@replayd/core 0.1.10 → 0.1.12

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