@reservamos/browser-analytics 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
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(X){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(X){}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 d=i&&toLowerCase(i);return(t[n.toLowerCase()]||d&&t[d])&&(c=a?a(c,e):"*".repeat(c.length)),c}function toLowerCase(e){return e.toLowerCase()}const 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-_:]");function genId(){return i++}let a,c;const d=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,u=/^(?:[a-z+]+:)?\/\//i,l=/^www\..*/i,p=/^(data:)([^,]*),(.*)/i;function absoluteToStylesheet(e,t){return(e||"").replace(d,((e,n,i,s,a,c)=>{const d=i||a||c,h=n||s||"";if(!d)return e;if(u.test(d)||l.test(d))return`url(${h}${d}${h})`;if(p.test(d))return`url(${h}${d}${h})`;if("/"===d[0])return`url(${h}${function extractOrigin(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+d}${h})`;const f=t.split("/"),m=d.split("/");f.pop();for(const t of m)"."!==t&&(".."===t?f.pop():f.push(t));return`url(${h}${f.join("/")}${h})`}))}const h=/^[^ \t\n\r\u000c]+/,f=/^[, \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(f),!(n>=t.length);){let s=collectCharacters(h);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:d,mirror:u,blockClass:l,blockSelector:p,needsMask:h,inlineStylesheet:f,maskInputOptions:m={},maskTextFn:g,maskInputFn:_,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}(d,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:d,blockClass:u,blockSelector:l,inlineStylesheet:p,maskInputOptions:h={},maskInputFn:f,dataURLOptions:m={},inlineImages:g,recordCanvas:_,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,l),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 x=t.attributes.length;for(let e=0;e<x;e++){const n=t.attributes[e];ignoreAttribute(w,n.name,n.value)||(I[n.name]=transformAttribute(d,w,toLowerCase(n.name),n.value))}if("link"===w&&p){const e=Array.from(d.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&&_)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(m.type,m.quality));else if(!("__context"in t)){const e=t.toDataURL(m.type,m.quality),n=document.createElement("canvas");n.width=t.width,n.height=t.height;e!==n.toDataURL(m.type,m.quality)&&(I.rr_dataURL=e)}if("img"===w&&g){a||(a=d.createElement("canvas"),c=a.getContext("2d"));const e=t,n=e.crossOrigin;e.crossOrigin="anonymous";const recordInlineImage=()=>{e.removeEventListener("load",recordInlineImage);try{a.width=e.naturalWidth,a.height=e.naturalHeight,c.drawImage(e,0,0),I.rr_dataURL=a.toDataURL(m.type,m.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(O){}return{type:e.Element,tagName:w,attributes:I,childNodes:[],isSVG:isSVGElement(t)||void 0,needBlock:S,rootId:b,isCustom:C}}(t,{doc:d,blockClass:l,blockSelector:p,inlineStylesheet:f,maskInputOptions:m,maskInputFn:_,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,d=t.parentNode&&t.parentNode.tagName;let u=t.textContent;const l="STYLE"===d||void 0,p="SCRIPT"===d||void 0;if(l&&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())}p&&(u="SCRIPT_PLACEHOLDER");!l&&!p&&u&&s&&(u=a?a(u,t.parentElement):u.replace(/[\S]/g,"*"));return{type:e.Text,textContent:u||"",isStyle:l,rootId:c}}(t,{needsMask:h,maskTextFn:g,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:a,blockSelector:c,maskTextClass:d,maskTextSelector:u,skipChild:l=!1,inlineStylesheet:p=!0,maskInputOptions:h={},maskTextFn:f,maskInputFn:m,slimDOMOptions:g,dataURLOptions:_={},inlineImages:y=!1,recordCanvas:v=!1,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w=5e3,onStylesheetLoad:I,stylesheetLoadTimeout:x=5e3,keepIframeSrcFn:C=()=>!1,newlyAddedElement:O=!1}=n;let{needsMask:T}=n,{preserveWhiteSpace:R=!0}=n;if(!T&&t.childNodes){T=needMaskingText(t,d,u,void 0===T)}const N=serializeNode(t,{doc:i,mirror:s,blockClass:a,blockSelector:c,needsMask:T,inlineStylesheet:p,maskInputOptions:h,maskTextFn:f,maskInputFn:m,dataURLOptions:_,inlineImages:y,recordCanvas:v,keepIframeSrcFn:C,newlyAddedElement:O});if(!N)return console.warn(t,"not serialized"),null;let Z;Z=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}(N,g)&&(R||N.type!==e.Text||N.isStyle||N.textContent.replace(/^\s+|\s+$/gm,"").length)?genId():-2;const P=Object.assign(N,{id:Z});if(s.add(t,P),-2===Z)return null;b&&b(t);let D=!l;if(P.type===e.Element){D=D&&!P.needBlock,delete P.needBlock;const e=t.shadowRoot;e&&isNativeShadowDom(e)&&(P.isShadowHost=!0)}if((P.type===e.Document||P.type===e.Element)&&D){g.headWhitespace&&P.type===e.Element&&"head"===P.tagName&&(R=!1);const n={doc:i,mirror:s,blockClass:a,blockSelector:c,needsMask:T,maskTextClass:d,maskTextSelector:u,skipChild:l,inlineStylesheet:p,maskInputOptions:h,maskTextFn:f,maskInputFn:m,slimDOMOptions:g,dataURLOptions:_,inlineImages:y,recordCanvas:v,preserveWhiteSpace:R,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onStylesheetLoad:I,stylesheetLoadTimeout:x,keepIframeSrcFn:C};if(P.type===e.Element&&"textarea"===P.tagName&&void 0!==P.attributes.value);else for(const e of Array.from(t.childNodes)){const t=serializeNodeWithId(e,n);t&&P.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),P.childNodes.push(i))}}return t.parentNode&&isShadowRoot(t.parentNode)&&isNativeShadowDom(t.parentNode)&&(P.isShadow=!0),P.type===e.Element&&"iframe"===P.tagName&&function onceIframeLoaded(e,t,n){const i=e.contentWindow;if(!i)return;let s,a=!1;try{s=i.document.readyState}catch(X){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&&S){const n=serializeNodeWithId(e,{doc:e,mirror:s,blockClass:a,blockSelector:c,needsMask:T,maskTextClass:d,maskTextSelector:u,skipChild:!1,inlineStylesheet:p,maskInputOptions:h,maskTextFn:f,maskInputFn:m,slimDOMOptions:g,dataURLOptions:_,inlineImages:y,recordCanvas:v,preserveWhiteSpace:R,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onStylesheetLoad:I,stylesheetLoadTimeout:x,keepIframeSrcFn:C});n&&S(t,n)}}),w),P.type===e.Element&&"link"===P.tagName&&"string"==typeof P.attributes.rel&&("stylesheet"===P.attributes.rel||"preload"===P.attributes.rel&&"string"==typeof P.attributes.href&&"css"===extractFileExtension(P.attributes.href))&&function onceStylesheetLoaded(e,t,n){let i,s=!1;try{i=e.sheet}catch(X){return}if(i)return;const a=setTimeout((()=>{s||(t(),s=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(a),s=!0,t()}))}(t,(()=>{if(I){const e=serializeNodeWithId(t,{doc:i,mirror:s,blockClass:a,blockSelector:c,needsMask:T,maskTextClass:d,maskTextSelector:u,skipChild:!1,inlineStylesheet:p,maskInputOptions:h,maskTextFn:f,maskInputFn:m,slimDOMOptions:g,dataURLOptions:_,inlineImages:y,recordCanvas:v,preserveWhiteSpace:R,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onStylesheetLoad:I,stylesheetLoadTimeout:x,keepIframeSrcFn:C});e&&I(t,e)}}),x),P}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 d=t-(c-s),u=this;d<=0||d>t?(i&&(clearTimeout(i),i=null),s=c,e.apply(u,a)):i||!1===n.trailing||(i=setTimeout((()=>{s=!1===n.leading?0:Date.now(),i=null,e.apply(u,a)}),d))}}function hookSetter(e,t,n,i,s=window){const a=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,i?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),a&&a.set&&a.set.call(this,e)}}),()=>hookSetter(e,t,a||{},!0)}function patch(e,t,n){try{if(!(t in e))return()=>{};const i=e[t],s=n(i);return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i}})),e[t]=s,()=>{e[t]=i}}catch(i){return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(g=new Proxy(g,{get:(e,t,n)=>("map"===t&&console.error(m),Reflect.get(e,t,n))}));let _=Date.now;function getWindowScroll(e){var t,n,i,s,a,c;const d=e.document;return{left:d.scrollingElement?d.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==d?void 0:d.documentElement.scrollLeft)||(null===(n=null===(t=null==d?void 0:d.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(i=null==d?void 0:d.body)||void 0===i?void 0:i.scrollLeft)||0,top:d.scrollingElement?d.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==d?void 0:d.documentElement.scrollTop)||(null===(a=null===(s=null==d?void 0:d.body)||void 0===s?void 0:s.parentElement)||void 0===a?void 0:a.scrollTop)||(null===(c=null==d?void 0:d.body)||void 0===c?void 0:c.scrollTop)||0}}function getWindowHeight(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function getWindowWidth(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function closestElementOfNode(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}function isBlocked(e,t,n,i){if(!e)return!1;const s=closestElementOfNode(e);if(!s)return!1;try{if("string"==typeof t){if(s.classList.contains(t))return!0;if(i&&null!==s.closest("."+t))return!0}else if(classMatchesRegex(s,t,i))return!0}catch(a){}if(n){if(s.matches(n))return!0;if(i&&null!==s.closest(n))return!0}return!1}function isIgnored(e,t){return-2===t.getId(e)}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())||(_=()=>(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 y=(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))(y||{}),v=(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))(v||{}),b=(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))(b||{}),S=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(S||{}),w=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(w||{});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=-2;for(;-2===n;)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 I;const callbackWrapper=e=>{if(!I)return e;return(...t)=>{try{return e(...t)}catch(X){if(I&&!0===I(X))return;throw X}}},x=[];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;x.push(s),s.init(e);let a=window.MutationObserver||window.__rrMutationObserver;const c=null===(i=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===i?void 0:i.call(n,"MutationObserver");c&&window[c]&&(a=window[c]);const d=new a(callbackWrapper(s.processMutations.bind(s)));return d.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),d}function initMouseInteractionObserver({mouseInteractionCb:e,doc:t,mirror:n,blockClass:i,blockSelector:s,sampling:a}){if(!1===a.mouseInteraction)return()=>{};const c=!0===a.mouseInteraction||void 0===a.mouseInteraction?{}:a.mouseInteraction,d=[];let u=null;return Object.keys(b).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==c[e])).forEach((a=>{let c=toLowerCase(a);const l=(t=>a=>{const c=getEventTarget(a);if(isBlocked(c,i,s,!0))return;let d=null,l=t;if("pointerType"in a){switch(a.pointerType){case"mouse":d=S.Mouse;break;case"touch":d=S.Touch;break;case"pen":d=S.Pen}d===S.Touch?b[t]===b.MouseDown?l="TouchStart":b[t]===b.MouseUp&&(l="TouchEnd"):S.Pen}else legacy_isTouchEvent(a)&&(d=S.Touch);null!==d?(u=d,(l.startsWith("Touch")&&d===S.Touch||l.startsWith("Mouse")&&d===S.Mouse)&&(d=null)):b[t]===b.Click&&(d=u,u=null);const p=legacy_isTouchEvent(a)?a.changedTouches[0]:a;if(!p)return;const h=n.getId(c),{clientX:f,clientY:m}=p;callbackWrapper(e)(Object.assign({type:b[l],id:h,x:f,y:m},null!==d&&{pointerType:d}))})(a);if(window.PointerEvent)switch(b[a]){case b.MouseDown:case b.MouseUp:c=c.replace("mouse","pointer");break;case b.TouchStart:case b.TouchEnd:return}d.push(on(c,l,t))})),callbackWrapper((()=>{d.forEach((e=>e()))}))}function initScrollObserver({scrollCb:e,doc:t,mirror:n,blockClass:i,blockSelector:s,sampling:a}){return on("scroll",callbackWrapper(throttle(callbackWrapper((a=>{const c=getEventTarget(a);if(!c||isBlocked(c,i,s,!0))return;const d=n.getId(c);if(c===t&&t.defaultView){const n=getWindowScroll(t.defaultView);e({id:d,x:n.left,y:n.top})}else e({id:d,x:c.scrollLeft,y:c.scrollTop})})),a.scroll||100)),t)}const C=["INPUT","TEXTAREA","SELECT"],O=new WeakMap;function getNestedCSSRulePositions(e){return function recurse(e,t){if(hasNestedCSSRule("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||hasNestedCSSRule("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||hasNestedCSSRule("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||hasNestedCSSRule("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function getIdAndStyleId(e,t,n){let i,s;return e?(e.ownerNode?i=t.getId(e.ownerNode):s=n.getId(e),{styleId:s,id:i}):{}}function initAdoptedStyleSheetObserver({mirror:e,stylesheetManager:t},n){var i,s,a;let c=null;c="#document"===n.nodeName?e.getId(n):e.getId(n.host);const d="#document"===n.nodeName?null===(i=n.defaultView)||void 0===i?void 0:i.Document:null===(a=null===(s=n.ownerDocument)||void 0===s?void 0:s.defaultView)||void 0===a?void 0:a.ShadowRoot,u=(null==d?void 0:d.prototype)?Object.getOwnPropertyDescriptor(null==d?void 0:d.prototype,"adoptedStyleSheets"):void 0;return null!==c&&-1!==c&&d&&u?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get(){var e;return null===(e=u.get)||void 0===e?void 0:e.call(this)},set(e){var n;const i=null===(n=u.set)||void 0===n?void 0:n.call(this,e);if(null!==c&&-1!==c)try{t.adoptStyleSheets(e,c)}catch(s){}return i}}),callbackWrapper((()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})}))):()=>{}}function initObservers(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let i;!function mergeHooks(e,t){const{mutationCb:n,mousemoveCb:i,mouseInteractionCb:s,scrollCb:a,viewportResizeCb:c,inputCb:d,mediaInteractionCb:u,styleSheetRuleCb:l,styleDeclarationCb:p,canvasMutationCb:h,fontCb:f,selectionCb:m,customElementCb:g}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),i(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),s(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),a(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),c(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),d(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),u(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),l(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),p(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),h(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),f(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),m(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),g(...e)}}(e,t),e.recordDOM&&(i=initMutationObserver(e,e.doc));const s=function initMoveObserver({mousemoveCb:e,sampling:t,doc:n,mirror:i}){if(!1===t.mousemove)return()=>{};const s="number"==typeof t.mousemove?t.mousemove:50,a="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let c,d=[];const u=throttle(callbackWrapper((t=>{const n=Date.now()-c;e(d.map((e=>(e.timeOffset-=n,e))),t),d=[],c=null})),a),l=callbackWrapper(throttle(callbackWrapper((e=>{const t=getEventTarget(e),{clientX:n,clientY:s}=legacy_isTouchEvent(e)?e.changedTouches[0]:e;c||(c=_()),d.push({x:n,y:s,id:i.getId(t),timeOffset:_()-c}),u("undefined"!=typeof DragEvent&&e instanceof DragEvent?v.Drag:e instanceof MouseEvent?v.MouseMove:v.TouchMove)})),s,{trailing:!1})),p=[on("mousemove",l,n),on("touchmove",l,n),on("drag",l,n)];return callbackWrapper((()=>{p.forEach((e=>e()))}))}(e),a=initMouseInteractionObserver(e),c=initScrollObserver(e),d=function initViewportResizeObserver({viewportResizeCb:e},{win:t}){let n=-1,i=-1;return on("resize",callbackWrapper(throttle(callbackWrapper((()=>{const t=getWindowHeight(),s=getWindowWidth();n===t&&i===s||(e({width:Number(s),height:Number(t)}),n=t,i=s)})),200)),t)}(e,{win:n}),u=function initInputObserver({inputCb:e,doc:t,mirror:n,blockClass:i,blockSelector:s,ignoreClass:a,ignoreSelector:c,maskInputOptions:d,maskInputFn:u,sampling:l,userTriggeredOnInput:p}){function eventHandler(e){let n=getEventTarget(e);const l=e.isTrusted,h=n&&n.tagName;if(n&&"OPTION"===h&&(n=n.parentElement),!n||!h||C.indexOf(h)<0||isBlocked(n,i,s,!0))return;if(n.classList.contains(a)||c&&n.matches(c))return;let f=n.value,m=!1;const g=getInputType(n)||"";"radio"===g||"checkbox"===g?m=n.checked:(d[h.toLowerCase()]||d[g])&&(f=maskInputValue({element:n,maskInputOptions:d,tagName:h,type:g,value:f,maskInputFn:u})),cbWithDedup(n,p?{text:f,isChecked:m,userTriggered:l}:{text:f,isChecked:m});const _=n.name;"radio"===g&&_&&m&&t.querySelectorAll(`input[type="radio"][name="${_}"]`).forEach((e=>{if(e!==n){const t=e.value;cbWithDedup(e,p?{text:t,isChecked:!m,userTriggered:!1}:{text:t,isChecked:!m})}}))}function cbWithDedup(t,i){const s=O.get(t);if(!s||s.text!==i.text||s.isChecked!==i.isChecked){O.set(t,i);const s=n.getId(t);callbackWrapper(e)(Object.assign(Object.assign({},i),{id:s}))}}const h=("last"===l.input?["change"]:["input","change"]).map((e=>on(e,callbackWrapper(eventHandler),t))),f=t.defaultView;if(!f)return()=>{h.forEach((e=>e()))};const m=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),g=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&h.push(...g.map((e=>hookSetter(e[0],e[1],{set(){callbackWrapper(eventHandler)({target:this,isTrusted:!1})}},!1,f)))),callbackWrapper((()=>{h.forEach((e=>e()))}))}(e),l=function initMediaInteractionObserver({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:i,sampling:s,doc:a}){const c=callbackWrapper((a=>throttle(callbackWrapper((s=>{const c=getEventTarget(s);if(!c||isBlocked(c,t,n,!0))return;const{currentTime:d,volume:u,muted:l,playbackRate:p,loop:h}=c;e({type:a,id:i.getId(c),currentTime:d,volume:u,muted:l,playbackRate:p,loop:h})})),s.media||500))),d=[on("play",c(0),a),on("pause",c(1),a),on("seeked",c(2),a),on("volumechange",c(3),a),on("ratechange",c(4),a)];return callbackWrapper((()=>{d.forEach((e=>e()))}))}(e);let styleSheetObserver=()=>{},adoptedStyleSheetObserver=()=>{},styleDeclarationObserver=()=>{},fontObserver=()=>{};e.recordDOM&&(styleSheetObserver=function initStyleSheetObserver({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:i}){if(!i.CSSStyleSheet||!i.CSSStyleSheet.prototype)return()=>{};const s=i.CSSStyleSheet.prototype.insertRule;i.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:callbackWrapper(((i,s,a)=>{const[c,d]=a,{id:u,styleId:l}=getIdAndStyleId(s,t,n.styleMirror);return(u&&-1!==u||l&&-1!==l)&&e({id:u,styleId:l,adds:[{rule:c,index:d}]}),i.apply(s,a)}))});const a=i.CSSStyleSheet.prototype.deleteRule;let c,d;i.CSSStyleSheet.prototype.deleteRule=new Proxy(a,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:d,styleId:u}=getIdAndStyleId(s,t,n.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,removes:[{index:c}]}),i.apply(s,a)}))}),i.CSSStyleSheet.prototype.replace&&(c=i.CSSStyleSheet.prototype.replace,i.CSSStyleSheet.prototype.replace=new Proxy(c,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:d,styleId:u}=getIdAndStyleId(s,t,n.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,replace:c}),i.apply(s,a)}))})),i.CSSStyleSheet.prototype.replaceSync&&(d=i.CSSStyleSheet.prototype.replaceSync,i.CSSStyleSheet.prototype.replaceSync=new Proxy(d,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:d,styleId:u}=getIdAndStyleId(s,t,n.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,replaceSync:c}),i.apply(s,a)}))}));const u={};canMonkeyPatchNestedCSSRule("CSSGroupingRule")?u.CSSGroupingRule=i.CSSGroupingRule:(canMonkeyPatchNestedCSSRule("CSSMediaRule")&&(u.CSSMediaRule=i.CSSMediaRule),canMonkeyPatchNestedCSSRule("CSSConditionRule")&&(u.CSSConditionRule=i.CSSConditionRule),canMonkeyPatchNestedCSSRule("CSSSupportsRule")&&(u.CSSSupportsRule=i.CSSSupportsRule));const l={};return Object.entries(u).forEach((([i,s])=>{l[i]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(l[i].insertRule,{apply:callbackWrapper(((i,s,a)=>{const[c,d]=a,{id:u,styleId:l}=getIdAndStyleId(s.parentStyleSheet,t,n.styleMirror);return(u&&-1!==u||l&&-1!==l)&&e({id:u,styleId:l,adds:[{rule:c,index:[...getNestedCSSRulePositions(s),d||0]}]}),i.apply(s,a)}))}),s.prototype.deleteRule=new Proxy(l[i].deleteRule,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:d,styleId:u}=getIdAndStyleId(s.parentStyleSheet,t,n.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,removes:[{index:[...getNestedCSSRulePositions(s),c]}]}),i.apply(s,a)}))})})),callbackWrapper((()=>{i.CSSStyleSheet.prototype.insertRule=s,i.CSSStyleSheet.prototype.deleteRule=a,c&&(i.CSSStyleSheet.prototype.replace=c),d&&(i.CSSStyleSheet.prototype.replaceSync=d),Object.entries(u).forEach((([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule}))}))}(e,{win:n}),adoptedStyleSheetObserver=initAdoptedStyleSheetObserver(e,e.doc),styleDeclarationObserver=function initStyleDeclarationObserver({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:i},{win:s}){const a=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:callbackWrapper(((s,c,d)=>{var u;const[l,p,h]=d;if(n.has(l))return a.apply(c,[l,p,h]);const{id:f,styleId:m}=getIdAndStyleId(null===(u=c.parentRule)||void 0===u?void 0:u.parentStyleSheet,t,i.styleMirror);return(f&&-1!==f||m&&-1!==m)&&e({id:f,styleId:m,set:{property:l,value:p,priority:h},index:getNestedCSSRulePositions(c.parentRule)}),s.apply(c,d)}))});const c=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(c,{apply:callbackWrapper(((s,a,d)=>{var u;const[l]=d;if(n.has(l))return c.apply(a,[l]);const{id:p,styleId:h}=getIdAndStyleId(null===(u=a.parentRule)||void 0===u?void 0:u.parentStyleSheet,t,i.styleMirror);return(p&&-1!==p||h&&-1!==h)&&e({id:p,styleId:h,remove:{property:l},index:getNestedCSSRulePositions(a.parentRule)}),s.apply(a,d)}))}),callbackWrapper((()=>{s.CSSStyleDeclaration.prototype.setProperty=a,s.CSSStyleDeclaration.prototype.removeProperty=c}))}(e,{win:n}),e.collectFonts&&(fontObserver=function initFontObserver({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const i=[],s=new WeakMap,a=n.FontFace;n.FontFace=function FontFace(e,t,n){const i=new a(e,t,n);return s.set(i,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),i};const c=patch(t.fonts,"add",(function(t){return function(n){return setTimeout(callbackWrapper((()=>{const t=s.get(n);t&&(e(t),s.delete(n))})),0),t.apply(this,[n])}}));return i.push((()=>{n.FontFace=a})),i.push(c),callbackWrapper((()=>{i.forEach((e=>e()))}))}(e)));const p=function initSelectionObserver(e){const{doc:t,mirror:n,blockClass:i,blockSelector:s,selectionCb:a}=e;let c=!0;const d=callbackWrapper((()=>{const e=t.getSelection();if(!e||c&&(null==e?void 0:e.isCollapsed))return;c=e.isCollapsed||!1;const d=[],u=e.rangeCount||0;for(let t=0;t<u;t++){const a=e.getRangeAt(t),{startContainer:c,startOffset:u,endContainer:l,endOffset:p}=a;isBlocked(c,i,s,!0)||isBlocked(l,i,s,!0)||d.push({start:n.getId(c),startOffset:u,end:n.getId(l),endOffset:p})}a({ranges:d})}));return d(),on("selectionchange",d)}(e),h=function initCustomElementObserver({doc:e,customElementCb:t}){const n=e.defaultView;return n&&n.customElements?patch(n.customElements,"define",(function(e){return function(n,i,s){try{t({define:{name:n}})}catch(a){console.warn(`Custom element callback failed for ${n}`)}return e.apply(this,[n,i,s])}})):()=>{}}(e),f=[];for(const m of e.plugins)f.push(m.observer(m.callback,n,m.options));return callbackWrapper((()=>{x.forEach((e=>e.reset())),null==i||i.disconnect(),s(),a(),c(),d(),u(),l(),styleSheetObserver(),adoptedStyleSheetObserver(),styleDeclarationObserver(),fontObserver(),p(),h(),f.forEach((e=>e()))}))}function hasNestedCSSRule(e){return void 0!==window[e]}function canMonkeyPatchNestedCSSRule(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class CrossOriginIframeMirror{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,i){const s=n||this.getIdToRemoteIdMap(e),a=i||this.getRemoteIdToIdMap(e);let c=s.get(t);return c||(c=this.generateIdFn(),s.set(t,c),a.set(c,t)),c}getIds(e,t){const n=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,i)))}getRemoteId(e,t,n){const i=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const s=i.get(t);return s||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,n)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class IframeManager{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new CrossOriginIframeMirror(genId),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new CrossOriginIframeMirror(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const i=this.transformCrossOriginEvent(n,t.data.event);i&&this.wrappedEmit(i,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case y.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:y.IncrementalSnapshot,data:{source:v.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case y.Meta:case y.Load:case y.DomContentLoaded:return!1;case y.Plugin:return t;case y.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case y.IncrementalSnapshot:switch(t.data.source){case v.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 v.Drag:case v.TouchMove:case v.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case v.ViewportResize:return!1;case v.MediaInteraction:case v.MouseInteraction:case v.Scroll:case v.CanvasMutation:case v.Input:return this.replaceIds(t.data,e,["id"]),t;case v.StyleSheetRule:case v.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case v.Font:return t;case v.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case v.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}}
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(Q){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(Q){}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 d=i&&toLowerCase(i);return(t[n.toLowerCase()]||d&&t[d])&&(c=a?a(c,e):"*".repeat(c.length)),c}function toLowerCase(e){return e.toLowerCase()}const 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,d;const u=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,l=/^(?:[a-z+]+:)?\/\//i,p=/^www\..*/i,h=/^(data:)([^,]*),(.*)/i;function absoluteToStylesheet(e,t){return(e||"").replace(u,((e,n,i,s,a,c)=>{const d=i||a||c,u=n||s||"";if(!d)return e;if(l.test(d)||p.test(d))return`url(${u}${d}${u})`;if(h.test(d))return`url(${u}${d}${u})`;if("/"===d[0])return`url(${u}${function extractOrigin(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+d}${u})`;const f=t.split("/"),m=d.split("/");f.pop();for(const t of m)"."!==t&&(".."===t?f.pop():f.push(t));return`url(${u}${f.join("/")}${u})`}))}const f=/^[^ \t\n\r\u000c]+/,m=/^[, \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(m),!(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:l,blockSelector:p,needsMask:h,inlineStylesheet:f,maskInputOptions:m={},maskTextFn:g,maskInputFn:_,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:l,inlineStylesheet:p,maskInputOptions:h={},maskInputFn:f,dataURLOptions:m={},inlineImages:g,recordCanvas:_,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,l),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 x=t.attributes.length;for(let e=0;e<x;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&&p){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&&_)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(m.type,m.quality));else if(!("__context"in t)){const e=t.toDataURL(m.type,m.quality),n=document.createElement("canvas");n.width=t.width,n.height=t.height;e!==n.toDataURL(m.type,m.quality)&&(I.rr_dataURL=e)}if("img"===w&&g){c||(c=a.createElement("canvas"),d=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,d.drawImage(e,0,0),I.rr_dataURL=c.toDataURL(m.type,m.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(O){}return{type:e.Element,tagName:w,attributes:I,childNodes:[],isSVG:isSVGElement(t)||void 0,needBlock:S,rootId:b,isCustom:C}}(t,{doc:a,blockClass:l,blockSelector:p,inlineStylesheet:f,maskInputOptions:m,maskInputFn:_,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,d=t.parentNode&&t.parentNode.tagName;let u=t.textContent;const l="STYLE"===d||void 0,p="SCRIPT"===d||void 0;if(l&&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())}p&&(u="SCRIPT_PLACEHOLDER");!l&&!p&&u&&s&&(u=a?a(u,t.parentElement):u.replace(/[\S]/g,"*"));return{type:e.Text,textContent:u||"",isStyle:l,rootId:c}}(t,{needsMask:h,maskTextFn:g,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:d,maskTextClass:u,maskTextSelector:l,skipChild:p=!1,inlineStylesheet:h=!0,maskInputOptions:f={},maskTextFn:m,maskInputFn:g,slimDOMOptions:_,dataURLOptions:y={},inlineImages:v=!1,recordCanvas:b=!1,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:I=5e3,onStylesheetLoad:x,stylesheetLoadTimeout:C=5e3,keepIframeSrcFn:O=()=>!1,newlyAddedElement:T=!1}=n;let{needsMask:R}=n,{preserveWhiteSpace:N=!0}=n;if(!R&&t.childNodes){R=needMaskingText(t,u,l,void 0===R)}const Z=serializeNode(t,{doc:i,mirror:s,blockClass:c,blockSelector:d,needsMask:R,inlineStylesheet:h,maskInputOptions:f,maskTextFn:m,maskInputFn:g,dataURLOptions:y,inlineImages:v,recordCanvas:b,keepIframeSrcFn:O,newlyAddedElement:T});if(!Z)return console.warn(t,"not serialized"),null;let P;P=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}(Z,_)&&(N||Z.type!==e.Text||Z.isStyle||Z.textContent.replace(/^\s+|\s+$/gm,"").length)?genId():a;const D=Object.assign(Z,{id:P});if(s.add(t,D),P===a)return null;S&&S(t);let A=!p;if(D.type===e.Element){A=A&&!D.needBlock,delete D.needBlock;const e=t.shadowRoot;e&&isNativeShadowDom(e)&&(D.isShadowHost=!0)}if((D.type===e.Document||D.type===e.Element)&&A){_.headWhitespace&&D.type===e.Element&&"head"===D.tagName&&(N=!1);const n={doc:i,mirror:s,blockClass:c,blockSelector:d,needsMask:R,maskTextClass:u,maskTextSelector:l,skipChild:p,inlineStylesheet:h,maskInputOptions:f,maskTextFn:m,maskInputFn:g,slimDOMOptions:_,dataURLOptions:y,inlineImages:v,recordCanvas:b,preserveWhiteSpace:N,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:I,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:O};if(D.type===e.Element&&"textarea"===D.tagName&&void 0!==D.attributes.value);else for(const e of Array.from(t.childNodes)){const t=serializeNodeWithId(e,n);t&&D.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),D.childNodes.push(i))}}return t.parentNode&&isShadowRoot(t.parentNode)&&isNativeShadowDom(t.parentNode)&&(D.isShadow=!0),D.type===e.Element&&"iframe"===D.tagName&&function onceIframeLoaded(e,t,n){const i=e.contentWindow;if(!i)return;let s,a=!1;try{s=i.document.readyState}catch(Q){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:d,needsMask:R,maskTextClass:u,maskTextSelector:l,skipChild:!1,inlineStylesheet:h,maskInputOptions:f,maskTextFn:m,maskInputFn:g,slimDOMOptions:_,dataURLOptions:y,inlineImages:v,recordCanvas:b,preserveWhiteSpace:N,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:I,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:O});n&&w(t,n)}}),I),D.type===e.Element&&"link"===D.tagName&&"string"==typeof D.attributes.rel&&("stylesheet"===D.attributes.rel||"preload"===D.attributes.rel&&"string"==typeof D.attributes.href&&"css"===extractFileExtension(D.attributes.href))&&function onceStylesheetLoaded(e,t,n){let i,s=!1;try{i=e.sheet}catch(Q){return}if(i)return;const a=setTimeout((()=>{s||(t(),s=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(a),s=!0,t()}))}(t,(()=>{if(x){const e=serializeNodeWithId(t,{doc:i,mirror:s,blockClass:c,blockSelector:d,needsMask:R,maskTextClass:u,maskTextSelector:l,skipChild:!1,inlineStylesheet:h,maskInputOptions:f,maskTextFn:m,maskInputFn:g,slimDOMOptions:_,dataURLOptions:y,inlineImages:v,recordCanvas:b,preserveWhiteSpace:N,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:I,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:O});e&&x(t,e)}}),C),D}function on(e,t,n=document){const i={capture:!0,passive:!0};return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}const g="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 _={map:{},getId:()=>(console.error(g),-1),getNode:()=>(console.error(g),null),removeNodeFromMap(){console.error(g)},has:()=>(console.error(g),!1),reset(){console.error(g)}};function throttle(e,t,n={}){let i=null,s=0;return function(...a){const c=Date.now();s||!1!==n.leading||(s=c);const d=t-(c-s),u=this;d<=0||d>t?(i&&(clearTimeout(i),i=null),s=c,e.apply(u,a)):i||!1===n.trailing||(i=setTimeout((()=>{s=!1===n.leading?0:Date.now(),i=null,e.apply(u,a)}),d))}}function hookSetter(e,t,n,i,s=window){const a=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,i?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),a&&a.set&&a.set.call(this,e)}}),()=>hookSetter(e,t,a||{},!0)}function patch(e,t,n){try{if(!(t in e))return()=>{};const i=e[t],s=n(i);return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i}})),e[t]=s,()=>{e[t]=i}}catch(i){return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(_=new Proxy(_,{get:(e,t,n)=>("map"===t&&console.error(g),Reflect.get(e,t,n))}));let y=Date.now;function getWindowScroll(e){var t,n,i,s,a,c;const d=e.document;return{left:d.scrollingElement?d.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==d?void 0:d.documentElement.scrollLeft)||(null===(n=null===(t=null==d?void 0:d.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(i=null==d?void 0:d.body)||void 0===i?void 0:i.scrollLeft)||0,top:d.scrollingElement?d.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==d?void 0:d.documentElement.scrollTop)||(null===(a=null===(s=null==d?void 0:d.body)||void 0===s?void 0:s.parentElement)||void 0===a?void 0:a.scrollTop)||(null===(c=null==d?void 0:d.body)||void 0===c?void 0:c.scrollTop)||0}}function getWindowHeight(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function getWindowWidth(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function closestElementOfNode(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}function isBlocked(e,t,n,i){if(!e)return!1;const s=closestElementOfNode(e);if(!s)return!1;try{if("string"==typeof t){if(s.classList.contains(t))return!0;if(i&&null!==s.closest("."+t))return!0}else if(classMatchesRegex(s,t,i))return!0}catch(a){}if(n){if(s.matches(n))return!0;if(i&&null!==s.closest(n))return!0}return!1}function isIgnored(e,t){return t.getId(e)===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 x;const callbackWrapper=e=>{if(!x)return e;return(...t)=>{try{return e(...t)}catch(Q){if(x&&!0===x(Q))return;throw Q}}},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 d=new a(callbackWrapper(s.processMutations.bind(s)));return d.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),d}function initMouseInteractionObserver({mouseInteractionCb:e,doc:t,mirror:n,blockClass:i,blockSelector:s,sampling:a}){if(!1===a.mouseInteraction)return()=>{};const c=!0===a.mouseInteraction||void 0===a.mouseInteraction?{}:a.mouseInteraction,d=[];let u=null;return Object.keys(S).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==c[e])).forEach((a=>{let c=toLowerCase(a);const l=(t=>a=>{const c=getEventTarget(a);if(isBlocked(c,i,s,!0))return;let d=null,l=t;if("pointerType"in a){switch(a.pointerType){case"mouse":d=w.Mouse;break;case"touch":d=w.Touch;break;case"pen":d=w.Pen}d===w.Touch?S[t]===S.MouseDown?l="TouchStart":S[t]===S.MouseUp&&(l="TouchEnd"):w.Pen}else legacy_isTouchEvent(a)&&(d=w.Touch);null!==d?(u=d,(l.startsWith("Touch")&&d===w.Touch||l.startsWith("Mouse")&&d===w.Mouse)&&(d=null)):S[t]===S.Click&&(d=u,u=null);const p=legacy_isTouchEvent(a)?a.changedTouches[0]:a;if(!p)return;const h=n.getId(c),{clientX:f,clientY:m}=p;callbackWrapper(e)(Object.assign({type:S[l],id:h,x:f,y:m},null!==d&&{pointerType:d}))})(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}d.push(on(c,l,t))})),callbackWrapper((()=>{d.forEach((e=>e()))}))}function initScrollObserver({scrollCb:e,doc:t,mirror:n,blockClass:i,blockSelector:s,sampling:a}){return on("scroll",callbackWrapper(throttle(callbackWrapper((a=>{const c=getEventTarget(a);if(!c||isBlocked(c,i,s,!0))return;const d=n.getId(c);if(c===t&&t.defaultView){const n=getWindowScroll(t.defaultView);e({id:d,x:n.left,y:n.top})}else e({id:d,x:c.scrollLeft,y:c.scrollTop})})),a.scroll||100)),t)}const O=["INPUT","TEXTAREA","SELECT"],T=new WeakMap;function getNestedCSSRulePositions(e){return function recurse(e,t){if(hasNestedCSSRule("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||hasNestedCSSRule("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||hasNestedCSSRule("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||hasNestedCSSRule("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function getIdAndStyleId(e,t,n){let i,s;return e?(e.ownerNode?i=t.getId(e.ownerNode):s=n.getId(e),{styleId:s,id:i}):{}}function initAdoptedStyleSheetObserver({mirror:e,stylesheetManager:t},n){var i,s,a;let c=null;c="#document"===n.nodeName?e.getId(n):e.getId(n.host);const d="#document"===n.nodeName?null===(i=n.defaultView)||void 0===i?void 0:i.Document:null===(a=null===(s=n.ownerDocument)||void 0===s?void 0:s.defaultView)||void 0===a?void 0:a.ShadowRoot,u=(null==d?void 0:d.prototype)?Object.getOwnPropertyDescriptor(null==d?void 0:d.prototype,"adoptedStyleSheets"):void 0;return null!==c&&-1!==c&&d&&u?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get(){var e;return null===(e=u.get)||void 0===e?void 0:e.call(this)},set(e){var n;const i=null===(n=u.set)||void 0===n?void 0:n.call(this,e);if(null!==c&&-1!==c)try{t.adoptStyleSheets(e,c)}catch(s){}return i}}),callbackWrapper((()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})}))):()=>{}}function initObservers(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let i;!function mergeHooks(e,t){const{mutationCb:n,mousemoveCb:i,mouseInteractionCb:s,scrollCb:a,viewportResizeCb:c,inputCb:d,mediaInteractionCb:u,styleSheetRuleCb:l,styleDeclarationCb:p,canvasMutationCb:h,fontCb:f,selectionCb:m,customElementCb:g}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),i(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),s(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),a(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),c(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),d(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),u(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),l(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),p(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),h(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),f(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),m(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),g(...e)}}(e,t),e.recordDOM&&(i=initMutationObserver(e,e.doc));const s=function initMoveObserver({mousemoveCb:e,sampling:t,doc:n,mirror:i}){if(!1===t.mousemove)return()=>{};const s="number"==typeof t.mousemove?t.mousemove:50,a="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let c,d=[];const u=throttle(callbackWrapper((t=>{const n=Date.now()-c;e(d.map((e=>(e.timeOffset-=n,e))),t),d=[],c=null})),a),l=callbackWrapper(throttle(callbackWrapper((e=>{const t=getEventTarget(e),{clientX:n,clientY:s}=legacy_isTouchEvent(e)?e.changedTouches[0]:e;c||(c=y()),d.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})),p=[on("mousemove",l,n),on("touchmove",l,n),on("drag",l,n)];return callbackWrapper((()=>{p.forEach((e=>e()))}))}(e),a=initMouseInteractionObserver(e),c=initScrollObserver(e),d=function initViewportResizeObserver({viewportResizeCb:e},{win:t}){let n=-1,i=-1;return on("resize",callbackWrapper(throttle(callbackWrapper((()=>{const t=getWindowHeight(),s=getWindowWidth();n===t&&i===s||(e({width:Number(s),height:Number(t)}),n=t,i=s)})),200)),t)}(e,{win:n}),u=function initInputObserver({inputCb:e,doc:t,mirror:n,blockClass:i,blockSelector:s,ignoreClass:a,ignoreSelector:c,maskInputOptions:d,maskInputFn:u,sampling:l,userTriggeredOnInput:p}){function eventHandler(e){let n=getEventTarget(e);const l=e.isTrusted,h=n&&n.tagName;if(n&&"OPTION"===h&&(n=n.parentElement),!n||!h||O.indexOf(h)<0||isBlocked(n,i,s,!0))return;if(n.classList.contains(a)||c&&n.matches(c))return;let f=n.value,m=!1;const g=getInputType(n)||"";"radio"===g||"checkbox"===g?m=n.checked:(d[h.toLowerCase()]||d[g])&&(f=maskInputValue({element:n,maskInputOptions:d,tagName:h,type:g,value:f,maskInputFn:u})),cbWithDedup(n,p?{text:f,isChecked:m,userTriggered:l}:{text:f,isChecked:m});const _=n.name;"radio"===g&&_&&m&&t.querySelectorAll(`input[type="radio"][name="${_}"]`).forEach((e=>{if(e!==n){const t=e.value;cbWithDedup(e,p?{text:t,isChecked:!m,userTriggered:!1}:{text:t,isChecked:!m})}}))}function cbWithDedup(t,i){const s=T.get(t);if(!s||s.text!==i.text||s.isChecked!==i.isChecked){T.set(t,i);const s=n.getId(t);callbackWrapper(e)(Object.assign(Object.assign({},i),{id:s}))}}const h=("last"===l.input?["change"]:["input","change"]).map((e=>on(e,callbackWrapper(eventHandler),t))),f=t.defaultView;if(!f)return()=>{h.forEach((e=>e()))};const m=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),g=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&h.push(...g.map((e=>hookSetter(e[0],e[1],{set(){callbackWrapper(eventHandler)({target:this,isTrusted:!1})}},!1,f)))),callbackWrapper((()=>{h.forEach((e=>e()))}))}(e),l=function initMediaInteractionObserver({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:i,sampling:s,doc:a}){const c=callbackWrapper((a=>throttle(callbackWrapper((s=>{const c=getEventTarget(s);if(!c||isBlocked(c,t,n,!0))return;const{currentTime:d,volume:u,muted:l,playbackRate:p,loop:h}=c;e({type:a,id:i.getId(c),currentTime:d,volume:u,muted:l,playbackRate:p,loop:h})})),s.media||500))),d=[on("play",c(0),a),on("pause",c(1),a),on("seeked",c(2),a),on("volumechange",c(3),a),on("ratechange",c(4),a)];return callbackWrapper((()=>{d.forEach((e=>e()))}))}(e);let styleSheetObserver=()=>{},adoptedStyleSheetObserver=()=>{},styleDeclarationObserver=()=>{},fontObserver=()=>{};e.recordDOM&&(styleSheetObserver=function initStyleSheetObserver({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:i}){if(!i.CSSStyleSheet||!i.CSSStyleSheet.prototype)return()=>{};const s=i.CSSStyleSheet.prototype.insertRule;i.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:callbackWrapper(((i,s,a)=>{const[c,d]=a,{id:u,styleId:l}=getIdAndStyleId(s,t,n.styleMirror);return(u&&-1!==u||l&&-1!==l)&&e({id:u,styleId:l,adds:[{rule:c,index:d}]}),i.apply(s,a)}))});const a=i.CSSStyleSheet.prototype.deleteRule;let c,d;i.CSSStyleSheet.prototype.deleteRule=new Proxy(a,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:d,styleId:u}=getIdAndStyleId(s,t,n.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,removes:[{index:c}]}),i.apply(s,a)}))}),i.CSSStyleSheet.prototype.replace&&(c=i.CSSStyleSheet.prototype.replace,i.CSSStyleSheet.prototype.replace=new Proxy(c,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:d,styleId:u}=getIdAndStyleId(s,t,n.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,replace:c}),i.apply(s,a)}))})),i.CSSStyleSheet.prototype.replaceSync&&(d=i.CSSStyleSheet.prototype.replaceSync,i.CSSStyleSheet.prototype.replaceSync=new Proxy(d,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:d,styleId:u}=getIdAndStyleId(s,t,n.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,replaceSync:c}),i.apply(s,a)}))}));const u={};canMonkeyPatchNestedCSSRule("CSSGroupingRule")?u.CSSGroupingRule=i.CSSGroupingRule:(canMonkeyPatchNestedCSSRule("CSSMediaRule")&&(u.CSSMediaRule=i.CSSMediaRule),canMonkeyPatchNestedCSSRule("CSSConditionRule")&&(u.CSSConditionRule=i.CSSConditionRule),canMonkeyPatchNestedCSSRule("CSSSupportsRule")&&(u.CSSSupportsRule=i.CSSSupportsRule));const l={};return Object.entries(u).forEach((([i,s])=>{l[i]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(l[i].insertRule,{apply:callbackWrapper(((i,s,a)=>{const[c,d]=a,{id:u,styleId:l}=getIdAndStyleId(s.parentStyleSheet,t,n.styleMirror);return(u&&-1!==u||l&&-1!==l)&&e({id:u,styleId:l,adds:[{rule:c,index:[...getNestedCSSRulePositions(s),d||0]}]}),i.apply(s,a)}))}),s.prototype.deleteRule=new Proxy(l[i].deleteRule,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:d,styleId:u}=getIdAndStyleId(s.parentStyleSheet,t,n.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,removes:[{index:[...getNestedCSSRulePositions(s),c]}]}),i.apply(s,a)}))})})),callbackWrapper((()=>{i.CSSStyleSheet.prototype.insertRule=s,i.CSSStyleSheet.prototype.deleteRule=a,c&&(i.CSSStyleSheet.prototype.replace=c),d&&(i.CSSStyleSheet.prototype.replaceSync=d),Object.entries(u).forEach((([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule}))}))}(e,{win:n}),adoptedStyleSheetObserver=initAdoptedStyleSheetObserver(e,e.doc),styleDeclarationObserver=function initStyleDeclarationObserver({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:i},{win:s}){const a=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:callbackWrapper(((s,c,d)=>{var u;const[l,p,h]=d;if(n.has(l))return a.apply(c,[l,p,h]);const{id:f,styleId:m}=getIdAndStyleId(null===(u=c.parentRule)||void 0===u?void 0:u.parentStyleSheet,t,i.styleMirror);return(f&&-1!==f||m&&-1!==m)&&e({id:f,styleId:m,set:{property:l,value:p,priority:h},index:getNestedCSSRulePositions(c.parentRule)}),s.apply(c,d)}))});const c=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(c,{apply:callbackWrapper(((s,a,d)=>{var u;const[l]=d;if(n.has(l))return c.apply(a,[l]);const{id:p,styleId:h}=getIdAndStyleId(null===(u=a.parentRule)||void 0===u?void 0:u.parentStyleSheet,t,i.styleMirror);return(p&&-1!==p||h&&-1!==h)&&e({id:p,styleId:h,remove:{property:l},index:getNestedCSSRulePositions(a.parentRule)}),s.apply(a,d)}))}),callbackWrapper((()=>{s.CSSStyleDeclaration.prototype.setProperty=a,s.CSSStyleDeclaration.prototype.removeProperty=c}))}(e,{win:n}),e.collectFonts&&(fontObserver=function initFontObserver({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const i=[],s=new WeakMap,a=n.FontFace;n.FontFace=function FontFace(e,t,n){const i=new a(e,t,n);return s.set(i,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),i};const c=patch(t.fonts,"add",(function(t){return function(n){return setTimeout(callbackWrapper((()=>{const t=s.get(n);t&&(e(t),s.delete(n))})),0),t.apply(this,[n])}}));return i.push((()=>{n.FontFace=a})),i.push(c),callbackWrapper((()=>{i.forEach((e=>e()))}))}(e)));const p=function initSelectionObserver(e){const{doc:t,mirror:n,blockClass:i,blockSelector:s,selectionCb:a}=e;let c=!0;const d=callbackWrapper((()=>{const e=t.getSelection();if(!e||c&&(null==e?void 0:e.isCollapsed))return;c=e.isCollapsed||!1;const d=[],u=e.rangeCount||0;for(let t=0;t<u;t++){const a=e.getRangeAt(t),{startContainer:c,startOffset:u,endContainer:l,endOffset:p}=a;isBlocked(c,i,s,!0)||isBlocked(l,i,s,!0)||d.push({start:n.getId(c),startOffset:u,end:n.getId(l),endOffset:p})}a({ranges:d})}));return d(),on("selectionchange",d)}(e),h=function initCustomElementObserver({doc:e,customElementCb:t}){const n=e.defaultView;return n&&n.customElements?patch(n.customElements,"define",(function(e){return function(n,i,s){try{t({define:{name:n}})}catch(a){console.warn(`Custom element callback failed for ${n}`)}return e.apply(this,[n,i,s])}})):()=>{}}(e),f=[];for(const m of e.plugins)f.push(m.observer(m.callback,n,m.options));return callbackWrapper((()=>{C.forEach((e=>e.reset())),null==i||i.disconnect(),s(),a(),c(),d(),u(),l(),styleSheetObserver(),adoptedStyleSheetObserver(),styleDeclarationObserver(),fontObserver(),p(),h(),f.forEach((e=>e()))}))}function hasNestedCSSRule(e){return void 0!==window[e]}function canMonkeyPatchNestedCSSRule(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class CrossOriginIframeMirror{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,i){const s=n||this.getIdToRemoteIdMap(e),a=i||this.getRemoteIdToIdMap(e);let c=s.get(t);return c||(c=this.generateIdFn(),s.set(t,c),a.set(c,t)),c}getIds(e,t){const n=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,i)))}getRemoteId(e,t,n){const i=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const s=i.get(t);return s||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,n)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class IframeManager{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new CrossOriginIframeMirror(genId),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new CrossOriginIframeMirror(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const i=this.transformCrossOriginEvent(n,t.data.event);i&&this.wrappedEmit(i,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case 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
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -12,7 +12,7 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
12
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */function __awaiter$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+/",R="undefined"==typeof Uint8Array?[]:new Uint8Array(256),N=0;N<64;N++)R[T.charCodeAt(N)]=N;const Z=new Map;const saveWebGLVar=(e,t,n)=>{if(!e||!isInstanceOfWebGLObject(e,t)&&"object"!=typeof e)return;const i=function variableListFor(e,t){let n=Z.get(e);return n||(n=new Map,Z.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 d=[],u=Object.getOwnPropertyNames(e);for(const p of u)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(p))try{if("function"!=typeof e[p])continue;const a=patch(e,p,(function(e){return function(...a){const d=e.apply(this,a);if(saveWebGLVar(d,c,this),"tagName"in this.canvas&&!isBlocked(this.canvas,i,s,!0)){const e=serializeArgs(a,c,this),i={type:t,property:p,args:e};n(this.canvas,i)}return d}}));d.push(a)}catch(l){const i=hookSetter(e,p,{set(e){n(this.canvas,{type:t,property:p,args:[e],setter:!0})}});d.push(i)}return d}var P=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(){
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 R="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",N="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Z=0;Z<64;Z++)N[R.charCodeAt(Z)]=Z;const P=new Map;const saveWebGLVar=(e,t,n)=>{if(!e||!isInstanceOfWebGLObject(e,t)&&"object"!=typeof e)return;const i=function variableListFor(e,t){let n=P.get(e);return n||(n=new Map,P.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+=R[n[t]>>2],s+=R[(3&n[t])<<4|n[t+1]>>4],s+=R[(15&n[t+1])<<2|n[t+2]>>6],s+=R[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 d=[],u=Object.getOwnPropertyNames(e);for(const p of u)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(p))try{if("function"!=typeof e[p])continue;const a=patch(e,p,(function(e){return function(...a){const d=e.apply(this,a);if(saveWebGLVar(d,c,this),"tagName"in this.canvas&&!isBlocked(this.canvas,i,s,!0)){const e=serializeArgs(a,c,this),i={type:t,property:p,args:e};n(this.canvas,i)}return d}}));d.push(a)}catch(l){const i=hookSetter(e,p,{set(e){n(this.canvas,{type:t,property:p,args:[e],setter:!0})}});d.push(i)}return d}var D=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
16
  /*! *****************************************************************************
17
17
  Copyright (c) Microsoft Corporation.
18
18
 
@@ -27,4 +27,4 @@ PERFORMANCE OF THIS SOFTWARE.
27
27
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28
28
  PERFORMANCE OF THIS SOFTWARE.
29
29
  ***************************************************************************** */
30
- function __awaiter2(e,t,n,i){return new(n||(n=Promise))((function(t,s){function fulfilled(e){try{step(i.next(e))}catch(t){s(t)}}function rejected(e){try{step(i.throw(e))}catch(t){s(t)}}function step(e){e.done?t(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((i=i.apply(e,[])).next())}))}for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),n=0;n<64;n++)t[e.charCodeAt(n)]=n;var encode2=function(t){var n,i=new Uint8Array(t),s=i.length,a="";for(n=0;n<s;n+=3)a+=e[i[n]>>2],a+=e[(3&i[n])<<4|i[n+1]>>4],a+=e[(15&i[n+1])<<2|i[n+2]>>6],a+=e[63&i[n+2]];return s%3==2?a=a.substring(0,a.length-1)+"=":s%3==1&&(a=a.substring(0,a.length-2)+"=="),a};const i=new Map,s=new Map;const a=self;a.onmessage=function(e){return __awaiter2(this,0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return a.postMessage({id:e.data.id});{const{id:t,bitmap:n,width:c,height:d,dataURLOptions:u}=e.data,l=function getTransparentBlobFor(e,t,n){return __awaiter2(this,0,void 0,(function*(){const i=`${e}-${t}`;if("OffscreenCanvas"in globalThis){if(s.has(i))return s.get(i);const a=new OffscreenCanvas(e,t);a.getContext("2d");const c=yield a.convertToBlob(n),d=yield c.arrayBuffer(),u=encode2(d);return s.set(i,u),u}return""}))}(c,d,u),p=new OffscreenCanvas(c,d);p.getContext("2d").drawImage(n,0,0),n.close();const h=yield p.convertToBlob(u),f=h.type,m=yield h.arrayBuffer(),g=encode2(m);if(!i.has(t)&&(yield l)===g)return i.set(t,g),a.postMessage({id:t});if(i.get(t)===g)return a.postMessage({id:t});a.postMessage({id:t,type:f,base64:g,width:c,height:d}),i.set(t,g)}}))}}()}));class CanvasManager{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:n,blockClass:i,blockSelector:s,recordCanvas:a,dataURLOptions:c}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&"all"===t&&this.initCanvasMutationObserver(n,i,s),a&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,i,s,{dataURLOptions:c})}initCanvasFPSObserver(e,t,n,i,s){const a=initCanvasContextObserver(t,n,i,!0),c=new Map,d=new P;d.onmessage=e=>{const{id:t}=e.data;if(c.set(t,!1),!("base64"in e.data))return;const{base64:n,type:i,width:s,height:a}=e.data;this.mutationCb({id:t,type:w["2D"],commands:[{property:"clearRect",args:[0,0,s,a]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:i}]},0,0]}]})};const u=1e3/e;let l,p=0;const takeCanvasSnapshots=e=>{p&&e-p<u||(p=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{isBlocked(t,n,i,!0)||e.push(t)})),e})().forEach((e=>__awaiter$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);d.postMessage({id:n,bitmap:i,width:e.width,height:e.height,dataURLOptions:s.dataURLOptions},[i])}))))),l=requestAnimationFrame(takeCanvasSnapshots)};l=requestAnimationFrame(takeCanvasSnapshots),this.resetObservers=()=>{a(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=initCanvasContextObserver(e,t,n,!1),s=function initCanvas2DMutationObserver(e,t,n,i){const s=[],a=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const d of a)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[d])continue;const a=patch(t.CanvasRenderingContext2D.prototype,d,(function(s){return function(...a){return isBlocked(this.canvas,n,i,!0)||setTimeout((()=>{const n=serializeArgs(a,t,this);e(this.canvas,{type:w["2D"],property:d,args:n})}),0),s.apply(this,a)}}));s.push(a)}catch(c){const n=hookSetter(t.CanvasRenderingContext2D.prototype,d,{set(t){e(this.canvas,{type:w["2D"],property:d,args:[t],setter:!0})}});s.push(n)}return()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),a=function initCanvasWebGLMutationObserver(e,t,n,i,s){const a=[];return a.push(...patchGLPrototype(t.WebGLRenderingContext.prototype,w.WebGL,e,n,i,0,t)),void 0!==t.WebGL2RenderingContext&&a.push(...patchGLPrototype(t.WebGL2RenderingContext.prototype,w.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:_()})}let D,A,L,j=!1;const q=function createMirror(){return new Mirror}();function record(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:i,blockClass:s="rr-block",blockSelector:a=null,ignoreClass:c="rr-ignore",ignoreSelector:d=null,maskTextClass:u="rr-mask",maskTextSelector:l=null,inlineStylesheet:p=!0,maskAllInputs:h,maskInputOptions:f,slimDOMOptions:m,maskInputFn:g,maskTextFn:_,hooks:b,packFn:S,sampling:w={},dataURLOptions:C={},mousemoveWait:O,recordDOM:T=!0,recordCanvas:R=!1,recordCrossOriginIframes:N=!1,recordAfter:Z=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:P=!1,collectFonts:U=!1,inlineImages:B=!1,plugins:$,keepIframeSrcFn:z=()=>!1,ignoreCSSAttributes:W=new Set([]),errorHandler:K}=e;!function registerErrorHandler(e){I=e}(K);const H=!N||window.parent===window;let G=!1;if(!H)try{window.parent.document&&(G=!1)}catch(oe){G=!0}if(H&&!t)throw new Error("emit function is required");void 0!==O&&void 0===w.mousemove&&(w.mousemove=O),q.reset();const J=!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},Y=!0===m||"all"===m?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===m,headMetaDescKeywords:"all"===m}:m||{};let Q;!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 $||[])t.eventProcessor&&(e=t.eventProcessor(e));return S&&!G&&(e=S(e)),e};D=(e,s)=>{var a;if(!(null===(a=x[0])||void 0===a?void 0:a.isFrozen())||e.type===y.FullSnapshot||e.type===y.IncrementalSnapshot&&e.data.source===v.Mutation||x.forEach((e=>e.unfreeze())),H)null==t||t(eventProcessor(e),s);else if(G){const t={type:"rrweb",event:eventProcessor(e),origin:window.location.origin,isCheckout:s};window.parent.postMessage(t,"*")}if(e.type===y.FullSnapshot)Q=e,ee=0;else if(e.type===y.IncrementalSnapshot){if(e.data.source===v.Mutation&&e.data.isAttachIframe)return;ee++;const t=i&&ee>=i,s=n&&e.timestamp-Q.timestamp>n;(t||s)&&A(!0)}};const wrappedMutationEmit=e=>{D(wrapEvent({type:y.IncrementalSnapshot,data:Object.assign({source:v.Mutation},e)}))},wrappedScrollEmit=e=>D(wrapEvent({type:y.IncrementalSnapshot,data:Object.assign({source:v.Scroll},e)})),wrappedCanvasMutationEmit=e=>D(wrapEvent({type:y.IncrementalSnapshot,data:Object.assign({source:v.CanvasMutation},e)})),te=new StylesheetManager({mutationCb:wrappedMutationEmit,adoptedStyleSheetCb:e=>D(wrapEvent({type:y.IncrementalSnapshot,data:Object.assign({source:v.AdoptedStyleSheet},e)}))}),re=new IframeManager({mirror:q,mutationCb:wrappedMutationEmit,stylesheetManager:te,recordCrossOriginIframes:N,wrappedEmit:D});for(const y of $||[])y.getMirror&&y.getMirror({nodeMirror:q,crossOriginIframeMirror:re.crossOriginIframeMirror,crossOriginIframeStyleMirror:re.crossOriginIframeStyleMirror});const ne=new ProcessedNodeManager;L=new CanvasManager({recordCanvas:R,mutationCb:wrappedCanvasMutationEmit,win:window,blockClass:s,blockSelector:a,mirror:q,sampling:w.canvas,dataURLOptions:C});const ie=new ShadowDomManager({mutationCb:wrappedMutationEmit,scrollCb:wrappedScrollEmit,bypassOptions:{blockClass:s,blockSelector:a,maskTextClass:u,maskTextSelector:l,inlineStylesheet:p,maskInputOptions:J,dataURLOptions:C,maskTextFn:_,maskInputFn:g,recordCanvas:R,inlineImages:B,sampling:w,slimDOMOptions:Y,iframeManager:re,stylesheetManager:te,canvasManager:L,keepIframeSrcFn:z,processedNodeManager:ne},mirror:q});A=(e=!1)=>{if(!T)return;D(wrapEvent({type:y.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}),e),te.reset(),ie.init(),x.forEach((e=>e.lock()));const t=function snapshot(e,t){const{mirror:n=new Mirror,blockClass:i="rr-block",blockSelector:s=null,maskTextClass:a="rr-mask",maskTextSelector:c=null,inlineStylesheet:d=!0,inlineImages:u=!1,recordCanvas:l=!1,maskAllInputs:p=!1,maskTextFn:h,maskInputFn:f,slimDOM:m=!1,dataURLOptions:g,preserveWhiteSpace:_,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:b,onStylesheetLoad:S,stylesheetLoadTimeout:w,keepIframeSrcFn:I=()=>!1}=t||{};return serializeNodeWithId(e,{doc:e,mirror:n,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:d,maskInputOptions:!0===p?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===p?{password:!0}:p,maskTextFn:h,maskInputFn:f,slimDOMOptions:!0===m||"all"===m?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===m,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===m?{}:m,dataURLOptions:g,inlineImages:u,recordCanvas:l,preserveWhiteSpace:_,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:b,onStylesheetLoad:S,stylesheetLoadTimeout:w,keepIframeSrcFn:I,newlyAddedElement:!1})}(document,{mirror:q,blockClass:s,blockSelector:a,maskTextClass:u,maskTextSelector:l,inlineStylesheet:p,maskAllInputs:J,maskTextFn:_,slimDOM:Y,dataURLOptions:C,recordCanvas:R,inlineImages:B,onSerialize:e=>{isSerializedIframe(e,q)&&re.addIframe(e),isSerializedStylesheet(e,q)&&te.trackLinkElement(e),hasShadowRoot(e)&&ie.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{re.attachIframe(e,t),ie.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{te.attachLinkElement(e,t)},keepIframeSrcFn:z});if(!t)return console.warn("Failed to snapshot the document");D(wrapEvent({type:y.FullSnapshot,data:{node:t,initialOffset:getWindowScroll(window)}}),e),x.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&te.adoptStyleSheets(document.adoptedStyleSheets,q.getId(document))};try{const e=[],observe=e=>{var t;return callbackWrapper(initObservers)({mutationCb:wrappedMutationEmit,mousemoveCb:(e,t)=>D(wrapEvent({type:y.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>D(wrapEvent({type:y.IncrementalSnapshot,data:Object.assign({source:v.MouseInteraction},e)})),scrollCb:wrappedScrollEmit,viewportResizeCb:e=>D(wrapEvent({type:y.IncrementalSnapshot,data:Object.assign({source:v.ViewportResize},e)})),inputCb:e=>D(wrapEvent({type:y.IncrementalSnapshot,data:Object.assign({source:v.Input},e)})),mediaInteractionCb:e=>D(wrapEvent({type:y.IncrementalSnapshot,data:Object.assign({source:v.MediaInteraction},e)})),styleSheetRuleCb:e=>D(wrapEvent({type:y.IncrementalSnapshot,data:Object.assign({source:v.StyleSheetRule},e)})),styleDeclarationCb:e=>D(wrapEvent({type:y.IncrementalSnapshot,data:Object.assign({source:v.StyleDeclaration},e)})),canvasMutationCb:wrappedCanvasMutationEmit,fontCb:e=>D(wrapEvent({type:y.IncrementalSnapshot,data:Object.assign({source:v.Font},e)})),selectionCb:e=>{D(wrapEvent({type:y.IncrementalSnapshot,data:Object.assign({source:v.Selection},e)}))},customElementCb:e=>{D(wrapEvent({type:y.IncrementalSnapshot,data:Object.assign({source:v.CustomElement},e)}))},blockClass:s,ignoreClass:c,ignoreSelector:d,maskTextClass:u,maskTextSelector:l,maskInputOptions:J,inlineStylesheet:p,sampling:w,recordDOM:T,recordCanvas:R,inlineImages:B,userTriggeredOnInput:P,collectFonts:U,doc:e,maskInputFn:g,maskTextFn:_,keepIframeSrcFn:z,blockSelector:a,slimDOMOptions:Y,dataURLOptions:C,mirror:q,iframeManager:re,stylesheetManager:te,shadowDomManager:ie,processedNodeManager:ne,canvasManager:L,ignoreCSSAttributes:W,plugins:(null===(t=null==$?void 0:$.filter((e=>e.observer)))||void 0===t?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>D(wrapEvent({type:y.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},b)};re.addLoadListener((t=>{try{e.push(observe(t.contentDocument))}catch(X){console.warn(X)}}));const init2=()=>{A(),e.push(observe(document)),j=!0};return"interactive"===document.readyState||"complete"===document.readyState?init2():(e.push(on("DOMContentLoaded",(()=>{D(wrapEvent({type:y.DomContentLoaded,data:{}})),"DOMContentLoaded"===Z&&init2()}))),e.push(on("load",(()=>{D(wrapEvent({type:y.Load,data:{}})),"load"===Z&&init2()}),window))),()=>{e.forEach((e=>e())),ne.destroy(),j=!1,function unregisterErrorHandler(){I=void 0}()}}catch(X){console.warn(X)}}record.addCustomEvent=(e,t)=>{if(!j)throw new Error("please add custom event after start recording");D(wrapEvent({type:y.Custom,data:{tag:e,payload:t}}))},record.freezePage=()=>{x.forEach((e=>e.freeze()))},record.takeFullSnapshot=e=>{if(!j)throw new Error("please take full snapshot after start recording");A(e)},record.mirror=q;var U,B=(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))(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))($||{}),z={DEBUG:!1,LIB_VERSION:"2.55.1"};if("undefined"==typeof window){var W={hostname:""};U={navigator:{userAgent:"",onLine:!0},document:{location:W,referrer:""},screen:{width:0,height:0},location:W}}else U=window;var K,H,G,J,Y,X,Q,ee,te,re,ne=864e5,ie=8e3,oe=Array.prototype,se=Function.prototype,ae=Object.prototype,ce=oe.slice,de=ae.toString,ue=ae.hasOwnProperty,le=U.console,pe=U.navigator,he=U.document,fe=U.opera,me=U.screen,ge=pe.userAgent,_e=se.bind,ye=oe.forEach,ve=oe.indexOf,be=oe.map,Se=Array.isArray,ke={},we={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},Ie={log:function(){if(z.DEBUG&&!we.isUndefined(le)&&le)try{le.log.apply(le,arguments)}catch(e){we.each(arguments,(function(e){le.log(e)}))}},warn:function(){if(z.DEBUG&&!we.isUndefined(le)&&le){var e=["Mixpanel warning:"].concat(we.toArray(arguments));try{le.warn.apply(le,e)}catch(t){we.each(e,(function(e){le.warn(e)}))}}},error:function(){if(z.DEBUG&&!we.isUndefined(le)&&le){var e=["Mixpanel error:"].concat(we.toArray(arguments));try{le.error.apply(le,e)}catch(t){we.each(e,(function(e){le.error(e)}))}}},critical:function(){if(!we.isUndefined(le)&&le){var e=["Mixpanel error:"].concat(we.toArray(arguments));try{le.error.apply(le,e)}catch(t){we.each(e,(function(e){le.error(e)}))}}}},log_func_with_prefix=function(e,t){return function(){return arguments[0]="["+t+"] "+arguments[0],e.apply(Ie,arguments)}},console_with_prefix=function(e){return{log:log_func_with_prefix(Ie.log,e),error:log_func_with_prefix(Ie.error,e),critical:log_func_with_prefix(Ie.critical,e)}};we.bind=function(e,t){var n,i;if(_e&&e.bind===_e)return _e.apply(e,ce.call(arguments,1));if(!we.isFunction(e))throw new TypeError;return n=ce.call(arguments,2),i=function(){if(!(this instanceof i))return e.apply(t,n.concat(ce.call(arguments)));var s={};s.prototype=e.prototype;var a=new s;s.prototype=null;var c=e.apply(a,n.concat(ce.call(arguments)));return Object(c)===c?c:a},i},we.each=function(e,t,n){if(null!=e)if(ye&&e.forEach===ye)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)===ke)return}else for(var a in e)if(ue.call(e,a)&&t.call(n,e[a],a,e)===ke)return},we.extend=function(e){return we.each(ce.call(arguments,1),(function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])})),e},we.isArray=Se||function(e){return"[object Array]"===de.call(e)},we.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(t){return!1}},we.isArguments=function(e){return!(!e||!ue.call(e,"callee"))},we.toArray=function(e){return e?e.toArray?e.toArray():we.isArray(e)||we.isArguments(e)?ce.call(e):we.values(e):[]},we.map=function(e,t,n){if(be&&e.map===be)return e.map(t,n);var i=[];return we.each(e,(function(e){i.push(t.call(n,e))})),i},we.keys=function(e){var t=[];return null===e||we.each(e,(function(e,n){t[t.length]=n})),t},we.values=function(e){var t=[];return null===e||we.each(e,(function(e){t[t.length]=e})),t},we.include=function(e,t){var n=!1;return null===e?n:ve&&e.indexOf===ve?-1!=e.indexOf(t):(we.each(e,(function(e){if(n||(n=e===t))return ke})),n)},we.includes=function(e,t){return-1!==e.indexOf(t)},we.inherit=function(e,t){return e.prototype=new t,e.prototype.constructor=e,e.superclass=t.prototype,e},we.isObject=function(e){return e===Object(e)&&!we.isArray(e)},we.isEmptyObject=function(e){if(we.isObject(e)){for(var t in e)if(ue.call(e,t))return!1;return!0}return!1},we.isUndefined=function(e){return void 0===e},we.isString=function(e){return"[object String]"==de.call(e)},we.isDate=function(e){return"[object Date]"==de.call(e)},we.isNumber=function(e){return"[object Number]"==de.call(e)},we.isElement=function(e){return!(!e||1!==e.nodeType)},we.encodeDates=function(e){return we.each(e,(function(t,n){we.isDate(t)?e[n]=we.formatDate(t):we.isObject(t)&&(e[n]=we.encodeDates(t))})),e},we.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},we.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())},we.strip_empty_properties=function(e){var t={};return we.each(e,(function(e,n){we.isString(e)&&e.length>0&&(t[n]=e)})),t},we.truncate=function(e,t){var n;return"string"==typeof e?n=e.slice(0,t):we.isArray(e)?(n=[],we.each(e,(function(e){n.push(we.truncate(e,t))}))):we.isObject(e)?(n={},we.each(e,(function(e,i){n[i]=we.truncate(e,t)}))):n=e,n},we.JSONEncode=function(){return function(e){var quote=function(e){var t=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,n={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return t.lastIndex=0,t.test(e)?'"'+e.replace(t,(function(e){var t=n[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'},str=function(e,t){var n="",i=0,s="",a="",c=0,d=n,u=[],l=t[e];switch(l&&"object"==typeof l&&"function"==typeof l.toJSON&&(l=l.toJSON(e)),typeof l){case"string":return quote(l);case"number":return isFinite(l)?String(l):"null";case"boolean":case"null":return String(l);case"object":if(!l)return"null";if(n+=" ",u=[],"[object Array]"===de.apply(l)){for(c=l.length,i=0;i<c;i+=1)u[i]=str(i,l)||"null";return a=0===u.length?"[]":n?"[\n"+n+u.join(",\n"+n)+"\n"+d+"]":"["+u.join(",")+"]",n=d,a}for(s in l)ue.call(l,s)&&(a=str(s,l))&&u.push(quote(s)+(n?": ":":")+a);return a=0===u.length?"{}":n?"{"+u.join(",")+d+"}":"{"+u.join(",")+"}",n=d,a}};return str("",{"":e})}}(),we.JSONDecode=(Y={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},X=function(e){var t=new SyntaxError(e);throw t.at=K,t.text=G,t},Q=function(e){return e&&e!==H&&X("Expected '"+e+"' instead of '"+H+"'"),H=G.charAt(K),K+=1,H},ee=function(){var e,t="";for("-"===H&&(t="-",Q("-"));H>="0"&&H<="9";)t+=H,Q();if("."===H)for(t+=".";Q()&&H>="0"&&H<="9";)t+=H;if("e"===H||"E"===H)for(t+=H,Q(),"-"!==H&&"+"!==H||(t+=H,Q());H>="0"&&H<="9";)t+=H,Q();if(e=+t,isFinite(e))return e;X("Bad number")},te=function(){var e,t,n,i="";if('"'===H)for(;Q();){if('"'===H)return Q(),i;if("\\"===H)if(Q(),"u"===H){for(n=0,t=0;t<4&&(e=parseInt(Q(),16),isFinite(e));t+=1)n=16*n+e;i+=String.fromCharCode(n)}else{if("string"!=typeof Y[H])break;i+=Y[H]}else i+=H}X("Bad string")},re=function(){for(;H&&H<=" ";)Q()},J=function(){switch(re(),H){case"{":return function(){var e,t={};if("{"===H){if(Q("{"),re(),"}"===H)return Q("}"),t;for(;H;){if(e=te(),re(),Q(":"),Object.hasOwnProperty.call(t,e)&&X('Duplicate key "'+e+'"'),t[e]=J(),re(),"}"===H)return Q("}"),t;Q(","),re()}}X("Bad object")}();case"[":return function(){var e=[];if("["===H){if(Q("["),re(),"]"===H)return Q("]"),e;for(;H;){if(e.push(J()),re(),"]"===H)return Q("]"),e;Q(","),re()}}X("Bad array")}();case'"':return te();case"-":return ee();default:return H>="0"&&H<="9"?ee():function(){switch(H){case"t":return Q("t"),Q("r"),Q("u"),Q("e"),!0;case"f":return Q("f"),Q("a"),Q("l"),Q("s"),Q("e"),!1;case"n":return Q("n"),Q("u"),Q("l"),Q("l"),null}X('Unexpected "'+H+'"')}()}},function(e){var t;return G=e,K=0,H=" ",t=J(),re(),H&&X("Syntax error"),t}),we.base64Encode=function(e){var t,n,i,s,a,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",d=0,u=0,l="",p=[];if(!e)return e;e=we.utf8Encode(e);do{t=(a=e.charCodeAt(d++)<<16|e.charCodeAt(d++)<<8|e.charCodeAt(d++))>>18&63,n=a>>12&63,i=a>>6&63,s=63&a,p[u++]=c.charAt(t)+c.charAt(n)+c.charAt(i)+c.charAt(s)}while(d<e.length);switch(l=p.join(""),e.length%3){case 1:l=l.slice(0,-2)+"==";break;case 2:l=l.slice(0,-1)+"="}return l},we.utf8Encode=function(e){var t,n,i,s,a="";for(t=n=0,i=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<i;s++){var c=e.charCodeAt(s),d=null;c<128?n++:d=c>127&&c<2048?String.fromCharCode(c>>6|192,63&c|128):String.fromCharCode(c>>12|224,c>>6&63|128,63&c|128),null!==d&&(n>t&&(a+=e.substring(t,n)),a+=d,t=n=s+1)}return n>t&&(a+=e.substring(t,e.length)),a},we.UUID=function(){var T2=function(){var e,t=1*new Date;if(U.performance&&U.performance.now)e=U.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 xe=["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"];we.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<xe.length;t++)if(-1!==e.indexOf(xe[t]))return!0;return!1},we.HTTPBuildQuery=function(e,t){var n,i,s=[];return we.isUndefined(t)&&(t="&"),we.each(e,(function(e,t){n=encodeURIComponent(e.toString()),i=encodeURIComponent(t),s[s.length]=i+"="+n})),s.join(t)},we.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){Ie.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")},we.cookie={get:function(e){for(var t=e+"=",n=he.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=we.JSONDecode(we.cookie.get(e))||{}}catch(n){}return t},set_seconds:function(e,t,n,i,s,a,c){var d="",u="",l="";if(c)d="; domain="+c;else if(i){var p=extract_domain(he.location.hostname);d=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+1e3*n),u="; expires="+h.toGMTString()}a&&(s=!0,l="; SameSite=None"),s&&(l+="; secure"),he.cookie=e+"="+encodeURIComponent(t)+u+"; path=/"+d+l},set:function(e,t,n,i,s,a,c){var d="",u="",l="";if(c)d="; domain="+c;else if(i){var p=extract_domain(he.location.hostname);d=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+24*n*60*60*1e3),u="; expires="+h.toGMTString()}a&&(s=!0,l="; SameSite=None"),s&&(l+="; secure");var f=e+"="+encodeURIComponent(t)+u+"; path=/"+d+l;return he.cookie=f,f},remove:function(e,t,n){we.cookie.set(e,"",-1,t,!1,!1,n)}};var Ee=null,localStorageSupported=function(e,t){if(null!==Ee&&!t)return Ee;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 Ee=n,n};we.localStorage={is_supported:function(e){var t=localStorageSupported(null,e);return t||Ie.error("localStorage unsupported; falling back to cookie store"),t},error:function(e){Ie.error("localStorage error: "+e)},get:function(e){try{return window.localStorage.getItem(e)}catch(t){we.localStorage.error(t)}return null},parse:function(e){try{return we.JSONDecode(we.localStorage.get(e))||{}}catch(t){}return null},set:function(e,t){try{window.localStorage.setItem(e,t)}catch(n){we.localStorage.error(n)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(t){we.localStorage.error(t)}}},we.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 we.isFunction(n)&&(s=n(i)),a=t.call(e,i),!1!==s&&!1!==a||(c=!1),c}};return handler}(e,n,c)}else Ie.error("No valid element provided to register_event")}}();var Ce=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');we.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(!he.getElementsByTagName)return[];var t,n,i,s,a,c,d,u,l,p,h=e.split(" "),f=[he];for(c=0;c<h.length;c++)if((t=h[c].replace(/^\s+/,"").replace(/\s+$/,"")).indexOf("#")>-1){i=(n=t.split("#"))[0];var m=n[1],g=he.getElementById(m);if(!g||i&&g.nodeName.toLowerCase()!=i)return[];f=[g]}else if(t.indexOf(".")>-1){i=(n=t.split("."))[0];var _=n[1];for(i||(i="*"),s=[],a=0,d=0;d<f.length;d++)for(l="*"==i?getAllChildren(f[d]):f[d].getElementsByTagName(i),u=0;u<l.length;u++)s[a++]=l[u];for(f=[],p=0,d=0;d<s.length;d++)s[d].className&&we.isString(s[d].className)&&hasClass(s[d],_)&&(f[p++]=s[d])}else{var y=t.match(Ce);if(y){i=y[1];var v,b=y[2],S=y[3],w=y[4];for(i||(i="*"),s=[],a=0,d=0;d<f.length;d++)for(l="*"==i?getAllChildren(f[d]):f[d].getElementsByTagName(i),u=0;u<l.length;u++)s[a++]=l[u];switch(f=[],p=0,S){case"=":v=function(e){return e.getAttribute(b)==w};break;case"~":v=function(e){return e.getAttribute(b).match(new RegExp("\\b"+w+"\\b"))};break;case"|":v=function(e){return e.getAttribute(b).match(new RegExp("^"+w+"-?"))};break;case"^":v=function(e){return 0===e.getAttribute(b).indexOf(w)};break;case"$":v=function(e){return e.getAttribute(b).lastIndexOf(w)==e.getAttribute(b).length-w.length};break;case"*":v=function(e){return e.getAttribute(b).indexOf(w)>-1};break;default:v=function(e){return e.getAttribute(b)}}for(f=[],p=0,d=0;d<s.length;d++)v(s[d])&&(f[p++]=s[d])}else{for(i=t,s=[],a=0,d=0;d<f.length;d++)for(l=f[d].getElementsByTagName(i),u=0;u<l.length;u++)s[a++]=l[u];f=s}}return f}return function(e){return we.isElement(e)?[e]:we.isObject(e)&&!we.isUndefined(e.length)?e:getElementsBySelector.call(this,e)}}();var Oe=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],Te=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];we.info={campaignParams:function(e){var t="",n={};return we.each(Oe,(function(i){(t=we.getQueryParam(he.URL,i)).length?n[i]=t:void 0!==e&&(n[i]=e)})),n},clickParams:function(){var e="",t={};return we.each(Te,(function(n){(e=we.getQueryParam(he.URL,n)).length&&(t[n]=e)})),t},marketingParams:function(){return we.extend(we.info.campaignParams(),we.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=we.info.searchEngine(e),n="yahoo"!=t?"q":"p",i={};if(null!==t){i.$search_engine=t;var s=we.getQueryParam(e,n);s.length&&(i.mp_keyword=s)}return i},browser:function(e,t,n){return t=t||"",n||we.includes(e," OPR/")?we.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":we.includes(e,"IEMobile")||we.includes(e,"WPDesktop")?"Internet Explorer Mobile":we.includes(e,"SamsungBrowser/")?"Samsung Internet":we.includes(e,"Edge")||we.includes(e,"Edg/")?"Microsoft Edge":we.includes(e,"FBIOS")?"Facebook Mobile":we.includes(e,"Chrome")?"Chrome":we.includes(e,"CriOS")?"Chrome iOS":we.includes(e,"UCWEB")||we.includes(e,"UCBrowser")?"UC Browser":we.includes(e,"FxiOS")?"Firefox iOS":we.includes(t,"Apple")?we.includes(e,"Mobile")?"Mobile Safari":"Safari":we.includes(e,"Android")?"Android Mobile":we.includes(e,"Konqueror")?"Konqueror":we.includes(e,"Firefox")?"Firefox":we.includes(e,"MSIE")||we.includes(e,"Trident/")?"Internet Explorer":we.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+)?)/}[we.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 U.location.href},properties:function(e){return"object"!=typeof e&&(e={}),we.extend(we.strip_empty_properties({$os:we.info.os(),$browser:we.info.browser(ge,pe.vendor,fe),$referrer:he.referrer,$referring_domain:we.info.referringDomain(he.referrer),$device:we.info.device(ge)}),{$current_url:we.info.currentUrl(),$browser_version:we.info.browserVersion(ge,pe.vendor,fe),$screen_height:me.height,$screen_width:me.width,mp_lib:"web",$lib_version:z.LIB_VERSION,$insert_id:cheap_guid(),time:we.timestamp()/1e3},we.strip_empty_properties(e))},people_properties:function(){return we.extend(we.strip_empty_properties({$os:we.info.os(),$browser:we.info.browser(ge,pe.vendor,fe)}),{$browser_version:we.info.browserVersion(ge,pe.vendor,fe)})},mpPageViewProperties:function(){return we.strip_empty_properties({current_page_title:he.title,current_domain:U.location.hostname,current_url_path:U.location.pathname,current_url_protocol:U.location.protocol,current_url_search:U.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},Re=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,Me=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,extract_domain=function(e){var t=Me,n=e.split("."),i=n[n.length-1];(i.length>4||"com"===i||"org"===i)&&(t=Re);var s=e.match(t);return s?s[0]:""},Ne=null,Ze=null;"undefined"!=typeof JSON&&(Ne=JSON.stringify,Ze=JSON.parse),Ne=Ne||we.JSONEncode,Ze=Ze||we.JSONDecode,we.toArray=we.toArray,we.isObject=we.isObject,we.JSONEncode=we.JSONEncode,we.JSONDecode=we.JSONDecode,we.isBlockedUA=we.isBlockedUA,we.isEmptyObject=we.isEmptyObject,we.info=we.info,we.info.device=we.info.device,we.info.browser=we.info.browser,we.info.browserVersion=we.info.browserVersion,we.info.properties=we.info.properties;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||U,n=t.navigator||{},i=!1;return we.each([n.doNotTrack,n.msDoNotTrack,t.doNotTrack],(function(e){we.includes([!0,1,"1","yes"],e)&&(i=!0)})),i}(t))return Ie.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&&Ie.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?we.localStorage:we.cookie}function _getStorageKey(e,t){return((t=t||{}).persistencePrefix||"__mp_opt_in_out_")+e}function _getStorageValue(e,t){return _getStorage(t).get(_getStorageKey(e,t))}function _optInOut(e,t,n){we.isString(t)&&t.length?(_getStorage(n=n||{}).set(_getStorageKey(t,n),e?1:0,we.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})):Ie.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function _addOptOutCheck(e,t){return function(){var n=!1;try{var i=t.call(this,"token"),s=t.call(this,"ignore_dnt"),a=t.call(this,"opt_out_tracking_persistence_type"),c=t.call(this,"opt_out_tracking_cookie_prefix"),d=t.call(this,"window");i&&(n=hasOptedOut(i,{ignoreDnt:s,persistenceType:a,persistencePrefix:c,window:d}))}catch(l){Ie.error("Unexpected error when checking tracking opt-out status: "+l)}if(!n)return e.apply(this,arguments);var u=arguments[arguments.length-1];"function"==typeof u&&u(0)}}var 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,d=this.timeoutMS,u=this.storage,l=a+":X",p=a+":Y",h=a+":Z",reportError=function(e){t&&t(e)},delay=function(e){if((new Date).getTime()-s>d)return Pe.error("Timeout waiting for mutex on "+a+"; clearing lock. ["+i+"]"),u.removeItem(h),u.removeItem(p),void loop();setTimeout((function(){try{e()}catch(t){reportError(t)}}),c*(Math.random()+.1))},waitFor=function(e,t){e()?t():delay((function(){waitFor(e,t)}))},getSetY=function(){var e=u.getItem(p);if(e&&e!==i)return!1;if(u.setItem(p,i),u.getItem(p)===i)return!0;if(!localStorageSupported(u,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},loop=function(){u.setItem(l,i),waitFor(getSetY,(function(){u.getItem(l)!==i?delay((function(){u.getItem(p)===i?waitFor((function(){return!u.getItem(h)}),criticalSection):loop()})):criticalSection()}))},criticalSection=function(){u.setItem(h,"1");try{e()}finally{u.removeItem(h),u.getItem(p)===i&&u.removeItem(p),u.getItem(l)===i&&u.removeItem(l)}};try{if(!localStorageSupported(u,!0))throw new Error("localStorage support check failed");loop()}catch(f){reportError(f)}};var De=console_with_prefix("batch"),RequestQueue=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||window.localStorage,this.reportError=t.errorReporter||we.bind(De.error,De),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(we.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),we.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={};we.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 we.each(e,(function(e){e.id&&!t[e.id]&&n.push(e)})),n};RequestQueue.prototype.removeItemsByID=function(e,t){var n={};if(we.each(e,(function(e){n[e]=!0})),this.memQueue=filterOutIDsAndInvalid(this.memQueue,n),this.usePersistence){var i=we.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)}),we.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 we.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(we.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),we.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=Ze(e),we.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,Ne(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 Ae=console_with_prefix("batch"),RequestBatcher=function(e,t){this.errorReporter=t.errorReporter,this.queue=new RequestQueue(e,{errorReporter:we.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(we.bind((function(){this.stopped||this.flush()}),this),this.flushInterval))},RequestBatcher.prototype.flush=function(e){try{if(this.requestInProgress)return void Ae.log("Flush: Request already in progress");e=e||{};var t=this.libConfig.batch_request_timeout_ms,n=(new Date).getTime(),i=this.batchSize,s=this.queue.fillBatch(i),a=s.length===i,c=[],d={};if(we.each(s,(function(e){var t=e.payload;if(this.beforeSendHook&&!e.orphaned&&(t=this.beforeSendHook(t)),t){t.event&&t.properties&&(t.properties=we.extend({},t.properties,{mp_sent_by_lib_version:z.LIB_VERSION}));var n=!0,i=e.id;i?(this.itemIdsSentSuccessfully[i]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:e,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[i]}),n=!1):this.reportError("[dupe] found item with no ID",{item:e}),n&&c.push(t)}d[e.id]=t}),this),c.length<1)return void this.resetFlush();this.requestInProgress=!0;var u=we.bind((function(c){this.requestInProgress=!1;try{var u=!1;if(e.unloading)this.queue.updatePayloads(d);else if(we.isObject(c)&&"timeout"===c.error&&(new Date).getTime()-n>=t)this.reportError("Network timeout; retrying"),this.flush();else if(we.isObject(c)&&(c.httpStatusCode>=500||429===c.httpStatusCode||c.httpStatusCode<=0&&(h=U.navigator.onLine,!we.isUndefined(h)&&!h)||"timeout"===c.error)){var l=2*this.flushInterval;c.retryAfter&&(l=1e3*parseInt(c.retryAfter,10)||l),l=Math.min(6e5,l),this.reportError("Error; retry in "+l+" ms"),this.scheduleFlush(l)}else if(we.isObject(c)&&413===c.httpStatusCode)if(s.length>1){var p=Math.max(1,Math.floor(i/2));this.batchSize=Math.min(this.batchSize,p,s.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",s),this.resetBatchSize(),u=!0;else u=!0;u&&(this.queue.removeItemsByID(we.map(s,(function(e){return e.id})),we.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)),we.each(s,we.bind((function(e){var t=e.id;t?(this.itemIdsSentSuccessfully[t]=this.itemIdsSentSuccessfully[t]||0,this.itemIdsSentSuccessfully[t]++,this.itemIdsSentSuccessfully[t]>5&&this.reportError("[dupe] item ID sent too many times",{item:e,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[t]})):this.reportError("[dupe] found item with no ID while removing",{item:e})}),this)))}catch(f){this.reportError("Error handling API response",f),this.resetFlush()}var h}),this),l={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:t};e.unloading&&(l.transport="sendBeacon"),Ae.log("MIXPANEL REQUEST:",c),this.sendRequest(c,l,u)}catch(p){this.reportError("Error flushing request queue",p),this.resetFlush()}},RequestBatcher.prototype.reportError=function(e,t){if(Ae.error.apply(Ae.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(n){Ae.error(n)}};var Le=console_with_prefix("recorder"),je=U.CompressionStream,Fe={batch_size:1e3,batch_flush_interval_ms:1e4,batch_request_timeout_ms:9e4,batch_autostart:!0},qe=new Set([$.MouseMove,$.MouseInteraction,$.Scroll,$.ViewportResize,$.Input,$.TouchMove,$.MediaInteraction,$.Drag,$.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=ne,this.recordMinMs=0,this._initBatcher()};MixpanelRecorder.prototype._initBatcher=function(){this.batcher=new RequestBatcher("__mprec",{libConfig:Fe,sendRequestFunc:we.bind(this.flushEventsWithOptOut,this),errorReporter:we.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>ne&&(this.recordMaxMs=ne,Le.critical("record_max_ms cannot be greater than "+ne+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>ie&&(this.recordMinMs=ie,Le.critical("record_min_ms cannot be greater than 8000ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=(new Date).getTime(),this.replayId=we.UUID(),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var t=we.bind((function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(we.bind((function(){Le.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:we.bind((function(e){this.batcher.enqueue(e),function isUserEvent(e){return e.type===B.IncrementalSnapshot&&qe.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(we.bind(this.resetRecording,this),this.recordMaxMs)}else Le.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,we.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=we.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);U.fetch(this.get_config("api_host")+"/"+this.get_config("api_routes").record+"?"+new URLSearchParams(t),{method:"POST",headers:{Authorization:"Basic "+btoa(this.get_config("token")+":"),"Content-Type":"application/octet-stream"},body:n}).then((function(e){e.json().then((function(t){s(e,t)})).catch((function(e){i({error:e})}))})).catch((function(e){i({error:e,httpStatusCode:0})}))},MixpanelRecorder.prototype._flushEvents=addOptOutCheckMixpanelLib((function(e,t,n){const i=e.length;if(i>0){var s=this.replayId,a=e[0].timestamp;0!==this.seqNo&&this.replayStartTime||(0!==this.seqNo&&this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=a);var c=e[i-1].timestamp-this.replayStartTime,d={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:a/1e3,replay_id:s,replay_length_ms:c,replay_start_time:this.replayStartTime/1e3},u=we.JSONEncode(e),l=this._mixpanel.get_property("$device_id");l&&(d.$device_id=l);var p=this._mixpanel.get_property("$user_id");if(p&&(d.$user_id=p),je){var h=new Blob([u],{type:"application/json"}).stream().pipeThrough(new je("gzip"));new Response(h).blob().then(we.bind((function(e){d.format="gzip",this._sendRequest(s,d,e,n)}),this))}else d.format="body",this._sendRequest(s,d,u,n)}})),MixpanelRecorder.prototype.reportError=function(e,t){Le.error.apply(Le.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){Le.error(n)}},U.__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=we.dom_query(e);if(0!==a.length)return we.each(a,(function(e){we.register_event(e,this.override_event,(function(e){var a={},c=s.create_properties(n,this),d=s.mp.get_config("track_links_timeout");s.event_handler(e,this,a),window.setTimeout(s.track_callback(i,c,a,!0),d),s.mp.track(t,c,s.track_callback(i,c,a))}))}),this),!0;Ie.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):we.extend({},e)};var LinkTracker=function(){this.override_event="click"};we.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"};we.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 Ue="$set",Be="$set_once",$e="$unset",ze="$add",We="$append",Ve="$union",Ke="$remove",He={set_action:function(e,t){var n={},i={};return we.isObject(e)?we.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Ue]=i,n},unset_action:function(e){var t={},n=[];return we.isArray(e)||(e=[e]),we.each(e,(function(e){this._is_reserved_property(e)||n.push(e)}),this),t[$e]=n,t},set_once_action:function(e,t){var n={},i={};return we.isObject(e)?we.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Be]=i,n},union_action:function(e,t){var n={},i={};return we.isObject(e)?we.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=we.isArray(e)?e:[e])}),this):i[e]=we.isArray(t)?t:[t],n[Ve]=i,n},append_action:function(e,t){var n={},i={};return we.isObject(e)?we.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[We]=i,n},remove_action:function(e,t){var n={},i={};return we.isObject(e)?we.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Ke]=i,n},delete_action:function(){var e={$delete:""};return e}},MixpanelGroup=function(){};we.extend(MixpanelGroup.prototype,He),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 we.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 we.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){we.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=we.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(){};we.extend(MixpanelPeople.prototype,He),MixpanelPeople.prototype._init=function(e){this._mixpanel=e},MixpanelPeople.prototype.set=addOptOutCheckMixpanelPeople((function(e,t,n){var i=this.set_action(e,t);return we.isObject(e)&&(n=t),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),i[Ue]=we.extend({},we.info.people_properties(),i[Ue]),this._send_request(i,n)})),MixpanelPeople.prototype.set_once=addOptOutCheckMixpanelPeople((function(e,t,n){var i=this.set_once_action(e,t);return we.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 we.isObject(e)?(we.each(e,(function(e,t){if(!this._is_reserved_property(t)){if(isNaN(parseFloat(e)))return void Ie.error("Invalid increment value passed to mixpanel.people.increment - must be a number");s[t]=e}}),this),n=t):(we.isUndefined(t)&&(t=1),s[e]=t),i[ze]=s,this._send_request(i,n)})),MixpanelPeople.prototype.append=addOptOutCheckMixpanelPeople((function(e,t,n){we.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){we.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){we.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(we.isNumber(e)||(e=parseFloat(e),!isNaN(e)))return this.append("$transactions",we.extend({$amount:e},t),n);Ie.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)}Ie.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=we.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),we.isUndefined(t)||(this._get_config("verbose")?t({status:-1,error:null}):t(-1)),we.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){Ue in e?this._mixpanel.persistence._add_to_people_queue(Ue,e):Be in e?this._mixpanel.persistence._add_to_people_queue(Be,e):$e in e?this._mixpanel.persistence._add_to_people_queue($e,e):ze in e?this._mixpanel.persistence._add_to_people_queue(ze,e):We in e?this._mixpanel.persistence._add_to_people_queue(We,e):Ke in e?this._mixpanel.persistence._add_to_people_queue(Ke,e):Ve in e?this._mixpanel.persistence._add_to_people_queue(Ve,e):Ie.error("Invalid call to _enqueue():",e)},MixpanelPeople.prototype._flush_one_queue=function(e,t,n,i){var s=this,a=we.extend({},this._mixpanel.persistence.load_queue(e)),c=a;we.isUndefined(a)||!we.isObject(a)||we.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),we.isUndefined(n)||n(t,i)})))},MixpanelPeople.prototype._flush=function(e,t,n,i,s,a,c){var d=this;this._flush_one_queue(Ue,this.set,e),this._flush_one_queue(Be,this.set_once,i),this._flush_one_queue($e,this.unset,a,(function(e){return we.keys(e)})),this._flush_one_queue(ze,this.increment,t),this._flush_one_queue(Ve,this.union,s);var u=this._mixpanel.persistence.load_queue(We);if(!we.isUndefined(u)&&we.isArray(u)&&u.length)for(var l,append_callback=function(e,t){0===e&&d._mixpanel.persistence._add_to_people_queue(We,l),we.isUndefined(n)||n(e,t)},p=u.length-1;p>=0;p--)u=this._mixpanel.persistence.load_queue(We),l=u.pop(),d._mixpanel.persistence.save(),we.isEmptyObject(l)||d.append(l,append_callback);var h=this._mixpanel.persistence.load_queue(Ke);if(!we.isUndefined(h)&&we.isArray(h)&&h.length)for(var f,remove_callback=function(e,t){0===e&&d._mixpanel.persistence._add_to_people_queue(Ke,f),we.isUndefined(c)||c(e,t)},m=h.length-1;m>=0;m--)h=this._mixpanel.persistence.load_queue(Ke),f=h.pop(),d._mixpanel.persistence.save(),we.isEmptyObject(f)||d.remove(f,remove_callback)},MixpanelPeople.prototype._is_reserved_property=function(e){return"$distinct_id"===e||"$token"===e||"$device_id"===e||"$user_id"===e||"$had_persisted_distinct_id"===e},MixpanelPeople.prototype.set=MixpanelPeople.prototype.set,MixpanelPeople.prototype.set_once=MixpanelPeople.prototype.set_once,MixpanelPeople.prototype.unset=MixpanelPeople.prototype.unset,MixpanelPeople.prototype.increment=MixpanelPeople.prototype.increment,MixpanelPeople.prototype.append=MixpanelPeople.prototype.append,MixpanelPeople.prototype.remove=MixpanelPeople.prototype.remove,MixpanelPeople.prototype.union=MixpanelPeople.prototype.union,MixpanelPeople.prototype.track_charge=MixpanelPeople.prototype.track_charge,MixpanelPeople.prototype.clear_charges=MixpanelPeople.prototype.clear_charges,MixpanelPeople.prototype.delete_user=MixpanelPeople.prototype.delete_user,MixpanelPeople.prototype.toString=MixpanelPeople.prototype.toString;var Ge,Je="__mps",Ye="__mpso",Xe="__mpus",Qe="__mpa",et="__mpap",tt="__mpr",rt="__mpu",nt="$people_distinct_id",it="__alias",ot="__timers",st=[Je,Ye,Xe,Qe,et,tt,rt,nt,it,ot],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&&(Ie.critical("Unknown persistence type "+t+"; falling back to cookie"),t=e.persistence="cookie"),"localStorage"===t&&we.localStorage.is_supported()?this.storage=we.localStorage:this.storage=we.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};MixpanelPersistence.prototype.properties=function(){var e={};return this.load(),we.each(this.props,(function(t,n){we.include(st,n)||(e[n]=t)})),e},MixpanelPersistence.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=we.extend({},e))}},MixpanelPersistence.prototype.upgrade=function(){var e,t;this.storage===we.localStorage?(e=we.cookie.parse(this.name),we.cookie.remove(this.name),we.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===we.cookie&&(t=we.localStorage.parse(this.name),we.localStorage.remove(this.name),t&&this.register_once(t))},MixpanelPersistence.prototype.save=function(){this.disabled||this.storage.set(this.name,we.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!!we.isObject(e)&&(void 0===t&&(t="None"),this.expire_days=void 0===n?this.default_expiry:n,this.load(),we.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!!we.isObject(e)&&(this.expire_days=void 0===t?this.default_expiry:t,this.load(),we.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(we.info.searchInfo(e))},MixpanelPersistence.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:we.info.referringDomain(e)||"$direct"},"")},MixpanelPersistence.prototype.get_referrer_info=function(){return we.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(Ue),a=this._get_or_create_queue(Be),c=this._get_or_create_queue($e),d=this._get_or_create_queue(ze),u=this._get_or_create_queue(Ve),l=this._get_or_create_queue(Ke,[]),p=this._get_or_create_queue(We,[]);n===Je?(we.extend(s,i),this._pop_from_people_queue(ze,i),this._pop_from_people_queue(Ve,i),this._pop_from_people_queue($e,i)):n===Ye?(we.each(i,(function(e,t){t in a||(a[t]=e)})),this._pop_from_people_queue($e,i)):n===Xe?we.each(i,(function(e){we.each([s,a,d,u],(function(t){e in t&&delete t[e]})),we.each(p,(function(t){e in t&&delete t[e]})),c[e]=!0})):n===Qe?(we.each(i,(function(e,t){t in s?s[t]+=e:(t in d||(d[t]=0),d[t]+=e)}),this),this._pop_from_people_queue($e,i)):n===rt?(we.each(i,(function(e,t){we.isArray(e)&&(t in u||(u[t]=[]),u[t]=u[t].concat(e))})),this._pop_from_people_queue($e,i)):n===tt?(l.push(i),this._pop_from_people_queue(We,i)):n===et&&(p.push(i),this._pop_from_people_queue($e,i)),Ie.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),Ie.log(t),this.save()},MixpanelPersistence.prototype._pop_from_people_queue=function(e,t){var n=this.props[this._get_queue_key(e)];we.isUndefined(n)||we.each(t,(function(t,i){e===We||e===Ke?we.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===Ue?Je:e===Be?Ye:e===$e?Xe:e===ze?Qe:e===We?et:e===Ke?tt:e===Ve?rt:void Ie.error("Invalid queue:",e)},MixpanelPersistence.prototype._get_or_create_queue=function(e,t){var n=this._get_queue_key(e);return t=we.isUndefined(t)?{}:t,this.props[n]||(this.props[n]=t)},MixpanelPersistence.prototype.set_event_timer=function(e,t){var n=this.load_prop(ot)||{};n[e]=t,this.props[ot]=n,this.save()},MixpanelPersistence.prototype.remove_event_timer=function(e){var t=(this.load_prop(ot)||{})[e];return we.isUndefined(t)||(delete this.props[ot][e],this.save()),t};var at,load_extra_bundle=function(e,t){throw new Error(e+" not available in this build.")},IDENTITY_FUNC=function(e){return e},NOOP_FUNC=function(){},ct="mixpanel",dt="base64",ut="$device:",lt=U.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,pt=!lt&&-1===ge.indexOf("MSIE")&&-1===ge.indexOf("Mozilla"),ht=null;pe.sendBeacon&&(ht=function(){return pe.sendBeacon.apply(pe,arguments)});var ft={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},mt={api_host:"https://api-js.mixpanel.com",api_routes:ft,api_method:"POST",api_transport:"XHR",api_payload_format:dt,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:ne,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},gt=!1,MixpanelLib=function(){},create_mplib=function(e,t,n){var i,s=n===ct?at:at[n];if(s&&0===Ge)i=s;else{if(s&&!we.isArray(s))return void Ie.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=we.info.campaignParams(null),c={},d=!1;we.each(a,(function(e,t){c["initial_"+t]=e,e&&(d=!0)})),d&&i.people.set_once(c)}return z.DEBUG=z.DEBUG||i.get_config("debug"),!we.isUndefined(s)&&we.isArray(s)&&(i._execute_array.call(i.people,s.people),i._execute_array(s)),i};MixpanelLib.prototype.init=function(e,t,n){if(we.isUndefined(n))this.report_error("You must name your new library: init(token, config, name)");else{if(n!==ct){var i=create_mplib(e,t,n);return at[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||mt.api_host).match(/\.mixpanel\.com/)&&(i.api_payload_format="json");if(this.set_config(we.extend({},mt,i,t,{name:n,token:e,callback_fn:(n===ct?n:ct+"."+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(we.localStorage.is_supported(!0)&&lt){if(this.init_batchers(),ht&&U.addEventListener){var s=we.bind((function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})}),this);U.addEventListener("pagehide",(function(e){e.persisted&&s()})),U.addEventListener("visibilitychange",(function(){"hidden"===he.visibilityState&&s()}))}}else this._batch_requests=!1,Ie.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),we.each(this.get_batcher_configs(),(function(e){Ie.log("Clearing batch queue "+e.queue_key),we.localStorage.remove(e.queue_key)}));this.persistence=this.cookie=new MixpanelPersistence(this.config),this.unpersisted_superprops={},this._gdpr_init();var a=we.UUID();this.get_distinct_id()||this.register_once({distinct_id:ut+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(U.MutationObserver){var e=we.bind((function(){this._recorder=this._recorder||new U.__mp_recorder(this),this._recorder.startRecording()}),this);we.isUndefined(U.__mp_recorder)?load_extra_bundle(this.get_config("recorder_src"),e):e()}else Ie.critical("Browser does not support MutationObserver; skipping session recording")})),MixpanelLib.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():Ie.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=we.info.campaignParams(null);we.each(e,function(e,t){this.unregister(t)}.bind(this))}},MixpanelLib.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(he.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(we.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(he.referrer)},MixpanelLib.prototype._dom_loaded=function(){we.each(this.__dom_loaded_queue,(function(e){this._track_dom.apply(this,e)}),this),this.has_opted_out_tracking()||we.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(!gt)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=we.info.currentUrl()),we.include(["full-url","url-with-path-and-query-string","url-with-path"],e)){U.addEventListener("popstate",(function(){U.dispatchEvent(new Event("mp_locationchange"))})),U.addEventListener("hashchange",(function(){U.dispatchEvent(new Event("mp_locationchange"))}));var n=U.history.pushState;"function"==typeof n&&(U.history.pushState=function(e,t,i){n.call(U.history,e,t,i),U.dispatchEvent(new Event("mp_locationchange"))});var i=U.history.replaceState;"function"==typeof i&&(U.history.replaceState=function(e,t,n){i.call(U.history,e,t,n),U.dispatchEvent(new Event("mp_locationchange"))}),U.addEventListener("mp_locationchange",function(){var n=we.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(we.isUndefined(e))return null;if(lt){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(pt)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||!we.isFunction(n)&&"string"!=typeof n||(i=n,n=null),n=we.extend(a,n||{}),lt||(n.method="GET");var d="POST"===n.method,u=ht&&d&&"sendbeacon"===n.transport.toLowerCase(),l=n.verbose;t.verbose&&(l=!0),this.get_config("test")&&(t.test=1),l&&(t.verbose=1),this.get_config("img")&&(t.img=1),lt||(i?t.callback=i:(l||this.get_config("test"))&&(t.callback="(function(){})")),t.ip=this.get_config("ip")?1:0,t._=(new Date).getTime().toString(),d&&(c="data="+encodeURIComponent(t.data),delete t.data),e+="?"+we.HTTPBuildQuery(t);var p=this;if("img"in t){var h=he.createElement("img");h.src=e,he.body.appendChild(h)}else if(u){try{s=ht(e,c)}catch(v){p.report_error(v),s=!1}try{i&&i(s?1:0)}catch(v){p.report_error(v)}}else if(lt)try{var f=new XMLHttpRequest;f.open(n.method,e,!0);var m=this.get_config("xhr_headers");if(d&&(m["Content-Type"]="application/x-www-form-urlencoded"),we.each(m,(function(e,t){f.setRequestHeader(t,e)})),n.timeout_ms&&void 0!==f.timeout){f.timeout=n.timeout_ms;var g=(new Date).getTime()}f.withCredentials=!0,f.onreadystatechange=function(){var e;if(4===f.readyState)if(200===f.status){if(i)if(l){var t;try{t=we.JSONDecode(f.responseText)}catch(v){if(p.report_error(v),!n.ignore_json_errors)return;t=f.responseText}i(t)}else i(Number(f.responseText))}else if(e=f.timeout&&!f.status&&(new Date).getTime()-g>=f.timeout?"timeout":"Bad HTTP status: "+f.status+" "+f.statusText,p.report_error(e),i)if(l){var s=f.responseHeaders||{};i({status:0,httpStatusCode:f.status,error:e,retryAfter:s["Retry-After"]})}else i(0)},f.send(c)}catch(v){p.report_error(v),s=!1}else{var _=he.createElement("script");_.type="text/javascript",_.async=!0,_.defer=!0,_.src=e;var y=he.getElementsByTagName("script")[0];y.parentNode.insertBefore(_,y)}return s},MixpanelLib.prototype._execute_array=function(e){var t,n=[],i=[],s=[];we.each(e,(function(e){e&&(t=e[0],we.isArray(t)?s.push(e):"function"==typeof e?e.call(this):we.isArray(e)&&"alias"===t?n.push(e):we.isArray(e)&&-1!==t.indexOf("track")&&"function"==typeof this[t]?s.push(e):i.push(e))}),this);var execute=function(e,t){we.each(e,(function(e){if(we.isArray(e[0])){var n=t;we.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=we.bind((function(e){return new RequestBatcher(e.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:we.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:we.bind((function(t){return this._run_hook("before_send_"+e.type,t)}),this),stopAllBatchingFunc:we.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,we.each(this.request_batchers,(function(e){e.start()})))},MixpanelLib.prototype.stop_batch_senders=function(){this._batch_requests=!1,we.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=we.JSONEncode(e);return this.get_config("api_payload_format")===dt&&(t=we.base64Encode(t)),{data:t}},MixpanelLib.prototype._track_or_batch=function(e,t){var n=we.truncate(e.data,255),i=e.endpoint,s=e.batcher,a=e.should_send_immediately,c=e.send_request_options||{};t=t||NOOP_FUNC;var d=!0,u=we.bind((function(){return c.skip_hooks||(n=this._run_hook("before_send_"+e.type,n)),n?(Ie.log("MIXPANEL REQUEST:"),Ie.log(n),this._send_request(i,this._encode_data_for_request(n),c,this._prepare_callback(t,n))):null}),this);return this._batch_requests&&!a?s.enqueue(n,(function(e){e?t(1,n):u()})):d=u(),d&&n},MixpanelLib.prototype.track=addOptOutCheckMixpanelLib((function(e,t,n,i){i||"function"!=typeof n||(i=n,n=null);var s=(n=n||{}).transport;s&&(n.transport=s);var a=n.send_immediately;if("function"!=typeof i&&(i=NOOP_FUNC),we.isUndefined(e))this.report_error("No event name provided to mixpanel.track");else{if(!this._event_is_disabled(e)){(t=we.extend({},t)).token=this.get_config("token");var c=this.persistence.remove_event_timer(e);if(!we.isUndefined(c)){var d=(new Date).getTime()-c;t.$duration=parseFloat((d/1e3).toFixed(3))}this._set_default_superprops();var u=this.get_config("track_marketing")?we.info.marketingParams():{};t=we.extend({},we.info.properties({mp_loader:this.get_config("mp_loader")}),u,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),t);var l=this.get_config("property_blacklist");we.isArray(l)?we.each(l,(function(e){delete t[e]})):this.report_error("Invalid value for property_blacklist config: "+l);var p={event:e,properties:t};return this._track_or_batch({type:"events",data:p,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:a,send_request_options:n},i)}i(0)}})),MixpanelLib.prototype.set_group=addOptOutCheckMixpanelLib((function(e,t,n){we.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=we.extend({},t||{});return we.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=we.extend(we.info.mpPageViewProperties(),we.info.campaignParams(),we.info.clickParams()),s=we.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){we.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 _t={persistent:!0},options_for_register=function(e){var t;return t=we.isObject(e)?e:we.isUndefined(e)?{}:{days:e},we.extend({},_t,t)};MixpanelLib.prototype.register=function(e,t){var n=options_for_register(t);n.persistent?this.persistence.register(e,n.days):we.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"),we.each(e,(function(e,n){this.unpersisted_superprops.hasOwnProperty(n)&&this.unpersisted_superprops[n]!==t||(this.unpersisted_superprops[n]=e)}),this))},MixpanelLib.prototype.unregister=function(e,t){(t=options_for_register(t)).persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e]},MixpanelLib.prototype._register_single=function(e,t){var n={};n[e]=t,this.register(n)},MixpanelLib.prototype.identify=function(e,t,n,i,s,a,c,d){var u=this.get_distinct_id();if(e&&u!==e){if("string"==typeof e&&0===e.indexOf(ut))return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var l=u;this.register_once({$had_persisted_distinct_id:!0,$device_id:l},"")}e!==u&&e!==this.get_property(it)&&(this.unregister(it),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(t,n,i,s,a,c,d),e!==u&&this.track("$identify",{distinct_id:e,$anon_distinct_id:u},{skip_hooks:!0})},MixpanelLib.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=we.UUID();this.register_once({distinct_id:ut+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(nt))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var n=this;return we.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(it,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){we.isObject(e)&&(we.extend(this.config,e),e.batch_size&&we.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),z.DEBUG=z.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,ce.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!==ct&&(e=ct+"."+e),e},MixpanelLib.prototype._event_is_disabled=function(e){return we.isBlockedUA(ge)||this._flags.disable_all_events||we.include(this.__disabled_events,e)},MixpanelLib.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_tracking_persistence_type")&&we.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")&&!we.cookie.get("mp_optout")||(we.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=we.extend({track:we.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),we.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=we.extend({enable_persistence:!0},e),this._gdpr_call_func(optIn,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.opt_out_tracking=function(e){(e=we.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=we.extend({enable_persistence:!0},e),this._gdpr_call_func(clearOptInOut,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.report_error=function(e,t){Ie.error.apply(Ie.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){Ie.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=ft,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 yt={},override_mp_init_func=function(){at.init=function(e,t,n){if(n)return at[n]||(at[n]=yt[n]=create_mplib(e,t,n),at[n]._loaded()),at[n];var i=at;yt[ct]?i=yt[ct]:e&&((i=create_mplib(e,t,ct))._loaded(),yt[ct]=i),at=i,1===Ge&&(U[ct]=at),we.each(yt,(function(e,t){t!==ct&&(at[t]=e)})),at._=we}};var vt,bt,St,kt=function init_as_module(e){return load_extra_bundle=e,Ge=0,at=new MixpanelLib,override_mp_init_func(),at.init(),function(){function dom_loaded_handler(){dom_loaded_handler.done||(dom_loaded_handler.done=!0,gt=!0,pt=!1,we.each(yt,(function(e){e._dom_loaded()})))}if(he.addEventListener)"complete"===he.readyState?dom_loaded_handler():he.addEventListener("DOMContentLoaded",dom_loaded_handler,!1);else if(he.attachEvent){he.attachEvent("onreadystatechange",dom_loaded_handler);var e=!1;try{e=null===U.frameElement}catch(t){}he.documentElement.doScroll&&e&&function do_scroll_check(){try{he.documentElement.doScroll("left")}catch(t){return void setTimeout(do_scroll_check,1)}dom_loaded_handler()}()}we.register_event(U,"load",dom_loaded_handler,!0)}(),at}((function loadNoop(e,t){t()}));(bt=vt||(vt={})).assertEqual=e=>e,bt.assertIs=function assertIs(e){},bt.assertNever=function assertNever(e){throw new Error},bt.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},bt.getValidEnumValues=e=>{const t=bt.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),n={};for(const i of t)n[i]=e[i];return bt.objectValues(n)},bt.objectValues=e=>bt.objectKeys(e).map((function(t){return e[t]})),bt.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},bt.find=(e,t)=>{for(const n of e)if(t(n))return n},bt.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,bt.joinValues=function joinValues(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},bt.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(St||(St={})).mergeShapes=(e,t)=>({...e,...t});const wt=vt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=e=>{switch(typeof e){case"undefined":return wt.undefined;case"string":return wt.string;case"number":return isNaN(e)?wt.nan:wt.number;case"boolean":return wt.boolean;case"function":return wt.function;case"bigint":return wt.bigint;case"symbol":return wt.symbol;case"object":return Array.isArray(e)?wt.array:null===e?wt.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?wt.promise:"undefined"!=typeof Map&&e instanceof Map?wt.map:"undefined"!=typeof Set&&e instanceof Set?wt.set:"undefined"!=typeof Date&&e instanceof Date?wt.date:wt.object;default:return wt.unknown}},It=vt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ZodError extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},processError=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(processError);else if("invalid_return_type"===i.code)processError(i.returnTypeError);else if("invalid_arguments"===i.code)processError(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,s=0;for(;s<i.path.length;){const n=i.path[s];s===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],s++}}};return processError(this),n}static assert(e){if(!(e instanceof ZodError))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,vt.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}ZodError.create=e=>new ZodError(e);const errorMap=(e,t)=>{let n;switch(e.code){case It.invalid_type:n=e.received===wt.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case It.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,vt.jsonStringifyReplacer)}`;break;case It.unrecognized_keys:n=`Unrecognized key(s) in object: ${vt.joinValues(e.keys,", ")}`;break;case It.invalid_union:n="Invalid input";break;case It.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${vt.joinValues(e.options)}`;break;case It.invalid_enum_value:n=`Invalid enum value. Expected ${vt.joinValues(e.options)}, received '${e.received}'`;break;case It.invalid_arguments:n="Invalid function arguments";break;case It.invalid_return_type:n="Invalid function return type";break;case It.invalid_date:n="Invalid date";break;case It.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:vt.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case It.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case It.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case It.custom:n="Invalid input";break;case It.invalid_intersection_types:n="Intersection results could not be merged";break;case It.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case It.not_finite:n="Number must be finite";break;default:n=t.defaultError,vt.assertNever(e)}return{message:n}};let xt=errorMap;function getErrorMap(){return xt}const makeIssue=e=>{const{data:t,path:n,errorMaps:i,issueData:s}=e,a=[...n,...s.path||[]],c={...s,path:a};if(void 0!==s.message)return{...s,path:a,message:s.message};let d="";const u=i.filter((e=>!!e)).slice().reverse();for(const l of u)d=l(c,{data:t,defaultError:d}).message;return{...s,path:a,message:d}};function addIssueToContext(e,t){const n=getErrorMap(),i=makeIssue({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===errorMap?void 0:errorMap].filter((e=>!!e))});e.common.issues.push(i)}class ParseStatus{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const i of t){if("aborted"===i.status)return Et;"dirty"===i.status&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const i of t){const e=await i.key,t=await i.value;n.push({key:e,value:t})}return ParseStatus.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const i of t){const{key:t,value:s}=i;if("aborted"===t.status)return Et;if("aborted"===s.status)return Et;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!i.alwaysSet||(n[t.value]=s.value)}return{status:e.value,value:n}}}const Et=Object.freeze({status:"aborted"}),DIRTY=e=>({status:"dirty",value:e}),OK=e=>({status:"valid",value:e}),isAborted=e=>"aborted"===e.status,isDirty=e=>"dirty"===e.status,isValid=e=>"valid"===e.status,isAsync=e=>"undefined"!=typeof Promise&&e instanceof Promise;function __classPrivateFieldGet(e,t,n,i){if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function __classPrivateFieldSet(e,t,n,i,s){if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var Ct,Ot,Tt,Rt;"function"==typeof SuppressedError&&SuppressedError,(Ot=Ct||(Ct={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},Ot.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class ParseInputLazyPath{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(e,t)=>{if(isValid(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ZodError(e.common.issues);return this._error=t,this._error}}};function processCreateParams(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:i,description:s}=e;if(t&&(n||i))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:s};return{errorMap:(t,s)=>{var a,c;const{message:d}=e;return"invalid_enum_value"===t.code?{message:null!=d?d:s.defaultError}:void 0===s.data?{message:null!==(a=null!=d?d:i)&&void 0!==a?a:s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:null!==(c=null!=d?d:n)&&void 0!==c?c:s.defaultError}},description:s}}class ZodType{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return getParsedType(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(isAsync(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const i={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},s=this._parseSync({data:e,path:i.path,parent:i});return handleResult(i,s)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(isAsync(i)?i:Promise.resolve(i));return handleResult(n,s)}refine(e,t){const getIssueProperties=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const i=e(t),setError=()=>n.addIssue({code:It.custom,...getIssueProperties(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(setError(),!1))):!!i||(setError(),!1)}))}refinement(e,t){return this._refinement(((n,i)=>!!e(n)||(i.addIssue("function"==typeof t?t(n,i):t),!1)))}_refinement(e){return new ZodEffects({schema:this,typeName:Vt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(e){return ZodUnion.create([this,e],this._def)}and(e){return ZodIntersection.create(this,e,this._def)}transform(e){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:Vt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:t,typeName:Vt.ZodDefault})}brand(){return new ZodBranded({typeName:Vt.ZodBranded,type:this,...processCreateParams(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:t,typeName:Vt.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ZodPipeline.create(this,e)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Mt=/^c[^\s-]{8,}$/i,Nt=/^[0-9a-z]+$/,Zt=/^[0-9A-HJKMNP-TV-Z]{26}$/,Pt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Dt=/^[a-z0-9_-]{21}$/i,At=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Lt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let jt;const Ft=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,qt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ut=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Bt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",$t=new RegExp(`^${Bt}$`);function timeRegexSource(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function datetimeRegex(e){let t=`${Bt}T${timeRegexSource(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}class ZodString extends ZodType{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==wt.string){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:It.invalid_type,expected:wt.string,received:t.parsedType}),Et}const t=new ParseStatus;let n;for(const c of this._def.checks)if("min"===c.kind)e.data.length<c.value&&(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:It.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),t.dirty());else if("max"===c.kind)e.data.length>c.value&&(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:It.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),t.dirty());else if("length"===c.kind){const i=e.data.length>c.value,s=e.data.length<c.value;(i||s)&&(n=this._getOrReturnCtx(e,n),i?addIssueToContext(n,{code:It.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):s&&addIssueToContext(n,{code:It.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),t.dirty())}else if("email"===c.kind)Lt.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"email",code:It.invalid_string,message:c.message}),t.dirty());else if("emoji"===c.kind)jt||(jt=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),jt.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"emoji",code:It.invalid_string,message:c.message}),t.dirty());else if("uuid"===c.kind)Pt.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"uuid",code:It.invalid_string,message:c.message}),t.dirty());else if("nanoid"===c.kind)Dt.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"nanoid",code:It.invalid_string,message:c.message}),t.dirty());else if("cuid"===c.kind)Mt.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"cuid",code:It.invalid_string,message:c.message}),t.dirty());else if("cuid2"===c.kind)Nt.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"cuid2",code:It.invalid_string,message:c.message}),t.dirty());else if("ulid"===c.kind)Zt.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"ulid",code:It.invalid_string,message:c.message}),t.dirty());else if("url"===c.kind)try{new URL(e.data)}catch(a){n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"url",code:It.invalid_string,message:c.message}),t.dirty()}else if("regex"===c.kind){c.regex.lastIndex=0;c.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"regex",code:It.invalid_string,message:c.message}),t.dirty())}else if("trim"===c.kind)e.data=e.data.trim();else if("includes"===c.kind)e.data.includes(c.value,c.position)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:It.invalid_string,validation:{includes:c.value,position:c.position},message:c.message}),t.dirty());else if("toLowerCase"===c.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===c.kind)e.data=e.data.toUpperCase();else if("startsWith"===c.kind)e.data.startsWith(c.value)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:It.invalid_string,validation:{startsWith:c.value},message:c.message}),t.dirty());else if("endsWith"===c.kind)e.data.endsWith(c.value)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:It.invalid_string,validation:{endsWith:c.value},message:c.message}),t.dirty());else if("datetime"===c.kind){datetimeRegex(c).test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:It.invalid_string,validation:"datetime",message:c.message}),t.dirty())}else if("date"===c.kind){$t.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:It.invalid_string,validation:"date",message:c.message}),t.dirty())}else if("time"===c.kind){new RegExp(`^${timeRegexSource(c)}$`).test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:It.invalid_string,validation:"time",message:c.message}),t.dirty())}else"duration"===c.kind?At.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"duration",code:It.invalid_string,message:c.message}),t.dirty()):"ip"===c.kind?(i=e.data,("v4"!==(s=c.version)&&s||!Ft.test(i))&&("v6"!==s&&s||!qt.test(i))&&(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"ip",code:It.invalid_string,message:c.message}),t.dirty())):"base64"===c.kind?Ut.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"base64",code:It.invalid_string,message:c.message}),t.dirty()):vt.assertNever(c);var i,s;return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:It.invalid_string,...Ct.errToObj(n)})}_addCheck(e){return new ZodString({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ct.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ct.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ct.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ct.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ct.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ct.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ct.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ct.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ct.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ct.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...Ct.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Ct.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ct.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ct.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Ct.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ct.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ct.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ct.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ct.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ct.errToObj(t)})}nonempty(e){return this.min(1,Ct.errToObj(e))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function floatSafeRemainder(e,t){const n=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,s=n>i?n:i;return parseInt(e.toFixed(s).replace(".",""))%parseInt(t.toFixed(s).replace(".",""))/Math.pow(10,s)}ZodString.create=e=>{var t;return new ZodString({checks:[],typeName:Vt.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==wt.number){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:It.invalid_type,expected:wt.number,received:t.parsedType}),Et}let t;const n=new ParseStatus;for(const i of this._def.checks)if("int"===i.kind)vt.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:It.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty());else if("min"===i.kind){(i.inclusive?e.data<i.value:e.data<=i.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:It.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty())}else if("max"===i.kind){(i.inclusive?e.data>i.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:It.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty())}else"multipleOf"===i.kind?0!==floatSafeRemainder(e.data,i.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:It.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):"finite"===i.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:It.not_finite,message:i.message}),n.dirty()):vt.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,i){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(i)}]})}_addCheck(e){return new ZodNumber({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ct.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ct.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ct.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ct.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&vt.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ZodNumber.create=e=>new ZodNumber({checks:[],typeName:Vt.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==wt.bigint){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:It.invalid_type,expected:wt.bigint,received:t.parsedType}),Et}let t;const n=new ParseStatus;for(const i of this._def.checks)if("min"===i.kind){(i.inclusive?e.data<i.value:e.data<=i.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:It.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty())}else if("max"===i.kind){(i.inclusive?e.data>i.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:It.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty())}else"multipleOf"===i.kind?e.data%i.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:It.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):vt.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,i){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(i)}]})}_addCheck(e){return new ZodBigInt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ZodBigInt.create=e=>{var t;return new ZodBigInt({checks:[],typeName:Vt.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodBoolean extends ZodType{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==wt.boolean){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:It.invalid_type,expected:wt.boolean,received:t.parsedType}),Et}return OK(e.data)}}ZodBoolean.create=e=>new ZodBoolean({typeName:Vt.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodDate extends ZodType{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==wt.date){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:It.invalid_type,expected:wt.date,received:t.parsedType}),Et}if(isNaN(e.data.getTime())){return addIssueToContext(this._getOrReturnCtx(e),{code:It.invalid_date}),Et}const t=new ParseStatus;let n;for(const i of this._def.checks)"min"===i.kind?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:It.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),t.dirty()):"max"===i.kind?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:It.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),t.dirty()):vt.assertNever(i);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ZodDate({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ct.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ct.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ZodDate.create=e=>new ZodDate({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Vt.ZodDate,...processCreateParams(e)});class ZodSymbol extends ZodType{_parse(e){if(this._getType(e)!==wt.symbol){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:It.invalid_type,expected:wt.symbol,received:t.parsedType}),Et}return OK(e.data)}}ZodSymbol.create=e=>new ZodSymbol({typeName:Vt.ZodSymbol,...processCreateParams(e)});class ZodUndefined extends ZodType{_parse(e){if(this._getType(e)!==wt.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:It.invalid_type,expected:wt.undefined,received:t.parsedType}),Et}return OK(e.data)}}ZodUndefined.create=e=>new ZodUndefined({typeName:Vt.ZodUndefined,...processCreateParams(e)});class ZodNull extends ZodType{_parse(e){if(this._getType(e)!==wt.null){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:It.invalid_type,expected:wt.null,received:t.parsedType}),Et}return OK(e.data)}}ZodNull.create=e=>new ZodNull({typeName:Vt.ZodNull,...processCreateParams(e)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(e){return OK(e.data)}}ZodAny.create=e=>new ZodAny({typeName:Vt.ZodAny,...processCreateParams(e)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(e){return OK(e.data)}}ZodUnknown.create=e=>new ZodUnknown({typeName:Vt.ZodUnknown,...processCreateParams(e)});class ZodNever extends ZodType{_parse(e){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:It.invalid_type,expected:wt.never,received:t.parsedType}),Et}}ZodNever.create=e=>new ZodNever({typeName:Vt.ZodNever,...processCreateParams(e)});class ZodVoid extends ZodType{_parse(e){if(this._getType(e)!==wt.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:It.invalid_type,expected:wt.void,received:t.parsedType}),Et}return OK(e.data)}}ZodVoid.create=e=>new ZodVoid({typeName:Vt.ZodVoid,...processCreateParams(e)});class ZodArray extends ZodType{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==wt.array)return addIssueToContext(t,{code:It.invalid_type,expected:wt.array,received:t.parsedType}),Et;if(null!==i.exactLength){const e=t.data.length>i.exactLength.value,s=t.data.length<i.exactLength.value;(e||s)&&(addIssueToContext(t,{code:e?It.too_big:It.too_small,minimum:s?i.exactLength.value:void 0,maximum:e?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(null!==i.minLength&&t.data.length<i.minLength.value&&(addIssueToContext(t,{code:It.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),null!==i.maxLength&&t.data.length>i.maxLength.value&&(addIssueToContext(t,{code:It.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>i.type._parseAsync(new ParseInputLazyPath(t,e,t.path,n))))).then((e=>ParseStatus.mergeArray(n,e)));const s=[...t.data].map(((e,n)=>i.type._parseSync(new ParseInputLazyPath(t,e,t.path,n))));return ParseStatus.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new ZodArray({...this._def,minLength:{value:e,message:Ct.toString(t)}})}max(e,t){return new ZodArray({...this._def,maxLength:{value:e,message:Ct.toString(t)}})}length(e,t){return new ZodArray({...this._def,exactLength:{value:e,message:Ct.toString(t)}})}nonempty(e){return this.min(1,e)}}function deepPartialify(e){if(e instanceof ZodObject){const t={};for(const n in e.shape){const i=e.shape[n];t[n]=ZodOptional.create(deepPartialify(i))}return new ZodObject({...e._def,shape:()=>t})}return e instanceof ZodArray?new ZodArray({...e._def,type:deepPartialify(e.element)}):e instanceof ZodOptional?ZodOptional.create(deepPartialify(e.unwrap())):e instanceof ZodNullable?ZodNullable.create(deepPartialify(e.unwrap())):e instanceof ZodTuple?ZodTuple.create(e.items.map((e=>deepPartialify(e)))):e}ZodArray.create=(e,t)=>new ZodArray({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Vt.ZodArray,...processCreateParams(t)});class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=vt.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==wt.object){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:It.invalid_type,expected:wt.object,received:t.parsedType}),Et}const{status:t,ctx:n}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof ZodNever&&"strip"===this._def.unknownKeys))for(const d in n.data)s.includes(d)||a.push(d);const c=[];for(const d of s){const e=i[d],t=n.data[d];c.push({key:{status:"valid",value:d},value:e._parse(new ParseInputLazyPath(n,t,n.path,d)),alwaysSet:d in n.data})}if(this._def.catchall instanceof ZodNever){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of a)c.push({key:{status:"valid",value:t},value:{status:"valid",value:n.data[t]}});else if("strict"===e)a.length>0&&(addIssueToContext(n,{code:It.unrecognized_keys,keys:a}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of a){const i=n.data[t];c.push({key:{status:"valid",value:t},value:e._parse(new ParseInputLazyPath(n,i,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of c){const n=await t.key,i=await t.value;e.push({key:n,value:i,alwaysSet:t.alwaysSet})}return e})).then((e=>ParseStatus.mergeObjectSync(t,e))):ParseStatus.mergeObjectSync(t,c)}get shape(){return this._def.shape()}strict(e){return Ct.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var i,s,a,c;const d=null!==(a=null===(s=(i=this._def).errorMap)||void 0===s?void 0:s.call(i,t,n).message)&&void 0!==a?a:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(c=Ct.errToObj(e).message)&&void 0!==c?c:d}:{message:d}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(e){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ZodObject({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Vt.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ZodObject({...this._def,catchall:e})}pick(e){const t={};return vt.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new ZodObject({...this._def,shape:()=>t})}omit(e){const t={};return vt.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new ZodObject({...this._def,shape:()=>t})}deepPartial(){return deepPartialify(this)}partial(e){const t={};return vt.objectKeys(this.shape).forEach((n=>{const i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()})),new ZodObject({...this._def,shape:()=>t})}required(e){const t={};return vt.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof ZodOptional;)e=e._def.innerType;t[n]=e}})),new ZodObject({...this._def,shape:()=>t})}keyof(){return createZodEnum(vt.objectKeys(this.shape))}}ZodObject.create=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:Vt.ZodObject,...processCreateParams(t)}),ZodObject.strictCreate=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strict",catchall:ZodNever.create(),typeName:Vt.ZodObject,...processCreateParams(t)}),ZodObject.lazycreate=(e,t)=>new ZodObject({shape:e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:Vt.ZodObject,...processCreateParams(t)});class ZodUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function handleResults(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const i of e)if("dirty"===i.result.status)return t.common.issues.push(...i.ctx.common.issues),i.result;const n=e.map((e=>new ZodError(e.ctx.common.issues)));return addIssueToContext(t,{code:It.invalid_union,unionErrors:n}),Et}));{let e;const i=[];for(const a of n){const n={...t,common:{...t.common,issues:[]},parent:null},s=a._parseSync({data:t.data,path:t.path,parent:n});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:n}),n.common.issues.length&&i.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const s=i.map((e=>new ZodError(e)));return addIssueToContext(t,{code:It.invalid_union,unionErrors:s}),Et}}get options(){return this._def.options}}ZodUnion.create=(e,t)=>new ZodUnion({options:e,typeName:Vt.ZodUnion,...processCreateParams(t)});const getDiscriminator=e=>e instanceof ZodLazy?getDiscriminator(e.schema):e instanceof ZodEffects?getDiscriminator(e.innerType()):e instanceof ZodLiteral?[e.value]:e instanceof ZodEnum?e.options:e instanceof ZodNativeEnum?vt.objectValues(e.enum):e instanceof ZodDefault?getDiscriminator(e._def.innerType):e instanceof ZodUndefined?[void 0]:e instanceof ZodNull?[null]:e instanceof ZodOptional?[void 0,...getDiscriminator(e.unwrap())]:e instanceof ZodNullable?[null,...getDiscriminator(e.unwrap())]:e instanceof ZodBranded||e instanceof ZodReadonly?getDiscriminator(e.unwrap()):e instanceof ZodCatch?getDiscriminator(e._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==wt.object)return addIssueToContext(t,{code:It.invalid_type,expected:wt.object,received:t.parsedType}),Et;const n=this.discriminator,i=t.data[n],s=this.optionsMap.get(i);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(addIssueToContext(t,{code:It.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Et)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const i=new Map;for(const s of t){const t=getDiscriminator(s.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(i.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);i.set(n,s)}}return new ZodDiscriminatedUnion({typeName:Vt.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...processCreateParams(n)})}}function mergeValues(e,t){const n=getParsedType(e),i=getParsedType(t);if(e===t)return{valid:!0,data:e};if(n===wt.object&&i===wt.object){const n=vt.objectKeys(t),i=vt.objectKeys(e).filter((e=>-1!==n.indexOf(e))),s={...e,...t};for(const a of i){const n=mergeValues(e[a],t[a]);if(!n.valid)return{valid:!1};s[a]=n.data}return{valid:!0,data:s}}if(n===wt.array&&i===wt.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let i=0;i<e.length;i++){const s=mergeValues(e[i],t[i]);if(!s.valid)return{valid:!1};n.push(s.data)}return{valid:!0,data:n}}return n===wt.date&&i===wt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class ZodIntersection extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),handleParsed=(e,i)=>{if(isAborted(e)||isAborted(i))return Et;const s=mergeValues(e.value,i.value);return s.valid?((isDirty(e)||isDirty(i))&&t.dirty(),{status:t.value,value:s.data}):(addIssueToContext(n,{code:It.invalid_intersection_types}),Et)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>handleParsed(e,t))):handleParsed(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ZodIntersection.create=(e,t,n)=>new ZodIntersection({left:e,right:t,typeName:Vt.ZodIntersection,...processCreateParams(n)});class ZodTuple extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==wt.array)return addIssueToContext(n,{code:It.invalid_type,expected:wt.array,received:n.parsedType}),Et;if(n.data.length<this._def.items.length)return addIssueToContext(n,{code:It.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Et;!this._def.rest&&n.data.length>this._def.items.length&&(addIssueToContext(n,{code:It.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const i=[...n.data].map(((e,t)=>{const i=this._def.items[t]||this._def.rest;return i?i._parse(new ParseInputLazyPath(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(i).then((e=>ParseStatus.mergeArray(t,e))):ParseStatus.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new ZodTuple({...this._def,rest:e})}}ZodTuple.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:e,typeName:Vt.ZodTuple,rest:null,...processCreateParams(t)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==wt.object)return addIssueToContext(n,{code:It.invalid_type,expected:wt.object,received:n.parsedType}),Et;const i=[],s=this._def.keyType,a=this._def.valueType;for(const c in n.data)i.push({key:s._parse(new ParseInputLazyPath(n,c,n.path,c)),value:a._parse(new ParseInputLazyPath(n,n.data[c],n.path,c)),alwaysSet:c in n.data});return n.common.async?ParseStatus.mergeObjectAsync(t,i):ParseStatus.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return new ZodRecord(t instanceof ZodType?{keyType:e,valueType:t,typeName:Vt.ZodRecord,...processCreateParams(n)}:{keyType:ZodString.create(),valueType:e,typeName:Vt.ZodRecord,...processCreateParams(t)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==wt.map)return addIssueToContext(n,{code:It.invalid_type,expected:wt.map,received:n.parsedType}),Et;const i=this._def.keyType,s=this._def.valueType,a=[...n.data.entries()].map((([e,t],a)=>({key:i._parse(new ParseInputLazyPath(n,e,n.path,[a,"key"])),value:s._parse(new ParseInputLazyPath(n,t,n.path,[a,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of a){const i=await n.key,s=await n.value;if("aborted"===i.status||"aborted"===s.status)return Et;"dirty"!==i.status&&"dirty"!==s.status||t.dirty(),e.set(i.value,s.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of a){const i=n.key,s=n.value;if("aborted"===i.status||"aborted"===s.status)return Et;"dirty"!==i.status&&"dirty"!==s.status||t.dirty(),e.set(i.value,s.value)}return{status:t.value,value:e}}}}ZodMap.create=(e,t,n)=>new ZodMap({valueType:t,keyType:e,typeName:Vt.ZodMap,...processCreateParams(n)});class ZodSet extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==wt.set)return addIssueToContext(n,{code:It.invalid_type,expected:wt.set,received:n.parsedType}),Et;const i=this._def;null!==i.minSize&&n.data.size<i.minSize.value&&(addIssueToContext(n,{code:It.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),null!==i.maxSize&&n.data.size>i.maxSize.value&&(addIssueToContext(n,{code:It.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const s=this._def.valueType;function finalizeSet(e){const n=new Set;for(const i of e){if("aborted"===i.status)return Et;"dirty"===i.status&&t.dirty(),n.add(i.value)}return{status:t.value,value:n}}const a=[...n.data.values()].map(((e,t)=>s._parse(new ParseInputLazyPath(n,e,n.path,t))));return n.common.async?Promise.all(a).then((e=>finalizeSet(e))):finalizeSet(a)}min(e,t){return new ZodSet({...this._def,minSize:{value:e,message:Ct.toString(t)}})}max(e,t){return new ZodSet({...this._def,maxSize:{value:e,message:Ct.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ZodSet.create=(e,t)=>new ZodSet({valueType:e,minSize:null,maxSize:null,typeName:Vt.ZodSet,...processCreateParams(t)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==wt.function)return addIssueToContext(t,{code:It.invalid_type,expected:wt.function,received:t.parsedType}),Et;function makeArgsIssue(e,n){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:It.invalid_arguments,argumentsError:n}})}function makeReturnsIssue(e,n){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:It.invalid_return_type,returnTypeError:n}})}const n={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof ZodPromise){const e=this;return OK((async function(...t){const s=new ZodError([]),a=await e._def.args.parseAsync(t,n).catch((e=>{throw s.addIssue(makeArgsIssue(t,e)),s})),c=await Reflect.apply(i,this,a);return await e._def.returns._def.type.parseAsync(c,n).catch((e=>{throw s.addIssue(makeReturnsIssue(c,e)),s}))}))}{const e=this;return OK((function(...t){const s=e._def.args.safeParse(t,n);if(!s.success)throw new ZodError([makeArgsIssue(t,s.error)]);const a=Reflect.apply(i,this,s.data),c=e._def.returns.safeParse(a,n);if(!c.success)throw new ZodError([makeReturnsIssue(a,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ZodFunction({...this._def,args:ZodTuple.create(e).rest(ZodUnknown.create())})}returns(e){return new ZodFunction({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new ZodFunction({args:e||ZodTuple.create([]).rest(ZodUnknown.create()),returns:t||ZodUnknown.create(),typeName:Vt.ZodFunction,...processCreateParams(n)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ZodLazy.create=(e,t)=>new ZodLazy({getter:e,typeName:Vt.ZodLazy,...processCreateParams(t)});class ZodLiteral extends ZodType{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{received:t.data,code:It.invalid_literal,expected:this._def.value}),Et}return{status:"valid",value:e.data}}get value(){return this._def.value}}function createZodEnum(e,t){return new ZodEnum({values:e,typeName:Vt.ZodEnum,...processCreateParams(t)})}ZodLiteral.create=(e,t)=>new ZodLiteral({value:e,typeName:Vt.ZodLiteral,...processCreateParams(t)});class ZodEnum extends ZodType{constructor(){super(...arguments),Tt.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return addIssueToContext(t,{expected:vt.joinValues(n),received:t.parsedType,code:It.invalid_type}),Et}if(__classPrivateFieldGet(this,Tt)||__classPrivateFieldSet(this,Tt,new Set(this._def.values)),!__classPrivateFieldGet(this,Tt).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return addIssueToContext(t,{received:t.data,code:It.invalid_enum_value,options:n}),Et}return OK(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ZodEnum.create(e,{...this._def,...t})}exclude(e,t=this._def){return ZodEnum.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Tt=new WeakMap,ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),Rt.set(this,void 0)}_parse(e){const t=vt.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==wt.string&&n.parsedType!==wt.number){const e=vt.objectValues(t);return addIssueToContext(n,{expected:vt.joinValues(e),received:n.parsedType,code:It.invalid_type}),Et}if(__classPrivateFieldGet(this,Rt)||__classPrivateFieldSet(this,Rt,new Set(vt.getValidEnumValues(this._def.values))),!__classPrivateFieldGet(this,Rt).has(e.data)){const e=vt.objectValues(t);return addIssueToContext(n,{received:n.data,code:It.invalid_enum_value,options:e}),Et}return OK(e.data)}get enum(){return this._def.values}}Rt=new WeakMap,ZodNativeEnum.create=(e,t)=>new ZodNativeEnum({values:e,typeName:Vt.ZodNativeEnum,...processCreateParams(t)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==wt.promise&&!1===t.common.async)return addIssueToContext(t,{code:It.invalid_type,expected:wt.promise,received:t.parsedType}),Et;const n=t.parsedType===wt.promise?t.data:Promise.resolve(t.data);return OK(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}ZodPromise.create=(e,t)=>new ZodPromise({type:e,typeName:Vt.ZodPromise,...processCreateParams(t)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Vt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:e=>{addIssueToContext(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===i.type){const e=i.transform(n.data,s);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return Et;const i=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===i.status?Et:"dirty"===i.status||"dirty"===t.value?DIRTY(i.value):i}));{if("aborted"===t.value)return Et;const i=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===i.status?Et:"dirty"===i.status||"dirty"===t.value?DIRTY(i.value):i}}if("refinement"===i.type){const executeRefinement=e=>{const t=i.refinement(e,s);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?Et:("dirty"===e.status&&t.dirty(),executeRefinement(e.value),{status:t.value,value:e.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>"aborted"===e.status?Et:("dirty"===e.status&&t.dirty(),executeRefinement(e.value).then((()=>({status:t.value,value:e.value}))))))}if("transform"===i.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!isValid(e))return e;const a=i.transform(e.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>isValid(e)?Promise.resolve(i.transform(e.value,s)).then((e=>({status:t.value,value:e}))):e))}vt.assertNever(i)}}ZodEffects.create=(e,t,n)=>new ZodEffects({schema:e,typeName:Vt.ZodEffects,effect:t,...processCreateParams(n)}),ZodEffects.createWithPreprocess=(e,t,n)=>new ZodEffects({schema:t,effect:{type:"preprocess",transform:e},typeName:Vt.ZodEffects,...processCreateParams(n)});class ZodOptional extends ZodType{_parse(e){return this._getType(e)===wt.undefined?OK(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodOptional.create=(e,t)=>new ZodOptional({innerType:e,typeName:Vt.ZodOptional,...processCreateParams(t)});class ZodNullable extends ZodType{_parse(e){return this._getType(e)===wt.null?OK(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodNullable.create=(e,t)=>new ZodNullable({innerType:e,typeName:Vt.ZodNullable,...processCreateParams(t)});class ZodDefault extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===wt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ZodDefault.create=(e,t)=>new ZodDefault({innerType:e,typeName:Vt.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...processCreateParams(t)});class ZodCatch extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return isAsync(i)?i.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new ZodError(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===i.status?i.value:this._def.catchValue({get error(){return new ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(e,t)=>new ZodCatch({innerType:e,typeName:Vt.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...processCreateParams(t)});class ZodNaN extends ZodType{_parse(e){if(this._getType(e)!==wt.nan){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:It.invalid_type,expected:wt.nan,received:t.parsedType}),Et}return{status:"valid",value:e.data}}}ZodNaN.create=e=>new ZodNaN({typeName:Vt.ZodNaN,...processCreateParams(e)});const zt=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?Et:"dirty"===e.status?(t.dirty(),DIRTY(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?Et:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new ZodPipeline({in:e,out:t,typeName:Vt.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(e){const t=this._def.innerType._parse(e),freeze=e=>(isValid(e)&&(e.value=Object.freeze(e.value)),e);return isAsync(t)?t.then((e=>freeze(e))):freeze(t)}unwrap(){return this._def.innerType}}function custom(e,t={},n){return e?ZodAny.create().superRefine(((i,s)=>{var a,c;if(!e(i)){const e="function"==typeof t?t(i):"string"==typeof t?{message:t}:t,d=null===(c=null!==(a=e.fatal)&&void 0!==a?a:n)||void 0===c||c,u="string"==typeof e?{message:e}:e;s.addIssue({code:"custom",...u,fatal:d})}})):ZodAny.create()}ZodReadonly.create=(e,t)=>new ZodReadonly({innerType:e,typeName:Vt.ZodReadonly,...processCreateParams(t)});const Wt={object:ZodObject.lazycreate};var Vt,Kt;(Kt=Vt||(Vt={})).ZodString="ZodString",Kt.ZodNumber="ZodNumber",Kt.ZodNaN="ZodNaN",Kt.ZodBigInt="ZodBigInt",Kt.ZodBoolean="ZodBoolean",Kt.ZodDate="ZodDate",Kt.ZodSymbol="ZodSymbol",Kt.ZodUndefined="ZodUndefined",Kt.ZodNull="ZodNull",Kt.ZodAny="ZodAny",Kt.ZodUnknown="ZodUnknown",Kt.ZodNever="ZodNever",Kt.ZodVoid="ZodVoid",Kt.ZodArray="ZodArray",Kt.ZodObject="ZodObject",Kt.ZodUnion="ZodUnion",Kt.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Kt.ZodIntersection="ZodIntersection",Kt.ZodTuple="ZodTuple",Kt.ZodRecord="ZodRecord",Kt.ZodMap="ZodMap",Kt.ZodSet="ZodSet",Kt.ZodFunction="ZodFunction",Kt.ZodLazy="ZodLazy",Kt.ZodLiteral="ZodLiteral",Kt.ZodEnum="ZodEnum",Kt.ZodEffects="ZodEffects",Kt.ZodNativeEnum="ZodNativeEnum",Kt.ZodOptional="ZodOptional",Kt.ZodNullable="ZodNullable",Kt.ZodDefault="ZodDefault",Kt.ZodCatch="ZodCatch",Kt.ZodPromise="ZodPromise",Kt.ZodBranded="ZodBranded",Kt.ZodPipeline="ZodPipeline",Kt.ZodReadonly="ZodReadonly";const Ht=ZodString.create,Gt=ZodNumber.create,Jt=ZodNaN.create,Yt=ZodBigInt.create,Xt=ZodBoolean.create,Qt=ZodDate.create,er=ZodSymbol.create,tr=ZodUndefined.create,rr=ZodNull.create,nr=ZodAny.create,ir=ZodUnknown.create,or=ZodNever.create,sr=ZodVoid.create,ar=ZodArray.create,cr=ZodObject.create,dr=ZodObject.strictCreate,ur=ZodUnion.create,lr=ZodDiscriminatedUnion.create,pr=ZodIntersection.create,hr=ZodTuple.create,fr=ZodRecord.create,mr=ZodMap.create,gr=ZodSet.create,_r=ZodFunction.create,yr=ZodLazy.create,vr=ZodLiteral.create,br=ZodEnum.create,Sr=ZodNativeEnum.create,kr=ZodPromise.create,wr=ZodEffects.create,Ir=ZodOptional.create,xr=ZodNullable.create,Er=ZodEffects.createWithPreprocess,Cr=ZodPipeline.create,Or={string:e=>ZodString.create({...e,coerce:!0}),number:e=>ZodNumber.create({...e,coerce:!0}),boolean:e=>ZodBoolean.create({...e,coerce:!0}),bigint:e=>ZodBigInt.create({...e,coerce:!0}),date:e=>ZodDate.create({...e,coerce:!0})},Tr=Et;var Rr=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap:function setErrorMap(e){xt=e},getErrorMap:getErrorMap,makeIssue:makeIssue,EMPTY_PATH:[],addIssueToContext:addIssueToContext,ParseStatus:ParseStatus,INVALID:Et,DIRTY:DIRTY,OK:OK,isAborted:isAborted,isDirty:isDirty,isValid:isValid,isAsync:isAsync,get util(){return vt},get objectUtil(){return St},ZodParsedType:wt,getParsedType:getParsedType,ZodType:ZodType,datetimeRegex:datetimeRegex,ZodString:ZodString,ZodNumber:ZodNumber,ZodBigInt:ZodBigInt,ZodBoolean:ZodBoolean,ZodDate:ZodDate,ZodSymbol:ZodSymbol,ZodUndefined:ZodUndefined,ZodNull:ZodNull,ZodAny:ZodAny,ZodUnknown:ZodUnknown,ZodNever:ZodNever,ZodVoid:ZodVoid,ZodArray:ZodArray,ZodObject:ZodObject,ZodUnion:ZodUnion,ZodDiscriminatedUnion:ZodDiscriminatedUnion,ZodIntersection:ZodIntersection,ZodTuple:ZodTuple,ZodRecord:ZodRecord,ZodMap:ZodMap,ZodSet:ZodSet,ZodFunction:ZodFunction,ZodLazy:ZodLazy,ZodLiteral:ZodLiteral,ZodEnum:ZodEnum,ZodNativeEnum:ZodNativeEnum,ZodPromise:ZodPromise,ZodEffects:ZodEffects,ZodTransformer:ZodEffects,ZodOptional:ZodOptional,ZodNullable:ZodNullable,ZodDefault:ZodDefault,ZodCatch:ZodCatch,ZodNaN:ZodNaN,BRAND:zt,ZodBranded:ZodBranded,ZodPipeline:ZodPipeline,ZodReadonly:ZodReadonly,custom:custom,Schema:ZodType,ZodSchema:ZodType,late:Wt,get ZodFirstPartyTypeKind(){return Vt},coerce:Or,any:nr,array:ar,bigint:Yt,boolean:Xt,date:Qt,discriminatedUnion:lr,effect:wr,enum:br,function:_r,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>custom((t=>t instanceof e),t),intersection:pr,lazy:yr,literal:vr,map:mr,nan:Jt,nativeEnum:Sr,never:or,null:rr,nullable:xr,number:Gt,object:cr,oboolean:()=>Xt().optional(),onumber:()=>Gt().optional(),optional:Ir,ostring:()=>Ht().optional(),pipeline:Cr,preprocess:Er,promise:kr,record:fr,set:gr,strictObject:dr,string:Ht,symbol:er,transformer:wr,tuple:hr,undefined:tr,union:ur,unknown:ir,void:sr,NEVER:Tr,ZodIssueCode:It,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:ZodError});const Mr=Rr.object({departure_arrival:Rr.string().refine((e=>!isNaN(Date.parse(e))),{message:"Invalid departure arrival datetime format"}),departure_destination:Rr.string().refine((e=>e),{message:"Departure destination must be a string"}),departure_destination_terminal:Rr.string().refine((e=>e),{message:"Departure destination terminal must be a string"}),departure_line:Rr.string().refine((e=>e),{message:"Departure line must be a string"}),departure_origin:Rr.string().refine((e=>e),{message:"Departure origin must be a string"}),departure_origin_terminal:Rr.string().refine((e=>e),{message:"Departure origin terminal must be a string"}),departure_price:Rr.number().refine((e=>e),{message:"Departure price must be a number"}),departure_route:Rr.string().refine((e=>e),{message:"Departure route must be a string"}),departure_stop_cities:Rr.string().refine((e=>e),{message:"Departure stop cities must be a string"}),departure_stops:Rr.number().int().refine((e=>e),{message:"Departure stops must be an integer"}),departure_time:Rr.string().refine((e=>!isNaN(Date.parse(e))),{message:"Invalid departure time datetime format"}),departure_transport_type:Rr.string().refine((e=>e),{message:"Departure transport type must be a string"}),departure_transporter:Rr.string().refine((e=>e),{message:"Departure transporter must be a string"}),passenger_count:Rr.number().int().refine((e=>e),{message:"Passenger count must be an integer"}),payment_card_affiliate:Rr.string().or(Rr.null()).refine((e=>null===e||"string"==typeof e),{message:"Payment card affiliate must be a string or null"}),payment_type:Rr.string().refine((e=>e),{message:"Payment type must be a string"}),recommended_trip:Rr.boolean().refine((e=>e),{message:"Recommended trip must be a boolean"}),recommended_trip_type:Rr.string().or(Rr.null()).refine((e=>null===e||"string"==typeof e),{message:"Recommended trip type must be a string or null"}),routes:Rr.number().int().refine((e=>e),{message:"Routes must be an integer"}),tickets:Rr.number().int().refine((e=>e),{message:"Tickets must be an integer"}),total:Rr.number().refine((e=>e),{message:"Total must be a number"}),user_fingerprint:Rr.string().or(Rr.null()).refine((e=>null===e||"string"==typeof e),{message:"User fingerprint must be a string or null"}),product:Rr.string().refine((e=>e),{message:"Product must be a string"}),ip:Rr.string().regex(/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,{message:"Invalid IP address format"}),departure_ally:Rr.boolean().refine((e=>e),{message:"Departure ally must be a boolean"}).optional(),departure_multicarrier_lines:Rr.array(Rr.any()).refine((e=>e),{message:"Departure multicarrier lines must be an array"}).optional(),departure_multicarrier_transporters:Rr.array(Rr.any()).refine((e=>e),{message:"Departure multicarrier transporters must be an array"}).optional(),departure_open_ticket:Rr.boolean().refine((e=>e),{message:"Departure open ticket must be a boolean"}).optional(),departure_transport_types:Rr.string().refine((e=>e),{message:"Departure transport types must be a string"}).optional(),discount_code:Rr.string().refine((e=>e),{message:"Discount code must be a string"}).optional(),error_message:Rr.string().refine((e=>e),{message:"Error message must be a string"}).optional(),installments:Rr.number().int().refine((e=>e),{message:"Installments must be an integer"}).optional(),language:Rr.string().refine((e=>e),{message:"Language must be a string"}).optional(),on_demand:Rr.boolean().refine((e=>e),{message:"On demand must be a boolean"}).optional(),open_ticket:Rr.boolean().refine((e=>e),{message:"Open ticket must be a boolean"}).optional(),payment_engine:Rr.string().refine((e=>e),{message:"Payment engine must be a string"}).optional(),result_seats:Rr.boolean().refine((e=>e),{message:"Result seats must be a boolean"}).optional(),return_open_ticket:Rr.boolean().refine((e=>e),{message:"Return open ticket must be a boolean"}).optional(),save_card:Rr.boolean().refine((e=>e),{message:"Save card must be a boolean"}).optional(),tenant_name:Rr.string().refine((e=>e),{message:"Tenant name must be a string"}).optional(),token:Rr.string().refine((e=>e),{message:"Token must be a string"}).optional(),use_saved_card:Rr.boolean().refine((e=>e),{message:"Use saved card must be a boolean"}).optional(),user_type:Rr.string().refine((e=>e),{message:"User type must be a string"}).optional(),meta:Rr.object({}).refine((e=>e),{message:"Meta must be an object"}).optional(),phone:Rr.string().regex(/^\+?[1-9]\d{1,14}$/,{message:"Invalid phone number format"}).optional(),email:Rr.string().email({message:"Invalid email format"}).optional()}).strict(),Nr=Rr.object({bus_categories:Rr.string().min(1,"Bus categories are required"),departure_arrival:Rr.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/,"Invalid date-time format for departure arrival"),departure_destination:Rr.string().min(1,"Departure destination is required"),departure_destination_terminal:Rr.string().min(1,"Departure destination terminal is required"),departure_line:Rr.string().min(1,"Departure line is required"),departure_origin:Rr.string().min(1,"Departure origin is required"),departure_origin_terminal:Rr.string().min(1,"Departure origin terminal is required"),departure_price:Rr.number().positive("Departure price must be a positive number"),departure_route:Rr.string().min(1,"Departure route is required"),departure_stop_cities:Rr.string().min(1,"Departure stop cities are required"),departure_stops:Rr.number().int("Departure stops must be an integer"),departure_time:Rr.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/,"Invalid date-time format for departure time"),departure_transport_type:Rr.string().min(1,"Departure transport type is required"),departure_transporter:Rr.string().min(1,"Departure transporter is required"),passenger_count:Rr.number().int("Passenger count must be an integer"),payment_card_affiliate:Rr.string().nullable().optional(),payment_type:Rr.string().min(1,"Payment type is required"),recommended_trip:Rr.boolean().refine((e=>"boolean"==typeof e),{message:"Recommended trip must be a boolean"}),recommended_trip_type:Rr.string().nullable().optional(),routes:Rr.number().int("Routes must be an integer"),tickets:Rr.number().int("Tickets must be an integer"),total:Rr.number().positive("Total must be a positive number"),user_fingerprint:Rr.string().nullable().optional(),product:Rr.string().min(1,"Product is required"),ip:Rr.string().regex(/^(\d{1,3}\.){3}\d{1,3}$/,"Invalid IPv4 format"),meta:Rr.object({}).optional(),phone:Rr.string().regex(/^\+?[1-9]\d{1,14}$/,"Invalid phone format").optional(),email:Rr.string().email("Invalid email format").optional()}),Zr=Rr.object({}),Pr=Rr.object({mixpanelToken:Rr.string().min(1,"Mixpanel token is required"),debug:Rr.boolean().optional(),identificationKey:Rr.string().min(1,"Identification key is required")}),SchemaErrorFormatter=e=>e.issues.map((e=>{console.log("issue==>",e);let t="INVALID_FIELD",n="",i="",s="";return"invalid_type"===e.code?(t="TYPE_MISMATCH",n=e.expected,i=e.received,s=`Expected ${n} but received ${i}. Please provide a value of type ${n}.`):"too_small"===e.code?(t="VALUE_TOO_SMALL",s=`Increase the value to at least ${e.minimum}.`):"too_big"===e.code?(t="VALUE_TOO_BIG",s=`Reduce the value to no more than ${e.maximum}.`):(t="INVALID_FIELD",s="Ensure the field matches the expected format and value type."),{field:e.path.join("."),error_type:t,expected:n,received:i,message:e.message,suggestion:s}})),Dr={"Payment Failed":Mr,"Purchase Complete":Nr,"Track Test":Zr},Ar={parseEventProps(e,t){const n=Dr[e];if(!n)return{status:"error",message:`Event ${e} not found`};try{return n.parse(t),{status:"ok",message:"Schema is valid"}}catch(X){if(X instanceof ZodError){return{status:"error",message:"Schema validation failed",errors:SchemaErrorFormatter(X)}}return{status:"error",message:"Unknown validation error"}}},parseInitProps(e){try{return Pr.parse(e),{status:"ok",message:"Init props are valid"}}catch(X){if(X instanceof ZodError){return{status:"error",message:"Schema validation failed",errors:SchemaErrorFormatter(X)}}return{status:"error",message:"Unknown validation error"}}}};var __assign=function(){return __assign=Object.assign||function __assign2(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},__assign.apply(this,arguments)};function __awaiter(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 Lr={default:"endpoint"},jr={default:"tlsEndpoint"},Fr="Client timeout",qr="Network connection error",Ur="Network request aborted",Br="Response cannot be parsed",$r="Blocked by CSP",zr="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 Wr=E("WrongRegion"),Vr=E("SubscriptionNotActive"),Kr=E("UnsupportedVersion"),Hr=E("InstallationMethodRestricted"),Gr=E("HostnameRestricted"),Jr=E("IntegrationFailed"),Yr="API key required",Xr="API key not found",Qr="API key expired",en="Request cannot be parsed",tn="Request failed",rn="Request failed to process",nn="Too many requests, rate limit exceeded",sn="Not available for this origin",an="Not available with restricted header",cn=Yr,dn=Xr,un=Qr,ln="Failed to load the JS script of the agent",pn="9319";function M(e,t){var n,i,s,a,c,d=[],u=(c=function __spreadArray(e,t,n){if(n||2===arguments.length)for(var i,s=0,a=t.length;s<a;s++)!i&&s in t||(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))}([],e,!0),n={current:function(){return c[0]},postpone:function(){var e=c.shift();void 0!==e&&c.push(e)},exclude:function(){c.shift()}},a=0,i=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,a++))},s=new Set,[n.current(),function(e,t){var a,c=t instanceof Error?t.message:"";if(c===$r||c===zr)n.exclude(),a=0;else if(c===pn)n.exclude();else if(c===ln){var d=Date.now()-e.getTime()<50,u=n.current();u&&d&&!s.has(u)&&(s.add(u),a=0),n.postpone()}else n.postpone();var l=n.current();return void 0===l?void 0:[l,null!=a?a:e.getTime()+i()-Date.now()]}]),l=u[0],p=u[1];if(void 0===l)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var p2=function(e){var n=new Date,r3=function(t){return d.push({url:e,startedAt:n,finishedAt:new Date,error:t})},i=t(e);return i.then((function(){return r3()}),r3),i.catch((function(e){if(d.length>=5)throw e;var t=p(n,e);if(!t)throw e;var i,s=t[0],a=t[1];return(i=a,new Promise((function(e){return setTimeout(e,i)}))).then((function(){return p2(s)}))}))};return p2(l).then((function(e){return[e,d]}))}var hn="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",fn=hn;function F(e){var t;e.scriptUrlPattern;var n,i,s,a,c,d,u,l=e.token,p=e.apiKey,h=void 0===p?l:p,f=function __rest(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]])}return n}(e,["scriptUrlPattern","token","apiKey"]),m=null!==(t=function r(e,t){return n=e,i=t,Object.prototype.hasOwnProperty.call(n,i)?e[t]:void 0;var n,i}(e,"scriptUrlPattern"))&&void 0!==t?t:hn,g=(c=[],d=function(){c.push({time:new Date,state:document.visibilityState})},n=document,i="visibilitychange",s=d,n.addEventListener(i,s,a),u=function(){return n.removeEventListener(i,s,a)},d(),[c,u]),_=g[0],y=g[1];return Promise.resolve().then((function(){if(!h||"string"!=typeof h)throw new Error(Yr);var e=function(e,t){return(Array.isArray(e)?e:[e]).map((function(e){return function(e,t){var n=encodeURIComponent;return e.replace(/<[^<>]+>/g,(function(e){return"<version>"===e?"3":"<apiKey>"===e?n(t):"<loaderVersion>"===e?n("3.11.1"):e}))}(String(e),t)}))}(m,h);return M(e,V)})).catch((function(e){throw y(),function(e){return e instanceof Error&&e.message===pn?new Error(ln):e}(e)})).then((function(e){var t=e[0],n=e[1];return y(),t.load(__assign(__assign({},f),{ldi:{attempts:n,visibilityStates:_}}))}))}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(zr);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(ln))},i.async=!0,i.src=t,s.appendChild(i)}));var t}),(function(){throw new Error($r)})).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(pn);return c}var mn={load:F,defaultScriptUrlPattern:fn,ERROR_SCRIPT_LOAD_FAIL:ln,ERROR_API_KEY_EXPIRED:Qr,ERROR_API_KEY_INVALID:Xr,ERROR_API_KEY_MISSING:Yr,ERROR_BAD_REQUEST_FORMAT:en,ERROR_BAD_RESPONSE_FORMAT:Br,ERROR_CLIENT_TIMEOUT:Fr,ERROR_CSP_BLOCK:$r,ERROR_FORBIDDEN_ENDPOINT:Gr,ERROR_FORBIDDEN_HEADER:an,ERROR_FORBIDDEN_ORIGIN:sn,ERROR_GENERAL_SERVER_FAILURE:tn,ERROR_INSTALLATION_METHOD_RESTRICTED:Hr,ERROR_INTEGRATION_FAILURE:Jr,ERROR_INVALID_ENDPOINT:zr,ERROR_NETWORK_ABORT:Ur,ERROR_NETWORK_CONNECTION:qr,ERROR_RATE_LIMIT:nn,ERROR_SERVER_TIMEOUT:rn,ERROR_SUBSCRIPTION_NOT_ACTIVE:Vr,ERROR_TOKEN_EXPIRED:un,ERROR_TOKEN_INVALID:dn,ERROR_TOKEN_MISSING:cn,ERROR_UNSUPPORTED_VERSION:Kr,ERROR_WRONG_REGION:Wr,defaultEndpoint:Lr,defaultTlsEndpoint:jr};const gn=Object.freeze(Object.defineProperty({__proto__:null,ERROR_API_KEY_EXPIRED:Qr,ERROR_API_KEY_INVALID:Xr,ERROR_API_KEY_MISSING:Yr,ERROR_BAD_REQUEST_FORMAT:en,ERROR_BAD_RESPONSE_FORMAT:Br,ERROR_CLIENT_TIMEOUT:Fr,ERROR_CSP_BLOCK:$r,ERROR_FORBIDDEN_ENDPOINT:Gr,ERROR_FORBIDDEN_HEADER:an,ERROR_FORBIDDEN_ORIGIN:sn,ERROR_GENERAL_SERVER_FAILURE:tn,ERROR_INSTALLATION_METHOD_RESTRICTED:Hr,ERROR_INTEGRATION_FAILURE:Jr,ERROR_INVALID_ENDPOINT:zr,ERROR_NETWORK_ABORT:Ur,ERROR_NETWORK_CONNECTION:qr,ERROR_RATE_LIMIT:nn,ERROR_SCRIPT_LOAD_FAIL:ln,ERROR_SERVER_TIMEOUT:rn,ERROR_SUBSCRIPTION_NOT_ACTIVE:Vr,ERROR_TOKEN_EXPIRED:un,ERROR_TOKEN_INVALID:dn,ERROR_TOKEN_MISSING:cn,ERROR_UNSUPPORTED_VERSION:Kr,ERROR_WRONG_REGION:Wr,default:mn,defaultEndpoint:Lr,defaultScriptUrlPattern:fn,defaultTlsEndpoint:jr,load:F},Symbol.toStringTag,{value:"Module"})),_n="@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=_n){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=_n){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 yn,vn;(vn=yn||(yn={})).Memory="memory",vn.LocalStorage="localstorage",vn.SessionStorage="sessionstorage",vn.NoCache="nocache";const bn={[yn.Memory]:()=>(new InMemoryCache).enclosedCache,[yn.LocalStorage]:e=>new LocalStorageCache(e),[yn.SessionStorage]:e=>new SessionStorageCache(e),[yn.NoCache]:()=>new CacheStub},cacheFactory=e=>bn[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)||yn.SessionStorage,!cacheFactory(this.cacheLocation))throw new Error(`Invalid cache location "${this.cacheLocation}"`);(e=>{switch(e){case yn.SessionStorage:try{window.sessionStorage.getItem("item")}catch(t){return!1}return!0;case yn.LocalStorage:try{window.localStorage.getItem("item")}catch(t){return!1}return!0;default:return!0}})(this.cacheLocation)||(this.cacheLocation=yn.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:gn;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 Sn="default_fingerprint_cache",kn=7,getExpirationDate=e=>new Date((new Date).getTime()+24*e*60*60*1e3).getTime();async function getFingerprint(e=!1){if(!window.fingerprintConfig)throw new Error("Fingerprint configuration is not initialized.");const t=(()=>{const{cacheName:e=Sn}=window.fingerprintConfig;try{const t=JSON.parse(localStorage.getItem(e)||"null");return t&&t.expiresAt>Date.now()?t.fingerprint:(localStorage.removeItem(e),null)}catch{return null}})();if(t)return t;if(e)return"";if(!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(e=>{const{cacheName:t=Sn,cacheTimeInDays:n=kn}=window.fingerprintConfig,i={fingerprint:e,expiresAt:getExpirationDate(n)};localStorage.setItem(t,JSON.stringify(i))})(t),t}catch(X){throw console.error("Error retrieving fingerprint:",X),X}}const wn=["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=Ar.parseEventProps(e,t);console.log("validation schema result===>",n);const i=!wn.includes(e),s=await getFingerprint(i),a={...{"User Fingerprint":s},...t};kt.track(e,a)}catch(X){throw console.error("Error tracking event:",X),X}}function trackTest(){trackEvent("Track Test",{})}async function init(e){Ar.parseInitProps(e);const{mixpanelToken:t,debug:n=!1,identificationKey:i}=e;await function initMixpanel(e,t=!1){return new Promise((n=>{kt.init(e,{debug:t,loaded:()=>{window.mixpanel=kt,n()}})}))}(t,n);try{await async function initFingerprint(e){window.fingerprintConfig={},window.fpClient=new FpjsClient({loadOptions:{apiKey:e}});try{await window.fpClient.init()}catch(X){throw console.error("Error initializing identification service:",X),X}}(i)}catch(X){console.error("Error initializing identification service:",X)}!function onLoaded(){window.dispatchEvent(new CustomEvent("Tracker Ready"))}()}const In={init:init,trackTest:trackTest};exports.default=In,exports.init=init,exports.trackTest=trackTest;
30
+ function __awaiter2(e,t,n,i){return new(n||(n=Promise))((function(t,s){function fulfilled(e){try{step(i.next(e))}catch(t){s(t)}}function rejected(e){try{step(i.throw(e))}catch(t){s(t)}}function step(e){e.done?t(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((i=i.apply(e,[])).next())}))}for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),n=0;n<64;n++)t[e.charCodeAt(n)]=n;var encode2=function(t){var n,i=new Uint8Array(t),s=i.length,a="";for(n=0;n<s;n+=3)a+=e[i[n]>>2],a+=e[(3&i[n])<<4|i[n+1]>>4],a+=e[(15&i[n+1])<<2|i[n+2]>>6],a+=e[63&i[n+2]];return s%3==2?a=a.substring(0,a.length-1)+"=":s%3==1&&(a=a.substring(0,a.length-2)+"=="),a};const i=new Map,s=new Map;const a=self;a.onmessage=function(e){return __awaiter2(this,0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return a.postMessage({id:e.data.id});{const{id:t,bitmap:n,width:c,height:d,dataURLOptions:u}=e.data,l=function getTransparentBlobFor(e,t,n){return __awaiter2(this,0,void 0,(function*(){const i=`${e}-${t}`;if("OffscreenCanvas"in globalThis){if(s.has(i))return s.get(i);const a=new OffscreenCanvas(e,t);a.getContext("2d");const c=yield a.convertToBlob(n),d=yield c.arrayBuffer(),u=encode2(d);return s.set(i,u),u}return""}))}(c,d,u),p=new OffscreenCanvas(c,d);p.getContext("2d").drawImage(n,0,0),n.close();const h=yield p.convertToBlob(u),f=h.type,m=yield h.arrayBuffer(),g=encode2(m);if(!i.has(t)&&(yield l)===g)return i.set(t,g),a.postMessage({id:t});if(i.get(t)===g)return a.postMessage({id:t});a.postMessage({id:t,type:f,base64:g,width:c,height:d}),i.set(t,g)}}))}}()}));class CanvasManager{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:n,blockClass:i,blockSelector:s,recordCanvas:a,dataURLOptions:c}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&"all"===t&&this.initCanvasMutationObserver(n,i,s),a&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,i,s,{dataURLOptions:c})}initCanvasFPSObserver(e,t,n,i,s){const a=initCanvasContextObserver(t,n,i,!0),c=new Map,d=new D;d.onmessage=e=>{const{id:t}=e.data;if(c.set(t,!1),!("base64"in e.data))return;const{base64:n,type:i,width:s,height:a}=e.data;this.mutationCb({id:t,type: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 l,p=0;const takeCanvasSnapshots=e=>{p&&e-p<u||(p=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{isBlocked(t,n,i,!0)||e.push(t)})),e})().forEach((e=>__awaiter$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);d.postMessage({id:n,bitmap:i,width:e.width,height:e.height,dataURLOptions:s.dataURLOptions},[i])}))))),l=requestAnimationFrame(takeCanvasSnapshots)};l=requestAnimationFrame(takeCanvasSnapshots),this.resetObservers=()=>{a(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=initCanvasContextObserver(e,t,n,!1),s=function initCanvas2DMutationObserver(e,t,n,i){const s=[],a=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const d of a)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[d])continue;const a=patch(t.CanvasRenderingContext2D.prototype,d,(function(s){return function(...a){return isBlocked(this.canvas,n,i,!0)||setTimeout((()=>{const n=serializeArgs(a,t,this);e(this.canvas,{type:I["2D"],property:d,args:n})}),0),s.apply(this,a)}}));s.push(a)}catch(c){const n=hookSetter(t.CanvasRenderingContext2D.prototype,d,{set(t){e(this.canvas,{type:I["2D"],property:d,args:[t],setter:!0})}});s.push(n)}return()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),a=function initCanvasWebGLMutationObserver(e,t,n,i,s){const a=[];return a.push(...patchGLPrototype(t.WebGLRenderingContext.prototype,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 A,L,j,q=!1;const U=function createMirror(){return new Mirror}();function record(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:i,blockClass:s="rr-block",blockSelector:a=null,ignoreClass:c="rr-ignore",ignoreSelector:d=null,maskTextClass:u="rr-mask",maskTextSelector:l=null,inlineStylesheet:p=!0,maskAllInputs:h,maskInputOptions:f,slimDOMOptions:m,maskInputFn:g,maskTextFn:_,hooks:y,packFn:S,sampling:w={},dataURLOptions:I={},mousemoveWait:O,recordDOM:T=!0,recordCanvas:R=!1,recordCrossOriginIframes:N=!1,recordAfter:Z=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:P=!1,collectFonts:D=!1,inlineImages:B=!1,plugins:$,keepIframeSrcFn:z=()=>!1,ignoreCSSAttributes:W=new Set([]),errorHandler:K}=e;!function registerErrorHandler(e){x=e}(K);const H=!N||window.parent===window;let G=!1;if(!H)try{window.parent.document&&(G=!1)}catch(oe){G=!0}if(H&&!t)throw new Error("emit function is required");void 0!==O&&void 0===w.mousemove&&(w.mousemove=O),U.reset();const J=!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},Y=!0===m||"all"===m?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===m,headMetaDescKeywords:"all"===m}:m||{};let X;!function polyfill(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let 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 $||[])t.eventProcessor&&(e=t.eventProcessor(e));return S&&!G&&(e=S(e)),e};A=(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())),H)null==t||t(eventProcessor(e),s);else if(G){const t={type:"rrweb",event:eventProcessor(e),origin:window.location.origin,isCheckout:s};window.parent.postMessage(t,"*")}if(e.type===v.FullSnapshot)X=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-X.timestamp>n;(t||s)&&L(!0)}};const wrappedMutationEmit=e=>{A(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.Mutation},e)}))},wrappedScrollEmit=e=>A(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.Scroll},e)})),wrappedCanvasMutationEmit=e=>A(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.CanvasMutation},e)})),te=new StylesheetManager({mutationCb:wrappedMutationEmit,adoptedStyleSheetCb:e=>A(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.AdoptedStyleSheet},e)}))}),re=new IframeManager({mirror:U,mutationCb:wrappedMutationEmit,stylesheetManager:te,recordCrossOriginIframes:N,wrappedEmit:A});for(const v of $||[])v.getMirror&&v.getMirror({nodeMirror:U,crossOriginIframeMirror:re.crossOriginIframeMirror,crossOriginIframeStyleMirror:re.crossOriginIframeStyleMirror});const ne=new ProcessedNodeManager;j=new CanvasManager({recordCanvas:R,mutationCb:wrappedCanvasMutationEmit,win:window,blockClass:s,blockSelector:a,mirror:U,sampling:w.canvas,dataURLOptions:I});const ie=new ShadowDomManager({mutationCb:wrappedMutationEmit,scrollCb:wrappedScrollEmit,bypassOptions:{blockClass:s,blockSelector:a,maskTextClass:u,maskTextSelector:l,inlineStylesheet:p,maskInputOptions:J,dataURLOptions:I,maskTextFn:_,maskInputFn:g,recordCanvas:R,inlineImages:B,sampling:w,slimDOMOptions:Y,iframeManager:re,stylesheetManager:te,canvasManager:j,keepIframeSrcFn:z,processedNodeManager:ne},mirror:U});L=(e=!1)=>{if(!T)return;A(wrapEvent({type:v.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}),e),te.reset(),ie.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:d=!0,inlineImages:u=!1,recordCanvas:l=!1,maskAllInputs:p=!1,maskTextFn:h,maskInputFn:f,slimDOM:m=!1,dataURLOptions:g,preserveWhiteSpace:_,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:b,onStylesheetLoad:S,stylesheetLoadTimeout:w,keepIframeSrcFn:I=()=>!1}=t||{};return serializeNodeWithId(e,{doc:e,mirror:n,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:d,maskInputOptions:!0===p?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===p?{password:!0}:p,maskTextFn:h,maskInputFn:f,slimDOMOptions:!0===m||"all"===m?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===m,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===m?{}:m,dataURLOptions:g,inlineImages:u,recordCanvas:l,preserveWhiteSpace:_,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:b,onStylesheetLoad:S,stylesheetLoadTimeout:w,keepIframeSrcFn:I,newlyAddedElement:!1})}(document,{mirror:U,blockClass:s,blockSelector:a,maskTextClass:u,maskTextSelector:l,inlineStylesheet:p,maskAllInputs:J,maskTextFn:_,slimDOM:Y,dataURLOptions:I,recordCanvas:R,inlineImages:B,onSerialize:e=>{isSerializedIframe(e,U)&&re.addIframe(e),isSerializedStylesheet(e,U)&&te.trackLinkElement(e),hasShadowRoot(e)&&ie.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{re.attachIframe(e,t),ie.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{te.attachLinkElement(e,t)},keepIframeSrcFn:z});if(!t)return console.warn("Failed to snapshot the document");A(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,U.getId(document))};try{const e=[],observe=e=>{var t;return callbackWrapper(initObservers)({mutationCb:wrappedMutationEmit,mousemoveCb:(e,t)=>A(wrapEvent({type:v.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>A(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.MouseInteraction},e)})),scrollCb:wrappedScrollEmit,viewportResizeCb:e=>A(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.ViewportResize},e)})),inputCb:e=>A(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.Input},e)})),mediaInteractionCb:e=>A(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.MediaInteraction},e)})),styleSheetRuleCb:e=>A(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.StyleSheetRule},e)})),styleDeclarationCb:e=>A(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.StyleDeclaration},e)})),canvasMutationCb:wrappedCanvasMutationEmit,fontCb:e=>A(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.Font},e)})),selectionCb:e=>{A(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.Selection},e)}))},customElementCb:e=>{A(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.CustomElement},e)}))},blockClass:s,ignoreClass:c,ignoreSelector:d,maskTextClass:u,maskTextSelector:l,maskInputOptions:J,inlineStylesheet:p,sampling:w,recordDOM:T,recordCanvas:R,inlineImages:B,userTriggeredOnInput:P,collectFonts:D,doc:e,maskInputFn:g,maskTextFn:_,keepIframeSrcFn:z,blockSelector:a,slimDOMOptions:Y,dataURLOptions:I,mirror:U,iframeManager:re,stylesheetManager:te,shadowDomManager:ie,processedNodeManager:ne,canvasManager:j,ignoreCSSAttributes:W,plugins:(null===(t=null==$?void 0:$.filter((e=>e.observer)))||void 0===t?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>A(wrapEvent({type:v.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},y)};re.addLoadListener((t=>{try{e.push(observe(t.contentDocument))}catch(Q){console.warn(Q)}}));const init2=()=>{L(),e.push(observe(document)),q=!0};return"interactive"===document.readyState||"complete"===document.readyState?init2():(e.push(on("DOMContentLoaded",(()=>{A(wrapEvent({type:v.DomContentLoaded,data:{}})),"DOMContentLoaded"===Z&&init2()}))),e.push(on("load",(()=>{A(wrapEvent({type:v.Load,data:{}})),"load"===Z&&init2()}),window))),()=>{e.forEach((e=>e())),ne.destroy(),q=!1,function unregisterErrorHandler(){x=void 0}()}}catch(Q){console.warn(Q)}}record.addCustomEvent=(e,t)=>{if(!q)throw new Error("please add custom event after start recording");A(wrapEvent({type:v.Custom,data:{tag:e,payload:t}}))},record.freezePage=()=>{C.forEach((e=>e.freeze()))},record.takeFullSnapshot=e=>{if(!q)throw new Error("please take full snapshot after start recording");L(e)},record.mirror=U;var B,$=(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))($||{}),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||{}),W={DEBUG:!1,LIB_VERSION:"2.55.1"};if("undefined"==typeof window){var K={hostname:""};B={navigator:{userAgent:"",onLine:!0},document:{location:K,referrer:""},screen:{width:0,height:0},location:K}}else B=window;var H,G,J,Y,X,Q,ee,te,re,ne,ie=864e5,oe=8e3,se=Array.prototype,ae=Function.prototype,ce=Object.prototype,de=se.slice,ue=ce.toString,le=ce.hasOwnProperty,pe=B.console,he=B.navigator,fe=B.document,me=B.opera,ge=B.screen,_e=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,"")}},xe={log:function(){if(W.DEBUG&&!Ie.isUndefined(pe)&&pe)try{pe.log.apply(pe,arguments)}catch(e){Ie.each(arguments,(function(e){pe.log(e)}))}},warn:function(){if(W.DEBUG&&!Ie.isUndefined(pe)&&pe){var e=["Mixpanel warning:"].concat(Ie.toArray(arguments));try{pe.warn.apply(pe,e)}catch(t){Ie.each(e,(function(e){pe.warn(e)}))}}},error:function(){if(W.DEBUG&&!Ie.isUndefined(pe)&&pe){var e=["Mixpanel error:"].concat(Ie.toArray(arguments));try{pe.error.apply(pe,e)}catch(t){Ie.each(e,(function(e){pe.error(e)}))}}},critical:function(){if(!Ie.isUndefined(pe)&&pe){var e=["Mixpanel error:"].concat(Ie.toArray(arguments));try{pe.error.apply(pe,e)}catch(t){Ie.each(e,(function(e){pe.error(e)}))}}}},log_func_with_prefix=function(e,t){return function(){return arguments[0]="["+t+"] "+arguments[0],e.apply(xe,arguments)}},console_with_prefix=function(e){return{log:log_func_with_prefix(xe.log,e),error:log_func_with_prefix(xe.error,e),critical:log_func_with_prefix(xe.critical,e)}};Ie.bind=function(e,t){var n,i;if(ye&&e.bind===ye)return ye.apply(e,de.call(arguments,1));if(!Ie.isFunction(e))throw new TypeError;return n=de.call(arguments,2),i=function(){if(!(this instanceof i))return e.apply(t,n.concat(de.call(arguments)));var s={};s.prototype=e.prototype;var a=new s;s.prototype=null;var c=e.apply(a,n.concat(de.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(le.call(e,a)&&t.call(n,e[a],a,e)===we)return},Ie.extend=function(e){return Ie.each(de.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||!le.call(e,"callee"))},Ie.toArray=function(e){return e?e.toArray?e.toArray():Ie.isArray(e)||Ie.isArguments(e)?de.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(le.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,d=n,u=[],l=t[e];switch(l&&"object"==typeof l&&"function"==typeof l.toJSON&&(l=l.toJSON(e)),typeof l){case"string":return quote(l);case"number":return isFinite(l)?String(l):"null";case"boolean":case"null":return String(l);case"object":if(!l)return"null";if(n+=" ",u=[],"[object Array]"===ue.apply(l)){for(c=l.length,i=0;i<c;i+=1)u[i]=str(i,l)||"null";return a=0===u.length?"[]":n?"[\n"+n+u.join(",\n"+n)+"\n"+d+"]":"["+u.join(",")+"]",n=d,a}for(s in l)le.call(l,s)&&(a=str(s,l))&&u.push(quote(s)+(n?": ":":")+a);return a=0===u.length?"{}":n?"{"+u.join(",")+d+"}":"{"+u.join(",")+"}",n=d,a}};return str("",{"":e})}}(),Ie.JSONDecode=(X={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},Q=function(e){var t=new SyntaxError(e);throw t.at=H,t.text=J,t},ee=function(e){return e&&e!==G&&Q("Expected '"+e+"' instead of '"+G+"'"),G=J.charAt(H),H+=1,G},te=function(){var e,t="";for("-"===G&&(t="-",ee("-"));G>="0"&&G<="9";)t+=G,ee();if("."===G)for(t+=".";ee()&&G>="0"&&G<="9";)t+=G;if("e"===G||"E"===G)for(t+=G,ee(),"-"!==G&&"+"!==G||(t+=G,ee());G>="0"&&G<="9";)t+=G,ee();if(e=+t,isFinite(e))return e;Q("Bad number")},re=function(){var e,t,n,i="";if('"'===G)for(;ee();){if('"'===G)return ee(),i;if("\\"===G)if(ee(),"u"===G){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 X[G])break;i+=X[G]}else i+=G}Q("Bad string")},ne=function(){for(;G&&G<=" ";)ee()},Y=function(){switch(ne(),G){case"{":return function(){var e,t={};if("{"===G){if(ee("{"),ne(),"}"===G)return ee("}"),t;for(;G;){if(e=re(),ne(),ee(":"),Object.hasOwnProperty.call(t,e)&&Q('Duplicate key "'+e+'"'),t[e]=Y(),ne(),"}"===G)return ee("}"),t;ee(","),ne()}}Q("Bad object")}();case"[":return function(){var e=[];if("["===G){if(ee("["),ne(),"]"===G)return ee("]"),e;for(;G;){if(e.push(Y()),ne(),"]"===G)return ee("]"),e;ee(","),ne()}}Q("Bad array")}();case'"':return re();case"-":return te();default:return G>="0"&&G<="9"?te():function(){switch(G){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}Q('Unexpected "'+G+'"')}()}},function(e){var t;return J=e,H=0,G=" ",t=Y(),ne(),G&&Q("Syntax error"),t}),Ie.base64Encode=function(e){var t,n,i,s,a,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",d=0,u=0,l="",p=[];if(!e)return e;e=Ie.utf8Encode(e);do{t=(a=e.charCodeAt(d++)<<16|e.charCodeAt(d++)<<8|e.charCodeAt(d++))>>18&63,n=a>>12&63,i=a>>6&63,s=63&a,p[u++]=c.charAt(t)+c.charAt(n)+c.charAt(i)+c.charAt(s)}while(d<e.length);switch(l=p.join(""),e.length%3){case 1:l=l.slice(0,-2)+"==";break;case 2:l=l.slice(0,-1)+"="}return l},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),d=null;c<128?n++:d=c>127&&c<2048?String.fromCharCode(c>>6|192,63&c|128):String.fromCharCode(c>>12|224,c>>6&63|128,63&c|128),null!==d&&(n>t&&(a+=e.substring(t,n)),a+=d,t=n=s+1)}return n>t&&(a+=e.substring(t,e.length)),a},Ie.UUID=function(){var T2=function(){var e,t=1*new Date;if(B.performance&&B.performance.now)e=B.performance.now();else for(e=0;t==1*new Date;)e++;return t.toString(16)+Math.floor(e).toString(16)};return function(){var e=(ge.height*ge.width).toString(16);return T2()+"-"+Math.random().toString(16).replace(".","")+"-"+function(){var e,t,n=_e,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 Ee=["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<Ee.length;t++)if(-1!==e.indexOf(Ee[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){xe.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 d="",u="",l="";if(c)d="; domain="+c;else if(i){var p=extract_domain(fe.location.hostname);d=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+1e3*n),u="; expires="+h.toGMTString()}a&&(s=!0,l="; SameSite=None"),s&&(l+="; secure"),fe.cookie=e+"="+encodeURIComponent(t)+u+"; path=/"+d+l},set:function(e,t,n,i,s,a,c){var d="",u="",l="";if(c)d="; domain="+c;else if(i){var p=extract_domain(fe.location.hostname);d=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+24*n*60*60*1e3),u="; expires="+h.toGMTString()}a&&(s=!0,l="; SameSite=None"),s&&(l+="; secure");var f=e+"="+encodeURIComponent(t)+u+"; path=/"+d+l;return 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||xe.error("localStorage unsupported; falling back to cookie store"),t},error:function(e){xe.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 xe.error("No valid element provided to register_event")}}();var Oe=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,d,u,l,p,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 m=n[1],g=fe.getElementById(m);if(!g||i&&g.nodeName.toLowerCase()!=i)return[];f=[g]}else if(t.indexOf(".")>-1){i=(n=t.split("."))[0];var _=n[1];for(i||(i="*"),s=[],a=0,d=0;d<f.length;d++)for(l="*"==i?getAllChildren(f[d]):f[d].getElementsByTagName(i),u=0;u<l.length;u++)s[a++]=l[u];for(f=[],p=0,d=0;d<s.length;d++)s[d].className&&Ie.isString(s[d].className)&&hasClass(s[d],_)&&(f[p++]=s[d])}else{var y=t.match(Oe);if(y){i=y[1];var v,b=y[2],S=y[3],w=y[4];for(i||(i="*"),s=[],a=0,d=0;d<f.length;d++)for(l="*"==i?getAllChildren(f[d]):f[d].getElementsByTagName(i),u=0;u<l.length;u++)s[a++]=l[u];switch(f=[],p=0,S){case"=":v=function(e){return e.getAttribute(b)==w};break;case"~":v=function(e){return e.getAttribute(b).match(new RegExp("\\b"+w+"\\b"))};break;case"|":v=function(e){return e.getAttribute(b).match(new RegExp("^"+w+"-?"))};break;case"^":v=function(e){return 0===e.getAttribute(b).indexOf(w)};break;case"$":v=function(e){return e.getAttribute(b).lastIndexOf(w)==e.getAttribute(b).length-w.length};break;case"*":v=function(e){return e.getAttribute(b).indexOf(w)>-1};break;default:v=function(e){return e.getAttribute(b)}}for(f=[],p=0,d=0;d<s.length;d++)v(s[d])&&(f[p++]=s[d])}else{for(i=t,s=[],a=0,d=0;d<f.length;d++)for(l=f[d].getElementsByTagName(i),u=0;u<l.length;u++)s[a++]=l[u];f=s}}return f}return function(e){return Ie.isElement(e)?[e]:Ie.isObject(e)&&!Ie.isUndefined(e.length)?e:getElementsBySelector.call(this,e)}}();var Te=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],Re=["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(Te,(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(Re,(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=_e;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 B.location.href},properties:function(e){return"object"!=typeof e&&(e={}),Ie.extend(Ie.strip_empty_properties({$os:Ie.info.os(),$browser:Ie.info.browser(_e,he.vendor,me),$referrer:fe.referrer,$referring_domain:Ie.info.referringDomain(fe.referrer),$device:Ie.info.device(_e)}),{$current_url:Ie.info.currentUrl(),$browser_version:Ie.info.browserVersion(_e,he.vendor,me),$screen_height:ge.height,$screen_width:ge.width,mp_lib:"web",$lib_version:W.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(_e,he.vendor,me)}),{$browser_version:Ie.info.browserVersion(_e,he.vendor,me)})},mpPageViewProperties:function(){return Ie.strip_empty_properties({current_page_title:fe.title,current_domain:B.location.hostname,current_url_path:B.location.pathname,current_url_protocol:B.location.protocol,current_url_search:B.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},Me=/[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=Me);var s=e.match(t);return s?s[0]:""},Ze=null,Pe=null;"undefined"!=typeof JSON&&(Ze=JSON.stringify,Pe=JSON.parse),Ze=Ze||Ie.JSONEncode,Pe=Pe||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 De="__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||B,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 xe.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&&xe.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||De)+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})):xe.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function _addOptOutCheck(e,t){return function(){var n=!1;try{var i=t.call(this,"token"),s=t.call(this,"ignore_dnt"),a=t.call(this,"opt_out_tracking_persistence_type"),c=t.call(this,"opt_out_tracking_cookie_prefix"),d=t.call(this,"window");i&&(n=hasOptedOut(i,{ignoreDnt:s,persistenceType:a,persistencePrefix:c,window:d}))}catch(l){xe.error("Unexpected error when checking tracking opt-out status: "+l)}if(!n)return e.apply(this,arguments);var u=arguments[arguments.length-1];"function"==typeof u&&u(0)}}var Ae=console_with_prefix("lock"),SharedLock=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||window.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3};SharedLock.prototype.withLock=function(e,t,n){n||"function"==typeof t||(n=t,t=null);var i=n||(new Date).getTime()+"|"+Math.random(),s=(new Date).getTime(),a=this.storageKey,c=this.pollIntervalMS,d=this.timeoutMS,u=this.storage,l=a+":X",p=a+":Y",h=a+":Z",reportError=function(e){t&&t(e)},delay=function(e){if((new Date).getTime()-s>d)return Ae.error("Timeout waiting for mutex on "+a+"; clearing lock. ["+i+"]"),u.removeItem(h),u.removeItem(p),void loop();setTimeout((function(){try{e()}catch(t){reportError(t)}}),c*(Math.random()+.1))},waitFor=function(e,t){e()?t():delay((function(){waitFor(e,t)}))},getSetY=function(){var e=u.getItem(p);if(e&&e!==i)return!1;if(u.setItem(p,i),u.getItem(p)===i)return!0;if(!localStorageSupported(u,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},loop=function(){u.setItem(l,i),waitFor(getSetY,(function(){u.getItem(l)!==i?delay((function(){u.getItem(p)===i?waitFor((function(){return!u.getItem(h)}),criticalSection):loop()})):criticalSection()}))},criticalSection=function(){u.setItem(h,"1");try{e()}finally{u.removeItem(h),u.getItem(p)===i&&u.removeItem(p),u.getItem(l)===i&&u.removeItem(l)}};try{if(!localStorageSupported(u,!0))throw new Error("localStorage support check failed");loop()}catch(f){reportError(f)}};var Le=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(Le.error,Le),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=Pe(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,Ze(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 je=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 je.log("Flush: Request already in progress");e=e||{};var t=this.libConfig.batch_request_timeout_ms,n=(new Date).getTime(),i=this.batchSize,s=this.queue.fillBatch(i),a=s.length===i,c=[],d={};if(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:W.LIB_VERSION}));var n=!0,i=e.id;i?(this.itemIdsSentSuccessfully[i]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:e,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[i]}),n=!1):this.reportError("[dupe] found item with no ID",{item:e}),n&&c.push(t)}d[e.id]=t}),this),c.length<1)return void this.resetFlush();this.requestInProgress=!0;var u=Ie.bind((function(c){this.requestInProgress=!1;try{var u=!1;if(e.unloading)this.queue.updatePayloads(d);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=B.navigator.onLine,!Ie.isUndefined(h)&&!h)||"timeout"===c.error)){var l=2*this.flushInterval;c.retryAfter&&(l=1e3*parseInt(c.retryAfter,10)||l),l=Math.min(6e5,l),this.reportError("Error; retry in "+l+" ms"),this.scheduleFlush(l)}else if(Ie.isObject(c)&&413===c.httpStatusCode)if(s.length>1){var p=Math.max(1,Math.floor(i/2));this.batchSize=Math.min(this.batchSize,p,s.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",s),this.resetBatchSize(),u=!0;else u=!0;u&&(this.queue.removeItemsByID(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),l={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:t};e.unloading&&(l.transport="sendBeacon"),je.log("MIXPANEL REQUEST:",c),this.sendRequest(c,l,u)}catch(p){this.reportError("Error flushing request queue",p),this.resetFlush()}},RequestBatcher.prototype.reportError=function(e,t){if(je.error.apply(je.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(n){je.error(n)}};var Fe=console_with_prefix("recorder"),qe=B.CompressionStream,Ue={batch_size:1e3,batch_flush_interval_ms:1e4,batch_request_timeout_ms:9e4,batch_autostart:!0},Be=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=ie,this.recordMinMs=0,this._initBatcher()};MixpanelRecorder.prototype._initBatcher=function(){this.batcher=new RequestBatcher("__mprec",{libConfig:Ue,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>ie&&(this.recordMaxMs=ie,Fe.critical("record_max_ms cannot be greater than "+ie+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>oe&&(this.recordMinMs=oe,Fe.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(){Fe.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===$.IncrementalSnapshot&&Be.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 Fe.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);B.fetch(this.get_config("api_host")+"/"+this.get_config("api_routes").record+"?"+new URLSearchParams(t),{method:"POST",headers:{Authorization:"Basic "+btoa(this.get_config("token")+":"),"Content-Type":"application/octet-stream"},body:n}).then((function(e){e.json().then((function(t){s(e,t)})).catch((function(e){i({error:e})}))})).catch((function(e){i({error:e,httpStatusCode:0})}))},MixpanelRecorder.prototype._flushEvents=addOptOutCheckMixpanelLib((function(e,t,n){const i=e.length;if(i>0){var s=this.replayId,a=e[0].timestamp;0!==this.seqNo&&this.replayStartTime||(0!==this.seqNo&&this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=a);var c=e[i-1].timestamp-this.replayStartTime,d={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:a/1e3,replay_id:s,replay_length_ms:c,replay_start_time:this.replayStartTime/1e3},u=Ie.JSONEncode(e),l=this._mixpanel.get_property("$device_id");l&&(d.$device_id=l);var p=this._mixpanel.get_property("$user_id");if(p&&(d.$user_id=p),qe){var h=new Blob([u],{type:"application/json"}).stream().pipeThrough(new qe("gzip"));new Response(h).blob().then(Ie.bind((function(e){d.format="gzip",this._sendRequest(s,d,e,n)}),this))}else d.format="body",this._sendRequest(s,d,u,n)}})),MixpanelRecorder.prototype.reportError=function(e,t){Fe.error.apply(Fe.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){Fe.error(n)}},B.__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),d=s.mp.get_config("track_links_timeout");s.event_handler(e,this,a),window.setTimeout(s.track_callback(i,c,a,!0),d),s.mp.track(t,c,s.track_callback(i,c,a))}))}),this),!0;xe.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 $e="$set",ze="$set_once",We="$unset",Ve="$add",Ke="$append",He="$union",Ge="$remove",Je={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[$e]=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[We]=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[He]=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[Ge]=i,n},delete_action:function(){var e={$delete:""};return e}},MixpanelGroup=function(){};Ie.extend(MixpanelGroup.prototype,Je),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,Je),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[$e]=Ie.extend({},Ie.info.people_properties(),i[$e]),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 xe.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[Ve]=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);xe.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)}xe.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){$e in e?this._mixpanel.persistence._add_to_people_queue($e,e):ze in e?this._mixpanel.persistence._add_to_people_queue(ze,e):We in e?this._mixpanel.persistence._add_to_people_queue(We,e):Ve in e?this._mixpanel.persistence._add_to_people_queue(Ve,e):Ke in e?this._mixpanel.persistence._add_to_people_queue(Ke,e):Ge in e?this._mixpanel.persistence._add_to_people_queue(Ge,e):He in e?this._mixpanel.persistence._add_to_people_queue(He,e):xe.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 d=this;this._flush_one_queue($e,this.set,e),this._flush_one_queue(ze,this.set_once,i),this._flush_one_queue(We,this.unset,a,(function(e){return Ie.keys(e)})),this._flush_one_queue(Ve,this.increment,t),this._flush_one_queue(He,this.union,s);var u=this._mixpanel.persistence.load_queue(Ke);if(!Ie.isUndefined(u)&&Ie.isArray(u)&&u.length)for(var l,append_callback=function(e,t){0===e&&d._mixpanel.persistence._add_to_people_queue(Ke,l),Ie.isUndefined(n)||n(e,t)},p=u.length-1;p>=0;p--)u=this._mixpanel.persistence.load_queue(Ke),l=u.pop(),d._mixpanel.persistence.save(),Ie.isEmptyObject(l)||d.append(l,append_callback);var h=this._mixpanel.persistence.load_queue(Ge);if(!Ie.isUndefined(h)&&Ie.isArray(h)&&h.length)for(var f,remove_callback=function(e,t){0===e&&d._mixpanel.persistence._add_to_people_queue(Ge,f),Ie.isUndefined(c)||c(e,t)},m=h.length-1;m>=0;m--)h=this._mixpanel.persistence.load_queue(Ge),f=h.pop(),d._mixpanel.persistence.save(),Ie.isEmptyObject(f)||d.remove(f,remove_callback)},MixpanelPeople.prototype._is_reserved_property=function(e){return"$distinct_id"===e||"$token"===e||"$device_id"===e||"$user_id"===e||"$had_persisted_distinct_id"===e},MixpanelPeople.prototype.set=MixpanelPeople.prototype.set,MixpanelPeople.prototype.set_once=MixpanelPeople.prototype.set_once,MixpanelPeople.prototype.unset=MixpanelPeople.prototype.unset,MixpanelPeople.prototype.increment=MixpanelPeople.prototype.increment,MixpanelPeople.prototype.append=MixpanelPeople.prototype.append,MixpanelPeople.prototype.remove=MixpanelPeople.prototype.remove,MixpanelPeople.prototype.union=MixpanelPeople.prototype.union,MixpanelPeople.prototype.track_charge=MixpanelPeople.prototype.track_charge,MixpanelPeople.prototype.clear_charges=MixpanelPeople.prototype.clear_charges,MixpanelPeople.prototype.delete_user=MixpanelPeople.prototype.delete_user,MixpanelPeople.prototype.toString=MixpanelPeople.prototype.toString;var Ye,Xe="__mps",Qe="__mpso",et="__mpus",tt="__mpa",rt="__mpap",nt="__mpr",it="__mpu",ot="$people_distinct_id",st="__alias",at="__timers",ct=[Xe,Qe,et,tt,rt,nt,it,ot,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&&(xe.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($e),a=this._get_or_create_queue(ze),c=this._get_or_create_queue(We),d=this._get_or_create_queue(Ve),u=this._get_or_create_queue(He),l=this._get_or_create_queue(Ge,[]),p=this._get_or_create_queue(Ke,[]);n===Xe?(Ie.extend(s,i),this._pop_from_people_queue(Ve,i),this._pop_from_people_queue(He,i),this._pop_from_people_queue(We,i)):n===Qe?(Ie.each(i,(function(e,t){t in a||(a[t]=e)})),this._pop_from_people_queue(We,i)):n===et?Ie.each(i,(function(e){Ie.each([s,a,d,u],(function(t){e in t&&delete t[e]})),Ie.each(p,(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 d||(d[t]=0),d[t]+=e)}),this),this._pop_from_people_queue(We,i)):n===it?(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(We,i)):n===nt?(l.push(i),this._pop_from_people_queue(Ke,i)):n===rt&&(p.push(i),this._pop_from_people_queue(We,i)),xe.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),xe.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===Ge?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===$e?Xe:e===ze?Qe:e===We?et:e===Ve?tt:e===Ke?rt:e===Ge?nt:e===He?it:void xe.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 dt,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",lt="base64",pt="$device:",ht=B.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,ft=!ht&&-1===_e.indexOf("MSIE")&&-1===_e.indexOf("Mozilla"),mt=null;he.sendBeacon&&(mt=function(){return he.sendBeacon.apply(he,arguments)});var gt={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},_t={api_host:"https://api-js.mixpanel.com",api_routes:gt,api_method:"POST",api_transport:"XHR",api_payload_format:lt,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:ie,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?dt:dt[n];if(s&&0===Ye)i=s;else{if(s&&!Ie.isArray(s))return void xe.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={},d=!1;Ie.each(a,(function(e,t){c["initial_"+t]=e,e&&(d=!0)})),d&&i.people.set_once(c)}return W.DEBUG=W.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 dt[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||_t.api_host).match(/\.mixpanel\.com/)&&(i.api_payload_format="json");if(this.set_config(Ie.extend({},_t,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(),mt&&B.addEventListener){var s=Ie.bind((function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})}),this);B.addEventListener("pagehide",(function(e){e.persisted&&s()})),B.addEventListener("visibilitychange",(function(){"hidden"===fe.visibilityState&&s()}))}}else this._batch_requests=!1,xe.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),Ie.each(this.get_batcher_configs(),(function(e){xe.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:pt+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(B.MutationObserver){var e=Ie.bind((function(){this._recorder=this._recorder||new B.__mp_recorder(this),this._recorder.startRecording()}),this);Ie.isUndefined(B.__mp_recorder)?load_extra_bundle(this.get_config("recorder_src"),e):e()}else xe.critical("Browser does not support MutationObserver; skipping session recording")})),MixpanelLib.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():xe.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)){B.addEventListener("popstate",(function(){B.dispatchEvent(new Event("mp_locationchange"))})),B.addEventListener("hashchange",(function(){B.dispatchEvent(new Event("mp_locationchange"))}));var n=B.history.pushState;"function"==typeof n&&(B.history.pushState=function(e,t,i){n.call(B.history,e,t,i),B.dispatchEvent(new Event("mp_locationchange"))});var i=B.history.replaceState;"function"==typeof i&&(B.history.replaceState=function(e,t,n){i.call(B.history,e,t,n),B.dispatchEvent(new Event("mp_locationchange"))}),B.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 d="POST"===n.method,u=mt&&d&&"sendbeacon"===n.transport.toLowerCase(),l=n.verbose;t.verbose&&(l=!0),this.get_config("test")&&(t.test=1),l&&(t.verbose=1),this.get_config("img")&&(t.img=1),ht||(i?t.callback=i:(l||this.get_config("test"))&&(t.callback="(function(){})")),t.ip=this.get_config("ip")?1:0,t._=(new Date).getTime().toString(),d&&(c="data="+encodeURIComponent(t.data),delete t.data),e+="?"+Ie.HTTPBuildQuery(t);var p=this;if("img"in t){var h=fe.createElement("img");h.src=e,fe.body.appendChild(h)}else if(u){try{s=mt(e,c)}catch(v){p.report_error(v),s=!1}try{i&&i(s?1:0)}catch(v){p.report_error(v)}}else if(ht)try{var f=new XMLHttpRequest;f.open(n.method,e,!0);var m=this.get_config("xhr_headers");if(d&&(m["Content-Type"]="application/x-www-form-urlencoded"),Ie.each(m,(function(e,t){f.setRequestHeader(t,e)})),n.timeout_ms&&void 0!==f.timeout){f.timeout=n.timeout_ms;var g=(new Date).getTime()}f.withCredentials=!0,f.onreadystatechange=function(){var e;if(4===f.readyState)if(200===f.status){if(i)if(l){var t;try{t=Ie.JSONDecode(f.responseText)}catch(v){if(p.report_error(v),!n.ignore_json_errors)return;t=f.responseText}i(t)}else i(Number(f.responseText))}else if(e=f.timeout&&!f.status&&(new Date).getTime()-g>=f.timeout?"timeout":"Bad HTTP status: "+f.status+" "+f.statusText,p.report_error(e),i)if(l){var s=f.responseHeaders||{};i({status:0,httpStatusCode:f.status,error:e,retryAfter:s["Retry-After"]})}else i(0)},f.send(c)}catch(v){p.report_error(v),s=!1}else{var _=fe.createElement("script");_.type="text/javascript",_.async=!0,_.defer=!0,_.src=e;var y=fe.getElementsByTagName("script")[0];y.parentNode.insertBefore(_,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")===lt&&(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 d=!0,u=Ie.bind((function(){return c.skip_hooks||(n=this._run_hook("before_send_"+e.type,n)),n?(xe.log("MIXPANEL REQUEST:"),xe.log(n),this._send_request(i,this._encode_data_for_request(n),c,this._prepare_callback(t,n))):null}),this);return this._batch_requests&&!a?s.enqueue(n,(function(e){e?t(1,n):u()})):d=u(),d&&n},MixpanelLib.prototype.track=addOptOutCheckMixpanelLib((function(e,t,n,i){i||"function"!=typeof n||(i=n,n=null);var s=(n=n||{}).transport;s&&(n.transport=s);var a=n.send_immediately;if("function"!=typeof i&&(i=NOOP_FUNC),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 d=(new Date).getTime()-c;t.$duration=parseFloat((d/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 l=this.get_config("property_blacklist");Ie.isArray(l)?Ie.each(l,(function(e){delete t[e]})):this.report_error("Invalid value for property_blacklist config: "+l);var p={event:e,properties:t};return this._track_or_batch({type:"events",data:p,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:a,send_request_options:n},i)}i(0)}})),MixpanelLib.prototype.set_group=addOptOutCheckMixpanelLib((function(e,t,n){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,d){var u=this.get_distinct_id();if(e&&u!==e){if("string"==typeof e&&0===e.indexOf(pt))return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var l=u;this.register_once({$had_persisted_distinct_id:!0,$device_id:l},"")}e!==u&&e!==this.get_property(st)&&(this.unregister(st),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(t,n,i,s,a,c,d),e!==u&&this.track("$identify",{distinct_id:e,$anon_distinct_id:u},{skip_hooks:!0})},MixpanelLib.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=Ie.UUID();this.register_once({distinct_id:pt+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(ot))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),W.DEBUG=W.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,de.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(_e)||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){xe.error.apply(xe.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){xe.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=gt,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(){dt.init=function(e,t,n){if(n)return dt[n]||(dt[n]=bt[n]=create_mplib(e,t,n),dt[n]._loaded()),dt[n];var i=dt;bt[ut]?i=bt[ut]:e&&((i=create_mplib(e,t,ut))._loaded(),bt[ut]=i),dt=i,1===Ye&&(B[ut]=dt),Ie.each(bt,(function(e,t){t!==ut&&(dt[t]=e)})),dt._=Ie}};var St,kt,wt,It=function init_as_module(e){return load_extra_bundle=e,Ye=0,dt=new MixpanelLib,override_mp_init_func(),dt.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===B.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(B,"load",dom_loaded_handler,!0)}(),dt}((function loadNoop(e,t){t()}));(kt=St||(St={})).assertEqual=e=>e,kt.assertIs=function assertIs(e){},kt.assertNever=function assertNever(e){throw new Error},kt.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},kt.getValidEnumValues=e=>{const t=kt.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),n={};for(const i of t)n[i]=e[i];return kt.objectValues(n)},kt.objectValues=e=>kt.objectKeys(e).map((function(t){return e[t]})),kt.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},kt.find=(e,t)=>{for(const n of e)if(t(n))return n},kt.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,kt.joinValues=function joinValues(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},kt.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(wt||(wt={})).mergeShapes=(e,t)=>({...e,...t});const xt=St.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=e=>{switch(typeof e){case"undefined":return xt.undefined;case"string":return xt.string;case"number":return isNaN(e)?xt.nan:xt.number;case"boolean":return xt.boolean;case"function":return xt.function;case"bigint":return xt.bigint;case"symbol":return xt.symbol;case"object":return Array.isArray(e)?xt.array:null===e?xt.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?xt.promise:"undefined"!=typeof Map&&e instanceof Map?xt.map:"undefined"!=typeof Set&&e instanceof Set?xt.set:"undefined"!=typeof Date&&e instanceof Date?xt.date:xt.object;default:return xt.unknown}},Et=St.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ZodError extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},processError=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(processError);else if("invalid_return_type"===i.code)processError(i.returnTypeError);else if("invalid_arguments"===i.code)processError(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,s=0;for(;s<i.path.length;){const n=i.path[s];s===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],s++}}};return processError(this),n}static assert(e){if(!(e instanceof ZodError))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,St.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}ZodError.create=e=>new ZodError(e);const errorMap=(e,t)=>{let n;switch(e.code){case Et.invalid_type:n=e.received===xt.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Et.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,St.jsonStringifyReplacer)}`;break;case Et.unrecognized_keys:n=`Unrecognized key(s) in object: ${St.joinValues(e.keys,", ")}`;break;case Et.invalid_union:n="Invalid input";break;case Et.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${St.joinValues(e.options)}`;break;case Et.invalid_enum_value:n=`Invalid enum value. Expected ${St.joinValues(e.options)}, received '${e.received}'`;break;case Et.invalid_arguments:n="Invalid function arguments";break;case Et.invalid_return_type:n="Invalid function return type";break;case Et.invalid_date:n="Invalid date";break;case Et.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:St.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Et.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case Et.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case Et.custom:n="Invalid input";break;case Et.invalid_intersection_types:n="Intersection results could not be merged";break;case Et.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Et.not_finite:n="Number must be finite";break;default:n=t.defaultError,St.assertNever(e)}return{message:n}};let Ct=errorMap;function getErrorMap(){return Ct}const makeIssue=e=>{const{data:t,path:n,errorMaps:i,issueData:s}=e,a=[...n,...s.path||[]],c={...s,path:a};if(void 0!==s.message)return{...s,path:a,message:s.message};let d="";const u=i.filter((e=>!!e)).slice().reverse();for(const l of u)d=l(c,{data:t,defaultError:d}).message;return{...s,path:a,message:d}};function addIssueToContext(e,t){const n=getErrorMap(),i=makeIssue({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===errorMap?void 0:errorMap].filter((e=>!!e))});e.common.issues.push(i)}class ParseStatus{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const i of t){if("aborted"===i.status)return Ot;"dirty"===i.status&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const i of t){const e=await i.key,t=await i.value;n.push({key:e,value:t})}return ParseStatus.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const i of t){const{key:t,value:s}=i;if("aborted"===t.status)return Ot;if("aborted"===s.status)return Ot;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!i.alwaysSet||(n[t.value]=s.value)}return{status:e.value,value:n}}}const Ot=Object.freeze({status:"aborted"}),DIRTY=e=>({status:"dirty",value:e}),OK=e=>({status:"valid",value:e}),isAborted=e=>"aborted"===e.status,isDirty=e=>"dirty"===e.status,isValid=e=>"valid"===e.status,isAsync=e=>"undefined"!=typeof Promise&&e instanceof Promise;function __classPrivateFieldGet(e,t,n,i){if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function __classPrivateFieldSet(e,t,n,i,s){if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var Tt,Rt,Mt,Nt;"function"==typeof SuppressedError&&SuppressedError,(Rt=Tt||(Tt={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},Rt.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class ParseInputLazyPath{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(e,t)=>{if(isValid(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ZodError(e.common.issues);return this._error=t,this._error}}};function processCreateParams(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:i,description:s}=e;if(t&&(n||i))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:s};return{errorMap:(t,s)=>{var a,c;const{message:d}=e;return"invalid_enum_value"===t.code?{message:null!=d?d:s.defaultError}:void 0===s.data?{message:null!==(a=null!=d?d:i)&&void 0!==a?a:s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:null!==(c=null!=d?d:n)&&void 0!==c?c:s.defaultError}},description:s}}class ZodType{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return getParsedType(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(isAsync(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const i={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},s=this._parseSync({data:e,path:i.path,parent:i});return handleResult(i,s)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(isAsync(i)?i:Promise.resolve(i));return handleResult(n,s)}refine(e,t){const getIssueProperties=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const i=e(t),setError=()=>n.addIssue({code:Et.custom,...getIssueProperties(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(setError(),!1))):!!i||(setError(),!1)}))}refinement(e,t){return this._refinement(((n,i)=>!!e(n)||(i.addIssue("function"==typeof t?t(n,i):t),!1)))}_refinement(e){return new ZodEffects({schema:this,typeName:Ht.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(e){return ZodUnion.create([this,e],this._def)}and(e){return ZodIntersection.create(this,e,this._def)}transform(e){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:Ht.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:t,typeName:Ht.ZodDefault})}brand(){return new ZodBranded({typeName:Ht.ZodBranded,type:this,...processCreateParams(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:t,typeName:Ht.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ZodPipeline.create(this,e)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Zt=/^c[^\s-]{8,}$/i,Pt=/^[0-9a-z]+$/,Dt=/^[0-9A-HJKMNP-TV-Z]{26}$/,At=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Lt=/^[a-z0-9_-]{21}$/i,jt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ft=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let qt;const Ut=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Bt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,$t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,zt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Wt=new RegExp(`^${zt}$`);function timeRegexSource(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function datetimeRegex(e){let t=`${zt}T${timeRegexSource(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}class ZodString extends ZodType{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==xt.string){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:Et.invalid_type,expected:xt.string,received:t.parsedType}),Ot}const t=new ParseStatus;let n;for(const c of this._def.checks)if("min"===c.kind)e.data.length<c.value&&(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:Et.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),t.dirty());else if("max"===c.kind)e.data.length>c.value&&(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:Et.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),t.dirty());else if("length"===c.kind){const i=e.data.length>c.value,s=e.data.length<c.value;(i||s)&&(n=this._getOrReturnCtx(e,n),i?addIssueToContext(n,{code:Et.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):s&&addIssueToContext(n,{code:Et.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),t.dirty())}else if("email"===c.kind)Ft.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"email",code:Et.invalid_string,message:c.message}),t.dirty());else if("emoji"===c.kind)qt||(qt=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),qt.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"emoji",code:Et.invalid_string,message:c.message}),t.dirty());else if("uuid"===c.kind)At.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"uuid",code:Et.invalid_string,message:c.message}),t.dirty());else if("nanoid"===c.kind)Lt.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"nanoid",code:Et.invalid_string,message:c.message}),t.dirty());else if("cuid"===c.kind)Zt.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"cuid",code:Et.invalid_string,message:c.message}),t.dirty());else if("cuid2"===c.kind)Pt.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"cuid2",code:Et.invalid_string,message:c.message}),t.dirty());else if("ulid"===c.kind)Dt.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"ulid",code:Et.invalid_string,message:c.message}),t.dirty());else if("url"===c.kind)try{new URL(e.data)}catch(a){n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"url",code:Et.invalid_string,message:c.message}),t.dirty()}else if("regex"===c.kind){c.regex.lastIndex=0;c.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"regex",code:Et.invalid_string,message:c.message}),t.dirty())}else if("trim"===c.kind)e.data=e.data.trim();else if("includes"===c.kind)e.data.includes(c.value,c.position)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:Et.invalid_string,validation:{includes:c.value,position:c.position},message:c.message}),t.dirty());else if("toLowerCase"===c.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===c.kind)e.data=e.data.toUpperCase();else if("startsWith"===c.kind)e.data.startsWith(c.value)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:Et.invalid_string,validation:{startsWith:c.value},message:c.message}),t.dirty());else if("endsWith"===c.kind)e.data.endsWith(c.value)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:Et.invalid_string,validation:{endsWith:c.value},message:c.message}),t.dirty());else if("datetime"===c.kind){datetimeRegex(c).test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:Et.invalid_string,validation:"datetime",message:c.message}),t.dirty())}else if("date"===c.kind){Wt.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:Et.invalid_string,validation:"date",message:c.message}),t.dirty())}else if("time"===c.kind){new RegExp(`^${timeRegexSource(c)}$`).test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:Et.invalid_string,validation:"time",message:c.message}),t.dirty())}else"duration"===c.kind?jt.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"duration",code:Et.invalid_string,message:c.message}),t.dirty()):"ip"===c.kind?(i=e.data,("v4"!==(s=c.version)&&s||!Ut.test(i))&&("v6"!==s&&s||!Bt.test(i))&&(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"ip",code:Et.invalid_string,message:c.message}),t.dirty())):"base64"===c.kind?$t.test(e.data)||(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{validation:"base64",code:Et.invalid_string,message:c.message}),t.dirty()):St.assertNever(c);var i,s;return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:Et.invalid_string,...Tt.errToObj(n)})}_addCheck(e){return new ZodString({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Tt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Tt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Tt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Tt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Tt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Tt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Tt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Tt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Tt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Tt.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...Tt.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Tt.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Tt.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Tt.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Tt.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Tt.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Tt.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Tt.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Tt.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Tt.errToObj(t)})}nonempty(e){return this.min(1,Tt.errToObj(e))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function floatSafeRemainder(e,t){const n=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,s=n>i?n:i;return parseInt(e.toFixed(s).replace(".",""))%parseInt(t.toFixed(s).replace(".",""))/Math.pow(10,s)}ZodString.create=e=>{var t;return new ZodString({checks:[],typeName:Ht.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==xt.number){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:Et.invalid_type,expected:xt.number,received:t.parsedType}),Ot}let t;const n=new ParseStatus;for(const i of this._def.checks)if("int"===i.kind)St.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:Et.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty());else if("min"===i.kind){(i.inclusive?e.data<i.value:e.data<=i.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:Et.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty())}else if("max"===i.kind){(i.inclusive?e.data>i.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:Et.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty())}else"multipleOf"===i.kind?0!==floatSafeRemainder(e.data,i.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:Et.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):"finite"===i.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:Et.not_finite,message:i.message}),n.dirty()):St.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Tt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Tt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Tt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Tt.toString(t))}setLimit(e,t,n,i){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Tt.toString(i)}]})}_addCheck(e){return new ZodNumber({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Tt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Tt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Tt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Tt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Tt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Tt.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Tt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Tt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Tt.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&St.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ZodNumber.create=e=>new ZodNumber({checks:[],typeName:Ht.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==xt.bigint){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:Et.invalid_type,expected:xt.bigint,received:t.parsedType}),Ot}let t;const n=new ParseStatus;for(const i of this._def.checks)if("min"===i.kind){(i.inclusive?e.data<i.value:e.data<=i.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:Et.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty())}else if("max"===i.kind){(i.inclusive?e.data>i.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:Et.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty())}else"multipleOf"===i.kind?e.data%i.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:Et.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):St.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Tt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Tt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Tt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Tt.toString(t))}setLimit(e,t,n,i){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Tt.toString(i)}]})}_addCheck(e){return new ZodBigInt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Tt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Tt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Tt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Tt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Tt.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ZodBigInt.create=e=>{var t;return new ZodBigInt({checks:[],typeName:Ht.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodBoolean extends ZodType{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==xt.boolean){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:Et.invalid_type,expected:xt.boolean,received:t.parsedType}),Ot}return OK(e.data)}}ZodBoolean.create=e=>new ZodBoolean({typeName:Ht.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodDate extends ZodType{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==xt.date){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:Et.invalid_type,expected:xt.date,received:t.parsedType}),Ot}if(isNaN(e.data.getTime())){return addIssueToContext(this._getOrReturnCtx(e),{code:Et.invalid_date}),Ot}const t=new ParseStatus;let n;for(const i of this._def.checks)"min"===i.kind?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:Et.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),t.dirty()):"max"===i.kind?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),addIssueToContext(n,{code:Et.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),t.dirty()):St.assertNever(i);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ZodDate({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Tt.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Tt.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ZodDate.create=e=>new ZodDate({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Ht.ZodDate,...processCreateParams(e)});class ZodSymbol extends ZodType{_parse(e){if(this._getType(e)!==xt.symbol){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:Et.invalid_type,expected:xt.symbol,received:t.parsedType}),Ot}return OK(e.data)}}ZodSymbol.create=e=>new ZodSymbol({typeName:Ht.ZodSymbol,...processCreateParams(e)});class ZodUndefined extends ZodType{_parse(e){if(this._getType(e)!==xt.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:Et.invalid_type,expected:xt.undefined,received:t.parsedType}),Ot}return OK(e.data)}}ZodUndefined.create=e=>new ZodUndefined({typeName:Ht.ZodUndefined,...processCreateParams(e)});class ZodNull extends ZodType{_parse(e){if(this._getType(e)!==xt.null){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:Et.invalid_type,expected:xt.null,received:t.parsedType}),Ot}return OK(e.data)}}ZodNull.create=e=>new ZodNull({typeName:Ht.ZodNull,...processCreateParams(e)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(e){return OK(e.data)}}ZodAny.create=e=>new ZodAny({typeName:Ht.ZodAny,...processCreateParams(e)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(e){return OK(e.data)}}ZodUnknown.create=e=>new ZodUnknown({typeName:Ht.ZodUnknown,...processCreateParams(e)});class ZodNever extends ZodType{_parse(e){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:Et.invalid_type,expected:xt.never,received:t.parsedType}),Ot}}ZodNever.create=e=>new ZodNever({typeName:Ht.ZodNever,...processCreateParams(e)});class ZodVoid extends ZodType{_parse(e){if(this._getType(e)!==xt.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:Et.invalid_type,expected:xt.void,received:t.parsedType}),Ot}return OK(e.data)}}ZodVoid.create=e=>new ZodVoid({typeName:Ht.ZodVoid,...processCreateParams(e)});class ZodArray extends ZodType{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==xt.array)return addIssueToContext(t,{code:Et.invalid_type,expected:xt.array,received:t.parsedType}),Ot;if(null!==i.exactLength){const e=t.data.length>i.exactLength.value,s=t.data.length<i.exactLength.value;(e||s)&&(addIssueToContext(t,{code:e?Et.too_big:Et.too_small,minimum:s?i.exactLength.value:void 0,maximum:e?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(null!==i.minLength&&t.data.length<i.minLength.value&&(addIssueToContext(t,{code:Et.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),null!==i.maxLength&&t.data.length>i.maxLength.value&&(addIssueToContext(t,{code:Et.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>i.type._parseAsync(new ParseInputLazyPath(t,e,t.path,n))))).then((e=>ParseStatus.mergeArray(n,e)));const s=[...t.data].map(((e,n)=>i.type._parseSync(new ParseInputLazyPath(t,e,t.path,n))));return ParseStatus.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new ZodArray({...this._def,minLength:{value:e,message:Tt.toString(t)}})}max(e,t){return new ZodArray({...this._def,maxLength:{value:e,message:Tt.toString(t)}})}length(e,t){return new ZodArray({...this._def,exactLength:{value:e,message:Tt.toString(t)}})}nonempty(e){return this.min(1,e)}}function deepPartialify(e){if(e instanceof ZodObject){const t={};for(const n in e.shape){const i=e.shape[n];t[n]=ZodOptional.create(deepPartialify(i))}return new ZodObject({...e._def,shape:()=>t})}return e instanceof ZodArray?new ZodArray({...e._def,type:deepPartialify(e.element)}):e instanceof ZodOptional?ZodOptional.create(deepPartialify(e.unwrap())):e instanceof ZodNullable?ZodNullable.create(deepPartialify(e.unwrap())):e instanceof ZodTuple?ZodTuple.create(e.items.map((e=>deepPartialify(e)))):e}ZodArray.create=(e,t)=>new ZodArray({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ht.ZodArray,...processCreateParams(t)});class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=St.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==xt.object){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:Et.invalid_type,expected:xt.object,received:t.parsedType}),Ot}const{status:t,ctx:n}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof ZodNever&&"strip"===this._def.unknownKeys))for(const d in n.data)s.includes(d)||a.push(d);const c=[];for(const d of s){const e=i[d],t=n.data[d];c.push({key:{status:"valid",value:d},value:e._parse(new ParseInputLazyPath(n,t,n.path,d)),alwaysSet:d in n.data})}if(this._def.catchall instanceof ZodNever){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of a)c.push({key:{status:"valid",value:t},value:{status:"valid",value:n.data[t]}});else if("strict"===e)a.length>0&&(addIssueToContext(n,{code:Et.unrecognized_keys,keys:a}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of a){const i=n.data[t];c.push({key:{status:"valid",value:t},value:e._parse(new ParseInputLazyPath(n,i,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of c){const n=await t.key,i=await t.value;e.push({key:n,value:i,alwaysSet:t.alwaysSet})}return e})).then((e=>ParseStatus.mergeObjectSync(t,e))):ParseStatus.mergeObjectSync(t,c)}get shape(){return this._def.shape()}strict(e){return Tt.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var i,s,a,c;const d=null!==(a=null===(s=(i=this._def).errorMap)||void 0===s?void 0:s.call(i,t,n).message)&&void 0!==a?a:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(c=Tt.errToObj(e).message)&&void 0!==c?c:d}:{message:d}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(e){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ZodObject({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ht.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ZodObject({...this._def,catchall:e})}pick(e){const t={};return St.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new ZodObject({...this._def,shape:()=>t})}omit(e){const t={};return St.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new ZodObject({...this._def,shape:()=>t})}deepPartial(){return deepPartialify(this)}partial(e){const t={};return St.objectKeys(this.shape).forEach((n=>{const i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()})),new ZodObject({...this._def,shape:()=>t})}required(e){const t={};return St.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof ZodOptional;)e=e._def.innerType;t[n]=e}})),new ZodObject({...this._def,shape:()=>t})}keyof(){return createZodEnum(St.objectKeys(this.shape))}}ZodObject.create=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:Ht.ZodObject,...processCreateParams(t)}),ZodObject.strictCreate=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strict",catchall:ZodNever.create(),typeName:Ht.ZodObject,...processCreateParams(t)}),ZodObject.lazycreate=(e,t)=>new ZodObject({shape:e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:Ht.ZodObject,...processCreateParams(t)});class ZodUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function handleResults(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const i of e)if("dirty"===i.result.status)return t.common.issues.push(...i.ctx.common.issues),i.result;const n=e.map((e=>new ZodError(e.ctx.common.issues)));return addIssueToContext(t,{code:Et.invalid_union,unionErrors:n}),Ot}));{let e;const i=[];for(const a of n){const n={...t,common:{...t.common,issues:[]},parent:null},s=a._parseSync({data:t.data,path:t.path,parent:n});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:n}),n.common.issues.length&&i.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const s=i.map((e=>new ZodError(e)));return addIssueToContext(t,{code:Et.invalid_union,unionErrors:s}),Ot}}get options(){return this._def.options}}ZodUnion.create=(e,t)=>new ZodUnion({options:e,typeName:Ht.ZodUnion,...processCreateParams(t)});const getDiscriminator=e=>e instanceof ZodLazy?getDiscriminator(e.schema):e instanceof ZodEffects?getDiscriminator(e.innerType()):e instanceof ZodLiteral?[e.value]:e instanceof ZodEnum?e.options:e instanceof ZodNativeEnum?St.objectValues(e.enum):e instanceof ZodDefault?getDiscriminator(e._def.innerType):e instanceof ZodUndefined?[void 0]:e instanceof ZodNull?[null]:e instanceof ZodOptional?[void 0,...getDiscriminator(e.unwrap())]:e instanceof ZodNullable?[null,...getDiscriminator(e.unwrap())]:e instanceof ZodBranded||e instanceof ZodReadonly?getDiscriminator(e.unwrap()):e instanceof ZodCatch?getDiscriminator(e._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==xt.object)return addIssueToContext(t,{code:Et.invalid_type,expected:xt.object,received:t.parsedType}),Ot;const n=this.discriminator,i=t.data[n],s=this.optionsMap.get(i);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(addIssueToContext(t,{code:Et.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ot)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const i=new Map;for(const s of t){const t=getDiscriminator(s.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(i.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);i.set(n,s)}}return new ZodDiscriminatedUnion({typeName:Ht.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...processCreateParams(n)})}}function mergeValues(e,t){const n=getParsedType(e),i=getParsedType(t);if(e===t)return{valid:!0,data:e};if(n===xt.object&&i===xt.object){const n=St.objectKeys(t),i=St.objectKeys(e).filter((e=>-1!==n.indexOf(e))),s={...e,...t};for(const a of i){const n=mergeValues(e[a],t[a]);if(!n.valid)return{valid:!1};s[a]=n.data}return{valid:!0,data:s}}if(n===xt.array&&i===xt.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let i=0;i<e.length;i++){const s=mergeValues(e[i],t[i]);if(!s.valid)return{valid:!1};n.push(s.data)}return{valid:!0,data:n}}return n===xt.date&&i===xt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class ZodIntersection extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),handleParsed=(e,i)=>{if(isAborted(e)||isAborted(i))return Ot;const s=mergeValues(e.value,i.value);return s.valid?((isDirty(e)||isDirty(i))&&t.dirty(),{status:t.value,value:s.data}):(addIssueToContext(n,{code:Et.invalid_intersection_types}),Ot)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>handleParsed(e,t))):handleParsed(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ZodIntersection.create=(e,t,n)=>new ZodIntersection({left:e,right:t,typeName:Ht.ZodIntersection,...processCreateParams(n)});class ZodTuple extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==xt.array)return addIssueToContext(n,{code:Et.invalid_type,expected:xt.array,received:n.parsedType}),Ot;if(n.data.length<this._def.items.length)return addIssueToContext(n,{code:Et.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ot;!this._def.rest&&n.data.length>this._def.items.length&&(addIssueToContext(n,{code:Et.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const i=[...n.data].map(((e,t)=>{const i=this._def.items[t]||this._def.rest;return i?i._parse(new ParseInputLazyPath(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(i).then((e=>ParseStatus.mergeArray(t,e))):ParseStatus.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new ZodTuple({...this._def,rest:e})}}ZodTuple.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:e,typeName:Ht.ZodTuple,rest:null,...processCreateParams(t)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==xt.object)return addIssueToContext(n,{code:Et.invalid_type,expected:xt.object,received:n.parsedType}),Ot;const i=[],s=this._def.keyType,a=this._def.valueType;for(const c in n.data)i.push({key:s._parse(new ParseInputLazyPath(n,c,n.path,c)),value:a._parse(new ParseInputLazyPath(n,n.data[c],n.path,c)),alwaysSet:c in n.data});return n.common.async?ParseStatus.mergeObjectAsync(t,i):ParseStatus.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return new ZodRecord(t instanceof ZodType?{keyType:e,valueType:t,typeName:Ht.ZodRecord,...processCreateParams(n)}:{keyType:ZodString.create(),valueType:e,typeName:Ht.ZodRecord,...processCreateParams(t)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==xt.map)return addIssueToContext(n,{code:Et.invalid_type,expected:xt.map,received:n.parsedType}),Ot;const i=this._def.keyType,s=this._def.valueType,a=[...n.data.entries()].map((([e,t],a)=>({key:i._parse(new ParseInputLazyPath(n,e,n.path,[a,"key"])),value:s._parse(new ParseInputLazyPath(n,t,n.path,[a,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of a){const i=await n.key,s=await n.value;if("aborted"===i.status||"aborted"===s.status)return Ot;"dirty"!==i.status&&"dirty"!==s.status||t.dirty(),e.set(i.value,s.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of a){const i=n.key,s=n.value;if("aborted"===i.status||"aborted"===s.status)return Ot;"dirty"!==i.status&&"dirty"!==s.status||t.dirty(),e.set(i.value,s.value)}return{status:t.value,value:e}}}}ZodMap.create=(e,t,n)=>new ZodMap({valueType:t,keyType:e,typeName:Ht.ZodMap,...processCreateParams(n)});class ZodSet extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==xt.set)return addIssueToContext(n,{code:Et.invalid_type,expected:xt.set,received:n.parsedType}),Ot;const i=this._def;null!==i.minSize&&n.data.size<i.minSize.value&&(addIssueToContext(n,{code:Et.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),null!==i.maxSize&&n.data.size>i.maxSize.value&&(addIssueToContext(n,{code:Et.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const s=this._def.valueType;function finalizeSet(e){const n=new Set;for(const i of e){if("aborted"===i.status)return Ot;"dirty"===i.status&&t.dirty(),n.add(i.value)}return{status:t.value,value:n}}const a=[...n.data.values()].map(((e,t)=>s._parse(new ParseInputLazyPath(n,e,n.path,t))));return n.common.async?Promise.all(a).then((e=>finalizeSet(e))):finalizeSet(a)}min(e,t){return new ZodSet({...this._def,minSize:{value:e,message:Tt.toString(t)}})}max(e,t){return new ZodSet({...this._def,maxSize:{value:e,message:Tt.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ZodSet.create=(e,t)=>new ZodSet({valueType:e,minSize:null,maxSize:null,typeName:Ht.ZodSet,...processCreateParams(t)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==xt.function)return addIssueToContext(t,{code:Et.invalid_type,expected:xt.function,received:t.parsedType}),Ot;function makeArgsIssue(e,n){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:Et.invalid_arguments,argumentsError:n}})}function makeReturnsIssue(e,n){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:Et.invalid_return_type,returnTypeError:n}})}const n={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof ZodPromise){const e=this;return OK((async function(...t){const s=new ZodError([]),a=await e._def.args.parseAsync(t,n).catch((e=>{throw s.addIssue(makeArgsIssue(t,e)),s})),c=await Reflect.apply(i,this,a);return await e._def.returns._def.type.parseAsync(c,n).catch((e=>{throw s.addIssue(makeReturnsIssue(c,e)),s}))}))}{const e=this;return OK((function(...t){const s=e._def.args.safeParse(t,n);if(!s.success)throw new ZodError([makeArgsIssue(t,s.error)]);const a=Reflect.apply(i,this,s.data),c=e._def.returns.safeParse(a,n);if(!c.success)throw new ZodError([makeReturnsIssue(a,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ZodFunction({...this._def,args:ZodTuple.create(e).rest(ZodUnknown.create())})}returns(e){return new ZodFunction({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new ZodFunction({args:e||ZodTuple.create([]).rest(ZodUnknown.create()),returns:t||ZodUnknown.create(),typeName:Ht.ZodFunction,...processCreateParams(n)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ZodLazy.create=(e,t)=>new ZodLazy({getter:e,typeName:Ht.ZodLazy,...processCreateParams(t)});class ZodLiteral extends ZodType{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{received:t.data,code:Et.invalid_literal,expected:this._def.value}),Ot}return{status:"valid",value:e.data}}get value(){return this._def.value}}function createZodEnum(e,t){return new ZodEnum({values:e,typeName:Ht.ZodEnum,...processCreateParams(t)})}ZodLiteral.create=(e,t)=>new ZodLiteral({value:e,typeName:Ht.ZodLiteral,...processCreateParams(t)});class ZodEnum extends ZodType{constructor(){super(...arguments),Mt.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return addIssueToContext(t,{expected:St.joinValues(n),received:t.parsedType,code:Et.invalid_type}),Ot}if(__classPrivateFieldGet(this,Mt)||__classPrivateFieldSet(this,Mt,new Set(this._def.values)),!__classPrivateFieldGet(this,Mt).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return addIssueToContext(t,{received:t.data,code:Et.invalid_enum_value,options:n}),Ot}return OK(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ZodEnum.create(e,{...this._def,...t})}exclude(e,t=this._def){return ZodEnum.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Mt=new WeakMap,ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),Nt.set(this,void 0)}_parse(e){const t=St.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==xt.string&&n.parsedType!==xt.number){const e=St.objectValues(t);return addIssueToContext(n,{expected:St.joinValues(e),received:n.parsedType,code:Et.invalid_type}),Ot}if(__classPrivateFieldGet(this,Nt)||__classPrivateFieldSet(this,Nt,new Set(St.getValidEnumValues(this._def.values))),!__classPrivateFieldGet(this,Nt).has(e.data)){const e=St.objectValues(t);return addIssueToContext(n,{received:n.data,code:Et.invalid_enum_value,options:e}),Ot}return OK(e.data)}get enum(){return this._def.values}}Nt=new WeakMap,ZodNativeEnum.create=(e,t)=>new ZodNativeEnum({values:e,typeName:Ht.ZodNativeEnum,...processCreateParams(t)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==xt.promise&&!1===t.common.async)return addIssueToContext(t,{code:Et.invalid_type,expected:xt.promise,received:t.parsedType}),Ot;const n=t.parsedType===xt.promise?t.data:Promise.resolve(t.data);return OK(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}ZodPromise.create=(e,t)=>new ZodPromise({type:e,typeName:Ht.ZodPromise,...processCreateParams(t)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ht.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:e=>{addIssueToContext(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===i.type){const e=i.transform(n.data,s);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return Ot;const i=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===i.status?Ot:"dirty"===i.status||"dirty"===t.value?DIRTY(i.value):i}));{if("aborted"===t.value)return Ot;const i=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===i.status?Ot:"dirty"===i.status||"dirty"===t.value?DIRTY(i.value):i}}if("refinement"===i.type){const executeRefinement=e=>{const t=i.refinement(e,s);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?Ot:("dirty"===e.status&&t.dirty(),executeRefinement(e.value),{status:t.value,value:e.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>"aborted"===e.status?Ot:("dirty"===e.status&&t.dirty(),executeRefinement(e.value).then((()=>({status:t.value,value:e.value}))))))}if("transform"===i.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!isValid(e))return e;const a=i.transform(e.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>isValid(e)?Promise.resolve(i.transform(e.value,s)).then((e=>({status:t.value,value:e}))):e))}St.assertNever(i)}}ZodEffects.create=(e,t,n)=>new ZodEffects({schema:e,typeName:Ht.ZodEffects,effect:t,...processCreateParams(n)}),ZodEffects.createWithPreprocess=(e,t,n)=>new ZodEffects({schema:t,effect:{type:"preprocess",transform:e},typeName:Ht.ZodEffects,...processCreateParams(n)});class ZodOptional extends ZodType{_parse(e){return this._getType(e)===xt.undefined?OK(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodOptional.create=(e,t)=>new ZodOptional({innerType:e,typeName:Ht.ZodOptional,...processCreateParams(t)});class ZodNullable extends ZodType{_parse(e){return this._getType(e)===xt.null?OK(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodNullable.create=(e,t)=>new ZodNullable({innerType:e,typeName:Ht.ZodNullable,...processCreateParams(t)});class ZodDefault extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===xt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ZodDefault.create=(e,t)=>new ZodDefault({innerType:e,typeName:Ht.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...processCreateParams(t)});class ZodCatch extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return isAsync(i)?i.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new ZodError(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===i.status?i.value:this._def.catchValue({get error(){return new ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(e,t)=>new ZodCatch({innerType:e,typeName:Ht.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...processCreateParams(t)});class ZodNaN extends ZodType{_parse(e){if(this._getType(e)!==xt.nan){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:Et.invalid_type,expected:xt.nan,received:t.parsedType}),Ot}return{status:"valid",value:e.data}}}ZodNaN.create=e=>new ZodNaN({typeName:Ht.ZodNaN,...processCreateParams(e)});const Vt=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?Ot:"dirty"===e.status?(t.dirty(),DIRTY(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?Ot:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new ZodPipeline({in:e,out:t,typeName:Ht.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(e){const t=this._def.innerType._parse(e),freeze=e=>(isValid(e)&&(e.value=Object.freeze(e.value)),e);return isAsync(t)?t.then((e=>freeze(e))):freeze(t)}unwrap(){return this._def.innerType}}function custom(e,t={},n){return e?ZodAny.create().superRefine(((i,s)=>{var a,c;if(!e(i)){const e="function"==typeof t?t(i):"string"==typeof t?{message:t}:t,d=null===(c=null!==(a=e.fatal)&&void 0!==a?a:n)||void 0===c||c,u="string"==typeof e?{message:e}:e;s.addIssue({code:"custom",...u,fatal:d})}})):ZodAny.create()}ZodReadonly.create=(e,t)=>new ZodReadonly({innerType:e,typeName:Ht.ZodReadonly,...processCreateParams(t)});const Kt={object:ZodObject.lazycreate};var Ht,Gt;(Gt=Ht||(Ht={})).ZodString="ZodString",Gt.ZodNumber="ZodNumber",Gt.ZodNaN="ZodNaN",Gt.ZodBigInt="ZodBigInt",Gt.ZodBoolean="ZodBoolean",Gt.ZodDate="ZodDate",Gt.ZodSymbol="ZodSymbol",Gt.ZodUndefined="ZodUndefined",Gt.ZodNull="ZodNull",Gt.ZodAny="ZodAny",Gt.ZodUnknown="ZodUnknown",Gt.ZodNever="ZodNever",Gt.ZodVoid="ZodVoid",Gt.ZodArray="ZodArray",Gt.ZodObject="ZodObject",Gt.ZodUnion="ZodUnion",Gt.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Gt.ZodIntersection="ZodIntersection",Gt.ZodTuple="ZodTuple",Gt.ZodRecord="ZodRecord",Gt.ZodMap="ZodMap",Gt.ZodSet="ZodSet",Gt.ZodFunction="ZodFunction",Gt.ZodLazy="ZodLazy",Gt.ZodLiteral="ZodLiteral",Gt.ZodEnum="ZodEnum",Gt.ZodEffects="ZodEffects",Gt.ZodNativeEnum="ZodNativeEnum",Gt.ZodOptional="ZodOptional",Gt.ZodNullable="ZodNullable",Gt.ZodDefault="ZodDefault",Gt.ZodCatch="ZodCatch",Gt.ZodPromise="ZodPromise",Gt.ZodBranded="ZodBranded",Gt.ZodPipeline="ZodPipeline",Gt.ZodReadonly="ZodReadonly";const Jt=ZodString.create,Yt=ZodNumber.create,Xt=ZodNaN.create,Qt=ZodBigInt.create,er=ZodBoolean.create,tr=ZodDate.create,rr=ZodSymbol.create,nr=ZodUndefined.create,ir=ZodNull.create,or=ZodAny.create,sr=ZodUnknown.create,ar=ZodNever.create,cr=ZodVoid.create,dr=ZodArray.create,ur=ZodObject.create,lr=ZodObject.strictCreate,pr=ZodUnion.create,hr=ZodDiscriminatedUnion.create,fr=ZodIntersection.create,mr=ZodTuple.create,gr=ZodRecord.create,_r=ZodMap.create,yr=ZodSet.create,vr=ZodFunction.create,br=ZodLazy.create,Sr=ZodLiteral.create,kr=ZodEnum.create,wr=ZodNativeEnum.create,Ir=ZodPromise.create,xr=ZodEffects.create,Er=ZodOptional.create,Cr=ZodNullable.create,Or=ZodEffects.createWithPreprocess,Tr=ZodPipeline.create,Rr={string:e=>ZodString.create({...e,coerce:!0}),number:e=>ZodNumber.create({...e,coerce:!0}),boolean:e=>ZodBoolean.create({...e,coerce:!0}),bigint:e=>ZodBigInt.create({...e,coerce:!0}),date:e=>ZodDate.create({...e,coerce:!0})},Mr=Ot;var Nr=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap:function setErrorMap(e){Ct=e},getErrorMap:getErrorMap,makeIssue:makeIssue,EMPTY_PATH:[],addIssueToContext:addIssueToContext,ParseStatus:ParseStatus,INVALID:Ot,DIRTY:DIRTY,OK:OK,isAborted:isAborted,isDirty:isDirty,isValid:isValid,isAsync:isAsync,get util(){return St},get objectUtil(){return wt},ZodParsedType:xt,getParsedType:getParsedType,ZodType:ZodType,datetimeRegex:datetimeRegex,ZodString:ZodString,ZodNumber:ZodNumber,ZodBigInt:ZodBigInt,ZodBoolean:ZodBoolean,ZodDate:ZodDate,ZodSymbol:ZodSymbol,ZodUndefined:ZodUndefined,ZodNull:ZodNull,ZodAny:ZodAny,ZodUnknown:ZodUnknown,ZodNever:ZodNever,ZodVoid:ZodVoid,ZodArray:ZodArray,ZodObject:ZodObject,ZodUnion:ZodUnion,ZodDiscriminatedUnion:ZodDiscriminatedUnion,ZodIntersection:ZodIntersection,ZodTuple:ZodTuple,ZodRecord:ZodRecord,ZodMap:ZodMap,ZodSet:ZodSet,ZodFunction:ZodFunction,ZodLazy:ZodLazy,ZodLiteral:ZodLiteral,ZodEnum:ZodEnum,ZodNativeEnum:ZodNativeEnum,ZodPromise:ZodPromise,ZodEffects:ZodEffects,ZodTransformer:ZodEffects,ZodOptional:ZodOptional,ZodNullable:ZodNullable,ZodDefault:ZodDefault,ZodCatch:ZodCatch,ZodNaN:ZodNaN,BRAND:Vt,ZodBranded:ZodBranded,ZodPipeline:ZodPipeline,ZodReadonly:ZodReadonly,custom:custom,Schema:ZodType,ZodSchema:ZodType,late:Kt,get ZodFirstPartyTypeKind(){return Ht},coerce:Rr,any:or,array:dr,bigint:Qt,boolean:er,date:tr,discriminatedUnion:hr,effect:xr,enum:kr,function:vr,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>custom((t=>t instanceof e),t),intersection:fr,lazy:br,literal:Sr,map:_r,nan:Xt,nativeEnum:wr,never:ar,null:ir,nullable:Cr,number:Yt,object:ur,oboolean:()=>er().optional(),onumber:()=>Yt().optional(),optional:Er,ostring:()=>Jt().optional(),pipeline:Tr,preprocess:Or,promise:Ir,record:gr,set:yr,strictObject:lr,string:Jt,symbol:rr,transformer:xr,tuple:mr,undefined:nr,union:pr,unknown:sr,void:cr,NEVER:Mr,ZodIssueCode:Et,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:ZodError});const Zr=Nr.object({departure_arrival:Nr.string().refine((e=>!isNaN(Date.parse(e))),{message:"Invalid departure arrival datetime format"}),departure_destination:Nr.string().refine((e=>e),{message:"Departure destination must be a string"}),departure_destination_terminal:Nr.string().refine((e=>e),{message:"Departure destination terminal must be a string"}),departure_line:Nr.string().refine((e=>e),{message:"Departure line must be a string"}),departure_origin:Nr.string().refine((e=>e),{message:"Departure origin must be a string"}),departure_origin_terminal:Nr.string().refine((e=>e),{message:"Departure origin terminal must be a string"}),departure_price:Nr.number().refine((e=>e),{message:"Departure price must be a number"}),departure_route:Nr.string().refine((e=>e),{message:"Departure route must be a string"}),departure_stop_cities:Nr.string().refine((e=>e),{message:"Departure stop cities must be a string"}),departure_stops:Nr.number().int().refine((e=>e),{message:"Departure stops must be an integer"}),departure_time:Nr.string().refine((e=>!isNaN(Date.parse(e))),{message:"Invalid departure time datetime format"}),departure_transport_type:Nr.string().refine((e=>e),{message:"Departure transport type must be a string"}),departure_transporter:Nr.string().refine((e=>e),{message:"Departure transporter must be a string"}),passenger_count:Nr.number().int().refine((e=>e),{message:"Passenger count must be an integer"}),payment_card_affiliate:Nr.string().or(Nr.null()).refine((e=>null===e||"string"==typeof e),{message:"Payment card affiliate must be a string or null"}),payment_type:Nr.string().refine((e=>e),{message:"Payment type must be a string"}),recommended_trip:Nr.boolean().refine((e=>e),{message:"Recommended trip must be a boolean"}),recommended_trip_type:Nr.string().or(Nr.null()).refine((e=>null===e||"string"==typeof e),{message:"Recommended trip type must be a string or null"}),routes:Nr.number().int().refine((e=>e),{message:"Routes must be an integer"}),tickets:Nr.number().int().refine((e=>e),{message:"Tickets must be an integer"}),total:Nr.number().refine((e=>e),{message:"Total must be a number"}),user_fingerprint:Nr.string().or(Nr.null()).refine((e=>null===e||"string"==typeof e),{message:"User fingerprint must be a string or null"}),product:Nr.string().refine((e=>e),{message:"Product must be a string"}),ip:Nr.string().regex(/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,{message:"Invalid IP address format"}),departure_ally:Nr.boolean().refine((e=>e),{message:"Departure ally must be a boolean"}).optional(),departure_multicarrier_lines:Nr.array(Nr.any()).refine((e=>e),{message:"Departure multicarrier lines must be an array"}).optional(),departure_multicarrier_transporters:Nr.array(Nr.any()).refine((e=>e),{message:"Departure multicarrier transporters must be an array"}).optional(),departure_open_ticket:Nr.boolean().refine((e=>e),{message:"Departure open ticket must be a boolean"}).optional(),departure_transport_types:Nr.string().refine((e=>e),{message:"Departure transport types must be a string"}).optional(),discount_code:Nr.string().refine((e=>e),{message:"Discount code must be a string"}).optional(),error_message:Nr.string().refine((e=>e),{message:"Error message must be a string"}).optional(),installments:Nr.number().int().refine((e=>e),{message:"Installments must be an integer"}).optional(),language:Nr.string().refine((e=>e),{message:"Language must be a string"}).optional(),on_demand:Nr.boolean().refine((e=>e),{message:"On demand must be a boolean"}).optional(),open_ticket:Nr.boolean().refine((e=>e),{message:"Open ticket must be a boolean"}).optional(),payment_engine:Nr.string().refine((e=>e),{message:"Payment engine must be a string"}).optional(),result_seats:Nr.boolean().refine((e=>e),{message:"Result seats must be a boolean"}).optional(),return_open_ticket:Nr.boolean().refine((e=>e),{message:"Return open ticket must be a boolean"}).optional(),save_card:Nr.boolean().refine((e=>e),{message:"Save card must be a boolean"}).optional(),tenant_name:Nr.string().refine((e=>e),{message:"Tenant name must be a string"}).optional(),token:Nr.string().refine((e=>e),{message:"Token must be a string"}).optional(),use_saved_card:Nr.boolean().refine((e=>e),{message:"Use saved card must be a boolean"}).optional(),user_type:Nr.string().refine((e=>e),{message:"User type must be a string"}).optional(),meta:Nr.object({}).refine((e=>e),{message:"Meta must be an object"}).optional(),phone:Nr.string().regex(/^\+?[1-9]\d{1,14}$/,{message:"Invalid phone number format"}).optional(),email:Nr.string().email({message:"Invalid email format"}).optional()}).strict(),Pr=Nr.object({bus_categories:Nr.string().min(1,"Bus categories are required"),departure_arrival:Nr.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/,"Invalid date-time format for departure arrival"),departure_destination:Nr.string().min(1,"Departure destination is required"),departure_destination_terminal:Nr.string().min(1,"Departure destination terminal is required"),departure_line:Nr.string().min(1,"Departure line is required"),departure_origin:Nr.string().min(1,"Departure origin is required"),departure_origin_terminal:Nr.string().min(1,"Departure origin terminal is required"),departure_price:Nr.number().positive("Departure price must be a positive number"),departure_route:Nr.string().min(1,"Departure route is required"),departure_stop_cities:Nr.string().min(1,"Departure stop cities are required"),departure_stops:Nr.number().int("Departure stops must be an integer"),departure_time:Nr.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/,"Invalid date-time format for departure time"),departure_transport_type:Nr.string().min(1,"Departure transport type is required"),departure_transporter:Nr.string().min(1,"Departure transporter is required"),passenger_count:Nr.number().int("Passenger count must be an integer"),payment_card_affiliate:Nr.string().nullable().optional(),payment_type:Nr.string().min(1,"Payment type is required"),recommended_trip:Nr.boolean().refine((e=>"boolean"==typeof e),{message:"Recommended trip must be a boolean"}),recommended_trip_type:Nr.string().nullable().optional(),routes:Nr.number().int("Routes must be an integer"),tickets:Nr.number().int("Tickets must be an integer"),total:Nr.number().positive("Total must be a positive number"),user_fingerprint:Nr.string().nullable().optional(),product:Nr.string().min(1,"Product is required"),ip:Nr.string().regex(/^(\d{1,3}\.){3}\d{1,3}$/,"Invalid IPv4 format"),meta:Nr.object({}).optional(),phone:Nr.string().regex(/^\+?[1-9]\d{1,14}$/,"Invalid phone format").optional(),email:Nr.string().email("Invalid email format").optional()}),Dr=Nr.object({}),Ar=Nr.object({mixpanelToken:Nr.string().min(1,"Mixpanel token is required"),debug:Nr.boolean().optional(),identificationKey:Nr.string().min(1,"Identification key is required")}),SchemaErrorFormatter=e=>e.issues.map((e=>{console.log("issue==>",e);let t="INVALID_FIELD",n="",i="",s="";return"invalid_type"===e.code?(t="TYPE_MISMATCH",n=e.expected,i=e.received,s=`Expected ${n} but received ${i}. Please provide a value of type ${n}.`):"too_small"===e.code?(t="VALUE_TOO_SMALL",s=`Increase the value to at least ${e.minimum}.`):"too_big"===e.code?(t="VALUE_TOO_BIG",s=`Reduce the value to no more than ${e.maximum}.`):(t="INVALID_FIELD",s="Ensure the field matches the expected format and value type."),{field:e.path.join("."),error_type:t,expected:n,received:i,message:e.message,suggestion:s}})),Lr={"Payment Failed":Zr,"Purchase Complete":Pr,"Track Test":Dr},jr={parseEventProps(e,t){const n=Lr[e];if(!n)return{status:"error",message:`Event ${e} not found`};try{return n.parse(t),{status:"ok",message:"Schema is valid"}}catch(Q){if(Q instanceof ZodError){return{status:"error",message:"Schema validation failed",errors:SchemaErrorFormatter(Q)}}return{status:"error",message:"Unknown validation error"}}},parseInitProps(e){try{return Ar.parse(e),{status:"ok",message:"Init props are valid"}}catch(Q){if(Q instanceof ZodError){return{status:"error",message:"Schema validation failed",errors:SchemaErrorFormatter(Q)}}return{status:"error",message:"Unknown validation error"}}}};var __assign=function(){return __assign=Object.assign||function __assign2(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},__assign.apply(this,arguments)};function __awaiter(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 Fr={default:"endpoint"},qr={default:"tlsEndpoint"},Ur="Client timeout",Br="Network connection error",$r="Network request aborted",zr="Response cannot be parsed",Wr="Blocked by CSP",Vr="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 Kr=E("WrongRegion"),Hr=E("SubscriptionNotActive"),Gr=E("UnsupportedVersion"),Jr=E("InstallationMethodRestricted"),Yr=E("HostnameRestricted"),Xr=E("IntegrationFailed"),Qr="API key required",en="API key not found",tn="API key expired",rn="Request cannot be parsed",nn="Request failed",sn="Request failed to process",an="Too many requests, rate limit exceeded",cn="Not available for this origin",dn="Not available with restricted header",un=Qr,ln=en,pn=tn,hn="Failed to load the JS script of the agent",fn="9319";function M(e,t){var n,i,s,a,c,d=[],u=(c=function __spreadArray(e,t,n){if(n||2===arguments.length)for(var i,s=0,a=t.length;s<a;s++)!i&&s in t||(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))}([],e,!0),n={current:function(){return c[0]},postpone:function(){var e=c.shift();void 0!==e&&c.push(e)},exclude:function(){c.shift()}},a=0,i=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,a++))},s=new Set,[n.current(),function(e,t){var a,c=t instanceof Error?t.message:"";if(c===Wr||c===Vr)n.exclude(),a=0;else if(c===fn)n.exclude();else if(c===hn){var d=Date.now()-e.getTime()<50,u=n.current();u&&d&&!s.has(u)&&(s.add(u),a=0),n.postpone()}else n.postpone();var l=n.current();return void 0===l?void 0:[l,null!=a?a:e.getTime()+i()-Date.now()]}]),l=u[0],p=u[1];if(void 0===l)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var p2=function(e){var n=new Date,r3=function(t){return d.push({url:e,startedAt:n,finishedAt:new Date,error:t})},i=t(e);return i.then((function(){return r3()}),r3),i.catch((function(e){if(d.length>=5)throw e;var t=p(n,e);if(!t)throw e;var i,s=t[0],a=t[1];return(i=a,new Promise((function(e){return setTimeout(e,i)}))).then((function(){return p2(s)}))}))};return p2(l).then((function(e){return[e,d]}))}var mn="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",gn=mn;function F(e){var t;e.scriptUrlPattern;var n,i,s,a,c,d,u,l=e.token,p=e.apiKey,h=void 0===p?l:p,f=function __rest(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]])}return n}(e,["scriptUrlPattern","token","apiKey"]),m=null!==(t=function r(e,t){return n=e,i=t,Object.prototype.hasOwnProperty.call(n,i)?e[t]:void 0;var n,i}(e,"scriptUrlPattern"))&&void 0!==t?t:mn,g=(c=[],d=function(){c.push({time:new Date,state:document.visibilityState})},n=document,i="visibilitychange",s=d,n.addEventListener(i,s,a),u=function(){return n.removeEventListener(i,s,a)},d(),[c,u]),_=g[0],y=g[1];return Promise.resolve().then((function(){if(!h||"string"!=typeof h)throw new Error(Qr);var e=function(e,t){return(Array.isArray(e)?e:[e]).map((function(e){return function(e,t){var n=encodeURIComponent;return e.replace(/<[^<>]+>/g,(function(e){return"<version>"===e?"3":"<apiKey>"===e?n(t):"<loaderVersion>"===e?n("3.11.1"):e}))}(String(e),t)}))}(m,h);return M(e,V)})).catch((function(e){throw y(),function(e){return e instanceof Error&&e.message===fn?new Error(hn):e}(e)})).then((function(e){var t=e[0],n=e[1];return y(),t.load(__assign(__assign({},f),{ldi:{attempts:n,visibilityStates:_}}))}))}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(Vr);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(hn))},i.async=!0,i.src=t,s.appendChild(i)}));var t}),(function(){throw new Error(Wr)})).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(fn);return c}var _n={load:F,defaultScriptUrlPattern:gn,ERROR_SCRIPT_LOAD_FAIL:hn,ERROR_API_KEY_EXPIRED:tn,ERROR_API_KEY_INVALID:en,ERROR_API_KEY_MISSING:Qr,ERROR_BAD_REQUEST_FORMAT:rn,ERROR_BAD_RESPONSE_FORMAT:zr,ERROR_CLIENT_TIMEOUT:Ur,ERROR_CSP_BLOCK:Wr,ERROR_FORBIDDEN_ENDPOINT:Yr,ERROR_FORBIDDEN_HEADER:dn,ERROR_FORBIDDEN_ORIGIN:cn,ERROR_GENERAL_SERVER_FAILURE:nn,ERROR_INSTALLATION_METHOD_RESTRICTED:Jr,ERROR_INTEGRATION_FAILURE:Xr,ERROR_INVALID_ENDPOINT:Vr,ERROR_NETWORK_ABORT:$r,ERROR_NETWORK_CONNECTION:Br,ERROR_RATE_LIMIT:an,ERROR_SERVER_TIMEOUT:sn,ERROR_SUBSCRIPTION_NOT_ACTIVE:Hr,ERROR_TOKEN_EXPIRED:pn,ERROR_TOKEN_INVALID:ln,ERROR_TOKEN_MISSING:un,ERROR_UNSUPPORTED_VERSION:Gr,ERROR_WRONG_REGION:Kr,defaultEndpoint:Fr,defaultTlsEndpoint:qr};const yn=Object.freeze(Object.defineProperty({__proto__:null,ERROR_API_KEY_EXPIRED:tn,ERROR_API_KEY_INVALID:en,ERROR_API_KEY_MISSING:Qr,ERROR_BAD_REQUEST_FORMAT:rn,ERROR_BAD_RESPONSE_FORMAT:zr,ERROR_CLIENT_TIMEOUT:Ur,ERROR_CSP_BLOCK:Wr,ERROR_FORBIDDEN_ENDPOINT:Yr,ERROR_FORBIDDEN_HEADER:dn,ERROR_FORBIDDEN_ORIGIN:cn,ERROR_GENERAL_SERVER_FAILURE:nn,ERROR_INSTALLATION_METHOD_RESTRICTED:Jr,ERROR_INTEGRATION_FAILURE:Xr,ERROR_INVALID_ENDPOINT:Vr,ERROR_NETWORK_ABORT:$r,ERROR_NETWORK_CONNECTION:Br,ERROR_RATE_LIMIT:an,ERROR_SCRIPT_LOAD_FAIL:hn,ERROR_SERVER_TIMEOUT:sn,ERROR_SUBSCRIPTION_NOT_ACTIVE:Hr,ERROR_TOKEN_EXPIRED:pn,ERROR_TOKEN_INVALID:ln,ERROR_TOKEN_MISSING:un,ERROR_UNSUPPORTED_VERSION:Gr,ERROR_WRONG_REGION:Kr,default:_n,defaultEndpoint:Fr,defaultScriptUrlPattern:gn,defaultTlsEndpoint:qr,load:F},Symbol.toStringTag,{value:"Module"})),vn="@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=vn){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=vn){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 bn,Sn;(Sn=bn||(bn={})).Memory="memory",Sn.LocalStorage="localstorage",Sn.SessionStorage="sessionstorage",Sn.NoCache="nocache";const kn={[bn.Memory]:()=>(new InMemoryCache).enclosedCache,[bn.LocalStorage]:e=>new LocalStorageCache(e),[bn.SessionStorage]:e=>new SessionStorageCache(e),[bn.NoCache]:()=>new CacheStub},cacheFactory=e=>kn[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)||bn.SessionStorage,!cacheFactory(this.cacheLocation))throw new Error(`Invalid cache location "${this.cacheLocation}"`);(e=>{switch(e){case bn.SessionStorage:try{window.sessionStorage.getItem("item")}catch(t){return!1}return!0;case bn.LocalStorage:try{window.localStorage.getItem("item")}catch(t){return!1}return!0;default:return!0}})(this.cacheLocation)||(this.cacheLocation=bn.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:yn;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 wn="default_fingerprint_cache",In=7,getExpirationDate=e=>new Date((new Date).getTime()+24*e*60*60*1e3).getTime(),getCachedFingerprint=()=>{const{cacheName:e=wn}=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=wn,cacheTimeInDays:n=In}=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(Q){throw console.error("Error retrieving fingerprint:",Q),Q}}const xn=["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=jr.parseEventProps(e,t);console.log("validation schema result===>",n);const i=!xn.includes(e),s=await getFingerprint(i),a={...{"User Fingerprint":s},...t};It.track(e,a)}catch(Q){throw console.error("Error tracking event:",Q),Q}}function trackTest(){trackEvent("Track Test",{})}async function init(e){jr.parseInitProps(e);const{mixpanelToken:t,debug:n=!1,identificationKey:i}=e;await function initMixpanel(e,t=!1){return new Promise((n=>{It.init(e,{debug:t,loaded:()=>{window.mixpanel=It,n()}})}))}(t,n);try{await async function initFingerprint(e){window.fingerprintConfig={},window.fpClient=new FpjsClient({loadOptions:{apiKey:e}});try{await window.fpClient.init()}catch(Q){throw console.error("Error initializing identification service:",Q),Q}}(i)}catch(Q){console.error("Error initializing identification service:",Q)}!function onLoaded(){window.dispatchEvent(new CustomEvent("Tracker Ready"))}()}const En={init:init,trackTest:trackTest};exports.default=En,exports.init=init,exports.trackTest=trackTest;