UNPKG

testchimp-js

Version:

TestChimp SDK for JS

2 lines 107 kB
/*! For license information please see testchimp-sdk.cjs.js.LICENSE.txt */ !function(){"use strict";var e,t={d:function(e,r){for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};function n(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function s(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function o(e){try{var t=e.rules||e.cssRules;return t?((r=Array.from(t).map(i).join("")).includes(" background-clip: text;")&&!r.includes(" -webkit-background-clip: text;")&&(r=r.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),r):null}catch(e){return null}var r}function i(e){var t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=o(e.styleSheet)||t}catch(e){}return t}t.r(r),t.d(r,{TestChimpSDK:function(){return pr}}),function(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||(e={}));var a=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var r=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=r?r:-1},e.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},e.prototype.removeNodeFromMap=function(e){var t=this,r=this.getId(e);this.idNodeMap.delete(r),e.childNodes&&e.childNodes.forEach((function(e){return t.removeNodeFromMap(e)}))},e.prototype.has=function(e){return this.idNodeMap.has(e)},e.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},e.prototype.add=function(e,t){var r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){var r=this.getNode(e);if(r){var n=this.nodeMetaMap.get(r);n&&this.nodeMetaMap.set(t,n)}this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function c(e){var t=e.maskInputOptions,r=e.tagName,n=e.type,s=e.value,o=e.maskInputFn,i=s||"";return(t[r.toLowerCase()]||t[n])&&(i=o?o(i):"*".repeat(i.length)),i}var l,d,u="__rrweb_original__",h=1,p=new RegExp("[^a-z0-9-_:]"),g=-2;function m(){return h++}var f=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,y=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,I=/^(data:)([^,]*),(.*)/i;function C(e,t){return(e||"").replace(f,(function(e,r,n,s,o,i){var a,c=n||o||i,l=r||s||"";if(!c)return e;if(!y.test(c))return"url(".concat(l).concat(c).concat(l,")");if(I.test(c))return"url(".concat(l).concat(c).concat(l,")");if("/"===c[0])return"url(".concat(l).concat((a=t,(a.indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+c)).concat(l,")");var d=t.split("/"),u=c.split("/");d.pop();for(var h=0,p=u;h<p.length;h++){var g=p[h];"."!==g&&(".."===g?d.pop():d.push(g))}return"url(".concat(l).concat(d.join("/")).concat(l,")")}))}var v=/^[^ \t\n\r\u000c]+/,b=/^[, \t\n\r\u000c]+/;function S(e,t){if(!t||""===t.trim())return t;var r=e.createElement("a");return r.href=t,r.href}function A(){var e=document.createElement("a");return e.href="",e.href}function w(e,t,r,n){return"src"===r||"href"===r&&n&&("use"!==t||"#"!==n[0])||"xlink:href"===r&&n&&"#"!==n[0]?S(e,n):"background"!==r||!n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===r&&n?function(e,t){if(""===t.trim())return t;var r=0;function n(e){var n,s=e.exec(t.substring(r));return s?(n=s[0],r+=n.length,n):""}for(var s=[];n(b),!(r>=t.length);){var o=n(v);if(","===o.slice(-1))o=S(e,o.substring(0,o.length-1)),s.push(o);else{var i="";o=S(e,o);for(var a=!1;;){var c=t.charAt(r);if(""===c){s.push((o+i).trim());break}if(a)")"===c&&(a=!1);else{if(","===c){r+=1,s.push((o+i).trim());break}"("===c&&(a=!0)}i+=c,r+=1}}}return s.join(", ")}(e,n):"style"===r&&n?C(n,A()):"object"===t&&"data"===r&&n?S(e,n):n:S(e,n)}function k(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&k(e.parentNode,t,r);for(var n=e.classList.length;n--;){var s=e.classList[n];if(t.test(s))return!0}return!!r&&k(e.parentNode,t,r)}function T(e,t,r){var n=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===n)return!1;if("string"==typeof t){if(n.classList.contains(t))return!0;if(n.closest(".".concat(t)))return!0}else if(k(n,t,!0))return!0;if(r){if(n.matches(r))return!0;if(n.closest(r))return!0}return!1}function M(e){return void 0===e?"":e.toLowerCase()}function x(t,r){var i,a=r.doc,h=r.mirror,f=r.blockClass,y=r.blockSelector,I=r.maskTextClass,v=r.maskTextSelector,b=r.skipChild,S=void 0!==b&&b,k=r.inlineStylesheet,R=void 0===k||k,E=r.maskInputOptions,N=void 0===E?{}:E,L=r.maskTextFn,O=r.maskInputFn,D=r.slimDOMOptions,F=r.dataURLOptions,q=void 0===F?{}:F,B=r.inlineImages,W=void 0!==B&&B,G=r.recordCanvas,U=void 0!==G&&G,P=r.onSerialize,V=r.onIframeLoad,Z=r.iframeLoadTimeout,_=void 0===Z?5e3:Z,K=r.onStylesheetLoad,j=r.stylesheetLoadTimeout,H=void 0===j?5e3:j,J=r.keepIframeSrcFn,Y=void 0===J?function(){return!1}:J,z=r.newlyAddedElement,X=void 0!==z&&z,Q=r.preserveWhiteSpace,$=void 0===Q||Q,ee=function(t,r){var n=r.doc,s=r.mirror,i=r.blockClass,a=r.blockSelector,h=r.maskTextClass,g=r.maskTextSelector,m=r.inlineStylesheet,f=r.maskInputOptions,y=void 0===f?{}:f,I=r.maskTextFn,v=r.maskInputFn,b=r.dataURLOptions,S=void 0===b?{}:b,k=r.inlineImages,M=r.recordCanvas,x=r.keepIframeSrcFn,R=r.newlyAddedElement,E=void 0!==R&&R,N=function(e,t){if(t.hasNode(e)){var r=t.getId(e);return 1===r?void 0:r}}(n,s);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:e.Document,childNodes:[],compatMode:t.compatMode}:{type:e.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:e.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:N};case t.ELEMENT_NODE:return function(t,r){for(var n=r.doc,s=r.inlineStylesheet,i=r.maskInputOptions,a=void 0===i?{}:i,h=r.maskInputFn,g=r.dataURLOptions,m=void 0===g?{}:g,f=r.inlineImages,y=r.recordCanvas,I=r.keepIframeSrcFn,v=r.newlyAddedElement,b=void 0!==v&&v,S=r.rootId,k=function(e,t,r){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var n=e.classList.length;n--;){var s=e.classList[n];if(t.test(s))return!0}return!!r&&e.matches(r)}(t,r.blockClass,r.blockSelector),T=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return p.test(t)?"div":t}(t),M={},x=t.attributes.length,R=0;R<x;R++){var E=t.attributes[R];M[E.name]=w(n,T,E.name,E.value)}if("link"===T&&s){var N=Array.from(n.styleSheets).find((function(e){return e.href===t.href})),L=null;N&&(L=o(N)),L&&(delete M.rel,delete M.href,M._cssText=C(L,N.href))}if("style"===T&&t.sheet&&!(t.innerText||t.textContent||"").trim().length&&(L=o(t.sheet))&&(M._cssText=C(L,A())),"input"===T||"textarea"===T||"select"===T){var O=t.value,D=t.checked;"radio"!==M.type&&"checkbox"!==M.type&&"submit"!==M.type&&"button"!==M.type&&O?M.value=c({type:M.type,tagName:T,value:O,maskInputOptions:a,maskInputFn:h}):D&&(M.checked=D)}if("option"===T&&(t.selected&&!a.select?M.selected=!0:delete M.selected),"canvas"===T&&y)if("2d"===t.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var r=0;r<e.width;r+=50)for(var n=0;n<e.height;n+=50){var s=t.getImageData,o=u in s?s[u]:s;if(new Uint32Array(o.call(t,r,n,Math.min(50,e.width-r),Math.min(50,e.height-n)).data.buffer).some((function(e){return 0!==e})))return!1}return!0})(t)||(M.rr_dataURL=t.toDataURL(m.type,m.quality));else if(!("__context"in t)){var F=t.toDataURL(m.type,m.quality),q=document.createElement("canvas");q.width=t.width,q.height=t.height,F!==q.toDataURL(m.type,m.quality)&&(M.rr_dataURL=F)}if("img"===T&&f){l||(l=n.createElement("canvas"),d=l.getContext("2d"));var B=t,W=B.crossOrigin;B.crossOrigin="anonymous";var G=function(){try{l.width=B.naturalWidth,l.height=B.naturalHeight,d.drawImage(B,0,0),M.rr_dataURL=l.toDataURL(m.type,m.quality)}catch(e){console.warn("Cannot inline img src=".concat(B.currentSrc,"! Error: ").concat(e))}W?M.crossOrigin=W:B.removeAttribute("crossorigin")};B.complete&&0!==B.naturalWidth?G():B.onload=G}if("audio"!==T&&"video"!==T||(M.rr_mediaState=t.paused?"paused":"played",M.rr_mediaCurrentTime=t.currentTime),b||(t.scrollLeft&&(M.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(M.rr_scrollTop=t.scrollTop)),k){var U=t.getBoundingClientRect(),P=U.width,V=U.height;M={class:M.class,rr_width:"".concat(P,"px"),rr_height:"".concat(V,"px")}}return"iframe"!==T||I(M.src)||(t.contentDocument||(M.rr_src=M.src),delete M.src),{type:e.Element,tagName:T,attributes:M,childNodes:[],isSVG:(Z=t,Boolean("svg"===Z.tagName||Z.ownerSVGElement)||void 0),needBlock:k,rootId:S};var Z}(t,{doc:n,blockClass:i,blockSelector:a,inlineStylesheet:m,maskInputOptions:y,maskInputFn:v,dataURLOptions:S,inlineImages:k,recordCanvas:M,keepIframeSrcFn:x,newlyAddedElement:E,rootId:N});case t.TEXT_NODE:return function(t,r){var n,s,o=r.maskTextClass,i=r.maskTextSelector,a=r.maskTextFn,c=r.rootId,l=t.parentNode&&t.parentNode.tagName,d=t.textContent,u="STYLE"===l||void 0,h="SCRIPT"===l||void 0;if(u&&d){try{t.nextSibling||t.previousSibling||(null===(n=t.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(d=(s=t.parentNode.sheet).cssRules?Array.from(s.cssRules).map((function(e){return e.cssText||""})).join(""):"")}catch(e){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(e),t)}d=C(d,A())}return h&&(d="SCRIPT_PLACEHOLDER"),!u&&!h&&d&&T(t,o,i)&&(d=a?a(d):d.replace(/[\S]/g,"*")),{type:e.Text,textContent:d||"",isStyle:u,rootId:c}}(t,{maskTextClass:h,maskTextSelector:g,maskTextFn:I,rootId:N});case t.CDATA_SECTION_NODE:return{type:e.CDATA,textContent:"",rootId:N};case t.COMMENT_NODE:return{type:e.Comment,textContent:t.textContent||"",rootId:N};default:return!1}}(t,{doc:a,mirror:h,blockClass:f,blockSelector:y,maskTextClass:I,maskTextSelector:v,inlineStylesheet:R,maskInputOptions:N,maskTextFn:L,maskInputFn:O,dataURLOptions:q,inlineImages:W,recordCanvas:U,keepIframeSrcFn:Y,newlyAddedElement:X});if(!ee)return console.warn(t,"not serialized"),null;i=h.hasNode(t)?h.getId(t):!function(t,r){if(r.comment&&t.type===e.Comment)return!0;if(t.type===e.Element){if(r.script&&("script"===t.tagName||"link"===t.tagName&&"preload"===t.attributes.rel&&"script"===t.attributes.as||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&t.attributes.href.endsWith(".js")))return!0;if(r.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(M(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===M(t.attributes.name)||"icon"===M(t.attributes.rel)||"apple-touch-icon"===M(t.attributes.rel)||"shortcut icon"===M(t.attributes.rel))))return!0;if("meta"===t.tagName){if(r.headMetaDescKeywords&&M(t.attributes.name).match(/^description|keywords$/))return!0;if(r.headMetaSocial&&(M(t.attributes.property).match(/^(og|twitter|fb):/)||M(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===M(t.attributes.name)))return!0;if(r.headMetaRobots&&("robots"===M(t.attributes.name)||"googlebot"===M(t.attributes.name)||"bingbot"===M(t.attributes.name)))return!0;if(r.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(r.headMetaAuthorship&&("author"===M(t.attributes.name)||"generator"===M(t.attributes.name)||"framework"===M(t.attributes.name)||"publisher"===M(t.attributes.name)||"progid"===M(t.attributes.name)||M(t.attributes.property).match(/^article:/)||M(t.attributes.property).match(/^product:/)))return!0;if(r.headMetaVerification&&("google-site-verification"===M(t.attributes.name)||"yandex-verification"===M(t.attributes.name)||"csrf-token"===M(t.attributes.name)||"p:domain_verify"===M(t.attributes.name)||"verify-v1"===M(t.attributes.name)||"verification"===M(t.attributes.name)||"shopify-checkout-api-token"===M(t.attributes.name)))return!0}}return!1}(ee,D)&&($||ee.type!==e.Text||ee.isStyle||ee.textContent.replace(/^\s+|\s+$/gm,"").length)?m():g;var te=Object.assign(ee,{id:i});if(h.add(t,te),i===g)return null;P&&P(t);var re=!S;if(te.type===e.Element){re=re&&!te.needBlock,delete te.needBlock;var ne=t.shadowRoot;ne&&s(ne)&&(te.isShadowHost=!0)}if((te.type===e.Document||te.type===e.Element)&&re){D.headWhitespace&&te.type===e.Element&&"head"===te.tagName&&($=!1);for(var se={doc:a,mirror:h,blockClass:f,blockSelector:y,maskTextClass:I,maskTextSelector:v,skipChild:S,inlineStylesheet:R,maskInputOptions:N,maskTextFn:L,maskInputFn:O,slimDOMOptions:D,dataURLOptions:q,inlineImages:W,recordCanvas:U,preserveWhiteSpace:$,onSerialize:P,onIframeLoad:V,iframeLoadTimeout:_,onStylesheetLoad:K,stylesheetLoadTimeout:H,keepIframeSrcFn:Y},oe=0,ie=Array.from(t.childNodes);oe<ie.length;oe++)(le=x(ie[oe],se))&&te.childNodes.push(le);if(function(e){return e.nodeType===e.ELEMENT_NODE}(t)&&t.shadowRoot)for(var ae=0,ce=Array.from(t.shadowRoot.childNodes);ae<ce.length;ae++){var le;(le=x(ce[ae],se))&&(s(t.shadowRoot)&&(le.isShadow=!0),te.childNodes.push(le))}}return t.parentNode&&n(t.parentNode)&&s(t.parentNode)&&(te.isShadow=!0),te.type===e.Element&&"iframe"===te.tagName&&function(e,t,r){var n=e.contentWindow;if(n){var s,o=!1;try{s=n.document.readyState}catch(e){return}if("complete"===s){var i="about:blank";if(n.location.href!==i||e.src===i||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}else{var a=setTimeout((function(){o||(t(),o=!0)}),r);e.addEventListener("load",(function(){clearTimeout(a),o=!0,t()}))}}}(t,(function(){var e=t.contentDocument;if(e&&V){var r=x(e,{doc:e,mirror:h,blockClass:f,blockSelector:y,maskTextClass:I,maskTextSelector:v,skipChild:!1,inlineStylesheet:R,maskInputOptions:N,maskTextFn:L,maskInputFn:O,slimDOMOptions:D,dataURLOptions:q,inlineImages:W,recordCanvas:U,preserveWhiteSpace:$,onSerialize:P,onIframeLoad:V,iframeLoadTimeout:_,onStylesheetLoad:K,stylesheetLoadTimeout:H,keepIframeSrcFn:Y});r&&V(t,r)}}),_),te.type===e.Element&&"link"===te.tagName&&"stylesheet"===te.attributes.rel&&function(e,t,r){var n,s=!1;try{n=e.sheet}catch(e){return}if(!n){var o=setTimeout((function(){s||(t(),s=!0)}),r);e.addEventListener("load",(function(){clearTimeout(o),s=!0,t()}))}}(t,(function(){if(K){var e=x(t,{doc:a,mirror:h,blockClass:f,blockSelector:y,maskTextClass:I,maskTextSelector:v,skipChild:!1,inlineStylesheet:R,maskInputOptions:N,maskTextFn:L,maskInputFn:O,slimDOMOptions:D,dataURLOptions:q,inlineImages:W,recordCanvas:U,preserveWhiteSpace:$,onSerialize:P,onIframeLoad:V,iframeLoadTimeout:_,onStylesheetLoad:K,stylesheetLoadTimeout:H,keepIframeSrcFn:Y});e&&K(t,e)}}),H),te}function R(e,t,r=document){const n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}new RegExp(/([^\\]):hover/.source,"g");const E="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 N={map:{},getId(){return console.error(E),-1},getNode(){return console.error(E),null},removeNodeFromMap(){console.error(E)},has(){return console.error(E),!1},reset(){console.error(E)}};function L(e,t,r={}){let n=null,s=0;return function(...o){const i=Date.now();s||!1!==r.leading||(s=i);const a=t-(i-s),c=this;a<=0||a>t?(n&&(clearTimeout(n),n=null),s=i,e.apply(c,o)):n||!1===r.trailing||(n=setTimeout((()=>{s=!1===r.leading?0:Date.now(),n=null,e.apply(c,o)}),a))}}function O(e,t,r,n,s=window){const o=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,n?r:{set(e){setTimeout((()=>{r.set.call(this,e)}),0),o&&o.set&&o.set.call(this,e)}}),()=>O(e,t,o||{},!0)}function D(e,t,r){try{if(!(t in e))return()=>{};const n=e[t],s=r(n);return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=s,()=>{e[t]=n}}catch(e){return()=>{}}}function F(){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 B(e,t,r,n){if(!e)return!1;const s=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(!s)return!1;if("string"==typeof t){if(s.classList.contains(t))return!0;if(n&&null!==s.closest("."+t))return!0}else if(k(s,t,n))return!0;if(r){if(e.matches(r))return!0;if(n&&null!==s.closest(r))return!0}return!1}function W(e,t){return t.getId(e)===g}function G(e,t){if(n(e))return!1;const r=t.getId(e);return!t.has(r)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||G(e.parentNode,t))}function U(e){return Boolean(e.changedTouches)}function P(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function V(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Z(e){return Boolean(null==e?void 0:e.shadowRoot)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(N=new Proxy(N,{get(e,t,r){return"map"===t&&console.error(E),Reflect.get(e,t,r)}}));class _{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return r=void 0===t?this.id++:t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}var K=(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))(K||{}),j=(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))(j||{}),H=(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))(H||{}),J=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(J||{});function Y(e){return"__ln"in e}class z{constructor(){this.length=0,this.head=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&Y(e.previousSibling)){const r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&Y(e.nextSibling)&&e.nextSibling.__ln.previous){const r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next&&(t.next.previous=t.previous)):(this.head=t.next,this.head&&(this.head.previous=null)),e.__ln&&delete e.__ln,this.length--)}}const X=(e,t)=>`${e}@${t}`;class Q{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new z,r=e=>{let t=e,r=g;for(;r===g;)t=t&&t.nextSibling,r=t&&this.mirror.getId(t);return r},s=s=>{var o,i,a,c;let l=null;(null===(i=null===(o=s.getRootNode)||void 0===o?void 0:o.call(s))||void 0===i?void 0:i.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&s.getRootNode().host&&(l=s.getRootNode().host);let d=l;for(;(null===(c=null===(a=null==d?void 0:d.getRootNode)||void 0===a?void 0:a.call(d))||void 0===c?void 0:c.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&d.getRootNode().host;)d=d.getRootNode().host;const u=!(this.doc.contains(s)||d&&this.doc.contains(d));if(!s.parentNode||u)return;const h=n(s.parentNode)?this.mirror.getId(l):this.mirror.getId(s.parentNode),p=r(s);if(-1===h||-1===p)return t.addNode(s);const g=x(s,{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=>{P(e,this.mirror)&&this.iframeManager.addIframe(e),V(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Z(s)&&this.shadowDomManager.addShadowRoot(s.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});g&&e.push({parentId:h,nextId:p,node:g})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of Array.from(this.movedSet.values()))ee(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||s(e);for(const e of Array.from(this.addedSet.values()))re(this.droppedSet,e)||ee(this.removes,e,this.mirror)?re(this.movedSet,e)?s(e):this.droppedSet.add(e):s(e);let o=null;for(;t.length;){let e=null;if(o){const t=this.mirror.getId(o.value.parentNode),n=r(o.value);-1!==t&&-1!==n&&(e=o)}if(!e)for(let n=t.length-1;n>=0;n--){const s=t.get(n);if(s){const t=this.mirror.getId(s.value.parentNode);if(-1===r(s.value))continue;if(-1!==t){e=s;break}{const t=s.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const r=t.parentNode.host;if(-1!==this.mirror.getId(r)){e=s;break}}}}}if(!e){for(;t.head;)t.removeNode(t.head.value);break}o=e.previous,t.removeNode(e.value),s(e.value)}const i={texts:this.texts.map((e=>({id:this.mirror.getId(e.node),value:e.value}))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>({id:this.mirror.getId(e.node),attributes:e.attributes}))).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.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(i))},this.processMutation=e=>{if(!W(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;B(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:T(e.target,this.maskTextClass,this.maskTextSelector)&&t?this.maskTextFn?this.maskTextFn(t):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let r=e.target.getAttribute(e.attributeName);if("value"===e.attributeName&&(r=c({maskInputOptions:this.maskInputOptions,tagName:e.target.tagName,type:e.target.getAttribute("type"),value:r,maskInputFn:this.maskInputFn})),B(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let n=this.attributes.find((t=>t.node===e.target));if("IFRAME"===t.tagName&&"src"===e.attributeName&&!this.keepIframeSrcFn(r)){if(t.contentDocument)return;e.attributeName="rr_src"}if(n||(n={node:e.target,attributes:{}},this.attributes.push(n)),"style"===e.attributeName){const r=this.doc.createElement("span");e.oldValue&&r.setAttribute("style",e.oldValue),void 0!==n.attributes.style&&null!==n.attributes.style||(n.attributes.style={});const s=n.attributes.style;for(const e of Array.from(t.style)){const n=t.style.getPropertyValue(e),o=t.style.getPropertyPriority(e);n===r.style.getPropertyValue(e)&&o===r.style.getPropertyPriority(e)||(s[e]=""===o?n:[n,o])}for(const e of Array.from(r.style))""===t.style.getPropertyValue(e)&&(s[e]=!1)}else n.attributes[e.attributeName]=w(this.doc,t.tagName,e.attributeName,r);break}case"childList":if(B(e.target,this.blockClass,this.blockSelector,!0))return;e.addedNodes.forEach((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{const r=this.mirror.getId(t),o=n(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);B(e.target,this.blockClass,this.blockSelector,!1)||W(t,this.mirror)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?($(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===r||G(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[X(r,o)]?$(this.movedSet,t):this.removes.push({parentId:o,id:r,isShadow:!(!n(e.target)||!s(e.target))||void 0})),this.mapRemoves.push(t))}))}},this.genAdds=(e,t)=>{if(this.mirror.hasNode(e)){if(W(e,this.mirror))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&-1!==r&&(this.movedMap[X(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);B(e,this.blockClass,this.blockSelector,!1)||e.childNodes.forEach((e=>this.genAdds(e)))}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].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 $(e,t){e.delete(t),t.childNodes.forEach((t=>$(e,t)))}function ee(e,t,r){return 0!==e.length&&te(e,t,r)}function te(e,t,r){const{parentNode:n}=t;if(!n)return!1;const s=r.getId(n);return!!e.some((e=>e.id===s))||te(e,n,r)}function re(e,t){return 0!==e.size&&ne(e,t)}function ne(e,t){const{parentNode:r}=t;return!!r&&(!!e.has(r)||ne(e,r))}const se=[],oe="undefined"!=typeof CSSGroupingRule,ie="undefined"!=typeof CSSMediaRule,ae="undefined"!=typeof CSSSupportsRule,ce="undefined"!=typeof CSSConditionRule;function le(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];return e.target}catch(t){return e.target}}function de(e,t){var r,n;const s=new Q;se.push(s),s.init(e);let o=window.MutationObserver||window.__rrMutationObserver;const i=null===(n=null===(r=null===window||void 0===window?void 0:window.Zone)||void 0===r?void 0:r.__symbol__)||void 0===n?void 0:n.call(r,"MutationObserver");i&&window[i]&&(o=window[i]);const a=new o(s.processMutations.bind(s));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function ue({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,sampling:o}){return R("scroll",L((o=>{const i=le(o);if(!i||B(i,n,s,!0))return;const a=r.getId(i);if(i===t){const r=t.scrollingElement||t.documentElement;e({id:a,x:r.scrollLeft,y:r.scrollTop})}else e({id:a,x:i.scrollLeft,y:i.scrollTop})}),o.scroll||100),t)}function he(e,t){const r=Object.assign({},e);return t||delete r.userTriggered,r}const pe=["INPUT","TEXTAREA","SELECT"],ge=new WeakMap;function me(e){return function(e,t){if(oe&&e.parentRule instanceof CSSGroupingRule||ie&&e.parentRule instanceof CSSMediaRule||ae&&e.parentRule instanceof CSSSupportsRule||ce&&e.parentRule instanceof CSSConditionRule){const r=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(r)}else if(e.parentStyleSheet){const r=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(r)}return t}(e,[])}function fe(e,t,r){let n,s;return e?(e.ownerNode?n=t.getId(e.ownerNode):s=r.getId(e),{styleId:s,id:n}):{}}function ye({mirror:e,stylesheetManager:t},r){var n,s,o;let i=null;i="#document"===r.nodeName?e.getId(r):e.getId(r.host);const a="#document"===r.nodeName?null===(n=r.defaultView)||void 0===n?void 0:n.Document:null===(o=null===(s=r.ownerDocument)||void 0===s?void 0:s.defaultView)||void 0===o?void 0:o.ShadowRoot,c=Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets");return null!==i&&-1!==i&&a&&c?(Object.defineProperty(r,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var e;return null===(e=c.get)||void 0===e?void 0:e.call(this)},set(e){var r;const n=null===(r=c.set)||void 0===r?void 0:r.call(this,e);if(null!==i&&-1!==i)try{t.adoptStyleSheets(e,i)}catch(e){}return n}}),()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}):()=>{}}function Ie(e,t={}){const r=e.doc.defaultView;if(!r)return()=>{};!function(e,t){const{mutationCb:r,mousemoveCb:n,mouseInteractionCb:s,scrollCb:o,viewportResizeCb:i,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:d,canvasMutationCb:u,fontCb:h,selectionCb:p}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),r(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),n(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),s(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),o(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),i(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),c(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),l(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),d(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),u(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)}}(e,t);const n=de(e,e.doc),s=function({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(!1===t.mousemove)return()=>{};const s="number"==typeof t.mousemove?t.mousemove:50,o="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let i,a=[];const c=L((t=>{const r=Date.now()-i;e(a.map((e=>(e.timeOffset-=r,e))),t),a=[],i=null}),o),l=L((e=>{const t=le(e),{clientX:r,clientY:s}=U(e)?e.changedTouches[0]:e;i||(i=Date.now()),a.push({x:r,y:s,id:n.getId(t),timeOffset:Date.now()-i}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?j.Drag:e instanceof MouseEvent?j.MouseMove:j.TouchMove)}),s,{trailing:!1}),d=[R("mousemove",l,r),R("touchmove",l,r),R("drag",l,r)];return()=>{d.forEach((e=>e()))}}(e),o=function({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,sampling:o}){if(!1===o.mouseInteraction)return()=>{};const i=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,a=[];return Object.keys(H).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==i[e])).forEach((o=>{const i=o.toLowerCase(),c=(t=>o=>{const i=le(o);if(B(i,n,s,!0))return;const a=U(o)?o.changedTouches[0]:o;if(!a)return;const c=r.getId(i),{clientX:l,clientY:d}=a;e({type:H[t],id:c,x:l,y:d})})(o);a.push(R(i,c,t))})),()=>{a.forEach((e=>e()))}}(e),i=ue(e),a=function({viewportResizeCb:e}){let t=-1,r=-1;return R("resize",L((()=>{const n=F(),s=q();t===n&&r===s||(e({width:Number(s),height:Number(n)}),t=n,r=s)}),200),window)}(e),l=function({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,ignoreClass:o,maskInputOptions:i,maskInputFn:a,sampling:l,userTriggeredOnInput:d}){function u(e){let r=le(e);const l=e.isTrusted;if(r&&"OPTION"===r.tagName&&(r=r.parentElement),!r||!r.tagName||pe.indexOf(r.tagName)<0||B(r,n,s,!0))return;const u=r.type;if(r.classList.contains(o))return;let p=r.value,g=!1;"radio"===u||"checkbox"===u?g=r.checked:(i[r.tagName.toLowerCase()]||i[u])&&(p=c({maskInputOptions:i,tagName:r.tagName,type:u,value:p,maskInputFn:a})),h(r,he({text:p,isChecked:g,userTriggered:l},d));const m=r.name;"radio"===u&&m&&g&&t.querySelectorAll(`input[type="radio"][name="${m}"]`).forEach((e=>{e!==r&&h(e,he({text:e.value,isChecked:!g,userTriggered:!1},d))}))}function h(t,n){const s=ge.get(t);if(!s||s.text!==n.text||s.isChecked!==n.isChecked){ge.set(t,n);const s=r.getId(t);e(Object.assign(Object.assign({},n),{id:s}))}}const p=("last"===l.input?["change"]:["input","change"]).map((e=>R(e,u,t))),g=t.defaultView;if(!g)return()=>{p.forEach((e=>e()))};const m=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value"),f=[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&p.push(...f.map((e=>O(e[0],e[1],{set(){u({target:this})}},!1,g)))),()=>{p.forEach((e=>e()))}}(e),d=function({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:s}){const o=o=>L((s=>{const i=le(s);if(!i||B(i,t,r,!0))return;const{currentTime:a,volume:c,muted:l,playbackRate:d}=i;e({type:o,id:n.getId(i),currentTime:a,volume:c,muted:l,playbackRate:d})}),s.media||500),i=[R("play",o(0)),R("pause",o(1)),R("seeked",o(2)),R("volumechange",o(3)),R("ratechange",o(4))];return()=>{i.forEach((e=>e()))}}(e),u=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){const s=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=function(n,o){const{id:i,styleId:a}=fe(this,t,r.styleMirror);return(i&&-1!==i||a&&-1!==a)&&e({id:i,styleId:a,adds:[{rule:n,index:o}]}),s.apply(this,[n,o])};const o=n.CSSStyleSheet.prototype.deleteRule;let i,a;n.CSSStyleSheet.prototype.deleteRule=function(n){const{id:s,styleId:i}=fe(this,t,r.styleMirror);return(s&&-1!==s||i&&-1!==i)&&e({id:s,styleId:i,removes:[{index:n}]}),o.apply(this,[n])},n.CSSStyleSheet.prototype.replace&&(i=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=function(n){const{id:s,styleId:o}=fe(this,t,r.styleMirror);return(s&&-1!==s||o&&-1!==o)&&e({id:s,styleId:o,replace:n}),i.apply(this,[n])}),n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=function(n){const{id:s,styleId:o}=fe(this,t,r.styleMirror);return(s&&-1!==s||o&&-1!==o)&&e({id:s,styleId:o,replaceSync:n}),a.apply(this,[n])});const c={};oe?c.CSSGroupingRule=n.CSSGroupingRule:(ie&&(c.CSSMediaRule=n.CSSMediaRule),ce&&(c.CSSConditionRule=n.CSSConditionRule),ae&&(c.CSSSupportsRule=n.CSSSupportsRule));const l={};return Object.entries(c).forEach((([n,s])=>{l[n]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=function(s,o){const{id:i,styleId:a}=fe(this.parentStyleSheet,t,r.styleMirror);return(i&&-1!==i||a&&-1!==a)&&e({id:i,styleId:a,adds:[{rule:s,index:[...me(this),o||0]}]}),l[n].insertRule.apply(this,[s,o])},s.prototype.deleteRule=function(s){const{id:o,styleId:i}=fe(this.parentStyleSheet,t,r.styleMirror);return(o&&-1!==o||i&&-1!==i)&&e({id:o,styleId:i,removes:[{index:[...me(this),s]}]}),l[n].deleteRule.apply(this,[s])}})),()=>{n.CSSStyleSheet.prototype.insertRule=s,n.CSSStyleSheet.prototype.deleteRule=o,i&&(n.CSSStyleSheet.prototype.replace=i),a&&(n.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach((([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule}))}}(e,{win:r}),h=ye(e,e.doc),p=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:s}){const o=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=function(s,i,a){var c;if(r.has(s))return o.apply(this,[s,i,a]);const{id:l,styleId:d}=fe(null===(c=this.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,n.styleMirror);return(l&&-1!==l||d&&-1!==d)&&e({id:l,styleId:d,set:{property:s,value:i,priority:a},index:me(this.parentRule)}),o.apply(this,[s,i,a])};const i=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=function(s){var o;if(r.has(s))return i.apply(this,[s]);const{id:a,styleId:c}=fe(null===(o=this.parentRule)||void 0===o?void 0:o.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,remove:{property:s},index:me(this.parentRule)}),i.apply(this,[s])},()=>{s.CSSStyleDeclaration.prototype.setProperty=o,s.CSSStyleDeclaration.prototype.removeProperty=i}}(e,{win:r}),g=e.collectFonts?function({fontCb:e,doc:t}){const r=t.defaultView;if(!r)return()=>{};const n=[],s=new WeakMap,o=r.FontFace;r.FontFace=function(e,t,r){const n=new o(e,t,r);return s.set(n,{family:e,buffer:"string"!=typeof t,descriptors:r,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),n};const i=D(t.fonts,"add",(function(t){return function(r){return setTimeout((()=>{const t=s.get(r);t&&(e(t),s.delete(r))}),0),t.apply(this,[r])}}));return n.push((()=>{r.FontFace=o})),n.push(i),()=>{n.forEach((e=>e()))}}(e):()=>{},m=function(e){const{doc:t,mirror:r,blockClass:n,blockSelector:s,selectionCb:o}=e;let i=!0;const a=()=>{const e=t.getSelection();if(!e||i&&(null==e?void 0:e.isCollapsed))return;i=e.isCollapsed||!1;const a=[],c=e.rangeCount||0;for(let t=0;t<c;t++){const o=e.getRangeAt(t),{startContainer:i,startOffset:c,endContainer:l,endOffset:d}=o;B(i,n,s,!0)||B(l,n,s,!0)||a.push({start:r.getId(i),startOffset:c,end:r.getId(l),endOffset:d})}o({ranges:a})};return a(),R("selectionchange",a)}(e),f=[];for(const t of e.plugins)f.push(t.observer(t.callback,r,t.options));return()=>{se.forEach((e=>e.reset())),n.disconnect(),s(),o(),i(),a(),l(),d(),u(),h(),p(),g(),m(),f.forEach((e=>e()))}}class Ce{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,r,n){const s=r||this.getIdToRemoteIdMap(e),o=n||this.getRemoteIdToIdMap(e);let i=s.get(t);return i||(i=this.generateIdFn(),s.set(t,i),o.set(i,t)),i}getIds(e,t){const r=this.getIdToRemoteIdMap(e),n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,r,n)))}getRemoteId(e,t,r){const n=r||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;return n.get(t)||-1}getRemoteIds(e,t){const r=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,r)))}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){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Ce(m),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Ce(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 r;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(r=this.loadListener)||void 0===r||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){if("rrweb"===e.data.type){if(!e.source)return;const t=this.crossOriginIframeMap.get(e.source);if(!t)return;const r=this.transformCrossOriginEvent(t,e.data.event);r&&this.wrappedEmit(r,e.data.isCheckout)}}transformCrossOriginEvent(e,t){var r;switch(t.type){case K.FullSnapshot:return this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e),{timestamp:t.timestamp,type:K.IncrementalSnapshot,data:{source:j.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case K.Meta:case K.Load:case K.DomContentLoaded:return!1;case K.Plugin:return t;case K.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case K.IncrementalSnapshot:switch(t.data.source){case j.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e)})),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 j.Drag:case j.TouchMove:case j.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case j.ViewportResize:return!1;case j.MediaInteraction:case j.MouseInteraction:case j.Scroll:case j.CanvasMutation:case j.Input:return this.replaceIds(t.data,e,["id"]),t;case j.StyleSheetRule:case j.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case j.Font:return t;case j.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case j.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(r=t.data.styles)||void 0===r||r.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}}replace(e,t,r,n){for(const s of n)(Array.isArray(t[s])||"number"==typeof t[s])&&(Array.isArray(t[s])?t[s]=e.getIds(r,t[s]):t[s]=e.getId(r,t[s]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}}class be{constructor(e){this.shadowDoms=new WeakSet,this.restorePatches=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror;const t=this;this.restorePatches.push(D(Element.prototype,"attachShadow",(function(e){return function(r){const n=e.call(this,r);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,this.ownerDocument),n}})))}addShadowRoot(e,t){s(e)&&(this.shadowDoms.has(e)||(this.shadowDoms.add(e),de(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),ue(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),ye({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)}),0)))}observeAttachShadow(e){if(e.contentWindow){const t=this;this.restorePatches.push(D(e.contentWindow.HTMLElement.prototype,"attachShadow",(function(r){return function(n){const s=r.call(this,n);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,e.contentDocument),s}})))}}reset(){this.restorePatches.forEach((e=>e())),this.shadowDoms=new WeakSet}}for(var Se="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ae="undefined"==typeof Uint8Array?[]:new Uint8Array(256),we=0;we<64;we++)Ae[Se.charCodeAt(we)]=we;const ke=new Map,Te=(e,t,r)=>{if(!e||!Re(e,t)&&"object"!=typeof e)return;const n=function(e,t){let r=ke.get(e);return r||(r=new Map,ke.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}(r,e.constructor.name);let s=n.indexOf(e);return-1===s&&(s=n.length,n.push(e)),s};function Me(e,t,r){if(e instanceof Array)return e.map((e=>Me(e,t,r)));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){const t=e.constructor.name,r=function(e){var t,r=new Uint8Array(e),n=r.length,s="";for(t=0;t<n;t+=3)s+=Se[r[t]>>2],s+=Se[(3&r[t])<<4|r[t+1]>>4],s+=Se[(15&r[t+1])<<2|r[t+2]>>6],s+=Se[63&r[t+2]];return n%3==2?s=s.substring(0,s.length-1)+"=":n%3==1&&(s=s.substring(0,s.length-2)+"=="),s}(e);return{rr_type:t,base64:r}}if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Me(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:r}=e;return{rr_type:t,src:r}}return e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL()}:e instanceof ImageData?{rr_type:e.constructor.name,args:[Me(e.data,t,r),e.width,e.height]}:Re(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:Te(e,t,r)}:e}const xe=(e,t,r)=>[...e].map((e=>Me(e,t,r))),Re=(e,t)=>{const r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof t[e]));return Boolean(r.find((r=>e instanceof t[r])))};function Ee(e,t,r){const n=[];try{const s=D(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(n,...s){return B(this,t,r,!0)||"__context"in this||(this.__context=n),e.apply(this,[n,...s])}}));n.push(s)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach((e=>e()))}}function Ne(e,t,r,n,s,o,i){const a=[],c=Object.getOwnPropertyNames(e);for(const o of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(o))try{if("function"!=typeof e[o])continue;const c=D(e,o,(function(e){return function(...a){const c=e.apply(this,a);if(Te(c,i,this),!B(this.canvas,n,s,!0)){const e=xe([...a],i,this),n={type:t,property:o,args:e};r(this.canvas,n)}return c}}));a.push(c)}catch(n){const s=O(e,o,{set(e){r(this.canvas,{type:t,property:o,args:[e],setter:!0})}});a.push(s)}return a}var Le=null;try{var Oe="undefined"!=typeof module&&"function"==typeof module.require&&module.require("worker_threads")||"function"==typeof require&&require("worker_threads")||"function"==typeof require&&require("worker_threads");Le=Oe.Worker}catch(e){}var De,Fe,qe=(De="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaS