!function(e){"use strict";var t,n=Object.defineProperty,r=(e,t,r)=>((e,t,r)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),o=Object.defineProperty,s=(e,t,n)=>((e,t,n)=>t in e?o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),i=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(i||{});function a(e){return e.nodeType===e.ELEMENT_NODE}function l(e){const t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function c(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function d(e){try{const n=e.rules||e.cssRules;return n?((t=Array.from(n,u).join("")).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t):null}catch(e){return null}var t}function u(e){let t;if(function(e){return"styleSheet"in e}(e))try{t=d(e.styleSheet)||function(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(e){}else if(function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":"))return function(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}(e.cssText);return t||e.cssText}function h(e,t){return Array.from(e.styleSheets).find((e=>e.href===t))}let p=class{constructor(){s(this,"idNodeMap",new Map),s(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;const n=null==(t=this.getMeta(e))?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 m(e){let{element:t,maskInputOptions:n,tagName:r,type:o,value:s,maskInputFn:i}=e,a=s||"";const l=o&&g(o);return(n[r.toLowerCase()]||l&&n[l])&&(a=i?i(a,t):"*".repeat(a.length)),a}function g(e){return e.toLowerCase()}const f="__rrweb_original__";function y(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?g(t):null}function I(e,t){var n;let r;try{r=new URL(e,null!=t?t:window.location.href)}catch(e){return null}const o=r.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(n=null==o?void 0:o[1])&&void 0!==n?n:null}let C=1;const b=new RegExp("[^a-z0-9-_:]"),S=-2;function v(){return C++}let w,M;const k=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,A=/^(?:[a-z+]+:)?\/\//i,N=/^www\..*/i,T=/^(data:)([^,]*),(.*)/i;function E(e,t){return(e||"").replace(k,((e,n,r,o,s,i)=>{const a=r||s||i,l=n||o||"";if(!a)return e;if(A.test(a)||N.test(a))return`url(${l}${a}${l})`;if(T.test(a))return`url(${l}${a}${l})`;if("/"===a[0])return`url(${l}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+a}${l})`;const c=t.split("/"),d=a.split("/");c.pop();for(const e of d)"."!==e&&(".."===e?c.pop():c.push(e));return`url(${l}${c.join("/")}${l})`}))}const O=/^[^ \t\n\r\u000c]+/,R=/^[, \t\n\r\u000c]+/;const L=new WeakMap;function x(e,t){return t&&""!==t.trim()?F(e,t):t}function D(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function F(e,t){let n=L.get(e);if(n||(n=e.createElement("a"),L.set(e,n)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return n.setAttribute("href",t),n.href}function G(e,t,n,r){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]?x(e,r):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function(e,t){if(""===t.trim())return t;let n=0;function r(e){let r;const o=e.exec(t.substring(n));return o?(r=o[0],n+=r.length,r):""}const o=[];for(;r(R),!(n>=t.length);){let s=r(O);if(","===s.slice(-1))s=x(e,s.substring(0,s.length-1)),o.push(s);else{let r="";s=x(e,s);let i=!1;for(;;){const e=t.charAt(n);if(""===e){o.push((s+r).trim());break}if(i)")"===e&&(i=!1);else{if(","===e){n+=1,o.push((s+r).trim());break}"("===e&&(i=!0)}r+=e,n+=1}}}return o.join(", ")}(e,r):"style"===n?E(r,F(e)):"object"===t&&"data"===n?x(e,r):r:x(e,r):r}function B(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function W(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&W(e.parentNode,t,n);for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}return!!n&&W(e.parentNode,t,n)}function Z(e,t,n,r){let o;if(a(e)){if(o=e,!o.childNodes.length)return!1}else{if(null===e.parentElement)return!1;o=e.parentElement}try{if("string"==typeof t){if(r){if(o.closest(`.${t}`))return!0}else if(o.classList.contains(t))return!0}else if(W(o,t,r))return!0;if(n)if(r){if(o.closest(n))return!0}else if(o.matches(n))return!0}catch(e){}return!1}function Y(e,t){const{doc:n,mirror:r,blockClass:o,blockSelector:s,needsMask:a,inlineStylesheet:l,maskInputOptions:c={},maskTextFn:u,maskInputFn:p,dataURLOptions:I={},inlineImages:C,recordCanvas:S,keepIframeSrcFn:v,newlyAddedElement:k=!1}=t,A=function(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:i.Document,childNodes:[],compatMode:e.compatMode}:{type:i.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:i.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:A};case e.ELEMENT_NODE:return function(e,t){const{doc:n,blockClass:r,blockSelector:o,inlineStylesheet:s,maskInputOptions:a={},maskInputFn:l,dataURLOptions:c={},inlineImages:u,recordCanvas:p,keepIframeSrcFn:I,newlyAddedElement:C=!1,rootId:S}=t,v=function(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}if(n)return e.matches(n)}catch(e){}return!1}(e,r,o),k=function(e){if(e instanceof HTMLFormElement)return"form";const t=g(e.tagName);return b.test(t)?"div":t}(e);let A={};const N=e.attributes.length;for(let t=0;t0!==e)))return!1}return!0})(e)||(A.rr_dataURL=e.toDataURL(c.type,c.quality));else if(!("__context"in e)){const t=e.toDataURL(c.type,c.quality),r=n.createElement("canvas");r.width=e.width,r.height=e.height;t!==r.toDataURL(c.type,c.quality)&&(A.rr_dataURL=t)}if("img"===k&&u){w||(w=n.createElement("canvas"),M=w.getContext("2d"));const t=e,r=t.currentSrc||t.getAttribute("src")||"",o=t.crossOrigin,s=()=>{t.removeEventListener("load",s);try{w.width=t.naturalWidth,w.height=t.naturalHeight,M.drawImage(t,0,0),A.rr_dataURL=w.toDataURL(c.type,c.quality)}catch(e){if("anonymous"!==t.crossOrigin)return t.crossOrigin="anonymous",void(t.complete&&0!==t.naturalWidth?s():t.addEventListener("load",s));console.warn(`Cannot inline img src=${r}! Error: ${e}`)}"anonymous"===t.crossOrigin&&(o?A.crossOrigin=o:t.removeAttribute("crossorigin"))};t.complete&&0!==t.naturalWidth?s():t.addEventListener("load",s)}if("audio"===k||"video"===k){const t=A;t.rr_mediaState=e.paused?"paused":"played",t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}C||(e.scrollLeft&&(A.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(A.rr_scrollTop=e.scrollTop));if(v){const{width:t,height:n}=e.getBoundingClientRect();A={class:A.class,rr_width:`${t}px`,rr_height:`${n}px`}}"iframe"!==k||I(A.src)||(e.contentDocument||(A.rr_src=A.src),delete A.src);let T;try{customElements.get(k)&&(T=!0)}catch(e){}return{type:i.Element,tagName:k,attributes:A,childNodes:[],isSVG:D(e)||void 0,needBlock:v,rootId:S,isCustom:T}}(e,{doc:n,blockClass:o,blockSelector:s,inlineStylesheet:l,maskInputOptions:c,maskInputFn:p,dataURLOptions:I,inlineImages:C,recordCanvas:S,keepIframeSrcFn:v,newlyAddedElement:k,rootId:A});case e.TEXT_NODE:return function(e,t){var n;const{needsMask:r,maskTextFn:o,rootId:s}=t,a=e.parentNode&&e.parentNode.tagName;let l=e.textContent;const c="STYLE"===a||void 0,u="SCRIPT"===a||void 0;if(c&&l){try{e.nextSibling||e.previousSibling||(null==(n=e.parentNode.sheet)?void 0:n.cssRules)&&(l=d(e.parentNode.sheet))}catch(t){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${t}`,e)}l=E(l,F(t.doc))}u&&(l="SCRIPT_PLACEHOLDER");!c&&!u&&l&&r&&(l=o?o(l,e.parentElement):l.replace(/[\S]/g,"*"));return{type:i.Text,textContent:l||"",isStyle:c,rootId:s}}(e,{doc:n,needsMask:a,maskTextFn:u,rootId:A});case e.CDATA_SECTION_NODE:return{type:i.CDATA,textContent:"",rootId:A};case e.COMMENT_NODE:return{type:i.Comment,textContent:e.textContent||"",rootId:A};default:return!1}}function V(e){return null==e?"":e.toLowerCase()}function H(e,t){const{doc:n,mirror:r,blockClass:o,blockSelector:s,maskTextClass:d,maskTextSelector:u,skipChild:h=!1,inlineStylesheet:p=!0,maskInputOptions:m={},maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:C={},inlineImages:b=!1,recordCanvas:w=!1,onSerialize:M,onIframeLoad:k,iframeLoadTimeout:A=5e3,onStylesheetLoad:N,stylesheetLoadTimeout:T=5e3,keepIframeSrcFn:E=(()=>!1),newlyAddedElement:O=!1}=t;let{needsMask:R}=t,{preserveWhiteSpace:L=!0}=t;if(!R){R=Z(e,d,u,void 0===R)}const x=Y(e,{doc:n,mirror:r,blockClass:o,blockSelector:s,needsMask:R,inlineStylesheet:p,maskInputOptions:m,maskTextFn:g,maskInputFn:f,dataURLOptions:C,inlineImages:b,recordCanvas:w,keepIframeSrcFn:E,newlyAddedElement:O});if(!x)return console.warn(e,"not serialized"),null;let D;D=r.hasNode(e)?r.getId(e):!function(e,t){if(t.comment&&e.type===i.Comment)return!0;if(e.type===i.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel||"modulepreload"===e.attributes.rel)&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===I(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(V(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===V(e.attributes.name)||"icon"===V(e.attributes.rel)||"apple-touch-icon"===V(e.attributes.rel)||"shortcut icon"===V(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&V(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(V(e.attributes.property).match(/^(og|twitter|fb):/)||V(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===V(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===V(e.attributes.name)||"googlebot"===V(e.attributes.name)||"bingbot"===V(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===V(e.attributes.name)||"generator"===V(e.attributes.name)||"framework"===V(e.attributes.name)||"publisher"===V(e.attributes.name)||"progid"===V(e.attributes.name)||V(e.attributes.property).match(/^article:/)||V(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===V(e.attributes.name)||"yandex-verification"===V(e.attributes.name)||"csrf-token"===V(e.attributes.name)||"p:domain_verify"===V(e.attributes.name)||"verify-v1"===V(e.attributes.name)||"verification"===V(e.attributes.name)||"shopify-checkout-api-token"===V(e.attributes.name)))return!0}}return!1}(x,y)&&(L||x.type!==i.Text||x.isStyle||x.textContent.replace(/^\s+|\s+$/gm,"").length)?v():S;const F=Object.assign(x,{id:D});if(r.add(e,F),D===S)return null;M&&M(e);let G=!h;if(F.type===i.Element){G=G&&!F.needBlock,delete F.needBlock;const t=e.shadowRoot;t&&c(t)&&(F.isShadowHost=!0)}if((F.type===i.Document||F.type===i.Element)&&G){y.headWhitespace&&F.type===i.Element&&"head"===F.tagName&&(L=!1);const t={doc:n,mirror:r,blockClass:o,blockSelector:s,needsMask:R,maskTextClass:d,maskTextSelector:u,skipChild:h,inlineStylesheet:p,maskInputOptions:m,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:C,inlineImages:b,recordCanvas:w,preserveWhiteSpace:L,onSerialize:M,onIframeLoad:k,iframeLoadTimeout:A,onStylesheetLoad:N,stylesheetLoadTimeout:T,keepIframeSrcFn:E};if(F.type===i.Element&&"textarea"===F.tagName&&void 0!==F.attributes.value);else for(const n of Array.from(e.childNodes)){const e=H(n,t);e&&F.childNodes.push(e)}if(a(e)&&e.shadowRoot)for(const n of Array.from(e.shadowRoot.childNodes)){const r=H(n,t);r&&(c(e.shadowRoot)&&(r.isShadow=!0),F.childNodes.push(r))}}return e.parentNode&&l(e.parentNode)&&c(e.parentNode)&&(F.isShadow=!0),F.type===i.Element&&"iframe"===F.tagName&&function(e,t,n){const r=e.contentWindow;if(!r)return;let o,s=!1;try{o=r.document.readyState}catch(e){return}if("complete"!==o){const r=setTimeout((()=>{s||(t(),s=!0)}),n);return void e.addEventListener("load",(()=>{clearTimeout(r),s=!0,t()}))}const i="about:blank";if(r.location.href!==i||e.src===i||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(e,(()=>{const t=e.contentDocument;if(t&&k){const n=H(t,{doc:t,mirror:r,blockClass:o,blockSelector:s,needsMask:R,maskTextClass:d,maskTextSelector:u,skipChild:!1,inlineStylesheet:p,maskInputOptions:m,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:C,inlineImages:b,recordCanvas:w,preserveWhiteSpace:L,onSerialize:M,onIframeLoad:k,iframeLoadTimeout:A,onStylesheetLoad:N,stylesheetLoadTimeout:T,keepIframeSrcFn:E});n&&k(e,n)}}),A),F.type===i.Element&&"link"===F.tagName&&"string"==typeof F.attributes.rel&&("stylesheet"===F.attributes.rel||"preload"===F.attributes.rel&&"string"==typeof F.attributes.href&&"css"===I(F.attributes.href))&&function(e,t,n){let r,o=!1;try{r=e.sheet}catch(e){return}if(r)return;const s=setTimeout((()=>{o||(t(),o=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(s),o=!0,t()}))}(e,(()=>{if(N){const t=H(e,{doc:n,mirror:r,blockClass:o,blockSelector:s,needsMask:R,maskTextClass:d,maskTextSelector:u,skipChild:!1,inlineStylesheet:p,maskInputOptions:m,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:C,inlineImages:b,recordCanvas:w,preserveWhiteSpace:L,onSerialize:M,onIframeLoad:k,iframeLoadTimeout:A,onStylesheetLoad:N,stylesheetLoadTimeout:T,keepIframeSrcFn:E});t&&N(e,t)}}),T),F}function X(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document;const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const _="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 z={map:{},getId:()=>(console.error(_),-1),getNode:()=>(console.error(_),null),removeNodeFromMap(){console.error(_)},has:()=>(console.error(_),!1),reset(){console.error(_)}};function P(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=null,o=0;return function(){for(var s=arguments.length,i=new Array(s),a=0;at?(r&&(clearTimeout(r),r=null),o=l,e.apply(d,i)):r||!1===n.trailing||(r=setTimeout((()=>{o=!1===n.leading?0:Date.now(),r=null,e.apply(d,i)}),c))}}function J(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:window;const s=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,r?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),s&&s.set&&s.set.call(this,e)}}),()=>J(e,t,s||{},!0)}function U(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],o=n(r);return"function"==typeof o&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=o,()=>{e[t]=r}}catch{return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(z=new Proxy(z,{get:(e,t,n)=>("map"===t&&console.error(_),Reflect.get(e,t,n))}));let K=Date.now;function j(e){var t,n,r,o,s,i;const a=e.document;return{left:a.scrollingElement?a.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==a?void 0:a.documentElement.scrollLeft)||(null==(n=null==(t=null==a?void 0:a.body)?void 0:t.parentElement)?void 0:n.scrollLeft)||(null==(r=null==a?void 0:a.body)?void 0:r.scrollLeft)||0,top:a.scrollingElement?a.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==a?void 0:a.documentElement.scrollTop)||(null==(s=null==(o=null==a?void 0:a.body)?void 0:o.parentElement)?void 0:s.scrollTop)||(null==(i=null==a?void 0:a.body)?void 0:i.scrollTop)||0}}function Q(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function q(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function $(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}function ee(e,t,n,r){if(!e)return!1;const o=$(e);if(!o)return!1;try{if("string"==typeof t){if(o.classList.contains(t))return!0;if(r&&null!==o.closest("."+t))return!0}else if(W(o,t,r))return!0}catch(e){}if(n){if(o.matches(n))return!0;if(r&&null!==o.closest(n))return!0}return!1}function te(e,t,n){return!("TITLE"!==e.tagName||!n.headTitleMutations)||t.getId(e)===S}function ne(e,t){if(l(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||ne(e.parentNode,t))}function re(e){return Boolean(e.changedTouches)}function oe(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function se(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function ie(e){return Boolean(null==e?void 0:e.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(K=()=>(new Date).getTime());let ae=class{constructor(){r(this,"id",1),r(this,"styleIDMap",new WeakMap),r(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 le(e){var t,n;let r=null;return(null==(n=null==(t=e.getRootNode)?void 0:t.call(e))?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(r=e.getRootNode().host),r}function ce(e){const t=e.ownerDocument;if(!t)return!1;const n=function(e){let t,n=e;for(;t=le(n);)n=t;return n}(e);return t.contains(n)}function de(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||ce(e))}var ue=(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))(ue||{}),he=(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))(he||{}),pe=(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))(pe||{}),me=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(me||{}),ge=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(ge||{}),fe=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(fe||{});function ye(e){return"__ln"in e}class Ie{constructor(){r(this,"length",0),r(this,"head",null),r(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}@${t}`;class be{constructor(){r(this,"frozen",!1),r(this,"locked",!1),r(this,"texts",[]),r(this,"attributes",[]),r(this,"attributeMap",new WeakMap),r(this,"removes",[]),r(this,"mapRemoves",[]),r(this,"movedMap",{}),r(this,"addedSet",new Set),r(this,"movedSet",new Set),r(this,"droppedSet",new Set),r(this,"mutationCb"),r(this,"blockClass"),r(this,"blockSelector"),r(this,"maskTextClass"),r(this,"maskTextSelector"),r(this,"inlineStylesheet"),r(this,"maskInputOptions"),r(this,"maskTextFn"),r(this,"maskInputFn"),r(this,"keepIframeSrcFn"),r(this,"recordCanvas"),r(this,"inlineImages"),r(this,"slimDOMOptions"),r(this,"dataURLOptions"),r(this,"doc"),r(this,"mirror"),r(this,"iframeManager"),r(this,"stylesheetManager"),r(this,"shadowDomManager"),r(this,"canvasManager"),r(this,"processedNodeManager"),r(this,"unattachedDoc"),r(this,"processMutations",(e=>{e.forEach(this.processMutation),this.emit()})),r(this,"emit",(()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,n=new Ie,r=e=>{let t=e,n=S;for(;n===S;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},o=o=>{if(!o.parentNode||!de(o)||"TEXTAREA"===o.parentNode.tagName)return;const s=l(o.parentNode)?this.mirror.getId(le(o)):this.mirror.getId(o.parentNode),i=r(o);if(-1===s||-1===i)return n.addNode(o);const a=H(o,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{oe(e,this.mirror)&&this.iframeManager.addIframe(e),se(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),ie(o)&&this.shadowDomManager.addShadowRoot(o.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});a&&(e.push({parentId:s,nextId:i,node:a}),t.add(a.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of this.movedSet)ve(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||o(e);for(const e of this.addedSet)we(this.droppedSet,e)||ve(this.removes,e,this.mirror)?we(this.movedSet,e)?o(e):this.droppedSet.add(e):o(e);let s=null;for(;n.length;){let e=null;if(s){const t=this.mirror.getId(s.value.parentNode),n=r(s.value);-1!==t&&-1!==n&&(e=s)}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===r(n.value))continue;if(-1!==t){e=n;break}{const t=n.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const r=t.parentNode.host;if(-1!==this.mirror.getId(r)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}s=e.previous,n.removeNode(e.value),o(e.value)}const i={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),r=JSON.stringify(e._unchangedStyles);n.length!t.has(e.id))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(i.texts.length||i.attributes.length||i.removes.length||i.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(i))})),r(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("")})),r(this,"processMutation",(e=>{if(!te(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=e.target.textContent;ee(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:Z(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,$(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let n=e.attributeName,r=e.target.getAttribute(n);if("value"===n){const e=y(t);r=m({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:r,maskInputFn:this.maskInputFn})}if(ee(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let o=this.attributeMap.get(e.target);if("IFRAME"===t.tagName&&"src"===n&&!this.keepIframeSrcFn(r)){if(t.contentDocument)return;n="rr_src"}if(o||(o={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(e.target,o)),"type"===n&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),!B(t.tagName,n)&&(o.attributes[n]=G(this.doc,g(t.tagName),g(n),r),"style"===n)){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}const n=this.unattachedDoc.createElement("span");e.oldValue&&n.setAttribute("style",e.oldValue);for(const e of Array.from(t.style)){const r=t.style.getPropertyValue(e),s=t.style.getPropertyPriority(e);r!==n.style.getPropertyValue(e)||s!==n.style.getPropertyPriority(e)?o.styleDiff[e]=""===s?r:[r,s]:o._unchangedStyles[e]=[r,s]}for(const e of Array.from(n.style))""===t.style.getPropertyValue(e)&&(o.styleDiff[e]=!1)}break}case"childList":if(ee(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),r=l(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);ee(e.target,this.blockClass,this.blockSelector,!1)||te(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(Se(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||ne(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Ce(n,r)]?Se(this.movedSet,t):this.removes.push({parentId:r,id:n,isShadow:!(!l(e.target)||!c(e.target))||void 0})),this.mapRemoves.push(t))}))}})),r(this,"genAdds",((e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(te(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[Ce(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);ee(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach((e=>this.genAdds(e))),ie(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 Se(e,t){e.delete(t),t.childNodes.forEach((t=>Se(e,t)))}function ve(e,t,n){return 0!==e.length&&function(e,t,n){let r=t.parentNode;for(;r;){const t=n.getId(r);if(e.some((e=>e.id===t)))return!0;r=r.parentNode}return!1}(e,t,n)}function we(e,t){return 0!==e.size&&Me(e,t)}function Me(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||Me(e,n))}let ke;const Ae=e=>{if(!ke)return e;return function(){try{return e(...arguments)}catch(e){if(ke&&!0===ke(e))return;throw e}}},Ne=[];function Te(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{}return e&&e.target}function Ee(e,t){var n,r;const o=new be;Ne.push(o),o.init(e);let s=window.MutationObserver||window.__rrMutationObserver;const i=null==(r=null==(n=null==window?void 0:window.Zone)?void 0:n.__symbol__)?void 0:r.call(n,"MutationObserver");i&&window[i]&&(s=window[i]);const a=new s(Ae(o.processMutations.bind(o)));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function Oe(e){let{mouseInteractionCb:t,doc:n,mirror:r,blockClass:o,blockSelector:s,sampling:i}=e;if(!1===i.mouseInteraction)return()=>{};const a=!0===i.mouseInteraction||void 0===i.mouseInteraction?{}:i.mouseInteraction,l=[];let c=null;return Object.keys(pe).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==a[e])).forEach((e=>{let i=g(e);const a=(e=>n=>{const i=Te(n);if(ee(i,o,s,!0))return;let a=null,l=e;if("pointerType"in n){switch(n.pointerType){case"mouse":a=me.Mouse;break;case"touch":a=me.Touch;break;case"pen":a=me.Pen}a===me.Touch?pe[e]===pe.MouseDown?l="TouchStart":pe[e]===pe.MouseUp&&(l="TouchEnd"):me.Pen}else re(n)&&(a=me.Touch);null!==a?(c=a,(l.startsWith("Touch")&&a===me.Touch||l.startsWith("Mouse")&&a===me.Mouse)&&(a=null)):pe[e]===pe.Click&&(a=c,c=null);const d=re(n)?n.changedTouches[0]:n;if(!d)return;const u=r.getId(i),{clientX:h,clientY:p}=d;Ae(t)({type:pe[l],id:u,x:h,y:p,...null!==a&&{pointerType:a}})})(e);if(window.PointerEvent)switch(pe[e]){case pe.MouseDown:case pe.MouseUp:i=i.replace("mouse","pointer");break;case pe.TouchStart:case pe.TouchEnd:return}l.push(X(i,a,n))})),Ae((()=>{l.forEach((e=>e()))}))}function Re(e){let{scrollCb:t,doc:n,mirror:r,blockClass:o,blockSelector:s,sampling:i}=e;return X("scroll",Ae(P(Ae((e=>{const i=Te(e);if(!i||ee(i,o,s,!0))return;const a=r.getId(i);if(i===n&&n.defaultView){const e=j(n.defaultView);t({id:a,x:e.left,y:e.top})}else t({id:a,x:i.scrollLeft,y:i.scrollTop})})),i.scroll||100)),n)}const Le=["INPUT","TEXTAREA","SELECT"],xe=new WeakMap;function De(e){return function(e,t){if(We("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||We("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||We("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||We("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 Fe(e,t,n){let r,o;return e?(e.ownerNode?r=t.getId(e.ownerNode):o=n.getId(e),{styleId:o,id:r}):{}}function Ge(e,t){let{mirror:n,stylesheetManager:r}=e;var o,s,i;let a=null;a="#document"===t.nodeName?n.getId(t):n.getId(t.host);const l="#document"===t.nodeName?null==(o=t.defaultView)?void 0:o.Document:null==(i=null==(s=t.ownerDocument)?void 0:s.defaultView)?void 0:i.ShadowRoot,c=(null==l?void 0:l.prototype)?Object.getOwnPropertyDescriptor(null==l?void 0:l.prototype,"adoptedStyleSheets"):void 0;return null!==a&&-1!==a&&l&&c?(Object.defineProperty(t,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var e;return null==(e=c.get)?void 0:e.call(this)},set(e){var t;const n=null==(t=c.set)?void 0:t.call(this,e);if(null!==a&&-1!==a)try{r.adoptStyleSheets(e,a)}catch(e){}return n}}),Ae((()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))):()=>{}}function Be(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=e.doc.defaultView;if(!n)return()=>{};let r;!function(e,t){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:i,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:d,canvasMutationCb:u,fontCb:h,selectionCb:p,customElementCb:m}=e;e.mutationCb=function(){t.mutation&&t.mutation(...arguments),n(...arguments)},e.mousemoveCb=function(){t.mousemove&&t.mousemove(...arguments),r(...arguments)},e.mouseInteractionCb=function(){t.mouseInteraction&&t.mouseInteraction(...arguments),o(...arguments)},e.scrollCb=function(){t.scroll&&t.scroll(...arguments),s(...arguments)},e.viewportResizeCb=function(){t.viewportResize&&t.viewportResize(...arguments),i(...arguments)},e.inputCb=function(){t.input&&t.input(...arguments),a(...arguments)},e.mediaInteractionCb=function(){t.mediaInteaction&&t.mediaInteaction(...arguments),l(...arguments)},e.styleSheetRuleCb=function(){t.styleSheetRule&&t.styleSheetRule(...arguments),c(...arguments)},e.styleDeclarationCb=function(){t.styleDeclaration&&t.styleDeclaration(...arguments),d(...arguments)},e.canvasMutationCb=function(){t.canvasMutation&&t.canvasMutation(...arguments),u(...arguments)},e.fontCb=function(){t.font&&t.font(...arguments),h(...arguments)},e.selectionCb=function(){t.selection&&t.selection(...arguments),p(...arguments)},e.customElementCb=function(){t.customElement&&t.customElement(...arguments),m(...arguments)}}(e,t),e.recordDOM&&(r=Ee(e,e.doc));const o=function(e){let{mousemoveCb:t,sampling:n,doc:r,mirror:o}=e;if(!1===n.mousemove)return()=>{};const s="number"==typeof n.mousemove?n.mousemove:50,i="number"==typeof n.mousemoveCallback?n.mousemoveCallback:500;let a,l=[];const c=P(Ae((e=>{const n=Date.now()-a;t(l.map((e=>(e.timeOffset-=n,e))),e),l=[],a=null})),i),d=Ae(P(Ae((e=>{const t=Te(e),{clientX:n,clientY:r}=re(e)?e.changedTouches[0]:e;a||(a=K()),l.push({x:n,y:r,id:o.getId(t),timeOffset:K()-a}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?he.Drag:e instanceof MouseEvent?he.MouseMove:he.TouchMove)})),s,{trailing:!1})),u=[X("mousemove",d,r),X("touchmove",d,r),X("drag",d,r)];return Ae((()=>{u.forEach((e=>e()))}))}(e),s=Oe(e),i=Re(e),a=function(e,t){let{viewportResizeCb:n}=e,{win:r}=t,o=-1,s=-1;return X("resize",Ae(P(Ae((()=>{const e=Q(),t=q();o===e&&s===t||(n({width:Number(t),height:Number(e)}),o=e,s=t)})),200)),r)}(e,{win:n}),l=function(e){let{inputCb:t,doc:n,mirror:r,blockClass:o,blockSelector:s,ignoreClass:i,ignoreSelector:a,maskInputOptions:l,maskInputFn:c,sampling:d,userTriggeredOnInput:u}=e;function h(e){let t=Te(e);const r=e.isTrusted,d=t&&t.tagName;if(t&&"OPTION"===d&&(t=t.parentElement),!t||!d||Le.indexOf(d)<0||ee(t,o,s,!0))return;if(t.classList.contains(i)||a&&t.matches(a))return;let h=t.value,g=!1;const f=y(t)||"";"radio"===f||"checkbox"===f?g=t.checked:(l[d.toLowerCase()]||l[f])&&(h=m({element:t,maskInputOptions:l,tagName:d,type:f,value:h,maskInputFn:c})),p(t,u?{text:h,isChecked:g,userTriggered:r}:{text:h,isChecked:g});const I=t.name;"radio"===f&&I&&g&&n.querySelectorAll(`input[type="radio"][name="${I}"]`).forEach((e=>{if(e!==t){const t=e.value;p(e,u?{text:t,isChecked:!g,userTriggered:!1}:{text:t,isChecked:!g})}}))}function p(e,n){const o=xe.get(e);if(!o||o.text!==n.text||o.isChecked!==n.isChecked){xe.set(e,n);const o=r.getId(e);Ae(t)({...n,id:o})}}const g=("last"===d.input?["change"]:["input","change"]).map((e=>X(e,Ae(h),n))),f=n.defaultView;if(!f)return()=>{g.forEach((e=>e()))};const I=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),C=[[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 I&&I.set&&g.push(...C.map((e=>J(e[0],e[1],{set(){Ae(h)({target:this,isTrusted:!1})}},!1,f)))),Ae((()=>{g.forEach((e=>e()))}))}(e),c=function(e){let{mediaInteractionCb:t,blockClass:n,blockSelector:r,mirror:o,sampling:s,doc:i}=e;const a=Ae((e=>P(Ae((s=>{const i=Te(s);if(!i||ee(i,n,r,!0))return;const{currentTime:a,volume:l,muted:c,playbackRate:d,loop:u}=i;t({type:e,id:o.getId(i),currentTime:a,volume:l,muted:c,playbackRate:d,loop:u})})),s.media||500))),l=[X("play",a(fe.Play),i),X("pause",a(fe.Pause),i),X("seeked",a(fe.Seeked),i),X("volumechange",a(fe.VolumeChange),i),X("ratechange",a(fe.RateChange),i)];return Ae((()=>{l.forEach((e=>e()))}))}(e);let d=()=>{},u=()=>{},h=()=>{},p=()=>{};e.recordDOM&&(d=function(e,t){let{styleSheetRuleCb:n,mirror:r,stylesheetManager:o}=e,{win:s}=t;if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};const i=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:Ae(((e,t,s)=>{const[i,a]=s,{id:l,styleId:c}=Fe(t,r,o.styleMirror);return(l&&-1!==l||c&&-1!==c)&&n({id:l,styleId:c,adds:[{rule:i,index:a}]}),e.apply(t,s)}))});const a=s.CSSStyleSheet.prototype.deleteRule;let l,c;s.CSSStyleSheet.prototype.deleteRule=new Proxy(a,{apply:Ae(((e,t,s)=>{const[i]=s,{id:a,styleId:l}=Fe(t,r,o.styleMirror);return(a&&-1!==a||l&&-1!==l)&&n({id:a,styleId:l,removes:[{index:i}]}),e.apply(t,s)}))}),s.CSSStyleSheet.prototype.replace&&(l=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(l,{apply:Ae(((e,t,s)=>{const[i]=s,{id:a,styleId:l}=Fe(t,r,o.styleMirror);return(a&&-1!==a||l&&-1!==l)&&n({id:a,styleId:l,replace:i}),e.apply(t,s)}))})),s.CSSStyleSheet.prototype.replaceSync&&(c=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(c,{apply:Ae(((e,t,s)=>{const[i]=s,{id:a,styleId:l}=Fe(t,r,o.styleMirror);return(a&&-1!==a||l&&-1!==l)&&n({id:a,styleId:l,replaceSync:i}),e.apply(t,s)}))}));const d={};Ze("CSSGroupingRule")?d.CSSGroupingRule=s.CSSGroupingRule:(Ze("CSSMediaRule")&&(d.CSSMediaRule=s.CSSMediaRule),Ze("CSSConditionRule")&&(d.CSSConditionRule=s.CSSConditionRule),Ze("CSSSupportsRule")&&(d.CSSSupportsRule=s.CSSSupportsRule));const u={};return Object.entries(d).forEach((e=>{let[t,s]=e;u[t]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(u[t].insertRule,{apply:Ae(((e,t,s)=>{const[i,a]=s,{id:l,styleId:c}=Fe(t.parentStyleSheet,r,o.styleMirror);return(l&&-1!==l||c&&-1!==c)&&n({id:l,styleId:c,adds:[{rule:i,index:[...De(t),a||0]}]}),e.apply(t,s)}))}),s.prototype.deleteRule=new Proxy(u[t].deleteRule,{apply:Ae(((e,t,s)=>{const[i]=s,{id:a,styleId:l}=Fe(t.parentStyleSheet,r,o.styleMirror);return(a&&-1!==a||l&&-1!==l)&&n({id:a,styleId:l,removes:[{index:[...De(t),i]}]}),e.apply(t,s)}))})})),Ae((()=>{s.CSSStyleSheet.prototype.insertRule=i,s.CSSStyleSheet.prototype.deleteRule=a,l&&(s.CSSStyleSheet.prototype.replace=l),c&&(s.CSSStyleSheet.prototype.replaceSync=c),Object.entries(d).forEach((e=>{let[t,n]=e;n.prototype.insertRule=u[t].insertRule,n.prototype.deleteRule=u[t].deleteRule}))}))}(e,{win:n}),u=Ge(e,e.doc),h=function(e,t){let{styleDeclarationCb:n,mirror:r,ignoreCSSAttributes:o,stylesheetManager:s}=e,{win:i}=t;const a=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:Ae(((e,t,i)=>{var l;const[c,d,u]=i;if(o.has(c))return a.apply(t,[c,d,u]);const{id:h,styleId:p}=Fe(null==(l=t.parentRule)?void 0:l.parentStyleSheet,r,s.styleMirror);return(h&&-1!==h||p&&-1!==p)&&n({id:h,styleId:p,set:{property:c,value:d,priority:u},index:De(t.parentRule)}),e.apply(t,i)}))});const l=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(l,{apply:Ae(((e,t,i)=>{var a;const[c]=i;if(o.has(c))return l.apply(t,[c]);const{id:d,styleId:u}=Fe(null==(a=t.parentRule)?void 0:a.parentStyleSheet,r,s.styleMirror);return(d&&-1!==d||u&&-1!==u)&&n({id:d,styleId:u,remove:{property:c},index:De(t.parentRule)}),e.apply(t,i)}))}),Ae((()=>{i.CSSStyleDeclaration.prototype.setProperty=a,i.CSSStyleDeclaration.prototype.removeProperty=l}))}(e,{win:n}),e.collectFonts&&(p=function(e){let{fontCb:t,doc:n}=e;const r=n.defaultView;if(!r)return()=>{};const o=[],s=new WeakMap,i=r.FontFace;r.FontFace=function(e,t,n){const r=new i(e,t,n);return s.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};const a=U(n.fonts,"add",(function(e){return function(n){return setTimeout(Ae((()=>{const e=s.get(n);e&&(t(e),s.delete(n))})),0),e.apply(this,[n])}}));return o.push((()=>{r.FontFace=i})),o.push(a),Ae((()=>{o.forEach((e=>e()))}))}(e)));const g=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:o,selectionCb:s}=e;let i=!0;const a=Ae((()=>{const e=t.getSelection();if(!e||i&&(null==e?void 0:e.isCollapsed))return;i=e.isCollapsed||!1;const a=[],l=e.rangeCount||0;for(let t=0;t{}}(e),I=[];for(const t of e.plugins)I.push(t.observer(t.callback,n,t.options));return Ae((()=>{Ne.forEach((e=>e.reset())),null==r||r.disconnect(),o(),s(),i(),a(),l(),c(),d(),u(),h(),p(),g(),f(),I.forEach((e=>e()))}))}function We(e){return void 0!==window[e]}function Ze(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class Ye{constructor(e){r(this,"iframeIdToRemoteIdMap",new WeakMap),r(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,n,r){const o=n||this.getIdToRemoteIdMap(e),s=r||this.getRemoteIdToIdMap(e);let i=o.get(t);return i||(i=this.generateIdFn(),o.set(t,i),s.set(i,t)),i}getIds(e,t){const n=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,r)))}getRemoteId(e,t,n){const r=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const o=r.get(t);return o||-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 Ve{constructor(e){r(this,"iframes",new WeakMap),r(this,"crossOriginIframeMap",new WeakMap),r(this,"crossOriginIframeMirror",new Ye(v)),r(this,"crossOriginIframeStyleMirror"),r(this,"crossOriginIframeRootIdMap",new WeakMap),r(this,"mirror"),r(this,"mutationCb"),r(this,"wrappedEmit"),r(this,"loadListener"),r(this,"stylesheetManager"),r(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Ye(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,r;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&(null==(n=e.contentWindow)||n.addEventListener("message",this.handleMessage.bind(this))),null==(r=this.loadListener)||r.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 r=this.transformCrossOriginEvent(n,t.data.event);r&&this.wrappedEmit(r,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case ue.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:ue.IncrementalSnapshot,data:{source:he.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case ue.Meta:case ue.Load:case ue.DomContentLoaded:return!1;case ue.Plugin:return t;case ue.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case ue.IncrementalSnapshot:switch(t.data.source){case he.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 he.Drag:case he.TouchMove:case he.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case he.ViewportResize:return!1;case he.MediaInteraction:case he.MouseInteraction:case he.Scroll:case he.CanvasMutation:case he.Input:return this.replaceIds(t.data,e,["id"]),t;case he.StyleSheetRule:case he.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case he.Font:return t;case he.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case he.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null==(n=t.data.styles)||n.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}return!1}replace(e,t,n,r){for(const o of r)(Array.isArray(t[o])||"number"==typeof t[o])&&(Array.isArray(t[o])?t[o]=e.getIds(n,t[o]):t[o]=e.getId(n,t[o]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}patchRootIdOnNode(e,t){e.type===i.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}}class He{constructor(e){r(this,"shadowDoms",new WeakSet),r(this,"mutationCb"),r(this,"scrollCb"),r(this,"bypassOptions"),r(this,"mirror"),r(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(!c(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=Ee({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push((()=>n.disconnect())),this.restoreHandlers.push(Re({...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(Ge({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(U(e.prototype,"attachShadow",(function(e){return function(r){const o=e.call(this,r);return this.shadowRoot&&de(this)&&n.addShadowRoot(this.shadowRoot,t),o}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var Xe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_e="undefined"==typeof Uint8Array?[]:new Uint8Array(256),ze=0;ze<64;ze++)_e[Xe.charCodeAt(ze)]=ze;const Pe=new Map;const Je=(e,t,n)=>{if(!e||!je(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=Pe.get(e);return n||(n=new Map,Pe.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let o=r.indexOf(e);return-1===o&&(o=r.length,r.push(e)),o};function Ue(e,t,n){if(e instanceof Array)return e.map((e=>Ue(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),r=n.length,o="";for(t=0;t>2],o+=Xe[(3&n[t])<<4|n[t+1]>>4],o+=Xe[(15&n[t+1])<<2|n[t+2]>>6],o+=Xe[63&n[t+2]];return r%3==2?o=o.substring(0,o.length-1)+"=":r%3==1&&(o=o.substring(0,o.length-2)+"=="),o}(e)}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[Ue(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:[Ue(e.data,t,n),e.width,e.height]}}if(je(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:Je(e,t,n)}}return e}const Ke=(e,t,n)=>e.map((e=>Ue(e,t,n))),je=(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 Qe(e,t,n,r){const o=[];try{const s=U(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(o){for(var s=arguments.length,i=new Array(s>1?s-1:0),a=1;a{o.forEach((e=>e()))}}function qe(e,t,n,r,o,s){const i=[],a=Object.getOwnPropertyNames(e);for(const l of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if("function"!=typeof e[l])continue;const a=U(e,l,(function(e){return function(){for(var i=arguments.length,a=new Array(i),c=0;ce.charCodeAt(0))))],{type:"text/javascript;charset=utf-8"});var tt;function nt(e){let t;try{if(t=et&&(window.URL||window.webkitURL).createObjectURL(et),!t)throw"";const n=new Worker(t,{name:null==e?void 0:e.name});return n.addEventListener("error",(()=>{(window.URL||window.webkitURL).revokeObjectURL(t)})),n}catch(t){return new Worker("data:text/javascript;base64,"+$e,{name:null==e?void 0:e.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}class rt{constructor(e){r(this,"pendingCanvasMutations",new Map),r(this,"rafStamps",{latestId:0,invokeId:null}),r(this,"mirror"),r(this,"mutationCb"),r(this,"resetObservers"),r(this,"frozen",!1),r(this,"locked",!1),r(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:o,blockSelector:s,recordCanvas:i,dataURLOptions:a}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,i&&"all"===t&&this.initCanvasMutationObserver(n,o,s),i&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,o,s,{dataURLOptions:a})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,n,r,o){const s=Qe(t,n,r,!0),i=new Map,a=new nt;a.onmessage=e=>{const{id:t}=e.data;if(i.set(t,!1),!("base64"in e.data))return;const{base64:n,type:r,width:o,height:s}=e.data;this.mutationCb({id:t,type:ge["2D"],commands:[{property:"clearRect",args:[0,0,o,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:r}]},0,0]}]})};const l=1e3/e;let c,d=0;const u=e=>{d&&e-d{const e=[],o=t=>{t.querySelectorAll("canvas").forEach((t=>{ee(t,n,r,!0)||e.push(t)})),t.querySelectorAll("*").forEach((e=>{e.shadowRoot&&o(e.shadowRoot)}))};return o(t.document),e})().forEach((async e=>{var t;const n=this.mirror.getId(e);if(i.get(n))return;if(0===e.width||0===e.height)return;if(i.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.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const r=e.clientWidth||e.width,s=e.clientHeight||e.height,l=await createImageBitmap(e,{resizeWidth:r,resizeHeight:s});a.postMessage({id:n,bitmap:l,width:r,height:s,dataURLOptions:o.dataURLOptions},[l])}))),c=requestAnimationFrame(u)};c=requestAnimationFrame(u),this.resetObservers=()=>{s(),cancelAnimationFrame(c)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=Qe(e,t,n,!1),o=function(e,t,n,r){const o=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const i of s)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[i])continue;const s=U(t.CanvasRenderingContext2D.prototype,i,(function(o){return function(){for(var s=arguments.length,a=new Array(s),l=0;l{const n=Ke(a,t,this);e(this.canvas,{type:ge["2D"],property:i,args:n})}),0),o.apply(this,a)}}));o.push(s)}catch{const n=J(t.CanvasRenderingContext2D.prototype,i,{set(t){e(this.canvas,{type:ge["2D"],property:i,args:[t],setter:!0})}});o.push(n)}return()=>{o.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),s=function(e,t,n,r){const o=[];return o.push(...qe(t.WebGLRenderingContext.prototype,ge.WebGL,e,n,r,t)),void 0!==t.WebGL2RenderingContext&&o.push(...qe(t.WebGL2RenderingContext.prototype,ge.WebGL2,e,n,r,t)),()=>{o.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n);this.resetObservers=()=>{r(),o(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}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 r=n.map((e=>{const{type:t,...n}=e;return n})),{type:o}=n[0];this.mutationCb({id:t,type:o,commands:r}),this.pendingCanvasMutations.delete(e)}}class ot{constructor(e){r(this,"trackedLinkElements",new WeakSet),r(this,"mutationCb"),r(this,"adoptedStyleSheetCb"),r(this,"styleMirror",new ae),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:[]},r=[];for(const t of e){let e;this.styleMirror.has(t)?e=this.styleMirror.getId(t):(e=this.styleMirror.add(t),r.push({styleId:e,rules:Array.from(t.rules||CSSRule,((e,t)=>({rule:u(e),index:t})))})),n.styleIds.push(e)}r.length>0&&(n.styles=r),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class st{constructor(){r(this,"nodeMap",new WeakMap),r(this,"active",!1)}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some((e=>e!==t))}add(e,t){this.active||(this.active=!0,requestAnimationFrame((()=>{this.nodeMap=new WeakMap,this.active=!1}))),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}}let it,at,lt,ct=!1;try{if(2!==Array.from([1],(e=>2*e))[0]){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null==(t=e.contentWindow)?void 0:t.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}const dt=new p;function ut(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:i="rr-ignore",ignoreSelector:a=null,maskTextClass:l="rr-mask",maskTextSelector:c=null,inlineStylesheet:d=!0,maskAllInputs:u,maskInputOptions:h,slimDOMOptions:m,maskInputFn:g,maskTextFn:f,hooks:y,packFn:I,sampling:C={},dataURLOptions:b={},mousemoveWait:S,recordDOM:v=!0,recordCanvas:w=!1,recordCrossOriginIframes:M=!1,recordAfter:k=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:A=!1,collectFonts:N=!1,inlineImages:T=!1,plugins:E,keepIframeSrcFn:O=(()=>!1),ignoreCSSAttributes:R=new Set([]),errorHandler:L}=e;ke=L;const x=!M||window.parent===window;let D=!1;if(!x)try{window.parent.document&&(D=!1)}catch(e){D=!0}if(x&&!t)throw new Error("emit function is required");if(!x&&!D)return()=>{};void 0!==S&&void 0===C.mousemove&&(C.mousemove=S),dt.reset();const F=!0===u?{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!==h?h:{password:!0},G=!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,headTitleMutations:"all"===m}:m||{};let B;!function(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=function(){for(var t=arguments.length,n=new Array(t),r=0;r{for(const t of E||[])t.eventProcessor&&(e=t.eventProcessor(e));return I&&!D&&(e=I(e)),e};it=(e,o)=>{var s;const i=e;if(i.timestamp=K(),!(null==(s=Ne[0])?void 0:s.isFrozen())||i.type===ue.FullSnapshot||i.type===ue.IncrementalSnapshot&&i.data.source===he.Mutation||Ne.forEach((e=>e.unfreeze())),x)null==t||t(Z(i),o);else if(D){const e={type:"rrweb",event:Z(i),origin:window.location.origin,isCheckout:o};window.parent.postMessage(e,"*")}if(i.type===ue.FullSnapshot)B=i,W=0;else if(i.type===ue.IncrementalSnapshot){if(i.data.source===he.Mutation&&i.data.isAttachIframe)return;W++;const e=r&&W>=r,t=n&&i.timestamp-B.timestamp>n;(e||t)&&at(!0)}};const Y=e=>{it({type:ue.IncrementalSnapshot,data:{source:he.Mutation,...e}})},V=e=>it({type:ue.IncrementalSnapshot,data:{source:he.Scroll,...e}}),_=e=>it({type:ue.IncrementalSnapshot,data:{source:he.CanvasMutation,...e}}),z=new ot({mutationCb:Y,adoptedStyleSheetCb:e=>it({type:ue.IncrementalSnapshot,data:{source:he.AdoptedStyleSheet,...e}})}),P=new Ve({mirror:dt,mutationCb:Y,stylesheetManager:z,recordCrossOriginIframes:M,wrappedEmit:it});for(const e of E||[])e.getMirror&&e.getMirror({nodeMirror:dt,crossOriginIframeMirror:P.crossOriginIframeMirror,crossOriginIframeStyleMirror:P.crossOriginIframeStyleMirror});const J=new st;lt=new rt({recordCanvas:w,mutationCb:_,win:window,blockClass:o,blockSelector:s,mirror:dt,sampling:C.canvas,dataURLOptions:b});const U=new He({mutationCb:Y,scrollCb:V,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:l,maskTextSelector:c,inlineStylesheet:d,maskInputOptions:F,dataURLOptions:b,maskTextFn:f,maskInputFn:g,recordCanvas:w,inlineImages:T,sampling:C,slimDOMOptions:G,iframeManager:P,stylesheetManager:z,canvasManager:lt,keepIframeSrcFn:O,processedNodeManager:J},mirror:dt});at=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!v)return;it({type:ue.Meta,data:{href:window.location.href,width:q(),height:Q()}},e),z.reset(),U.init(),Ne.forEach((e=>e.lock()));const t=function(e,t){const{mirror:n=new p,blockClass:r="rr-block",blockSelector:o=null,maskTextClass:s="rr-mask",maskTextSelector:i=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:c=!1,maskAllInputs:d=!1,maskTextFn:u,maskInputFn:h,slimDOM:m=!1,dataURLOptions:g,preserveWhiteSpace:f,onSerialize:y,onIframeLoad:I,iframeLoadTimeout:C,onStylesheetLoad:b,stylesheetLoadTimeout:S,keepIframeSrcFn:v=(()=>!1)}=t||{};return H(e,{doc:e,mirror:n,blockClass:r,blockSelector:o,maskTextClass:s,maskTextSelector:i,skipChild:!1,inlineStylesheet:a,maskInputOptions:!0===d?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===d?{password:!0}:d,maskTextFn:u,maskInputFn:h,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:l,recordCanvas:c,preserveWhiteSpace:f,onSerialize:y,onIframeLoad:I,iframeLoadTimeout:C,onStylesheetLoad:b,stylesheetLoadTimeout:S,keepIframeSrcFn:v,newlyAddedElement:!1})}(document,{mirror:dt,blockClass:o,blockSelector:s,maskTextClass:l,maskTextSelector:c,inlineStylesheet:d,maskAllInputs:F,maskTextFn:f,maskInputFn:g,slimDOM:G,dataURLOptions:b,recordCanvas:w,inlineImages:T,onSerialize:e=>{oe(e,dt)&&P.addIframe(e),se(e,dt)&&z.trackLinkElement(e),ie(e)&&U.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{P.attachIframe(e,t),U.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{z.attachLinkElement(e,t)},keepIframeSrcFn:O});if(!t)return console.warn("Failed to snapshot the document");it({type:ue.FullSnapshot,data:{node:t,initialOffset:j(window)}},e),Ne.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&z.adoptStyleSheets(document.adoptedStyleSheets,dt.getId(document))};try{const e=[],t=e=>{var t;return Ae(Be)({mutationCb:Y,mousemoveCb:(e,t)=>it({type:ue.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>it({type:ue.IncrementalSnapshot,data:{source:he.MouseInteraction,...e}}),scrollCb:V,viewportResizeCb:e=>it({type:ue.IncrementalSnapshot,data:{source:he.ViewportResize,...e}}),inputCb:e=>it({type:ue.IncrementalSnapshot,data:{source:he.Input,...e}}),mediaInteractionCb:e=>it({type:ue.IncrementalSnapshot,data:{source:he.MediaInteraction,...e}}),styleSheetRuleCb:e=>it({type:ue.IncrementalSnapshot,data:{source:he.StyleSheetRule,...e}}),styleDeclarationCb:e=>it({type:ue.IncrementalSnapshot,data:{source:he.StyleDeclaration,...e}}),canvasMutationCb:_,fontCb:e=>it({type:ue.IncrementalSnapshot,data:{source:he.Font,...e}}),selectionCb:e=>{it({type:ue.IncrementalSnapshot,data:{source:he.Selection,...e}})},customElementCb:e=>{it({type:ue.IncrementalSnapshot,data:{source:he.CustomElement,...e}})},blockClass:o,ignoreClass:i,ignoreSelector:a,maskTextClass:l,maskTextSelector:c,maskInputOptions:F,inlineStylesheet:d,sampling:C,recordDOM:v,recordCanvas:w,inlineImages:T,userTriggeredOnInput:A,collectFonts:N,doc:e,maskInputFn:g,maskTextFn:f,keepIframeSrcFn:O,blockSelector:s,slimDOMOptions:G,dataURLOptions:b,mirror:dt,iframeManager:P,stylesheetManager:z,shadowDomManager:U,processedNodeManager:J,canvasManager:lt,ignoreCSSAttributes:R,plugins:(null==(t=null==E?void 0:E.filter((e=>e.observer)))?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>it({type:ue.Plugin,data:{plugin:e.name,payload:t}})}))))||[]},y)};P.addLoadListener((n=>{try{e.push(t(n.contentDocument))}catch(e){console.warn(e)}}));const n=()=>{at(),e.push(t(document)),ct=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():(e.push(X("DOMContentLoaded",(()=>{it({type:ue.DomContentLoaded,data:{}}),"DOMContentLoaded"===k&&n()}))),e.push(X("load",(()=>{it({type:ue.Load,data:{}}),"load"===k&&n()}),window))),()=>{e.forEach((e=>e())),J.destroy(),ct=!1,ke=void 0}}catch(e){console.warn(e)}}var ht,pt;ut.addCustomEvent=(e,t)=>{if(!ct)throw new Error("please add custom event after start recording");it({type:ue.Custom,data:{tag:e,payload:t}})},ut.freezePage=()=>{Ne.forEach((e=>e.freeze()))},ut.takeFullSnapshot=e=>{if(!ct)throw new Error("please take full snapshot after start recording");at(e)},ut.mirror=dt,(pt=ht||(ht={}))[pt.NotStarted=0]="NotStarted",pt[pt.Running=1]="Running",pt[pt.Stopped=2]="Stopped";const mt="2.0.0-alpha.16";var gt,ft=Object.defineProperty,yt=(e,t,n)=>(((e,t,n)=>{t in e?ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),It=Object.defineProperty,Ct=(e,t,n)=>(((e,t,n)=>{t in e?It(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),bt=Object.defineProperty,St=(e,t,n)=>(((e,t,n)=>{t in e?bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);class vt{constructor(){St(this,"idNodeMap",new Map),St(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;const n=null==(t=this.getMeta(e))?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 wt(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&wt(e.parentNode,t,n);for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}return!!n&&wt(e.parentNode,t,n)}const Mt="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 kt={map:{},getId:()=>(console.error(Mt),-1),getNode:()=>(console.error(Mt),null),removeNodeFromMap(){console.error(Mt)},has:()=>(console.error(Mt),!1),reset(){console.error(Mt)}};"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(kt=new Proxy(kt,{get:(e,t,n)=>("map"===t&&console.error(Mt),Reflect.get(e,t,n))}));let At=Date.now;function Nt(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}/[1-9][0-9]{12}/.test(Date.now().toString())||(At=()=>(new Date).getTime());function Tt(e){var t,n;let r=null;return(null==(n=null==(t=e.getRootNode)?void 0:t.call(e))?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(r=e.getRootNode().host),r}function Et(e){let t,n=e;for(;t=Tt(n);)n=t;return n}function Ot(e){const t=e.ownerDocument;if(!t)return!1;const n=Et(e);return t.contains(n)}const Rt=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:class{constructor(){Ct(this,"id",1),Ct(this,"styleIDMap",new WeakMap),Ct(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++}},get _mirror(){return kt},closestElementOfNode:Nt,getBaseDimension:function e(t,n){var r,o;const s=null==(o=null==(r=t.ownerDocument)?void 0:r.defaultView)?void 0:o.frameElement;if(!s||s===n)return{x:0,y:0,relativeScale:1,absoluteScale:1};const i=s.getBoundingClientRect(),a=e(s,n),l=i.height/s.clientHeight;return{x:i.x*a.relativeScale+a.x,y:i.y*a.relativeScale+a.y,relativeScale:l,absoluteScale:a.absoluteScale*l}},getNestedRule:function e(t,n){const r=t[n[0]];return 1===n.length?r:e(r.cssRules[n[1]].cssRules,n.slice(2))},getPositionsAndIndex:function(e){const t=[...e],n=t.pop();return{positions:t,index:n}},getRootShadowHost:Et,getShadowHost:Tt,getWindowHeight:function(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight},getWindowScroll:function(e){var t,n,r,o,s,i;const a=e.document;return{left:a.scrollingElement?a.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==a?void 0:a.documentElement.scrollLeft)||(null==(n=null==(t=null==a?void 0:a.body)?void 0:t.parentElement)?void 0:n.scrollLeft)||(null==(r=null==a?void 0:a.body)?void 0:r.scrollLeft)||0,top:a.scrollingElement?a.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==a?void 0:a.documentElement.scrollTop)||(null==(s=null==(o=null==a?void 0:a.body)?void 0:o.parentElement)?void 0:s.scrollTop)||(null==(i=null==a?void 0:a.body)?void 0:i.scrollTop)||0}},getWindowWidth:function(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth},hasShadowRoot:function(e){return Boolean(null==e?void 0:e.shadowRoot)},hookSetter:function e(t,n,r,o){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:window;const i=s.Object.getOwnPropertyDescriptor(t,n);return s.Object.defineProperty(t,n,o?r:{set(e){setTimeout((()=>{r.set.call(this,e)}),0),i&&i.set&&i.set.call(this,e)}}),()=>e(t,n,i||{},!0)},inDom:function(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||Ot(e))},isAncestorRemoved:function e(t,n){if(function(e){const t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}(t))return!1;const r=n.getId(t);return!n.has(r)||(!t.parentNode||t.parentNode.nodeType!==t.DOCUMENT_NODE)&&(!t.parentNode||e(t.parentNode,n))},isBlocked:function(e,t,n,r){if(!e)return!1;const o=Nt(e);if(!o)return!1;try{if("string"==typeof t){if(o.classList.contains(t))return!0;if(r&&null!==o.closest("."+t))return!0}else if(wt(o,t,r))return!0}catch(e){}if(n){if(o.matches(n))return!0;if(r&&null!==o.closest(n))return!0}return!1},isIgnored:function(e,t,n){return!("TITLE"!==e.tagName||!n.headTitleMutations)||-2===t.getId(e)},isSerialized:function(e,t){return-1!==t.getId(e)},isSerializedIframe:function(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))},isSerializedStylesheet:function(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))},iterateResolveTree:function e(t,n){n(t.value);for(let r=t.children.length-1;r>=0;r--)e(t.children[r],n)},legacy_isTouchEvent:function(e){return Boolean(e.changedTouches)},get nowTimestamp(){return At},on:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document;const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)},patch:function(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],o=n(r);return"function"==typeof o&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=o,()=>{e[t]=r}}catch{return()=>{}}},polyfill:function(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=function(){for(var t=arguments.length,n=new Array(t),r=0;r{const r={value:e,parent:n,children:[]};return t[e.node.id]=r,r},r=[];for(const o of e){const{nextId:e,parentId:s}=o;if(e&&e in t){const s=t[e];if(s.parent){const e=s.parent.children.indexOf(s);s.parent.children.splice(e,0,n(o,s.parent))}else{const e=r.indexOf(s);r.splice(e,0,n(o,null))}}else if(s in t){const e=t[s];e.children.push(n(o,e))}else r.push(n(o,null))}return r},shadowHostInDom:Ot,throttle:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=null,o=0;return function(){for(var s=arguments.length,i=new Array(s),a=0;at?(r&&(clearTimeout(r),r=null),o=l,e.apply(d,i)):r||!1===n.trailing||(r=setTimeout((()=>{o=!1===n.leading?0:Date.now(),r=null,e.apply(d,i)}),c))}},uniqueTextMutations:function(e){const t=new Set,n=[];for(let r=e.length;r--;){const o=e[r];t.has(o.id)||(n.push(o),t.add(o.id))}return n}},Symbol.toStringTag,{value:"Module"}));for(var Lt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xt="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Dt=0;Dt<64;Dt++)xt[Lt.charCodeAt(Dt)]=Dt;"undefined"!=typeof window&&window.Blob&&new Blob([(e=>Uint8Array.from(atob(e),(e=>e.charCodeAt(0))))("KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpCiAgICAgICAgcmV0dXJuIHRyYW5zcGFyZW50QmxvYk1hcC5nZXQoaWQpOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIHRyYW5zcGFyZW50QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICAgIHJldHVybiBiYXNlNjQ7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gIiI7CiAgICB9CiAgfQogIGNvbnN0IHdvcmtlciA9IHNlbGY7CiAgd29ya2VyLm9ubWVzc2FnZSA9IGFzeW5jIGZ1bmN0aW9uKGUpIHsKICAgIGlmICgiT2Zmc2NyZWVuQ2FudmFzIiBpbiBnbG9iYWxUaGlzKSB7CiAgICAgIGNvbnN0IHsgaWQsIGJpdG1hcCwgd2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMgfSA9IGUuZGF0YTsKICAgICAgY29uc3QgdHJhbnNwYXJlbnRCYXNlNjQgPSBnZXRUcmFuc3BhcmVudEJsb2JGb3IoCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0LAogICAgICAgIGRhdGFVUkxPcHRpb25zCiAgICAgICk7CiAgICAgIGNvbnN0IG9mZnNjcmVlbiA9IG5ldyBPZmZzY3JlZW5DYW52YXMod2lkdGgsIGhlaWdodCk7CiAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCIyZCIpOwogICAgICBjdHguZHJhd0ltYWdlKGJpdG1hcCwgMCwgMCk7CiAgICAgIGJpdG1hcC5jbG9zZSgpOwogICAgICBjb25zdCBibG9iID0gYXdhaXQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOwogICAgICBjb25zdCB0eXBlID0gYmxvYi50eXBlOwogICAgICBjb25zdCBhcnJheUJ1ZmZlciA9IGF3YWl0IGJsb2IuYXJyYXlCdWZmZXIoKTsKICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsKICAgICAgaWYgKCFsYXN0QmxvYk1hcC5oYXMoaWQpICYmIGF3YWl0IHRyYW5zcGFyZW50QmFzZTY0ID09PSBiYXNlNjQpIHsKICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOwogICAgICB9CiAgICAgIGlmIChsYXN0QmxvYk1hcC5nZXQoaWQpID09PSBiYXNlNjQpCiAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOwogICAgICB3b3JrZXIucG9zdE1lc3NhZ2UoewogICAgICAgIGlkLAogICAgICAgIHR5cGUsCiAgICAgICAgYmFzZTY0LAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodAogICAgICB9KTsKICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkOiBlLmRhdGEuaWQgfSk7CiAgICB9CiAgfTsKfSkoKTsKLy8jIHNvdXJjZU1hcHBpbmdVUkw9aW1hZ2UtYml0bWFwLWRhdGEtdXJsLXdvcmtlci1CWjFyN1JKRC5qcy5tYXAK")],{type:"text/javascript;charset=utf-8"});try{if(2!==Array.from([1],(e=>2*e))[0]){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null==(gt=e.contentWindow)?void 0:gt.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var Ft;new vt,function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(Ft||(Ft={}));class Gt{constructor(e){yt(this,"fileName"),yt(this,"functionName"),yt(this,"lineNumber"),yt(this,"columnNumber"),this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){const e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${e}:${t})`:`${this.fileName}:${e}:${t}`}}const Bt=/(^|@)\S+:\d+/,Wt=/^\s*at .*(\S+:\d+|\(native\))/m,Zt=/^(eval@)?(\[native code])?$/,Yt={parse:function(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(Wt)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):(console.warn("[console-record-plugin]: Failed to parse error object:",e),[]):[]},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];const t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error(`Cannot parse given url: ${e}`);return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(Wt)}),this).map((function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const n=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=n?t.replace(n[0],""):t;const r=t.split(/\s+/).slice(1),o=this.extractLocation(n?n[1]:r.pop()),s=r.join(" ")||void 0,i=["eval",""].indexOf(o[0])>-1?void 0:o[0];return new Gt({functionName:s,fileName:i,lineNumber:o[1],columnNumber:o[2]})}),this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter((function(e){return!e.match(Zt)}),this).map((function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new Gt({functionName:e});{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,o=this.extractLocation(e.replace(t,""));return new Gt({functionName:r,fileName:o[0],lineNumber:o[1],columnNumber:o[2]})}}),this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){const t=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split("\n"),r=[];for(let e=2,o=n.length;e/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Gt({functionName:r,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}),this)}};function Vt(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let n=e.localName;if(!n)break;n=n.toLowerCase();const r=e.parentElement,o=[];if(r.children&&r.children.length>0)for(let e=0;e1&&(n+=`:eq(${o.indexOf(e)})`),t=n+(t?">"+t:""),e=r}return t}function Ht(e){return"[object Object]"===Object.prototype.toString.call(e)}function Xt(e,t){if(0===t)return!0;const n=Object.keys(e);for(const r of n)if(Ht(e[r])&&Xt(e[r],t-1))return!0;return!1}function _t(e,t){const n={numOfKeysLimit:50,depthOfLimit:4};Object.assign(n,t);const r=[],o=[];return JSON.stringify(e,(function(e,t){if(r.length>0){const n=r.indexOf(this);~n?r.splice(n+1):r.push(this),~n?o.splice(n,1/0,e):o.push(e),~r.indexOf(t)&&(t=r[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,r.indexOf(t)).join(".")+"]")}else r.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(function(e){if(Ht(e)&&Object.keys(e).length>n.numOfKeysLimit)return!0;if("function"==typeof e)return!0;if(Ht(e)&&Xt(e,n.depthOfLimit))return!0;return!1}(t))return function(e){let t=e.toString();n.stringLengthLimit&&t.length>n.stringLengthLimit&&(t=`${t.slice(0,n.stringLengthLimit)}...`);return t}(t);if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){const e={};for(const n in t){const r=t[n];Array.isArray(r)?e[n]=Vt(r.length?r[0]:null):e[n]=r}return e}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t}))}const zt={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function Pt(e,t,n){const r=n?Object.assign({},zt,n):zt,o=r.logger;if(!o)return()=>{};let s;s="string"==typeof o?t[o]:o;let i=0,a=!1;const l=[];if(r.level.includes("error")){const n=t=>{const n=t.message,o=t.error,s=Yt.parse(o).map((e=>e.toString())),i=[_t(n,r.stringifyOptions)];e({level:"error",trace:s,payload:i})};t.addEventListener("error",n),l.push((()=>{t.removeEventListener("error",n)}));const o=t=>{let n,o;t.reason instanceof Error?(n=t.reason,o=[_t(`Uncaught (in promise) ${n.name}: ${n.message}`,r.stringifyOptions)]):(n=new Error,o=[_t("Uncaught (in promise)",r.stringifyOptions),_t(t.reason,r.stringifyOptions)]);const s=Yt.parse(n).map((e=>e.toString()));e({level:"error",trace:s,payload:o})};t.addEventListener("unhandledrejection",o),l.push((()=>{t.removeEventListener("unhandledrejection",o)}))}for(const e of r.level)l.push(c(s,e));return()=>{l.forEach((e=>e()))};function c(t,n){var o=this;return t[n]?Rt.patch(t,n,(t=>function(){for(var s=arguments.length,l=new Array(s),c=0;ce.toString())).splice(1),o=l.map((e=>_t(e,r.stringifyOptions)));i++,i{}}}const Jt=e=>({name:"rrweb/console@1",observer:Pt,options:e}),Ut=Array.isArray,Kt=Object.prototype,jt=Kt.hasOwnProperty,Qt=Kt.toString,qt=Ut||function(e){return"[object Array]"===Qt.call(e)},$t=function(e){return"function"==typeof e},en=function(e){return e===Object(e)&&!qt(e)},tn=function(e){return void 0===e},nn=function(e){return"[object String]"==Qt.call(e)},rn=function(e){return null===e},on=function(e){return tn(e)||rn(e)},sn=function(e){return"[object Boolean]"===Qt.call(e)},an=e=>e instanceof Document,ln=e=>e instanceof FormData,cn="undefined"!=typeof window?window:void 0,dn="undefined"!=typeof globalThis?globalThis:cn,un=Array.prototype.forEach,hn=null==dn?void 0:dn.navigator;null==dn||dn.document,null==dn||dn.location,null==dn||dn.fetch,null!=dn&&dn.XMLHttpRequest&&"withCredentials"in new dn.XMLHttpRequest&&dn.XMLHttpRequest,null==dn||dn.AbortController,null==hn||hn.userAgent;const pn=null!=cn?cn:{},mn="[PostHog.js]",gn={_log:function(e){if(cn&&pn.POSTHOG_DEBUG&&!tn(cn.console)&&cn.console){const o="__rrweb_original__"in cn.console[e]?cn.console[e].__rrweb_original__:cn.console[e];for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{gn.error(`You must initialize PostHog before calling ${e}`)}},fn={};function yn(e,t,n){if(!on(e)){if(qt(e))return function(e,t,n){if(qt(e))if(un&&e.forEach===un)e.forEach(t,n);else if("length"in e&&e.length===+e.length)for(let r=0,o=e.length;r1&&void 0!==arguments[1]?arguments[1]:"&";const o=[];return yn(e,(function(e,r){tn(e)||tn(r)||"undefined"===r||(t=encodeURIComponent(e instanceof File?e.name:e.toString()),n=encodeURIComponent(r),o[o.length]=n+"="+t)})),o.join(r)},Cn={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io"]};function bn(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],o=n(r);return $t(o)&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=o,()=>{e[t]=r}}catch{return()=>{}}}function Sn(e,t){var n;const r=function(e){try{return"string"==typeof e?new URL(e).hostname:"url"in e?new URL(e.url).hostname:e.hostname}catch{return null}}(e),o={hostname:r,isHostDenied:!1};if(null===(n=t.payloadHostDenyList)||void 0===n||!n.length||null==r||!r.trim().length)return o;for(const e of t.payloadHostDenyList)if(r.endsWith(e))return{hostname:r,isHostDenied:!0};return o}const vn=e=>"navigation"===e.entryType,wn=e=>"resource"===e.entryType;function Mn(e,t){for(let n=e.length-1;n>=0;n-=1)if(t(e[n]))return e[n]}function kn(e,t,n){if(n.recordInitialRequests){const r=t.performance.getEntries().filter((e=>vn(e)||wn(e)&&n.initiatorTypes.includes(e.initiatorType)));e({requests:r.flatMap((e=>Rn({entry:e,method:void 0,status:void 0,networkRequest:{},isInitial:!0}))),isInitial:!0})}const r=new t.PerformanceObserver((t=>{const r=t.getEntries().filter((e=>vn(e)||wn(e)&&n.initiatorTypes.includes(e.initiatorType)&&(e=>!n.recordBody&&!n.recordHeaders||"xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType)(e)));e({requests:r.flatMap((e=>Rn({entry:e,method:void 0,status:void 0,networkRequest:{}})))})})),o=PerformanceObserver.supportedEntryTypes.filter((e=>n.performanceEntryTypeToObserve.includes(e)));return r.observe({entryTypes:o}),()=>{r.disconnect()}}function An(e,t){return!!t&&(sn(t)||t[e])}function Nn(e){let{type:t,recordBody:n,headers:r}=e;function o(e){const t=Object.keys(r).find((e=>"content-type"===e.toLowerCase())),n=t&&r[t];return e.some((e=>null==n?void 0:n.includes(e)))}if(!n)return!1;if(sn(n))return!0;if(qt(n))return o(n);const s=n[t];return sn(s)?s:o(s)}async function Tn(e,t,n,r,o){let s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(s>10)return gn.warn("Failed to get performance entry for request",{url:n,initiatorType:t}),null;const i=Mn(e.performance.getEntriesByName(n),(e=>wn(e)&&e.initiatorType===t&&(tn(r)||e.startTime>=r)&&(tn(o)||e.startTime<=o)));return i||(await new Promise((e=>setTimeout(e,50*s))),Tn(e,t,n,r,o,s+1))}function En(e){let{body:t,options:n,url:r}=e;if(on(t))return null;const{hostname:o,isHostDenied:s}=Sn(r,n);if(s)return o+" is in deny list";if(nn(t))return t;if(an(t))return t.textContent;if(ln(t))return In(t);if(en(t))try{return JSON.stringify(t)}catch{return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(t)}const On=e=>!rn(e)&&("navigation"===e.entryType||"resource"===e.entryType);function Rn(e){let{entry:t,method:n,status:r,networkRequest:o,isInitial:s,start:i,end:a,url:l,initiatorType:c}=e;i=t?t.startTime:i,a=t?t.responseEnd:a;const d=Math.floor(Date.now()-performance.now()),u=Math.floor(d+(i||0)),h=[{...t?t.toJSON():{name:l},startTime:tn(i)?void 0:Math.round(i),endTime:tn(a)?void 0:Math.round(a),timeOrigin:d,timestamp:u,method:n,initiatorType:t?t.initiatorType:c,status:r,requestHeaders:o.requestHeaders,requestBody:o.requestBody,responseHeaders:o.responseHeaders,responseBody:o.responseBody,isInitial:s}];if(On(t))for(const e of t.serverTiming||[])h.push({timeOrigin:d,timestamp:u,startTime:Math.round(t.startTime),name:e.name,duration:e.duration,entryType:"serverTiming"});return h}const Ln=["video/","audio/"];function xn(e){return new Promise(((t,n)=>{const r=setTimeout((()=>t("[SessionReplay] Timeout while trying to read body")),500);try{e.clone().text().then((e=>t(e)),(e=>n(e))).finally((()=>clearTimeout(r)))}catch{clearTimeout(r),t("[SessionReplay] Failed to read body")}}))}async function Dn(e){let{r:t,options:n,url:r}=e;const o=function(e){var t;let{r:n,options:r,url:o}=e;if("chunked"===n.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";const s=null===(t=n.headers.get("Content-Type"))||void 0===t?void 0:t.toLowerCase(),i=Ln.some((e=>null==s?void 0:s.startsWith(e)));if(s&&i)return`Content-Type ${s} is not supported`;const{hostname:a,isHostDenied:l}=Sn(o,r);return l?a+" is in deny list":null}({r:t,options:n,url:r});return rn(o)?xn(t):Promise.resolve(o)}function Fn(e,t,n){if(!n.initiatorTypes.includes("fetch"))return()=>{};const r=An("request",n.recordHeaders),o=An("response",n.recordHeaders),s=bn(t,"fetch",(s=>async function(i,a){const l=new Request(i,a);let c;const d={};let u,h;try{const e={};l.headers.forEach(((t,n)=>{e[n]=t})),r&&(d.requestHeaders=e),Nn({type:"request",headers:e,url:i,recordBody:n.recordBody})&&(d.requestBody=await async function(e){let{r:t,options:n,url:r}=e;const{hostname:o,isHostDenied:s}=Sn(r,n);return s?Promise.resolve(o+" is in deny list"):xn(t)}({r:l,options:n,url:i})),u=t.performance.now(),c=await s(l),h=t.performance.now();const a={};return c.headers.forEach(((e,t)=>{a[t]=e})),o&&(d.responseHeaders=a),Nn({type:"response",headers:a,url:i,recordBody:n.recordBody})&&(d.responseBody=await Dn({r:c,options:n,url:i})),c}finally{Tn(t,"fetch",l.url,u,h).then((t=>{var n;const r=Rn({entry:t,method:l.method,status:null===(n=c)||void 0===n?void 0:n.status,networkRequest:d,start:u,end:h,url:l.url,initiatorType:"fetch"});e({requests:r})})).catch((()=>{}))}}));return()=>{s()}}let Gn=null;function Bn(e,t,n){if(!("performance"in t))return()=>{};if(Gn)return gn.warn("Network observer already initialised, doing nothing"),()=>{};const r=n?Object.assign({},Cn,n):Cn,o=t=>{const n=[];t.requests.forEach((e=>{const t=r.maskRequestFn(e);t&&n.push(t)})),n.length>0&&e({...t,requests:n})},s=kn(o,t,r);let i=()=>{},a=()=>{};return(r.recordHeaders||r.recordBody)&&(i=function(e,t,n){if(!n.initiatorTypes.includes("xmlhttprequest"))return()=>{};const r=An("request",n.recordHeaders),o=An("response",n.recordHeaders),s=bn(t.XMLHttpRequest.prototype,"open",(s=>function(i,a){let l=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],c=arguments.length>3?arguments[3]:void 0,d=arguments.length>4?arguments[4]:void 0;const u=this,h=new Request(a),p={};let m,g;const f={},y=u.setRequestHeader.bind(u);u.setRequestHeader=(e,t)=>(f[e]=t,y(e,t)),r&&(p.requestHeaders=f);const I=u.send.bind(u);u.send=e=>(Nn({type:"request",headers:f,url:a,recordBody:n.recordBody})&&(p.requestBody=En({body:e,options:n,url:a})),m=t.performance.now(),I(e)),u.addEventListener("readystatechange",(()=>{if(u.readyState!==u.DONE)return;g=t.performance.now();const r={};u.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((e=>{const t=e.split(": "),n=t.shift(),o=t.join(": ");n&&(r[n]=o)})),o&&(p.responseHeaders=r),Nn({type:"response",headers:r,url:a,recordBody:n.recordBody})&&(p.responseBody=En({body:u.response,options:n,url:a})),Tn(t,"xmlhttprequest",h.url,m,g).then((t=>{const n=Rn({entry:t,method:h.method,status:null==u?void 0:u.status,networkRequest:p,start:m,end:g,url:a.toString(),initiatorType:"xmlhttprequest"});e({requests:n})})).catch((()=>{}))})),s.call(u,i,a,l,c,d)}));return()=>{s()}}(o,t,r),a=Fn(o,t,r)),Gn=()=>{s(),i(),a()},Gn}const Wn="rrweb/network@1",Zn=e=>({name:Wn,observer:Bn,options:e});pn.__PosthogExtensions__=pn.__PosthogExtensions__||{},pn.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:Jt,getRecordNetworkPlugin:Zn},pn.__PosthogExtensions__.rrweb={record:ut,version:"v2",rrwebVersion:mt},pn.rrweb={record:ut,version:"v2",rrwebVersion:mt},pn.rrwebConsoleRecord={getRecordConsolePlugin:Jt},pn.getRecordNetworkPlugin=Zn,e.NETWORK_PLUGIN_NAME=Wn,e.default=ut,e.findLast=Mn,e.getRecordNetworkPlugin=Zn,Object.defineProperty(e,"__esModule",{value:!0})}({}); //# sourceMappingURL=recorder.js.map