zipyai-sprinto
Version:
SDK for zipy
1 lines • 174 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e||self).zipyaiSprinto={})}(this,function(e){var t,n,r;!function(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.ReplayerEvent=11]="ReplayerEvent",e[e.ConsoleInfo=50]="ConsoleInfo",e[e.ConsoleError=51]="ConsoleError",e[e.ConsoleWarning=52]="ConsoleWarning",e[e.ConsoleDebug=53]="ConsoleDebug",e[e.Error=70]="Error",e[e.RangeError=71]="RangeError",e[e.ReferenceError=72]="ReferenceError",e[e.TypeError=73]="TypeError",e[e.SyntaxError=74]="SyntaxError",e[e.URIError=75]="URIError",e[e.EvalError=76]="EvalError",e[e.UnhandledRejection=77]="UnhandledRejection",e[e.BROWSERDATA=100]="BROWSERDATA",e[e.NAVIGATION=101]="NAVIGATION",e[e.Online=102]="Online",e[e.Offline=103]="Offline",e[e.XHR=104]="XHR",e[e.WSOPEN=105]="WSOPEN",e[e.WSCLOSE=106]="WSCLOSE",e[e.WSMESSAGE=107]="WSMESSAGE",e[e.WSERROR=108]="WSERROR",e[e.Fonts=109]="Fonts",e[e.Link=110]="Link",e[e.Css=111]="Css",e[e.Image=112]="Image",e[e.Js=113]="Js",e[e.Media=114]="Media",e[e.ZipyLogMessage=115]="ZipyLogMessage",e[e.ZipyLogException=116]="ZipyLogException",e[e.ZipyLogFrontendError=117]="ZipyLogFrontendError",e[e.ZipyLogNetworkError=118]="ZipyLogNetworkError",e[e.Performance=119]="Performance",e[e.PerfNavigation=120]="PerfNavigation",e[e.OtherNetworkCall=121]="OtherNetworkCall",e[e.WebVitals=122]="WebVitals"}(t||(t={})),function(e){e[e.MESSAGESEND=0]="MESSAGESEND",e[e.MESSAGERECEIVED=1]="MESSAGERECEIVED",e[e.SOCKETCLOSE=2]="SOCKETCLOSE",e[e.SOCKETERROR=3]="SOCKETERROR",e[e.SOCKETOPEN=4]="SOCKETOPEN"}(n||(n={})),function(e){e[e.ELEMENT=0]="ELEMENT",e[e.EVENT=1]="EVENT",e[e.FIRST_INPUT=2]="FIRST_INPUT",e[e.LARGEST_CONTENTFUL_PAINT=3]="LARGEST_CONTENTFUL_PAINT",e[e.LAYOUT_SHIFT=4]="LAYOUT_SHIFT",e[e.LONGTASK=5]="LONGTASK",e[e.MARK=6]="MARK",e[e.MEASURE=7]="MEASURE",e[e.NAVIGATION=8]="NAVIGATION",e[e.PAINT=9]="PAINT",e[e.RESOURCE=10]="RESOURCE"}(r||(r={}));var o,i,s,a="zipy",c="rrweb";!function(e){e[e.POSTENDUSERINFOANDGETUSERCONFIG=0]="POSTENDUSERINFOANDGETUSERCONFIG",e[e.POSTENDUSERINFO=1]="POSTENDUSERINFO",e[e.GETUSERCONFIG=2]="GETUSERCONFIG"}(o||(o={})),function(e){e[e.ANONYMS=0]="ANONYMS",e[e.IDENTIFIED=1]="IDENTIFIED"}(i||(i={})),function(e){e[e.NORECORDING=0]="NORECORDING",e[e.RECORDINGPENDING=1]="RECORDINGPENDING",e[e.RECORDINGSUCCESSFUL=2]="RECORDINGSUCCESSFUL"}(s||(s={}));var l,d,u,p,f="logEvent",g="exceptionEvent",h="errorEvent",m=1024,v="startIframeRecording",y="stopIframeRecording",w="iframeContentLoaded";(p=l||(l={})).DEBUG="1",p.WARNING="2",p.ERROR="3",p.LOG="4",function(e){e[e.BLOCKING=0]="BLOCKING",e[e.NON_BLOCKING=1]="NON_BLOCKING"}(d||(d={})),function(e){e.session_data="_zsession-data",e.total_data_sent="_ztotal-data-sent",e.enduser_last_activity_time="_zenduser-last-activity-time",e.last_activity_time="_zlast-activity-time"}(u||(u={}));var I,C=/^(?!-)[A-Za-z0-9-]+([\-\.]{1}[a-z0-9]+)*\.[A-Za-z]{2,6}$/,S=499;!function(e){e[e.FCP=0]="FCP",e[e.FP=1]="FP",e[e.FID=2]="FID",e[e.CLS=3]="CLS",e[e.LCP=4]="LCP"}(I||(I={}));var b,E={streamMgrUrl:"https://services.zipy.ai/sdk-session-manager/v2/enduser-info",registerSessionUrl:"https://services.zipy.ai/sdk-session-manager/v1/register-sdk-session",sdkVersion:"1.0.18",errorUrl:"divolte.collector",streamMgrRetryCount:5,zipyDeploymentEnviornment:"Production",sdkLoopTime:1e3,perfLoopTime:5e3,ignoreEmptyErros:!0,ignoreLargeResponse:!0,debugLogs:!1,sessionLinkUrl:"https://app.zipy.ai",isNPM:!0},k=!1;function A(e){k&&console.info(a,e)}function T(e){k&&console.debug(a,e)}function N(e){k&&console.log(a,e)}function R(e){k&&console.error(a,e)}function O(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function z(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function M(e){try{var t=e.rules||e.cssRules;return t?((n=Array.from(t).map(D).join("")).includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")&&(n=n.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),n):null}catch(e){return null}var n}function D(e){var t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=M(e.styleSheet)||t}catch(e){}return t}!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"}(b||(b={}));var x=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-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,n=this.getId(e);this.idNodeMap.delete(n),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){this.idNodeMap.set(t.id,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){var n=this.getNode(e);if(n){var r=this.nodeMetaMap.get(n);r&&this.nodeMetaMap.set(t,r)}this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function L(e){var t=e.maskInputOptions,n=e.tagName,r=e.type,o=e.maskInputFn,i=e.value||"",s=r&&r.toLowerCase();return(t[n.toLowerCase()]||s&&t[s])&&(i=o?o(i):"*".repeat(i.length)),i}var U,F,P="__rrweb_original__",G=1,_=new RegExp("[^a-z0-9-_:]"),W=-2;function B(){return G++}var Z=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,V=/^(?:[a-z+]+:)?\/\//i,q=/^www\..*/i,K=/^(data:)([^,]*),(.*)/i;function J(e,t){return(e||"").replace(Z,function(e,n,r,o,i,s){var a,c=r||i||s,l=n||o||"";if(!c)return e;if(V.test(c)||q.test(c))return"url(".concat(l).concat(c).concat(l,")");if(K.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 p=0,f=u;p<f.length;p++){var g=f[p];"."!==g&&(".."===g?d.pop():d.push(g))}return"url(".concat(l).concat(d.join("/")).concat(l,")")})}var H=/^[^ \t\n\r\u000c]+/,j=/^[, \t\n\r\u000c]+/;function Y(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function X(){var e=document.createElement("a");return e.href="",e.href}function Q(e,t,n,r){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]?Y(e,r):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function(e,t){if(""===t.trim())return t;var n=0;function r(e){var r,o=e.exec(t.substring(n));return o?(n+=(r=o[0]).length,r):""}for(var o=[];r(j),!(n>=t.length);){var i=r(H);if(","===i.slice(-1))i=Y(e,i.substring(0,i.length-1)),o.push(i);else{var s="";i=Y(e,i);for(var a=!1;;){var c=t.charAt(n);if(""===c){o.push((i+s).trim());break}if(a)")"===c&&(a=!1);else{if(","===c){n+=1,o.push((i+s).trim());break}"("===c&&(a=!0)}s+=c,n+=1}}}return o.join(", ")}(e,r):"style"===n?J(r,X()):"object"===t&&"data"===n?Y(e,r):r:Y(e,r):r}function $(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function ee(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&ee(e.parentNode,t,n);for(var r=e.classList.length;r--;)if(t.test(e.classList[r]))return!0;return!!n&&ee(e.parentNode,t,n)}function te(e,t,n){var r=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===r)return!1;if("string"==typeof t){if(r.classList.contains(t))return!0;if(r.closest(".".concat(t)))return!0}else if(ee(r,t,!0))return!0;if(n){if(r.matches(n))return!0;if(r.closest(n))return!0}return!1}function ne(e){return null==e?"":e.toLowerCase()}function re(e,t){var n,r=t.doc,o=t.mirror,i=t.blockClass,s=t.blockSelector,a=t.maskTextClass,c=t.maskTextSelector,l=t.skipChild,d=void 0!==l&&l,u=t.inlineStylesheet,p=void 0===u||u,f=t.maskInputOptions,g=void 0===f?{}:f,h=t.maskTextFn,m=t.maskInputFn,v=t.slimDOMOptions,y=t.dataURLOptions,w=void 0===y?{}:y,I=t.inlineImages,C=void 0!==I&&I,S=t.recordCanvas,E=void 0!==S&&S,k=t.onSerialize,A=t.onIframeLoad,T=t.iframeLoadTimeout,N=void 0===T?5e3:T,R=t.onStylesheetLoad,D=t.stylesheetLoadTimeout,x=void 0===D?5e3:D,G=t.keepIframeSrcFn,Z=void 0===G?function(){return!1}:G,V=t.newlyAddedElement,q=t.preserveWhiteSpace,K=void 0===q||q,H=function(e,t){var n=t.doc,r=t.blockClass,o=t.blockSelector,i=t.maskTextClass,s=t.maskTextSelector,a=t.inlineStylesheet,c=t.maskInputOptions,l=void 0===c?{}:c,d=t.maskTextFn,u=t.maskInputFn,p=t.dataURLOptions,f=void 0===p?{}:p,g=t.inlineImages,h=t.recordCanvas,m=t.keepIframeSrcFn,v=t.newlyAddedElement,y=void 0!==v&&v,w=function(e,t){if(t.hasNode(e)){var n=t.getId(e);return 1===n?void 0:n}}(n,t.mirror);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:b.Document,childNodes:[],compatMode:e.compatMode}:{type:b.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:b.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:w};case e.ELEMENT_NODE:return function(e,t){for(var n=t.doc,r=t.inlineStylesheet,o=t.maskInputOptions,i=void 0===o?{}:o,s=t.maskInputFn,a=t.dataURLOptions,c=void 0===a?{}:a,l=t.inlineImages,d=t.recordCanvas,u=t.keepIframeSrcFn,p=t.newlyAddedElement,f=void 0!==p&&p,g=t.rootId,h=function(e,t,n){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var r=e.classList.length;r--;)if(t.test(e.classList[r]))return!0;return!!n&&e.matches(n)}(e,t.blockClass,t.blockSelector),m=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return _.test(t)?"div":t}(e),v={},y=e.attributes.length,w=0;w<y;w++){var I=e.attributes[w];$(m,I.name)||(v[I.name]=Q(n,m,I.name,I.value))}if("link"===m&&r){var C=Array.from(n.styleSheets).find(function(t){return t.href===e.href}),S=null;C&&(S=M(C)),S&&(delete v.rel,delete v.href,v._cssText=J(S,C.href))}if("style"===m&&e.sheet&&!(e.innerText||e.textContent||"").trim().length&&(S=M(e.sheet))&&(v._cssText=J(S,X())),"input"===m||"textarea"===m||"select"===m){var E=e.value,k=e.checked;if("radio"!==v.type&&"checkbox"!==v.type&&"submit"!==v.type&&"button"!==v.type&&E){var A=e.hasAttribute("data-rr-is-password")?"password":"string"==typeof v.type?v.type.toLowerCase():null;v.value=L({type:A,tagName:m,value:E,maskInputOptions:i,maskInputFn:s})}else k&&(v.checked=k)}if("option"===m&&(e.selected&&!i.select?v.selected=!0:delete v.selected),"canvas"===m&&d)if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var n=0;n<e.width;n+=50)for(var r=0;r<e.height;r+=50){var o=t.getImageData;if(new Uint32Array((P in o?o[P]:o).call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some(function(e){return 0!==e}))return!1}return!0})(e)||(v.rr_dataURL=e.toDataURL(c.type,c.quality));else if(!("__context"in e)){var T=e.toDataURL(c.type,c.quality),N=document.createElement("canvas");N.width=e.width,N.height=e.height,T!==N.toDataURL(c.type,c.quality)&&(v.rr_dataURL=T)}if("img"===m&&l){U||(U=n.createElement("canvas"),F=U.getContext("2d"));var R=e,O=R.crossOrigin;R.crossOrigin="anonymous";var z=function(){R.removeEventListener("load",z);try{U.width=R.naturalWidth,U.height=R.naturalHeight,F.drawImage(R,0,0),v.rr_dataURL=U.toDataURL(c.type,c.quality)}catch(e){console.warn("Cannot inline img src=".concat(R.currentSrc,"! Error: ").concat(e))}O?v.crossOrigin=O:R.removeAttribute("crossorigin")};R.complete&&0!==R.naturalWidth?z():R.addEventListener("load",z)}if("audio"!==m&&"video"!==m||(v.rr_mediaState=e.paused?"paused":"played",v.rr_mediaCurrentTime=e.currentTime),f||(e.scrollLeft&&(v.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(v.rr_scrollTop=e.scrollTop)),h){var D=e.getBoundingClientRect(),x=D.height;v={class:v.class,rr_width:"".concat(D.width,"px"),rr_height:"".concat(x,"px")}}return"iframe"!==m||u(v.src)||(e.contentDocument||(v.rr_src=v.src),delete v.src),{type:b.Element,tagName:m,attributes:v,childNodes:[],isSVG:(G=e,Boolean("svg"===G.tagName||G.ownerSVGElement)||void 0),needBlock:h,rootId:g};var G}(e,{doc:n,blockClass:r,blockSelector:o,inlineStylesheet:a,maskInputOptions:l,maskInputFn:u,dataURLOptions:f,inlineImages:g,recordCanvas:h,keepIframeSrcFn:m,newlyAddedElement:y,rootId:w});case e.TEXT_NODE:return function(e,t){var n,r,o=t.maskTextClass,i=t.maskTextSelector,s=t.maskTextFn,a=t.rootId,c=e.parentNode&&e.parentNode.tagName,l=e.textContent,d="STYLE"===c||void 0,u="SCRIPT"===c||void 0;if(d&&l){try{e.nextSibling||e.previousSibling||(null===(n=e.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(l=(r=e.parentNode.sheet).cssRules?Array.from(r.cssRules).map(function(e){return e.cssText||""}).join(""):"")}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(t),e)}l=J(l,X())}return u&&(l="SCRIPT_PLACEHOLDER"),!d&&!u&&l&&te(e,o,i)&&(l=s?s(l):l.replace(/[\S]/g,"*")),{type:b.Text,textContent:l||"",isStyle:d,rootId:a}}(e,{maskTextClass:i,maskTextSelector:s,maskTextFn:d,rootId:w});case e.CDATA_SECTION_NODE:return{type:b.CDATA,textContent:"",rootId:w};case e.COMMENT_NODE:return{type:b.Comment,textContent:e.textContent||"",rootId:w};default:return!1}}(e,{doc:r,mirror:o,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:c,inlineStylesheet:p,maskInputOptions:g,maskTextFn:h,maskInputFn:m,dataURLOptions:w,inlineImages:C,recordCanvas:E,keepIframeSrcFn:Z,newlyAddedElement:void 0!==V&&V});if(!H)return console.warn(e,"not serialized"),null;n=o.hasNode(e)?o.getId(e):!function(e,t){if(t.comment&&e.type===b.Comment)return!0;if(e.type===b.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&&e.attributes.href.endsWith(".js")))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(ne(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===ne(e.attributes.name)||"icon"===ne(e.attributes.rel)||"apple-touch-icon"===ne(e.attributes.rel)||"shortcut icon"===ne(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&ne(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(ne(e.attributes.property).match(/^(og|twitter|fb):/)||ne(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===ne(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===ne(e.attributes.name)||"googlebot"===ne(e.attributes.name)||"bingbot"===ne(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===ne(e.attributes.name)||"generator"===ne(e.attributes.name)||"framework"===ne(e.attributes.name)||"publisher"===ne(e.attributes.name)||"progid"===ne(e.attributes.name)||ne(e.attributes.property).match(/^article:/)||ne(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===ne(e.attributes.name)||"yandex-verification"===ne(e.attributes.name)||"csrf-token"===ne(e.attributes.name)||"p:domain_verify"===ne(e.attributes.name)||"verify-v1"===ne(e.attributes.name)||"verification"===ne(e.attributes.name)||"shopify-checkout-api-token"===ne(e.attributes.name)))return!0}}return!1}(H,v)&&(K||H.type!==b.Text||H.isStyle||H.textContent.replace(/^\s+|\s+$/gm,"").length)?B():W;var j=Object.assign(H,{id:n});if(o.add(e,j),n===W)return null;k&&k(e);var Y=!d;if(j.type===b.Element){Y=Y&&!j.needBlock,delete j.needBlock;var ee=e.shadowRoot;ee&&z(ee)&&(j.isShadowHost=!0)}if((j.type===b.Document||j.type===b.Element)&&Y){v.headWhitespace&&j.type===b.Element&&"head"===j.tagName&&(K=!1);for(var oe={doc:r,mirror:o,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:c,skipChild:d,inlineStylesheet:p,maskInputOptions:g,maskTextFn:h,maskInputFn:m,slimDOMOptions:v,dataURLOptions:w,inlineImages:C,recordCanvas:E,preserveWhiteSpace:K,onSerialize:k,onIframeLoad:A,iframeLoadTimeout:N,onStylesheetLoad:R,stylesheetLoadTimeout:x,keepIframeSrcFn:Z},ie=0,se=Array.from(e.childNodes);ie<se.length;ie++)(le=re(se[ie],oe))&&j.childNodes.push(le);if(function(e){return e.nodeType===e.ELEMENT_NODE}(e)&&e.shadowRoot)for(var ae=0,ce=Array.from(e.shadowRoot.childNodes);ae<ce.length;ae++){var le;(le=re(ce[ae],oe))&&(z(e.shadowRoot)&&(le.isShadow=!0),j.childNodes.push(le))}}return e.parentNode&&O(e.parentNode)&&z(e.parentNode)&&(j.isShadow=!0),j.type===b.Element&&"iframe"===j.tagName&&function(e,t,n){var r=e.contentWindow;if(r){var o,i=!1;try{o=r.document.readyState}catch(e){return}if("complete"===o){var s="about:blank";if(r.location.href!==s||e.src===s||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}else{var a=setTimeout(function(){i||(t(),i=!0)},n);e.addEventListener("load",function(){clearTimeout(a),i=!0,t()})}}}(e,function(){var t=e.contentDocument;if(t&&A){var n=re(t,{doc:t,mirror:o,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:p,maskInputOptions:g,maskTextFn:h,maskInputFn:m,slimDOMOptions:v,dataURLOptions:w,inlineImages:C,recordCanvas:E,preserveWhiteSpace:K,onSerialize:k,onIframeLoad:A,iframeLoadTimeout:N,onStylesheetLoad:R,stylesheetLoadTimeout:x,keepIframeSrcFn:Z});n&&A(e,n)}},N),j.type===b.Element&&"link"===j.tagName&&"stylesheet"===j.attributes.rel&&function(e,t,n){var r,o=!1;try{r=e.sheet}catch(e){return}if(!r){var i=setTimeout(function(){o||(t(),o=!0)},n);e.addEventListener("load",function(){clearTimeout(i),o=!0,t()})}}(e,function(){if(R){var t=re(e,{doc:r,mirror:o,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:p,maskInputOptions:g,maskTextFn:h,maskInputFn:m,slimDOMOptions:v,dataURLOptions:w,inlineImages:C,recordCanvas:E,preserveWhiteSpace:K,onSerialize:k,onIframeLoad:A,iframeLoadTimeout:N,onStylesheetLoad:R,stylesheetLoadTimeout:x,keepIframeSrcFn:Z});t&&R(e,t)}},x),j}function oe(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const ie="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 se={map:{},getId:()=>(console.error(ie),-1),getNode:()=>(console.error(ie),null),removeNodeFromMap(){console.error(ie)},has:()=>(console.error(ie),!1),reset(){console.error(ie)}};function ae(e,t,n={}){let r=null,o=0;return function(...i){const s=Date.now();o||!1!==n.leading||(o=s);const a=t-(s-o),c=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),o=s,e.apply(c,i)):r||!1===n.trailing||(r=setTimeout(()=>{o=!1===n.leading?0:Date.now(),r=null,e.apply(c,i)},a))}}function ce(e,t,n,r,o=window){const i=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,r?n:{set(e){setTimeout(()=>{n.set.call(this,e)},0),i&&i.set&&i.set.call(this,e)}}),()=>ce(e,t,i||{},!0)}function le(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(e){return()=>{}}}function de(e){var t,n,r,o,i,s;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?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(r=null==a?void 0:a.body)||void 0===r?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===(i=null===(o=null==a?void 0:a.body)||void 0===o?void 0:o.parentElement)||void 0===i?void 0:i.scrollTop)||(null===(s=null==a?void 0:a.body)||void 0===s?void 0:s.scrollTop)||0}}function ue(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function pe(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function fe(e,t,n,r){if(!e)return!1;const o=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;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(ee(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 ge(e,t){return t.getId(e)===W}function he(e,t){if(O(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||he(e.parentNode,t))}function me(e){return Boolean(e.changedTouches)}function ve(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function ye(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function we(e){return Boolean(null==e?void 0:e.shadowRoot)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(se=new Proxy(se,{get:(e,t,n)=>("map"===t&&console.error(ie),Reflect.get(e,t,n))}));class Ie{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function Ce(e){var t,n;let r=null;return(null===(n=null===(t=e.getRootNode)||void 0===t?void 0:t.call(e))||void 0===n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(r=e.getRootNode().host),r}function Se(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||function(e){const t=e.ownerDocument;if(!t)return!1;const n=function(e){let t,n=e;for(;t=Ce(n);)n=t;return n}(e);return t.contains(n)}(e))}function be(e){return e.hasAttribute("data-rr-is-password")?"password":e.hasAttribute("type")?e.getAttribute("type").toLowerCase():null}var Ee=(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))(Ee||{}),ke=(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))(ke||{}),Ae=(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))(Ae||{}),Te=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Te||{});function Ne(e){return"__ln"in e}class Re{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 n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&Ne(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&Ne(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;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 Oe=(e,t)=>`${e}@${t}`;class ze{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 Re,n=e=>{let t=e,n=W;for(;n===W;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},r=r=>{if(!r.parentNode||!Se(r))return;const o=O(r.parentNode)?this.mirror.getId(Ce(r)):this.mirror.getId(r.parentNode),i=n(r);if(-1===o||-1===i)return t.addNode(r);const s=re(r,{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=>{ve(e,this.mirror)&&this.iframeManager.addIframe(e),ye(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),we(r)&&this.shadowDomManager.addShadowRoot(r.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});s&&e.push({parentId:o,nextId:i,node:s})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of this.movedSet)De(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||r(e);for(const e of this.addedSet)Le(this.droppedSet,e)||De(this.removes,e,this.mirror)?Le(this.movedSet,e)?r(e):this.droppedSet.add(e):r(e);let o=null;for(;t.length;){let e=null;if(o){const t=this.mirror.getId(o.value.parentNode),r=n(o.value);-1!==t&&-1!==r&&(e=o)}if(!e)for(let r=t.length-1;r>=0;r--){const o=t.get(r);if(o){const t=this.mirror.getId(o.value.parentNode);if(-1===n(o.value))continue;if(-1!==t){e=o;break}{const t=o.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&-1!==this.mirror.getId(t.parentNode.host)){e=o;break}}}}if(!e){for(;t.head;)t.removeNode(t.head.value);break}o=e.previous,t.removeNode(e.value),r(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(!ge(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;fe(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:te(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 n=e.attributeName,r=e.target.getAttribute(n);if("value"===n){const e=be(t);r=L({maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:r,maskInputFn:this.maskInputFn})}if(fe(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let o=this.attributes.find(t=>t.node===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:{}},this.attributes.push(o)),"type"===n&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),"style"===n){const n=this.doc.createElement("span");e.oldValue&&n.setAttribute("style",e.oldValue),null==o.attributes.style&&(o.attributes.style={});const r=o.attributes.style;for(const e of Array.from(t.style)){const o=t.style.getPropertyValue(e),i=t.style.getPropertyPriority(e);o===n.style.getPropertyValue(e)&&i===n.style.getPropertyPriority(e)||(r[e]=""===i?o:[o,i])}for(const e of Array.from(n.style))""===t.style.getPropertyValue(e)&&(r[e]=!1)}else $(t.tagName,n)||(o.attributes[n]=Q(this.doc,t.tagName,n,r));break}case"childList":if(fe(e.target,this.blockClass,this.blockSelector,!0))return;e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const n=this.mirror.getId(t),r=O(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);fe(e.target,this.blockClass,this.blockSelector,!1)||ge(t,this.mirror)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(Me(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||he(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Oe(n,r)]?Me(this.movedSet,t):this.removes.push({parentId:r,id:n,isShadow:!(!O(e.target)||!z(e.target))||void 0})),this.mapRemoves.push(t))})}},this.genAdds=(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)){if(this.mirror.hasNode(e)){if(ge(e,this.mirror))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[Oe(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);fe(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach(e=>this.genAdds(e)),we(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 Me(e,t){e.delete(t),t.childNodes.forEach(t=>Me(e,t))}function De(e,t,n){return 0!==e.length&&xe(e,t,n)}function xe(e,t,n){const{parentNode:r}=t;if(!r)return!1;const o=n.getId(r);return!!e.some(e=>e.id===o)||xe(e,r,n)}function Le(e,t){return 0!==e.size&&Ue(e,t)}function Ue(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||Ue(e,n))}let Fe;function Pe(e){Fe=e}function Ge(){Fe=void 0}const _e=e=>Fe?(...t)=>{try{return e(...t)}catch(e){if(Fe&&!0===Fe(e))return;throw e}}:e;function We(e){let t="";return!e||e&&!e.length||Object.values(e).forEach(e=>{if(e&&e.nodeName){let n=e.nodeName,r=e.nodeValue;"class"==n?t=t+"."+r:"id"==n?t=t+"#"+r:"type"==n?t+=`[${n}="${r}"]`:"value"==n&&(t=t+"."+r)}}),t}function Be(e){const t=function(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t}else if("path"in e&&e.path.length)return e.path;return null}catch(e){return null}}(e);return t?function(e){if(!e||!Array.isArray(e))return"";let t="";for(let n=e.length>3?3:e.length-1;n>=0;n--){let r="",o=e[n];o&&o.tagName&&o.attributes&&o.attributes.length&&(r=n>0?o.tagName.toLowerCase()+We(o.attributes)+" > ":o.tagName.toLowerCase()+We(o.attributes),t+=r)}return t}(t):""}const Ze=[];function Ve(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 qe(e,t){var n,r;const o=new ze;Ze.push(o),o.init(e);let i=window.MutationObserver||window.__rrMutationObserver;const s=null===(r=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===r?void 0:r.call(n,"MutationObserver");s&&window[s]&&(i=window[s]);const a=new i(_e(o.processMutations.bind(o)));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function Ke({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:i}){return oe("scroll",_e(ae(_e(i=>{const s=Ve(i);if(!s||fe(s,r,o,!0))return;const a=n.getId(s);if(s===t&&t.defaultView){const n=de(t.defaultView);e({id:a,x:n.left,y:n.top})}else e({id:a,x:s.scrollLeft,y:s.scrollTop})}),i.scroll||100)),t)}function Je(e,t){const n=Object.assign({},e);return t||delete n.userTriggered,n}const He=["INPUT","TEXTAREA","SELECT"],je=new WeakMap;function Ye(e){return function(e,t){if(et("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||et("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||et("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||et("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 Xe(e,t,n){let r,o;return e?(e.ownerNode?r=t.getId(e.ownerNode):o=n.getId(e),{styleId:o,id:r}):{}}function Qe({mirror:e,stylesheetManager:t},n){var r,o,i;let s=null;s=e.getId("#document"===n.nodeName?n:n.host);const a="#document"===n.nodeName?null===(r=n.defaultView)||void 0===r?void 0:r.Document:null===(i=null===(o=n.ownerDocument)||void 0===o?void 0:o.defaultView)||void 0===i?void 0:i.ShadowRoot,c=Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets");return null!==s&&-1!==s&&a&&c?(Object.defineProperty(n,"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 n;const r=null===(n=c.set)||void 0===n?void 0:n.call(this,e);if(null!==s&&-1!==s)try{t.adoptStyleSheets(e,s)}catch(e){}return r}}),_e(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})})):()=>{}}function $e(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};!function(e,t){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:o,scrollCb:i,viewportResizeCb:s,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:d,canvasMutationCb:u,fontCb:p,selectionCb:f}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),r(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),o(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),i(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),s(...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),p(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),f(...e)}}(e,t);const r=qe(e,e.doc),o=function({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(!1===t.mousemove)return()=>{};const o="number"==typeof t.mousemove?t.mousemove:50,i="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let s,a=[];const c=ae(_e(t=>{const n=Date.now()-s;e(a.map(e=>(e.timeOffset-=n,e)),t),a=[],s=null}),i),l=_e(ae(_e(e=>{const t=Ve(e),{clientX:n,clientY:o}=me(e)?e.changedTouches[0]:e;s||(s=Date.now()),a.push({x:n,y:o,id:r.getId(t),timeOffset:Date.now()-s}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?ke.Drag:e instanceof MouseEvent?ke.MouseMove:ke.TouchMove)}),o,{trailing:!1})),d=[oe("mousemove",l,n),oe("touchmove",l,n),oe("drag",l,n)];return _e(()=>{d.forEach(e=>e())})}(e),i=function({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:i}){if(!1===i.mouseInteraction)return()=>{};const s=!0===i.mouseInteraction||void 0===i.mouseInteraction?{}:i.mouseInteraction,a=[];let c=0,l="";return Object.keys(Ae).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==s[e]).forEach(i=>{const s=i.toLowerCase(),d=(t=>i=>{const s=Ve(i);if(fe(s,r,o,!0))return;const a=me(i)?i.changedTouches[0]:i;if(!a)return;const d=n.getId(s),{clientX:u,clientY:p}=a,f=Be(i);let g={type:Ae[t],id:d,x:u,y:p,nodePath:f};if(Ae[t]===Ae.Click){const e=window.innerHeight?window.innerHeight:null,t=window.innerWidth?window.innerWidth:null,n=window.location.href||"",r=function(e){let t=e.target;return t?t.innerText||"":(console.error("Event target is not an HTML element."),"")}(i),o=function(e){const t=e.target,n=t?null==t?void 0:t.nodeName.toLowerCase():"",r=t instanceof HTMLAnchorElement||null!==t.onclick||t.hasAttribute("onclick");return"a"!==n&&!r}(i),s=i.offsetX,a=i.offsetY,[d,u]=function(e){let t=e.target;return t?[t.clientHeight,t.clientWidth]:(console.error("Event target is not an HTML element."),[0,0])}(i),p=function(e){let t=e.target;if(t){if(!t||!t.parentNode)return null;const n=[];let r=e.target;for(;r;){let e=r.tagName.toLowerCase(),t=Array.from(r.parentNode.children).indexOf(r)+1;n.unshift("body"!==e?e+(t>1?`:nth-child(${t})`:""):e),r=r.parentNode instanceof HTMLElement?r.parentNode:null}return n.join(" > ")}return null}(i),f=(new Date).getTime();let h=!1;l===p&&(h=f-c<3e3),c=new Date(f).getTime(),l=p||"",g=Object.assign(Object.assign({},g),{deadClick:o,innerText:r,offsetX:s,offsetY:a,rageClick:h,screenHeight:e,screenWidth:t,navigationUrl:n,elementHeight:d,elementWidth:u,selector:p})}_e(e)(g)})(i);a.push(oe(s,d,t))}),_e(()=>{a.forEach(e=>e())})}(e),s=Ke(e),a=function({viewportResizeCb:e}){let t=-1,n=-1;return oe("resize",_e(ae(_e(()=>{const r=ue(),o=pe();t===r&&n===o||(e({width:Number(o),height:Number(r)}),t=r,n=o)}),200)),window)}(e),c=function({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,ignoreClass:i,maskInputOptions:s,maskInputFn:a,sampling:c,userTriggeredOnInput:l}){function d(e){let n=Ve(e);const c=Be(e),d=e.isTrusted,p=n&&n.tagName;if(n&&"OPTION"===p&&(n=n.parentElement),!n||!p||He.indexOf(p)<0||fe(n,r,o,!0))return;if(n.classList.contains(i))return;let f=n.value,g=!1;const h=be(n)||"";"radio"===h||"checkbox"===h?g=n.checked:(s[p.toLowerCase()]||s[h])&&(f=L({maskInputOptions:s,tagName:p,type:h,value:f,maskInputFn:a})),u(n,_e(Je)({text:f,isChecked:g,userTriggered:d,nodePath:c},l));const m=n.name;"radio"===h&&m&&g&&t.querySelectorAll(`input[type="radio"][name="${m}"]`).forEach(e=>{e!==n&&u(e,_e(Je)({text:e.value,isChecked:!g,userTriggered:!1,nodePath:""},l))})}function u(t,r){const o=je.get(t);if(!o||o.text!==r.text||o.isChecked!==r.isChecked){je.set(t,r);const o=n.getId(t);_e(e)(Object.assign(Object.assign({},r),{id:o}))}}const p=("last"===c.input?["change"]:["input","change"]).map(e=>oe(e,_e(d),t)),f=t.defaultView;if(!f)return()=>{p.forEach(e=>e())};const g=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value");return g&&g.set&&p.push(...[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]].map(e=>ce(e[0],e[1],{set(){_e(d)({target:this,isTrusted:!1})}},!1,f))),_e(()=>{p.forEach(e=>e())})}(e),l=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:o}){const i=_e(i=>ae(_e(o=>{const s=Ve(o);if(!s||fe(s,t,n,!0))return;const{currentTime:a,volume:c,muted:l,playbackRate:d}=s;e({type:i,id:r.getId(s),currentTime:a,volume:c,muted:l,playbackRate:d})}),o.media||500)),s=[oe("play",i(0)),oe("pause",i(1)),oe("seeked",i(2)),oe("volumechange",i(3)),oe("ratechange",i(4))];return _e(()=>{s.forEach(e=>e())})}(e),d=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const o=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:_e((r,o,i)=>{const[s,a]=i,{id:c,styleId:l}=Xe(o,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:s,index:a}]}),r.apply(o,i)})});const i=r.CSSStyleSheet.prototype.deleteRule;let s,a;r.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:_e((r,o,i)=>{const[s]=i,{id:a,styleId:c}=Xe(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:s}]}),r.apply(o,i)})}),r.CSSStyleSheet.prototype.replace&&(s=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:_e((r,o,i)=>{const[s]=i,{id:a,styleId:c}=Xe(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replace:s}),r.apply(o,i)})})),r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:_e((r,o,i)=>{const[s]=i,{id:a,styleId:c}=Xe(o,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replaceSync:s}),r.apply(o,i)})}));const c={};tt("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(tt("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),tt("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),tt("CSSSupportsRule")&&(c.CSSSupportsRule=r.CSSSupportsRule));const l={};return Object.entries(c).forEach(([r,o])=>{l[r]={insertRule:o.prototype.insertRule,deleteRule:o.prototype.deleteRule},o.prototype.insertRule=new Proxy(l[r].insertRule,{apply:_e((r,o,i)=>{const[s,a]=i,{id:c,styleId:l}=Xe(o.parentStyleSheet,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:s,index:[...Ye(o),a||0]}]}),r.apply(o,i)})}),o.prototype.deleteRule=new Proxy(l[r].deleteRule,{apply:_e((r,o,i)=>{const[s]=i,{id:a,styleId:c}=Xe(o.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:[...Ye(o),s]}]}),r.apply(o,i)})})}),_e(()=>{try{r.CSSStyleSheet.prototype.insertRule=o,r.CSSStyleSheet.prototype.deleteRule=i,s&&(r.CSSStyleSheet.prototype.replace=s),a&&(r.CSSStyleSheet.prototype.replaceSync=a)}catch(e){}try{Object.entries(c).forEach(([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule})}catch(e){}})}(e,{win:n}),u=Qe(e,e.doc),p=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:o}){const i=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(i,{apply:_e((o,s,a)=>{var c;const[l,d,u]=a;if(n.has(l))return i.apply(s,[l,d,u]);const{id:p,styleId:f}=Xe(null===(c=s.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,r.styleMirror);return(p&&-1!==p||f&&-1!==f)&&e({id:p,styleId:f,set:{property:l,value:d,priority:u},index:Ye(s.parentRule)}),o.apply(s,a)})});const s=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:_e((o,i,a)=>{var c;const[l]=a;if(n.has(l))return s.apply(i,[l]);const{id:d,styleId:u}=Xe(null===(c=i.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,r.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,remove:{property:l},index:Ye(i.parentRule)}),o.apply(i,a)})}),_e(()=>{try{o.CSSStyleDeclaration.prototype.setProperty=i,o.CSSStyleDeclaration.prototype.removeProperty=s}catch(e){}})}(e,{win:n}),f=e.collectFonts?function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],o=new WeakMap,i=n.FontFace;n.FontFace=function(e,t,n){const r=new i(e,t,n);return o.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};const s=le(t.fonts,"add",function(t){return function(n){return setTimeout(_e(()=>{const t=o.get(n);t&&(e(t),o.delete(n))}),0),t.apply(this,[n])}});return r.push(()=>{n.FontFace=i}),r.push(s),_e(()=>{r.forEach(e=>e())})}(e):()=>{},g=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:o,selectionCb:i}=e;let s=!0;const a=_e(()=>{const e=t.getSelection();if(!e||s&&(null==e?void 0:e.isCollapsed))return;s=e.isCollapsed||!1;const a=[],c=e.rangeCount||0;for(let t=0;t<c;t++){const i=e.getRangeAt(t),{startContainer:s,startOffset:c,endContainer:l,endOffset:d}=i;fe(s,r,o,!0)||fe(l,r,o,!0)||a.push({start:n.getId(s),startOffset:c,end:n.getId(l),endOffset:d})}i({ranges:a})});return a(),oe("selectionchange",a)}(e),h=[];for(const t of e.plugins)h.push(t.observer(t.callback,n,t.options));return _e(()=>{Ze.forEach(e=>e.reset()),r.disconnect(),o(),i(),s(),a(),c(),l(),d(),u(),p(),f(),g(),h.forEach(e=>e())})}function et(e){return void 0!==window[e]}function tt(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class nt{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,r){const o=n||this.getIdToRemoteIdMap(e),i=r||this.getRemoteIdToIdMap(e);let s=o.get(t);return s||(s=this.generateIdFn(),o.set(t,s),i.set(s,t)),s}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);return"number"!=typeof t?t:r.get(t)||-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 rt{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new nt(B),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new nt(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const r=this.transformCrossOriginEvent(n,t.data.event);r&&this.wrappedEmit(r,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case Ee.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:Ee.IncrementalSnapshot,data:{source:ke.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Ee.Meta:case Ee.Load:case Ee.DomContentLoaded:return!1;case Ee.Plugin:return t;case Ee.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Ee.IncrementalSnapshot:switch(t.data.source){case ke.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 ke.Drag:case ke.TouchMove:case ke.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case ke.ViewportResize:return!1;case ke.MediaInteraction:case ke.MouseInteraction:case ke.Scroll:case ke.CanvasMutation:case ke.Input:return this.replaceIds(t.data,e,["id"]),t;case ke.StyleSheetRule:case ke.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case ke.Font:return t;case ke.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case ke.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}}replace(e,t,n,r){for(const o of r)(Array.isArray(t[o])||"number"==typeof t[o])&&(t[o]=Array.isArray(t[o])?e.getIds(n,t[o]):e.getId(n,t[o]));return t}rep