var rrweb=function(ne){"use strict";var x;(function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment"})(x||(x={}));function vr(t){return t.nodeType===t.ELEMENT_NODE}function Ye(t){var e=t?.host;return Boolean(e?.shadowRoot===t)}function Xe(t){return Object.prototype.toString.call(t)==="[object ShadowRoot]"}function no(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),t}function It(t){try{var e=t.rules||t.cssRules;return e?no(Array.from(e).map(Sr).join("")):null}catch{return null}}function Sr(t){var e=t.cssText;if(oo(t))try{e=It(t.styleSheet)||e}catch{}return e}function oo(t){return"styleSheet"in t}var kt=function(){function t(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return t.prototype.getId=function(e){var r;if(!e)return-1;var n=(r=this.getMeta(e))===null||r===void 0?void 0:r.id;return n??-1},t.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},t.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},t.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},t.prototype.removeNodeFromMap=function(e){var r=this,n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach(function(o){return r.removeNodeFromMap(o)})},t.prototype.has=function(e){return this.idNodeMap.has(e)},t.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},t.prototype.add=function(e,r){var n=r.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,r)},t.prototype.replace=function(e,r){var n=this.getNode(e);if(n){var o=this.nodeMetaMap.get(n);o&&this.nodeMetaMap.set(r,o)}this.idNodeMap.set(e,r)},t.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},t}();function br(){return new kt}function Dt(t){var e=t.element,r=t.maskInputOptions,n=t.tagName,o=t.type,i=t.value,s=t.maskInputFn,l=i||"",a=o&&Te(o);return(r[n.toLowerCase()]||a&&r[a])&&(s?l=s(l,e):l="*".repeat(l.length)),l}function Te(t){return t.toLowerCase()}var wr="__rrweb_original__";function io(t){var e=t.getContext("2d");if(!e)return!0;for(var r=50,n=0;n-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}var Ae,Er,po=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,mo=/^(?:[a-z+]+:)?\/\//i,fo=/^www\..*/i,go=/^(data:)([^,]*),(.*)/i;function at(t,e){return(t||"").replace(po,function(r,n,o,i,s,l){var a=o||s||l,c=n||i||"";if(!a)return r;if(mo.test(a)||fo.test(a)||go.test(a))return"url(".concat(c).concat(a).concat(c,")");if(a[0]==="/")return"url(".concat(c).concat(ho(e)+a).concat(c,")");var u=e.split("/"),d=a.split("/");u.pop();for(var h=0,p=d;h=e.length);){var i=n(yo);if(i.slice(-1)===",")i=lt(t,i.substring(0,i.length-1)),o.push(i);else{var s="";i=lt(t,i);for(var l=!1;;){var a=e.charAt(r);if(a===""){o.push((i+s).trim());break}else if(l)a===")"&&(l=!1);else if(a===","){r+=1,o.push((i+s).trim());break}else a==="("&&(l=!0);s+=a,r+=1}}}return o.join(", ")}function lt(t,e){if(!e||e.trim()==="")return e;var r=t.createElement("a");return r.href=e,r.href}function bo(t){return Boolean(t.tagName==="svg"||t.ownerSVGElement)}function Rt(){var t=document.createElement("a");return t.href="",t.href}function Nr(t,e,r,n){return n&&(r==="src"||r==="href"&&!(e==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&(e==="table"||e==="td"||e==="th")?lt(t,n):r==="srcset"?So(t,n):r==="style"?at(n,Rt()):e==="object"&&r==="data"?lt(t,n):n)}function Tr(t,e,r){return(t==="video"||t==="audio")&&e==="autoplay"}function wo(t,e,r){try{if(typeof e=="string"){if(t.classList.contains(e))return!0}else for(var n=t.classList.length;n--;){var o=t.classList[n];if(e.test(o))return!0}if(r)return t.matches(r)}catch{}return!1}function ct(t,e,r){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return r?ct(t.parentNode,e,r):!1;for(var n=t.classList.length;n--;){var o=t.classList[n];if(e.test(o))return!0}return r?ct(t.parentNode,e,r):!1}function Mr(t,e,r){try{var n=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(n===null)return!1;if(typeof e=="string"){if(n.classList.contains(e)||n.closest(".".concat(e)))return!0}else if(ct(n,e,!0))return!0;if(r&&(n.matches(r)||n.closest(r)))return!0}catch{}return!1}function Co(t,e,r){var n=t.contentWindow;if(n){var o=!1,i;try{i=n.document.readyState}catch{return}if(i!=="complete"){var s=setTimeout(function(){o||(e(),o=!0)},r);t.addEventListener("load",function(){clearTimeout(s),o=!0,e()});return}var l="about:blank";if(n.location.href!==l||t.src===l||t.src==="")return setTimeout(e,0),t.addEventListener("load",e);t.addEventListener("load",e)}}function Eo(t,e,r){var n=!1,o;try{o=t.sheet}catch{return}if(!o){var i=setTimeout(function(){n||(e(),n=!0)},r);t.addEventListener("load",function(){clearTimeout(i),n=!0,e()})}}function No(t,e){var r=e.doc,n=e.mirror,o=e.blockClass,i=e.blockSelector,s=e.maskTextClass,l=e.maskTextSelector,a=e.inlineStylesheet,c=e.maskInputOptions,u=c===void 0?{}:c,d=e.maskTextFn,h=e.maskInputFn,p=e.dataURLOptions,m=p===void 0?{}:p,g=e.inlineImages,S=e.recordCanvas,f=e.keepIframeSrcFn,y=e.newlyAddedElement,v=y===void 0?!1:y,C=To(r,n);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:x.Document,childNodes:[],compatMode:t.compatMode}:{type:x.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:x.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:C};case t.ELEMENT_NODE:return Io(t,{doc:r,blockClass:o,blockSelector:i,inlineStylesheet:a,maskInputOptions:u,maskInputFn:h,dataURLOptions:m,inlineImages:g,recordCanvas:S,keepIframeSrcFn:f,newlyAddedElement:v,rootId:C});case t.TEXT_NODE:return Mo(t,{maskTextClass:s,maskTextSelector:l,maskTextFn:d,rootId:C});case t.CDATA_SECTION_NODE:return{type:x.CDATA,textContent:"",rootId:C};case t.COMMENT_NODE:return{type:x.Comment,textContent:t.textContent||"",rootId:C};default:return!1}}function To(t,e){if(e.hasNode(t)){var r=e.getId(t);return r===1?void 0:r}}function Mo(t,e){var r,n=e.maskTextClass,o=e.maskTextSelector,i=e.maskTextFn,s=e.rootId,l=t.parentNode&&t.parentNode.tagName,a=t.textContent,c=l==="STYLE"?!0:void 0,u=l==="SCRIPT"?!0:void 0;if(c&&a){try{t.nextSibling||t.previousSibling||!((r=t.parentNode.sheet)===null||r===void 0)&&r.cssRules&&(a=uo(t.parentNode.sheet))}catch(d){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(d),t)}a=at(a,Rt())}return u&&(a="SCRIPT_PLACEHOLDER"),!c&&!u&&a&&Mr(t,n,o)&&(a=i?i(a):a.replace(/[\S]/g,"*")),{type:x.Text,textContent:a||"",isStyle:c,rootId:s}}function Io(t,e){for(var r=e.doc,n=e.blockClass,o=e.blockSelector,i=e.inlineStylesheet,s=e.maskInputOptions,l=s===void 0?{}:s,a=e.maskInputFn,c=e.dataURLOptions,u=c===void 0?{}:c,d=e.inlineImages,h=e.recordCanvas,p=e.keepIframeSrcFn,m=e.newlyAddedElement,g=m===void 0?!1:m,S=e.rootId,f=wo(t,n,o),y=co(t),v={},C=t.attributes.length,T=0;T'):r.write('')),h=r),n.add(h,t),(t.type===x.Document||t.type===x.Element)&&!i)for(var p=function(f){var y=Ke(f,{doc:r,mirror:n,skipChild:!1,hackCss:l,afterAppend:a,cache:c});if(!y)return console.warn("Failed to rebuild",f),"continue";if(f.isShadow&&vr(h)&&h.shadowRoot)h.shadowRoot.appendChild(y);else if(t.type===x.Document&&f.type==x.Element){var v=y,C=null;v.childNodes.forEach(function(T){T.nodeName==="BODY"&&(C=T)}),C?(v.removeChild(C),h.appendChild(y),v.appendChild(C)):h.appendChild(y)}else h.appendChild(y);a&&a(y,f.id)},m=0,g=t.childNodes;mr.removeEventListener(t,e,n)}const _e=`Please stop import mirror directly. Instead of that,\r now you can use replayer.getMirror() to access the mirror instance of a replayer,\r or you can use record.mirror to access the mirror instance during recording.`;ne.mirror={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)}},typeof window<"u"&&window.Proxy&&window.Reflect&&(ne.mirror=new Proxy(ne.mirror,{get(t,e,r){return e==="map"&&console.error(_e),Reflect.get(t,e,r)}}));function Pe(t,e,r={}){let n=null,o=0;return function(...i){const s=Date.now();!o&&r.leading===!1&&(o=s);const l=e-(s-o),a=this;l<=0||l>e?(n&&(clearTimeout(n),n=null),o=s,t.apply(a,i)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{o=r.leading===!1?0:Date.now(),n=null,t.apply(a,i)},l))}}function Je(t,e,r,n,o=window){const i=o.Object.getOwnPropertyDescriptor(t,e);return o.Object.defineProperty(t,e,n?r:{set(s){setTimeout(()=>{r.set.call(this,s)},0),i&&i.set&&i.set.call(this,s)}}),()=>Je(t,e,i||{},!0)}function Re(t,e,r){try{if(!(e in t))return()=>{};const n=t[e],o=r(n);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:n}})),t[e]=o,()=>{t[e]=n}}catch{return()=>{}}}let Qe=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Qe=()=>new Date().getTime());function Lt(t){var e,r,n,o,i,s;const l=t.document;return{left:l.scrollingElement?l.scrollingElement.scrollLeft:t.pageXOffset!==void 0?t.pageXOffset:l?.documentElement.scrollLeft||((r=(e=l?.body)==null?void 0:e.parentElement)==null?void 0:r.scrollLeft)||((n=l?.body)==null?void 0:n.scrollLeft)||0,top:l.scrollingElement?l.scrollingElement.scrollTop:t.pageYOffset!==void 0?t.pageYOffset:l?.documentElement.scrollTop||((i=(o=l?.body)==null?void 0:o.parentElement)==null?void 0:i.scrollTop)||((s=l?.body)==null?void 0:s.scrollTop)||0}}function At(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Ft(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function le(t,e,r,n){if(!t)return!1;const o=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(!o)return!1;try{if(typeof e=="string"){if(o.classList.contains(e)||n&&o.closest("."+e)!==null)return!0}else if(ct(o,e,n))return!0}catch{}return!!(r&&(o.matches(r)||n&&o.closest(r)!==null))}function xr(t,e){return e.getId(t)!==-1}function ut(t,e){return e.getId(t)===Ze}function _t(t,e){if(Ye(t))return!1;const r=e.getId(t);return e.has(r)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?!1:t.parentNode?_t(t.parentNode,e):!0:!0}function dt(t){return Boolean(t.changedTouches)}function Pt(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let r=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===r)return!0;while(r=r&&r.parentNode);return!1})}function Lr(t){const e={},r=(o,i)=>{const s={value:o,parent:i,children:[]};return e[o.node.id]=s,s},n=[];for(const o of t){const{nextId:i,parentId:s}=o;if(i&&i in e){const l=e[i];if(l.parent){const a=l.parent.children.indexOf(l);l.parent.children.splice(a,0,r(o,l.parent))}else{const a=n.indexOf(l);n.splice(a,0,r(o,null))}continue}if(s in e){const l=e[s];l.children.push(r(o,l));continue}n.push(r(o,null))}return n}function $t(t,e){e(t.value);for(let r=t.children.length-1;r>=0;r--)$t(t.children[r],e)}function $e(t,e){return Boolean(t.nodeName==="IFRAME"&&e.getMeta(t))}function Wt(t,e){return Boolean(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function Ut(t,e){var r,n;const o=(n=(r=t.ownerDocument)==null?void 0:r.defaultView)==null?void 0:n.frameElement;if(!o||o===e)return{x:0,y:0,relativeScale:1,absoluteScale:1};const i=o.getBoundingClientRect(),s=Ut(o,e),l=i.height/o.clientHeight;return{x:i.x*s.relativeScale+s.x,y:i.y*s.relativeScale+s.y,relativeScale:l,absoluteScale:s.absoluteScale*l}}function Me(t){return Boolean(t?.shadowRoot)}function We(t,e){const r=t[e[0]];return e.length===1?r:We(r.cssRules[e[1]].cssRules,e.slice(2))}function jt(t){const e=[...t],r=e.pop();return{positions:e,index:r}}function Ar(t){const e=new Set,r=[];for(let n=t.length;n--;){const o=t[n];e.has(o.id)||(r.push(o),e.add(o.id))}return r}class Vt{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var r;return(r=this.styleIDMap.get(e))!=null?r:-1}has(e){return this.styleIDMap.has(e)}add(e,r){if(this.has(e))return this.getId(e);let n;return r===void 0?n=this.id++:n=r,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 Bt(t){var e,r;let n=null;return((r=(e=t.getRootNode)==null?void 0:e.call(t))==null?void 0:r.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&t.getRootNode().host&&(n=t.getRootNode().host),n}function Fr(t){let e=t,r;for(;r=Bt(e);)e=r;return e}function _r(t){const e=t.ownerDocument;if(!e)return!1;const r=Fr(t);return e.contains(r)}function Gt(t){const e=t.ownerDocument;return e?e.contains(t)||_r(t):!1}var $o=Object.freeze({__proto__:null,on:ae,get _mirror(){return ne.mirror},throttle:Pe,hookSetter:Je,patch:Re,get nowTimestamp(){return Qe},getWindowScroll:Lt,getWindowHeight:At,getWindowWidth:Ft,isBlocked:le,isSerialized:xr,isIgnored:ut,isAncestorRemoved:_t,legacy_isTouchEvent:dt,polyfill:Pt,queueToResolveTrees:Lr,iterateResolveTree:$t,isSerializedIframe:$e,isSerializedStylesheet:Wt,getBaseDimension:Ut,hasShadowRoot:Me,getNestedRule:We,getPositionsAndIndex:jt,uniqueTextMutations:Ar,StyleSheetMirror:Vt,getShadowHost:Bt,getRootShadowHost:Fr,shadowHostInDom:_r,inDom:Gt}),k=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(k||{}),N=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t))(N||{}),$=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))($||{}),be=(t=>(t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t))(be||{}),we=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(we||{}),Ce=(t=>(t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t))(Ce||{}),j=(t=>(t.Start="start",t.Pause="pause",t.Resume="resume",t.Resize="resize",t.Finish="finish",t.FullsnapshotRebuilded="fullsnapshot-rebuilded",t.LoadStylesheetStart="load-stylesheet-start",t.LoadStylesheetEnd="load-stylesheet-end",t.SkipStart="skip-start",t.SkipEnd="skip-end",t.MouseInteraction="mouse-interaction",t.EventCast="event-cast",t.CustomEvent="custom-event",t.Flush="flush",t.StateChange="state-change",t.PlayBack="play-back",t.Destroy="destroy",t))(j||{});function Pr(t){return"__ln"in t}class Wo{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let n=0;n`${t}@${e}`;class Uo{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=[],r=new Wo,n=l=>{let a=l,c=Ze;for(;c===Ze;)a=a&&a.nextSibling,c=a&&this.mirror.getId(a);return c},o=l=>{if(!l.parentNode||!Gt(l))return;const a=Ye(l.parentNode)?this.mirror.getId(Bt(l)):this.mirror.getId(l.parentNode),c=n(l);if(a===-1||c===-1)return r.addNode(l);const u=Fe(l,{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:d=>{$e(d,this.mirror)&&this.iframeManager.addIframe(d),Wt(d,this.mirror)&&this.stylesheetManager.trackLinkElement(d),Me(l)&&this.shadowDomManager.addShadowRoot(l.shadowRoot,this.doc)},onIframeLoad:(d,h)=>{this.iframeManager.attachIframe(d,h),this.shadowDomManager.observeAttachShadow(d)},onStylesheetLoad:(d,h)=>{this.stylesheetManager.attachLinkElement(d,h)}});u&&e.push({parentId:a,nextId:c,node:u})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const l of this.movedSet)Wr(this.removes,l,this.mirror)&&!this.movedSet.has(l.parentNode)||o(l);for(const l of this.addedSet)!jr(this.droppedSet,l)&&!Wr(this.removes,l,this.mirror)||jr(this.movedSet,l)?o(l):this.droppedSet.add(l);let i=null;for(;r.length;){let l=null;if(i){const a=this.mirror.getId(i.value.parentNode),c=n(i.value);a!==-1&&c!==-1&&(l=i)}if(!l){let a=r.tail;for(;a;){const c=a;if(a=a.previous,c){const u=this.mirror.getId(c.value.parentNode);if(n(c.value)===-1)continue;if(u!==-1){l=c;break}else{const d=c.value;if(d.parentNode&&d.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const h=d.parentNode.host;if(this.mirror.getId(h)!==-1){l=c;break}}}}}}if(!l){for(;r.head;)r.removeNode(r.head.value);break}i=l.previous,r.removeNode(l.value),o(l.value)}const s={texts:this.texts.map(l=>({id:this.mirror.getId(l.node),value:l.value})).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.map(l=>({id:this.mirror.getId(l.node),attributes:l.attributes})).filter(l=>this.mirror.has(l.id)),removes:this.removes,adds:e};!s.texts.length&&!s.attributes.length&&!s.removes.length&&!s.adds.length||(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(s))},this.processMutation=e=>{if(ut(e.target,this.mirror))return;let r;try{r=document.implementation.createHTMLDocument()}catch{r=this.doc}switch(e.type){case"characterData":{const n=e.target.textContent;!le(e.target,this.blockClass,this.blockSelector,!1)&&n!==e.oldValue&&this.texts.push({value:Mr(e.target,this.maskTextClass,this.maskTextSelector)&&n?this.maskTextFn?this.maskTextFn(n):n.replace(/[\S]/g,"*"):n,node:e.target});break}case"attributes":{const n=e.target;let o=e.attributeName,i=e.target.getAttribute(o);if(o==="value"){const l=Ot(n);i=Dt({element:n,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:l,value:i,maskInputFn:this.maskInputFn})}if(le(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let s=this.attributes.find(l=>l.node===e.target);if(n.tagName==="IFRAME"&&o==="src"&&!this.keepIframeSrcFn(i))if(!n.contentDocument)o="rr_src";else return;if(s||(s={node:e.target,attributes:{}},this.attributes.push(s)),o==="type"&&n.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&n.setAttribute("data-rr-is-password","true"),o==="style"){const l=r.createElement("span");e.oldValue&&l.setAttribute("style",e.oldValue),(s.attributes.style===void 0||s.attributes.style===null)&&(s.attributes.style={});const a=s.attributes.style;for(const c of Array.from(n.style)){const u=n.style.getPropertyValue(c),d=n.style.getPropertyPriority(c);(u!==l.style.getPropertyValue(c)||d!==l.style.getPropertyPriority(c))&&(d===""?a[c]=u:a[c]=[u,d])}for(const c of Array.from(l.style))n.style.getPropertyValue(c)===""&&(a[c]=!1)}else Tr(n.tagName,o)||(s.attributes[o]=Nr(this.doc,Te(n.tagName),Te(o),i));break}case"childList":{if(le(e.target,this.blockClass,this.blockSelector,!0))return;e.addedNodes.forEach(n=>this.genAdds(n,e.target)),e.removedNodes.forEach(n=>{const o=this.mirror.getId(n),i=Ye(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);le(e.target,this.blockClass,this.blockSelector,!1)||ut(n,this.mirror)||!xr(n,this.mirror)||(this.addedSet.has(n)?(zt(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(e.target)&&o===-1||_t(e.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[$r(o,i)]?zt(this.movedSet,n):this.removes.push({parentId:i,id:o,isShadow:Ye(e.target)&&Xe(e.target)?!0:void 0})),this.mapRemoves.push(n))});break}}},this.genAdds=(e,r)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(ut(e,this.mirror))return;this.movedSet.add(e);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[$r(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);le(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach(n=>this.genAdds(n)),Me(e)&&e.shadowRoot.childNodes.forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,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(r=>{this[r]=e[r]})}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 zt(t,e){t.delete(e),e.childNodes.forEach(r=>zt(t,r))}function Wr(t,e,r){return t.length===0?!1:Ur(t,e,r)}function Ur(t,e,r){const{parentNode:n}=e;if(!n)return!1;const o=r.getId(n);return t.some(i=>i.id===o)?!0:Ur(t,n,r)}function jr(t,e){return t.size===0?!1:Vr(t,e)}function Vr(t,e){const{parentNode:r}=e;return r?t.has(r)?!0:Vr(t,r):!1}let qe;function jo(t){qe=t}function Vo(){qe=void 0}const _=t=>qe?(...e)=>{try{return t(...e)}catch(r){if(qe&&qe(r)===!0)return;throw r}}:t;var Bo=Object.defineProperty,Go=Object.defineProperties,zo=Object.getOwnPropertyDescriptors,Br=Object.getOwnPropertySymbols,Ho=Object.prototype.hasOwnProperty,Yo=Object.prototype.propertyIsEnumerable,Gr=(t,e,r)=>e in t?Bo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ht=(t,e)=>{for(var r in e||(e={}))Ho.call(e,r)&&Gr(t,r,e[r]);if(Br)for(var r of Br(e))Yo.call(e,r)&&Gr(t,r,e[r]);return t},Xo=(t,e)=>Go(t,zo(e));const xe=[];function et(t){try{if("composedPath"in t){const e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0];return t.target}catch{return t.target}}function zr(t,e){var r,n;const o=new Uo;xe.push(o),o.init(t);let i=window.MutationObserver||window.__rrMutationObserver;const s=(n=(r=window?.Zone)==null?void 0:r.__symbol__)==null?void 0:n.call(r,"MutationObserver");s&&window[s]&&(i=window[s]);const l=new i(_(o.processMutations.bind(o)));return l.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),l}function Zo({mousemoveCb:t,sampling:e,doc:r,mirror:n}){if(e.mousemove===!1)return()=>{};const o=typeof e.mousemove=="number"?e.mousemove:50,i=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let s=[],l;const a=Pe(_(d=>{const h=Date.now()-l;t(s.map(p=>(p.timeOffset-=h,p)),d),s=[],l=null}),i),c=_(Pe(_(d=>{const h=et(d),{clientX:p,clientY:m}=dt(d)?d.changedTouches[0]:d;l||(l=Qe()),s.push({x:p,y:m,id:n.getId(h),timeOffset:Qe()-l}),a(typeof DragEvent<"u"&&d instanceof DragEvent?N.Drag:d instanceof MouseEvent?N.MouseMove:N.TouchMove)}),o,{trailing:!1})),u=[ae("mousemove",c,r),ae("touchmove",c,r),ae("drag",c,r)];return _(()=>{u.forEach(d=>d())})}function Ko({mouseInteractionCb:t,doc:e,mirror:r,blockClass:n,blockSelector:o,sampling:i}){if(i.mouseInteraction===!1)return()=>{};const s=i.mouseInteraction===!0||i.mouseInteraction===void 0?{}:i.mouseInteraction,l=[];let a=null;const c=u=>d=>{const h=et(d);if(le(h,n,o,!0))return;let p=null,m=u;if("pointerType"in d){switch(d.pointerType){case"mouse":p=be.Mouse;break;case"touch":p=be.Touch;break;case"pen":p=be.Pen;break}p===be.Touch?$[u]===$.MouseDown?m="TouchStart":$[u]===$.MouseUp&&(m="TouchEnd"):be.Pen}else dt(d)&&(p=be.Touch);p!==null?(a=p,(m.startsWith("Touch")&&p===be.Touch||m.startsWith("Mouse")&&p===be.Mouse)&&(p=null)):$[u]===$.Click&&(p=a,a=null);const g=dt(d)?d.changedTouches[0]:d;if(!g)return;const S=r.getId(h),{clientX:f,clientY:y}=g;_(t)(Ht({type:$[m],id:S,x:f,y},p!==null&&{pointerType:p}))};return Object.keys($).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&s[u]!==!1).forEach(u=>{let d=Te(u);const h=c(u);if(window.PointerEvent)switch($[u]){case $.MouseDown:case $.MouseUp:d=d.replace("mouse","pointer");break;case $.TouchStart:case $.TouchEnd:return}l.push(ae(d,h,e))}),_(()=>{l.forEach(u=>u())})}function Hr({scrollCb:t,doc:e,mirror:r,blockClass:n,blockSelector:o,sampling:i}){const s=_(Pe(_(l=>{const a=et(l);if(!a||le(a,n,o,!0))return;const c=r.getId(a);if(a===e&&e.defaultView){const u=Lt(e.defaultView);t({id:c,x:u.left,y:u.top})}else t({id:c,x:a.scrollLeft,y:a.scrollTop})}),i.scroll||100));return ae("scroll",s,e)}function Jo({viewportResizeCb:t}){let e=-1,r=-1;const n=_(Pe(_(()=>{const o=At(),i=Ft();(e!==o||r!==i)&&(t({width:Number(i),height:Number(o)}),e=o,r=i)}),200));return ae("resize",n,window)}function Yr(t,e){const r=Ht({},t);return e||delete r.userTriggered,r}const Qo=["INPUT","TEXTAREA","SELECT"],Xr=new WeakMap;function qo({inputCb:t,doc:e,mirror:r,blockClass:n,blockSelector:o,ignoreClass:i,maskInputOptions:s,maskInputFn:l,sampling:a,userTriggeredOnInput:c}){function u(S){let f=et(S);const y=S.isTrusted,v=f&&f.tagName;if(f&&v==="OPTION"&&(f=f.parentElement),!f||!v||Qo.indexOf(v)<0||le(f,n,o,!0)||f.classList.contains(i))return;let C=f.value,T=!1;const I=Ot(f)||"";I==="radio"||I==="checkbox"?T=f.checked:(s[v.toLowerCase()]||s[I])&&(C=Dt({element:f,maskInputOptions:s,tagName:v,type:I,value:C,maskInputFn:l})),d(f,_(Yr)({text:C,isChecked:T,userTriggered:y},c));const L=f.name;I==="radio"&&L&&T&&e.querySelectorAll(`input[type="radio"][name="${L}"]`).forEach(E=>{E!==f&&d(E,_(Yr)({text:E.value,isChecked:!T,userTriggered:!1},c))})}function d(S,f){const y=Xr.get(S);if(!y||y.text!==f.text||y.isChecked!==f.isChecked){Xr.set(S,f);const v=r.getId(S);_(t)(Xo(Ht({},f),{id:v}))}}const h=(a.input==="last"?["change"]:["input","change"]).map(S=>ae(S,_(u),e)),p=e.defaultView;if(!p)return()=>{h.forEach(S=>S())};const m=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value"),g=[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&h.push(...g.map(S=>Je(S[0],S[1],{set(){_(u)({target:this,isTrusted:!1})}},!1,p))),_(()=>{h.forEach(S=>S())})}function ht(t){const e=[];function r(n,o){if(pt("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||pt("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||pt("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||pt("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){const i=Array.from(n.parentRule.cssRules).indexOf(n);o.unshift(i)}else if(n.parentStyleSheet){const i=Array.from(n.parentStyleSheet.cssRules).indexOf(n);o.unshift(i)}return o}return r(t,e)}function Ie(t,e,r){let n,o;return t?(t.ownerNode?n=e.getId(t.ownerNode):o=r.getId(t),{styleId:o,id:n}):{}}function ei({styleSheetRuleCb:t,mirror:e,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};const o=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:_((u,d,h)=>{const[p,m]=h,{id:g,styleId:S}=Ie(d,e,r.styleMirror);return(g&&g!==-1||S&&S!==-1)&&t({id:g,styleId:S,adds:[{rule:p,index:m}]}),u.apply(d,h)})});const i=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:_((u,d,h)=>{const[p]=h,{id:m,styleId:g}=Ie(d,e,r.styleMirror);return(m&&m!==-1||g&&g!==-1)&&t({id:m,styleId:g,removes:[{index:p}]}),u.apply(d,h)})});let s;n.CSSStyleSheet.prototype.replace&&(s=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:_((u,d,h)=>{const[p]=h,{id:m,styleId:g}=Ie(d,e,r.styleMirror);return(m&&m!==-1||g&&g!==-1)&&t({id:m,styleId:g,replace:p}),u.apply(d,h)})}));let l;n.CSSStyleSheet.prototype.replaceSync&&(l=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:_((u,d,h)=>{const[p]=h,{id:m,styleId:g}=Ie(d,e,r.styleMirror);return(m&&m!==-1||g&&g!==-1)&&t({id:m,styleId:g,replaceSync:p}),u.apply(d,h)})}));const a={};mt("CSSGroupingRule")?a.CSSGroupingRule=n.CSSGroupingRule:(mt("CSSMediaRule")&&(a.CSSMediaRule=n.CSSMediaRule),mt("CSSConditionRule")&&(a.CSSConditionRule=n.CSSConditionRule),mt("CSSSupportsRule")&&(a.CSSSupportsRule=n.CSSSupportsRule));const c={};return Object.entries(a).forEach(([u,d])=>{c[u]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(c[u].insertRule,{apply:_((h,p,m)=>{const[g,S]=m,{id:f,styleId:y}=Ie(p.parentStyleSheet,e,r.styleMirror);return(f&&f!==-1||y&&y!==-1)&&t({id:f,styleId:y,adds:[{rule:g,index:[...ht(p),S||0]}]}),h.apply(p,m)})}),d.prototype.deleteRule=new Proxy(c[u].deleteRule,{apply:_((h,p,m)=>{const[g]=m,{id:S,styleId:f}=Ie(p.parentStyleSheet,e,r.styleMirror);return(S&&S!==-1||f&&f!==-1)&&t({id:S,styleId:f,removes:[{index:[...ht(p),g]}]}),h.apply(p,m)})})}),_(()=>{n.CSSStyleSheet.prototype.insertRule=o,n.CSSStyleSheet.prototype.deleteRule=i,s&&(n.CSSStyleSheet.prototype.replace=s),l&&(n.CSSStyleSheet.prototype.replaceSync=l),Object.entries(a).forEach(([u,d])=>{d.prototype.insertRule=c[u].insertRule,d.prototype.deleteRule=c[u].deleteRule})})}function Zr({mirror:t,stylesheetManager:e},r){var n,o,i;let s=null;r.nodeName==="#document"?s=t.getId(r):s=t.getId(r.host);const l=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(i=(o=r.ownerDocument)==null?void 0:o.defaultView)==null?void 0:i.ShadowRoot,a=Object.getOwnPropertyDescriptor(l?.prototype,"adoptedStyleSheets");return s===null||s===-1||!l||!a?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var c;return(c=a.get)==null?void 0:c.call(this)},set(c){var u;const d=(u=a.set)==null?void 0:u.call(this,c);if(s!==null&&s!==-1)try{e.adoptStyleSheets(c,s)}catch{}return d}}),_(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function ti({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:r,stylesheetManager:n},{win:o}){const i=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(i,{apply:_((l,a,c)=>{var u;const[d,h,p]=c;if(r.has(d))return i.apply(a,[d,h,p]);const{id:m,styleId:g}=Ie((u=a.parentRule)==null?void 0:u.parentStyleSheet,e,n.styleMirror);return(m&&m!==-1||g&&g!==-1)&&t({id:m,styleId:g,set:{property:d,value:h,priority:p},index:ht(a.parentRule)}),l.apply(a,c)})});const s=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:_((l,a,c)=>{var u;const[d]=c;if(r.has(d))return s.apply(a,[d]);const{id:h,styleId:p}=Ie((u=a.parentRule)==null?void 0:u.parentStyleSheet,e,n.styleMirror);return(h&&h!==-1||p&&p!==-1)&&t({id:h,styleId:p,remove:{property:d},index:ht(a.parentRule)}),l.apply(a,c)})}),_(()=>{o.CSSStyleDeclaration.prototype.setProperty=i,o.CSSStyleDeclaration.prototype.removeProperty=s})}function ri({mediaInteractionCb:t,blockClass:e,blockSelector:r,mirror:n,sampling:o}){const i=_(l=>Pe(_(a=>{const c=et(a);if(!c||le(c,e,r,!0))return;const{currentTime:u,volume:d,muted:h,playbackRate:p}=c;t({type:l,id:n.getId(c),currentTime:u,volume:d,muted:h,playbackRate:p})}),o.media||500)),s=[ae("play",i(Ce.Play)),ae("pause",i(Ce.Pause)),ae("seeked",i(Ce.Seeked)),ae("volumechange",i(Ce.VolumeChange)),ae("ratechange",i(Ce.RateChange))];return _(()=>{s.forEach(l=>l())})}function ni({fontCb:t,doc:e}){const r=e.defaultView;if(!r)return()=>{};const n=[],o=new WeakMap,i=r.FontFace;r.FontFace=function(l,a,c){const u=new i(l,a,c);return o.set(u,{family:l,buffer:typeof a!="string",descriptors:c,fontSource:typeof a=="string"?a:JSON.stringify(Array.from(new Uint8Array(a)))}),u};const s=Re(e.fonts,"add",function(l){return function(a){return setTimeout(_(()=>{const c=o.get(a);c&&(t(c),o.delete(a))}),0),l.apply(this,[a])}});return n.push(()=>{r.FontFace=i}),n.push(s),_(()=>{n.forEach(l=>l())})}function oi(t){const{doc:e,mirror:r,blockClass:n,blockSelector:o,selectionCb:i}=t;let s=!0;const l=_(()=>{const a=e.getSelection();if(!a||s&&a?.isCollapsed)return;s=a.isCollapsed||!1;const c=[],u=a.rangeCount||0;for(let d=0;d{e.mutation&&e.mutation(...m),r(...m)},t.mousemoveCb=(...m)=>{e.mousemove&&e.mousemove(...m),n(...m)},t.mouseInteractionCb=(...m)=>{e.mouseInteraction&&e.mouseInteraction(...m),o(...m)},t.scrollCb=(...m)=>{e.scroll&&e.scroll(...m),i(...m)},t.viewportResizeCb=(...m)=>{e.viewportResize&&e.viewportResize(...m),s(...m)},t.inputCb=(...m)=>{e.input&&e.input(...m),l(...m)},t.mediaInteractionCb=(...m)=>{e.mediaInteaction&&e.mediaInteaction(...m),a(...m)},t.styleSheetRuleCb=(...m)=>{e.styleSheetRule&&e.styleSheetRule(...m),c(...m)},t.styleDeclarationCb=(...m)=>{e.styleDeclaration&&e.styleDeclaration(...m),u(...m)},t.canvasMutationCb=(...m)=>{e.canvasMutation&&e.canvasMutation(...m),d(...m)},t.fontCb=(...m)=>{e.font&&e.font(...m),h(...m)},t.selectionCb=(...m)=>{e.selection&&e.selection(...m),p(...m)}}function si(t,e={}){const r=t.doc.defaultView;if(!r)return()=>{};ii(t,e);const n=zr(t,t.doc),o=Zo(t),i=Ko(t),s=Hr(t),l=Jo(t),a=qo(t),c=ri(t),u=ei(t,{win:r}),d=Zr(t,t.doc),h=ti(t,{win:r}),p=t.collectFonts?ni(t):()=>{},m=oi(t),g=[];for(const S of t.plugins)g.push(S.observer(S.callback,r,S.options));return _(()=>{xe.forEach(S=>S.reset()),n.disconnect(),o(),i(),s(),l(),a(),c(),u(),d(),h(),p(),m(),g.forEach(S=>S())})}function pt(t){return typeof window[t]<"u"}function mt(t){return Boolean(typeof window[t]<"u"&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}class Kr{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,r,n,o){const i=n||this.getIdToRemoteIdMap(e),s=o||this.getRemoteIdToIdMap(e);let l=i.get(r);return l||(l=this.generateIdFn(),i.set(r,l),s.set(l,r)),l}getIds(e,r){const n=this.getIdToRemoteIdMap(e),o=this.getRemoteIdToIdMap(e);return r.map(i=>this.getId(e,i,n,o))}getRemoteId(e,r,n){const o=n||this.getRemoteIdToIdMap(e);return typeof r!="number"?r:o.get(r)||-1}getRemoteIds(e,r){const n=this.getRemoteIdToIdMap(e);return r.map(o=>this.getRemoteId(e,o,n))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let r=this.iframeIdToRemoteIdMap.get(e);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(e,r)),r}getRemoteIdToIdMap(e){let r=this.iframeRemoteIdToIdMap.get(e);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(e,r)),r}}class ai{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Kr(Cr),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Kr(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,r){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(n=this.loadListener)==null||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 r=e;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const o=this.transformCrossOriginEvent(n,r.data.event);o&&this.wrappedEmit(o,r.data.isCheckout)}transformCrossOriginEvent(e,r){var n;switch(r.type){case k.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(r.data.node,e);const o=r.data.node.id;return this.crossOriginIframeRootIdMap.set(e,o),this.patchRootIdOnNode(r.data.node,o),{timestamp:r.timestamp,type:k.IncrementalSnapshot,data:{source:N.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case k.Meta:case k.Load:case k.DomContentLoaded:return!1;case k.Plugin:return r;case k.Custom:return this.replaceIds(r.data.payload,e,["id","parentId","previousId","nextId"]),r;case k.IncrementalSnapshot:switch(r.data.source){case N.Mutation:return r.data.adds.forEach(o=>{this.replaceIds(o,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,e);const i=this.crossOriginIframeRootIdMap.get(e);i&&this.patchRootIdOnNode(o.node,i)}),r.data.removes.forEach(o=>{this.replaceIds(o,e,["parentId","id"])}),r.data.attributes.forEach(o=>{this.replaceIds(o,e,["id"])}),r.data.texts.forEach(o=>{this.replaceIds(o,e,["id"])}),r;case N.Drag:case N.TouchMove:case N.MouseMove:return r.data.positions.forEach(o=>{this.replaceIds(o,e,["id"])}),r;case N.ViewportResize:return!1;case N.MediaInteraction:case N.MouseInteraction:case N.Scroll:case N.CanvasMutation:case N.Input:return this.replaceIds(r.data,e,["id"]),r;case N.StyleSheetRule:case N.StyleDeclaration:return this.replaceIds(r.data,e,["id"]),this.replaceStyleIds(r.data,e,["styleId"]),r;case N.Font:return r;case N.Selection:return r.data.ranges.forEach(o=>{this.replaceIds(o,e,["start","end"])}),r;case N.AdoptedStyleSheet:return this.replaceIds(r.data,e,["id"]),this.replaceStyleIds(r.data,e,["styleIds"]),(n=r.data.styles)==null||n.forEach(o=>{this.replaceStyleIds(o,e,["styleId"])}),r}}}replace(e,r,n,o){for(const i of o)!Array.isArray(r[i])&&typeof r[i]!="number"||(Array.isArray(r[i])?r[i]=e.getIds(n,r[i]):r[i]=e.getId(n,r[i]));return r}replaceIds(e,r,n){return this.replace(this.crossOriginIframeMirror,e,r,n)}replaceStyleIds(e,r,n){return this.replace(this.crossOriginIframeStyleMirror,e,r,n)}replaceIdOnNode(e,r){this.replaceIds(e,r,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(e,r){e.type!==x.Document&&!e.rootId&&(e.rootId=r),"childNodes"in e&&e.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}}var li=Object.defineProperty,ci=Object.defineProperties,ui=Object.getOwnPropertyDescriptors,Jr=Object.getOwnPropertySymbols,di=Object.prototype.hasOwnProperty,hi=Object.prototype.propertyIsEnumerable,Qr=(t,e,r)=>e in t?li(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,qr=(t,e)=>{for(var r in e||(e={}))di.call(e,r)&&Qr(t,r,e[r]);if(Jr)for(var r of Jr(e))hi.call(e,r)&&Qr(t,r,e[r]);return t},en=(t,e)=>ci(t,ui(e));class pi{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,r){if(!Xe(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=zr(en(qr({},this.bypassOptions),{doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(Hr(en(qr({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(Zr({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,r){const n=this;this.restoreHandlers.push(Re(e.prototype,"attachShadow",function(o){return function(i){const s=o.call(this,i);return this.shadowRoot&&Gt(this)&&n.addShadowRoot(this.shadowRoot,r),s}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var Ue="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",tt=typeof Uint8Array>"u"?[]:new Uint8Array(256),ft=0;ft>2],o+=Ue[(e[r]&3)<<4|e[r+1]>>4],o+=Ue[(e[r+1]&15)<<2|e[r+2]>>6],o+=Ue[e[r+2]&63];return n%3===2?o=o.substring(0,o.length-1)+"=":n%3===1&&(o=o.substring(0,o.length-2)+"=="),o},fi=function(t){var e=t.length*.75,r=t.length,n,o=0,i,s,l,a;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);var c=new ArrayBuffer(e),u=new Uint8Array(c);for(n=0;n>4,u[o++]=(s&15)<<4|l>>2,u[o++]=(l&3)<<6|a&63;return c};const tn=new Map;function gi(t,e){let r=tn.get(t);return r||(r=new Map,tn.set(t,r)),r.has(e)||r.set(e,[]),r.get(e)}const rn=(t,e,r)=>{if(!t||!(on(t,e)||typeof t=="object"))return;const n=t.constructor.name,o=gi(r,n);let i=o.indexOf(t);return i===-1&&(i=o.length,o.push(t)),i};function gt(t,e,r){if(t instanceof Array)return t.map(n=>gt(n,e,r));if(t===null)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer){const n=t.constructor.name,o=mi(t);return{rr_type:n,base64:o}}else{if(t instanceof DataView)return{rr_type:t.constructor.name,args:[gt(t.buffer,e,r),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){const n=t.constructor.name,{src:o}=t;return{rr_type:n,src:o}}else if(t instanceof HTMLCanvasElement){const n="HTMLImageElement",o=t.toDataURL();return{rr_type:n,src:o}}else{if(t instanceof ImageData)return{rr_type:t.constructor.name,args:[gt(t.data,e,r),t.width,t.height]};if(on(t,e)||typeof t=="object"){const n=t.constructor.name,o=rn(t,e,r);return{rr_type:n,index:o}}}}return t}const nn=(t,e,r)=>[...t].map(n=>gt(n,e,r)),on=(t,e)=>{const r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(n=>typeof e[n]=="function");return Boolean(r.find(n=>t instanceof e[n]))};function yi(t,e,r,n){const o=[],i=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const s of i)try{if(typeof e.CanvasRenderingContext2D.prototype[s]!="function")continue;const l=Re(e.CanvasRenderingContext2D.prototype,s,function(a){return function(...c){return le(this.canvas,r,n,!0)||setTimeout(()=>{const u=nn([...c],e,this);t(this.canvas,{type:we["2D"],property:s,args:u})},0),a.apply(this,c)}});o.push(l)}catch{const a=Je(e.CanvasRenderingContext2D.prototype,s,{set(c){t(this.canvas,{type:we["2D"],property:s,args:[c],setter:!0})}});o.push(a)}return()=>{o.forEach(s=>s())}}function sn(t,e,r){const n=[];try{const o=Re(t.HTMLCanvasElement.prototype,"getContext",function(i){return function(s,...l){return le(this,e,r,!0)||"__context"in this||(this.__context=s),i.apply(this,[s,...l])}});n.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach(o=>o())}}function an(t,e,r,n,o,i,s){const l=[],a=Object.getOwnPropertyNames(t);for(const c of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(c))try{if(typeof t[c]!="function")continue;const u=Re(t,c,function(d){return function(...h){const p=d.apply(this,h);if(rn(p,s,this),!le(this.canvas,n,o,!0)){const m=nn([...h],s,this),g={type:e,property:c,args:m};r(this.canvas,g)}return p}});l.push(u)}catch{const d=Je(t,c,{set(h){r(this.canvas,{type:e,property:c,args:[h],setter:!0})}});l.push(d)}return l}function vi(t,e,r,n,o){const i=[];return i.push(...an(e.WebGLRenderingContext.prototype,we.WebGL,t,r,n,o,e)),typeof e.WebGL2RenderingContext<"u"&&i.push(...an(e.WebGL2RenderingContext.prototype,we.WebGL2,t,r,n,o,e)),()=>{i.forEach(s=>s())}}function Si(t,e){var r=atob(t);if(e){for(var n=new Uint8Array(r.length),o=0,i=r.length;o{var r={};for(var n in t)Ei.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&ln)for(var n of ln(t))e.indexOf(n)<0&&Ni.call(t,n)&&(r[n]=t[n]);return r},Mi=(t,e,r)=>new Promise((n,o)=>{var i=a=>{try{l(r.next(a))}catch(c){o(c)}},s=a=>{try{l(r.throw(a))}catch(c){o(c)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(i,s);l((r=r.apply(t,e)).next())});class Ii{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(a,c)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(c)};const{sampling:r="all",win:n,blockClass:o,blockSelector:i,recordCanvas:s,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,s&&r==="all"&&this.initCanvasMutationObserver(n,o,i),s&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,o,i,{dataURLOptions:l})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,r,n,o,i){const s=sn(r,n,o),l=new Map,a=new Ci;a.onmessage=m=>{const{id:g}=m.data;if(l.set(g,!1),!("base64"in m.data))return;const{base64:S,type:f,width:y,height:v}=m.data;this.mutationCb({id:g,type:we["2D"],commands:[{property:"clearRect",args:[0,0,y,v]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:S}],type:f}]},0,0]}]})};const c=1e3/e;let u=0,d;const h=()=>{const m=[];return r.document.querySelectorAll("canvas").forEach(g=>{le(g,n,o,!0)||m.push(g)}),m},p=m=>{if(u&&m-uMi(this,null,function*(){var S;const f=this.mirror.getId(g);if(l.get(f))return;if(l.set(f,!0),["webgl","webgl2"].includes(g.__context)){const v=g.getContext(g.__context);((S=v?.getContextAttributes())==null?void 0:S.preserveDrawingBuffer)===!1&&v?.clear(v.COLOR_BUFFER_BIT)}const y=yield createImageBitmap(g);a.postMessage({id:f,bitmap:y,width:g.width,height:g.height,dataURLOptions:i.dataURLOptions},[y])})),d=requestAnimationFrame(p)};d=requestAnimationFrame(p),this.resetObservers=()=>{s(),cancelAnimationFrame(d)}}initCanvasMutationObserver(e,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const o=sn(e,r,n),i=yi(this.processMutation.bind(this),e,r,n),s=vi(this.processMutation.bind(this),e,r,n,this.mirror);this.resetObservers=()=>{o(),i(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=r=>{this.rafStamps.latestId=r,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,r)=>{const n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,r){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||r===-1)return;const o=n.map(s=>Ti(s,["type"])),{type:i}=n[0];this.mutationCb({id:r,type:i,commands:o}),this.pendingCanvasMutations.delete(e)}}class ki{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new Vt,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,r){if(e.length===0)return;const n={id:r,styleIds:[]},o=[];for(const i of e){let s;if(this.styleMirror.has(i))s=this.styleMirror.getId(i);else{s=this.styleMirror.add(i);const l=Array.from(i.rules||CSSRule);o.push({styleId:s,rules:l.map((a,c)=>({rule:Sr(a),index:c}))})}n.styleIds.push(s)}o.length>0&&(n.styles=o),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class Di{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame(()=>{this.clear(),this.loop&&this.periodicallyClear()})}inOtherBuffer(e,r){const n=this.nodeMap.get(e);return n&&Array.from(n).some(o=>o!==r)}add(e,r){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(r))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}var Oi=Object.defineProperty,Ri=Object.defineProperties,xi=Object.getOwnPropertyDescriptors,cn=Object.getOwnPropertySymbols,Li=Object.prototype.hasOwnProperty,Ai=Object.prototype.propertyIsEnumerable,un=(t,e,r)=>e in t?Oi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,he=(t,e)=>{for(var r in e||(e={}))Li.call(e,r)&&un(t,r,e[r]);if(cn)for(var r of cn(e))Ai.call(e,r)&&un(t,r,e[r]);return t},Fi=(t,e)=>Ri(t,xi(e));function oe(t){return Fi(he({},t),{timestamp:Qe()})}let re,yt,Yt,vt=!1;const fe=br();function Le(t={}){const{emit:e,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:o="rr-block",blockSelector:i=null,ignoreClass:s="rr-ignore",maskTextClass:l="rr-mask",maskTextSelector:a=null,inlineStylesheet:c=!0,maskAllInputs:u,maskInputOptions:d,slimDOMOptions:h,maskInputFn:p,maskTextFn:m,hooks:g,packFn:S,sampling:f={},dataURLOptions:y={},mousemoveWait:v,recordCanvas:C=!1,recordCrossOriginIframes:T=!1,recordAfter:I=t.recordAfter==="DOMContentLoaded"?t.recordAfter:"load",userTriggeredOnInput:L=!1,collectFonts:E=!1,inlineImages:Y=!1,plugins:W,keepIframeSrcFn:q=()=>!1,ignoreCSSAttributes:U=new Set([]),errorHandler:V}=t;jo(V);const B=T?window.parent===window:!0;let A=!1;if(!B)try{window.parent.document&&(A=!1)}catch{A=!0}if(B&&!e)throw new Error("emit function is required");v!==void 0&&f.mousemove===void 0&&(f.mousemove=v),fe.reset();const F=u===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:d!==void 0?d:{password:!0},O=h===!0||h==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:h==="all",headMetaDescKeywords:h==="all"}:h||{};Pt();let G,w=0;const b=R=>{for(const ie of W||[])ie.eventProcessor&&(R=ie.eventProcessor(R));return S&&!A&&(R=S(R)),R};re=(R,ie)=>{var H;if(((H=xe[0])==null?void 0:H.isFrozen())&&R.type!==k.FullSnapshot&&!(R.type===k.IncrementalSnapshot&&R.data.source===N.Mutation)&&xe.forEach(Q=>Q.unfreeze()),B)e?.(b(R),ie);else if(A){const Q={type:"rrweb",event:b(R),origin:window.location.origin,isCheckout:ie};window.parent.postMessage(Q,"*")}if(R.type===k.FullSnapshot)G=R,w=0;else if(R.type===k.IncrementalSnapshot){if(R.data.source===N.Mutation&&R.data.isAttachIframe)return;w++;const Q=n&&w>=n,Ne=r&&R.timestamp-G.timestamp>r;(Q||Ne)&&yt(!0)}};const M=R=>{re(oe({type:k.IncrementalSnapshot,data:he({source:N.Mutation},R)}))},D=R=>re(oe({type:k.IncrementalSnapshot,data:he({source:N.Scroll},R)})),z=R=>re(oe({type:k.IncrementalSnapshot,data:he({source:N.CanvasMutation},R)})),ee=R=>re(oe({type:k.IncrementalSnapshot,data:he({source:N.AdoptedStyleSheet},R)})),X=new ki({mutationCb:M,adoptedStyleSheetCb:ee}),ce=new ai({mirror:fe,mutationCb:M,stylesheetManager:X,recordCrossOriginIframes:T,wrappedEmit:re});for(const R of W||[])R.getMirror&&R.getMirror({nodeMirror:fe,crossOriginIframeMirror:ce.crossOriginIframeMirror,crossOriginIframeStyleMirror:ce.crossOriginIframeStyleMirror});const me=new Di;Yt=new Ii({recordCanvas:C,mutationCb:z,win:window,blockClass:o,blockSelector:i,mirror:fe,sampling:f.canvas,dataURLOptions:y});const de=new pi({mutationCb:M,scrollCb:D,bypassOptions:{blockClass:o,blockSelector:i,maskTextClass:l,maskTextSelector:a,inlineStylesheet:c,maskInputOptions:F,dataURLOptions:y,maskTextFn:m,maskInputFn:p,recordCanvas:C,inlineImages:Y,sampling:f,slimDOMOptions:O,iframeManager:ce,stylesheetManager:X,canvasManager:Yt,keepIframeSrcFn:q,processedNodeManager:me},mirror:fe});yt=(R=!1)=>{re(oe({type:k.Meta,data:{href:window.location.href,width:Ft(),height:At()}}),R),X.reset(),de.init(),xe.forEach(H=>H.lock());const ie=Do(document,{mirror:fe,blockClass:o,blockSelector:i,maskTextClass:l,maskTextSelector:a,inlineStylesheet:c,maskAllInputs:F,maskTextFn:m,slimDOM:O,dataURLOptions:y,recordCanvas:C,inlineImages:Y,onSerialize:H=>{$e(H,fe)&&ce.addIframe(H),Wt(H,fe)&&X.trackLinkElement(H),Me(H)&&de.addShadowRoot(H.shadowRoot,document)},onIframeLoad:(H,Q)=>{ce.attachIframe(H,Q),de.observeAttachShadow(H)},onStylesheetLoad:(H,Q)=>{X.attachLinkElement(H,Q)},keepIframeSrcFn:q});if(!ie)return console.warn("Failed to snapshot the document");re(oe({type:k.FullSnapshot,data:{node:ie,initialOffset:Lt(window)}}),R),xe.forEach(H=>H.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&X.adoptStyleSheets(document.adoptedStyleSheets,fe.getId(document))};try{const R=[],ie=Q=>{var Ne;return _(si)({mutationCb:M,mousemoveCb:(Z,yr)=>re(oe({type:k.IncrementalSnapshot,data:{source:yr,positions:Z}})),mouseInteractionCb:Z=>re(oe({type:k.IncrementalSnapshot,data:he({source:N.MouseInteraction},Z)})),scrollCb:D,viewportResizeCb:Z=>re(oe({type:k.IncrementalSnapshot,data:he({source:N.ViewportResize},Z)})),inputCb:Z=>re(oe({type:k.IncrementalSnapshot,data:he({source:N.Input},Z)})),mediaInteractionCb:Z=>re(oe({type:k.IncrementalSnapshot,data:he({source:N.MediaInteraction},Z)})),styleSheetRuleCb:Z=>re(oe({type:k.IncrementalSnapshot,data:he({source:N.StyleSheetRule},Z)})),styleDeclarationCb:Z=>re(oe({type:k.IncrementalSnapshot,data:he({source:N.StyleDeclaration},Z)})),canvasMutationCb:z,fontCb:Z=>re(oe({type:k.IncrementalSnapshot,data:he({source:N.Font},Z)})),selectionCb:Z=>{re(oe({type:k.IncrementalSnapshot,data:he({source:N.Selection},Z)}))},blockClass:o,ignoreClass:s,maskTextClass:l,maskTextSelector:a,maskInputOptions:F,inlineStylesheet:c,sampling:f,recordCanvas:C,inlineImages:Y,userTriggeredOnInput:L,collectFonts:E,doc:Q,maskInputFn:p,maskTextFn:m,keepIframeSrcFn:q,blockSelector:i,slimDOMOptions:O,dataURLOptions:y,mirror:fe,iframeManager:ce,stylesheetManager:X,shadowDomManager:de,processedNodeManager:me,canvasManager:Yt,ignoreCSSAttributes:U,plugins:((Ne=W?.filter(Z=>Z.observer))==null?void 0:Ne.map(Z=>({observer:Z.observer,options:Z.options,callback:yr=>re(oe({type:k.Plugin,data:{plugin:Z.name,payload:yr}}))})))||[]},g)};ce.addLoadListener(Q=>{try{R.push(ie(Q.contentDocument))}catch(Ne){console.warn(Ne)}});const H=()=>{yt(),R.push(ie(document)),vt=!0};return document.readyState==="interactive"||document.readyState==="complete"?H():(R.push(ae("DOMContentLoaded",()=>{re(oe({type:k.DomContentLoaded,data:{}})),I==="DOMContentLoaded"&&H()})),R.push(ae("load",()=>{re(oe({type:k.Load,data:{}})),I==="load"&&H()},window))),()=>{R.forEach(Q=>Q()),me.destroy(),vt=!1,Vo()}}catch(R){console.warn(R)}}Le.addCustomEvent=(t,e)=>{if(!vt)throw new Error("please add custom event after start recording");re(oe({type:k.Custom,data:{tag:t,payload:e}}))},Le.freezePage=()=>{xe.forEach(t=>t.freeze())},Le.takeFullSnapshot=t=>{if(!vt)throw new Error("please take full snapshot after start recording");yt(t)},Le.mirror=fe;var P;(function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment"})(P||(P={}));var _i=function(){function t(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return t.prototype.getId=function(e){var r;if(!e)return-1;var n=(r=this.getMeta(e))===null||r===void 0?void 0:r.id;return n??-1},t.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},t.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},t.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},t.prototype.removeNodeFromMap=function(e){var r=this,n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach(function(o){return r.removeNodeFromMap(o)})},t.prototype.has=function(e){return this.idNodeMap.has(e)},t.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},t.prototype.add=function(e,r){var n=r.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,r)},t.prototype.replace=function(e,r){var n=this.getNode(e);if(n){var o=this.nodeMetaMap.get(n);o&&this.nodeMetaMap.set(r,o)}this.idNodeMap.set(e,r)},t.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},t}();function Pi(){return new _i}function $i(t){const e={},r=/;(?![^(]*\))/g,n=/:(.+)/,o=/\/\*.*?\*\//g;return t.replace(o,"").split(r).forEach(function(i){if(i){const s=i.split(n);s.length>1&&(e[Xt(s[0].trim())]=s[1].trim())}}),e}function dn(t){const e=[];for(const r in t){const n=t[r];if(typeof n!="string")continue;const o=Vi(r);e.push(`${o}: ${n};`)}return e.join(" ")}const Wi=/-([a-z])/g,Ui=/^--[a-zA-Z0-9-]+$/,Xt=t=>Ui.test(t)?t:t.replace(Wi,(e,r)=>r?r.toUpperCase():""),ji=/\B([A-Z])/g,Vi=t=>t.replace(ji,"-$1").toLowerCase();class pe{constructor(...e){this.parentElement=null,this.parentNode=null,this.firstChild=null,this.lastChild=null,this.previousSibling=null,this.nextSibling=null,this.ELEMENT_NODE=te.ELEMENT_NODE,this.TEXT_NODE=te.TEXT_NODE}get childNodes(){const e=[];let r=this.firstChild;for(;r;)e.push(r),r=r.nextSibling;return e}contains(e){if(e instanceof pe){if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0}else return!1;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function Bi(t){return class ro extends t{constructor(...r){super(r),this.nodeType=te.DOCUMENT_NODE,this.nodeName="#document",this.compatMode="CSS1Compat",this.RRNodeType=P.Document,this.textContent=null,this.ownerDocument=this}get documentElement(){return this.childNodes.find(r=>r.RRNodeType===P.Element&&r.tagName==="HTML")||null}get body(){var r;return((r=this.documentElement)===null||r===void 0?void 0:r.childNodes.find(n=>n.RRNodeType===P.Element&&n.tagName==="BODY"))||null}get head(){var r;return((r=this.documentElement)===null||r===void 0?void 0:r.childNodes.find(n=>n.RRNodeType===P.Element&&n.tagName==="HEAD"))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(r){const n=r.RRNodeType;if((n===P.Element||n===P.DocumentType)&&this.childNodes.some(i=>i.RRNodeType===n))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${n===P.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const o=Zt(this,r);return o.parentElement=null,o}insertBefore(r,n){const o=r.RRNodeType;if((o===P.Element||o===P.DocumentType)&&this.childNodes.some(s=>s.RRNodeType===o))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${o===P.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const i=yn(this,r,n);return i.parentElement=null,i}removeChild(r){return vn(this,r)}open(){this.firstChild=null,this.lastChild=null}close(){}write(r){let n;if(r===''?n="-//W3C//DTD XHTML 1.0 Transitional//EN":r===''&&(n="-//W3C//DTD HTML 4.0 Transitional//EN"),n){const o=this.createDocumentType("html",n,"");this.open(),this.appendChild(o)}}createDocument(r,n,o){return new ro}createDocumentType(r,n,o){const i=new(hn(pe))(r,n,o);return i.ownerDocument=this,i}createElement(r){const n=new(pn(pe))(r);return n.ownerDocument=this,n}createElementNS(r,n){return this.createElement(n)}createTextNode(r){const n=new(mn(pe))(r);return n.ownerDocument=this,n}createComment(r){const n=new(fn(pe))(r);return n.ownerDocument=this,n}createCDATASection(r){const n=new(gn(pe))(r);return n.ownerDocument=this,n}toString(){return"RRDocument"}}}function hn(t){return class extends t{constructor(e,r,n){super(),this.nodeType=te.DOCUMENT_TYPE_NODE,this.RRNodeType=P.DocumentType,this.name=e,this.publicId=r,this.systemId=n,this.nodeName=e,this.textContent=null}toString(){return"RRDocumentType"}}}function pn(t){return class extends t{constructor(e){super(),this.nodeType=te.ELEMENT_NODE,this.RRNodeType=P.Element,this.attributes={},this.shadowRoot=null,this.tagName=e.toUpperCase(),this.nodeName=e.toUpperCase()}get textContent(){let e="";return this.childNodes.forEach(r=>e+=r.textContent),e}set textContent(e){this.firstChild=null,this.lastChild=null,this.appendChild(this.ownerDocument.createTextNode(e))}get classList(){return new zi(this.attributes.class,e=>{this.attributes.class=e})}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const e=this.attributes.style?$i(this.attributes.style):{},r=/\B([A-Z])/g;return e.setProperty=(n,o,i)=>{if(r.test(n))return;const s=Xt(n);o?e[s]=o:delete e[s],i==="important"&&(e[s]+=" !important"),this.attributes.style=dn(e)},e.removeProperty=n=>{if(r.test(n))return"";const o=Xt(n),i=e[o]||"";return delete e[o],this.attributes.style=dn(e),i},e}getAttribute(e){return this.attributes[e]||null}setAttribute(e,r){this.attributes[e]=r}setAttributeNS(e,r,n){this.setAttribute(r,n)}removeAttribute(e){delete this.attributes[e]}appendChild(e){return Zt(this,e)}insertBefore(e,r){return yn(this,e,r)}removeChild(e){return vn(this,e)}attachShadow(e){const r=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=r,r}dispatchEvent(e){return!0}toString(){let e="";for(const r in this.attributes)e+=`${r}="${this.attributes[r]}" `;return`${this.tagName} ${e}`}}}function Gi(t){return class extends t{attachShadow(e){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}}function mn(t){return class extends t{constructor(e){super(),this.nodeType=te.TEXT_NODE,this.nodeName="#text",this.RRNodeType=P.Text,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRText text=${JSON.stringify(this.data)}`}}}function fn(t){return class extends t{constructor(e){super(),this.nodeType=te.COMMENT_NODE,this.nodeName="#comment",this.RRNodeType=P.Comment,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}}function gn(t){return class extends t{constructor(e){super(),this.nodeName="#cdata-section",this.nodeType=te.CDATA_SECTION_NODE,this.RRNodeType=P.CDATA,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}}class zi{constructor(e,r){if(this.classes=[],this.add=(...n)=>{for(const o of n){const i=String(o);this.classes.indexOf(i)>=0||this.classes.push(i)}this.onChange&&this.onChange(this.classes.join(" "))},this.remove=(...n)=>{this.classes=this.classes.filter(o=>n.indexOf(o)===-1),this.onChange&&this.onChange(this.classes.join(" "))},e){const n=e.trim().split(/\s+/);this.classes.push(...n)}this.onChange=r}}function Zt(t,e){return e.parentNode&&e.parentNode.removeChild(e),t.lastChild?(t.lastChild.nextSibling=e,e.previousSibling=t.lastChild):(t.firstChild=e,e.previousSibling=null),t.lastChild=e,e.nextSibling=null,e.parentNode=t,e.parentElement=t,e.ownerDocument=t.ownerDocument,e}function yn(t,e,r){if(!r)return Zt(t,e);if(r.parentNode!==t)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return e===r||(e.parentNode&&e.parentNode.removeChild(e),e.previousSibling=r.previousSibling,r.previousSibling=e,e.nextSibling=r,e.previousSibling?e.previousSibling.nextSibling=e:t.firstChild=e,e.parentElement=t,e.parentNode=t,e.ownerDocument=t.ownerDocument),e}function vn(t,e){if(e.parentNode!==t)throw new Error("Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode.");return e.previousSibling?e.previousSibling.nextSibling=e.nextSibling:t.firstChild=e.nextSibling,e.nextSibling?e.nextSibling.previousSibling=e.previousSibling:t.lastChild=e.previousSibling,e.previousSibling=null,e.nextSibling=null,e.parentElement=null,e.parentNode=null,e}var te;(function(t){t[t.PLACEHOLDER=0]="PLACEHOLDER",t[t.ELEMENT_NODE=1]="ELEMENT_NODE",t[t.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",t[t.TEXT_NODE=3]="TEXT_NODE",t[t.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",t[t.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",t[t.ENTITY_NODE=6]="ENTITY_NODE",t[t.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",t[t.COMMENT_NODE=8]="COMMENT_NODE",t[t.DOCUMENT_NODE=9]="DOCUMENT_NODE",t[t.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",t[t.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"})(te||(te={}));const Kt={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},Hi={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};let ye=null;function St(t,e,r,n=e.mirror||e.ownerDocument.mirror){t=Yi(t,e,r,n),Sn(t,e,r,n),Xi(t,e,r,n)}function Yi(t,e,r,n){var o;if(r.afterAppend&&!ye&&(ye=new WeakSet,setTimeout(()=>{ye=null},0)),!Jt(t,e)){const i=bt(e,r.mirror,n);(o=t.parentNode)===null||o===void 0||o.replaceChild(i,t),t=i}switch(e.RRNodeType){case P.Document:{if(!je(t,e,r.mirror,n)){const i=n.getMeta(e);i&&(r.mirror.removeNodeFromMap(t),t.close(),t.open(),r.mirror.add(t,i),ye?.add(t))}break}case P.Element:{const i=t,s=e;switch(s.tagName){case"IFRAME":{const l=t.contentDocument;if(!l)break;St(l,e.contentDocument,r,n);break}}s.shadowRoot&&(i.shadowRoot||i.attachShadow({mode:"open"}),Sn(i.shadowRoot,s.shadowRoot,r,n));break}}return t}function Xi(t,e,r,n){var o;switch(e.RRNodeType){case P.Document:{const i=e.scrollData;i&&r.applyScroll(i,!0);break}case P.Element:{const i=t,s=e;switch(Zi(i,s,n),s.scrollData&&r.applyScroll(s.scrollData,!0),s.inputData&&r.applyInput(s.inputData),s.tagName){case"AUDIO":case"VIDEO":{const l=t,a=s;a.paused!==void 0&&(a.paused?l.pause():l.play()),a.muted!==void 0&&(l.muted=a.muted),a.volume!==void 0&&(l.volume=a.volume),a.currentTime!==void 0&&(l.currentTime=a.currentTime),a.playbackRate!==void 0&&(l.playbackRate=a.playbackRate);break}case"CANVAS":{const l=e;if(l.rr_dataURL!==null){const a=document.createElement("img");a.onload=()=>{const c=i.getContext("2d");c&&c.drawImage(a,0,0,a.width,a.height)},a.src=l.rr_dataURL}l.canvasMutations.forEach(a=>r.applyCanvas(a.event,a.mutation,t));break}case"STYLE":{const l=i.sheet;l&&e.rules.forEach(a=>r.applyStyleSheetMutation(a,l));break}}break}case P.Text:case P.Comment:case P.CDATA:{t.textContent!==e.data&&(t.textContent=e.data);break}}ye!=null&&ye.has(t)&&(ye.delete(t),(o=r.afterAppend)===null||o===void 0||o.call(r,t,r.mirror.getId(t)))}function Zi(t,e,r){const n=t.attributes,o=e.attributes;for(const i in o){const s=o[i],l=r.getMeta(e);if(l?.isSVG&&Kt[i])t.setAttributeNS(Kt[i],i,s);else if(e.tagName==="CANVAS"&&i==="rr_dataURL"){const a=document.createElement("img");a.src=s,a.onload=()=>{const c=t.getContext("2d");c&&c.drawImage(a,0,0,a.width,a.height)}}else{if(e.tagName==="IFRAME"&&i==="srcdoc")continue;t.setAttribute(i,s)}}for(const{name:i}of Array.from(n))i in o||t.removeAttribute(i);e.scrollLeft&&(t.scrollLeft=e.scrollLeft),e.scrollTop&&(t.scrollTop=e.scrollTop)}function Sn(t,e,r,n){const o=Array.from(t.childNodes),i=e.childNodes;if(o.length===0&&i.length===0)return;let s=0,l=o.length-1,a=0,c=i.length-1,u=o[s],d=o[l],h=i[a],p=i[c],m,g;for(;s<=l&&a<=c;)if(u===void 0)u=o[++s];else if(d===void 0)d=o[--l];else if(je(u,h,r.mirror,n))u=o[++s],h=i[++a];else if(je(d,p,r.mirror,n))d=o[--l],p=i[--c];else if(je(u,p,r.mirror,n)){try{t.insertBefore(u,d.nextSibling)}catch(y){console.warn(y)}u=o[++s],p=i[--c]}else if(je(d,h,r.mirror,n)){try{t.insertBefore(d,u)}catch(y){console.warn(y)}d=o[--l],h=i[++a]}else{if(!m){m={};for(let v=s;v<=l;v++){const C=o[v];C&&r.mirror.hasNode(C)&&(m[r.mirror.getId(C)]=v)}}g=m[n.getId(h)];const y=o[g];if(g!==void 0&&y&&je(y,h,r.mirror,n)){try{t.insertBefore(y,u)}catch(v){console.warn(v)}o[g]=void 0}else{const v=bt(h,r.mirror,n);t.nodeName==="#document"&&u&&(v.nodeType===v.DOCUMENT_TYPE_NODE&&u.nodeType===u.DOCUMENT_TYPE_NODE||v.nodeType===v.ELEMENT_NODE&&u.nodeType===u.ELEMENT_NODE)&&(t.removeChild(u),r.mirror.removeNodeFromMap(u),u=o[++s]);try{t.insertBefore(v,u||null)}catch(C){console.warn(C)}}h=i[++a]}if(s>l){const y=i[c+1];let v=null;for(y&&(v=r.mirror.getNode(n.getId(y)));a<=c;++a){const C=bt(i[a],r.mirror,n);try{t.insertBefore(C,v)}catch(T){console.warn(T)}}}else if(a>c)for(;s<=l;s++){const y=o[s];if(!(!y||y.parentNode!==t))try{t.removeChild(y),r.mirror.removeNodeFromMap(y)}catch(v){console.warn(v)}}let S=t.firstChild,f=e.firstChild;for(;S!==null&&f!==null;)St(S,f,r,n),S=S.nextSibling,f=f.nextSibling}function bt(t,e,r){const n=r.getId(t),o=r.getMeta(t);let i=null;if(n>-1&&(i=e.getNode(n)),i!==null&&Jt(i,t))return i;switch(t.RRNodeType){case P.Document:i=new Document;break;case P.DocumentType:i=document.implementation.createDocumentType(t.name,t.publicId,t.systemId);break;case P.Element:{let s=t.tagName.toLowerCase();s=Hi[s]||s,o&&"isSVG"in o&&o?.isSVG?i=document.createElementNS(Kt.svg,s):i=document.createElement(t.tagName);break}case P.Text:i=document.createTextNode(t.data);break;case P.Comment:i=document.createComment(t.data);break;case P.CDATA:i=document.createCDATASection(t.data);break}o&&e.add(i,Object.assign({},o));try{ye?.add(i)}catch{}return i}function Jt(t,e){return t.nodeType!==e.nodeType?!1:t.nodeType!==t.ELEMENT_NODE||t.tagName.toUpperCase()===e.tagName}function je(t,e,r,n){const o=r.getId(t),i=n.getId(e);return o===-1||o!==i?!1:Jt(t,e)}class Ve extends Bi(pe){constructor(e){super(),this.UNSERIALIZED_STARTING_ID=-2,this._unserializedId=this.UNSERIALIZED_STARTING_ID,this.mirror=ss(),this.scrollData=null,e&&(this.mirror=e)}get unserializedId(){return this._unserializedId--}createDocument(e,r,n){return new Ve}createDocumentType(e,r,n){const o=new Ki(e,r,n);return o.ownerDocument=this,o}createElement(e){const r=e.toUpperCase();let n;switch(r){case"AUDIO":case"VIDEO":n=new Ji(r);break;case"IFRAME":n=new es(r,this.mirror);break;case"CANVAS":n=new Qi(r);break;case"STYLE":n=new qi(r);break;default:n=new rt(r);break}return n.ownerDocument=this,n}createComment(e){const r=new rs(e);return r.ownerDocument=this,r}createCDATASection(e){const r=new ns(e);return r.ownerDocument=this,r}createTextNode(e){const r=new ts(e);return r.ownerDocument=this,r}destroyTree(){this.firstChild=null,this.lastChild=null,this.mirror.reset()}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID}}const Ki=hn(pe);class rt extends pn(pe){constructor(){super(...arguments),this.inputData=null,this.scrollData=null}}class Ji extends Gi(rt){}class Qi extends rt{constructor(){super(...arguments),this.rr_dataURL=null,this.canvasMutations=[]}getContext(){return null}}class qi extends rt{constructor(){super(...arguments),this.rules=[]}}class es extends rt{constructor(e,r){super(e),this.contentDocument=new Ve,this.contentDocument.mirror=r}}const ts=mn(pe),rs=fn(pe),ns=gn(pe);function os(t){return t instanceof HTMLFormElement?"FORM":t.tagName.toUpperCase()}function bn(t,e,r,n){let o;switch(t.nodeType){case te.DOCUMENT_NODE:n&&n.nodeName==="IFRAME"?o=n.contentDocument:(o=e,o.compatMode=t.compatMode);break;case te.DOCUMENT_TYPE_NODE:{const s=t;o=e.createDocumentType(s.name,s.publicId,s.systemId);break}case te.ELEMENT_NODE:{const s=t,l=os(s);o=e.createElement(l);const a=o;for(const{name:c,value:u}of Array.from(s.attributes))a.attributes[c]=u;s.scrollLeft&&(a.scrollLeft=s.scrollLeft),s.scrollTop&&(a.scrollTop=s.scrollTop);break}case te.TEXT_NODE:o=e.createTextNode(t.textContent||"");break;case te.CDATA_SECTION_NODE:o=e.createCDATASection(t.data);break;case te.COMMENT_NODE:o=e.createComment(t.textContent||"");break;case te.DOCUMENT_FRAGMENT_NODE:o=n.attachShadow({mode:"open"});break;default:return null}let i=r.getMeta(t);return e instanceof Ve&&(i||(i=wn(o,e.unserializedId),r.add(t,i)),e.mirror.add(o,Object.assign({},i))),o}function is(t,e=Pi(),r=new Ve){function n(o,i){const s=bn(o,r,e,i);if(s!==null)if(i?.nodeName!=="IFRAME"&&o.nodeType!==te.DOCUMENT_FRAGMENT_NODE&&(i?.appendChild(s),s.parentNode=i,s.parentElement=i),o.nodeName==="IFRAME"){const l=o.contentDocument;l&&n(l,s)}else(o.nodeType===te.DOCUMENT_NODE||o.nodeType===te.ELEMENT_NODE||o.nodeType===te.DOCUMENT_FRAGMENT_NODE)&&(o.nodeType===te.ELEMENT_NODE&&o.shadowRoot&&n(o.shadowRoot,s),o.childNodes.forEach(l=>n(l,s)))}return n(t,null),r}function ss(){return new as}class as{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var r;if(!e)return-1;const n=(r=this.getMeta(e))===null||r===void 0?void 0:r.id;return n??-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const r=this.getId(e);this.idNodeMap.delete(r),e.childNodes&&e.childNodes.forEach(n=>this.removeNodeFromMap(n))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,r){const n=r.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,r)}replace(e,r){const n=this.getNode(e);if(n){const o=this.nodeMetaMap.get(n);o&&this.nodeMetaMap.set(r,o)}this.idNodeMap.set(e,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function wn(t,e){switch(t.RRNodeType){case P.Document:return{id:e,type:t.RRNodeType,childNodes:[]};case P.DocumentType:{const r=t;return{id:e,type:t.RRNodeType,name:r.name,publicId:r.publicId,systemId:r.systemId}}case P.Element:return{id:e,type:t.RRNodeType,tagName:t.tagName.toLowerCase(),attributes:{},childNodes:[]};case P.Text:return{id:e,type:t.RRNodeType,textContent:t.textContent||""};case P.Comment:return{id:e,type:t.RRNodeType,textContent:t.textContent||""};case P.CDATA:return{id:e,type:t.RRNodeType,textContent:""}}}function Cn(t){return{all:t=t||new Map,on:function(e,r){var n=t.get(e);n?n.push(r):t.set(e,[r])},off:function(e,r){var n=t.get(e);n&&(r?n.splice(n.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var n=t.get(e);n&&n.slice().map(function(o){o(r)}),(n=t.get("*"))&&n.slice().map(function(o){o(e,r)})}}}var ls=Object.freeze({__proto__:null,default:Cn});function cs(t=window,e=document){if("scrollBehavior"in e.documentElement.style&&t.__forceSmoothScrollPolyfill__!==!0)return;const r=t.HTMLElement||t.Element,n=468,o={scroll:t.scroll||t.scrollTo,scrollBy:t.scrollBy,elementScroll:r.prototype.scroll||a,scrollIntoView:r.prototype.scrollIntoView},i=t.performance&&t.performance.now?t.performance.now.bind(t.performance):Date.now;function s(f){const y=["MSIE ","Trident/","Edge/"];return new RegExp(y.join("|")).test(f)}const l=s(t.navigator.userAgent)?1:0;function a(f,y){this.scrollLeft=f,this.scrollTop=y}function c(f){return .5*(1-Math.cos(Math.PI*f))}function u(f){if(f===null||typeof f!="object"||f.behavior===void 0||f.behavior==="auto"||f.behavior==="instant")return!0;if(typeof f=="object"&&f.behavior==="smooth")return!1;throw new TypeError("behavior member of ScrollOptions "+f.behavior+" is not a valid value for enumeration ScrollBehavior.")}function d(f,y){if(y==="Y")return f.clientHeight+l1?1:I,v=c(I),C=f.startX+(f.x-f.startX)*v,T=f.startY+(f.y-f.startY)*v,f.method.call(f.scrollable,C,T),(C!==f.x||T!==f.y)&&t.requestAnimationFrame(g.bind(t,f))}function S(f,y,v){let C,T,I,L;const E=i();f===e.body?(C=t,T=t.scrollX||t.pageXOffset,I=t.scrollY||t.pageYOffset,L=o.scroll):(C=f,T=f.scrollLeft,I=f.scrollTop,L=a),g({scrollable:C,method:L,startTime:E,startX:T,startY:I,x:y,y:v})}t.scroll=t.scrollTo=function(){if(arguments[0]!==void 0){if(u(arguments[0])===!0){o.scroll.call(t,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:t.scrollX||t.pageXOffset,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:t.scrollY||t.pageYOffset);return}S.call(t,e.body,arguments[0].left!==void 0?~~arguments[0].left:t.scrollX||t.pageXOffset,arguments[0].top!==void 0?~~arguments[0].top:t.scrollY||t.pageYOffset)}},t.scrollBy=function(){if(arguments[0]!==void 0){if(u(arguments[0])){o.scrollBy.call(t,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:0,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:0);return}S.call(t,e.body,~~arguments[0].left+(t.scrollX||t.pageXOffset),~~arguments[0].top+(t.scrollY||t.pageYOffset))}},r.prototype.scroll=r.prototype.scrollTo=function(){if(arguments[0]===void 0)return;if(u(arguments[0])===!0){if(typeof arguments[0]=="number"&&arguments[1]===void 0)throw new SyntaxError("Value could not be converted");o.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left:typeof arguments[0]!="object"?~~arguments[0]:this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top:arguments[1]!==void 0?~~arguments[1]:this.scrollTop);return}const f=arguments[0].left,y=arguments[0].top;S.call(this,this,typeof f>"u"?this.scrollLeft:~~f,typeof y>"u"?this.scrollTop:~~y)},r.prototype.scrollBy=function(){if(arguments[0]!==void 0){if(u(arguments[0])===!0){o.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop);return}this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior})}},r.prototype.scrollIntoView=function(){if(u(arguments[0])===!0){o.scrollIntoView.call(this,arguments[0]===void 0?!0:arguments[0]);return}const f=m(this),y=f.getBoundingClientRect(),v=this.getBoundingClientRect();f!==e.body?(S.call(this,f,f.scrollLeft+v.left-y.left,f.scrollTop+v.top-y.top),t.getComputedStyle(f).position!=="fixed"&&t.scrollBy({left:y.left,top:y.top,behavior:"smooth"})):t.scrollBy({left:v.left,top:v.top,behavior:"smooth"})}}class us{constructor(e=[],r){this.timeOffset=0,this.raf=null,this.actions=e,this.speed=r.speed}addAction(e){const r=this.raf===!0;if(!this.actions.length||this.actions[this.actions.length-1].delay<=e.delay)this.actions.push(e);else{const n=this.findActionIndex(e);this.actions.splice(n,0,e)}r&&(this.raf=requestAnimationFrame(this.rafCheck.bind(this)))}start(){this.timeOffset=0,this.lastTimestamp=performance.now(),this.raf=requestAnimationFrame(this.rafCheck.bind(this))}rafCheck(){const e=performance.now();for(this.timeOffset+=(e-this.lastTimestamp)*this.speed,this.lastTimestamp=e;this.actions.length;){const r=this.actions[0];if(this.timeOffset>=r.delay)this.actions.shift(),r.doAction();else break}this.actions.length>0?this.raf=requestAnimationFrame(this.rafCheck.bind(this)):this.raf=!0}clear(){this.raf&&(this.raf!==!0&&cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(e){this.speed=e}isActive(){return this.raf!==null}findActionIndex(e){let r=0,n=this.actions.length-1;for(;r<=n;){const o=Math.floor((r+n)/2);if(this.actions[o].delaye.delay)n=o-1;else return o+1}return r}}function En(t,e){if(t.type===k.IncrementalSnapshot&&t.data.source===N.MouseMove&&t.data.positions&&t.data.positions.length){const r=t.data.positions[0].timeOffset,n=t.timestamp+r;return t.delay=n-e,n-e}return t.delay=t.timestamp-e,t.delay}/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */function Nn(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){o={error:l}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}var Be;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(Be||(Be={}));var Tn={type:"xstate.init"};function Qt(t){return t===void 0?[]:[].concat(t)}function Ge(t){return{type:"xstate.assign",assignment:t}}function Mn(t,e){return typeof(t=typeof t=="string"&&e&&e[t]?e[t]:t)=="string"?{type:t}:typeof t=="function"?{type:t.name,exec:t}:t}function wt(t){return function(e){return t===e}}function In(t){return typeof t=="string"?{type:t}:t}function kn(t,e){return{value:t,context:e,actions:[],changed:!1,matches:wt(t)}}function Dn(t,e,r){var n=e,o=!1;return[t.filter(function(i){if(i.type==="xstate.assign"){o=!0;var s=Object.assign({},n);return typeof i.assignment=="function"?s=i.assignment(n,r):Object.keys(i.assignment).forEach(function(l){s[l]=typeof i.assignment[l]=="function"?i.assignment[l](n,r):i.assignment[l]}),n=s,!1}return!0}),n,o]}function On(t,e){e===void 0&&(e={});var r=Nn(Dn(Qt(t.states[t.initial].entry).map(function(s){return Mn(s,e.actions)}),t.context,Tn),2),n=r[0],o=r[1],i={config:t,_options:e,initialState:{value:t.initial,actions:n,context:o,matches:wt(t.initial)},transition:function(s,l){var a,c,u=typeof s=="string"?{value:s,context:t.context}:s,d=u.value,h=u.context,p=In(l),m=t.states[d];if(m.on){var g=Qt(m.on[p.type]);try{for(var S=function(O){var G=typeof Symbol=="function"&&Symbol.iterator,w=G&&O[G],b=0;if(w)return w.call(O);if(O&&typeof O.length=="number")return{next:function(){return O&&b>=O.length&&(O=void 0),{value:O&&O[b++],done:!O}}};throw new TypeError(G?"Object is not iterable.":"Symbol.iterator is not defined.")}(g),f=S.next();!f.done;f=S.next()){var y=f.value;if(y===void 0)return kn(d,h);var v=typeof y=="string"?{target:y}:y,C=v.target,T=v.actions,I=T===void 0?[]:T,L=v.cond,E=L===void 0?function(){return!0}:L,Y=C===void 0,W=C??d,q=t.states[W];if(E(h,p)){var U=Nn(Dn((Y?Qt(I):[].concat(m.exit,I,q.entry).filter(function(O){return O})).map(function(O){return Mn(O,i._options.actions)}),h,p),3),V=U[0],B=U[1],A=U[2],F=C??d;return{value:F,context:B,actions:V,changed:C!==d||V.length>0||A,matches:wt(F)}}}}catch(O){a={error:O}}finally{try{f&&!f.done&&(c=S.return)&&c.call(S)}finally{if(a)throw a.error}}}return kn(d,h)}};return i}var Rn=function(t,e){return t.actions.forEach(function(r){var n=r.exec;return n&&n(t.context,e)})};function xn(t){var e=t.initialState,r=Be.NotStarted,n=new Set,o={_machine:t,send:function(i){r===Be.Running&&(e=t.transition(e,i),Rn(e,In(i)),n.forEach(function(s){return s(e)}))},subscribe:function(i){return n.add(i),i(e),{unsubscribe:function(){return n.delete(i)}}},start:function(i){if(i){var s=typeof i=="object"?i:{context:t.config.context,value:i};e={value:s.value,actions:[],context:s.context,matches:wt(s.value)}}return r=Be.Running,Rn(e,Tn),o},stop:function(){return r=Be.Stopped,n.clear(),o},get state(){return e},get status(){return r}};return o}var ds=Object.defineProperty,hs=Object.defineProperties,ps=Object.getOwnPropertyDescriptors,Ln=Object.getOwnPropertySymbols,ms=Object.prototype.hasOwnProperty,fs=Object.prototype.propertyIsEnumerable,An=(t,e,r)=>e in t?ds(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,qt=(t,e)=>{for(var r in e||(e={}))ms.call(e,r)&&An(t,r,e[r]);if(Ln)for(var r of Ln(e))fs.call(e,r)&&An(t,r,e[r]);return t},er=(t,e)=>hs(t,ps(e));function gs(t,e){for(let r=t.length-1;r>=0;r--){const n=t[r];if(n.type===k.Meta&&n.timestamp<=e)return t.slice(r)}return t}function ys(t,{getCastFn:e,applyEventsSynchronously:r,emitter:n}){const o=On({id:"player",context:t,initial:"paused",states:{playing:{on:{PAUSE:{target:"paused",actions:["pause"]},CAST_EVENT:{target:"playing",actions:"castEvent"},END:{target:"paused",actions:["resetLastPlayedEvent","pause"]},ADD_EVENT:{target:"playing",actions:["addEvent"]}}},paused:{on:{PLAY:{target:"playing",actions:["recordTimeOffset","play"]},CAST_EVENT:{target:"paused",actions:"castEvent"},TO_LIVE:{target:"live",actions:["startLive"]},ADD_EVENT:{target:"paused",actions:["addEvent"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]},CAST_EVENT:{target:"live",actions:["castEvent"]}}}}},{actions:{castEvent:Ge({lastPlayedEvent:(i,s)=>s.type==="CAST_EVENT"?s.payload.event:i.lastPlayedEvent}),recordTimeOffset:Ge((i,s)=>{let l=i.timeOffset;return"payload"in s&&"timeOffset"in s.payload&&(l=s.payload.timeOffset),er(qt({},i),{timeOffset:l,baselineTime:i.events[0].timestamp+l})}),play(i){var s;const{timer:l,events:a,baselineTime:c,lastPlayedEvent:u}=i;l.clear();for(const m of a)En(m,c);const d=gs(a,c);let h=u?.timestamp;u?.type===k.IncrementalSnapshot&&u.data.source===N.MouseMove&&(h=u.timestamp+((s=u.data.positions[0])==null?void 0:s.timeOffset)),c<(h||0)&&n.emit(j.PlayBack);const p=new Array;for(const m of d)if(!(h&&h{g()},delay:m.delay})}r(p),n.emit(j.Flush),l.start()},pause(i){i.timer.clear()},resetLastPlayedEvent:Ge(i=>er(qt({},i),{lastPlayedEvent:null})),startLive:Ge({baselineTime:(i,s)=>(i.timer.start(),s.type==="TO_LIVE"&&s.payload.baselineTime?s.payload.baselineTime:Date.now())}),addEvent:Ge((i,s)=>{const{baselineTime:l,timer:a,events:c}=i;if(s.type==="ADD_EVENT"){const{event:u}=s.payload;En(u,l);let d=c.length-1;if(!c[d]||c[d].timestamp<=u.timestamp)c.push(u);else{let m=-1,g=0;for(;g<=d;){const S=Math.floor((g+d)/2);c[S].timestamp<=u.timestamp?g=S+1:d=S-1}m===-1&&(m=g),c.splice(m,0,u)}const h=u.timestamp{p()},delay:u.delay})}return er(qt({},i),{events:c})})}});return xn(o)}function vs(t){const e=On({id:"speed",context:t,initial:"normal",states:{normal:{on:{FAST_FORWARD:{target:"skipping",actions:["recordSpeed","setSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}},skipping:{on:{BACK_TO_NORMAL:{target:"normal",actions:["restoreSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}}}},{actions:{setSpeed:(r,n)=>{"payload"in n&&r.timer.setSpeed(n.payload.speed)},recordSpeed:Ge({normalSpeed:r=>r.timer.speed}),restoreSpeed:r=>{r.timer.setSpeed(r.normalSpeed)}}});return xn(e)}const Ss=t=>[`.${t} { background: currentColor }`,"noscript { display: none !important; }"];var bs=(t,e,r)=>new Promise((n,o)=>{var i=a=>{try{l(r.next(a))}catch(c){o(c)}},s=a=>{try{l(r.throw(a))}catch(c){o(c)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(i,s);l((r=r.apply(t,e)).next())});const Fn=new Map;function _n(t,e){let r=Fn.get(t);return r||(r=new Map,Fn.set(t,r)),r.has(e)||r.set(e,[]),r.get(e)}function ke(t,e,r){return n=>bs(this,null,function*(){if(n&&typeof n=="object"&&"rr_type"in n)if(r&&(r.isUnchanged=!1),n.rr_type==="ImageBitmap"&&"args"in n){const o=yield ke(t,e,r)(n.args);return yield createImageBitmap.apply(null,o)}else if("index"in n){if(r||e===null)return n;const{rr_type:o,index:i}=n;return _n(e,o)[i]}else if("args"in n){const{rr_type:o,args:i}=n,s=window[o];return new s(...yield Promise.all(i.map(ke(t,e,r))))}else{if("base64"in n)return fi(n.base64);if("src"in n){const o=t.get(n.src);if(o)return o;{const i=new Image;return i.src=n.src,t.set(n.src,i),i}}else if("data"in n&&n.rr_type==="Blob"){const o=yield Promise.all(n.data.map(ke(t,e,r)));return new Blob(o,{type:n.type})}}else if(Array.isArray(n))return yield Promise.all(n.map(ke(t,e,r)));return n})}var ws=(t,e,r)=>new Promise((n,o)=>{var i=a=>{try{l(r.next(a))}catch(c){o(c)}},s=a=>{try{l(r.throw(a))}catch(c){o(c)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(i,s);l((r=r.apply(t,e)).next())});function Cs(t,e){try{return e===we.WebGL?t.getContext("webgl")||t.getContext("experimental-webgl"):t.getContext("webgl2")}catch{return null}}const Es=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function Ns(t,e){if(!(e!=null&&e.constructor))return;const{name:r}=e.constructor;if(!Es.includes(r))return;const n=_n(t,r);n.includes(e)||n.push(e)}function Ts(t){return ws(this,arguments,function*({mutation:e,target:r,type:n,imageMap:o,errorHandler:i}){try{const s=Cs(r,n);if(!s)return;if(e.setter){s[e.property]=e.args[0];return}const l=s[e.property],a=yield Promise.all(e.args.map(ke(o,s))),c=l.apply(s,a);Ns(s,c)}catch(s){i(e,s)}})}var Ms=(t,e,r)=>new Promise((n,o)=>{var i=a=>{try{l(r.next(a))}catch(c){o(c)}},s=a=>{try{l(r.throw(a))}catch(c){o(c)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(i,s);l((r=r.apply(t,e)).next())});function Is(t){return Ms(this,arguments,function*({event:e,mutation:r,target:n,imageMap:o,errorHandler:i}){try{const s=n.getContext("2d");if(r.setter){s[r.property]=r.args[0];return}const l=s[r.property];if(r.property==="drawImage"&&typeof r.args[0]=="string")o.get(e),l.apply(s,r.args);else{const a=yield Promise.all(r.args.map(ke(o,s)));l.apply(s,a)}}catch(s){i(r,s)}})}var ks=(t,e,r)=>new Promise((n,o)=>{var i=a=>{try{l(r.next(a))}catch(c){o(c)}},s=a=>{try{l(r.throw(a))}catch(c){o(c)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(i,s);l((r=r.apply(t,e)).next())});function Pn(t){return ks(this,arguments,function*({event:e,mutation:r,target:n,imageMap:o,canvasEventMap:i,errorHandler:s}){try{const l=i.get(e)||r,a="commands"in l?l.commands:[l];if([we.WebGL,we.WebGL2].includes(r.type)){for(let c=0;ce in t?Ds(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ct=(t,e)=>{for(var r in e||(e={}))xs.call(e,r)&&Wn(t,r,e[r]);if($n)for(var r of $n(e))Ls.call(e,r)&&Wn(t,r,e[r]);return t},tr=(t,e)=>Os(t,Rs(e)),rr=(t,e,r)=>new Promise((n,o)=>{var i=a=>{try{l(r.next(a))}catch(c){o(c)}},s=a=>{try{l(r.throw(a))}catch(c){o(c)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(i,s);l((r=r.apply(t,e)).next())});const As=10*1e3,Fs=5*1e3,_s=Cn||ls,Un="[replayer]",nr={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function jn(t){return t.type==k.IncrementalSnapshot&&(t.data.source==N.TouchMove||t.data.source==N.MouseInteraction&&t.data.type==$.TouchStart)}class Ps{constructor(e,r){if(this.usingVirtualDom=!1,this.virtualDom=new Ve,this.mouseTail=null,this.tailPositions=[],this.emitter=_s(),this.legacy_missingNodeRetryMap={},this.cache=Rr(),this.imageMap=new Map,this.canvasEventMap=new Map,this.mirror=br(),this.styleMirror=new Vt,this.firstFullSnapshot=null,this.newDocumentQueue=[],this.mousePos=null,this.touchActive=null,this.lastMouseDownEvent=null,this.lastSelectionData=null,this.constructedStyleMutations=[],this.adoptedStyleSheets=[],this.handleResize=l=>{this.iframe.style.display="inherit";for(const a of[this.mouseTail,this.iframe])!a||(a.setAttribute("width",String(l.width)),a.setAttribute("height",String(l.height)))},this.applyEventsSynchronously=l=>{for(const a of l){switch(a.type){case k.DomContentLoaded:case k.Load:case k.Custom:continue;case k.FullSnapshot:case k.Meta:case k.Plugin:case k.IncrementalSnapshot:break}this.getCastFn(a,!0)()}},this.getCastFn=(l,a=!1)=>{let c;switch(l.type){case k.DomContentLoaded:case k.Load:break;case k.Custom:c=()=>{this.emitter.emit(j.CustomEvent,l)};break;case k.Meta:c=()=>this.emitter.emit(j.Resize,{width:l.data.width,height:l.data.height});break;case k.FullSnapshot:c=()=>{var u;if(this.firstFullSnapshot){if(this.firstFullSnapshot===l){this.firstFullSnapshot=!0;return}}else this.firstFullSnapshot=!0;this.rebuildFullSnapshot(l,a),(u=this.iframe.contentWindow)==null||u.scrollTo(l.data.initialOffset),this.styleMirror.reset()};break;case k.IncrementalSnapshot:c=()=>{if(this.applyIncremental(l,a),!a&&(l===this.nextUserInteractionEvent&&(this.nextUserInteractionEvent=null,this.backToNormal()),this.config.skipInactive&&!this.nextUserInteractionEvent)){for(const u of this.service.state.context.events)if(!(u.timestamp<=l.timestamp)&&this.isUserInteraction(u)){u.delay-l.delay>As*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=u);break}if(this.nextUserInteractionEvent){const u=this.nextUserInteractionEvent.delay-l.delay,d={speed:Math.min(Math.round(u/Fs),this.config.maxSpeed)};this.speedService.send({type:"FAST_FORWARD",payload:d}),this.emitter.emit(j.SkipStart,d)}}};break}return()=>{c&&c();for(const d of this.config.plugins||[])d.handler&&d.handler(l,a,{replayer:this});this.service.send({type:"CAST_EVENT",payload:{event:l}});const u=this.service.state.context.events.length-1;if(!this.config.liveMode&&l===this.service.state.context.events[u]){const d=()=>{u{if(this.usingVirtualDom){const l={mirror:this.mirror,applyCanvas:(a,c,u)=>{Pn({event:a,mutation:c,target:u,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this),applyStyleSheetMutation:(a,c)=>{a.source===N.StyleSheetRule?this.applyStyleSheetRule(a,c):a.source===N.StyleDeclaration&&this.applyStyleDeclaration(a,c)},afterAppend:(a,c)=>{for(const u of this.config.plugins||[])u.onBuild&&u.onBuild(a,{id:c,replayer:this})}};if(this.iframe.contentDocument)try{St(this.iframe.contentDocument,this.virtualDom,l,this.virtualDom.mirror)}catch(a){console.warn(a)}if(this.virtualDom.destroyTree(),this.usingVirtualDom=!1,Object.keys(this.legacy_missingNodeRetryMap).length)for(const a in this.legacy_missingNodeRetryMap)try{const c=this.legacy_missingNodeRetryMap[a],u=bt(c.node,this.mirror,this.virtualDom.mirror);St(u,c.node,l,this.virtualDom.mirror),c.node=u}catch(c){this.warn(c)}this.constructedStyleMutations.forEach(a=>{this.applyStyleSheetMutation(a)}),this.constructedStyleMutations=[],this.adoptedStyleSheets.forEach(a=>{this.applyAdoptedStyleSheet(a)}),this.adoptedStyleSheets=[]}if(this.mousePos&&(this.moveAndHover(this.mousePos.x,this.mousePos.y,this.mousePos.id,!0,this.mousePos.debugData),this.mousePos=null),this.touchActive===!0?this.mouse.classList.add("touch-active"):this.touchActive===!1&&this.mouse.classList.remove("touch-active"),this.touchActive=null,this.lastMouseDownEvent){const[l,a]=this.lastMouseDownEvent;l.dispatchEvent(a)}this.lastMouseDownEvent=null,this.lastSelectionData&&(this.applySelection(this.lastSelectionData),this.lastSelectionData=null)}),this.emitter.on(j.PlayBack,()=>{this.firstFullSnapshot=null,this.mirror.reset(),this.styleMirror.reset()});const o=new us([],{speed:this.config.speed});this.service=ys({events:e.map(l=>r&&r.unpackFn?r.unpackFn(l):l).sort((l,a)=>l.timestamp-a.timestamp),timer:o,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe(l=>{this.emitter.emit(j.StateChange,{player:l})}),this.speedService=vs({normalSpeed:-1,timer:o}),this.speedService.start(),this.speedService.subscribe(l=>{this.emitter.emit(j.StateChange,{speed:l})});const i=this.service.state.context.events.find(l=>l.type===k.Meta),s=this.service.state.context.events.find(l=>l.type===k.FullSnapshot);if(i){const{width:l,height:a}=i.data;setTimeout(()=>{this.emitter.emit(j.Resize,{width:l,height:a})},0)}s&&setTimeout(()=>{var l;this.firstFullSnapshot||(this.firstFullSnapshot=s,this.rebuildFullSnapshot(s),(l=this.iframe.contentWindow)==null||l.scrollTo(s.data.initialOffset))},1),this.service.state.context.events.find(jn)&&this.mouse.classList.add("touch-device")}get timer(){return this.service.state.context.timer}on(e,r){return this.emitter.on(e,r),this}off(e,r){return this.emitter.off(e,r),this}setConfig(e){Object.keys(e).forEach(r=>{e[r],this.config[r]=e[r]}),this.config.skipInactive||this.backToNormal(),typeof e.speed<"u"&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}}),typeof e.mouseTail<"u"&&(e.mouseTail===!1?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"))}getMetaData(){const e=this.service.state.context.events[0],r=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:e.timestamp,endTime:r.timestamp,totalTime:r.timestamp-e.timestamp}}getCurrentTime(){return this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){const{baselineTime:e,events:r}=this.service.state.context;return e-r[0].timestamp}getMirror(){return this.mirror}play(e=0){var r,n;this.service.state.matches("paused")?this.service.send({type:"PLAY",payload:{timeOffset:e}}):(this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:e}})),(n=(r=this.iframe.contentDocument)==null?void 0:r.getElementsByTagName("html")[0])==null||n.classList.remove("rrweb-paused"),this.emitter.emit(j.Start)}pause(e){var r,n;e===void 0&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),typeof e=="number"&&(this.play(e),this.service.send({type:"PAUSE"})),(n=(r=this.iframe.contentDocument)==null?void 0:r.getElementsByTagName("html")[0])==null||n.classList.add("rrweb-paused"),this.emitter.emit(j.Pause)}resume(e=0){this.warn("The 'resume' was deprecated in 1.0. Please use 'play' method which has the same interface."),this.play(e),this.emitter.emit(j.Resume)}destroy(){this.pause(),this.config.root.removeChild(this.wrapper),this.emitter.emit(j.Destroy)}startLive(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})}addEvent(e){const r=this.config.unpackFn?this.config.unpackFn(e):e;jn(r)&&this.mouse.classList.add("touch-device"),Promise.resolve().then(()=>this.service.send({type:"ADD_EVENT",payload:{event:r}}))}enableInteract(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"}disableInteract(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"}resetCache(){this.cache=Rr()}setupDom(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),this.config.mouseTail!==!1&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.iframe=document.createElement("iframe");const e=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&e.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",e.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe),this.iframe.contentWindow&&this.iframe.contentDocument&&(cs(this.iframe.contentWindow,this.iframe.contentDocument),Pt(this.iframe.contentWindow))}rebuildFullSnapshot(e,r=!1){if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&this.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={};const n=[],o=(l,a)=>{this.collectIframeAndAttachDocument(n,l);for(const c of this.config.plugins||[])c.onBuild&&c.onBuild(l,{id:a,replayer:this})};this.usingVirtualDom&&(this.virtualDom.destroyTree(),this.usingVirtualDom=!1),this.mirror.reset(),Po(e.data.node,{doc:this.iframe.contentDocument,afterAppend:o,cache:this.cache,mirror:this.mirror}),o(this.iframe.contentDocument,e.data.node.id);for(const{mutationInQueue:l,builtNode:a}of n)this.attachDocumentToIframe(l,a),this.newDocumentQueue=this.newDocumentQueue.filter(c=>c!==l);const{documentElement:i,head:s}=this.iframe.contentDocument;this.insertStyleRules(i,s),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(j.FullsnapshotRebuilded,e),r||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()}insertStyleRules(e,r){var n;const o=Ss(this.config.blockClass).concat(this.config.insertStyleRules);if(this.config.pauseAnimation&&o.push("html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }"),this.usingVirtualDom){const i=this.virtualDom.createElement("style");this.virtualDom.mirror.add(i,wn(i,this.virtualDom.unserializedId)),e.insertBefore(i,r),i.rules.push({source:N.StyleSheetRule,adds:o.map((s,l)=>({rule:s,index:l}))})}else{const i=document.createElement("style");e.insertBefore(i,r);for(let s=0;s{this.collectIframeAndAttachDocument(o,s);const a=n.getMeta(s);if(a?.type===x.Element&&a?.tagName.toUpperCase()==="HTML"){const{documentElement:c,head:u}=r.contentDocument;this.insertStyleRules(c,u)}if(!this.usingVirtualDom)for(const c of this.config.plugins||[])c.onBuild&&c.onBuild(s,{id:l,replayer:this})};Ke(e.node,{doc:r.contentDocument,mirror:n,hackCss:!0,skipChild:!1,afterAppend:i,cache:this.cache}),i(r.contentDocument,e.node.id);for(const{mutationInQueue:s,builtNode:l}of o)this.attachDocumentToIframe(s,l),this.newDocumentQueue=this.newDocumentQueue.filter(a=>a!==s)}collectIframeAndAttachDocument(e,r){if($e(r,this.mirror)){const n=this.newDocumentQueue.find(o=>o.parentId===this.mirror.getId(r));n&&e.push({mutationInQueue:n,builtNode:r})}}waitForStylesheetLoad(){var e;const r=(e=this.iframe.contentDocument)==null?void 0:e.head;if(r){const n=new Set;let o,i=this.service.state;const s=()=>{i=this.service.state};this.emitter.on(j.Start,s),this.emitter.on(j.Pause,s);const l=()=>{this.emitter.off(j.Start,s),this.emitter.off(j.Pause,s)};r.querySelectorAll('link[rel="stylesheet"]').forEach(a=>{a.sheet||(n.add(a),a.addEventListener("load",()=>{n.delete(a),n.size===0&&o!==-1&&(i.matches("playing")&&this.play(this.getCurrentTime()),this.emitter.emit(j.LoadStylesheetEnd),o&&clearTimeout(o),l())}))}),n.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(j.LoadStylesheetStart),o=setTimeout(()=>{i.matches("playing")&&this.play(this.getCurrentTime()),o=-1,l()},this.config.loadTimeout))}}preloadAllImages(){return rr(this,null,function*(){this.service.state;const e=()=>{this.service.state};this.emitter.on(j.Start,e),this.emitter.on(j.Pause,e);const r=[];for(const n of this.service.state.context.events)n.type===k.IncrementalSnapshot&&n.data.source===N.CanvasMutation&&(r.push(this.deserializeAndPreloadCanvasEvents(n.data,n)),("commands"in n.data?n.data.commands:[n.data]).forEach(o=>{this.preloadImages(o,n)}));return Promise.all(r)})}preloadImages(e,r){if(e.property==="drawImage"&&typeof e.args[0]=="string"&&!this.imageMap.has(r)){const n=document.createElement("canvas"),o=n.getContext("2d"),i=o?.createImageData(n.width,n.height);i?.data,JSON.parse(e.args[0]),o?.putImageData(i,0,0)}}deserializeAndPreloadCanvasEvents(e,r){return rr(this,null,function*(){if(!this.canvasEventMap.has(r)){const n={isUnchanged:!0};if("commands"in e){const o=yield Promise.all(e.commands.map(i=>rr(this,null,function*(){const s=yield Promise.all(i.args.map(ke(this.imageMap,null,n)));return tr(Ct({},i),{args:s})})));n.isUnchanged===!1&&this.canvasEventMap.set(r,tr(Ct({},e),{commands:o}))}else{const o=yield Promise.all(e.args.map(ke(this.imageMap,null,n)));n.isUnchanged===!1&&this.canvasEventMap.set(r,tr(Ct({},e),{args:o}))}}})}applyIncremental(e,r){var n,o,i;const{data:s}=e;switch(s.source){case N.Mutation:{try{this.applyMutation(s,r)}catch(l){this.warn(`Exception in mutation ${l.message||l}`,s)}break}case N.Drag:case N.TouchMove:case N.MouseMove:if(r){const l=s.positions[s.positions.length-1];this.mousePos={x:l.x,y:l.y,id:l.id,debugData:s}}else s.positions.forEach(l=>{const a={doAction:()=>{this.moveAndHover(l.x,l.y,l.id,r,s)},delay:l.timeOffset+e.timestamp-this.service.state.context.baselineTime};this.timer.addAction(a)}),this.timer.addAction({doAction(){},delay:e.delay-((n=s.positions[0])==null?void 0:n.timeOffset)});break;case N.MouseInteraction:{if(s.id===-1)break;const l=new Event(Te($[s.type])),a=this.mirror.getNode(s.id);if(!a)return this.debugNodeNotFound(s,s.id);this.emitter.emit(j.MouseInteraction,{type:s.type,target:a});const{triggerFocus:c}=this.config;switch(s.type){case $.Blur:"blur"in a&&a.blur();break;case $.Focus:c&&a.focus&&a.focus({preventScroll:!0});break;case $.Click:case $.TouchStart:case $.TouchEnd:case $.MouseDown:case $.MouseUp:r?(s.type===$.TouchStart?this.touchActive=!0:s.type===$.TouchEnd&&(this.touchActive=!1),s.type===$.MouseDown?this.lastMouseDownEvent=[a,l]:s.type===$.MouseUp&&(this.lastMouseDownEvent=null),this.mousePos={x:s.x,y:s.y,id:s.id,debugData:s}):(s.type===$.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(s.x,s.y,s.id,r,s),s.type===$.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):s.type===$.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):s.type===$.TouchEnd?this.mouse.classList.remove("touch-active"):a.dispatchEvent(l));break;case $.TouchCancel:r?this.touchActive=!1:this.mouse.classList.remove("touch-active");break;default:a.dispatchEvent(l)}break}case N.Scroll:{if(s.id===-1)break;if(this.usingVirtualDom){const l=this.virtualDom.mirror.getNode(s.id);if(!l)return this.debugNodeNotFound(s,s.id);l.scrollData=s;break}this.applyScroll(s,r);break}case N.ViewportResize:this.emitter.emit(j.Resize,{width:s.width,height:s.height});break;case N.Input:{if(s.id===-1)break;if(this.usingVirtualDom){const l=this.virtualDom.mirror.getNode(s.id);if(!l)return this.debugNodeNotFound(s,s.id);l.inputData=s;break}this.applyInput(s);break}case N.MediaInteraction:{const l=this.usingVirtualDom?this.virtualDom.mirror.getNode(s.id):this.mirror.getNode(s.id);if(!l)return this.debugNodeNotFound(s,s.id);const a=l;try{s.currentTime!==void 0&&(a.currentTime=s.currentTime),s.volume!==void 0&&(a.volume=s.volume),s.muted!==void 0&&(a.muted=s.muted),s.type===Ce.Pause&&a.pause(),s.type===Ce.Play&&a.play(),s.type===Ce.RateChange&&(a.playbackRate=s.playbackRate)}catch(c){this.warn(`Failed to replay media interactions: ${c.message||c}`)}break}case N.StyleSheetRule:case N.StyleDeclaration:{this.usingVirtualDom?s.styleId?this.constructedStyleMutations.push(s):s.id&&((o=this.virtualDom.mirror.getNode(s.id))==null||o.rules.push(s)):this.applyStyleSheetMutation(s);break}case N.CanvasMutation:{if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){const l=this.virtualDom.mirror.getNode(s.id);if(!l)return this.debugNodeNotFound(s,s.id);l.canvasMutations.push({event:e,mutation:s})}else{const l=this.mirror.getNode(s.id);if(!l)return this.debugNodeNotFound(s,s.id);Pn({event:e,mutation:s,target:l,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})}break}case N.Font:{try{const l=new FontFace(s.family,s.buffer?new Uint8Array(JSON.parse(s.fontSource)):s.fontSource,s.descriptors);(i=this.iframe.contentDocument)==null||i.fonts.add(l)}catch(l){this.warn(l)}break}case N.Selection:{if(r){this.lastSelectionData=s;break}this.applySelection(s);break}case N.AdoptedStyleSheet:{this.usingVirtualDom?this.adoptedStyleSheets.push(s):this.applyAdoptedStyleSheet(s);break}}}applyMutation(e,r){if(this.config.useVirtualDom&&!this.usingVirtualDom&&r&&(this.usingVirtualDom=!0,is(this.iframe.contentDocument,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length))for(const c in this.legacy_missingNodeRetryMap)try{const u=this.legacy_missingNodeRetryMap[c],d=bn(u.node,this.virtualDom,this.mirror);d&&(u.node=d)}catch(u){this.warn(u)}const n=this.usingVirtualDom?this.virtualDom.mirror:this.mirror;e.removes=e.removes.filter(c=>n.getNode(c.id)?!0:(this.warnNodeNotFound(e,c.id),!1)),e.removes.forEach(c=>{var u;const d=n.getNode(c.id);if(!d)return;let h=n.getNode(c.parentId);if(!h)return this.warnNodeNotFound(e,c.parentId);if(c.isShadow&&Me(h)&&(h=h.shadowRoot),n.removeNodeFromMap(d),h)try{h.removeChild(d),this.usingVirtualDom&&d.nodeName==="#text"&&h.nodeName==="STYLE"&&((u=h.rules)==null?void 0:u.length)>0&&(h.rules=[])}catch(p){if(p instanceof DOMException)this.warn("parent could not remove child in mutation",h,d,e);else throw p}});const o=Ct({},this.legacy_missingNodeRetryMap),i=[],s=c=>{let u=null;return c.nextId&&(u=n.getNode(c.nextId)),c.nextId!==null&&c.nextId!==void 0&&c.nextId!==-1&&!u},l=c=>{var u,d;if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");let h=n.getNode(c.parentId);if(!h)return c.node.type===x.Document?this.newDocumentQueue.push(c):i.push(c);c.node.isShadow&&(Me(h)||h.attachShadow({mode:"open"}),h=h.shadowRoot);let p=null,m=null;if(c.previousId&&(p=n.getNode(c.previousId)),c.nextId&&(m=n.getNode(c.nextId)),s(c))return i.push(c);if(c.node.rootId&&!n.getNode(c.node.rootId))return;const g=c.node.rootId?n.getNode(c.node.rootId):this.usingVirtualDom?this.virtualDom:this.iframe.contentDocument;if($e(h,n)){this.attachDocumentToIframe(c,h);return}const S=(v,C)=>{if(!this.usingVirtualDom)for(const T of this.config.plugins||[])T.onBuild&&T.onBuild(v,{id:C,replayer:this})},f=Ke(c.node,{doc:g,mirror:n,skipChild:!0,hackCss:!0,cache:this.cache,afterAppend:S});if(c.previousId===-1||c.nextId===-1){o[c.node.id]={node:f,mutation:c};return}const y=n.getMeta(h);if(y&&y.type===x.Element&&y.tagName==="textarea"&&c.node.type===x.Text){const v=Array.isArray(h.childNodes)?h.childNodes:Array.from(h.childNodes);for(const C of v)C.nodeType===h.TEXT_NODE&&h.removeChild(C)}else if(y?.type===x.Document){const v=h;c.node.type===x.DocumentType&&((u=v.childNodes[0])==null?void 0:u.nodeType)===Node.DOCUMENT_TYPE_NODE&&v.removeChild(v.childNodes[0]),f.nodeName==="HTML"&&v.documentElement&&v.removeChild(v.documentElement)}if(p&&p.nextSibling&&p.nextSibling.parentNode?h.insertBefore(f,p.nextSibling):m&&m.parentNode?h.contains(m)?h.insertBefore(f,m):h.insertBefore(f,null):h.appendChild(f),S(f,c.node.id),this.usingVirtualDom&&f.nodeName==="#text"&&h.nodeName==="STYLE"&&((d=h.rules)==null?void 0:d.length)>0&&(h.rules=[]),$e(f,this.mirror)){const v=this.mirror.getId(f),C=this.newDocumentQueue.find(T=>T.parentId===v);C&&(this.attachDocumentToIframe(C,f),this.newDocumentQueue=this.newDocumentQueue.filter(T=>T!==C))}(c.previousId||c.nextId)&&this.legacy_resolveMissingNode(o,h,f,c)};e.adds.forEach(c=>{l(c)});const a=Date.now();for(;i.length;){const c=Lr(i);if(i.length=0,Date.now()-a>500){this.warn("Timeout in the loop, please check the resolve tree data:",c);break}for(const u of c)n.getNode(u.value.parentId)?$t(u,d=>{l(d)}):this.debug("Drop resolve tree since there is no parent for the root node.",u)}Object.keys(o).length&&Object.assign(this.legacy_missingNodeRetryMap,o),Ar(e.texts).forEach(c=>{var u;const d=n.getNode(c.id);if(!d)return e.removes.find(h=>h.id===c.id)?void 0:this.warnNodeNotFound(e,c.id);if(d.textContent=c.value,this.usingVirtualDom){const h=d.parentNode;((u=h?.rules)==null?void 0:u.length)>0&&(h.rules=[])}}),e.attributes.forEach(c=>{const u=n.getNode(c.id);if(!u)return e.removes.find(d=>d.id===c.id)?void 0:this.warnNodeNotFound(e,c.id);for(const d in c.attributes)if(typeof d=="string"){const h=c.attributes[d];if(h===null)u.removeAttribute(d);else if(typeof h=="string")try{if(d==="_cssText"&&(u.nodeName==="LINK"||u.nodeName==="STYLE"))try{const p=n.getMeta(u);Object.assign(p.attributes,c.attributes);const m=Ke(p,{doc:u.ownerDocument,mirror:n,skipChild:!0,hackCss:!0,cache:this.cache}),g=u.nextSibling,S=u.parentNode;if(m&&S){S.removeChild(u),S.insertBefore(m,g),n.replace(c.id,m);break}}catch{}u.setAttribute(d,h)}catch(p){this.warn("An error occurred may due to the checkout feature.",p)}else if(d==="style"){const p=h,m=u;for(const g in p)if(p[g]===!1)m.style.removeProperty(g);else if(p[g]instanceof Array){const S=p[g];m.style.setProperty(g,S[0],S[1])}else{const S=p[g];m.style.setProperty(g,S)}}}})}applyScroll(e,r){var n,o;const i=this.mirror.getNode(e.id);if(!i)return this.debugNodeNotFound(e,e.id);const s=this.mirror.getMeta(i);if(i===this.iframe.contentDocument)(n=this.iframe.contentWindow)==null||n.scrollTo({top:e.y,left:e.x,behavior:r?"auto":"smooth"});else if(s?.type===x.Document)(o=i.defaultView)==null||o.scrollTo({top:e.y,left:e.x,behavior:r?"auto":"smooth"});else try{i.scrollTo({top:e.y,left:e.x,behavior:r?"auto":"smooth"})}catch{}}applyInput(e){const r=this.mirror.getNode(e.id);if(!r)return this.debugNodeNotFound(e,e.id);try{r.checked=e.isChecked,r.value=e.text}catch{}}applySelection(e){try{const r=new Set,n=e.ranges.map(({start:o,startOffset:i,end:s,endOffset:l})=>{const a=this.mirror.getNode(o),c=this.mirror.getNode(s);if(!a||!c)return;const u=new Range;u.setStart(a,i),u.setEnd(c,l);const d=a.ownerDocument,h=d?.getSelection();return h&&r.add(h),{range:u,selection:h}});r.forEach(o=>o.removeAllRanges()),n.forEach(o=>{var i;return o&&((i=o.selection)==null?void 0:i.addRange(o.range))})}catch{}}applyStyleSheetMutation(e){var r;let n=null;e.styleId?n=this.styleMirror.getStyle(e.styleId):e.id&&(n=((r=this.mirror.getNode(e.id))==null?void 0:r.sheet)||null),n&&(e.source===N.StyleSheetRule?this.applyStyleSheetRule(e,n):e.source===N.StyleDeclaration&&this.applyStyleDeclaration(e,n))}applyStyleSheetRule(e,r){var n,o,i,s;if((n=e.adds)==null||n.forEach(({rule:l,index:a})=>{try{if(Array.isArray(a)){const{positions:c,index:u}=jt(a);We(r.cssRules,c).insertRule(l,u)}else{const c=a===void 0?void 0:Math.min(a,r.cssRules.length);r?.insertRule(l,c)}}catch{}}),(o=e.removes)==null||o.forEach(({index:l})=>{try{if(Array.isArray(l)){const{positions:a,index:c}=jt(l);We(r.cssRules,a).deleteRule(c||0)}else r?.deleteRule(l)}catch{}}),e.replace)try{(i=r.replace)==null||i.call(r,e.replace)}catch{}if(e.replaceSync)try{(s=r.replaceSync)==null||s.call(r,e.replaceSync)}catch{}}applyStyleDeclaration(e,r){e.set&&We(r.rules,e.index).style.setProperty(e.set.property,e.set.value,e.set.priority),e.remove&&We(r.rules,e.index).style.removeProperty(e.remove.property)}applyAdoptedStyleSheet(e){var r;const n=this.mirror.getNode(e.id);if(!n)return;(r=e.styles)==null||r.forEach(l=>{var a;let c=null,u=null;if(Me(n)?u=((a=n.ownerDocument)==null?void 0:a.defaultView)||null:n.nodeName==="#document"&&(u=n.defaultView),!!u)try{c=new u.CSSStyleSheet,this.styleMirror.add(c,l.styleId),this.applyStyleSheetRule({source:N.StyleSheetRule,adds:l.rules},c)}catch{}});const o=10;let i=0;const s=(l,a)=>{const c=a.map(u=>this.styleMirror.getStyle(u)).filter(u=>u!==null);Me(l)?l.shadowRoot.adoptedStyleSheets=c:l.nodeName==="#document"&&(l.adoptedStyleSheets=c),c.length!==a.length&&is(l,a),0+100*i),i++)};s(n,e.styleIds)}legacy_resolveMissingNode(e,r,n,o){const{previousId:i,nextId:s}=o,l=i&&e[i],a=s&&e[s];if(l){const{node:c,mutation:u}=l;r.insertBefore(c,n),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,r,c,u)}if(a){const{node:c,mutation:u}=a;r.insertBefore(c,n.nextSibling),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,r,c,u)}}moveAndHover(e,r,n,o,i){const s=this.mirror.getNode(n);if(!s)return this.debugNodeNotFound(i,n);const l=Ut(s,this.iframe),a=e*l.absoluteScale+l.x,c=r*l.absoluteScale+l.y;this.mouse.style.left=`${a}px`,this.mouse.style.top=`${c}px`,o||this.drawMouseTail({x:a,y:c}),this.hoverElements(s)}drawMouseTail(e){if(!this.mouseTail)return;const{lineCap:r,lineWidth:n,strokeStyle:o,duration:i}=this.config.mouseTail===!0?nr:Object.assign({},nr,this.config.mouseTail),s=()=>{if(!this.mouseTail)return;const l=this.mouseTail.getContext("2d");!l||!this.tailPositions.length||(l.clearRect(0,0,this.mouseTail.width,this.mouseTail.height),l.beginPath(),l.lineWidth=n,l.lineCap=r,l.strokeStyle=o,l.moveTo(this.tailPositions[0].x,this.tailPositions[0].y),this.tailPositions.forEach(a=>l.lineTo(a.x,a.y)),l.stroke())};this.tailPositions.push(e),s(),setTimeout(()=>{this.tailPositions=this.tailPositions.filter(l=>l!==e),s()},i/this.speedService.state.context.timer.speed)}hoverElements(e){var r;(r=this.lastHoveredRootNode||this.iframe.contentDocument)==null||r.querySelectorAll(".\\:hover").forEach(o=>{o.classList.remove(":hover")}),this.lastHoveredRootNode=e.getRootNode();let n=e;for(;n;)n.classList&&n.classList.add(":hover"),n=n.parentElement}isUserInteraction(e){return e.type!==k.IncrementalSnapshot?!1:e.data.source>N.Mutation&&e.data.source<=N.Input}backToNormal(){this.nextUserInteractionEvent=null,!this.speedService.state.matches("normal")&&(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(j.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))}warnNodeNotFound(e,r){this.warn(`Node with id '${r}' not found. `,e)}warnCanvasMutationFailed(e,r){this.warn("Has error on canvas update",r,"canvas mutation:",e)}debugNodeNotFound(e,r){this.debug(`Node with id '${r}' not found. `,e)}warn(...e){!this.config.showWarning||this.config.logger.warn(Un,...e)}debug(...e){!this.config.showDebug||this.config.logger.log(Un,...e)}}const{addCustomEvent:$s}=Le,{freezePage:Ws}=Le;var se=Uint8Array,ue=Uint16Array,nt=Uint32Array,Et=new se([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Nt=new se([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),or=new se([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Vn=function(t,e){for(var r=new ue(31),n=0;n<31;++n)r[n]=e+=1<>>1|(J&21845)<<1;De=(De&52428)>>>2|(De&13107)<<2,De=(De&61680)>>>4|(De&3855)<<4,sr[J]=((De&65280)>>>8|(De&255)<<8)>>>1}for(var ve=function(t,e,r){for(var n=t.length,o=0,i=new ue(e);o>>a]=c}else for(l=new ue(n),o=0;o>>15-t[o];return l},Oe=new se(288),J=0;J<144;++J)Oe[J]=8;for(var J=144;J<256;++J)Oe[J]=9;for(var J=256;J<280;++J)Oe[J]=7;for(var J=280;J<288;++J)Oe[J]=8;for(var ot=new se(32),J=0;J<32;++J)ot[J]=5;var js=ve(Oe,9,0),Vs=ve(Oe,9,1),Bs=ve(ot,5,0),Gs=ve(ot,5,1),ar=function(t){for(var e=t[0],r=1;re&&(e=t[r]);return e},ge=function(t,e,r){var n=e/8>>0;return(t[n]|t[n+1]<<8)>>>(e&7)&r},lr=function(t,e){var r=e/8>>0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>>(e&7)},cr=function(t){return(t/8>>0)+(t&7&&1)},ur=function(t,e,r){(e==null||e<0)&&(e=0),(r==null||r>t.length)&&(r=t.length);var n=new(t instanceof ue?ue:t instanceof nt?nt:se)(r-e);return n.set(t.subarray(e,r)),n},zs=function(t,e,r){var n=t.length,o=!e||r,i=!r||r.i;r||(r={}),e||(e=new se(n*3));var s=function(ce){var me=e.length;if(ce>me){var de=new se(Math.max(me*2,ce));de.set(e),e=de}},l=r.f||0,a=r.p||0,c=r.b||0,u=r.l,d=r.d,h=r.m,p=r.n,m=n*8;do{if(!u){r.f=l=ge(t,a,1);var g=ge(t,a+1,3);if(a+=3,g)if(g==1)u=Vs,d=Gs,h=9,p=5;else if(g==2){var v=ge(t,a,31)+257,C=ge(t,a+10,15)+4,T=v+ge(t,a+5,31)+1;a+=14;for(var I=new se(T),L=new se(19),E=0;Em)break;for(var q=ve(L,Y,1),E=0;E>>4;if(S<16)I[E++]=S;else{var V=0,B=0;for(S==16?(B=3+ge(t,a,3),a+=2,V=I[E-1]):S==17?(B=3+ge(t,a,7),a+=3):S==18&&(B=11+ge(t,a,127),a+=7);B--;)I[E++]=V}}var A=I.subarray(0,v),F=I.subarray(v);h=ar(A),p=ar(F),u=ve(A,h,1),d=ve(F,p,1)}else throw"invalid block type";else{var S=cr(a)+4,f=t[S-4]|t[S-3]<<8,y=S+f;if(y>n){if(i)throw"unexpected EOF";break}o&&s(c+f),e.set(t.subarray(S,y),c),r.b=c+=f,r.p=a=y*8;continue}if(a>m)throw"unexpected EOF"}o&&s(c+131072);for(var O=(1<>>4;if(a+=V&15,a>m)throw"unexpected EOF";if(!V)throw"invalid length/literal";if(b<256)e[c++]=b;else if(b==256){u=null;break}else{var M=b-254;if(b>264){var E=b-257,D=Et[E];M=ge(t,a,(1<>>4;if(!z)throw"invalid distance";a+=z&15;var F=Us[ee];if(ee>3){var D=Nt[ee];F+=lr(t,a)&(1<m)throw"unexpected EOF";o&&s(c+131072);for(var X=c+M;c>0;t[n]|=r,t[n+1]|=r>>>8},it=function(t,e,r){r<<=e&7;var n=e/8>>0;t[n]|=r,t[n+1]|=r>>>8,t[n+2]|=r>>>16},dr=function(t,e){for(var r=[],n=0;nh&&(h=i[n].s);var p=new ue(h+1),m=hr(r[u-1],p,0);if(m>e){var n=0,g=0,S=m-e,f=1<e)g+=f-(1<>>=S;g>0;){var v=i[n].s;p[v]=0&&g;--n){var C=i[n].s;p[C]==e&&(--p[C],++g)}m=e}return[new se(p),m]},hr=function(t,e,r){return t.s==-1?Math.max(hr(t.l,e,r+1),hr(t.r,e,r+1)):e[t.s]=r},Yn=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new ue(++e),n=0,o=t[0],i=1,s=function(a){r[n++]=a},l=1;l<=e;++l)if(t[l]==o&&l!=e)++i;else{if(!o&&i>2){for(;i>138;i-=138)s(32754);i>2&&(s(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(s(o),--i;i>6;i-=6)s(8304);i>2&&(s(i-3<<5|8208),i=0)}for(;i--;)s(o);i=1,o=t[l]}return[r.subarray(0,n),e]},st=function(t,e){for(var r=0,n=0;n>>8,t[o+2]=t[o]^255,t[o+3]=t[o+1]^255;for(var i=0;i4&&!W[or[U-1]];--U);var V=c+5<<3,B=st(o,Oe)+st(i,ot)+s,A=st(o,h)+st(i,g)+s+14+3*U+st(L,W)+(2*L[16]+3*L[17]+7*L[18]);if(V<=B&&V<=A)return Tt(e,u,t.subarray(a,a+c));var F,O,G,w;if(Ee(e,u,1+(A15&&(Ee(e,u,z[E]>>>5&127),u+=z[E]>>>12)}}else F=js,O=Oe,G=Bs,w=ot;for(var E=0;E255){var ee=n[E]>>>18&31;it(e,u,F[ee+257]),u+=O[ee+257],ee>7&&(Ee(e,u,n[E]>>>23&31),u+=Et[ee]);var X=n[E]&31;it(e,u,G[X]),u+=w[X],X>3&&(it(e,u,n[E]>>>5&8191),u+=Nt[X])}else it(e,u,F[n[E]]),u+=O[n[E]];return it(e,u,F[256]),u+O[256]},Hs=new nt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ys=new se(0),Xs=function(t,e,r,n,o,i){var s=t.length,l=new se(n+s+5*(1+Math.floor(s/7e3))+o),a=l.subarray(n,l.length-o),c=0;if(!e||s<8)for(var u=0;u<=s;u+=65535){var d=u+65535;d>>13,m=h&8191,g=(1<7e3||W>24576)&&F>423){c=Xn(t,a,0,T,I,L,Y,W,U,u-U,c),W=E=Y=0,U=u;for(var O=0;O<286;++O)I[O]=0;for(var O=0;O<30;++O)L[O]=0}var G=2,w=0,b=m,M=B-A&32767;if(F>2&&V==C(u-M))for(var D=Math.min(p,F)-1,z=Math.min(32767,u),ee=Math.min(258,F);M<=z&&--b&&B!=A;){if(t[u+G]==t[u+G-M]){for(var X=0;XG){if(G=X,w=M,X>D)break;for(var ce=Math.min(M,X-2),me=0,O=0;Ome&&(me=ie,A=de)}}}B=A,A=S[B],M+=B-A+32768&32767}if(w){T[W++]=268435456|ir[G]<<18|Hn[w];var H=ir[G]&31,Q=Hn[w]&31;Y+=Et[H]+Nt[Q],++I[257+H],++L[Q],q=u+G,++E}else T[W++]=t[u],++I[t[u]]}}c=Xn(t,a,i,T,I,L,Y,W,U,u-U,c),i||(c=Tt(a,c,Ys))}return ur(l,0,n+cr(c)+o)},Zs=function(){var t=1,e=0;return{p:function(r){for(var n=t,o=e,i=r.length,s=0;s!=i;){for(var l=Math.min(s+5552,i);s>>8<<16|(e&255)<<8|e>>>8)+((t&255)<<23)*2}}},Ks=function(t,e,r,n,o){return Xs(t,e.level==null?6:e.level,e.mem==null?Math.ceil(Math.max(8,Math.min(13,Math.log(t.length)))*1.5):12+e.mem,r,n,!o)},Js=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8},Qs=function(t,e){var r=e.level,n=r==0?0:r<6?1:r==9?3:2;t[0]=120,t[1]=n<<6|(n?32-2*n:1)},qs=function(t){if((t[0]&15)!=8||t[0]>>>4>7||(t[0]<<8|t[1])%31)throw"invalid zlib data";if(t[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function ea(t,e){e===void 0&&(e={});var r=Zs();r.p(t);var n=Ks(t,e,2,4);return Qs(n,e),Js(n,n.length-4,r.d()),n}function ta(t,e){return zs((qs(t),t.subarray(2,-4)),e)}function Zn(t,e){var r=t.length;if(!e&&typeof TextEncoder<"u")return new TextEncoder().encode(t);for(var n=new se(t.length+(t.length>>>1)),o=0,i=function(c){n[o++]=c},s=0;sn.length){var l=new se(o+8+(r-s<<1));l.set(n),n=l}var a=t.charCodeAt(s);a<128||e?i(a):a<2048?(i(192|a>>>6),i(128|a&63)):a>55295&&a<57344?(a=65536+(a&1047552)|t.charCodeAt(++s)&1023,i(240|a>>>18),i(128|a>>>12&63),i(128|a>>>6&63),i(128|a&63)):(i(224|a>>>12),i(128|a>>>6&63),i(128|a&63))}return ur(n,0,o)}function Kn(t,e){var r="";if(!e&&typeof TextDecoder<"u")return new TextDecoder().decode(t);for(var n=0;n>10,56320|o&1023))}return r}const pr="v1";var ra=Object.defineProperty,na=Object.defineProperties,oa=Object.getOwnPropertyDescriptors,Jn=Object.getOwnPropertySymbols,ia=Object.prototype.hasOwnProperty,sa=Object.prototype.propertyIsEnumerable,Qn=(t,e,r)=>e in t?ra(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,aa=(t,e)=>{for(var r in e||(e={}))ia.call(e,r)&&Qn(t,r,e[r]);if(Jn)for(var r of Jn(e))sa.call(e,r)&&Qn(t,r,e[r]);return t},la=(t,e)=>na(t,oa(e));const ca=t=>{const e=la(aa({},t),{v:pr});return Kn(ea(Zn(JSON.stringify(e))),!0)},ua=t=>{if(typeof t!="string")return t;try{const e=JSON.parse(t);if(e.timestamp)return e}catch{}try{const e=JSON.parse(Kn(ta(Zn(t,!0))));if(e.v===pr)return e;throw new Error(`These events were packed with packer ${e.v} which is incompatible with current packer ${pr}.`)}catch(e){throw console.error(e),new Error("Unknown data format.")}};class ze{constructor(e){this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){const e=this.lineNumber||"",r=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${e}:${r})`:`${this.fileName}:${e}:${r}`}}const da=/(^|@)\S+:\d+/,qn=/^\s*at .*(\S+:\d+|\(native\))/m,ha=/^(eval@)?(\[native code])?$/,mr={parse:function(t){return t?typeof t.stacktrace<"u"||typeof t["opera#sourceloc"]<"u"?this.parseOpera(t):t.stack&&t.stack.match(qn)?this.parseV8OrIE(t):t.stack?this.parseFFOrSafari(t):(console.warn("[console-record-plugin]: Failed to parse error object:",t),[]):[]},extractLocation:function(t){if(t.indexOf(":")===-1)return[t];const e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));if(!e)throw new Error(`Cannot parse given url: ${t}`);return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE:function(t){return t.stack.split(` `).filter(function(e){return!!e.match(qn)},this).map(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let r=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const n=r.match(/ (\((.+):(\d+):(\d+)\)$)/);r=n?r.replace(n[0],""):r;const o=r.split(/\s+/).slice(1),i=this.extractLocation(n?n[1]:o.pop()),s=o.join(" ")||void 0,l=["eval",""].indexOf(i[0])>-1?void 0:i[0];return new ze({functionName:s,fileName:l,lineNumber:i[1],columnNumber:i[2]})},this)},parseFFOrSafari:function(t){return t.stack.split(` `).filter(function(e){return!e.match(ha)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),e.indexOf("@")===-1&&e.indexOf(":")===-1)return new ze({functionName:e});{const r=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(r),o=n&&n[1]?n[1]:void 0,i=this.extractLocation(e.replace(r,""));return new ze({functionName:o,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})}},this)},parseOpera:function(t){return!t.stacktrace||t.message.indexOf(` `)>-1&&t.message.split(` `).length>t.stacktrace.split(` `).length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9:function(t){const e=/Line (\d+).*script (?:in )?(\S+)/i,r=t.message.split(` `),n=[];for(let o=2,i=r.length;o/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new ze({functionName:o,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})},this)}};function pa(t){if(!t||!t.outerHTML)return"";let e="";for(;t.parentElement;){let r=t.localName;if(!r)break;r=r.toLowerCase();const n=t.parentElement,o=[];if(n.children&&n.children.length>0)for(let i=0;i1&&(r+=`:eq(${o.indexOf(t)})`),e=r+(e?">"+e:""),t=n}return e}function fr(t){return Object.prototype.toString.call(t)==="[object Object]"}function eo(t,e){if(e===0)return!0;const r=Object.keys(t);for(const n of r)if(fr(t[n])&&eo(t[n],e-1))return!0;return!1}function He(t,e){const r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,e);const n=[],o=[];return JSON.stringify(t,function(l,a){if(n.length>0){const c=n.indexOf(this);~c?n.splice(c+1):n.push(this),~c?o.splice(c,1/0,l):o.push(l),~n.indexOf(a)&&(n[0]===a?a="[Circular ~]":a="[Circular ~."+o.slice(0,n.indexOf(a)).join(".")+"]")}else n.push(a);if(a===null)return a;if(a===void 0)return"undefined";if(i(a))return s(a);if(a instanceof Event){const c={};for(const u in a){const d=a[u];Array.isArray(d)?c[u]=pa(d.length?d[0]:null):c[u]=d}return c}else{if(a instanceof Node)return a instanceof HTMLElement?a?a.outerHTML:"":a.nodeName;if(a instanceof Error)return a.stack?a.stack+` End of stack for Error object`:a.name+": "+a.message}return a});function i(l){return!!(fr(l)&&Object.keys(l).length>r.numOfKeysLimit||typeof l=="function"||fr(l)&&eo(l,r.depthOfLimit))}function s(l){let a=l.toString();return r.stringLengthLimit&&a.length>r.stringLengthLimit&&(a=`${a.slice(0,r.stringLengthLimit)}...`),a}}const to={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function ma(t,e,r){const n=r?Object.assign({},to,r):to,o=n.logger;if(!o)return()=>{};let i;typeof o=="string"?i=e[o]:i=o;let s=0,l=!1;const a=[];if(n.level.includes("error")){const u=h=>{const p=h.message,m=h.error,g=mr.parse(m).map(f=>f.toString()),S=[He(p,n.stringifyOptions)];t({level:"error",trace:g,payload:S})};e.addEventListener("error",u),a.push(()=>{e.removeEventListener("error",u)});const d=h=>{let p,m;h.reason instanceof Error?(p=h.reason,m=[He(`Uncaught (in promise) ${p.name}: ${p.message}`,n.stringifyOptions)]):(p=new Error,m=[He("Uncaught (in promise)",n.stringifyOptions),He(h.reason,n.stringifyOptions)]);const g=mr.parse(p).map(S=>S.toString());t({level:"error",trace:g,payload:m})};e.addEventListener("unhandledrejection",d),a.push(()=>{e.removeEventListener("unhandledrejection",d)})}for(const u of n.level)a.push(c(i,u));return()=>{a.forEach(u=>u())};function c(u,d){return u[d]?Re(u,d,h=>(...p)=>{if(h.apply(this,p),!l){l=!0;try{const m=mr.parse(new Error).map(S=>S.toString()).splice(1),g=p.map(S=>He(S,n.stringifyOptions));s++,s{}}}const gr="rrweb/console@1",fa=t=>({name:gr,observer:ma,options:t}),Mt="__rrweb_original__",ga={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],replayLogger:void 0};class ya{constructor(e){this.config=Object.assign(ga,e)}getConsoleLogger(){const e={};for(const r of this.config.level)r==="trace"?e[r]=n=>{(console.log[Mt]?console.log[Mt]:console.log)(...n.payload.map(o=>JSON.parse(o)),this.formatMessage(n))}:e[r]=n=>{(console[r][Mt]?console[r][Mt]:console[r])(...n.payload.map(o=>JSON.parse(o)),this.formatMessage(n))};return e}formatMessage(e){if(e.trace.length===0)return"";const r=` at `;let n=r;return n+=e.trace.join(r),n}}const va=t=>{const e=t?.replayLogger||new ya(t).getConsoleLogger();return{handler(r,n,o){let i=null;if(r.type===k.IncrementalSnapshot&&r.data.source===N.Log?i=r.data:r.type===k.Plugin&&r.data.plugin===gr&&(i=r.data.payload),i)try{typeof e[i.level]=="function"&&e[i.level](i)}catch(s){o.replayer.config.showWarning&&console.warn(s)}}}};return ne.EventType=k,ne.IncrementalSource=N,ne.MouseInteractions=$,ne.PLUGIN_NAME=gr,ne.Replayer=Ps,ne.ReplayerEvents=j,ne.addCustomEvent=$s,ne.freezePage=Ws,ne.getRecordConsolePlugin=fa,ne.getReplayConsolePlugin=va,ne.pack=ca,ne.record=Le,ne.unpack=ua,ne.utils=$o,Object.defineProperty(ne,"__esModule",{value:!0}),ne}({});