UNPKG

@sentry-internal/rrweb

Version:
5 lines 54.1 kB
(function (g, f) {if ("object" == typeof exports && "object" == typeof module) {module.exports = f();} else if ("function" == typeof define && define.amd) {define("rrweb", [], f);} else if ("object" == typeof exports) {exports["rrweb"] = f();} else {g["rrweb"] = f();}}(typeof self !== 'undefined' ? self : typeof globalThis !== 'undefined' ? globalThis : this, () => {var exports = {};var module = { exports }; "use strict";var Ht=Object.defineProperty,zt=(e,t,r)=>t in e?Ht(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,V=(e,t,r)=>zt(e,typeof t!="symbol"?t+"":t,r),C=(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))(C||{});function et(e){return e.nodeType===e.ELEMENT_NODE}function Le(e){return e?.host?.shadowRoot===e}function fe(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Gt(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 $t(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 pe(e){try{let t=e.rules||e.cssRules;return t?Gt(Array.from(t,tt).join("")):null}catch{return null}}function jt(e){let t="";for(let r=0;r<e.style.length;r++){let n=e.style,o=n[r],s=n.getPropertyPriority(o);t+=`${o}:${n.getPropertyValue(o)}${s?" !important":""};`}return`${e.selectorText} { ${t} }`}function tt(e){let t;if(qt(e))try{t=pe(e.styleSheet)||$t(e)}catch{}else if(Xt(e)){let r=e.cssText,n=e.selectorText.includes(":"),o=typeof e.style.all=="string"&&e.style.all;if(o&&(r=jt(e)),n&&(r=Vt(r)),n||o)return r}return t||e.cssText}function Vt(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function qt(e){return"styleSheet"in e}function Xt(e){return"selectorText"in e}var ie=class{constructor(){V(this,"idNodeMap",new Map),V(this,"nodeMetaMap",new WeakMap)}getId(t){return t?this.getMeta(t)?.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(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 o=this.nodeMetaMap.get(n);o&&this.nodeMetaMap.set(r,o)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Yt(){return new ie}function De({maskInputOptions:e,tagName:t,type:r}){return t==="OPTION"&&(t="SELECT"),!!(e[t.toLowerCase()]||r&&e[r]||r==="password"||t==="INPUT"&&!r&&e.text)}function Ae({isMasked:e,element:t,value:r,maskInputFn:n}){let o=r||"";return e?(n&&(o=n(o,t)),"*".repeat(o.length)):o}function be(e){return e.toLowerCase()}function ke(e){return e.toUpperCase()}var Ge="__rrweb_original__";function Jt(e){let t=e.getContext("2d");if(!t)return!0;let r=50;for(let n=0;n<e.width;n+=r)for(let o=0;o<e.height;o+=r){let s=t.getImageData,i=Ge in s?s[Ge]:s;if(new Uint32Array(i.call(t,n,o,Math.min(r,e.width-n),Math.min(r,e.height-o)).data.buffer).some(a=>a!==0))return!1}return!0}function Kt(e,t){return!e||!t||e.type!==t.type?!1:e.type===C.Document?e.compatMode===t.compatMode:e.type===C.DocumentType?e.name===t.name&&e.publicId===t.publicId&&e.systemId===t.systemId:e.type===C.Comment||e.type===C.Text||e.type===C.CDATA?e.textContent===t.textContent:e.type===C.Element?e.tagName===t.tagName&&JSON.stringify(e.attributes)===JSON.stringify(t.attributes)&&e.isSVG===t.isSVG&&e.needBlock===t.needBlock:!1}function rt(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?be(t):null}function nt(e,t,r){return t==="INPUT"&&(r==="radio"||r==="checkbox")?e.getAttribute("value")||"":e.value}function ve(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i;return r.pathname.match(n)?.[1]??null}var $e={};function ot(e){let t=$e[e];if(t)return t;let r=window.document,n=window[e];if(r&&typeof r.createElement=="function")try{let o=r.createElement("iframe");o.hidden=!0,r.head.appendChild(o);let s=o.contentWindow;s&&s[e]&&(n=s[e]),r.head.removeChild(o)}catch{}return $e[e]=n.bind(window)}function Te(...e){return ot("setTimeout")(...e)}function st(...e){return ot("clearTimeout")(...e)}function it(e){try{return e.contentDocument}catch{}}function Qt(e){try{return e.contentWindow}catch{}}var Zt=1,er=new RegExp("[^a-z0-9-_:]"),me=-2;function at(){return Zt++}function tr(e){if(e instanceof HTMLFormElement)return"form";let t=be(e.tagName);return er.test(t)?"div":t}function rr(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var Y,je,nr=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,or=/^(?:[a-z+]+:)?\/\//i,sr=/^www\..*/i,ir=/^(data:)([^,]*),(.*)/i;function ar(e,t){if(!e||t.size===0)return e;try{let r=e.split(";"),n=[];for(let o of r){if(o=o.trim(),!o)continue;let s=o.indexOf(":");if(s===-1){n.push(o);continue}let i=o.slice(0,s).trim();t.has(i)||n.push(o)}return n.join("; ")+(n.length>0&&e.endsWith(";")?";":"")}catch(r){return console.warn("Error filtering CSS properties:",r),e}}function ge(e,t){return(e||"").replace(nr,(r,n,o,s,i,c)=>{let a=o||i||c,l=n||s||"";if(!a)return r;if(or.test(a)||sr.test(a))return`url(${l}${a}${l})`;if(ir.test(a))return`url(${l}${a}${l})`;if(a[0]==="/")return`url(${l}${rr(t)+a}${l})`;let d=t.split("/"),y=a.split("/");d.pop();for(let h of y)h!=="."&&(h===".."?d.pop():d.push(h));return`url(${l}${d.join("/")}${l})`})}var cr=/^[^ \t\n\r\u000c]+/,lr=/^[, \t\n\r\u000c]+/;function ur(e,t){if(t.trim()==="")return t;let r=0;function n(s){let i,c=s.exec(t.substring(r));return c?(i=c[0],r+=i.length,i):""}let o=[];for(;n(lr),!(r>=t.length);){let s=n(cr);if(s.slice(-1)===",")s=K(e,s.substring(0,s.length-1)),o.push(s);else{let i="";s=K(e,s);let c=!1;for(;;){let a=t.charAt(r);if(a===""){o.push((s+i).trim());break}else if(c)a===")"&&(c=!1);else if(a===","){r+=1,o.push((s+i).trim());break}else a==="("&&(c=!0);i+=a,r+=1}}}return o.join(", ")}var Ve=new WeakMap;function K(e,t){return!t||t.trim()===""?t:Ce(e,t)}function fr(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function Ce(e,t){let r=Ve.get(e);if(r||(r=e.createElement("a"),Ve.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function ct(e,t,r,n,o,s,i){if(!n)return n;if(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#"))return K(e,n);if(r==="xlink:href"&&n[0]!=="#")return K(e,n);if(r==="background"&&(t==="table"||t==="td"||t==="th"))return K(e,n);if(r==="srcset")return ur(e,n);if(r==="style"){let c=ge(n,Ce(e));return i&&i.size>0&&(c=ar(c,i)),c}else if(t==="object"&&r==="data")return K(e,n);return typeof s=="function"?s(r,n,o):n}function lt(e,t,r){return(e==="video"||e==="audio")&&t==="autoplay"}function dr(e,t,r,n){try{if(n&&e.matches(n))return!1;if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let o=e.classList.length;o--;){let s=e.classList[o];if(t.test(s))return!0}if(r)return e.matches(r)}catch{}return!1}function hr(e,t){for(let r=e.classList.length;r--;){let n=e.classList[r];if(t.test(n))return!0}return!1}function q(e,t,r=1/0,n=0){return!e||e.nodeType!==e.ELEMENT_NODE||n>r?-1:t(e)?n:q(e.parentNode,t,r,n+1)}function Q(e,t){return r=>{let n=r;if(n===null)return!1;try{if(e){if(typeof e=="string"){if(n.matches(`.${e}`))return!0}else if(hr(n,e))return!0}return!!(t&&n.matches(t))}catch{return!1}}}function ye(e,t,r,n,o,s){try{let i=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(i===null)return!1;if(i.tagName==="INPUT"){let l=i.getAttribute("autocomplete");if(["current-password","new-password","cc-number","cc-exp","cc-exp-month","cc-exp-year","cc-csc"].includes(l))return!0}let c=-1,a=-1;if(s){if(a=q(i,Q(n,o)),a<0)return!0;c=q(i,Q(t,r),a>=0?a:1/0)}else{if(c=q(i,Q(t,r)),c<0)return!1;a=q(i,Q(n,o),c>=0?c:1/0)}return c>=0?a>=0?c<=a:!0:a>=0?!1:!!s}catch{}return!!s}function pr(e,t,r){let n=Qt(e);if(!n)return;let o=!1,s;try{s=n.document.readyState}catch{return}if(s!=="complete"){let c=Te(()=>{o||(t(),o=!0)},r);e.addEventListener("load",()=>{st(c),o=!0,t()});return}let i="about:blank";if(n.location.href!==i||e.src===i||e.src==="")return Te(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function mr(e,t,r){let n=!1,o;try{o=e.sheet}catch{o=null}if(o)return;let s=Te(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{st(s),n=!0,t()})}function gr(e,t){let{doc:r,mirror:n,blockClass:o,blockSelector:s,unblockSelector:i,maskAllText:c,maskAttributeFn:a,maskTextClass:l,unmaskTextClass:d,maskTextSelector:y,unmaskTextSelector:h,inlineStylesheet:T,maskInputOptions:p={},maskTextFn:x,maskInputFn:w,dataURLOptions:A={},inlineImages:L,recordCanvas:R,keepIframeSrcFn:I,newlyAddedElement:_=!1,ignoreCSSAttributes:N}=t,b=yr(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:C.Document,childNodes:[],compatMode:e.compatMode}:{type:C.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:C.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:b};case e.ELEMENT_NODE:return br(e,{doc:r,blockClass:o,blockSelector:s,unblockSelector:i,inlineStylesheet:T,maskAttributeFn:a,maskInputOptions:p,maskInputFn:w,dataURLOptions:A,inlineImages:L,recordCanvas:R,keepIframeSrcFn:I,newlyAddedElement:_,rootId:b,maskTextClass:l,unmaskTextClass:d,maskTextSelector:y,unmaskTextSelector:h,ignoreCSSAttributes:N});case e.TEXT_NODE:return wr(e,{doc:r,maskAllText:c,maskTextClass:l,unmaskTextClass:d,maskTextSelector:y,unmaskTextSelector:h,maskTextFn:x,maskInputOptions:p,maskInputFn:w,rootId:b});case e.CDATA_SECTION_NODE:return{type:C.CDATA,textContent:"",rootId:b};case e.COMMENT_NODE:return{type:C.Comment,textContent:e.textContent||"",rootId:b};default:return!1}}function yr(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function wr(e,t){let{maskAllText:r,maskTextClass:n,unmaskTextClass:o,maskTextSelector:s,unmaskTextSelector:i,maskTextFn:c,maskInputOptions:a,maskInputFn:l,rootId:d}=t,y=e.parentNode&&e.parentNode.tagName,h=e.textContent,T=y==="STYLE"?!0:void 0,p=y==="SCRIPT"?!0:void 0,x=y==="TEXTAREA"?!0:void 0;if(T&&h){try{e.nextSibling||e.previousSibling||e.parentNode.sheet?.cssRules&&(h=pe(e.parentNode.sheet))}catch(A){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${A}`,e)}h=ge(h,Ce(t.doc))}p&&(h="SCRIPT_PLACEHOLDER");let w=ye(e,n,s,o,i,r);if(!T&&!p&&!x&&h&&w&&(h=c?c(h,e.parentElement):h.replace(/[\S]/g,"*")),x&&h&&(a.textarea||w)&&(h=l?l(h,e.parentNode):h.replace(/[\S]/g,"*")),y==="OPTION"&&h){let A=De({type:null,tagName:y,maskInputOptions:a});h=Ae({isMasked:ye(e,n,s,o,i,A),element:e,value:h,maskInputFn:l})}return{type:C.Text,textContent:h||"",isStyle:T,rootId:d}}function br(e,t){let{doc:r,blockClass:n,blockSelector:o,unblockSelector:s,inlineStylesheet:i,maskInputOptions:c={},maskAttributeFn:a,maskInputFn:l,dataURLOptions:d={},inlineImages:y,recordCanvas:h,keepIframeSrcFn:T,newlyAddedElement:p=!1,rootId:x,maskTextClass:w,unmaskTextClass:A,maskTextSelector:L,unmaskTextSelector:R,ignoreCSSAttributes:I}=t,_=dr(e,n,o,s),N=tr(e),b={},P=e.attributes.length;for(let g=0;g<P;g++){let k=e.attributes[g];k.name&&!lt(N,k.name,k.value)&&(b[k.name]=ct(r,N,be(k.name),k.value,e,a,I))}if(N==="link"&&i){let g=Array.from(r.styleSheets).find(D=>D.href===e.href),k=null;g&&(k=pe(g)),k&&(b.rel=null,b.href=null,b.crossorigin=null,b._cssText=ge(k,g.href))}if(N==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){let g=pe(e.sheet);g&&(b._cssText=ge(g,Ce(r)))}if(N==="input"||N==="textarea"||N==="select"||N==="option"){let g=e,k=rt(g),D=nt(g,ke(N),k),O=g.checked;if(k!=="submit"&&k!=="button"&&D){let W=ye(g,w,L,A,R,De({type:k,tagName:ke(N),maskInputOptions:c}));b.value=Ae({isMasked:W,element:g,value:D,maskInputFn:l})}O&&(b.checked=O)}if(N==="option"&&(e.selected&&!c.select?b.selected=!0:delete b.selected),N==="canvas"&&h){if(e.__context==="2d")Jt(e)||(b.rr_dataURL=e.toDataURL(d.type,d.quality));else if(!("__context"in e)){let g=e.toDataURL(d.type,d.quality),k=r.createElement("canvas");k.width=e.width,k.height=e.height;let D=k.toDataURL(d.type,d.quality);g!==D&&(b.rr_dataURL=g)}}if(N==="img"&&y){Y||(Y=r.createElement("canvas"),je=Y.getContext("2d"));let g=e,k=g.currentSrc||g.getAttribute("src")||"<unknown-src>",D=g.crossOrigin,O=()=>{g.removeEventListener("load",O);try{Y.width=g.naturalWidth,Y.height=g.naturalHeight,je.drawImage(g,0,0),b.rr_dataURL=Y.toDataURL(d.type,d.quality)}catch(W){if(g.crossOrigin!=="anonymous"){g.crossOrigin="anonymous",g.complete&&g.naturalWidth!==0?O():g.addEventListener("load",O);return}else console.warn(`Cannot inline img src=${k}! Error: ${W}`)}g.crossOrigin==="anonymous"&&(D?b.crossOrigin=D:g.removeAttribute("crossorigin"))};g.complete&&g.naturalWidth!==0?O():g.addEventListener("load",O)}if((N==="audio"||N==="video")&&(b.rr_mediaState=e.paused?"paused":"played",b.rr_mediaCurrentTime=e.currentTime),p||(e.scrollLeft&&(b.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(b.rr_scrollTop=e.scrollTop)),_){let{width:g,height:k}=e.getBoundingClientRect();b={class:b.class,rr_width:`${g}px`,rr_height:`${k}px`}}N==="iframe"&&!T(b.src)&&(!_&&!it(e)&&(b.rr_src=b.src),delete b.src);let F;try{customElements.get(N)&&(F=!0)}catch{}return{type:C.Element,tagName:N,attributes:b,childNodes:[],isSVG:fr(e)||void 0,needBlock:_,rootId:x,isCustom:F}}function E(e){return e==null?"":e.toLowerCase()}function Cr(e,t){if(t.comment&&e.type===C.Comment)return!0;if(e.type===C.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&ve(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(E(e.attributes.name).match(/^msapplication-tile(image|color)$/)||E(e.attributes.name)==="application-name"||E(e.attributes.rel)==="icon"||E(e.attributes.rel)==="apple-touch-icon"||E(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&E(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(E(e.attributes.property).match(/^(og|twitter|fb):/)||E(e.attributes.name).match(/^(og|twitter):/)||E(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(E(e.attributes.name)==="robots"||E(e.attributes.name)==="googlebot"||E(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(E(e.attributes.name)==="author"||E(e.attributes.name)==="generator"||E(e.attributes.name)==="framework"||E(e.attributes.name)==="publisher"||E(e.attributes.name)==="progid"||E(e.attributes.property).match(/^article:/)||E(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(E(e.attributes.name)==="google-site-verification"||E(e.attributes.name)==="yandex-verification"||E(e.attributes.name)==="csrf-token"||E(e.attributes.name)==="p:domain_verify"||E(e.attributes.name)==="verify-v1"||E(e.attributes.name)==="verification"||E(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Z(e,t){let{doc:r,mirror:n,blockClass:o,blockSelector:s,unblockSelector:i,maskAllText:c,maskTextClass:a,unmaskTextClass:l,maskTextSelector:d,unmaskTextSelector:y,skipChild:h=!1,inlineStylesheet:T=!0,maskInputOptions:p={},maskAttributeFn:x,maskTextFn:w,maskInputFn:A,slimDOMOptions:L,dataURLOptions:R={},inlineImages:I=!1,recordCanvas:_=!1,onSerialize:N,onIframeLoad:b,iframeLoadTimeout:P=5e3,onBlockedImageLoad:F,onStylesheetLoad:g,stylesheetLoadTimeout:k=5e3,keepIframeSrcFn:D=()=>!1,newlyAddedElement:O=!1,ignoreCSSAttributes:W}=t,{preserveWhiteSpace:$=!0}=t,G=gr(e,{doc:r,mirror:n,blockClass:o,blockSelector:s,maskAllText:c,unblockSelector:i,maskTextClass:a,unmaskTextClass:l,maskTextSelector:d,unmaskTextSelector:y,inlineStylesheet:T,maskInputOptions:p,maskAttributeFn:x,maskTextFn:w,maskInputFn:A,dataURLOptions:R,inlineImages:I,recordCanvas:_,keepIframeSrcFn:D,newlyAddedElement:O,ignoreCSSAttributes:W});if(!G)return console.warn(e,"not serialized"),null;let B;n.hasNode(e)?B=n.getId(e):Cr(G,L)||!$&&G.type===C.Text&&!G.isStyle&&!G.textContent.trim().length?B=me:B=at();let M=Object.assign(G,{id:B});if(n.add(e,M),B===me)return null;N&&N(e);let re=!h;if(M.type===C.Element){re=re&&!M.needBlock;let f=e.shadowRoot;f&&fe(f)&&(M.isShadowHost=!0)}if((M.type===C.Document||M.type===C.Element)&&re){L.headWhitespace&&M.type===C.Element&&M.tagName==="head"&&($=!1);let f={doc:r,mirror:n,blockClass:o,blockSelector:s,maskAllText:c,unblockSelector:i,maskTextClass:a,unmaskTextClass:l,maskTextSelector:d,unmaskTextSelector:y,skipChild:h,inlineStylesheet:T,maskInputOptions:p,maskAttributeFn:x,maskTextFn:w,maskInputFn:A,slimDOMOptions:L,dataURLOptions:R,inlineImages:I,recordCanvas:_,preserveWhiteSpace:$,onSerialize:N,onIframeLoad:b,iframeLoadTimeout:P,onBlockedImageLoad:F,onStylesheetLoad:g,stylesheetLoadTimeout:k,keepIframeSrcFn:D,ignoreCSSAttributes:W},u=e.childNodes?Array.from(e.childNodes):[];for(let m of u){let S=Z(m,f);S&&M.childNodes.push(S)}if(et(e)&&e.shadowRoot)for(let m of Array.from(e.shadowRoot.childNodes)){let S=Z(m,f);S&&(fe(e.shadowRoot)&&(S.isShadow=!0),M.childNodes.push(S))}}if(e.parentNode&&Le(e.parentNode)&&fe(e.parentNode)&&(M.isShadow=!0),M.type===C.Element&&M.tagName==="iframe"&&!M.needBlock&&pr(e,()=>{let f=it(e);if(f&&b){let u=Z(f,{doc:f,mirror:n,blockClass:o,blockSelector:s,unblockSelector:i,maskAllText:c,maskTextClass:a,unmaskTextClass:l,maskTextSelector:d,unmaskTextSelector:y,skipChild:!1,inlineStylesheet:T,maskInputOptions:p,maskAttributeFn:x,maskTextFn:w,maskInputFn:A,slimDOMOptions:L,dataURLOptions:R,inlineImages:I,recordCanvas:_,preserveWhiteSpace:$,onSerialize:N,onIframeLoad:b,iframeLoadTimeout:P,onStylesheetLoad:g,stylesheetLoadTimeout:k,keepIframeSrcFn:D,ignoreCSSAttributes:W});u&&b(e,u)}},P),M.type===C.Element&&M.tagName==="img"&&!e.complete&&M.needBlock){let f=e,u=()=>{if(f.isConnected&&!f.complete&&F)try{let m=f.getBoundingClientRect();m.width>0&&m.height>0&&F(f,M,m)}catch{}f.removeEventListener("load",u)};f.isConnected&&f.addEventListener("load",u)}return M.type===C.Element&&M.tagName==="link"&&typeof M.attributes.rel=="string"&&(M.attributes.rel==="stylesheet"||M.attributes.rel==="preload"&&typeof M.attributes.href=="string"&&ve(M.attributes.href)==="css")&&mr(e,()=>{if(g){let f=Z(e,{doc:r,mirror:n,blockClass:o,blockSelector:s,unblockSelector:i,maskAllText:c,maskTextClass:a,unmaskTextClass:l,maskTextSelector:d,unmaskTextSelector:y,skipChild:!1,inlineStylesheet:T,maskInputOptions:p,maskAttributeFn:x,maskTextFn:w,maskInputFn:A,slimDOMOptions:L,dataURLOptions:R,inlineImages:I,recordCanvas:_,preserveWhiteSpace:$,onSerialize:N,onIframeLoad:b,iframeLoadTimeout:P,onStylesheetLoad:g,stylesheetLoadTimeout:k,keepIframeSrcFn:D,ignoreCSSAttributes:W});f&&g(e,f)}},k),M.type===C.Element&&delete M.needBlock,M}function Sr(e,t){let{mirror:r=new ie,blockClass:n="rr-block",blockSelector:o=null,unblockSelector:s=null,maskAllText:i=!1,maskTextClass:c="rr-mask",unmaskTextClass:a=null,maskTextSelector:l=null,unmaskTextSelector:d=null,inlineStylesheet:y=!0,inlineImages:h=!1,recordCanvas:T=!1,maskAllInputs:p=!1,maskAttributeFn:x,maskTextFn:w,maskInputFn:A,slimDOM:L=!1,dataURLOptions:R,preserveWhiteSpace:I,onSerialize:_,onIframeLoad:N,iframeLoadTimeout:b,onBlockedImageLoad:P,onStylesheetLoad:F,stylesheetLoadTimeout:g,keepIframeSrcFn:k=()=>!1,ignoreCSSAttributes:D=new Set([])}=t||{};return Z(e,{doc:e,mirror:r,blockClass:n,blockSelector:o,unblockSelector:s,maskAllText:i,maskTextClass:c,unmaskTextClass:a,maskTextSelector:l,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:y,maskInputOptions:p===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0}:p===!1?{}:p,maskAttributeFn:x,maskTextFn:w,maskInputFn:A,slimDOMOptions:L===!0||L==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:L==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:L===!1?{}:L,dataURLOptions:R,inlineImages:h,recordCanvas:T,preserveWhiteSpace:I,onSerialize:_,onIframeLoad:N,iframeLoadTimeout:b,onBlockedImageLoad:P,onStylesheetLoad:F,stylesheetLoadTimeout:g,keepIframeSrcFn:k,newlyAddedElement:!1,ignoreCSSAttributes:D})}var qe=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function kr(e,t={}){let r=1,n=1;function o(f){let u=f.match(/\n/g);u&&(r+=u.length);let m=f.lastIndexOf(` `);n=m===-1?n+f.length:f.length-m}function s(){let f={line:r,column:n};return u=>(u.position=new c(f),x(),u)}let i=class ut{constructor(u){V(this,"content"),V(this,"start"),V(this,"end"),V(this,"source"),this.start=u,this.end={line:r,column:n},this.source=t.source,this.content=ut.content}};V(i,"content");let c=i;c.content=e;let a=[];function l(f){let u=new Error(`${t.source||""}:${r}:${n}: ${f}`);if(u.reason=f,u.filename=t.source,u.line=r,u.column=n,u.source=e,t.silent)a.push(u);else throw u}function d(){let f=T();return{type:"stylesheet",stylesheet:{source:t.source,rules:f,parsingErrors:a}}}function y(){return p(/^{\s*/)}function h(){return p(/^}/)}function T(){let f,u=[];for(x(),w(u);e.length&&e.charAt(0)!=="}"&&(f=M()||re());)f&&(u.push(f),w(u));return u}function p(f){let u=f.exec(e);if(!u)return;let m=u[0];return o(m),e=e.slice(m.length),u}function x(){p(/^\s*/)}function w(f=[]){let u;for(;u=A();)u&&f.push(u),u=A();return f}function A(){let f=s();if(e.charAt(0)!=="/"||e.charAt(1)!=="*")return;let u=2;for(;e.charAt(u)!==""&&(e.charAt(u)!=="*"||e.charAt(u+1)!=="/");)++u;if(u+=2,e.charAt(u-1)==="")return l("End of comment missing");let m=e.slice(2,u-2);return n+=2,o(m),e=e.slice(u),n+=2,f({type:"comment",comment:m})}function L(){let f=p(/^([^{]+)/);if(!f)return;let u=H(f[0]).replace(/\/\*[\s\S]*?\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,j=>j.replace(/,/g,"\u200C")).split(/\s*(?![^(]*\)),\s*/);if(u.length<=1)return u.map(j=>j.replace(/\u200C/g,","));let m=0,S=0,v=u.length,U=[];for(;m<v;){let j=(u[m].match(/\(/g)||[]).length,Ut=(u[m].match(/\)/g)||[]).length,Se=j-Ut;if(Se>=1){let He=!1;for(S=m+1;S<v;){let ue=(u[S].match(/\(/g)||[]).length,ze=(u[S].match(/\)/g)||[]).length-ue;if(ze===Se){U.push(u.slice(m,S+1).join(",")),m=S+1,He=!0;break}S++,Se-=ze}if(He)continue;u.slice(m,v).forEach(ue=>ue&&U.push(ue));break}u[m]&&U.push(u[m]),m++}return U.map(j=>j.replace(/\u200C/g,","))}function R(){let f=s(),u=p(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(!u)return;let m=H(u[0]);if(!p(/^:\s*/))return l("property missing ':'");let S=p(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),v=f({type:"declaration",property:m.replace(qe,""),value:S?H(S[0]).replace(qe,""):""});return p(/^[;\s]*/),v}function I(){let f=[];if(!y())return l("missing '{'");w(f);let u;for(;u=R();)u!==!1&&(f.push(u),w(f)),u=R();return h()?f:l("missing '}'")}function _(){let f,u=[],m=s();for(;f=p(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)u.push(f[1]),p(/^,\s*/);if(u.length)return m({type:"keyframe",values:u,declarations:I()})}function N(){let f=s(),u=p(/^@([-\w]+)?keyframes\s*/);if(!u)return;let m=u[1];if(u=p(/^([-\w]+)\s*/),!u)return l("@keyframes missing name");let S=u[1];if(!y())return l("@keyframes missing '{'");let v,U=w();for(;v=_();)U.push(v),U=U.concat(w());return h()?f({type:"keyframes",name:S,vendor:m,keyframes:U}):l("@keyframes missing '}'")}function b(){let f=s(),u=p(/^@supports *([^{]+)/);if(!u)return;let m=H(u[1]);if(!y())return l("@supports missing '{'");let S=w().concat(T());return h()?f({type:"supports",supports:m,rules:S}):l("@supports missing '}'")}function P(){let f=s();if(!p(/^@host\s*/))return;if(!y())return l("@host missing '{'");let m=w().concat(T());return h()?f({type:"host",rules:m}):l("@host missing '}'")}function F(){let f=s(),u=p(/^@media *([^{]+)/);if(!u)return;let m=H(u[1]);if(!y())return l("@media missing '{'");let S=w().concat(T());return h()?f({type:"media",media:m,rules:S}):l("@media missing '}'")}function g(){let f=s(),u=p(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(u)return f({type:"custom-media",name:H(u[1]),media:H(u[2])})}function k(){let f=s();if(!p(/^@page */))return;let m=L()||[];if(!y())return l("@page missing '{'");let S=w(),v;for(;v=R();)S.push(v),S=S.concat(w());return h()?f({type:"page",selectors:m,declarations:S}):l("@page missing '}'")}function D(){let f=s(),u=p(/^@([-\w]+)?document *([^{]+)/);if(!u)return;let m=H(u[1]),S=H(u[2]);if(!y())return l("@document missing '{'");let v=w().concat(T());return h()?f({type:"document",document:S,vendor:m,rules:v}):l("@document missing '}'")}function O(){let f=s();if(!p(/^@font-face\s*/))return;if(!y())return l("@font-face missing '{'");let m=w(),S;for(;S=R();)m.push(S),m=m.concat(w());return h()?f({type:"font-face",declarations:m}):l("@font-face missing '}'")}let W=B("import"),$=B("charset"),G=B("namespace");function B(f){let u=new RegExp("^@"+f+"\\s*((?:"+[/[^\\]"(?:\\"|[^"])*"/.source,/[^\\]'(?:\\'|[^'])*'/.source,"[^;]"].join("|")+")+);");return()=>{let m=s(),S=p(u);if(!S)return;let v={type:f};return v[f]=S[1].trim(),m(v)}}function M(){if(e[0]==="@")return N()||F()||g()||b()||W()||$()||G()||D()||k()||P()||O()}function re(){let f=s(),u=L();return u?(w(),f({type:"rule",selectors:u,declarations:I()})):l("selector missing")}return Ne(d())}function H(e){return e?e.replace(/^\s+|\s+$/g,""):""}function Ne(e,t){let r=e&&typeof e.type=="string",n=r?e:t;for(let o of Object.keys(e)){let s=e[o];Array.isArray(s)?s.forEach(i=>{Ne(i,n)}):s&&typeof s=="object"&&Ne(s,n)}return r&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var Xe={script:"noscript",altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};function Tr(e){let t=Xe[e.tagName]?Xe[e.tagName]:e.tagName;return t==="link"&&e.attributes._cssText&&(t="style"),t}function Nr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var ft=/([^\\]):hover/,Mr=new RegExp(ft.source,"g");function Ye(e,t){let r=t?.stylesWithHoverClass.get(e);if(r)return r;if(e.length>=1e6)return e;let n=kr(e,{silent:!0});if(!n.stylesheet)return e;let o=[];if(n.stylesheet.rules.forEach(c=>{"selectors"in c&&(c.selectors||[]).forEach(a=>{ft.test(a)&&o.push(a)})}),o.length===0)return e;let s=new RegExp(o.filter((c,a)=>o.indexOf(c)===a).sort((c,a)=>a.length-c.length).map(c=>Nr(c)).join("|"),"g"),i=e.replace(s,c=>{let a=c.replace(Mr,"$1.\\:hover");return`${c}, ${a}`});return t?.stylesWithHoverClass.set(e,i),i}function Er(){return{stylesWithHoverClass:new Map}}function xr(e,t){let{doc:r,hackCss:n,cache:o}=t;switch(e.type){case C.Document:return r.implementation.createDocument(null,"",null);case C.DocumentType:return r.implementation.createDocumentType(e.name||"html",e.publicId,e.systemId);case C.Element:{let s=Tr(e),i;if(e.isSVG)i=r.createElementNS("http://www.w3.org/2000/svg",s);else{if(e.isCustom&&r.defaultView?.customElements&&!r.defaultView.customElements.get(e.tagName))try{r.defaultView.customElements.define(e.tagName,class extends r.defaultView.HTMLElement{})}catch(a){console.warn("Cannot define custom element",a)}i=r.createElement(s)}let c={};for(let a in e.attributes){if(!Object.prototype.hasOwnProperty.call(e.attributes,a))continue;let l=e.attributes[a];if(s==="option"&&a==="selected"&&l===!1||l===null)continue;if(l===!0&&(l=""),a.startsWith("rr_")){c[a]=l;continue}let d=s==="textarea"&&a==="value",y=s==="style"&&a==="_cssText";if(y&&n&&typeof l=="string"&&(l=Ye(l,o)),(d||y)&&typeof l=="string"){let h=r.createTextNode(l);for(let T of Array.from(i.childNodes))T.nodeType===i.TEXT_NODE&&i.removeChild(T);i.appendChild(h);continue}try{if(e.isSVG&&a==="xlink:href")i.setAttributeNS("http://www.w3.org/1999/xlink",a,l.toString());else if(a==="onload"||a==="onclick"||a.substring(0,7)==="onmouse")i.setAttribute("_"+a,l.toString());else if(s==="meta"&&e.attributes["http-equiv"]==="Content-Security-Policy"&&a==="content"){i.setAttribute("csp-content",l.toString());continue}else s==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")||s==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&ve(e.attributes.href)==="js"||(s==="img"&&e.attributes.srcset&&e.attributes.rr_dataURL?i.setAttribute("rrweb-original-srcset",e.attributes.srcset):i.setAttribute(a,l.toString()))}catch{}}for(let a in c){let l=c[a];if(s==="canvas"&&a==="rr_dataURL"){let d=r.createElement("img");d.onload=()=>{let y=i.getContext("2d");y&&y.drawImage(d,0,0,d.width,d.height)},d.src=l.toString(),i.RRNodeType&&(i.rr_dataURL=l.toString())}else if(s==="img"&&a==="rr_dataURL"){let d=i;d.currentSrc.startsWith("data:")||(d.setAttribute("rrweb-original-src",e.attributes.src),d.src=l.toString())}if(a==="rr_width")i.style.setProperty("width",l.toString());else if(a==="rr_height")i.style.setProperty("height",l.toString());else if(a==="rr_mediaCurrentTime"&&typeof l=="number")i.currentTime=l;else if(a==="rr_mediaState")switch(l){case"played":i.play().catch(d=>console.warn("media playback error",d));break;case"paused":i.pause();break}}if(e.isShadowHost)if(!i.shadowRoot)i.attachShadow({mode:"open"});else for(;i.shadowRoot.firstChild;)i.shadowRoot.removeChild(i.shadowRoot.firstChild);return i}case C.Text:return r.createTextNode(e.isStyle&&n?Ye(e.textContent,o):e.textContent);case C.CDATA:return r instanceof XMLDocument?r.createCDATASection(e.textContent):null;case C.Comment:return r.createComment(e.textContent);default:return null}}function Re(e,t){let{doc:r,mirror:n,skipChild:o=!1,hackCss:s=!0,afterAppend:i,cache:c}=t;if(n.has(e.id)){let l=n.getNode(e.id),d=n.getMeta(l);if(Kt(d,e))return n.getNode(e.id)}let a=xr(e,{doc:r,hackCss:s,cache:c});if(!a)return null;if(e.rootId&&n.getNode(e.rootId)!==r&&n.replace(e.rootId,r),e.type===C.Document&&(r.close(),r.open(),e.compatMode==="BackCompat"&&e.childNodes&&e.childNodes[0].type!==C.DocumentType&&(e.childNodes[0].type===C.Element&&"xmlns"in e.childNodes[0].attributes&&e.childNodes[0].attributes.xmlns==="http://www.w3.org/1999/xhtml"?r.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):r.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),a=r),n.add(a,e),(e.type===C.Document||e.type===C.Element)&&!o)for(let l of e.childNodes){let d=Re(l,{doc:r,mirror:n,skipChild:!1,hackCss:s,afterAppend:i,cache:c});if(!d){console.warn("Failed to rebuild",l);continue}if(l.isShadow&&et(a)&&a.shadowRoot)a.shadowRoot.appendChild(d);else if(e.type===C.Document&&l.type==C.Element){let y=d,h=null;y.childNodes.forEach(T=>{T.nodeName==="BODY"&&(h=T)}),h?(y.removeChild(h),a.appendChild(d),y.appendChild(h)):a.appendChild(d)}else a.appendChild(d);i&&i(d,l.id)}return a}function Lr(e,t){function r(n){t(n)}for(let n of e.getIds())e.has(n)&&r(e.getNode(n))}function Dr(e,t){let r=t.getMeta(e);if(r?.type!==C.Element)return;let n=e;for(let o in r.attributes){if(!(Object.prototype.hasOwnProperty.call(r.attributes,o)&&o.startsWith("rr_")))continue;let s=r.attributes[o];o==="rr_scrollLeft"&&(n.scrollLeft=s),o==="rr_scrollTop"&&(n.scrollTop=s)}}function Ar(e,t){let{doc:r,onVisit:n,hackCss:o=!0,afterAppend:s,cache:i,mirror:c=new ie}=t,a=Re(e,{doc:r,mirror:c,skipChild:!1,hackCss:o,afterAppend:s,cache:i});return Lr(c,l=>{n&&n(l),Dr(l,c)}),a}function dt(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var J=`Please stop import mirror directly. Instead of that,\r now you can use replayer.getMirror() to access the mirror instance of a replayer,\r or you can use record.mirror to access the mirror instance during recording.`,Me={map:{},getId(){return console.error(J),-1},getNode(){return console.error(J),null},removeNodeFromMap(){console.error(J)},has(){return console.error(J),!1},reset(){console.error(J)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Me=new Proxy(Me,{get(e,t,r){return t==="map"&&console.error(J),Reflect.get(e,t,r)}}));function ht(e,t,r={}){let n=null,o=0;return function(...s){let i=Date.now();!o&&r.leading===!1&&(o=i);let c=t-(i-o),a=this;c<=0||c>t?(n&&(Ue(n),n=null),o=i,e.apply(a,s)):!n&&r.trailing!==!1&&(n=le(()=>{o=r.leading===!1?0:Date.now(),n=null,e.apply(a,s)},c))}}function ae(e,t,r,n,o=window){let s=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,n?r:{set(i){le(()=>{r.set.call(this,i)},0),s&&s.set&&s.set.call(this,i)}}),()=>ae(e,t,s||{},!0)}function ce(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],o=r(n);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=o,()=>{e[t]=n}}catch{return()=>{}}}exports.nowTimestamp=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(exports.nowTimestamp=()=>new Date().getTime());function pt(e){let t=e.document;return{left:t.scrollingElement?t.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:t?.documentElement.scrollLeft||t?.body?.parentElement?.scrollLeft||t?.body?.scrollLeft||0,top:t.scrollingElement?t.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:t?.documentElement.scrollTop||t?.body?.parentElement?.scrollTop||t?.body?.scrollTop||0}}function mt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function gt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function _e(e){if(!e)return null;try{return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}catch{return null}}function te(e,t,r,n,o){if(!e)return!1;let s=_e(e);if(!s)return!1;let i=Q(t,r);if(!o){let l=n&&s.matches(n);return i(s)&&!l}let c=q(s,i),a=-1;return c<0?!1:(n&&(a=q(s,Q(null,n))),c>-1&&a<0?!0:c<a)}function yt(e,t){return t.getId(e)!==-1}function wt(e,t){return t.getId(e)===me}function Ie(e,t){if(Le(e))return!1;let r=t.getId(e);return t.has(r)?e.parentNode&&e.parentNode.nodeType===e.DOCUMENT_NODE?!1:e.parentNode?Ie(e.parentNode,t):!0:!0}function bt(e){return!!e.changedTouches}function Ct(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),Node.prototype.contains||(Node.prototype.contains=(...t)=>{let r=t[0];if(!(0 in t))throw new TypeError("1 argument is required");do if(this===r)return!0;while(r=r&&r.parentNode);return!1})}function St(e){let t={},r=(o,s)=>{let i={value:o,parent:s,children:[]};return t[o.node.id]=i,i},n=[];for(let o of e){let{nextId:s,parentId:i}=o;if(s&&s in t){let c=t[s];if(c.parent){let a=c.parent.children.indexOf(c);c.parent.children.splice(a,0,r(o,c.parent))}else{let a=n.indexOf(c);n.splice(a,0,r(o,null))}continue}if(i in t){let c=t[i];c.children.push(r(o,c));continue}n.push(r(o,null))}return n}function Oe(e,t){t(e.value);for(let r=e.children.length-1;r>=0;r--)Oe(e.children[r],t)}function kt(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Tt(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function We(e,t){let r=e.ownerDocument?.defaultView?.frameElement;if(!r||r===t)return{x:0,y:0,relativeScale:1,absoluteScale:1};let n=r.getBoundingClientRect(),o=We(r,t),s=n.height/r.clientHeight;return{x:n.x*o.relativeScale+o.x,y:n.y*o.relativeScale+o.y,relativeScale:s,absoluteScale:o.absoluteScale*s}}function Nt(e){return!!e?.shadowRoot}function Pe(e,t){let r=e[t[0]];return t.length===1?r:Pe(r.cssRules[t[1]].cssRules,t.slice(2))}function Mt(e){let t=[...e],r=t.pop();return{positions:t,index:r}}function Et(e){let t=new Set,r=[];for(let n=e.length;n--;){let o=e[n];t.has(o.id)||(r.push(o),t.add(o.id))}return r}var we=class{constructor(){this.id=1,this.styleIDMap=new WeakMap,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 Fe(e){let t=null;return e.getRootNode?.()?.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(t=e.getRootNode().host),t}function xt(e){let t=e,r;for(;r=Fe(t);)t=r;return t}function Lt(e){let t=e.ownerDocument;if(!t)return!1;let r=xt(e);return t.contains(r)}function Dt(e){let t=e.ownerDocument;return t?t.contains(e)||Lt(e):!1}var Je={};function Be(e){let t=Je[e];if(t)return t;let r=window.document,n=window[e];if(r&&typeof r.createElement=="function")try{let o=r.createElement("iframe");o.hidden=!0,r.head.appendChild(o);let s=o.contentWindow;s&&s[e]&&(n=s[e]),r.head.removeChild(o)}catch{}return Je[e]=n.bind(window)}function z(...e){return Be("requestAnimationFrame")(...e)}function le(...e){return Be("setTimeout")(...e)}function Ue(...e){return Be("clearTimeout")(...e)}var vr=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:we,get _mirror(){return Me},clearTimeout:Ue,closestElementOfNode:_e,getBaseDimension:We,getNestedRule:Pe,getPositionsAndIndex:Mt,getRootShadowHost:xt,getShadowHost:Fe,getWindowHeight:mt,getWindowScroll:pt,getWindowWidth:gt,hasShadowRoot:Nt,hookSetter:ae,inDom:Dt,isAncestorRemoved:Ie,isBlocked:te,isIgnored:wt,isSerialized:yt,isSerializedIframe:kt,isSerializedStylesheet:Tt,iterateResolveTree:Oe,legacy_isTouchEvent:bt,get nowTimestamp(){return exports.nowTimestamp},on:dt,onRequestAnimationFrame:z,patch:ce,polyfill:Ct,queueToResolveTrees:St,setTimeout:le,shadowHostInDom:Lt,throttle:ht,uniqueTextMutations:Et},Symbol.toStringTag,{value:"Module"})),At=(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))(At||{}),vt=(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))(vt||{}),Rt=(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))(Rt||{}),_t=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(_t||{}),X=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(X||{}),It=(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))(It||{}),Ot=(e=>(e.Start="start",e.Pause="pause",e.Resume="resume",e.Resize="resize",e.Finish="finish",e.FullsnapshotRebuilded="fullsnapshot-rebuilded",e.LoadStylesheetStart="load-stylesheet-start",e.LoadStylesheetEnd="load-stylesheet-end",e.SkipStart="skip-start",e.SkipEnd="skip-end",e.MouseInteraction="mouse-interaction",e.EventCast="event-cast",e.CustomEvent="custom-event",e.Flush="flush",e.StateChange="state-change",e.PlayBack="play-back",e.Destroy="destroy",e))(Ot||{}),se;function Wt(e){se=e}function Rr(){se=void 0}var de=e=>se?((...r)=>{try{return e(...r)}catch(n){if(se&&se(n)===!0)return()=>{};throw n}}):e,ee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",oe=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(ne=0;ne<ee.length;ne++)oe[ee.charCodeAt(ne)]=ne;var ne,_r=function(e){var t=new Uint8Array(e),r,n=t.length,o="";for(r=0;r<n;r+=3)o+=ee[t[r]>>2],o+=ee[(t[r]&3)<<4|t[r+1]>>4],o+=ee[(t[r+1]&15)<<2|t[r+2]>>6],o+=ee[t[r+2]&63];return n%3===2?o=o.substring(0,o.length-1)+"=":n%3===1&&(o=o.substring(0,o.length-2)+"=="),o},Ir=function(e){var t=e.length*.75,r=e.length,n,o=0,s,i,c,a;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var l=new ArrayBuffer(t),d=new Uint8Array(l);for(n=0;n<r;n+=4)s=oe[e.charCodeAt(n)],i=oe[e.charCodeAt(n+1)],c=oe[e.charCodeAt(n+2)],a=oe[e.charCodeAt(n+3)],d[o++]=s<<2|i>>4,d[o++]=(i&15)<<4|c>>2,d[o++]=(c&3)<<6|a&63;return l},Ke=new Map;function Or(e,t){let r=Ke.get(e);return r||(r=new Map,Ke.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var Pt=(e,t,r)=>{if(!e||!(Bt(e,t)||typeof e=="object"))return;let n=e.constructor.name,o=Or(r,n),s=o.indexOf(e);return s===-1&&(s=o.length,o.push(e)),s};function he(e,t,r){if(e instanceof Array)return e.map(n=>he(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,o=_r(e);return{rr_type:n,base64:o}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[he(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:o}=e;return{rr_type:n,src:o}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",o=e.toDataURL();return{rr_type:n,src:o}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[he(e.data,t,r),e.width,e.height]};if(Bt(e,t)||typeof e=="object"){let n=e.constructor.name,o=Pt(e,t,r);return{rr_type:n,index:o}}}}return e}var Ft=(e,t,r)=>e.map(n=>he(n,t,r)),Bt=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(o=>typeof t[o]=="function").find(o=>e instanceof t[o]);function Wr(e,t,r,n,o){let s=[],i=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let c of i)try{if(typeof t.CanvasRenderingContext2D.prototype[c]!="function")continue;let a=ce(t.CanvasRenderingContext2D.prototype,c,function(l){return function(...d){return te(this.canvas,r,n,o,!0)||le(()=>{let y=Ft(d,t,this);e(this.canvas,{type:X["2D"],property:c,args:y})},0),l.apply(this,d)}});s.push(a)}catch{let a=ae(t.CanvasRenderingContext2D.prototype,c,{set(l){e(this.canvas,{type:X["2D"],property:c,args:[l],setter:!0})}});s.push(a)}return()=>{s.forEach(c=>c())}}function Pr(e){return e==="experimental-webgl"?"webgl":e}function Qe(e,t,r,n,o){let s=[];try{let i=ce(e.HTMLCanvasElement.prototype,"getContext",function(c){return function(a,...l){if(!te(this,t,r,n,!0)){let d=Pr(a);if("__context"in this||(this.__context=d),o&&["webgl","webgl2"].includes(d))if(l[0]&&typeof l[0]=="object"){let y=l[0];y.preserveDrawingBuffer||(y.preserveDrawingBuffer=!0)}else l.splice(0,1,{preserveDrawingBuffer:!0})}return c.apply(this,[a,...l])}});s.push(i)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(i=>i())}}function Ze(e,t,r,n,o,s,i,c){let a=[],l=Object.getOwnPropertyNames(e);for(let d of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(d))try{if(typeof e[d]!="function")continue;let y=ce(e,d,function(h){return function(...T){let p=h.apply(this,T);if(Pt(p,c,this),"tagName"in this.canvas&&!te(this.canvas,n,o,s,!0)){let x=Ft(T,c,this),w={type:t,property:d,args:x};r(this.canvas,w)}return p}});a.push(y)}catch{let y=ae(e,d,{set(h){r(this.canvas,{type:t,property:d,args:[h],setter:!0})}});a.push(y)}return a}function Fr(e,t,r,n,o,s){let i=[];return i.push(...Ze(t.WebGLRenderingContext.prototype,X.WebGL,e,r,n,o,s,t)),typeof t.WebGL2RenderingContext<"u"&&i.push(...Ze(t.WebGL2RenderingContext.prototype,X.WebGL2,e,r,n,o,s,t)),()=>{i.forEach(c=>c())}}var Br='for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),a=0;a<64;a++)t[e.charCodeAt(a)]=a;var n=function(t){var a,n=new Uint8Array(t),r=n.length,s="";for(a=0;a<r;a+=3)s+=e[n[a]>>2],s+=e[(3&n[a])<<4|n[a+1]>>4],s+=e[(15&n[a+1])<<2|n[a+2]>>6],s+=e[63&n[a+2]];return r%3==2?s=s.substring(0,s.length-1)+"=":r%3==1&&(s=s.substring(0,s.length-2)+"=="),s};const r=new Map,s=new Map;const i=self;i.onmessage=async function(e){if(!("OffscreenCanvas"in globalThis))return i.postMessage({id:e.data.id});{const{id:t,bitmap:a,width:o,height:f,maxCanvasSize:c,dataURLOptions:g}=e.data,u=async function(e,t,a){const r=e+"-"+t;if("OffscreenCanvas"in globalThis){if(s.has(r))return s.get(r);const i=new OffscreenCanvas(e,t);i.getContext("2d");const o=await i.convertToBlob(a),f=await o.arrayBuffer(),c=n(f);return s.set(r,c),c}return""}(o,f,g),[h,d]=function(e,t,a){if(!a)return[e,t];const[n,r]=a;if(e<=n&&t<=r)return[e,t];let s=e,i=t;return s>n&&(i=Math.floor(n*t/e),s=n),i>r&&(s=Math.floor(r*e/t),i=r),[s,i]}(o,f,c),l=new OffscreenCanvas(h,d),w=l.getContext("bitmaprenderer"),p=h===o&&d===f?a:await createImageBitmap(a,{resizeWidth:h,resizeHeight:d,resizeQuality:"low"});w?.transferFromImageBitmap(p),a.close();const y=await l.convertToBlob(g),v=y.type,b=await y.arrayBuffer(),m=n(b);if(p.close(),!r.has(t)&&await u===m)return r.set(t,m),i.postMessage({id:t});if(r.get(t)===m)return i.postMessage({id:t});i.postMessage({id:t,type:v,base64:m,width:o,height:f}),r.set(t,m)}};';function Ur(){let e=new Blob([Br]);return URL.createObjectURL(e)}var Ee=class{reset(){}freeze(){}unfreeze(){}lock(){}unlock(){}snapshot(){}addWindow(){}addShadowRoot(){}resetShadowRoots(){}},xe=class{constructor(t){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.shadowDoms=new Set,this.windowsSet=new WeakSet,this.windows=[],this.restoreHandlers=[],this.frozen=!1,this.locked=!1,this.snapshotInProgressMap=new Map,this.worker=null,this.lastSnapshotTime=0,this.processMutation=(c,a)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(c)||this.pendingCanvasMutations.set(c,[]),this.pendingCanvasMutations.get(c).push(a)};let{enableManualSnapshot:r,sampling:n="all",win:o,recordCanvas:s,errorHandler:i}=t;t.sampling=n,this.mutationCb=t.mutationCb,this.mirror=t.mirror,this.options=t,i&&Wt(i),(s&&typeof n=="number"||r)&&(this.worker=this.initFPSWorker()),this.addWindow(o),!r&&de(()=>{s&&n==="all"&&(this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher()),s&&typeof n=="number"&&this.initCanvasFPSObserver()})()}reset(){this.pendingCanvasMutations.clear(),this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.windowsSet=new WeakSet,this.windows=[],this.shadowDoms=new Set,this.worker?.terminate(),this.worker=null,this.snapshotInProgressMap=new Map}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}addWindow(t){let{sampling:r="all",blockClass:n,blockSelector:o,unblockSelector:s,recordCanvas:i,enableManualSnapshot:c}=this.options;if(!this.windowsSet.has(t)){if(c){this.windowsSet.add(t),this.windows.push(new WeakRef(t));return}de(()=>{if(i&&r==="all"&&this.initCanvasMutationObserver(t,n,o,s),i&&typeof r=="number"){let a=Qe(t,n,o,s,!0);this.restoreHandlers.push(()=>{a()})}})(),this.windowsSet.add(t),this.windows.push(new WeakRef(t))}}addShadowRoot(t){this.shadowDoms.add(new WeakRef(t))}resetShadowRoots(){this.shadowDoms=new Set}snapshot(t,r){if(r?.skipRequestAnimationFrame){this.takeSnapshot(performance.now(),!0,t);return}z(n=>this.takeSnapshot(n,!0,t))}initFPSWorker(){let t=new Worker(Ur());return t.onmessage=r=>{let n=r.data,{id:o}=n;if(this.snapshotInProgressMap.set(o,!1),!("base64"in n))return;let{base64:s,type:i,width:c,height:a}=n;this.mutationCb({id:o,type:X["2D"],commands:[{property:"clearRect",args:[0,0,c,a]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:s}],type:i}]},0,0,c,a]}]})},t}initCanvasFPSObserver(){let t;if(!this.windows.length&&!this.shadowDoms.size)return;let r=n=>{this.takeSnapshot(n,!1),t=z(r)};t=z(r),this.restoreHandlers.push(()=>{t&&cancelAnimationFrame(t)})}initCanvasMutationObserver(t,r,n,o){let s=Qe(t,r,n,o,!1),i=Wr(this.processMutation.bind(this),t,r,n