@replayd/core 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/replay.js CHANGED
@@ -1,6 +1,6 @@
1
- var tn=Object.defineProperty,rn=(e,t,r)=>t in e?tn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,y=(e,t,r)=>rn(e,typeof t!="symbol"?t+"":t,r),tr,P=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e[e.Asset=7]="Asset",e[e.Annotation=8]="Annotation",e))(P||{}),F=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(F||{}),me=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(me||{}),Ie=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Ie||{}),He=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(He||{}),_e=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(_e||{}),te=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(te||{}),rr={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument","firstChild","lastChild","nextSibling","previousSibling"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},nr={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Ge={},Nt={},sr=0,nn=()=>!!globalThis.Zone;function qt(e){if(Ge[e])return Ge[e];let t=globalThis[e],r=t.prototype,n=e in rr?rr[e]:void 0,s=!!(n&&n.every(c=>{var i,d;return!!((d=(i=Object.getOwnPropertyDescriptor(r,c))==null?void 0:i.get)!=null&&d.toString().includes("[native code]"))})),o=e in nr?nr[e]:void 0,a=!!(o&&o.every(c=>{var i;return typeof r[c]=="function"&&((i=r[c])==null?void 0:i.toString().includes("[native code]"))}));if(s&&a&&!nn())return Ge[e]=t.prototype,t.prototype;try{let c=document.createElement("iframe");c.style.display="none",document.body.appendChild(c);let i=c.contentWindow;if(!i)return t.prototype;let d=i[e].prototype;if(!d)return c.remove(),r;let u=navigator.userAgent;return u.includes("Safari")&&!u.includes("Chrome")?(c.classList.add("rr-block"),c.setAttribute("__rrwebUntaintedMutationObserver",""),Nt[e]=()=>c.remove()):c.remove(),Ge[e]=d}catch{return r}}var kt={};function ge(e,t,r){var n,s;let o=(n=kt[e])==null?void 0:n[r];if(o)return o.call(t);let a=qt(e),c=(s=Object.getOwnPropertyDescriptor(a,r))==null?void 0:s.get;return c?((kt[e]||(kt[e]={}))[r]=c,c.call(t)):t[r]}var Rt={};function gr(e,t,r){let n=`${e}.${String(r)}`;if(Rt[n])return Rt[n].bind(t);let o=qt(e)[r];return typeof o!="function"?t[r]:(Rt[n]=o,o.bind(t))}function sn(e){return ge("Node",e,"ownerDocument")}function on(e){return ge("Node",e,"childNodes")}function an(e){return ge("Node",e,"parentNode")}function ln(e){return ge("Node",e,"parentElement")}function cn(e){return ge("Node",e,"textContent")}function dn(e){return ge("Node",e,"firstChild")}function un(e){return ge("Node",e,"lastChild")}function fn(e){return ge("Node",e,"nextSibling")}function hn(e){return ge("Node",e,"previousSibling")}function pn(e,t){return gr("Node",e,"contains")(t)}function mn(e){return gr("Node",e,"getRootNode")()}function gn(e){return!e||!("host"in e)?null:ge("ShadowRoot",e,"host")}function yn(e){return e.styleSheets}function bn(e){return!e||!("shadowRoot"in e)?null:ge("Element",e,"shadowRoot")}function Sn(e,t){return ge("Element",e,"querySelector")(t)}function wn(e,t){return ge("Element",e,"querySelectorAll")(t)}function yr(){let e=qt("MutationObserver");sr++;let t=!1;return[e.constructor,()=>{if(t||(t=!0,--sr!==0))return;let r=Nt.MutationObserver;if(r)try{r()}finally{delete Ge.MutationObserver,delete Nt.MutationObserver}}]}var Ye=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Ye=()=>new Date().getTime());function Te(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],s=r(n);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=s,()=>{e[t]=n}}catch{return()=>{}}}var C={ownerDocument:sn,childNodes:on,parentNode:an,parentElement:ln,textContent:cn,firstChild:dn,lastChild:un,nextSibling:fn,previousSibling:hn,contains:pn,getRootNode:mn,host:gn,styleSheets:yn,shadowRoot:bn,querySelector:Sn,querySelectorAll:wn,nowTimestamp:Ye,mutationObserverCtor:yr,patch:Te};function br(e){return e.nodeType===e.ELEMENT_NODE}function Ve(e){let t=e&&"host"in e&&"mode"in e&&C.host(e)||null;return!!(t&&"shadowRoot"in t&&C.shadowRoot(t)===e)}function Je(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function vn(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function Cn(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function xt(e){try{let t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);let n=Array.from(t,s=>Sr(s,r)).join("");return vn(n)}catch{return null}}function Sr(e,t){if(In(e)){let r;try{r=xt(e.styleSheet)||Cn(e)}catch{r=e.cssText}return e.styleSheet.href?ut(r,e.styleSheet.href):r}else{let r=e.cssText;return kn(e)&&e.selectorText.includes(":")&&(r=Mn(r)),t?ut(r,t):r}}function Mn(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function In(e){return"styleSheet"in e}function kn(e){return"selectorText"in e}var lt=class{constructor(){y(this,"idNodeMap",new Map),y(this,"nodeMetaMap",new WeakMap)}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(s=>this.removeNodeFromMap(s));let n=C.shadowRoot(t);n&&this.removeNodeFromMap(n)}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){let n=this.getNode(t);if(n){let s=this.nodeMetaMap.get(n);s&&this.nodeMetaMap.set(r,s)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Rn(){return new lt}function ct({element:e,maskInputOptions:t,tagName:r,type:n,value:s,maskInputFn:o}){let a=s||"",c=n&&Oe(n);return(t[r.toLowerCase()]||c&&t[c])&&(o?a=o(a,e):a="*".repeat(a.length)),a}function Oe(e){return e.toLowerCase()}var or="__rrweb_original__";function En(e){let t=e.getContext("2d");if(!t)return!0;let r=50;for(let n=0;n<e.width;n+=r)for(let s=0;s<e.height;s+=r){let o=t.getImageData,a=or in o?o[or]:o;if(new Uint32Array(a.call(t,n,s,Math.min(r,e.width-n),Math.min(r,e.height-s)).data.buffer).some(i=>i!==0))return!1}return!0}function dt(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Oe(t):null}function wr(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i,s=r.pathname.match(n);return s?.[1]??null}function On(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var Nn=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,xn=/^(?:[a-z+]+:)?\/\//i,Tn=/^www\..*/i,Dn=/^(data:)([^,]*),(.*)/i;function ut(e,t){return(e||"").replace(Nn,(r,n,s,o,a,c)=>{let i=s||a||c,d=n||o||"";if(!i)return r;if(xn.test(i)||Tn.test(i))return`url(${d}${i}${d})`;if(Dn.test(i))return`url(${d}${i}${d})`;if(i[0]==="/")return`url(${d}${On(t)+i}${d})`;let u=i.split("#")[0],f=i.substring(u.length),h=t.split("#")[0].split("/"),p=u.split("/");h.pop();for(let m of p)m!=="."&&(m===".."?h.pop():h.push(m));return`url(${d}${h.join("/")}${f}${d})`})}var vr="(?:/\\*[^*]*\\*/)|[\\s;]",Ln=new RegExp(`${vr}|\\b(0)px?`,"g"),An=new RegExp(vr,"g");function nt(e,t=!1){return t?e.replace(An,""):e.replace(Ln,"$1")}function _n(e,t,r=!1){let n=Array.from(t.childNodes),s=[],o=0;if(n.length>1&&e&&typeof e=="string"){let a=nt(e,r),c=a.length/e.length;for(let i=1;i<n.length;i++)if(n[i].textContent&&typeof n[i].textContent=="string"){let d=nt(n[i].textContent,r),u=100,f=3;for(;f<d.length&&(d[f].match(/[a-zA-Z0-9]/)||d.indexOf(d.substring(0,f),1)!==-1);f++);for(;f<d.length;f++){let h=d.substring(0,f),p=a.split(h),m=-1;if(p.length===2)m=p[0].length;else if(p.length>2&&p[0]===""&&n[i-1].textContent!=="")m=a.indexOf(h,1);else if(p.length===1){if(h=h.substring(0,h.length-1),p=a.split(h),p.length<=1)return s.push(e),s;f=u+1}else f===d.length-1&&(m=a.indexOf(h));if(p.length>=2&&f>u){let l=n[i-1].textContent;if(l&&typeof l=="string"){let b=nt(l).length;m=a.indexOf(h,b)}m===-1&&(m=p[0].length)}if(m!==-1){let l=Math.floor(m/c);for(;l>0&&l<e.length;){if(o+=1,o>50*n.length)return s.push(e),s;let b=nt(e.substring(0,l),r);if(b.length===m){s.push(e.substring(0,l)),e=e.substring(l),a=a.substring(m);break}else b.length<m?l+=Math.max(1,Math.floor((m-b.length)/c)):l-=Math.max(1,Math.floor((b.length-m)*c))}break}}}}return s.push(e),s}function Pn(e,t){return _n(e,t).join("/* rr_split */")}var Fn=1,Wn=new RegExp("[^a-z0-9-_:]"),ft=-2;function Cr(){return Fn++}function Un(e){if(e instanceof HTMLFormElement)return"form";let t=Oe(e.tagName);return Wn.test(t)?"div":t}var Ae,ir,Bn=/^[^ \t\n\r\u000c]+/,Hn=/^[, \t\n\r\u000c]+/;function zn(e,t){if(t.trim()==="")return t;let r=0;function n(o){let a,c=o.exec(t.substring(r));return c?(a=c[0],r+=a.length,a):""}let s=[];for(;n(Hn),!(r>=t.length);){let o=n(Bn);if(o.slice(-1)===",")o=Fe(e,o.substring(0,o.length-1)),s.push(o);else{let a="";o=Fe(e,o);let c=!1;for(;;){let i=t.charAt(r);if(i===""){s.push((o+a).trim());break}else if(c)i===")"&&(c=!1);else if(i===","){r+=1,s.push((o+a).trim());break}else i==="("&&(c=!0);a+=i,r+=1}}}return s.join(", ")}var ar=new WeakMap;function Fe(e,t){return!t||t.trim()===""?t:$t(e,t)}function jn(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function $t(e,t){let r=ar.get(e);if(r||(r=e.createElement("a"),ar.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function Mr(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&["table","td","th"].includes(t)?Fe(e,n):r==="srcset"?zn(e,n):r==="style"?ut(n,$t(e)):t==="object"&&r==="data"?Fe(e,n):n)}function Ir(e,t,r){return["video","audio"].includes(e)&&Oe(t)==="autoplay"}function qn(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){let s=e.classList[n];if(t.test(s))return!0}if(r)return e.matches(r)}catch{}return!1}function ht(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?ht(C.parentNode(e),t,r):!1;for(let n=e.classList.length;n--;){let s=e.classList[n];if(t.test(s))return!0}return r?ht(C.parentNode(e),t,r):!1}function kr(e,t,r,n){let s;if(br(e)){if(s=e,!C.childNodes(s).length)return!1}else{if(C.parentElement(e)===null)return!1;s=C.parentElement(e)}try{if(typeof t=="string"){if(n){if(s.closest(`.${t}`))return!0}else if(s.classList.contains(t))return!0}else if(ht(s,t,n))return!0;if(r){if(n){if(s.closest(r))return!0}else if(s.matches(r))return!0}}catch{}return!1}function $n(e,t,r){let n=e.contentWindow;if(!n)return;let s=!1,o;try{o=n.document.readyState}catch{return}if(o!=="complete"){let c=setTimeout(()=>{s||(t(),s=!0)},r);e.addEventListener("load",()=>{clearTimeout(c),s=!0,t()});return}let a="about:blank";if(n.location.href!==a||e.src===a||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function Gn(e,t,r){let n=!1,s;try{s=e.sheet}catch{return}if(s)return;let o=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(o),n=!0,t()})}function Vn(e,t){let{doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:a,inlineStylesheet:c,maskInputOptions:i={},maskTextFn:d,maskInputFn:u,dataURLOptions:f={},inlineImages:h,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:l=!1,cssCaptured:b=!1}=t,k=Jn(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:te.Document,childNodes:[],compatMode:e.compatMode}:{type:te.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:te.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:k};case e.ELEMENT_NODE:return Yn(e,{doc:r,blockClass:s,blockSelector:o,inlineStylesheet:c,maskInputOptions:i,maskInputFn:u,dataURLOptions:f,inlineImages:h,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:l,rootId:k});case e.TEXT_NODE:return Xn(e,{doc:r,needsMask:a,maskTextFn:d,rootId:k,cssCaptured:b});case e.CDATA_SECTION_NODE:return{type:te.CDATA,textContent:"",rootId:k};case e.COMMENT_NODE:return{type:te.Comment,textContent:C.textContent(e)||"",rootId:k};default:return!1}}function Jn(e,t){let r=t.getId(e);return r===-1||r===1?void 0:r}function Xn(e,t){let{needsMask:r,maskTextFn:n,rootId:s,cssCaptured:o}=t,a=C.parentNode(e),c=a&&a.tagName,i="",d=c==="STYLE"?!0:void 0,u=c==="SCRIPT"?!0:void 0;return u?i="SCRIPT_PLACEHOLDER":o||(i=C.textContent(e),d&&i&&(i=ut(i,$t(t.doc)))),!d&&!u&&i&&r&&(i=n?n(i,C.parentElement(e)):i.replace(/[\S]/g,"*")),{type:te.Text,textContent:i||"",rootId:s}}function Yn(e,t){let{doc:r,blockClass:n,blockSelector:s,inlineStylesheet:o,maskInputOptions:a={},maskInputFn:c,dataURLOptions:i={},inlineImages:d,recordCanvas:u,keepIframeSrcFn:f,newlyAddedElement:h=!1,rootId:p}=t,m=qn(e,n,s),l=Un(e),b={},k=e.attributes.length;for(let g=0;g<k;g++){let w=e.attributes[g];Ir(l,w.name,w.value)||(b[w.name]=Mr(r,l,Oe(w.name),w.value))}if(l==="link"&&o){let g=Array.from(r.styleSheets).find(E=>E.href===e.href),w=null;g&&(w=xt(g)),w&&(delete b.rel,delete b.href,b._cssText=w)}if(l==="style"&&e.sheet){let g=xt(e.sheet);g&&(e.childNodes.length>1&&(g=Pn(g,e)),b._cssText=g)}if(["input","textarea","select"].includes(l)){let g=e.value,w=e.checked;b.type!=="radio"&&b.type!=="checkbox"&&b.type!=="submit"&&b.type!=="button"&&g?b.value=ct({element:e,type:dt(e),tagName:l,value:g,maskInputOptions:a,maskInputFn:c}):w&&(b.checked=w)}if(l==="option"&&(e.selected&&!a.select?b.selected=!0:delete b.selected),l==="dialog"&&e.open&&(b.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),l==="canvas"&&u){if(e.__context==="2d")En(e)||(b.rr_dataURL=e.toDataURL(i.type,i.quality));else if(!("__context"in e)){let g=e.toDataURL(i.type,i.quality),w=r.createElement("canvas");w.width=e.width,w.height=e.height;let E=w.toDataURL(i.type,i.quality);g!==E&&(b.rr_dataURL=g)}}if(l==="img"&&d){Ae||(Ae=r.createElement("canvas"),ir=Ae.getContext("2d"));let g=e,w=g.currentSrc||g.getAttribute("src")||"<unknown-src>",E=g.crossOrigin,_=()=>{g.removeEventListener("load",_);try{Ae.width=g.naturalWidth,Ae.height=g.naturalHeight,ir.drawImage(g,0,0),b.rr_dataURL=Ae.toDataURL(i.type,i.quality)}catch(z){if(g.crossOrigin!=="anonymous"){g.crossOrigin="anonymous",g.complete&&g.naturalWidth!==0?_():g.addEventListener("load",_);return}else console.warn(`Cannot inline img src=${w}! Error: ${z}`)}g.crossOrigin==="anonymous"&&(E?b.crossOrigin=E:g.removeAttribute("crossorigin"))};g.complete&&g.naturalWidth!==0?_():g.addEventListener("load",_)}if(["audio","video"].includes(l)){let g=b;g.rr_mediaState=e.paused?"paused":"played",g.rr_mediaCurrentTime=e.currentTime,g.rr_mediaPlaybackRate=e.playbackRate,g.rr_mediaMuted=e.muted,g.rr_mediaLoop=e.loop,g.rr_mediaVolume=e.volume}if(h||(e.scrollLeft&&(b.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(b.rr_scrollTop=e.scrollTop)),m){let{width:g,height:w}=e.getBoundingClientRect();b={class:b.class,rr_width:`${g}px`,rr_height:`${w}px`}}l==="iframe"&&!f(b.src)&&(e.contentDocument||(b.rr_src=b.src),delete b.src);let I;try{customElements.get(l)&&(I=!0)}catch{}return{type:te.Element,tagName:l,attributes:b,childNodes:[],isSVG:jn(e)||void 0,needBlock:m,rootId:p,isCustom:I}}function J(e){return e==null?"":e.toLowerCase()}function Rr(e){return e===!0||e==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}function Kn(e,t){if(t.comment&&e.type===te.Comment)return!0;if(e.type===te.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&wr(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(J(e.attributes.name).match(/^msapplication-tile(image|color)$/)||J(e.attributes.name)==="application-name"||J(e.attributes.rel)==="icon"||J(e.attributes.rel)==="apple-touch-icon"||J(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&J(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(J(e.attributes.property).match(/^(og|twitter|fb):/)||J(e.attributes.name).match(/^(og|twitter):/)||J(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(J(e.attributes.name)==="robots"||J(e.attributes.name)==="googlebot"||J(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(J(e.attributes.name)==="author"||J(e.attributes.name)==="generator"||J(e.attributes.name)==="framework"||J(e.attributes.name)==="publisher"||J(e.attributes.name)==="progid"||J(e.attributes.property).match(/^article:/)||J(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(J(e.attributes.name)==="google-site-verification"||J(e.attributes.name)==="yandex-verification"||J(e.attributes.name)==="csrf-token"||J(e.attributes.name)==="p:domain_verify"||J(e.attributes.name)==="verify-v1"||J(e.attributes.name)==="verification"||J(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function We(e,t){let{doc:r,mirror:n,blockClass:s,blockSelector:o,maskTextClass:a,maskTextSelector:c,skipChild:i=!1,inlineStylesheet:d=!0,maskInputOptions:u={},maskTextFn:f,maskInputFn:h,slimDOMOptions:p,dataURLOptions:m={},inlineImages:l=!1,recordCanvas:b=!1,onSerialize:k,onIframeLoad:I,iframeLoadTimeout:g=5e3,onStylesheetLoad:w,stylesheetLoadTimeout:E=5e3,keepIframeSrcFn:_=()=>!1,newlyAddedElement:z=!1,cssCaptured:O=!1}=t,{needsMask:V}=t,{preserveWhiteSpace:ne=!0}=t;V||(V=kr(e,a,c,V===void 0));let Z=Vn(e,{doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:V,inlineStylesheet:d,maskInputOptions:u,maskTextFn:f,maskInputFn:h,dataURLOptions:m,inlineImages:l,recordCanvas:b,keepIframeSrcFn:_,newlyAddedElement:z,cssCaptured:O});if(!Z)return console.warn(e,"not serialized"),null;let ce;n.hasNode(e)?ce=n.getId(e):Kn(Z,p)||!ne&&Z.type===te.Text&&!Z.textContent.replace(/^\s+|\s+$/gm,"").length?ce=ft:ce=Cr();let D=Z;if(D.id=ce,n.add(e,D),ce===ft)return null;k&&k(e);let ve=!i;if(D.type===te.Element){ve=ve&&!D.needBlock,delete D.needBlock;let X=C.shadowRoot(e);X&&Je(X)&&(D.isShadowHost=!0)}if((D.type===te.Document||D.type===te.Element)&&ve){p.headWhitespace&&D.type===te.Element&&D.tagName==="head"&&(ne=!1);let X={doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:V,maskTextClass:a,maskTextSelector:c,skipChild:i,inlineStylesheet:d,maskInputOptions:u,maskTextFn:f,maskInputFn:h,slimDOMOptions:p,dataURLOptions:m,inlineImages:l,recordCanvas:b,preserveWhiteSpace:ne,onSerialize:k,onIframeLoad:I,iframeLoadTimeout:g,onStylesheetLoad:w,stylesheetLoadTimeout:E,keepIframeSrcFn:_,cssCaptured:!1};if(!(D.type===te.Element&&D.tagName==="textarea"&&D.attributes.value!==void 0)){D.type===te.Element&&D.attributes._cssText!==void 0&&typeof D.attributes._cssText=="string"&&(X.cssCaptured=!0);for(let se of Array.from(C.childNodes(e))){let re=We(se,X);re&&D.childNodes.push(re)}}let Y=null;if(br(e)&&(Y=C.shadowRoot(e)))for(let se of Array.from(C.childNodes(Y))){let re=We(se,X);re&&(Je(Y)&&(re.isShadow=!0),D.childNodes.push(re))}}let ye=C.parentNode(e);return ye&&Ve(ye)&&Je(ye)&&(D.isShadow=!0),D.type===te.Element&&D.tagName==="iframe"&&$n(e,()=>{let X=e.contentDocument;if(X&&I){let Y=We(X,{doc:X,mirror:n,blockClass:s,blockSelector:o,needsMask:V,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:d,maskInputOptions:u,maskTextFn:f,maskInputFn:h,slimDOMOptions:p,dataURLOptions:m,inlineImages:l,recordCanvas:b,preserveWhiteSpace:ne,onSerialize:k,onIframeLoad:I,iframeLoadTimeout:g,onStylesheetLoad:w,stylesheetLoadTimeout:E,keepIframeSrcFn:_});Y&&I(e,Y)}},g),D.type===te.Element&&D.tagName==="link"&&typeof D.attributes.rel=="string"&&(D.attributes.rel==="stylesheet"||D.attributes.rel==="preload"&&typeof D.attributes.href=="string"&&wr(D.attributes.href)==="css")&&Gn(e,()=>{if(w){let X=We(e,{doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:V,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:d,maskInputOptions:u,maskTextFn:f,maskInputFn:h,slimDOMOptions:p,dataURLOptions:m,inlineImages:l,recordCanvas:b,preserveWhiteSpace:ne,onSerialize:k,onIframeLoad:I,iframeLoadTimeout:g,onStylesheetLoad:w,stylesheetLoadTimeout:E,keepIframeSrcFn:_});X&&w(e,X)}},E),D}function Zn(e,t){let{mirror:r=new lt,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:o="rr-mask",maskTextSelector:a=null,inlineStylesheet:c=!0,inlineImages:i=!1,recordCanvas:d=!1,maskAllInputs:u=!1,maskTextFn:f,maskInputFn:h,slimDOM:p=!1,dataURLOptions:m,preserveWhiteSpace:l,onSerialize:b,onIframeLoad:k,iframeLoadTimeout:I,onStylesheetLoad:g,stylesheetLoadTimeout:w,keepIframeSrcFn:E=()=>!1}=t,_=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}:u===!1?{password:!0}:u,z=Rr(p);return We(e,{doc:e,mirror:r,blockClass:n,blockSelector:s,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:_,maskTextFn:f,maskInputFn:h,slimDOMOptions:z,dataURLOptions:m,inlineImages:i,recordCanvas:d,preserveWhiteSpace:l,onSerialize:b,onIframeLoad:k,iframeLoadTimeout:I,onStylesheetLoad:g,stylesheetLoadTimeout:w,keepIframeSrcFn:E,newlyAddedElement:!1})}var Tt=class e{constructor(...t){y(this,"parentElement",null),y(this,"parentNode",null),y(this,"ownerDocument"),y(this,"firstChild",null),y(this,"lastChild",null),y(this,"previousSibling",null),y(this,"nextSibling",null),y(this,"ELEMENT_NODE",1),y(this,"TEXT_NODE",3),y(this,"nodeType"),y(this,"nodeName"),y(this,"RRNodeType")}get childNodes(){let t=[],r=this.firstChild;for(;r;)t.push(r),r=r.nextSibling;return t}contains(t){if(t instanceof e){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function le(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var Pe=`Please stop import mirror directly. Instead of that,\r
1
+ var on=Object.defineProperty,an=(e,t,r)=>t in e?on(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,y=(e,t,r)=>an(e,typeof t!="symbol"?t+"":t,r),or,F=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e[e.Asset=7]="Asset",e[e.Annotation=8]="Annotation",e))(F||{}),W=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(W||{}),ue=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(ue||{}),Ce=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Ce||{}),ze=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(ze||{}),Pe=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(Pe||{}),te=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(te||{}),ir={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument","firstChild","lastChild","nextSibling","previousSibling"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},ar={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Je={},Dt={},lr=0,ln=()=>!!globalThis.Zone;function Vt(e){if(Je[e])return Je[e];let t=globalThis[e],r=t.prototype,n=e in ir?ir[e]:void 0,s=!!(n&&n.every(c=>{var i,d;return!!((d=(i=Object.getOwnPropertyDescriptor(r,c))==null?void 0:i.get)!=null&&d.toString().includes("[native code]"))})),o=e in ar?ar[e]:void 0,a=!!(o&&o.every(c=>{var i;return typeof r[c]=="function"&&((i=r[c])==null?void 0:i.toString().includes("[native code]"))}));if(s&&a&&!ln())return Je[e]=t.prototype,t.prototype;try{let c=document.createElement("iframe");c.style.display="none",document.body.appendChild(c);let i=c.contentWindow;if(!i)return t.prototype;let d=i[e].prototype;if(!d)return c.remove(),r;let u=navigator.userAgent;return u.includes("Safari")&&!u.includes("Chrome")?(c.classList.add("rr-block"),c.setAttribute("__rrwebUntaintedMutationObserver",""),Dt[e]=()=>c.remove()):c.remove(),Je[e]=d}catch{return r}}var Ot={};function he(e,t,r){var n,s;let o=(n=Ot[e])==null?void 0:n[r];if(o)return o.call(t);let a=Vt(e),c=(s=Object.getOwnPropertyDescriptor(a,r))==null?void 0:s.get;return c?((Ot[e]||(Ot[e]={}))[r]=c,c.call(t)):t[r]}var Nt={};function wr(e,t,r){let n=`${e}.${String(r)}`;if(Nt[n])return Nt[n].bind(t);let o=Vt(e)[r];return typeof o!="function"?t[r]:(Nt[n]=o,o.bind(t))}function cn(e){return he("Node",e,"ownerDocument")}function dn(e){return he("Node",e,"childNodes")}function un(e){return he("Node",e,"parentNode")}function fn(e){return he("Node",e,"parentElement")}function hn(e){return he("Node",e,"textContent")}function pn(e){return he("Node",e,"firstChild")}function mn(e){return he("Node",e,"lastChild")}function gn(e){return he("Node",e,"nextSibling")}function yn(e){return he("Node",e,"previousSibling")}function bn(e,t){return wr("Node",e,"contains")(t)}function Sn(e){return wr("Node",e,"getRootNode")()}function wn(e){return!e||!("host"in e)?null:he("ShadowRoot",e,"host")}function vn(e){return e.styleSheets}function Cn(e){return!e||!("shadowRoot"in e)?null:he("Element",e,"shadowRoot")}function Mn(e,t){return he("Element",e,"querySelector")(t)}function In(e,t){return he("Element",e,"querySelectorAll")(t)}function vr(){let e=Vt("MutationObserver");lr++;let t=!1;return[e.constructor,()=>{if(t||(t=!0,--lr!==0))return;let r=Dt.MutationObserver;if(r)try{r()}finally{delete Je.MutationObserver,delete Dt.MutationObserver}}]}var Ze=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Ze=()=>new Date().getTime());function xe(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],s=r(n);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=s,()=>{e[t]=n}}catch{return()=>{}}}var M={ownerDocument:cn,childNodes:dn,parentNode:un,parentElement:fn,textContent:hn,firstChild:pn,lastChild:mn,nextSibling:gn,previousSibling:yn,contains:bn,getRootNode:Sn,host:wn,styleSheets:vn,shadowRoot:Cn,querySelector:Mn,querySelectorAll:In,nowTimestamp:Ze,mutationObserverCtor:vr,patch:xe};function Cr(e){return e.nodeType===e.ELEMENT_NODE}function Xe(e){let t=e&&"host"in e&&"mode"in e&&M.host(e)||null;return!!(t&&"shadowRoot"in t&&M.shadowRoot(t)===e)}function Ye(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function kn(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function Rn(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function Lt(e){try{let t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);let n=Array.from(t,s=>Mr(s,r)).join("");return kn(n)}catch{return null}}function Mr(e,t){if(On(e)){let r;try{r=Lt(e.styleSheet)||Rn(e)}catch{r=e.cssText}return e.styleSheet.href?ht(r,e.styleSheet.href):r}else{let r=e.cssText;return Nn(e)&&e.selectorText.includes(":")&&(r=En(r)),t?ht(r,t):r}}function En(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function On(e){return"styleSheet"in e}function Nn(e){return"selectorText"in e}var dt=class{constructor(){y(this,"idNodeMap",new Map),y(this,"nodeMetaMap",new WeakMap)}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(s=>this.removeNodeFromMap(s));let n=M.shadowRoot(t);n&&this.removeNodeFromMap(n)}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){let n=this.getNode(t);if(n){let s=this.nodeMetaMap.get(n);s&&this.nodeMetaMap.set(r,s)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function xn(){return new dt}function ut({element:e,maskInputOptions:t,tagName:r,type:n,value:s,maskInputFn:o}){let a=s||"",c=n&&Re(n);return(t[r.toLowerCase()]||c&&t[c])&&(o?a=o(a,e):a="*".repeat(a.length)),a}function Re(e){return e.toLowerCase()}var cr="__rrweb_original__";function Tn(e){let t=e.getContext("2d");if(!t)return!0;let r=50;for(let n=0;n<e.width;n+=r)for(let s=0;s<e.height;s+=r){let o=t.getImageData,a=cr in o?o[cr]:o;if(new Uint32Array(a.call(t,n,s,Math.min(r,e.width-n),Math.min(r,e.height-s)).data.buffer).some(i=>i!==0))return!1}return!0}function ft(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Re(t):null}function Ir(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i,s=r.pathname.match(n);return s?.[1]??null}function Dn(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var Ln=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,An=/^(?:[a-z+]+:)?\/\//i,_n=/^www\..*/i,Pn=/^(data:)([^,]*),(.*)/i;function ht(e,t){return(e||"").replace(Ln,(r,n,s,o,a,c)=>{let i=s||a||c,d=n||o||"";if(!i)return r;if(An.test(i)||_n.test(i))return`url(${d}${i}${d})`;if(Pn.test(i))return`url(${d}${i}${d})`;if(i[0]==="/")return`url(${d}${Dn(t)+i}${d})`;let u=i.split("#")[0],f=i.substring(u.length),h=t.split("#")[0].split("/"),p=u.split("/");h.pop();for(let m of p)m!=="."&&(m===".."?h.pop():h.push(m));return`url(${d}${h.join("/")}${f}${d})`})}var kr="(?:/\\*[^*]*\\*/)|[\\s;]",Fn=new RegExp(`${kr}|\\b(0)px?`,"g"),Wn=new RegExp(kr,"g");function ot(e,t=!1){return t?e.replace(Wn,""):e.replace(Fn,"$1")}function Un(e,t,r=!1){let n=Array.from(t.childNodes),s=[],o=0;if(n.length>1&&e&&typeof e=="string"){let a=ot(e,r),c=a.length/e.length;for(let i=1;i<n.length;i++)if(n[i].textContent&&typeof n[i].textContent=="string"){let d=ot(n[i].textContent,r),u=100,f=3;for(;f<d.length&&(d[f].match(/[a-zA-Z0-9]/)||d.indexOf(d.substring(0,f),1)!==-1);f++);for(;f<d.length;f++){let h=d.substring(0,f),p=a.split(h),m=-1;if(p.length===2)m=p[0].length;else if(p.length>2&&p[0]===""&&n[i-1].textContent!=="")m=a.indexOf(h,1);else if(p.length===1){if(h=h.substring(0,h.length-1),p=a.split(h),p.length<=1)return s.push(e),s;f=u+1}else f===d.length-1&&(m=a.indexOf(h));if(p.length>=2&&f>u){let l=n[i-1].textContent;if(l&&typeof l=="string"){let b=ot(l).length;m=a.indexOf(h,b)}m===-1&&(m=p[0].length)}if(m!==-1){let l=Math.floor(m/c);for(;l>0&&l<e.length;){if(o+=1,o>50*n.length)return s.push(e),s;let b=ot(e.substring(0,l),r);if(b.length===m){s.push(e.substring(0,l)),e=e.substring(l),a=a.substring(m);break}else b.length<m?l+=Math.max(1,Math.floor((m-b.length)/c)):l-=Math.max(1,Math.floor((b.length-m)*c))}break}}}}return s.push(e),s}function Bn(e,t){return Un(e,t).join("/* rr_split */")}var Hn=1,zn=new RegExp("[^a-z0-9-_:]"),pt=-2;function Rr(){return Hn++}function jn(e){if(e instanceof HTMLFormElement)return"form";let t=Re(e.tagName);return zn.test(t)?"div":t}var _e,dr,qn=/^[^ \t\n\r\u000c]+/,$n=/^[, \t\n\r\u000c]+/;function Gn(e,t){if(t.trim()==="")return t;let r=0;function n(o){let a,c=o.exec(t.substring(r));return c?(a=c[0],r+=a.length,a):""}let s=[];for(;n($n),!(r>=t.length);){let o=n(qn);if(o.slice(-1)===",")o=We(e,o.substring(0,o.length-1)),s.push(o);else{let a="";o=We(e,o);let c=!1;for(;;){let i=t.charAt(r);if(i===""){s.push((o+a).trim());break}else if(c)i===")"&&(c=!1);else if(i===","){r+=1,s.push((o+a).trim());break}else i==="("&&(c=!0);a+=i,r+=1}}}return s.join(", ")}var ur=new WeakMap;function We(e,t){return!t||t.trim()===""?t:Jt(e,t)}function Vn(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function Jt(e,t){let r=ur.get(e);if(r||(r=e.createElement("a"),ur.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function Er(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&["table","td","th"].includes(t)?We(e,n):r==="srcset"?Gn(e,n):r==="style"?ht(n,Jt(e)):t==="object"&&r==="data"?We(e,n):n)}function Or(e,t,r){return["video","audio"].includes(e)&&Re(t)==="autoplay"}function Jn(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){let s=e.classList[n];if(t.test(s))return!0}if(r)return e.matches(r)}catch{}return!1}function mt(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?mt(M.parentNode(e),t,r):!1;for(let n=e.classList.length;n--;){let s=e.classList[n];if(t.test(s))return!0}return r?mt(M.parentNode(e),t,r):!1}function Nr(e,t,r,n){let s;if(Cr(e)){if(s=e,!M.childNodes(s).length)return!1}else{if(M.parentElement(e)===null)return!1;s=M.parentElement(e)}try{if(typeof t=="string"){if(n){if(s.closest(`.${t}`))return!0}else if(s.classList.contains(t))return!0}else if(mt(s,t,n))return!0;if(r){if(n){if(s.closest(r))return!0}else if(s.matches(r))return!0}}catch{}return!1}function Xn(e,t,r){let n=e.contentWindow;if(!n)return;let s=!1,o;try{o=n.document.readyState}catch{return}if(o!=="complete"){let c=setTimeout(()=>{s||(t(),s=!0)},r);e.addEventListener("load",()=>{clearTimeout(c),s=!0,t()});return}let a="about:blank";if(n.location.href!==a||e.src===a||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function Yn(e,t,r){let n=!1,s;try{s=e.sheet}catch{return}if(s)return;let o=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(o),n=!0,t()})}function Kn(e,t){let{doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:a,inlineStylesheet:c,maskInputOptions:i={},maskTextFn:d,maskInputFn:u,dataURLOptions:f={},inlineImages:h,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:l=!1,cssCaptured:b=!1}=t,E=Zn(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:te.Document,childNodes:[],compatMode:e.compatMode}:{type:te.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:te.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:E};case e.ELEMENT_NODE:return es(e,{doc:r,blockClass:s,blockSelector:o,inlineStylesheet:c,maskInputOptions:i,maskInputFn:u,dataURLOptions:f,inlineImages:h,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:l,rootId:E});case e.TEXT_NODE:return Qn(e,{doc:r,needsMask:a,maskTextFn:d,rootId:E,cssCaptured:b});case e.CDATA_SECTION_NODE:return{type:te.CDATA,textContent:"",rootId:E};case e.COMMENT_NODE:return{type:te.Comment,textContent:M.textContent(e)||"",rootId:E};default:return!1}}function Zn(e,t){let r=t.getId(e);return r===-1||r===1?void 0:r}function Qn(e,t){let{needsMask:r,maskTextFn:n,rootId:s,cssCaptured:o}=t,a=M.parentNode(e),c=a&&a.tagName,i="",d=c==="STYLE"?!0:void 0,u=c==="SCRIPT"?!0:void 0;return u?i="SCRIPT_PLACEHOLDER":o||(i=M.textContent(e),d&&i&&(i=ht(i,Jt(t.doc)))),!d&&!u&&i&&r&&(i=n?n(i,M.parentElement(e)):i.replace(/[\S]/g,"*")),{type:te.Text,textContent:i||"",rootId:s}}function es(e,t){let{doc:r,blockClass:n,blockSelector:s,inlineStylesheet:o,maskInputOptions:a={},maskInputFn:c,dataURLOptions:i={},inlineImages:d,recordCanvas:u,keepIframeSrcFn:f,newlyAddedElement:h=!1,rootId:p}=t,m=Jn(e,n,s),l=jn(e),b={},E=e.attributes.length;for(let g=0;g<E;g++){let w=e.attributes[g];Or(l,w.name,w.value)||(b[w.name]=Er(r,l,Re(w.name),w.value))}if(l==="link"&&o){let g=Array.from(r.styleSheets).find(N=>N.href===e.href),w=null;g&&(w=Lt(g)),w&&(delete b.rel,delete b.href,b._cssText=w)}if(l==="style"&&e.sheet){let g=Lt(e.sheet);g&&(e.childNodes.length>1&&(g=Bn(g,e)),b._cssText=g)}if(["input","textarea","select"].includes(l)){let g=e.value,w=e.checked;b.type!=="radio"&&b.type!=="checkbox"&&b.type!=="submit"&&b.type!=="button"&&g?b.value=ut({element:e,type:ft(e),tagName:l,value:g,maskInputOptions:a,maskInputFn:c}):w&&(b.checked=w)}if(l==="option"&&(e.selected&&!a.select?b.selected=!0:delete b.selected),l==="dialog"&&e.open&&(b.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),l==="canvas"&&u){if(e.__context==="2d")Tn(e)||(b.rr_dataURL=e.toDataURL(i.type,i.quality));else if(!("__context"in e)){let g=e.toDataURL(i.type,i.quality),w=r.createElement("canvas");w.width=e.width,w.height=e.height;let N=w.toDataURL(i.type,i.quality);g!==N&&(b.rr_dataURL=g)}}if(l==="img"&&d){_e||(_e=r.createElement("canvas"),dr=_e.getContext("2d"));let g=e,w=g.currentSrc||g.getAttribute("src")||"<unknown-src>",N=g.crossOrigin,_=()=>{g.removeEventListener("load",_);try{_e.width=g.naturalWidth,_e.height=g.naturalHeight,dr.drawImage(g,0,0),b.rr_dataURL=_e.toDataURL(i.type,i.quality)}catch(j){if(g.crossOrigin!=="anonymous"){g.crossOrigin="anonymous",g.complete&&g.naturalWidth!==0?_():g.addEventListener("load",_);return}else console.warn(`Cannot inline img src=${w}! Error: ${j}`)}g.crossOrigin==="anonymous"&&(N?b.crossOrigin=N:g.removeAttribute("crossorigin"))};g.complete&&g.naturalWidth!==0?_():g.addEventListener("load",_)}if(["audio","video"].includes(l)){let g=b;g.rr_mediaState=e.paused?"paused":"played",g.rr_mediaCurrentTime=e.currentTime,g.rr_mediaPlaybackRate=e.playbackRate,g.rr_mediaMuted=e.muted,g.rr_mediaLoop=e.loop,g.rr_mediaVolume=e.volume}if(h||(e.scrollLeft&&(b.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(b.rr_scrollTop=e.scrollTop)),m){let{width:g,height:w}=e.getBoundingClientRect();b={class:b.class,rr_width:`${g}px`,rr_height:`${w}px`}}l==="iframe"&&!f(b.src)&&(e.contentDocument||(b.rr_src=b.src),delete b.src);let k;try{customElements.get(l)&&(k=!0)}catch{}return{type:te.Element,tagName:l,attributes:b,childNodes:[],isSVG:Vn(e)||void 0,needBlock:m,rootId:p,isCustom:k}}function X(e){return e==null?"":e.toLowerCase()}function xr(e){return e===!0||e==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}function ts(e,t){if(t.comment&&e.type===te.Comment)return!0;if(e.type===te.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&Ir(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(X(e.attributes.name).match(/^msapplication-tile(image|color)$/)||X(e.attributes.name)==="application-name"||X(e.attributes.rel)==="icon"||X(e.attributes.rel)==="apple-touch-icon"||X(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&X(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(X(e.attributes.property).match(/^(og|twitter|fb):/)||X(e.attributes.name).match(/^(og|twitter):/)||X(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(X(e.attributes.name)==="robots"||X(e.attributes.name)==="googlebot"||X(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(X(e.attributes.name)==="author"||X(e.attributes.name)==="generator"||X(e.attributes.name)==="framework"||X(e.attributes.name)==="publisher"||X(e.attributes.name)==="progid"||X(e.attributes.property).match(/^article:/)||X(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(X(e.attributes.name)==="google-site-verification"||X(e.attributes.name)==="yandex-verification"||X(e.attributes.name)==="csrf-token"||X(e.attributes.name)==="p:domain_verify"||X(e.attributes.name)==="verify-v1"||X(e.attributes.name)==="verification"||X(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Ue(e,t){let{doc:r,mirror:n,blockClass:s,blockSelector:o,maskTextClass:a,maskTextSelector:c,skipChild:i=!1,inlineStylesheet:d=!0,maskInputOptions:u={},maskTextFn:f,maskInputFn:h,slimDOMOptions:p,dataURLOptions:m={},inlineImages:l=!1,recordCanvas:b=!1,onSerialize:E,onIframeLoad:k,iframeLoadTimeout:g=5e3,onStylesheetLoad:w,stylesheetLoadTimeout:N=5e3,keepIframeSrcFn:_=()=>!1,newlyAddedElement:j=!1,cssCaptured:x=!1}=t,{needsMask:V}=t,{preserveWhiteSpace:re=!0}=t;V||(V=Nr(e,a,c,V===void 0));let Z=Kn(e,{doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:V,inlineStylesheet:d,maskInputOptions:u,maskTextFn:f,maskInputFn:h,dataURLOptions:m,inlineImages:l,recordCanvas:b,keepIframeSrcFn:_,newlyAddedElement:j,cssCaptured:x});if(!Z)return console.warn(e,"not serialized"),null;let oe;n.hasNode(e)?oe=n.getId(e):ts(Z,p)||!re&&Z.type===te.Text&&!Z.textContent.replace(/^\s+|\s+$/gm,"").length?oe=pt:oe=Rr();let L=Z;if(L.id=oe,n.add(e,L),oe===pt)return null;E&&E(e);let be=!i;if(L.type===te.Element){be=be&&!L.needBlock,delete L.needBlock;let Y=M.shadowRoot(e);Y&&Ye(Y)&&(L.isShadowHost=!0)}if((L.type===te.Document||L.type===te.Element)&&be){p.headWhitespace&&L.type===te.Element&&L.tagName==="head"&&(re=!1);let Y={doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:V,maskTextClass:a,maskTextSelector:c,skipChild:i,inlineStylesheet:d,maskInputOptions:u,maskTextFn:f,maskInputFn:h,slimDOMOptions:p,dataURLOptions:m,inlineImages:l,recordCanvas:b,preserveWhiteSpace:re,onSerialize:E,onIframeLoad:k,iframeLoadTimeout:g,onStylesheetLoad:w,stylesheetLoadTimeout:N,keepIframeSrcFn:_,cssCaptured:!1};if(!(L.type===te.Element&&L.tagName==="textarea"&&L.attributes.value!==void 0)){L.type===te.Element&&L.attributes._cssText!==void 0&&typeof L.attributes._cssText=="string"&&(Y.cssCaptured=!0);for(let me of Array.from(M.childNodes(e))){let J=Ue(me,Y);J&&L.childNodes.push(J)}}let ne=null;if(Cr(e)&&(ne=M.shadowRoot(e)))for(let me of Array.from(M.childNodes(ne))){let J=Ue(me,Y);J&&(Ye(ne)&&(J.isShadow=!0),L.childNodes.push(J))}}let pe=M.parentNode(e);return pe&&Xe(pe)&&Ye(pe)&&(L.isShadow=!0),L.type===te.Element&&L.tagName==="iframe"&&Xn(e,()=>{let Y=e.contentDocument;if(Y&&k){let ne=Ue(Y,{doc:Y,mirror:n,blockClass:s,blockSelector:o,needsMask:V,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:d,maskInputOptions:u,maskTextFn:f,maskInputFn:h,slimDOMOptions:p,dataURLOptions:m,inlineImages:l,recordCanvas:b,preserveWhiteSpace:re,onSerialize:E,onIframeLoad:k,iframeLoadTimeout:g,onStylesheetLoad:w,stylesheetLoadTimeout:N,keepIframeSrcFn:_});ne&&k(e,ne)}},g),L.type===te.Element&&L.tagName==="link"&&typeof L.attributes.rel=="string"&&(L.attributes.rel==="stylesheet"||L.attributes.rel==="preload"&&typeof L.attributes.href=="string"&&Ir(L.attributes.href)==="css")&&Yn(e,()=>{if(w){let Y=Ue(e,{doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:V,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:d,maskInputOptions:u,maskTextFn:f,maskInputFn:h,slimDOMOptions:p,dataURLOptions:m,inlineImages:l,recordCanvas:b,preserveWhiteSpace:re,onSerialize:E,onIframeLoad:k,iframeLoadTimeout:g,onStylesheetLoad:w,stylesheetLoadTimeout:N,keepIframeSrcFn:_});Y&&w(e,Y)}},N),L}function rs(e,t){let{mirror:r=new dt,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:o="rr-mask",maskTextSelector:a=null,inlineStylesheet:c=!0,inlineImages:i=!1,recordCanvas:d=!1,maskAllInputs:u=!1,maskTextFn:f,maskInputFn:h,slimDOM:p=!1,dataURLOptions:m,preserveWhiteSpace:l,onSerialize:b,onIframeLoad:E,iframeLoadTimeout:k,onStylesheetLoad:g,stylesheetLoadTimeout:w,keepIframeSrcFn:N=()=>!1}=t,_=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}:u===!1?{password:!0}:u,j=xr(p);return Ue(e,{doc:e,mirror:r,blockClass:n,blockSelector:s,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:_,maskTextFn:f,maskInputFn:h,slimDOMOptions:j,dataURLOptions:m,inlineImages:i,recordCanvas:d,preserveWhiteSpace:l,onSerialize:b,onIframeLoad:E,iframeLoadTimeout:k,onStylesheetLoad:g,stylesheetLoadTimeout:w,keepIframeSrcFn:N,newlyAddedElement:!1})}var At=class e{constructor(...t){y(this,"parentElement",null),y(this,"parentNode",null),y(this,"ownerDocument"),y(this,"firstChild",null),y(this,"lastChild",null),y(this,"previousSibling",null),y(this,"nextSibling",null),y(this,"ELEMENT_NODE",1),y(this,"TEXT_NODE",3),y(this,"nodeType"),y(this,"nodeName"),y(this,"RRNodeType")}get childNodes(){let t=[],r=this.firstChild;for(;r;)t.push(r),r=r.nextSibling;return t}contains(t){if(t instanceof e){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function le(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var Fe=`Please stop import mirror directly. Instead of that,\r
2
2
  now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
3
- or you can use record.mirror to access the mirror instance during recording.`,lr={map:{},getId(){return console.error(Pe),-1},getNode(){return console.error(Pe),null},removeNodeFromMap(){console.error(Pe)},has(){return console.error(Pe),!1},reset(){console.error(Pe)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(lr=new Proxy(lr,{get(e,t,r){return t==="map"&&console.error(Pe),Reflect.get(e,t,r)}}));function Ke(e,t,r={}){let n=null,s=0;return function(...o){let a=Date.now();!s&&r.leading===!1&&(s=a);let c=t-(a-s),i=this;c<=0||c>t?(n&&(clearTimeout(n),n=null),s=a,e.apply(i,o)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{s=r.leading===!1?0:Date.now(),n=null,e.apply(i,o)},c))}}function gt(e,t,r,n,s=window){let o=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,n?r:{set(a){setTimeout(()=>{r.set.call(this,a)},0),o&&o.set&&o.set.call(this,a)}}),()=>gt(e,t,o||{},!0)}function Er(e){var t,r,n,s;let o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:o.documentElement.scrollLeft||o?.body&&((t=C.parentElement(o.body))==null?void 0:t.scrollLeft)||((r=o?.body)==null?void 0:r.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:o?.documentElement.scrollTop||o?.body&&((n=C.parentElement(o.body))==null?void 0:n.scrollTop)||((s=o?.body)==null?void 0:s.scrollTop)||0}}function Or(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Nr(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function xr(e){return e?e.nodeType===e.ELEMENT_NODE?e:C.parentElement(e):null}function he(e,t,r,n){if(!e)return!1;let s=xr(e);if(!s)return!1;try{if(typeof t=="string"){if(s.classList.contains(t)||n&&s.closest("."+t)!==null)return!0}else if(ht(s,t,n))return!0}catch{}return!!(r&&(s.matches(r)||n&&s.closest(r)!==null))}function Qn(e,t){return t.getId(e)!==-1}function Et(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===ft}function Tr(e,t){if(Ve(e))return!1;let r=t.getId(e);if(!t.has(r))return!0;let n=C.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?!1:n?Tr(n,t):!0}function Dt(e){return!!e.changedTouches}function es(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Dr(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Lr(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Lt(e){return e?e instanceof Tt&&"shadowRoot"in e?!!e.shadowRoot:!!C.shadowRoot(e):!1}var At=class{constructor(){y(this,"id",1),y(this,"styleIDMap",new WeakMap),y(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Ar(e){var t;let r=null;return"getRootNode"in e&&((t=C.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&C.host(C.getRootNode(e))&&(r=C.host(C.getRootNode(e))),r}function ts(e){let t=e,r;for(;r=Ar(t);)t=r;return t}function rs(e){let t=C.ownerDocument(e);if(!t)return!1;let r=ts(e);return C.contains(t,r)}function _t(e){let t=C.ownerDocument(e);return t?C.contains(t,e)||rs(e):!1}var cr=(e,t)=>`${e}@${t}`,Pt=class{constructor(){y(this,"frozen",!1),y(this,"locked",!1),y(this,"texts",[]),y(this,"attributes",[]),y(this,"attributeMap",new WeakMap),y(this,"removes",[]),y(this,"mapRemoves",[]),y(this,"movedMap",{}),y(this,"addedSet",new Set),y(this,"movedSet",new Set),y(this,"droppedSet",new Set),y(this,"removesSubTreeCache",new Set),y(this,"mutationCb"),y(this,"blockClass"),y(this,"blockSelector"),y(this,"maskTextClass"),y(this,"maskTextSelector"),y(this,"inlineStylesheet"),y(this,"maskInputOptions"),y(this,"maskTextFn"),y(this,"maskInputFn"),y(this,"keepIframeSrcFn"),y(this,"recordCanvas"),y(this,"inlineImages"),y(this,"slimDOMOptions"),y(this,"dataURLOptions"),y(this,"doc"),y(this,"mirror"),y(this,"iframeManager"),y(this,"stylesheetManager"),y(this,"shadowDomManager"),y(this,"processedNodeManager"),y(this,"unattachedDoc"),y(this,"processMutations",t=>{Wt&&(t=Wt(t),!t.length)||(t.forEach(this.processMutation),this.emit())}),y(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],r=new Set;for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let h of this.movedSet){let p=C.parentNode(h);this.removesSubTreeCache.has(p)&&!this.movedSet.has(p)||this.addedSet.add(h)}let n=null,s=null,o=-1,a=null,c=!1,i=new Set,d=this.addedSet.values(),u=d.next();for(;this.addedSet.size;){if(n!==null&&this.addedSet.has(C.previousSibling(n)))a=n,n=C.previousSibling(n);else{for(this.addedSet.has(u.value)||(u=d.next()),n=u.value;;){if(s=C.parentNode(n),this.addedSet.has(s)){n=s;continue}break}if(i.has(s))s=null;else if(s){if(_t(s)?(c=dr(this.droppedSet,s)||this.removesSubTreeCache.has(s),c&&dr(this.movedSet,n)&&(c=!1)):c=!0,this.addedSet.has(C.lastChild(s)))n=C.lastChild(s),a=null;else for(;;){if(a=C.nextSibling(n),this.addedSet.has(a)){n=a;continue}break}if(o=Ve(s)?this.mirror.getId(Ar(n)):this.mirror.getId(s),o===-1&&s.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let l=C.host(s);o=this.mirror.getId(l)}}}if(this.addedSet.delete(n),!s||o===-1){i.add(n);continue}else if(c){this.droppedSet.add(n);continue}let h=!1;if(n.nodeType===Node.TEXT_NODE){let l=s.tagName;if(l==="TEXTAREA")continue;l==="STYLE"&&r.has(o)&&(h=!0)}let p=a?this.mirror.getId(a):null;for(;p===ft;)a=a&&C.nextSibling(a),p=a&&this.mirror.getId(a);if(p===-1){console.warn("Couldn't record new node. Couldn't find mirror id for nextSibling:",a),n=null;continue}let m=We(n,{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:l=>{Dr(l,this.mirror)&&this.iframeManager.addIframe(l),Lr(l,this.mirror)&&this.stylesheetManager.trackLinkElement(l),Lt(n)&&this.shadowDomManager.addShadowRoot(C.shadowRoot(n),this.doc)},onIframeLoad:(l,b)=>{this.iframeManager.attachIframe(l,b),this.shadowDomManager.observeAttachShadow(l)},onStylesheetLoad:(l,b)=>{this.stylesheetManager.attachLinkElement(l,b)},cssCaptured:h});m&&(t.push({parentId:o,nextId:p,node:m}),r.add(m.id))}let f={texts:this.texts.map(h=>{let p=h.node,m=C.parentNode(p);return m&&m.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(m),{id:this.mirror.getId(p),value:h.value}}).filter(h=>!r.has(h.id)).filter(h=>this.mirror.has(h.id)),attributes:this.attributes.map(h=>{let{attributes:p}=h;if(typeof p.style=="string"){let m=JSON.stringify(h.styleDiff),l=JSON.stringify(h._unchangedStyles);m.length<p.style.length&&(m+l).split("var(").length===p.style.split("var(").length&&(p.style=h.styleDiff)}return{id:this.mirror.getId(h.node),attributes:p}}).filter(h=>!r.has(h.id)).filter(h=>this.mirror.has(h.id)),removes:this.removes,adds:t};!f.texts.length&&!f.attributes.length&&!f.removes.length&&!f.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(f))}),y(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r));let n=Array.from(C.childNodes(t),s=>C.textContent(s)||"").join("");r.attributes.value=ct({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:dt(t),value:n,maskInputFn:this.maskInputFn})}),y(this,"processMutation",t=>{if(!Et(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let r=C.textContent(t.target);!he(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:kr(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,xr(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{let r=t.target,n=Oe(r.tagName),s=t.attributeName,o=t.target.getAttribute(s);if(s==="value"){let c=dt(r);o=ct({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:c,value:o,maskInputFn:this.maskInputFn})}if(he(t.target,this.blockClass,this.blockSelector,!1)||o===t.oldValue)return;let a=this.attributeMap.get(t.target);if(n==="iframe"&&s==="src"&&!this.keepIframeSrcFn(o))if(!r.contentDocument)s="rr_src";else return;if(a||(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(t.target,a)),s==="type"&&n==="input"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!Ir(n,s))if(a.attributes[s]=Mr(this.doc,n,Oe(s),o),s==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let c=this.unattachedDoc.createElement("span");t.oldValue&&c.setAttribute("style",t.oldValue);for(let i of Array.from(r.style)){let d=r.style.getPropertyValue(i),u=r.style.getPropertyPriority(i);d!==c.style.getPropertyValue(i)||u!==c.style.getPropertyPriority(i)?u===""?a.styleDiff[i]=d:a.styleDiff[i]=[d,u]:a._unchangedStyles[i]=[d,u]}for(let i of Array.from(c.style))r.style.getPropertyValue(i)===""&&(a.styleDiff[i]=!1)}else s==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?a.attributes.rr_open_mode="modal":a.attributes.rr_open_mode="non-modal");break}case"childList":{if(he(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{_t(r)||this.shadowDomManager.removeShadowRootsIn(r);let n=this.mirror.getId(r),s=Ve(t.target)?this.mirror.getId(C.host(t.target)):this.mirror.getId(t.target);he(t.target,this.blockClass,this.blockSelector,!1)||Et(r,this.mirror,this.slimDOMOptions)||!Qn(r,this.mirror)||(this.addedSet.has(r)?(Ft(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||Tr(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[cr(n,s)]?Ft(this.movedSet,r):(this.removes.push({parentId:s,id:n,isShadow:Ve(t.target)&&Je(t.target)?!0:void 0}),ns(r,this.removesSubTreeCache))),this.mapRemoves.push(r))});break}}}),y(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(Et(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[cr(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);he(t,this.blockClass,this.blockSelector,!1)||(C.childNodes(t).forEach(n=>this.genAdds(n)),Lt(t)&&C.childNodes(C.shadowRoot(t)).forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","processedNodeManager"].forEach(r=>{this[r]=t[r]})}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1,this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0}unlock(){this.locked=!1,this.emit()}};function Ft(e,t){e.delete(t),C.childNodes(t).forEach(r=>Ft(e,r))}function ns(e,t){let r=[e];for(;r.length;){let n=r.pop();t.has(n)||(t.add(n),C.childNodes(n).forEach(s=>r.push(s)))}}function dr(e,t){return e.size===0?!1:_r(e,t)}function _r(e,t){if(e.has(t))return!0;let r=C.parentNode(t);return r?_r(e,r):!1}var Xe;function ss(e){Xe=e}function os(){Xe=void 0}var H=e=>Xe?(...r)=>{try{return e(...r)}catch(n){if(Xe&&Xe(n)===!0)return;throw n}}:e,Wt=null,Be=new Set;function Qe(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function Pr(e,t){let r=new Pt;Be.add(r),r.init(e);let[n,s]=yr(),o=new n(H(r.processMutations.bind(r)));return o.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),()=>{o.disconnect(),Be.delete(r),s()}}function is({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};let s=typeof t.mousemove=="number"?t.mousemove:50,o=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,a=[],c,i=Ke(H(f=>{let h=Date.now()-c;e(a.map(p=>(p.timeOffset-=h,p)),f),a=[],c=null}),o),d=H(Ke(H(f=>{let h=Qe(f),{clientX:p,clientY:m}=Dt(f)?f.changedTouches[0]:f;c||(c=Ye()),a.push({x:p,y:m,id:n.getId(h),timeOffset:Ye()-c}),i(typeof DragEvent<"u"&&f instanceof DragEvent?F.Drag:f instanceof MouseEvent?F.MouseMove:F.TouchMove)}),s,{trailing:!1})),u=[le("mousemove",d,r),le("touchmove",d,r),le("drag",d,r)];return H(()=>{u.forEach(f=>f())})}function as({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let a=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,c=[],i=null,d=u=>f=>{let h=Qe(f);if(he(h,n,s,!0))return;let p=null,m=u;if("pointerType"in f){switch(f.pointerType){case"mouse":p=Ie.Mouse;break;case"touch":p=Ie.Touch;break;case"pen":p=Ie.Pen;break}p===Ie.Touch?me[u]===me.MouseDown?m="TouchStart":me[u]===me.MouseUp&&(m="TouchEnd"):Ie.Pen}else Dt(f)&&(p=Ie.Touch);p!==null?(i=p,(m.startsWith("Touch")&&p===Ie.Touch||m.startsWith("Mouse")&&p===Ie.Mouse)&&(p=null)):me[u]===me.Click&&(p=i,i=null);let l=Dt(f)?f.changedTouches[0]:f;if(!l)return;let b=r.getId(h),{clientX:k,clientY:I}=l;H(e)({type:me[m],id:b,x:k,y:I,...p!==null&&{pointerType:p}})};return Object.keys(me).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&a[u]!==!1).forEach(u=>{let f=Oe(u),h=d(u);if(window.PointerEvent)switch(me[u]){case me.MouseDown:case me.MouseUp:f=f.replace("mouse","pointer");break;case me.TouchStart:case me.TouchEnd:return}c.push(le(f,h,t))}),H(()=>{c.forEach(u=>u())})}function Fr({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,sampling:o}){let a=H(Ke(H(c=>{let i=Qe(c);if(!i||he(i,n,s,!0))return;let d=r.getId(i);if(i===t&&t.defaultView){let u=Er(t.defaultView);e({id:d,x:u.left,y:u.top})}else e({id:d,x:i.scrollLeft,y:i.scrollTop})}),o.scroll||100));return le("scroll",a,t)}function ls({viewportResizeCb:e},{win:t}){let r=-1,n=-1,s=H(Ke(H(()=>{let o=Or(),a=Nr();(r!==o||n!==a)&&(e({width:Number(a),height:Number(o)}),r=o,n=a)}),200));return le("resize",s,t)}var cs=["INPUT","TEXTAREA","SELECT"],ur=new WeakMap;function ds({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,ignoreClass:o,ignoreSelector:a,maskInputOptions:c,maskInputFn:i,sampling:d,userTriggeredOnInput:u}){function f(I){let g=Qe(I),w=I.isTrusted,E=g&&g.tagName;if(g&&E==="OPTION"&&(g=C.parentElement(g)),!g||!E||cs.indexOf(E)<0||he(g,n,s,!0)||g.classList.contains(o)||a&&g.matches(a))return;let _=g.value,z=!1,O=dt(g)||"";O==="radio"||O==="checkbox"?z=g.checked:(c[E.toLowerCase()]||c[O])&&(_=ct({element:g,maskInputOptions:c,tagName:E,type:O,value:_,maskInputFn:i})),h(g,u?{text:_,isChecked:z,userTriggered:w}:{text:_,isChecked:z});let V=g.name;O==="radio"&&V&&z&&t.querySelectorAll(`input[type="radio"][name="${V}"]`).forEach(ne=>{if(ne!==g){let Z=ne.value;h(ne,u?{text:Z,isChecked:!z,userTriggered:!1}:{text:Z,isChecked:!z})}})}function h(I,g){let w=ur.get(I);if(!w||w.text!==g.text||w.isChecked!==g.isChecked){ur.set(I,g);let E=r.getId(I);H(e)({...g,id:E})}}let m=(d.input==="last"?["change"]:["input","change"]).map(I=>le(I,H(f),t)),l=t.defaultView;if(!l)return()=>{m.forEach(I=>I())};let b=l.Object.getOwnPropertyDescriptor(l.HTMLInputElement.prototype,"value"),k=[[l.HTMLInputElement.prototype,"value"],[l.HTMLInputElement.prototype,"checked"],[l.HTMLSelectElement.prototype,"value"],[l.HTMLTextAreaElement.prototype,"value"],[l.HTMLSelectElement.prototype,"selectedIndex"],[l.HTMLOptionElement.prototype,"selected"]];return b&&b.set&&m.push(...k.map(I=>gt(I[0],I[1],{set(){H(f)({target:this,isTrusted:!1})}},!1,l))),H(()=>{m.forEach(I=>I())})}function pt(e){let t=[];function r(n,s){if(st("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||st("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||st("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||st("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let a=Array.from(n.parentRule.cssRules).indexOf(n);return s.unshift(a),r(n.parentRule,s)}else if(n.parentStyleSheet){let a=Array.from(n.parentStyleSheet.cssRules).indexOf(n);s.unshift(a)}return s}return r(e,t)}function Ee(e,t,r){let n,s;return e?(e.ownerNode?n=t.getId(e.ownerNode):s=r.getId(e),{styleId:s,id:n}):{}}function us({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};let s=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:H((u,f,h)=>{let[p,m]=h,{id:l,styleId:b}=Ee(f,t,r.styleMirror);return(l&&l!==-1||b&&b!==-1)&&e({id:l,styleId:b,adds:[{rule:p,index:m}]}),u.apply(f,h)})}),n.CSSStyleSheet.prototype.addRule=function(u,f,h=this.cssRules.length){let p=`${u} { ${f} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[p,h])};let o=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:H((u,f,h)=>{let[p]=h,{id:m,styleId:l}=Ee(f,t,r.styleMirror);return(m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,removes:[{index:p}]}),u.apply(f,h)})}),n.CSSStyleSheet.prototype.removeRule=function(u){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let a;n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:H((u,f,h)=>{let[p]=h,{id:m,styleId:l}=Ee(f,t,r.styleMirror);return(m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,replace:p}),u.apply(f,h)})}));let c;n.CSSStyleSheet.prototype.replaceSync&&(c=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(c,{apply:H((u,f,h)=>{let[p]=h,{id:m,styleId:l}=Ee(f,t,r.styleMirror);return(m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,replaceSync:p}),u.apply(f,h)})}));let i={};ot("CSSGroupingRule")?i.CSSGroupingRule=n.CSSGroupingRule:(ot("CSSMediaRule")&&(i.CSSMediaRule=n.CSSMediaRule),ot("CSSConditionRule")&&(i.CSSConditionRule=n.CSSConditionRule),ot("CSSSupportsRule")&&(i.CSSSupportsRule=n.CSSSupportsRule));let d={};return Object.entries(i).forEach(([u,f])=>{d[u]={insertRule:f.prototype.insertRule,deleteRule:f.prototype.deleteRule},f.prototype.insertRule=new Proxy(d[u].insertRule,{apply:H((h,p,m)=>{let[l,b]=m,{id:k,styleId:I}=Ee(p.parentStyleSheet,t,r.styleMirror);return(k&&k!==-1||I&&I!==-1)&&e({id:k,styleId:I,adds:[{rule:l,index:[...pt(p),b||0]}]}),h.apply(p,m)})}),f.prototype.deleteRule=new Proxy(d[u].deleteRule,{apply:H((h,p,m)=>{let[l]=m,{id:b,styleId:k}=Ee(p.parentStyleSheet,t,r.styleMirror);return(b&&b!==-1||k&&k!==-1)&&e({id:b,styleId:k,removes:[{index:[...pt(p),l]}]}),h.apply(p,m)})})}),H(()=>{n.CSSStyleSheet.prototype.insertRule=s,n.CSSStyleSheet.prototype.deleteRule=o,a&&(n.CSSStyleSheet.prototype.replace=a),c&&(n.CSSStyleSheet.prototype.replaceSync=c),Object.entries(i).forEach(([u,f])=>{f.prototype.insertRule=d[u].insertRule,f.prototype.deleteRule=d[u].deleteRule})})}function Wr({mirror:e,stylesheetManager:t},r){var n,s,o;let a=null;r.nodeName==="#document"?a=e.getId(r):a=e.getId(C.host(r));let c=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(o=(s=r.ownerDocument)==null?void 0:s.defaultView)==null?void 0:o.ShadowRoot,i=c?.prototype?Object.getOwnPropertyDescriptor(c?.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!c||!i?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get(){var d;return(d=i.get)==null?void 0:d.call(this)},set(d){var u;let f=(u=i.set)==null?void 0:u.call(this,d);if(a!==null&&a!==-1)try{t.adoptStyleSheets(d,a)}catch{}return f}}),H(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get:i.get,set:i.set})}))}function fs({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:s}){let o=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:H((c,i,d)=>{var u;let[f,h,p]=d;if(r.has(f))return o.apply(i,[f,h,p]);let{id:m,styleId:l}=Ee((u=i.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return(m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,set:{property:f,value:h,priority:p},index:pt(i.parentRule)}),c.apply(i,d)})});let a=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:H((c,i,d)=>{var u;let[f]=d;if(r.has(f))return a.apply(i,[f]);let{id:h,styleId:p}=Ee((u=i.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return(h&&h!==-1||p&&p!==-1)&&e({id:h,styleId:p,remove:{property:f},index:pt(i.parentRule)}),c.apply(i,d)})}),H(()=>{s.CSSStyleDeclaration.prototype.setProperty=o,s.CSSStyleDeclaration.prototype.removeProperty=a})}function hs({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:s,doc:o}){let a=H(i=>Ke(H(d=>{let u=Qe(d);if(!u||he(u,t,r,!0))return;let{currentTime:f,volume:h,muted:p,playbackRate:m,loop:l}=u;e({type:i,id:n.getId(u),currentTime:f,volume:h,muted:p,playbackRate:m,loop:l})}),s.media||500)),c=[le("play",a(_e.Play),o),le("pause",a(_e.Pause),o),le("seeked",a(_e.Seeked),o),le("volumechange",a(_e.VolumeChange),o),le("ratechange",a(_e.RateChange),o)];return H(()=>{c.forEach(i=>i())})}function ps({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let n=[],s=new WeakMap,o=r.FontFace;r.FontFace=function(i,d,u){let f=new o(i,d,u);return s.set(f,{family:i,buffer:typeof d!="string",descriptors:u,fontSource:typeof d=="string"?d:JSON.stringify(Array.from(new Uint8Array(d)))}),f};let a=Te(t.fonts,"add",function(c){return function(i){return setTimeout(H(()=>{let d=s.get(i);d&&(e(d),s.delete(i))}),0),c.apply(this,[i])}});return n.push(()=>{r.FontFace=o}),n.push(a),H(()=>{n.forEach(c=>c())})}function ms(e){let{doc:t,mirror:r,blockClass:n,blockSelector:s,selectionCb:o}=e,a=!0,c=H(()=>{let i=t.getSelection();if(!i||a&&i?.isCollapsed)return;a=i.isCollapsed||!1;let d=[],u=i.rangeCount||0;for(let f=0;f<u;f++){let h=i.getRangeAt(f),{startContainer:p,startOffset:m,endContainer:l,endOffset:b}=h;he(p,n,s,!0)||he(l,n,s,!0)||d.push({start:r.getId(p),startOffset:m,end:r.getId(l),endOffset:b})}o({ranges:d})});return c(),le("selectionchange",c)}function gs({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:Te(r.customElements,"define",function(s){return function(o,a,c){try{t({define:{name:o}})}catch{console.warn(`Custom element callback failed for ${o}`)}return s.apply(this,[o,a,c])}})}function ys(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:s,scrollCb:o,viewportResizeCb:a,inputCb:c,mediaInteractionCb:i,styleSheetRuleCb:d,styleDeclarationCb:u,canvasMutationCb:f,fontCb:h,selectionCb:p,customElementCb:m}=e;e.mutationCb=(...l)=>{t.mutation&&t.mutation(...l),r(...l)},e.mousemoveCb=(...l)=>{t.mousemove&&t.mousemove(...l),n(...l)},e.mouseInteractionCb=(...l)=>{t.mouseInteraction&&t.mouseInteraction(...l),s(...l)},e.scrollCb=(...l)=>{t.scroll&&t.scroll(...l),o(...l)},e.viewportResizeCb=(...l)=>{t.viewportResize&&t.viewportResize(...l),a(...l)},e.inputCb=(...l)=>{t.input&&t.input(...l),c(...l)},e.mediaInteractionCb=(...l)=>{t.mediaInteaction&&t.mediaInteaction(...l),i(...l)},e.styleSheetRuleCb=(...l)=>{t.styleSheetRule&&t.styleSheetRule(...l),d(...l)},e.styleDeclarationCb=(...l)=>{t.styleDeclaration&&t.styleDeclaration(...l),u(...l)},e.canvasMutationCb=(...l)=>{t.canvasMutation&&t.canvasMutation(...l),f(...l)},e.fontCb=(...l)=>{t.font&&t.font(...l),h(...l)},e.selectionCb=(...l)=>{t.selection&&t.selection(...l),p(...l)},e.customElementCb=(...l)=>{t.customElement&&t.customElement(...l),m(...l)}}function bs(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};ys(e,t);let n;e.recordDOM&&(n=Pr(e,e.doc));let s=is(e),o=as(e),a=Fr(e),c=ls(e,{win:r}),i=ds(e),d=hs(e),u=()=>{},f=()=>{},h=()=>{},p=()=>{};e.recordDOM&&(u=us(e,{win:r}),f=Wr(e,e.doc),h=fs(e,{win:r}),e.collectFonts&&(p=ps(e)));let m=ms(e),l=gs(e),b=[];for(let k of e.plugins)b.push(k.observer(k.callback,r,k.options));return H(()=>{n?.(),s(),o(),a(),c(),i(),d(),u(),f(),h(),p(),m(),l(),b.forEach(k=>k())})}function st(e){return typeof window[e]<"u"}function ot(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var mt=class{constructor(t){y(this,"iframeIdToRemoteIdMap",new WeakMap),y(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,n,s){let o=n||this.getIdToRemoteIdMap(t),a=s||this.getRemoteIdToIdMap(t),c=o.get(r);return c||(c=this.generateIdFn(),o.set(r,c),a.set(c,r)),c}getIds(t,r){let n=this.getIdToRemoteIdMap(t),s=this.getRemoteIdToIdMap(t);return r.map(o=>this.getId(t,o,n,s))}getRemoteId(t,r,n){let s=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let o=s.get(r);return o||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(s=>this.getRemoteId(t,s,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}},Ut=class{constructor(t){y(this,"iframes",new WeakMap),y(this,"crossOriginIframeMap",new WeakMap),y(this,"crossOriginIframeMirror",new mt(Cr)),y(this,"crossOriginIframeStyleMirror"),y(this,"crossOriginIframeRootIdMap",new WeakMap),y(this,"mirror"),y(this,"mutationCb"),y(this,"wrappedEmit"),y(this,"loadListener"),y(this,"unloadListener"),y(this,"attachedWindows",new Map),y(this,"messageHandler",r=>this.handleMessage(r)),y(this,"stylesheetManager"),y(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new mt(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}addUnloadListener(t){this.unloadListener=t}attachIframe(t,r){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.watchIframeWindow(t),(n=this.loadListener)==null||n.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}destroy(){window.removeEventListener("message",this.messageHandler),this.attachedWindows.forEach(t=>t())}watchIframeWindow(t){let r=t.contentWindow;if(!r||this.attachedWindows.has(r))return;let n=[],s=()=>{this.attachedWindows.delete(r),n.forEach(o=>{try{o()}catch{}})};this.attachedWindows.set(r,s),this.recordCrossOriginIframes&&n.push(le("message",this.messageHandler,r)),n.push(le("pagehide",o=>{var a;if(o.persisted)return;let c=r.document;s(),(a=this.unloadListener)==null||a.call(this,c)},r))}handleMessage(t){let r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;let s=this.crossOriginIframeMap.get(t.source);if(!s)return;let o=this.transformCrossOriginEvent(s,r.data.event);o&&this.wrappedEmit(o,r.data.isCheckout)}transformCrossOriginEvent(t,r){var n;switch(r.type){case P.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let s=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,s),this.patchRootIdOnNode(r.data.node,s),{timestamp:r.timestamp,type:P.IncrementalSnapshot,data:{source:F.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case P.Meta:case P.Load:case P.DomContentLoaded:return!1;case P.Annotation:case P.Plugin:return r;case P.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case P.IncrementalSnapshot:switch(r.data.source){case F.Mutation:return r.data.adds.forEach(s=>{this.replaceIds(s,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(s.node,t);let o=this.crossOriginIframeRootIdMap.get(t);o&&this.patchRootIdOnNode(s.node,o)}),r.data.removes.forEach(s=>{this.replaceIds(s,t,["parentId","id"])}),r.data.attributes.forEach(s=>{this.replaceIds(s,t,["id"])}),r.data.texts.forEach(s=>{this.replaceIds(s,t,["id"])}),r;case F.Drag:case F.TouchMove:case F.MouseMove:return r.data.positions.forEach(s=>{this.replaceIds(s,t,["id"])}),r;case F.ViewportResize:return!1;case F.MediaInteraction:case F.MouseInteraction:case F.Scroll:case F.CanvasMutation:case F.Input:return this.replaceIds(r.data,t,["id"]),r;case F.StyleSheetRule:case F.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case F.Font:return r;case F.Selection:return r.data.ranges.forEach(s=>{this.replaceIds(s,t,["start","end"])}),r;case F.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(s=>{this.replaceStyleIds(s,t,["styleId"])}),r}}return!1}replace(t,r,n,s){for(let o of s)!Array.isArray(r[o])&&typeof r[o]!="number"||(Array.isArray(r[o])?r[o]=t.getIds(n,r[o]):r[o]=t.getId(n,r[o]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(t,r){t.type!==te.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}},Bt=class{constructor(t){y(this,"shadowDoms",new Map),y(this,"mutationCb"),y(this,"scrollCb"),y(this,"bypassOptions"),y(this,"mirror"),y(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,r){if(!Je(t)||this.shadowDoms.has(t))return;let n=[];this.shadowDoms.set(t,n);let s=Pr({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);n.push(s),n.push(Fr({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{this.shadowDoms.get(t)===n&&(t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(C.host(t))),n.push(Wr({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)))},0)}removeShadowRootsIn(t){if(this.shadowDoms.size===0)return;let r=C.shadowRoot(t);r&&(this.shadowDoms.has(r)&&this.removeShadowRoot(r),this.removeShadowRootsIn(r)),C.childNodes(t).forEach(n=>this.removeShadowRootsIn(n))}removeShadowRoot(t){let r=this.shadowDoms.get(t);this.shadowDoms.delete(t),r?.forEach(Ot)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){let n=this;this.restoreHandlers.push(Te(t.prototype,"attachShadow",function(s){return function(o){let a=s.call(this,o),c=C.shadowRoot(this);return c&&_t(this)&&n.addShadowRoot(c,r),a}}))}reset(){this.restoreHandlers.forEach(Ot),this.restoreHandlers=[];let t=this.shadowDoms;this.shadowDoms=new Map,t.forEach(r=>r.forEach(Ot))}};function Ot(e){try{e()}catch{}}var Ue="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ss=typeof Uint8Array>"u"?[]:new Uint8Array(256);for($e=0;$e<Ue.length;$e++)Ss[Ue.charCodeAt($e)]=$e;var $e,ws=function(e){var t=new Uint8Array(e),r,n=t.length,s="";for(r=0;r<n;r+=3)s+=Ue[t[r]>>2],s+=Ue[(t[r]&3)<<4|t[r+1]>>4],s+=Ue[(t[r+1]&15)<<2|t[r+2]>>6],s+=Ue[t[r+2]&63];return n%3===2?s=s.substring(0,s.length-1)+"=":n%3===1&&(s=s.substring(0,s.length-2)+"=="),s},fr=new Map;function vs(e,t){let r=fr.get(e);return r||(r=new Map,fr.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var Ur=(e,t,r)=>{if(!e||!(Hr(e,t)||typeof e=="object"))return;let n=e.constructor.name,s=vs(r,n),o=s.indexOf(e);return o===-1&&(o=s.length,s.push(e)),o};function it(e,t,r){if(e instanceof Array)return e.map(n=>it(n,t,r));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let n=e.constructor.name,s=ws(e);return{rr_type:n,base64:s}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[it(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:s}=e;return{rr_type:n,src:s}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",s=e.toDataURL();return{rr_type:n,src:s}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[it(e.data,t,r),e.width,e.height]};if(Hr(e,t)||typeof e=="object"){let n=e.constructor.name,s=Ur(e,t,r);return{rr_type:n,index:s}}}}return e}var Br=(e,t,r)=>e.map(n=>it(n,t,r)),Hr=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(s=>typeof t[s]=="function").find(s=>e instanceof t[s]);function Cs(e,t,r,n){let s=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let a of o)try{if(typeof t.CanvasRenderingContext2D.prototype[a]!="function")continue;let c=Te(t.CanvasRenderingContext2D.prototype,a,function(i){return function(...d){return he(this.canvas,r,n,!0)||setTimeout(()=>{let u=Br(d,t,this);e(this.canvas,{type:He["2D"],property:a,args:u})},0),i.apply(this,d)}});s.push(c)}catch{let c=gt(t.CanvasRenderingContext2D.prototype,a,{set(i){e(this.canvas,{type:He["2D"],property:a,args:[i],setter:!0})}});s.push(c)}return()=>{s.forEach(a=>a())}}function Ms(e){return e==="experimental-webgl"?"webgl":e}function hr(e,t,r,n){let s=[];try{let o=Te(e.HTMLCanvasElement.prototype,"getContext",function(a){return function(c,...i){if(!he(this,t,r,!0)){let d=Ms(c);if("__context"in this||(this.__context=d),n&&["webgl","webgl2"].includes(d))if(i[0]&&typeof i[0]=="object"){let u=i[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else i.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[c,...i])}});s.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(o=>o())}}function pr(e,t,r,n,s,o){let a=[],c=Object.getOwnPropertyNames(e);for(let i of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(i))try{if(typeof e[i]!="function")continue;let d=Te(e,i,function(u){return function(...f){let h=u.apply(this,f);if(Ur(h,o,this),"tagName"in this.canvas&&!he(this.canvas,n,s,!0)){let p=Br(f,o,this),m={type:t,property:i,args:p};r(this.canvas,m)}return h}});a.push(d)}catch{let d=gt(e,i,{set(u){r(this.canvas,{type:t,property:i,args:[u],setter:!0})}});a.push(d)}return a}function Is(e,t,r,n){let s=[];return typeof t.WebGLRenderingContext<"u"&&s.push(...pr(t.WebGLRenderingContext.prototype,He.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&s.push(...pr(t.WebGL2RenderingContext.prototype,He.WebGL2,e,r,n,t)),()=>{s.forEach(o=>o())}}var zr=`(function() {
3
+ or you can use record.mirror to access the mirror instance during recording.`,fr={map:{},getId(){return console.error(Fe),-1},getNode(){return console.error(Fe),null},removeNodeFromMap(){console.error(Fe)},has(){return console.error(Fe),!1},reset(){console.error(Fe)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(fr=new Proxy(fr,{get(e,t,r){return t==="map"&&console.error(Fe),Reflect.get(e,t,r)}}));function Qe(e,t,r={}){let n=null,s=0;return function(...o){let a=Date.now();!s&&r.leading===!1&&(s=a);let c=t-(a-s),i=this;c<=0||c>t?(n&&(clearTimeout(n),n=null),s=a,e.apply(i,o)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{s=r.leading===!1?0:Date.now(),n=null,e.apply(i,o)},c))}}function bt(e,t,r,n,s=window){let o=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,n?r:{set(a){setTimeout(()=>{r.set.call(this,a)},0),o&&o.set&&o.set.call(this,a)}}),()=>bt(e,t,o||{},!0)}function Tr(e){var t,r,n,s;let o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:o.documentElement.scrollLeft||o?.body&&((t=M.parentElement(o.body))==null?void 0:t.scrollLeft)||((r=o?.body)==null?void 0:r.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:o?.documentElement.scrollTop||o?.body&&((n=M.parentElement(o.body))==null?void 0:n.scrollTop)||((s=o?.body)==null?void 0:s.scrollTop)||0}}function Dr(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Lr(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ar(e){return e?e.nodeType===e.ELEMENT_NODE?e:M.parentElement(e):null}function de(e,t,r,n){if(!e)return!1;let s=Ar(e);if(!s)return!1;try{if(typeof t=="string"){if(s.classList.contains(t)||n&&s.closest("."+t)!==null)return!0}else if(mt(s,t,n))return!0}catch{}return!!(r&&(s.matches(r)||n&&s.closest(r)!==null))}function ns(e,t){return t.getId(e)!==-1}function xt(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===pt}function _r(e,t){if(Xe(e))return!1;let r=t.getId(e);if(!t.has(r))return!0;let n=M.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?!1:n?_r(n,t):!0}function _t(e){return!!e.changedTouches}function ss(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Pr(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Fr(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Pt(e){return e?e instanceof At&&"shadowRoot"in e?!!e.shadowRoot:!!M.shadowRoot(e):!1}var Ft=class{constructor(){y(this,"id",1),y(this,"styleIDMap",new WeakMap),y(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Wr(e){var t;let r=null;return"getRootNode"in e&&((t=M.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&M.host(M.getRootNode(e))&&(r=M.host(M.getRootNode(e))),r}function os(e){let t=e,r;for(;r=Wr(t);)t=r;return t}function is(e){let t=M.ownerDocument(e);if(!t)return!1;let r=os(e);return M.contains(t,r)}function Wt(e){let t=M.ownerDocument(e);return t?M.contains(t,e)||is(e):!1}var hr=(e,t)=>`${e}@${t}`,Ut=class{constructor(){y(this,"frozen",!1),y(this,"locked",!1),y(this,"texts",[]),y(this,"attributes",[]),y(this,"attributeMap",new WeakMap),y(this,"removes",[]),y(this,"mapRemoves",[]),y(this,"movedMap",{}),y(this,"addedSet",new Set),y(this,"movedSet",new Set),y(this,"droppedSet",new Set),y(this,"removesSubTreeCache",new Set),y(this,"mutationCb"),y(this,"blockClass"),y(this,"blockSelector"),y(this,"maskTextClass"),y(this,"maskTextSelector"),y(this,"inlineStylesheet"),y(this,"maskInputOptions"),y(this,"maskTextFn"),y(this,"maskInputFn"),y(this,"keepIframeSrcFn"),y(this,"recordCanvas"),y(this,"inlineImages"),y(this,"slimDOMOptions"),y(this,"dataURLOptions"),y(this,"doc"),y(this,"mirror"),y(this,"iframeManager"),y(this,"stylesheetManager"),y(this,"shadowDomManager"),y(this,"processedNodeManager"),y(this,"unattachedDoc"),y(this,"processMutations",t=>{Ht&&(t=Ht(t),!t.length)||(t.forEach(this.processMutation),this.emit())}),y(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],r=new Set;for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let h of this.movedSet){let p=M.parentNode(h);this.removesSubTreeCache.has(p)&&!this.movedSet.has(p)||this.addedSet.add(h)}let n=null,s=null,o=-1,a=null,c=!1,i=new Set,d=this.addedSet.values(),u=d.next();for(;this.addedSet.size;){if(n!==null&&this.addedSet.has(M.previousSibling(n)))a=n,n=M.previousSibling(n);else{for(this.addedSet.has(u.value)||(u=d.next()),n=u.value;;){if(s=M.parentNode(n),this.addedSet.has(s)){n=s;continue}break}if(i.has(s))s=null;else if(s){if(Wt(s)?(c=pr(this.droppedSet,s)||this.removesSubTreeCache.has(s),c&&pr(this.movedSet,n)&&(c=!1)):c=!0,this.addedSet.has(M.lastChild(s)))n=M.lastChild(s),a=null;else for(;;){if(a=M.nextSibling(n),this.addedSet.has(a)){n=a;continue}break}if(o=Xe(s)?this.mirror.getId(Wr(n)):this.mirror.getId(s),o===-1&&s.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let l=M.host(s);o=this.mirror.getId(l)}}}if(this.addedSet.delete(n),!s||o===-1){i.add(n);continue}else if(c){this.droppedSet.add(n);continue}let h=!1;if(n.nodeType===Node.TEXT_NODE){let l=s.tagName;if(l==="TEXTAREA")continue;l==="STYLE"&&r.has(o)&&(h=!0)}let p=a?this.mirror.getId(a):null;for(;p===pt;)a=a&&M.nextSibling(a),p=a&&this.mirror.getId(a);if(p===-1){console.warn("Couldn't record new node. Couldn't find mirror id for nextSibling:",a),n=null;continue}let m=Ue(n,{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:l=>{Pr(l,this.mirror)&&this.iframeManager.addIframe(l),Fr(l,this.mirror)&&this.stylesheetManager.trackLinkElement(l),Pt(n)&&this.shadowDomManager.addShadowRoot(M.shadowRoot(n),this.doc)},onIframeLoad:(l,b)=>{this.iframeManager.attachIframe(l,b),this.shadowDomManager.observeAttachShadow(l)},onStylesheetLoad:(l,b)=>{this.stylesheetManager.attachLinkElement(l,b)},cssCaptured:h});m&&(t.push({parentId:o,nextId:p,node:m}),r.add(m.id))}let f={texts:this.texts.map(h=>{let p=h.node,m=M.parentNode(p);return m&&m.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(m),{id:this.mirror.getId(p),value:h.value}}).filter(h=>!r.has(h.id)).filter(h=>this.mirror.has(h.id)),attributes:this.attributes.map(h=>{let{attributes:p}=h;if(typeof p.style=="string"){let m=JSON.stringify(h.styleDiff),l=JSON.stringify(h._unchangedStyles);m.length<p.style.length&&(m+l).split("var(").length===p.style.split("var(").length&&(p.style=h.styleDiff)}return{id:this.mirror.getId(h.node),attributes:p}}).filter(h=>!r.has(h.id)).filter(h=>this.mirror.has(h.id)),removes:this.removes,adds:t};!f.texts.length&&!f.attributes.length&&!f.removes.length&&!f.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(f))}),y(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r));let n=Array.from(M.childNodes(t),s=>M.textContent(s)||"").join("");r.attributes.value=ut({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:ft(t),value:n,maskInputFn:this.maskInputFn})}),y(this,"processMutation",t=>{if(!xt(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let r=M.textContent(t.target);!de(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:Nr(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,Ar(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{let r=t.target,n=Re(r.tagName),s=t.attributeName,o=t.target.getAttribute(s);if(s==="value"){let c=ft(r);o=ut({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:c,value:o,maskInputFn:this.maskInputFn})}if(de(t.target,this.blockClass,this.blockSelector,!1)||o===t.oldValue)return;let a=this.attributeMap.get(t.target);if(n==="iframe"&&s==="src"&&!this.keepIframeSrcFn(o))if(!r.contentDocument)s="rr_src";else return;if(a||(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(t.target,a)),s==="type"&&n==="input"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!Or(n,s))if(a.attributes[s]=Er(this.doc,n,Re(s),o),s==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let c=this.unattachedDoc.createElement("span");t.oldValue&&c.setAttribute("style",t.oldValue);for(let i of Array.from(r.style)){let d=r.style.getPropertyValue(i),u=r.style.getPropertyPriority(i);d!==c.style.getPropertyValue(i)||u!==c.style.getPropertyPriority(i)?u===""?a.styleDiff[i]=d:a.styleDiff[i]=[d,u]:a._unchangedStyles[i]=[d,u]}for(let i of Array.from(c.style))r.style.getPropertyValue(i)===""&&(a.styleDiff[i]=!1)}else s==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?a.attributes.rr_open_mode="modal":a.attributes.rr_open_mode="non-modal");break}case"childList":{if(de(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{Wt(r)||this.shadowDomManager.removeShadowRootsIn(r);let n=this.mirror.getId(r),s=Xe(t.target)?this.mirror.getId(M.host(t.target)):this.mirror.getId(t.target);de(t.target,this.blockClass,this.blockSelector,!1)||xt(r,this.mirror,this.slimDOMOptions)||!ns(r,this.mirror)||(this.addedSet.has(r)?(Bt(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||_r(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[hr(n,s)]?Bt(this.movedSet,r):(this.removes.push({parentId:s,id:n,isShadow:Xe(t.target)&&Ye(t.target)?!0:void 0}),as(r,this.removesSubTreeCache))),this.mapRemoves.push(r))});break}}}),y(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(xt(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[hr(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);de(t,this.blockClass,this.blockSelector,!1)||(M.childNodes(t).forEach(n=>this.genAdds(n)),Pt(t)&&M.childNodes(M.shadowRoot(t)).forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","processedNodeManager"].forEach(r=>{this[r]=t[r]})}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1,this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0}unlock(){this.locked=!1,this.emit()}};function Bt(e,t){e.delete(t),M.childNodes(t).forEach(r=>Bt(e,r))}function as(e,t){let r=[e];for(;r.length;){let n=r.pop();t.has(n)||(t.add(n),M.childNodes(n).forEach(s=>r.push(s)))}}function pr(e,t){return e.size===0?!1:Ur(e,t)}function Ur(e,t){if(e.has(t))return!0;let r=M.parentNode(t);return r?Ur(e,r):!1}var Ke;function ls(e){Ke=e}function cs(){Ke=void 0}var U=e=>Ke?(...r)=>{try{return e(...r)}catch(n){if(Ke&&Ke(n)===!0)return;throw n}}:e,Ht=null,He=new Set;function tt(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function Br(e,t){let r=new Ut;He.add(r),r.init(e);let[n,s]=vr(),o=new n(U(r.processMutations.bind(r)));return o.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),()=>{o.disconnect(),He.delete(r),s()}}function ds({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};let s=typeof t.mousemove=="number"?t.mousemove:50,o=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,a=[],c,i=Qe(U(f=>{let h=Date.now()-c;e(a.map(p=>(p.timeOffset-=h,p)),f),a=[],c=null}),o),d=U(Qe(U(f=>{let h=tt(f),{clientX:p,clientY:m}=_t(f)?f.changedTouches[0]:f;c||(c=Ze()),a.push({x:p,y:m,id:n.getId(h),timeOffset:Ze()-c}),i(typeof DragEvent<"u"&&f instanceof DragEvent?W.Drag:f instanceof MouseEvent?W.MouseMove:W.TouchMove)}),s,{trailing:!1})),u=[le("mousemove",d,r),le("touchmove",d,r),le("drag",d,r)];return U(()=>{u.forEach(f=>f())})}function us({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let a=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,c=[],i=null,d=u=>f=>{let h=tt(f);if(de(h,n,s,!0))return;let p=null,m=u;if("pointerType"in f){switch(f.pointerType){case"mouse":p=Ce.Mouse;break;case"touch":p=Ce.Touch;break;case"pen":p=Ce.Pen;break}p===Ce.Touch?ue[u]===ue.MouseDown?m="TouchStart":ue[u]===ue.MouseUp&&(m="TouchEnd"):Ce.Pen}else _t(f)&&(p=Ce.Touch);p!==null?(i=p,(m.startsWith("Touch")&&p===Ce.Touch||m.startsWith("Mouse")&&p===Ce.Mouse)&&(p=null)):ue[u]===ue.Click&&(p=i,i=null);let l=_t(f)?f.changedTouches[0]:f;if(!l)return;let b=r.getId(h),{clientX:E,clientY:k}=l;U(e)({type:ue[m],id:b,x:E,y:k,...p!==null&&{pointerType:p}})};return Object.keys(ue).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&a[u]!==!1).forEach(u=>{let f=Re(u),h=d(u);if(window.PointerEvent)switch(ue[u]){case ue.MouseDown:case ue.MouseUp:f=f.replace("mouse","pointer");break;case ue.TouchStart:case ue.TouchEnd:return}c.push(le(f,h,t))}),U(()=>{c.forEach(u=>u())})}function Hr({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,sampling:o}){let a=U(Qe(U(c=>{let i=tt(c);if(!i||de(i,n,s,!0))return;let d=r.getId(i);if(i===t&&t.defaultView){let u=Tr(t.defaultView);e({id:d,x:u.left,y:u.top})}else e({id:d,x:i.scrollLeft,y:i.scrollTop})}),o.scroll||100));return le("scroll",a,t)}function fs({viewportResizeCb:e},{win:t}){let r=-1,n=-1,s=U(Qe(U(()=>{let o=Dr(),a=Lr();(r!==o||n!==a)&&(e({width:Number(a),height:Number(o)}),r=o,n=a)}),200));return le("resize",s,t)}var hs=["INPUT","TEXTAREA","SELECT"],mr=new WeakMap;function ps({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,ignoreClass:o,ignoreSelector:a,maskInputOptions:c,maskInputFn:i,sampling:d,userTriggeredOnInput:u}){function f(k){let g=tt(k),w=k.isTrusted,N=g&&g.tagName;if(g&&N==="OPTION"&&(g=M.parentElement(g)),!g||!N||hs.indexOf(N)<0||de(g,n,s,!0)||g.classList.contains(o)||a&&g.matches(a))return;let _=g.value,j=!1,x=ft(g)||"";x==="radio"||x==="checkbox"?j=g.checked:(c[N.toLowerCase()]||c[x])&&(_=ut({element:g,maskInputOptions:c,tagName:N,type:x,value:_,maskInputFn:i})),h(g,u?{text:_,isChecked:j,userTriggered:w}:{text:_,isChecked:j});let V=g.name;x==="radio"&&V&&j&&t.querySelectorAll(`input[type="radio"][name="${V}"]`).forEach(re=>{if(re!==g){let Z=re.value;h(re,u?{text:Z,isChecked:!j,userTriggered:!1}:{text:Z,isChecked:!j})}})}function h(k,g){let w=mr.get(k);if(!w||w.text!==g.text||w.isChecked!==g.isChecked){mr.set(k,g);let N=r.getId(k);U(e)({...g,id:N})}}let m=(d.input==="last"?["change"]:["input","change"]).map(k=>le(k,U(f),t)),l=t.defaultView;if(!l)return()=>{m.forEach(k=>k())};let b=l.Object.getOwnPropertyDescriptor(l.HTMLInputElement.prototype,"value"),E=[[l.HTMLInputElement.prototype,"value"],[l.HTMLInputElement.prototype,"checked"],[l.HTMLSelectElement.prototype,"value"],[l.HTMLTextAreaElement.prototype,"value"],[l.HTMLSelectElement.prototype,"selectedIndex"],[l.HTMLOptionElement.prototype,"selected"]];return b&&b.set&&m.push(...E.map(k=>bt(k[0],k[1],{set(){U(f)({target:this,isTrusted:!1})}},!1,l))),U(()=>{m.forEach(k=>k())})}function gt(e){let t=[];function r(n,s){if(it("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||it("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||it("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||it("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let a=Array.from(n.parentRule.cssRules).indexOf(n);return s.unshift(a),r(n.parentRule,s)}else if(n.parentStyleSheet){let a=Array.from(n.parentStyleSheet.cssRules).indexOf(n);s.unshift(a)}return s}return r(e,t)}function ke(e,t,r){let n,s;return e?(e.ownerNode?n=t.getId(e.ownerNode):s=r.getId(e),{styleId:s,id:n}):{}}function ms({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};let s=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:U((u,f,h)=>{let[p,m]=h,{id:l,styleId:b}=ke(f,t,r.styleMirror);return(l&&l!==-1||b&&b!==-1)&&e({id:l,styleId:b,adds:[{rule:p,index:m}]}),u.apply(f,h)})}),n.CSSStyleSheet.prototype.addRule=function(u,f,h=this.cssRules.length){let p=`${u} { ${f} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[p,h])};let o=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:U((u,f,h)=>{let[p]=h,{id:m,styleId:l}=ke(f,t,r.styleMirror);return(m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,removes:[{index:p}]}),u.apply(f,h)})}),n.CSSStyleSheet.prototype.removeRule=function(u){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let a;n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:U((u,f,h)=>{let[p]=h,{id:m,styleId:l}=ke(f,t,r.styleMirror);return(m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,replace:p}),u.apply(f,h)})}));let c;n.CSSStyleSheet.prototype.replaceSync&&(c=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(c,{apply:U((u,f,h)=>{let[p]=h,{id:m,styleId:l}=ke(f,t,r.styleMirror);return(m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,replaceSync:p}),u.apply(f,h)})}));let i={};at("CSSGroupingRule")?i.CSSGroupingRule=n.CSSGroupingRule:(at("CSSMediaRule")&&(i.CSSMediaRule=n.CSSMediaRule),at("CSSConditionRule")&&(i.CSSConditionRule=n.CSSConditionRule),at("CSSSupportsRule")&&(i.CSSSupportsRule=n.CSSSupportsRule));let d={};return Object.entries(i).forEach(([u,f])=>{d[u]={insertRule:f.prototype.insertRule,deleteRule:f.prototype.deleteRule},f.prototype.insertRule=new Proxy(d[u].insertRule,{apply:U((h,p,m)=>{let[l,b]=m,{id:E,styleId:k}=ke(p.parentStyleSheet,t,r.styleMirror);return(E&&E!==-1||k&&k!==-1)&&e({id:E,styleId:k,adds:[{rule:l,index:[...gt(p),b||0]}]}),h.apply(p,m)})}),f.prototype.deleteRule=new Proxy(d[u].deleteRule,{apply:U((h,p,m)=>{let[l]=m,{id:b,styleId:E}=ke(p.parentStyleSheet,t,r.styleMirror);return(b&&b!==-1||E&&E!==-1)&&e({id:b,styleId:E,removes:[{index:[...gt(p),l]}]}),h.apply(p,m)})})}),U(()=>{n.CSSStyleSheet.prototype.insertRule=s,n.CSSStyleSheet.prototype.deleteRule=o,a&&(n.CSSStyleSheet.prototype.replace=a),c&&(n.CSSStyleSheet.prototype.replaceSync=c),Object.entries(i).forEach(([u,f])=>{f.prototype.insertRule=d[u].insertRule,f.prototype.deleteRule=d[u].deleteRule})})}function zr({mirror:e,stylesheetManager:t},r){var n,s,o;let a=null;r.nodeName==="#document"?a=e.getId(r):a=e.getId(M.host(r));let c=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(o=(s=r.ownerDocument)==null?void 0:s.defaultView)==null?void 0:o.ShadowRoot,i=c?.prototype?Object.getOwnPropertyDescriptor(c?.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!c||!i?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get(){var d;return(d=i.get)==null?void 0:d.call(this)},set(d){var u;let f=(u=i.set)==null?void 0:u.call(this,d);if(a!==null&&a!==-1)try{t.adoptStyleSheets(d,a)}catch{}return f}}),U(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get:i.get,set:i.set})}))}function gs({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:s}){let o=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:U((c,i,d)=>{var u;let[f,h,p]=d;if(r.has(f))return o.apply(i,[f,h,p]);let{id:m,styleId:l}=ke((u=i.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return(m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,set:{property:f,value:h,priority:p},index:gt(i.parentRule)}),c.apply(i,d)})});let a=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:U((c,i,d)=>{var u;let[f]=d;if(r.has(f))return a.apply(i,[f]);let{id:h,styleId:p}=ke((u=i.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return(h&&h!==-1||p&&p!==-1)&&e({id:h,styleId:p,remove:{property:f},index:gt(i.parentRule)}),c.apply(i,d)})}),U(()=>{s.CSSStyleDeclaration.prototype.setProperty=o,s.CSSStyleDeclaration.prototype.removeProperty=a})}function ys({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:s,doc:o}){let a=U(i=>Qe(U(d=>{let u=tt(d);if(!u||de(u,t,r,!0))return;let{currentTime:f,volume:h,muted:p,playbackRate:m,loop:l}=u;e({type:i,id:n.getId(u),currentTime:f,volume:h,muted:p,playbackRate:m,loop:l})}),s.media||500)),c=[le("play",a(Pe.Play),o),le("pause",a(Pe.Pause),o),le("seeked",a(Pe.Seeked),o),le("volumechange",a(Pe.VolumeChange),o),le("ratechange",a(Pe.RateChange),o)];return U(()=>{c.forEach(i=>i())})}function bs({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let n=[],s=new WeakMap,o=r.FontFace;r.FontFace=function(i,d,u){let f=new o(i,d,u);return s.set(f,{family:i,buffer:typeof d!="string",descriptors:u,fontSource:typeof d=="string"?d:JSON.stringify(Array.from(new Uint8Array(d)))}),f};let a=xe(t.fonts,"add",function(c){return function(i){return setTimeout(U(()=>{let d=s.get(i);d&&(e(d),s.delete(i))}),0),c.apply(this,[i])}});return n.push(()=>{r.FontFace=o}),n.push(a),U(()=>{n.forEach(c=>c())})}function Ss(e){let{doc:t,mirror:r,blockClass:n,blockSelector:s,selectionCb:o}=e,a=!0,c=U(()=>{let i=t.getSelection();if(!i||a&&i?.isCollapsed)return;a=i.isCollapsed||!1;let d=[],u=i.rangeCount||0;for(let f=0;f<u;f++){let h=i.getRangeAt(f),{startContainer:p,startOffset:m,endContainer:l,endOffset:b}=h;de(p,n,s,!0)||de(l,n,s,!0)||d.push({start:r.getId(p),startOffset:m,end:r.getId(l),endOffset:b})}o({ranges:d})});return c(),le("selectionchange",c)}function ws({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:xe(r.customElements,"define",function(s){return function(o,a,c){try{t({define:{name:o}})}catch{console.warn(`Custom element callback failed for ${o}`)}return s.apply(this,[o,a,c])}})}function vs(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:s,scrollCb:o,viewportResizeCb:a,inputCb:c,mediaInteractionCb:i,styleSheetRuleCb:d,styleDeclarationCb:u,canvasMutationCb:f,fontCb:h,selectionCb:p,customElementCb:m}=e;e.mutationCb=(...l)=>{t.mutation&&t.mutation(...l),r(...l)},e.mousemoveCb=(...l)=>{t.mousemove&&t.mousemove(...l),n(...l)},e.mouseInteractionCb=(...l)=>{t.mouseInteraction&&t.mouseInteraction(...l),s(...l)},e.scrollCb=(...l)=>{t.scroll&&t.scroll(...l),o(...l)},e.viewportResizeCb=(...l)=>{t.viewportResize&&t.viewportResize(...l),a(...l)},e.inputCb=(...l)=>{t.input&&t.input(...l),c(...l)},e.mediaInteractionCb=(...l)=>{t.mediaInteaction&&t.mediaInteaction(...l),i(...l)},e.styleSheetRuleCb=(...l)=>{t.styleSheetRule&&t.styleSheetRule(...l),d(...l)},e.styleDeclarationCb=(...l)=>{t.styleDeclaration&&t.styleDeclaration(...l),u(...l)},e.canvasMutationCb=(...l)=>{t.canvasMutation&&t.canvasMutation(...l),f(...l)},e.fontCb=(...l)=>{t.font&&t.font(...l),h(...l)},e.selectionCb=(...l)=>{t.selection&&t.selection(...l),p(...l)},e.customElementCb=(...l)=>{t.customElement&&t.customElement(...l),m(...l)}}function Cs(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};vs(e,t);let n;e.recordDOM&&(n=Br(e,e.doc));let s=ds(e),o=us(e),a=Hr(e),c=fs(e,{win:r}),i=ps(e),d=ys(e),u=()=>{},f=()=>{},h=()=>{},p=()=>{};e.recordDOM&&(u=ms(e,{win:r}),f=zr(e,e.doc),h=gs(e,{win:r}),e.collectFonts&&(p=bs(e)));let m=Ss(e),l=ws(e),b=[];for(let E of e.plugins)b.push(E.observer(E.callback,r,E.options));return U(()=>{n?.(),s(),o(),a(),c(),i(),d(),u(),f(),h(),p(),m(),l(),b.forEach(E=>E())})}function it(e){return typeof window[e]<"u"}function at(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var yt=class{constructor(t){y(this,"iframeIdToRemoteIdMap",new WeakMap),y(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,n,s){let o=n||this.getIdToRemoteIdMap(t),a=s||this.getRemoteIdToIdMap(t),c=o.get(r);return c||(c=this.generateIdFn(),o.set(r,c),a.set(c,r)),c}getIds(t,r){let n=this.getIdToRemoteIdMap(t),s=this.getRemoteIdToIdMap(t);return r.map(o=>this.getId(t,o,n,s))}getRemoteId(t,r,n){let s=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let o=s.get(r);return o||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(s=>this.getRemoteId(t,s,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}},zt=class{constructor(t){y(this,"iframes",new WeakMap),y(this,"crossOriginIframeMap",new WeakMap),y(this,"crossOriginIframeMirror",new yt(Rr)),y(this,"crossOriginIframeStyleMirror"),y(this,"crossOriginIframeRootIdMap",new WeakMap),y(this,"mirror"),y(this,"mutationCb"),y(this,"wrappedEmit"),y(this,"loadListener"),y(this,"unloadListener"),y(this,"attachedWindows",new Map),y(this,"messageHandler",r=>this.handleMessage(r)),y(this,"stylesheetManager"),y(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new yt(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}addUnloadListener(t){this.unloadListener=t}attachIframe(t,r){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.watchIframeWindow(t),(n=this.loadListener)==null||n.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}destroy(){window.removeEventListener("message",this.messageHandler),this.attachedWindows.forEach(t=>t())}watchIframeWindow(t){let r=t.contentWindow;if(!r||this.attachedWindows.has(r))return;let n=[],s=()=>{this.attachedWindows.delete(r),n.forEach(o=>{try{o()}catch{}})};this.attachedWindows.set(r,s),this.recordCrossOriginIframes&&n.push(le("message",this.messageHandler,r)),n.push(le("pagehide",o=>{var a;if(o.persisted)return;let c=r.document;s(),(a=this.unloadListener)==null||a.call(this,c)},r))}handleMessage(t){let r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;let s=this.crossOriginIframeMap.get(t.source);if(!s)return;let o=this.transformCrossOriginEvent(s,r.data.event);o&&this.wrappedEmit(o,r.data.isCheckout)}transformCrossOriginEvent(t,r){var n;switch(r.type){case F.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let s=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,s),this.patchRootIdOnNode(r.data.node,s),{timestamp:r.timestamp,type:F.IncrementalSnapshot,data:{source:W.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case F.Meta:case F.Load:case F.DomContentLoaded:return!1;case F.Annotation:case F.Plugin:return r;case F.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case F.IncrementalSnapshot:switch(r.data.source){case W.Mutation:return r.data.adds.forEach(s=>{this.replaceIds(s,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(s.node,t);let o=this.crossOriginIframeRootIdMap.get(t);o&&this.patchRootIdOnNode(s.node,o)}),r.data.removes.forEach(s=>{this.replaceIds(s,t,["parentId","id"])}),r.data.attributes.forEach(s=>{this.replaceIds(s,t,["id"])}),r.data.texts.forEach(s=>{this.replaceIds(s,t,["id"])}),r;case W.Drag:case W.TouchMove:case W.MouseMove:return r.data.positions.forEach(s=>{this.replaceIds(s,t,["id"])}),r;case W.ViewportResize:return!1;case W.MediaInteraction:case W.MouseInteraction:case W.Scroll:case W.CanvasMutation:case W.Input:return this.replaceIds(r.data,t,["id"]),r;case W.StyleSheetRule:case W.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case W.Font:return r;case W.Selection:return r.data.ranges.forEach(s=>{this.replaceIds(s,t,["start","end"])}),r;case W.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(s=>{this.replaceStyleIds(s,t,["styleId"])}),r}}return!1}replace(t,r,n,s){for(let o of s)!Array.isArray(r[o])&&typeof r[o]!="number"||(Array.isArray(r[o])?r[o]=t.getIds(n,r[o]):r[o]=t.getId(n,r[o]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(t,r){t.type!==te.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}},jt=class{constructor(t){y(this,"shadowDoms",new Map),y(this,"mutationCb"),y(this,"scrollCb"),y(this,"bypassOptions"),y(this,"mirror"),y(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,r){if(!Ye(t)||this.shadowDoms.has(t))return;let n=[];this.shadowDoms.set(t,n);let s=Br({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);n.push(s),n.push(Hr({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{this.shadowDoms.get(t)===n&&(t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(M.host(t))),n.push(zr({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)))},0)}removeShadowRootsIn(t){if(this.shadowDoms.size===0)return;let r=M.shadowRoot(t);r&&(this.shadowDoms.has(r)&&this.removeShadowRoot(r),this.removeShadowRootsIn(r)),M.childNodes(t).forEach(n=>this.removeShadowRootsIn(n))}removeShadowRoot(t){let r=this.shadowDoms.get(t);this.shadowDoms.delete(t),r?.forEach(Tt)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){let n=this;this.restoreHandlers.push(xe(t.prototype,"attachShadow",function(s){return function(o){let a=s.call(this,o),c=M.shadowRoot(this);return c&&Wt(this)&&n.addShadowRoot(c,r),a}}))}reset(){this.restoreHandlers.forEach(Tt),this.restoreHandlers=[];let t=this.shadowDoms;this.shadowDoms=new Map,t.forEach(r=>r.forEach(Tt))}};function Tt(e){try{e()}catch{}}var Be="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ms=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Ve=0;Ve<Be.length;Ve++)Ms[Be.charCodeAt(Ve)]=Ve;var Ve,Is=function(e){var t=new Uint8Array(e),r,n=t.length,s="";for(r=0;r<n;r+=3)s+=Be[t[r]>>2],s+=Be[(t[r]&3)<<4|t[r+1]>>4],s+=Be[(t[r+1]&15)<<2|t[r+2]>>6],s+=Be[t[r+2]&63];return n%3===2?s=s.substring(0,s.length-1)+"=":n%3===1&&(s=s.substring(0,s.length-2)+"=="),s},gr=new Map;function ks(e,t){let r=gr.get(e);return r||(r=new Map,gr.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var jr=(e,t,r)=>{if(!e||!($r(e,t)||typeof e=="object"))return;let n=e.constructor.name,s=ks(r,n),o=s.indexOf(e);return o===-1&&(o=s.length,s.push(e)),o};function lt(e,t,r){if(e instanceof Array)return e.map(n=>lt(n,t,r));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let n=e.constructor.name,s=Is(e);return{rr_type:n,base64:s}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[lt(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:s}=e;return{rr_type:n,src:s}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",s=e.toDataURL();return{rr_type:n,src:s}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[lt(e.data,t,r),e.width,e.height]};if($r(e,t)||typeof e=="object"){let n=e.constructor.name,s=jr(e,t,r);return{rr_type:n,index:s}}}}return e}var qr=(e,t,r)=>e.map(n=>lt(n,t,r)),$r=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(s=>typeof t[s]=="function").find(s=>e instanceof t[s]);function Rs(e,t,r,n){let s=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let a of o)try{if(typeof t.CanvasRenderingContext2D.prototype[a]!="function")continue;let c=xe(t.CanvasRenderingContext2D.prototype,a,function(i){return function(...d){return de(this.canvas,r,n,!0)||setTimeout(()=>{let u=qr(d,t,this);e(this.canvas,{type:ze["2D"],property:a,args:u})},0),i.apply(this,d)}});s.push(c)}catch{let c=bt(t.CanvasRenderingContext2D.prototype,a,{set(i){e(this.canvas,{type:ze["2D"],property:a,args:[i],setter:!0})}});s.push(c)}return()=>{s.forEach(a=>a())}}function Es(e){return e==="experimental-webgl"?"webgl":e}function yr(e,t,r,n){let s=[];try{let o=xe(e.HTMLCanvasElement.prototype,"getContext",function(a){return function(c,...i){if(!de(this,t,r,!0)){let d=Es(c);if("__context"in this||(this.__context=d),n&&["webgl","webgl2"].includes(d))if(i[0]&&typeof i[0]=="object"){let u=i[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else i.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[c,...i])}});s.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(o=>o())}}function br(e,t,r,n,s,o){let a=[],c=Object.getOwnPropertyNames(e);for(let i of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(i))try{if(typeof e[i]!="function")continue;let d=xe(e,i,function(u){return function(...f){let h=u.apply(this,f);if(jr(h,o,this),"tagName"in this.canvas&&!de(this.canvas,n,s,!0)){let p=qr(f,o,this),m={type:t,property:i,args:p};r(this.canvas,m)}return h}});a.push(d)}catch{let d=bt(e,i,{set(u){r(this.canvas,{type:t,property:i,args:[u],setter:!0})}});a.push(d)}return a}function Os(e,t,r,n){let s=[];return typeof t.WebGLRenderingContext<"u"&&s.push(...br(t.WebGLRenderingContext.prototype,ze.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&s.push(...br(t.WebGL2RenderingContext.prototype,ze.WebGL2,e,r,n,t)),()=>{s.forEach(o=>o())}}var Gr=`(function() {
4
4
  "use strict";
5
5
  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
6
6
  var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
@@ -75,5 +75,5 @@ or you can use record.mirror to access the mirror instance during recording.`,lr
75
75
  };
76
76
  })();
77
77
  //# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map
78
- `,mr=typeof self<"u"&&self.Blob&&new Blob([zr],{type:"text/javascript;charset=utf-8"});function ks(e){let t;try{if(t=mr&&(self.URL||self.webkitURL).createObjectURL(mr),!t)throw"";let r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(zr),{name:e?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var Ht=class{constructor(t){y(this,"pendingCanvasMutations",new Map),y(this,"rafStamps",{latestId:0,invokeId:null}),y(this,"mirror"),y(this,"mutationCb"),y(this,"resetObservers"),y(this,"frozen",!1),y(this,"locked",!1),y(this,"processMutation",(i,d)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(i)||this.pendingCanvasMutations.set(i,[]),this.pendingCanvasMutations.get(i).push(d)});let{sampling:r="all",win:n,blockClass:s,blockSelector:o,recordCanvas:a,dataURLOptions:c}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,a&&r==="all"&&this.initCanvasMutationObserver(n,s,o),a&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,s,o,{dataURLOptions:c})}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(t,r,n,s,o){let a=hr(r,n,s,!0),c=new Map,i=new ks;i.onmessage=m=>{let{id:l}=m.data;if(c.set(l,!1),!("base64"in m.data))return;let{base64:b,type:k,width:I,height:g}=m.data;this.mutationCb({id:l,type:He["2D"],commands:[{property:"clearRect",args:[0,0,I,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:b}],type:k}]},0,0]}]})};let d=1e3/t,u=0,f,h=()=>{let m=[];return r.document.querySelectorAll("canvas").forEach(l=>{he(l,n,s,!0)||m.push(l)}),m},p=m=>{if(u&&m-u<d){f=requestAnimationFrame(p);return}u=m,h().forEach(async l=>{var b;let k=this.mirror.getId(l);if(c.get(k)||l.width===0||l.height===0)return;if(c.set(k,!0),["webgl","webgl2"].includes(l.__context)){let g=l.getContext(l.__context);((b=g?.getContextAttributes())==null?void 0:b.preserveDrawingBuffer)===!1&&g.clear(g.COLOR_BUFFER_BIT)}let I=await createImageBitmap(l);i.postMessage({id:k,bitmap:I,width:l.width,height:l.height,dataURLOptions:o.dataURLOptions},[I])}),f=requestAnimationFrame(p)};f=requestAnimationFrame(p),this.resetObservers=()=>{a(),cancelAnimationFrame(f)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let s=hr(t,r,n,!1),o=Cs(this.processMutation.bind(this),t,r,n),a=Is(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{s(),o(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;let s=n.map(a=>{let{type:c,...i}=a;return i}),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:s}),this.pendingCanvasMutations.delete(t)}},zt=class{constructor(t){y(this,"trackedLinkElements",new WeakSet),y(this,"mutationCb"),y(this,"adoptedStyleSheetCb"),y(this,"styleMirror",new At),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;let n={id:r,styleIds:[]},s=[];for(let o of t){let a;this.styleMirror.has(o)?a=this.styleMirror.getId(o):(a=this.styleMirror.add(o),s.push({styleId:a,rules:Array.from(o.rules||CSSRule,(c,i)=>({rule:Sr(c,o.href),index:i}))})),n.styleIds.push(a)}s.length>0&&(n.styles=s),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},jt=class{constructor(){y(this,"nodeMap",new WeakMap),y(this,"active",!1)}inOtherBuffer(t,r){let n=this.nodeMap.get(t);return n&&Array.from(n).some(s=>s!==r)}add(t,r){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}destroy(){}},K,at,Re,Ze=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((tr=e.contentWindow)==null?void 0:tr.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var Se=Rn();function Ne(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:s="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:c=null,maskTextClass:i="rr-mask",maskTextSelector:d=null,inlineStylesheet:u=!0,maskAllInputs:f,maskInputOptions:h,slimDOMOptions:p,maskInputFn:m,maskTextFn:l,hooks:b,packFn:k,sampling:I={},dataURLOptions:g={},mousemoveWait:w,recordDOM:E=!0,recordCanvas:_=!1,recordCrossOriginIframes:z=!1,recordAfter:O=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:V=!1,collectFonts:ne=!1,inlineImages:Z=!1,plugins:ce,keepIframeSrcFn:D=()=>!1,ignoreCSSAttributes:ve=new Set([]),errorHandler:ye}=e;ss(ye);let X=z?window.parent===window:!0,Y=!1;if(!X)try{window.parent.document&&(Y=!1)}catch{Y=!0}if(X&&!t)throw new Error("emit function is required");if(!X&&!Y)return()=>{};w!==void 0&&I.mousemove===void 0&&(I.mousemove=w),Se.reset();let se=f===!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}:h!==void 0?h:{password:!0},re=Rr(p);es();let we,Ce=0,Me=T=>{for(let de of ce||[])de.eventProcessor&&(T=de.eventProcessor(T));return k&&!Y&&(T=k(T)),T};K=(T,de)=>{let L=T;if(L.timestamp=Ye(),L.type!==P.FullSnapshot&&!(L.type===P.IncrementalSnapshot&&L.data.source===F.Mutation)){Re.unfreeze();for(let ie of Be)if(ie.isFrozen())ie.unfreeze();else break}if(X)t?.(Me(L),de);else if(Y){let ie={type:"rrweb",event:Me(L),origin:window.location.origin,isCheckout:de};window.parent.postMessage(ie,"*")}if(L.type===P.FullSnapshot)we=L,Ce=0;else if(L.type===P.IncrementalSnapshot){if(L.data.source===F.Mutation&&L.data.isAttachIframe)return;Ce++;let ie=n&&Ce>=n,fe=r&&L.timestamp-we.timestamp>r;(ie||fe)&&at(!0)}};let be=T=>{K({type:P.IncrementalSnapshot,data:{source:F.Mutation,...T}})},M=T=>K({type:P.IncrementalSnapshot,data:{source:F.Scroll,...T}}),N=T=>K({type:P.IncrementalSnapshot,data:{source:F.CanvasMutation,...T}}),R=T=>K({type:P.IncrementalSnapshot,data:{source:F.AdoptedStyleSheet,...T}}),x=new zt({mutationCb:be,adoptedStyleSheetCb:R}),$=new Ut({mirror:Se,mutationCb:be,stylesheetManager:x,recordCrossOriginIframes:z,wrappedEmit:K});for(let T of ce||[])T.getMirror&&T.getMirror({nodeMirror:Se,crossOriginIframeMirror:$.crossOriginIframeMirror,crossOriginIframeStyleMirror:$.crossOriginIframeStyleMirror});let pe=new jt;Re=new Ht({recordCanvas:_,mutationCb:N,win:window,blockClass:s,blockSelector:o,mirror:Se,sampling:I.canvas,dataURLOptions:g});let oe=new Bt({mutationCb:be,scrollCb:M,bypassOptions:{blockClass:s,blockSelector:o,maskTextClass:i,maskTextSelector:d,inlineStylesheet:u,maskInputOptions:se,dataURLOptions:g,maskTextFn:l,maskInputFn:m,recordCanvas:_,inlineImages:Z,sampling:I,slimDOMOptions:re,iframeManager:$,stylesheetManager:x,canvasManager:Re,keepIframeSrcFn:D,processedNodeManager:pe},mirror:Se});at=(T=!1)=>{if(!E)return;K({type:P.Meta,data:{href:window.location.href,width:Nr(),height:Or()}},T),x.reset(),oe.init(),Re.lock(),Be.forEach(L=>L.lock());let de=Zn(document,{mirror:Se,blockClass:s,blockSelector:o,maskTextClass:i,maskTextSelector:d,inlineStylesheet:u,maskAllInputs:se,maskTextFn:l,maskInputFn:m,slimDOM:re,dataURLOptions:g,recordCanvas:_,inlineImages:Z,onSerialize:L=>{L.nodeType===1&&(Dr(L,Se)&&$.addIframe(L),Lr(L,Se)&&x.trackLinkElement(L),Lt(L)&&oe.addShadowRoot(C.shadowRoot(L),document))},onIframeLoad:(L,ie)=>{$.attachIframe(L,ie),oe.observeAttachShadow(L)},onStylesheetLoad:(L,ie)=>{x.attachLinkElement(L,ie)},keepIframeSrcFn:D});if(!de)return console.warn("Failed to snapshot the document");K({type:P.FullSnapshot,data:{node:de,initialOffset:Er(window)}},T),Re.unlock(),Be.forEach(L=>L.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&x.adoptStyleSheets(document.adoptedStyleSheets,Se.getId(document))};try{let T=[],de=fe=>{var ue;return H(bs)({mutationCb:be,mousemoveCb:(j,je)=>K({type:P.IncrementalSnapshot,data:{source:je,positions:j}}),mouseInteractionCb:j=>K({type:P.IncrementalSnapshot,data:{source:F.MouseInteraction,...j}}),scrollCb:M,viewportResizeCb:j=>K({type:P.IncrementalSnapshot,data:{source:F.ViewportResize,...j}}),inputCb:j=>K({type:P.IncrementalSnapshot,data:{source:F.Input,...j}}),mediaInteractionCb:j=>K({type:P.IncrementalSnapshot,data:{source:F.MediaInteraction,...j}}),styleSheetRuleCb:j=>K({type:P.IncrementalSnapshot,data:{source:F.StyleSheetRule,...j}}),styleDeclarationCb:j=>K({type:P.IncrementalSnapshot,data:{source:F.StyleDeclaration,...j}}),canvasMutationCb:N,fontCb:j=>K({type:P.IncrementalSnapshot,data:{source:F.Font,...j}}),selectionCb:j=>{K({type:P.IncrementalSnapshot,data:{source:F.Selection,...j}})},customElementCb:j=>{K({type:P.IncrementalSnapshot,data:{source:F.CustomElement,...j}})},blockClass:s,ignoreClass:a,ignoreSelector:c,maskTextClass:i,maskTextSelector:d,maskInputOptions:se,inlineStylesheet:u,sampling:I,recordDOM:E,recordCanvas:_,inlineImages:Z,userTriggeredOnInput:V,collectFonts:ne,doc:fe,maskInputFn:m,maskTextFn:l,keepIframeSrcFn:D,blockSelector:o,slimDOMOptions:re,dataURLOptions:g,mirror:Se,iframeManager:$,stylesheetManager:x,shadowDomManager:oe,processedNodeManager:pe,canvasManager:Re,ignoreCSSAttributes:ve,plugins:((ue=ce?.filter(j=>j.observer))==null?void 0:ue.map(j=>({observer:j.observer,options:j.options,callback:je=>K({type:P.Plugin,data:{plugin:j.name,payload:je}})})))||[]},b)},L=new Map;$.addLoadListener(fe=>{try{let ue=fe.contentDocument;if(L.has(ue))return;L.set(ue,de(ue))}catch(ue){console.warn(ue)}}),$.addUnloadListener(fe=>{let ue=L.get(fe);ue&&(L.delete(fe),ue(),oe.removeShadowRootsIn(fe),Se.removeNodeFromMap(fe))});let ie=()=>{at(),T.push(de(document)),Ze=!0};return["interactive","complete"].includes(document.readyState)?ie():(T.push(le("DOMContentLoaded",()=>{K({type:P.DomContentLoaded,data:{}}),O==="DOMContentLoaded"&&ie()})),T.push(le("load",()=>{K({type:P.Load,data:{}}),O==="load"&&ie()},window))),()=>{[...T,...L.values()].forEach(fe=>{try{fe()}catch(ue){String(ue).toLowerCase().includes("cross-origin")||console.warn(ue)}}),L.clear(),$.destroy(),pe.destroy(),oe.reset(),Re.reset(),Ze=!1,os()}}catch(T){console.warn(T)}}Ne.addCustomEvent=(e,t)=>{if(!Ze)throw new Error("please add custom event after start recording");K({type:P.Custom,data:{tag:e,payload:t}})};Ne.addAnnotation=e=>{if(!Ze)throw new Error("please add annotation after recording started");K({type:P.Annotation,data:e})};Ne.freezePage=()=>{Re.freeze(),Be.forEach(e=>e.freeze())};Ne.takeFullSnapshot=e=>{if(!Ze)throw new Error("please take full snapshot after start recording");at(e)};Ne.mirror=Se;Ne.setMutationHook=e=>{Wt=e};var jr=(e,t)=>{let r=[],n=0,s=0,o=0,a=0,c=0,i=0,d=0,u=0,f=[],h={},p=[],m,l=[],b=[],k=w=>b.length<30&&!b.includes(w)&&b.push(w),I=w=>typeof w=="string"&&(k("u:"+w),f.length<10&&!f.includes(w)&&f.push(w)),g=()=>{r=[],n=s=a=c=i=d=u=0,f=[],h={},p=[],m=void 0,l=[],b=[]};return{raw:()=>n,n:()=>s,reset:g,add(w){let E=w.data,_=w.timestamp;if(w.type==4&&E.href)I(E.href=e.u(E.href));else if(w.type==3&&E.source==2&&E.type==2)c++;else if(w.type==5){let O=E.payload;if(E.tag=="error")O.level=="warning"?d++:i++;else if(E.tag=="sig")h[O.k]=(h[O.k]??0)+1,O.k=="vitals"&&p.push(O),O.k=="lag"&&(u=Math.max(u,O.max)),O.k=="mem"&&(m={...m,...O,used:Math.max(m?.used??0,O.used??0)});else if(E.tag=="fields")O.value=e.j(O.value);else if(E.tag=="nav"&&typeof O.to=="string")I(O.to=e.u(O.to));else if(E.tag=="network"){for(let V of["reqBody","resBody"])typeof O[V]=="string"&&(O[V]=e.t(O[V]));(O.status>=400||O.status===0)&&l.length<10&&!l.includes(O.status)&&l.push(O.status)}else if(E.tag=="breadcrumb")k(("c:"+O.cat+":"+O.msg).slice(0,100));else if(E.tag=="ws"&&typeof O.raw=="string"){if(t&&O.dir=="in"){let V=t(O.raw,_,O.id);if(V==null)return;O.raw=V}O.raw=e.t(O.raw)}}s++||(o=_),_>a&&(a=_);let z=JSON.stringify(w);n+=z.length,r.push(z)},take(w,E){w.init&&(w.init.url=e.u(w.init.url),w.init.ref=e.u(w.init.ref),w.init.user=e.j(w.init.user)),w.fields&&(w.fields.user=e.j(w.fields.user),w.fields.custom_fields=e.j(w.fields.custom_fields),w.fields.tags=e.j(w.fields.tags),new TextEncoder().encode(JSON.stringify(w.fields.tags)).length>8192&&delete w.fields.tags),E&&r.unshift(JSON.stringify({type:5,timestamp:o,data:{tag:"gap",payload:{reason:"dropped",segments:E}}}));let _=JSON.stringify({canvas_bytes:0,...w,t0:o,t1:a,enc:"gzip",n:s,urls:f,clicks:c,errs:i,warns:d,sig:h,vitals:p,mem:m,st:l,tr:b,lag:u||void 0,has_error:i>0,gap:E>0}),z=`[${r.join(",")}]`;return g(),[_,z]}}},yt,qr=e=>{if(!yt){yt=new Int32Array(256);for(let i=0;i<256;i++){let d=i;for(let u=0;u<8;u++)d=d&1?3988292384^d>>>1:d>>>1;yt[i]=d}}let t=e.length,r=Math.ceil(t/65535)||1,n=new Uint8Array(18+t+r*5),s=new DataView(n.buffer);n.set([31,139,8,0,0,0,0,0,0,255]);let o=10,a=0,c=-1;for(let i=0;i<r;i++){let d=Math.min(65535,t-a);n[o]=+(i==r-1),s.setUint16(o+1,d,!0),s.setUint16(o+3,~d,!0),n.set(e.subarray(a,a+=d),o+=5),o+=d}for(let i=0;i<t;i++)c=yt[(c^e[i])&255]^c>>>8;return s.setUint32(o,~c,!0),s.setUint32(o+4,t,!0),n},$r=(e,t)=>{let r=new TextEncoder().encode(e),n=new Uint8Array(8+r.length+t.length),s=new DataView(n.buffer);return s.setUint16(0,r.length,!0),n.set(r,2),s.setUint32(2+r.length,t.length,!0),n.set(t,6+r.length),n};var ze=(e,t,r)=>{if(!PerformanceObserver.supportedEntryTypes?.includes(e))return;let n=new PerformanceObserver(s=>{try{for(let o of s.getEntries())t(o)}catch{}});return n.observe({type:e,buffered:!0,...r}),n},Rs="a,button,summary,[role=button],[role=link],[role=tab],[role=menuitem],[role=checkbox],[role=switch],input[type=submit],input[type=button],input[type=checkbox],input[type=radio]",Es="a[target=_blank],a[download],input[type=file],[data-rp-no-dead]",Gr=e=>{let t=e.tagName.toLowerCase()+(e.id?"#"+e.id:"");for(let r of[...e.classList].slice(0,3))t+="."+r;return t},Vr=(e,t,r)=>{let n=e.o().signals??{},s=document,o=null,a=0,c=0,i=0,d=0,u=M=>{let N=M.target,R=Date.now();if(!N?.closest)return;let x=N.closest(Rs);if(n.rage!==!1){let $=x??N;$===o&&R-a<1e3?++c==3&&t("rage",{el:Gr($),id:r($),n:c},R):(o=$,a=R,c=1)}n.dead!==!1&&x&&!x.closest(Es)&&!x.disabled&&(d++,setTimeout(()=>{d--,i<R&&x.isConnected&&t("dead",{el:Gr(x),id:r(x)},R)},3e3))},f=[],h=M=>{if(M.duration<200)return;let N={ms:Math.round(M.duration)},R;for(let x of M.scripts??[])(!R||x.duration>R.duration)&&(R=x);R&&(R.sourceURL&&(N.src=e.rd.u(R.sourceURL)),R.invoker&&(N.by=e.rd.u(R.invoker).slice(0,100))),t("freeze",N,Math.round(performance.timeOrigin+M.startTime))},p="[Filtered]",m=/eyJ[\w-]{8,}\.[\w-]{8,}\.[\w-]*|[\w+/=-]{32,}/g,l=Storage.prototype,b=[l.setItem,l.removeItem,l.clear],k=0,I=0,g=0,w=n.storage!==!1,E=[],_=(M,N,R,x)=>{if(!w||R?.startsWith("rp_"))return;let $=Date.now(),pe={area:M,op:N};if($-k>1e3&&(k=$,I=0),++I>20)return void g++;R!=null&&(pe.key=R.slice(0,128)),x!=null&&(pe.v=e.rd.j({[R]:0})[R]==p?p:e.rd.t(x.slice(0,256)).replace(m,p)),g&&(pe.skipped=g),g=0,t("storage",pe,$)},z=M=>{try{return M===localStorage?"local":"session"}catch{return"session"}},O=Object.getOwnPropertyDescriptor(Document.prototype,"cookie");if(w){let M=(N,R)=>function(...x){N.apply(this,x);try{R(this,x)}catch{}};E=[l.setItem=M(b[0],(N,[R,x])=>_(z(N),"set",String(R),String(x))),l.removeItem=M(b[1],(N,[R])=>_(z(N),"remove",String(R))),l.clear=M(b[2],N=>_(z(N),"clear"))],O?.set&&Object.defineProperty(s,"cookie",{configurable:!0,get:O.get,set(N){O.set.call(this,N);try{let R=String(N),x=/expires=([^;]+)/i.exec(R);_("cookie",/max-age=(0|-)/i.test(R)||x&&Date.parse(x[1])<Date.now()?"remove":"set",R.split("=")[0].trim())}catch{}}})}let V=0,ne=0,Z=0,ce=0,D=0,ve=0,ye=0,X="",Y=new Map;try{n.freeze!==!1&&f.push(ze("long-animation-frame",h)??ze("longtask",h)),n.vitals!==!1&&f.push(ze("largest-contentful-paint",M=>V=M.startTime),ze("paint",M=>M.name=="first-contentful-paint"&&(ne=M.startTime)),ze("layout-shift",M=>{if(M.hadRecentInput)return;let N=M.startTime;(N-ve>1e3||N-D>5e3)&&(D=N,ce=0),ve=N,Z=Math.max(Z,ce+=M.value)}),ze("event",M=>{if(M.interactionId&&(Y.set(M.interactionId,Math.max(Y.get(M.interactionId)??0,M.duration)),Y.size>200)){let N=[...Y].sort((R,x)=>x[1]-R[1]).slice(0,10);ye+=Y.size-10,Y.clear();for(let[R,x]of N)Y.set(R,x)}},{durationThreshold:40}))}catch{}let se=navigator,re=M=>Math.round(M/1e5)/10,we=1,Ce=()=>{if(s.visibilityState=="hidden")return;let M=performance.memory,N={};M&&Object.assign(N,{used:re(M.usedJSHeapSize),total:re(M.totalJSHeapSize),limit:re(M.jsHeapSizeLimit)}),we&&Object.assign(N,{dm:se.deviceMemory,cores:se.hardwareConcurrency}),we=0,(N.used||N.dm)&&t("mem",N,Date.now())},Me=n.memory!==!1?[setTimeout(Ce),setInterval(Ce,3e4)]:[],be=()=>{let M=performance.getEntriesByType?.("navigation")[0];if(n.vitals===!1||!(V||ne||M))return;let N=[...Y.values()].sort((pe,oe)=>oe-pe),R=Math.round,x={lcp:R(V),fcp:R(ne),cls:Math.round(Z*1e4)/1e4,inp:R(N[Math.min(9,(N.length+ye)/50|0)]??0),url:e.rd.u(location.href)};M&&Object.assign(x,{ttfb:R(M.responseStart),dcl:R(M.domContentLoadedEventEnd),load:R(M.loadEventEnd),nav:M.type});let $=JSON.stringify(x);$!=X&&t("vitals",{...x,page:R(performance.timeOrigin)},Date.now()),X=$};return{stop(){f.forEach(M=>M?.disconnect()),Me.forEach(clearInterval),w&&(w=!1,[l.setItem,l.removeItem,l.clear].every((M,N)=>M===E[N])&&([l.setItem,l.removeItem,l.clear]=b),Object.getOwnPropertyDescriptor(s,"cookie")&&delete s.cookie)},click:u,see(M){if(!d)return;let N=M.data,R=N?.source,x=N?.tag;M.type==2||M.type==4||M.type==3&&R!=1&&R!=2&&R!=6?i=Date.now():M.type==5&&x!="sig"&&x!="console"&&x!="breadcrumb"&&x!="fields"&&x!="ws"&&(i=Math.max(i,x=="network"&&typeof N?.payload?.start=="number"?N.payload.start:Date.now()))},away(){i=Date.now(),be()}}};var De=Ne,Jr=1e4,Os="[data-rp-throttle]";function Fs(e){try{xs(e)}catch{}}var Ns=()=>{let e=new URL("./worker.js",import.meta.url).href;try{return new Worker(e)}catch{return new Worker(URL.createObjectURL(new Blob([`importScripts(${JSON.stringify(e)})`],{type:"text/javascript"})))}};function xs(e){let t=e.o(),r=t.replay,n=t.redact,s=window,o=document,a=De.mirror,c=Ns(),i=`.rr-mask,${r.maskSelector??"[data-rp-mask]"}`,d=[],u=0,f=0,h=0,p=[],m=()=>{let S=n.headers.length+n.bodyKeys.length+n.queryParams.length;return S!=f?(f=S,n):0},l=()=>{d.length&&(c.postMessage([1,d,m()]),p.push(d),d=[],u=1)},b=S=>{h||(I.see(S),d.push(S)>=300&&l())},k=S=>b({type:5,timestamp:S.ts,data:{tag:S.type,payload:S.data}}),I=Vr(e,(S,v,A)=>k({type:"sig",ts:A,data:{k:S,...v}}),S=>a.getId(S)),g={n:o,id:-1,i:0,s:!1,q:!1,e:0},w=[],E=0,_=new WeakMap,z=0,O=Symbol(),V=S=>{let v=S[O];return v&&v.g==z?v:void 0},ne=(S,v)=>S[O]=v==g?{...g,g:z}:Object.assign(v,{g:z}),Z=S=>{let v=_.get(S);if(v===void 0){let A=S.closest?.(Os);v=A&&+A.getAttribute("data-rp-throttle")||0,v&&(r.maskAllText||S.closest(i))&&(v=-v),_.set(S,v)}return v},ce=S=>{for(let v=0;v<S.length;v++)if(S[v].nodeType!=3)return!1;return!0},D=S=>{if(!S.q){S.q=!0,E++;let v=(S.i<0?-S.i:S.i)/500|0,A=S.id<0||v<2?0:S.id%v;(w[A]??=[]).push(S)}},ve=S=>{let v=null,A=0;for(let W=0;W<S.length;W++){let U=S[W],B=U.target,q=!1;if(U.type=="characterData"){let Q=V(B);if(!Q){let ae=B.parentNode,G=ae?Z(ae):0;Q=ne(B,G?{n:B,id:-2,i:G,s:!1,q:!1,e:0}:g)}Q.i&&(D(Q),q=!0)}else if(U.type=="childList"){let Q=V(B),ae=B.firstChild;if(Q?.s)ae===B.lastChild&&(!ae||ae.nodeType==3)&&(D(Q),q=!0);else if(B.nodeType==1&&Z(B)&&ae===B.lastChild&&ce(U.addedNodes)&&ce(U.removedNodes)){if(!Q){let G=U.removedNodes[0],ee=G?a.getId(G):-1;ee>0&&(Q=ne(B,{n:B,id:ee,i:Z(B),s:!0,q:!1,e:0}))}Q&&(D(Q),q=!0)}if(!q&&A<=Jr){let G=U.addedNodes;for(let ee=0;ee<G.length;ee++)A+=1+(G[ee].getElementsByTagName?.("*").length??0)}}q?v??=S.slice(0,W):v&&v.push(U)}return A>Jr?(De.takeFullSnapshot(!0),[]):v??S},ye=0,X=()=>{if(ye++,!E)return;let S=new Int32Array(E),v=0,A="",W=[],U=Date.now();for(let q=0;q<w.length;q++){let Q=w[q];if(!Q?.length)continue;let ae=[];for(let G of Q){let ee=G.i,xe=ee<0?-ee:ee,ke=xe/500|0;if(ke>1&&G.id>=0&&ye%ke!=G.id%ke||U-G.e<xe-50){ae.push(G);continue}G.q=!1,E--;let qe=G.n;if(G.id<0){let rt=a.getId(qe);if(rt<0||a.getNode(rt)!==qe)continue;if(G.id=rt,ke>1&&ye%ke!=rt%ke){D(G);continue}}else if(!qe.isConnected)continue;G.e=U;let er=(G.s?qe.textContent:qe.nodeValue)??"";A+=(v?"\0":"")+(ee<0?er.replace(/\S/g,"*"):er),S[v++]=G.id}W[q]=ae}for(let q=0;q<W.length;q++)W[q]&&(w[q]=W[q]);if(!v)return;let B=v==S.length?S:S.slice(0,v);c.postMessage([2,B,A,Date.now(),d,m()],[B.buffer]),p.push(d),d=[],u=1},Y=()=>{h||(X(),l())},se="",re=-1,we=0,Ce=0,Me=0,be=0,M=-1,N,R=navigator,x=()=>{let S=e.m(),v=S.ctx.app??{};return{url:location.href,ref:o.referrer,ua:R.userAgent,vw:s.innerWidth,vh:s.innerHeight,lang:R.language,release:t.release,env:t.environment,platform:e.platform,user:S.user,app_ver:t.appVersion??v.version,device:v.device,os_ver:v.os,wv_ver:v.webview,dbg:t.dbg,...e.clock?.(e.sess().st)}},$=S=>{if(Me)return;if(!e.en())return Ct();if(be)return;if(e.idle()){h||Yr();return}if(h&&Gt(),l(),!u)return;u=0;let v=e.sess(),A=se&&v.id!=se,W=A?re+1:(se=v.id,e.seq()),U=e.c.ws_disc,B=U>=Ce?U-Ce:U;Ce=U;let q=e.m(),Q=q.fields_version??0,ae=t.appVersion??q.ctx.app?.version,G=!we||Q!==M||ae!==N?{user:q.user??null,custom_fields:q.custom_fields??{},tags:q.tags,app_ver:ae}:void 0,ee={sid:se,seq:W,ws_disc:B,ie:e.ie(),fields:G,...we?{}:{init:x()}};S===2?fe(ee):(c.postMessage([3,ee,t.redact,!!S]),oe.push([ee,p])>4&&oe.shift()),p=[],M=Q,N=ae,re=W,we=1,A&&(se=v.id,re=-1,we=0,De.takeFullSnapshot(!0))},pe="rp_tail",oe=[],T=[],de=0,L=()=>{try{let S=T.map(v=>v[1]);de&&S.unshift(`${de}`),S.length?sessionStorage.setItem(pe,S.join("")):sessionStorage.removeItem(pe)}catch{}},ie;try{let S=indexedDB.open("replayd",1);S.onupgradeneeded=()=>{for(let v of["q","e"])S.result.createObjectStore(v,{autoIncrement:!0})},S.onsuccess=()=>ie=S.result}catch{}let fe=S=>{c.postMessage([5,1]);let v=6e4;for(let[U,B]of S?[...oe,[S,p]]:oe){let q=jr(e.rd);for(let xe of B)for(let ke of xe)q.add(ke);if(!q.n())continue;let[Q,ae]=q.take(U,0),G=`${U.sid}:${U.seq}`,ee=$r(Q,qr(new TextEncoder().encode(ae)));if(T.push([G,`${Q}\0${ae}`]),ee.length<v)v-=ee.length,e.fetch(e.url("replay"),{method:"POST",body:ee,keepalive:!0,credentials:"omit",headers:{"Content-Type":"text/plain"}}).catch(()=>{});else try{let xe=ie.transaction("q","readwrite");xe.objectStore("q").add({t:Date.now(),b:ee,s:G}),xe.commit?.()}catch{}}oe=[];let A=T.at(-1)?.[1].length??0,W=T.length-1;for(;W>0&&(A+=T[W-1][1].length)<=1e6;)W--;W>0&&(de+=W,T=T.slice(W)),L()},ue=()=>{I.away(),X(),$(2),oe.length&&!Me&&fe(),be=1},j=()=>{let S=0,v=0;T=[];try{for(let A of sessionStorage.getItem(pe)?.split("")??[]){let W=A.indexOf("\0");if(W<0)v=S+=+A||0;else{let U=A.slice(0,W),B=JSON.parse(U);T.push([`${B.sid}:${B.seq}`,A]),c.postMessage([6,U,A.slice(W+1),S]),S=0}}}catch{}de=0,v&&L()},je=S=>{oe=oe.filter(([A])=>`${A.sid}:${A.seq}`!=S);let v=T.length;T=T.filter(A=>A[0]!=S),T.length<v&&L()},Xr=S=>S.persisted&&(be=0,j(),St()),Yr=()=>{h=1,d=[],p=[],u=0,c.postMessage([5])},Gt=()=>{h=0,se=e.sess().id,re=-1,we=0,De.takeFullSnapshot(!0)},bt=()=>h&&!be&&!e.idle()&&Gt(),Vt=()=>{I.away(),Y(),$(!0)},Kr=()=>o.visibilityState=="hidden"&&Vt(),St=()=>c.postMessage([4]),Le=r.canvas,et=new Set,Zr=`.rr-block,${r.blockSelector??"[data-rp-block]"}`,Jt=Le.enabled&&Le.fps>0&&typeof OffscreenCanvas=="function"&&typeof createImageBitmap=="function",Xt=()=>{if(h||be||Me||o.visibilityState=="hidden")return;let S=Date.now(),v=[],A=(W,U)=>{for(let B of W.querySelectorAll(Le.selector))B.tagName=="CANVAS"&&v.push(B);if(U<3)for(let B of W.querySelectorAll("iframe"))try{let q=B.contentDocument;q&&A(q,U+1)}catch{}};A(o,0);for(let W of v){let U=a.getId(W);U<1||et.has(U)||!W.width||!W.height||W.closest(Zr)||(et.add(U),createImageBitmap(W).then(B=>c.postMessage([7,U,B,S,Le.maxWidth,Le.quality],[B]),()=>et.delete(U)))}},wt=[[s,"pagehide",ue],[s,"pageshow",Xr],[o,"visibilitychange",Kr],[s,"online",St],[s,"replayd:resume",St],[s,"replayd:flush",Vt],[s,"pointerdown",bt],[s,"keydown",bt],[s,"scroll",bt],[s,"click",I.click]],tt=R.connection,Yt=()=>{tt?.effectiveType&&(e.m().ctx.net=tt.effectiveType)};Yt(),tt?.addEventListener&&wt.push([tt,"change",Yt]);let Kt=[setInterval(Y,500),setInterval($,5e3)],vt=Jt?setInterval(Xt,1e3/Le.fps/(R.hardwareConcurrency<=4?.5:1)):void 0;vt&&Kt.push(vt);let Ct=()=>{Me=1,I.stop();for(let S of Kt)clearInterval(S);De.setMutationHook(null),e.sink(null),e.onError(()=>{});for(let[S,v,A]of wt)S.removeEventListener(v,A,!0);try{en?.()}catch{}c.terminate()},Mt={};try{Mt=JSON.parse(localStorage.getItem("rp_cfg")).c.ws??{}}catch{}let It=Number(Mt.staleMs??t.websocket.staleMs)||0,Zt=String(Mt.lagField??t.websocket.lagField??""),Qr=It>0||Zt?new URL("./wsx.js",import.meta.url).href:0;c.postMessage([0,new URL(e.url("replay"),location.href).href,t.redact,(t.websocket.channelOf??"centrifugo-json")=="centrifugo-json"?1:0,t.websocket.sample.perChannelPerSec,e.platform!="web"||!!t.offlineQueue,Qr,It>0?Math.min(6e5,Math.max(5e3,It)):0,Zt.slice(0,64),t.websocket.sample.maxFramesPerSec]),j(),c.onmessage=S=>{let v=S.data;if(v[0]==2)et.delete(v[1]),v[2]&&clearInterval(vt);else if(v[0]==3)je(v[1]);else if(v[0]==8)for(let[A,W,U]of v[1]){let B=A.replace(/\d{3,}|[0-9a-f]{8,}/gi,"{id}");e.w("warning","ws","StaleData",`Stale data on ${B}`,void 0,{ws:{channel:B,silent_ms:W,sampled:!!U}})}else v[0]?Ct():$()},c.onerror=Ct;for(let[S,v,A]of wt)S.addEventListener(v,A,!0);e.onError(()=>$()),De.setMutationHook(ve);let en=De({emit:S=>{if(S.type==2){_=new WeakMap,z++;for(let v of w)for(let A of v??[])A.q=!1;w=[],E=0,Jt&&setTimeout(Xt,50)}b(S)},checkoutEveryNms:6e5,sampling:{mousemove:50,mouseInteraction:!0,scroll:150,media:800,input:"last"},blockSelector:r.blockSelector??"[data-rp-block]",maskTextSelector:r.maskAllText?"*":r.maskSelector??"[data-rp-mask]",maskAllInputs:!!r.maskAllInputs,maskInputOptions:{password:!0},recordCanvas:!1,collectFonts:!1,inlineImages:!1,inlineStylesheet:!0,slimDOMOptions:"all",recordCrossOriginIframes:!1}),Qt=performance.getEntriesByType?.("navigation")[0];k({type:"nav",ts:Math.round(performance.timeOrigin),data:{to:Qt?.name||location.href,load:Qt?.type||"navigate"}});for(let S of e.drain())k(S);e.sink(k)}export{Fs as startReplay};
78
+ `,Sr=typeof self<"u"&&self.Blob&&new Blob([Gr],{type:"text/javascript;charset=utf-8"});function Ns(e){let t;try{if(t=Sr&&(self.URL||self.webkitURL).createObjectURL(Sr),!t)throw"";let r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Gr),{name:e?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var qt=class{constructor(t){y(this,"pendingCanvasMutations",new Map),y(this,"rafStamps",{latestId:0,invokeId:null}),y(this,"mirror"),y(this,"mutationCb"),y(this,"resetObservers"),y(this,"frozen",!1),y(this,"locked",!1),y(this,"processMutation",(i,d)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(i)||this.pendingCanvasMutations.set(i,[]),this.pendingCanvasMutations.get(i).push(d)});let{sampling:r="all",win:n,blockClass:s,blockSelector:o,recordCanvas:a,dataURLOptions:c}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,a&&r==="all"&&this.initCanvasMutationObserver(n,s,o),a&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,s,o,{dataURLOptions:c})}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(t,r,n,s,o){let a=yr(r,n,s,!0),c=new Map,i=new Ns;i.onmessage=m=>{let{id:l}=m.data;if(c.set(l,!1),!("base64"in m.data))return;let{base64:b,type:E,width:k,height:g}=m.data;this.mutationCb({id:l,type:ze["2D"],commands:[{property:"clearRect",args:[0,0,k,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:b}],type:E}]},0,0]}]})};let d=1e3/t,u=0,f,h=()=>{let m=[];return r.document.querySelectorAll("canvas").forEach(l=>{de(l,n,s,!0)||m.push(l)}),m},p=m=>{if(u&&m-u<d){f=requestAnimationFrame(p);return}u=m,h().forEach(async l=>{var b;let E=this.mirror.getId(l);if(c.get(E)||l.width===0||l.height===0)return;if(c.set(E,!0),["webgl","webgl2"].includes(l.__context)){let g=l.getContext(l.__context);((b=g?.getContextAttributes())==null?void 0:b.preserveDrawingBuffer)===!1&&g.clear(g.COLOR_BUFFER_BIT)}let k=await createImageBitmap(l);i.postMessage({id:E,bitmap:k,width:l.width,height:l.height,dataURLOptions:o.dataURLOptions},[k])}),f=requestAnimationFrame(p)};f=requestAnimationFrame(p),this.resetObservers=()=>{a(),cancelAnimationFrame(f)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let s=yr(t,r,n,!1),o=Rs(this.processMutation.bind(this),t,r,n),a=Os(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{s(),o(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;let s=n.map(a=>{let{type:c,...i}=a;return i}),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:s}),this.pendingCanvasMutations.delete(t)}},$t=class{constructor(t){y(this,"trackedLinkElements",new WeakSet),y(this,"mutationCb"),y(this,"adoptedStyleSheetCb"),y(this,"styleMirror",new Ft),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;let n={id:r,styleIds:[]},s=[];for(let o of t){let a;this.styleMirror.has(o)?a=this.styleMirror.getId(o):(a=this.styleMirror.add(o),s.push({styleId:a,rules:Array.from(o.rules||CSSRule,(c,i)=>({rule:Mr(c,o.href),index:i}))})),n.styleIds.push(a)}s.length>0&&(n.styles=s),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},Gt=class{constructor(){y(this,"nodeMap",new WeakMap),y(this,"active",!1)}inOtherBuffer(t,r){let n=this.nodeMap.get(t);return n&&Array.from(n).some(s=>s!==r)}add(t,r){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}destroy(){}},K,ct,Ie,et=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((or=e.contentWindow)==null?void 0:or.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var ye=xn();function Ee(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:s="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:c=null,maskTextClass:i="rr-mask",maskTextSelector:d=null,inlineStylesheet:u=!0,maskAllInputs:f,maskInputOptions:h,slimDOMOptions:p,maskInputFn:m,maskTextFn:l,hooks:b,packFn:E,sampling:k={},dataURLOptions:g={},mousemoveWait:w,recordDOM:N=!0,recordCanvas:_=!1,recordCrossOriginIframes:j=!1,recordAfter:x=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:V=!1,collectFonts:re=!1,inlineImages:Z=!1,plugins:oe,keepIframeSrcFn:L=()=>!1,ignoreCSSAttributes:be=new Set([]),errorHandler:pe}=e;ls(pe);let Y=j?window.parent===window:!0,ne=!1;if(!Y)try{window.parent.document&&(ne=!1)}catch{ne=!0}if(Y&&!t)throw new Error("emit function is required");if(!Y&&!ne)return()=>{};w!==void 0&&k.mousemove===void 0&&(k.mousemove=w),ye.reset();let me=f===!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}:h!==void 0?h:{password:!0},J=xr(p);ss();let Se,fe=0,ve=O=>{for(let H of oe||[])H.eventProcessor&&(O=H.eventProcessor(O));return E&&!ne&&(O=E(O)),O};K=(O,H)=>{let D=O;if(D.timestamp=Ze(),D.type!==F.FullSnapshot&&!(D.type===F.IncrementalSnapshot&&D.data.source===W.Mutation)){Ie.unfreeze();for(let se of He)if(se.isFrozen())se.unfreeze();else break}if(Y)t?.(ve(D),H);else if(ne){let se={type:"rrweb",event:ve(D),origin:window.location.origin,isCheckout:H};window.parent.postMessage(se,"*")}if(D.type===F.FullSnapshot)Se=D,fe=0;else if(D.type===F.IncrementalSnapshot){if(D.data.source===W.Mutation&&D.data.isAttachIframe)return;fe++;let se=n&&fe>=n,ce=r&&D.timestamp-Se.timestamp>r;(se||ce)&&ct(!0)}};let ge=O=>{K({type:F.IncrementalSnapshot,data:{source:W.Mutation,...O}})},we=O=>K({type:F.IncrementalSnapshot,data:{source:W.Scroll,...O}}),Oe=O=>K({type:F.IncrementalSnapshot,data:{source:W.CanvasMutation,...O}}),De=O=>K({type:F.IncrementalSnapshot,data:{source:W.AdoptedStyleSheet,...O}}),C=new $t({mutationCb:ge,adoptedStyleSheetCb:De}),R=new zt({mirror:ye,mutationCb:ge,stylesheetManager:C,recordCrossOriginIframes:j,wrappedEmit:K});for(let O of oe||[])O.getMirror&&O.getMirror({nodeMirror:ye,crossOriginIframeMirror:R.crossOriginIframeMirror,crossOriginIframeStyleMirror:R.crossOriginIframeStyleMirror});let I=new Gt;Ie=new qt({recordCanvas:_,mutationCb:Oe,win:window,blockClass:s,blockSelector:o,mirror:ye,sampling:k.canvas,dataURLOptions:g});let T=new jt({mutationCb:ge,scrollCb:we,bypassOptions:{blockClass:s,blockSelector:o,maskTextClass:i,maskTextSelector:d,inlineStylesheet:u,maskInputOptions:me,dataURLOptions:g,maskTextFn:l,maskInputFn:m,recordCanvas:_,inlineImages:Z,sampling:k,slimDOMOptions:J,iframeManager:R,stylesheetManager:C,canvasManager:Ie,keepIframeSrcFn:L,processedNodeManager:I},mirror:ye});ct=(O=!1)=>{if(!N)return;K({type:F.Meta,data:{href:window.location.href,width:Lr(),height:Dr()}},O),C.reset(),T.init(),Ie.lock(),He.forEach(D=>D.lock());let H=rs(document,{mirror:ye,blockClass:s,blockSelector:o,maskTextClass:i,maskTextSelector:d,inlineStylesheet:u,maskAllInputs:me,maskTextFn:l,maskInputFn:m,slimDOM:J,dataURLOptions:g,recordCanvas:_,inlineImages:Z,onSerialize:D=>{D.nodeType===1&&(Pr(D,ye)&&R.addIframe(D),Fr(D,ye)&&C.trackLinkElement(D),Pt(D)&&T.addShadowRoot(M.shadowRoot(D),document))},onIframeLoad:(D,se)=>{R.attachIframe(D,se),T.observeAttachShadow(D)},onStylesheetLoad:(D,se)=>{C.attachLinkElement(D,se)},keepIframeSrcFn:L});if(!H)return console.warn("Failed to snapshot the document");K({type:F.FullSnapshot,data:{node:H,initialOffset:Tr(window)}},O),Ie.unlock(),He.forEach(D=>D.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&C.adoptStyleSheets(document.adoptedStyleSheets,ye.getId(document))};try{let O=[],H=ce=>{var ie;return U(Cs)({mutationCb:ge,mousemoveCb:($,Le)=>K({type:F.IncrementalSnapshot,data:{source:Le,positions:$}}),mouseInteractionCb:$=>K({type:F.IncrementalSnapshot,data:{source:W.MouseInteraction,...$}}),scrollCb:we,viewportResizeCb:$=>K({type:F.IncrementalSnapshot,data:{source:W.ViewportResize,...$}}),inputCb:$=>K({type:F.IncrementalSnapshot,data:{source:W.Input,...$}}),mediaInteractionCb:$=>K({type:F.IncrementalSnapshot,data:{source:W.MediaInteraction,...$}}),styleSheetRuleCb:$=>K({type:F.IncrementalSnapshot,data:{source:W.StyleSheetRule,...$}}),styleDeclarationCb:$=>K({type:F.IncrementalSnapshot,data:{source:W.StyleDeclaration,...$}}),canvasMutationCb:Oe,fontCb:$=>K({type:F.IncrementalSnapshot,data:{source:W.Font,...$}}),selectionCb:$=>{K({type:F.IncrementalSnapshot,data:{source:W.Selection,...$}})},customElementCb:$=>{K({type:F.IncrementalSnapshot,data:{source:W.CustomElement,...$}})},blockClass:s,ignoreClass:a,ignoreSelector:c,maskTextClass:i,maskTextSelector:d,maskInputOptions:me,inlineStylesheet:u,sampling:k,recordDOM:N,recordCanvas:_,inlineImages:Z,userTriggeredOnInput:V,collectFonts:re,doc:ce,maskInputFn:m,maskTextFn:l,keepIframeSrcFn:L,blockSelector:o,slimDOMOptions:J,dataURLOptions:g,mirror:ye,iframeManager:R,stylesheetManager:C,shadowDomManager:T,processedNodeManager:I,canvasManager:Ie,ignoreCSSAttributes:be,plugins:((ie=oe?.filter($=>$.observer))==null?void 0:ie.map($=>({observer:$.observer,options:$.options,callback:Le=>K({type:F.Plugin,data:{plugin:$.name,payload:Le}})})))||[]},b)},D=new Map;R.addLoadListener(ce=>{try{let ie=ce.contentDocument;if(D.has(ie))return;D.set(ie,H(ie))}catch(ie){console.warn(ie)}}),R.addUnloadListener(ce=>{let ie=D.get(ce);ie&&(D.delete(ce),ie(),T.removeShadowRootsIn(ce),ye.removeNodeFromMap(ce))});let se=()=>{ct(),O.push(H(document)),et=!0};return["interactive","complete"].includes(document.readyState)?se():(O.push(le("DOMContentLoaded",()=>{K({type:F.DomContentLoaded,data:{}}),x==="DOMContentLoaded"&&se()})),O.push(le("load",()=>{K({type:F.Load,data:{}}),x==="load"&&se()},window))),()=>{[...O,...D.values()].forEach(ce=>{try{ce()}catch(ie){String(ie).toLowerCase().includes("cross-origin")||console.warn(ie)}}),D.clear(),R.destroy(),I.destroy(),T.reset(),Ie.reset(),et=!1,cs()}}catch(O){console.warn(O)}}Ee.addCustomEvent=(e,t)=>{if(!et)throw new Error("please add custom event after start recording");K({type:F.Custom,data:{tag:e,payload:t}})};Ee.addAnnotation=e=>{if(!et)throw new Error("please add annotation after recording started");K({type:F.Annotation,data:e})};Ee.freezePage=()=>{Ie.freeze(),He.forEach(e=>e.freeze())};Ee.takeFullSnapshot=e=>{if(!et)throw new Error("please take full snapshot after start recording");ct(e)};Ee.mirror=ye;Ee.setMutationHook=e=>{Ht=e};var Vr=(e,t)=>{let r=[],n=0,s=0,o=0,a=0,c=0,i=0,d=0,u=0,f=[],h={},p=[],m,l=[],b=[],E=w=>b.length<30&&!b.includes(w)&&b.push(w),k=w=>typeof w=="string"&&(E("u:"+w),f.length<10&&!f.includes(w)&&f.push(w)),g=()=>{r=[],n=s=a=c=i=d=u=0,f=[],h={},p=[],m=void 0,l=[],b=[]};return{raw:()=>n,n:()=>s,reset:g,add(w){let N=w.data,_=w.timestamp;if(w.type==4&&N.href)k(N.href=e.u(N.href));else if(w.type==3&&N.source==2&&N.type==2)c++;else if(w.type==5){let x=N.payload;if(N.tag=="error")x.level=="warning"?d++:i++;else if(N.tag=="sig")h[x.k]=(h[x.k]??0)+1,x.k=="vitals"&&p.push(x),x.k=="lag"&&(u=Math.max(u,x.max)),x.k=="mem"&&(m={...m,...x,used:Math.max(m?.used??0,x.used??0)});else if(N.tag=="fields")x.value=e.j(x.value);else if(N.tag=="nav"&&typeof x.to=="string")k(x.to=e.u(x.to));else if(N.tag=="network"){for(let V of["reqBody","resBody"])typeof x[V]=="string"&&(x[V]=e.t(x[V]));(x.status>=400||x.status===0)&&l.length<10&&!l.includes(x.status)&&l.push(x.status)}else if(N.tag=="breadcrumb")E(("c:"+x.cat+":"+x.msg).slice(0,100));else if(N.tag=="ws"&&typeof x.raw=="string"){if(t&&x.dir=="in"){let V=t(x.raw,_,x.id);if(V==null)return;x.raw=V}x.raw=e.t(x.raw)}}s++||(o=_),_>a&&(a=_);let j=JSON.stringify(w);n+=j.length,r.push(j)},take(w,N){w.init&&(w.init.url=e.u(w.init.url),w.init.ref=e.u(w.init.ref),w.init.user=e.j(w.init.user)),w.fields&&(w.fields.user=e.j(w.fields.user),w.fields.custom_fields=e.j(w.fields.custom_fields),w.fields.tags=e.j(w.fields.tags),new TextEncoder().encode(JSON.stringify(w.fields.tags)).length>8192&&delete w.fields.tags),N&&r.unshift(JSON.stringify({type:5,timestamp:o,data:{tag:"gap",payload:{reason:"dropped",segments:N}}}));let _=JSON.stringify({canvas_bytes:0,...w,t0:o,t1:a,enc:"gzip",n:s,urls:f,clicks:c,errs:i,warns:d,sig:h,vitals:p,mem:m,st:l,tr:b,lag:u||void 0,has_error:i>0,gap:N>0}),j=`[${r.join(",")}]`;return g(),[_,j]}}},St,Jr=e=>{if(!St){St=new Int32Array(256);for(let i=0;i<256;i++){let d=i;for(let u=0;u<8;u++)d=d&1?3988292384^d>>>1:d>>>1;St[i]=d}}let t=e.length,r=Math.ceil(t/65535)||1,n=new Uint8Array(18+t+r*5),s=new DataView(n.buffer);n.set([31,139,8,0,0,0,0,0,0,255]);let o=10,a=0,c=-1;for(let i=0;i<r;i++){let d=Math.min(65535,t-a);n[o]=+(i==r-1),s.setUint16(o+1,d,!0),s.setUint16(o+3,~d,!0),n.set(e.subarray(a,a+=d),o+=5),o+=d}for(let i=0;i<t;i++)c=St[(c^e[i])&255]^c>>>8;return s.setUint32(o,~c,!0),s.setUint32(o+4,t,!0),n},Xr=(e,t)=>{let r=new TextEncoder().encode(e),n=new Uint8Array(8+r.length+t.length),s=new DataView(n.buffer);return s.setUint16(0,r.length,!0),n.set(r,2),s.setUint32(2+r.length,t.length,!0),n.set(t,6+r.length),n};var je=(e,t,r)=>{if(!PerformanceObserver.supportedEntryTypes?.includes(e))return;let n=new PerformanceObserver(s=>{try{for(let o of s.getEntries())t(o)}catch{}});return n.observe({type:e,buffered:!0,...r}),n},xs="a,button,summary,[role=button],[role=link],[role=tab],[role=menuitem],[role=checkbox],[role=switch],input[type=submit],input[type=button],input[type=checkbox],input[type=radio]",Ts="a[target=_blank],a[download],input[type=file],[data-rp-no-dead]",Yr=e=>{let t=e.tagName.toLowerCase()+(e.id?"#"+e.id:"");for(let r of[...e.classList].slice(0,3))t+="."+r;return t},Kr=(e,t,r)=>{let n=e.o().signals??{},s=document,o=null,a=0,c=0,i=0,d=new Set,u=C=>{let R=C.target,I=Date.now();if(!R?.closest)return;let T=R.closest(xs);if(n.rage!==!1){let O=T??R;O===o&&I-a<1e3?++c==3&&t("rage",{el:Yr(O),id:r(O),n:c},I):(o=O,a=I,c=1)}if(n.dead!==!1&&T&&d.size<32&&!T.closest(Ts)&&!T.disabled){let O=setTimeout(()=>{d.delete(O),i<I&&T.isConnected&&t("dead",{el:Yr(T),id:r(T)},I)},3e3);d.add(O)}};n.dead!==!1&&(e.go.f=()=>d.size&&(i=Date.now()));let f=[],h=C=>{if(C.duration<200)return;let R={ms:Math.round(C.duration)},I;for(let T of C.scripts??[])(!I||T.duration>I.duration)&&(I=T);I&&(I.sourceURL&&(R.src=e.rd.u(I.sourceURL)),I.invoker&&(R.by=e.rd.u(I.invoker).slice(0,100))),t("freeze",R,Math.round(performance.timeOrigin+C.startTime))},p="[Filtered]",m=/eyJ[\w-]{8,}\.[\w-]{8,}\.[\w-]*|[\w+/=-]{32,}/g,l=Storage.prototype,b=[l.setItem,l.removeItem,l.clear],E=0,k=0,g=0,w=n.storage!==!1,N=[],_=(C,R,I,T)=>{if(!w||I?.startsWith("rp_"))return;let O=Date.now(),H={area:C,op:R};if(O-E>1e3&&(E=O,k=0),++k>20)return void g++;I!=null&&(H.key=I.slice(0,128)),T!=null&&(H.v=e.rd.j({[I]:0})[I]==p?p:e.rd.t(T.slice(0,256)).replace(m,p)),g&&(H.skipped=g),g=0,t("storage",H,O)},j=C=>{try{return C===localStorage?"local":"session"}catch{return"session"}},x=Object.getOwnPropertyDescriptor(s,"cookie"),V=x??Object.getOwnPropertyDescriptor(Document.prototype,"cookie"),re;if(w){let C=(R,I)=>function(...T){R.apply(this,T);try{I(this,T)}catch{}};N=[l.setItem=C(b[0],(R,[I,T])=>_(j(R),"set",String(I),String(T))),l.removeItem=C(b[1],(R,[I])=>_(j(R),"remove",String(I))),l.clear=C(b[2],R=>_(j(R),"clear"))],V?.set&&(!x||x.configurable)&&Object.defineProperty(s,"cookie",re={...V,set(R){V.set.call(this,R);try{let I=String(R),T=/expires=([^;]+)/i.exec(I);_("cookie",/max-age=(0|-)/i.test(I)||T&&Date.parse(T[1])<Date.now()?"remove":"set",I.split("=")[0].trim())}catch{}}})}let Z=0,oe=0,L=0,be=0,pe=0,Y=-1e4,ne=0,me="",J=new Map;try{n.freeze!==!1&&f.push(je("long-animation-frame",h)??je("longtask",h)),n.vitals!==!1&&f.push(je("largest-contentful-paint",C=>Z=C.startTime),je("paint",C=>C.name=="first-contentful-paint"&&(oe=C.startTime)),je("layout-shift",C=>{if(C.hadRecentInput)return;let R=C.startTime;(R-Y>1e3||R-pe>5e3)&&(pe=R,be=0),Y=R,L=Math.max(L,be+=C.value)}),je("event",C=>{if(C.interactionId&&(J.set(C.interactionId,Math.max(J.get(C.interactionId)??0,C.duration)),J.size>200)){let R=[...J].sort((I,T)=>T[1]-I[1]).slice(0,10);ne+=J.size-10,J.clear();for(let[I,T]of R)J.set(I,T)}},{durationThreshold:40}))}catch{}let Se=navigator,fe=C=>Math.round(C/1e5)/10,ve=1,ge=()=>{if(s.visibilityState=="hidden")return;let C=performance.memory,R={};C&&Object.assign(R,{used:fe(C.usedJSHeapSize),total:fe(C.totalJSHeapSize),limit:fe(C.jsHeapSizeLimit)}),ve&&Object.assign(R,{dm:Se.deviceMemory,cores:Se.hardwareConcurrency}),ve=0,(R.used||R.dm)&&t("mem",R,Date.now())},we=n.memory!==!1?[setTimeout(ge),setInterval(ge,3e4)]:[],Oe=location.href,De=()=>{let C=performance.getEntriesByType?.("navigation")[0];if(n.vitals===!1||!(Z||oe||C))return;let R=[...J.values()].sort((H,D)=>D-H),I=Math.round,T={lcp:I(Z),fcp:I(oe),cls:Math.round(L*1e4)/1e4,inp:I(R[Math.min(9,(R.length+ne)/50|0)]??0),url:e.rd.u(C?.name||Oe)};C&&Object.assign(T,{ttfb:I(C.responseStart),dcl:I(C.domContentLoadedEventEnd),load:I(C.loadEventEnd),nav:C.type});let O=JSON.stringify(T);O!=me&&t("vitals",{...T,page:I(performance.timeOrigin)},Date.now()),me=O};return{stop(){if(f.forEach(C=>C?.disconnect()),we.forEach(clearInterval),d.forEach(clearTimeout),d.clear(),e.go.f=null,w){w=!1,[l.setItem,l.removeItem,l.clear].every((R,I)=>R===N[I])&&([l.setItem,l.removeItem,l.clear]=b);let C=re&&Object.getOwnPropertyDescriptor(s,"cookie");C&&C.get===re.get&&C.set===re.set&&(x?Object.defineProperty(s,"cookie",x):delete s.cookie)}},click:u,see(C){if(!d.size)return;let R=C.data,I=R?.source,T=R?.tag;C.type==2||C.type==4||C.type==3&&I!=1&&I!=2&&I!=6?i=Date.now():C.type==5&&T!="sig"&&T!="console"&&T!="breadcrumb"&&T!="fields"&&T!="ws"&&(i=Math.max(i,T=="network"&&typeof R?.payload?.start=="number"?R.payload.start:Date.now()))},away(){i=Date.now(),De()}}};var Te=Ee,Zr=1e4,Ds="[data-rp-throttle]";function Hs(e){try{As(e)}catch{}}var Ls=()=>{let e=new URL("./worker.js",import.meta.url).href;try{return new Worker(e)}catch{return new Worker(URL.createObjectURL(new Blob([`importScripts(${JSON.stringify(e)})`],{type:"text/javascript"})))}};function As(e){let t=e.o(),r=t.replay,n=t.redact,s=window,o=document,a=Te.mirror,c=Ls(),i=`.rr-mask,${r.maskSelector??"[data-rp-mask]"}`,d=[],u=0,f=0,h=0,p=[],m=()=>{let S=n.headers.length+n.bodyKeys.length+n.queryParams.length;return S!=f?(f=S,n):0},l=()=>{d.length&&(c.postMessage([1,d,m()]),p.push(d),d=[],u=1)},b=S=>{h||(k.see(S),d.push(S)>=300&&l())},E=S=>b({type:5,timestamp:S.ts,data:{tag:S.type,payload:S.data}}),k=Kr(e,(S,v,A)=>E({type:"sig",ts:A,data:{k:S,...v}}),S=>a.getId(S)),g={n:o,id:-1,i:0,s:!1,q:!1,e:0},w=[],N=0,_=new WeakMap,j=0,x=Symbol(),V=S=>{let v=S[x];return v&&v.g==j?v:void 0},re=(S,v)=>S[x]=v==g?{...g,g:j}:Object.assign(v,{g:j}),Z=S=>{let v=_.get(S);if(v===void 0){let A=S.closest?.(Ds);v=A&&+A.getAttribute("data-rp-throttle")||0,v&&(r.maskAllText||S.closest(i))&&(v=-v),_.set(S,v)}return v},oe=S=>{for(let v=0;v<S.length;v++)if(S[v].nodeType!=3)return!1;return!0},L=S=>{if(!S.q){S.q=!0,N++;let v=(S.i<0?-S.i:S.i)/500|0,A=S.id<0||v<2?0:S.id%v;(w[A]??=[]).push(S)}},be=S=>{let v=null,A=0;for(let P=0;P<S.length;P++){let B=S[P],z=B.target,q=!1;if(B.type=="characterData"){let Q=V(z);if(!Q){let ae=z.parentNode,G=ae?Z(ae):0;Q=re(z,G?{n:z,id:-2,i:G,s:!1,q:!1,e:0}:g)}Q.i&&(L(Q),q=!0)}else if(B.type=="childList"){let Q=V(z),ae=z.firstChild;if(Q?.s)ae===z.lastChild&&(!ae||ae.nodeType==3)&&(L(Q),q=!0);else if(z.nodeType==1&&Z(z)&&ae===z.lastChild&&oe(B.addedNodes)&&oe(B.removedNodes)){if(!Q){let G=B.removedNodes[0],ee=G?a.getId(G):-1;ee>0&&(Q=re(z,{n:z,id:ee,i:Z(z),s:!0,q:!1,e:0}))}Q&&(L(Q),q=!0)}if(!q&&A<=Zr){let G=B.addedNodes;for(let ee=0;ee<G.length;ee++)A+=1+(G[ee].getElementsByTagName?.("*").length??0)}}q?v??=S.slice(0,P):v&&v.push(B)}return A>Zr?(Te.takeFullSnapshot(!0),[]):v??S},pe=0,Y=()=>{if(pe++,!N)return;let S=new Int32Array(N),v=0,A="",P=[],B=Date.now();for(let q=0;q<w.length;q++){let Q=w[q];if(!Q?.length)continue;let ae=[];for(let G of Q){let ee=G.i,Ne=ee<0?-ee:ee,Me=Ne/500|0;if(Me>1&&G.id>=0&&pe%Me!=G.id%Me||B-G.e<Ne-50){ae.push(G);continue}G.q=!1,N--;let Ge=G.n;if(G.id<0){let st=a.getId(Ge);if(st<0||a.getNode(st)!==Ge)continue;if(G.id=st,Me>1&&pe%Me!=st%Me){L(G);continue}}else if(!Ge.isConnected)continue;G.e=B;let sr=(G.s?Ge.textContent:Ge.nodeValue)??"";A+=(v?"\0":"")+(ee<0?sr.replace(/\S/g,"*"):sr),S[v++]=G.id}P[q]=ae}for(let q=0;q<P.length;q++)P[q]&&(w[q]=P[q]);if(!v)return;let z=v==S.length?S:S.slice(0,v);c.postMessage([2,z,A,Date.now(),d,m()],[z.buffer]),p.push(d),d=[],u=1},ne=()=>{h||(Y(),l())},me=e.sess().smp!=1,J="",Se=-1,fe=0,ve=0,ge=0,we=0,Oe=-1,De,C=navigator,R=()=>{let S=e.m(),v=S.ctx.app??{};return{url:location.href,ref:o.referrer,ua:C.userAgent,vw:s.innerWidth,vh:s.innerHeight,lang:C.language,release:t.release,env:t.environment,platform:e.platform,user:S.user,app_ver:t.appVersion??v.version,device:v.device,os_ver:v.os,wv_ver:v.webview,dbg:+e.d(),...e.clock?.(e.sess().st)}},I=S=>{if(ge)return;if(!e.en()||me&&!e.d())return kt();if(we)return;if(e.idle()){h||tn();return}if(h&&Xt(),l(),!u)return;u=0;let v=e.sess(),A=J&&v.id!=J,P=A?Se+1:(J=v.id,e.seq()),B=e.c.ws_disc,z=B>=ve?B-ve:B;ve=B;let q=e.m(),Q=q.fields_version??0,ae=t.appVersion??q.ctx.app?.version,G=!fe||Q!==Oe||ae!==De?{user:q.user??null,custom_fields:q.custom_fields??{},tags:q.tags,app_ver:ae}:void 0,ee={sid:J,seq:P,ws_disc:z,ie:e.ie(),fields:G,...fe?{}:{init:R()}};S===2?ie(ee):(c.postMessage([3,ee,t.redact,!!S]),O.push([ee,p])>4&&O.shift()),p=[],Oe=Q,De=ae,Se=P,fe=1,A&&(J=v.id,Se=-1,fe=0,Te.takeFullSnapshot(!0))},T="rp_tail",O=[],H=[],D=0,se=()=>{try{let S=H.map(v=>v[1]);D&&S.unshift(`${D}`),S.length?sessionStorage.setItem(T,S.join("")):sessionStorage.removeItem(T)}catch{}},ce;try{let S=indexedDB.open("replayd",1);S.onupgradeneeded=()=>{for(let v of["q","e"])S.result.createObjectStore(v,{autoIncrement:!0})},S.onsuccess=()=>ce=S.result}catch{}let ie=S=>{c.postMessage([5,1]);let v=6e4;for(let[B,z]of S?[...O,[S,p]]:O){let q=Vr(e.rd);for(let Ne of z)for(let Me of Ne)q.add(Me);if(!q.n())continue;let[Q,ae]=q.take(B,0),G=`${B.sid}:${B.seq}`,ee=Xr(Q,Jr(new TextEncoder().encode(ae)));if(H.push([G,`${Q}\0${ae}`]),ee.length<v)v-=ee.length,e.fetch(e.url("replay"),{method:"POST",body:ee,keepalive:!0,credentials:"omit",headers:{"Content-Type":"text/plain"}}).catch(()=>{});else try{let Ne=ce.transaction("q","readwrite");Ne.objectStore("q").add({t:Date.now(),b:ee,s:G}),Ne.commit?.()}catch{}}O=[];let A=H.at(-1)?.[1].length??0,P=H.length-1;for(;P>0&&(A+=H[P-1][1].length)<=1e6;)P--;P>0&&(D+=P,H=H.slice(P)),se()},$=()=>{k.away(),Y(),I(2),O.length&&!ge&&ie(),we=1},Le=()=>{let S=0,v=0;H=[];try{for(let A of sessionStorage.getItem(T)?.split("")??[]){let P=A.indexOf("\0");if(P<0)v=S+=+A||0;else{let B=A.slice(0,P),z=JSON.parse(B);H.push([`${z.sid}:${z.seq}`,A]),c.postMessage([6,B,A.slice(P+1),S]),S=0}}}catch{}D=0,v&&se()},Qr=S=>{O=O.filter(([A])=>`${A.sid}:${A.seq}`!=S);let v=H.length;H=H.filter(A=>A[0]!=S),H.length<v&&se()},en=S=>S.persisted&&(we=0,Le(),vt()),rt=()=>c.postMessage([9,h||o.visibilityState=="hidden"?1:0]),tn=()=>{h=1,d=[],p=[],u=0,c.postMessage([5]),rt()},Xt=()=>{h=0,rt(),J=e.sess().id,Se=-1,fe=0,Te.takeFullSnapshot(!0)},wt=()=>h&&!we&&!e.idle()&&Xt(),Yt=()=>{k.away(),ne(),I(!0)},rn=()=>(rt(),o.visibilityState=="hidden"&&Yt()),vt=()=>c.postMessage([4]),Ae={enabled:!0,fps:.2,maxWidth:960,quality:.35,selector:"canvas",...r.canvas},qe=new Set,$e=[],nn=`.rr-block,${r.blockSelector??"[data-rp-block]"}`,Kt=Ae.enabled&&Ae.fps>0&&typeof OffscreenCanvas=="function"&&typeof createImageBitmap=="function",Ct=()=>{for(;qe.size-$e.length<2&&$e.length;){let[S,v,A]=$e.shift();createImageBitmap(v).then(P=>c.postMessage([7,S,P,A,Ae.maxWidth,Ae.quality],[P]),()=>(qe.delete(S),Ct()))}},Zt=()=>{if(h||we||ge||o.visibilityState=="hidden")return;let S=Date.now(),v=[],A=(P,B)=>{for(let z of P.querySelectorAll(Ae.selector))z.tagName=="CANVAS"&&v.push(z);if(B<3)for(let z of P.querySelectorAll("iframe"))try{let q=z.contentDocument;q&&A(q,B+1)}catch{}};A(o,0);for(let P of v){let B=a.getId(P);B<1||qe.has(B)||!P.width||!P.height||P.closest(nn)||(qe.add(B),$e.push([B,P,S]))}Ct()},Mt=[[s,"pagehide",$],[s,"pageshow",en],[o,"visibilitychange",rn],[s,"online",vt],[s,"replayd:resume",vt],[s,"replayd:flush",Yt],[s,"pointerdown",wt],[s,"keydown",wt],[s,"scroll",wt],[s,"click",k.click]],nt=C.connection,Qt=()=>{nt?.effectiveType&&(e.m().ctx.net=nt.effectiveType)};Qt(),nt?.addEventListener&&Mt.push([nt,"change",Qt]);let er=[setInterval(ne,500),setInterval(I,5e3)],It=Kt?setInterval(Zt,1e3/Ae.fps/(C.hardwareConcurrency<=4?.5:1)):void 0;It&&er.push(It);let kt=()=>{ge=1,k.stop();for(let S of er)clearInterval(S);Te.setMutationHook(null),e.sink(null),e.onError(()=>{});for(let[S,v,A]of Mt)S.removeEventListener(v,A,!0);try{sn?.()}catch{}c.terminate()},Rt={};try{Rt=JSON.parse(localStorage.getItem("rp_cfg"+e.url(""))).c.ws??{}}catch{}let Et=Number(Rt.staleMs??t.websocket.staleMs)||0,tr=String(Rt.lagField??t.websocket.lagField??""),rr=Et>0||tr?new URL("./wsx.js",import.meta.url).href:0;c.postMessage([0,new URL(e.url("replay"),location.href).href,t.redact,(t.websocket.channelOf??"centrifugo-json")=="centrifugo-json"?1:0,t.websocket.sample.perChannelPerSec,e.platform!="web"||!!t.offlineQueue,rr,Et>0?Math.min(6e5,Math.max(5e3,Et)):0,tr.slice(0,64),t.websocket.sample.maxFramesPerSec]),rr&&rt(),Le(),c.onmessage=S=>{let v=S.data;if(v[0]==2)qe.delete(v[1]),v[2]&&(clearInterval(It),$e.length=0),Ct();else if(v[0]==3)Qr(v[1]);else if(v[0]==8){v[2]&&(u=1);for(let[A,P,B]of v[1]){let z=A.replace(/\d{3,}|[0-9a-f]{8,}/gi,"{id}");e.w("warning","ws","StaleData",`Stale data on ${z}`,void 0,{ws:{channel:z,silent_ms:P,sampled:!!B}})}}else v[0]?kt():I()},c.onerror=kt;for(let[S,v,A]of Mt)S.addEventListener(v,A,!0);e.onError(()=>I()),Te.setMutationHook(be);let sn=Te({emit:S=>{if(S.type==2){_=new WeakMap,j++;for(let v of w)for(let A of v??[])A.q=!1;w=[],N=0,Kt&&setTimeout(Zt,50)}b(S)},checkoutEveryNms:6e5,sampling:{mousemove:50,mouseInteraction:!0,scroll:150,media:800,input:"last"},blockSelector:r.blockSelector??"[data-rp-block]",maskTextSelector:r.maskAllText?"*":r.maskSelector??"[data-rp-mask]",maskAllInputs:!!r.maskAllInputs,maskInputOptions:{password:!0},recordCanvas:!1,collectFonts:!1,inlineImages:!1,inlineStylesheet:!0,slimDOMOptions:"all",recordCrossOriginIframes:!1}),nr=performance.getEntriesByType?.("navigation")[0];E({type:"nav",ts:Math.round(performance.timeOrigin),data:{to:nr?.name||location.href,load:nr?.type||"navigate"}});for(let S of e.drain())E(S);e.sink(E)}export{Hs as startReplay};
79
79
  //# sourceMappingURL=replay.js.map