@replayd/core 0.1.2 → 0.1.4

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