UNPKG

@sentry-internal/rrweb

Version:
5 lines 160 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 $n=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var cn=$n(M=>{"use strict";var jn=Object.defineProperty,Yn=(e,t,r)=>t in e?jn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,pe=(e,t,r)=>Yn(e,typeof t!="symbol"?t+"":t,r),A=(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))(A||{});function wr(e){return e.nodeType===e.ELEMENT_NODE}function Mt(e){return e?.host?.shadowRoot===e}function Ye(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Xn(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 qn(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 Qe(e){try{let t=e.rules||e.cssRules;return t?Xn(Array.from(t,Ir).join("")):null}catch{return null}}function Qn(e){let t="";for(let r=0;r<e.style.length;r++){let n=e.style,s=n[r],o=n.getPropertyPriority(s);t+=`${s}:${n.getPropertyValue(s)}${o?" !important":""};`}return`${e.selectorText} { ${t} }`}function Ir(e){let t;if(Zn(e))try{t=Qe(e.styleSheet)||qn(e)}catch{}else if(Kn(e)){let r=e.cssText,n=e.selectorText.includes(":"),s=typeof e.style.all=="string"&&e.style.all;if(s&&(r=Qn(e)),n&&(r=Jn(r)),n||s)return r}return t||e.cssText}function Jn(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function Zn(e){return"styleSheet"in e}function Kn(e){return"selectorText"in e}var Fe=class{constructor(){pe(this,"idNodeMap",new Map),pe(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 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 es(){return new Fe}function Ct({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 Tt({isMasked:e,element:t,value:r,maskInputFn:n}){let s=r||"";return e?(n&&(s=n(s,t)),"*".repeat(s.length)):s}function tt(e){return e.toLowerCase()}function St(e){return e.toUpperCase()}var dr="__rrweb_original__";function ts(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,i=dr in o?o[dr]:o;if(new Uint32Array(i.call(t,n,s,Math.min(r,e.width-n),Math.min(r,e.height-s)).data.buffer).some(l=>l!==0))return!1}return!0}function rs(e,t){return!e||!t||e.type!==t.type?!1:e.type===A.Document?e.compatMode===t.compatMode:e.type===A.DocumentType?e.name===t.name&&e.publicId===t.publicId&&e.systemId===t.systemId:e.type===A.Comment||e.type===A.Text||e.type===A.CDATA?e.textContent===t.textContent:e.type===A.Element?e.tagName===t.tagName&&JSON.stringify(e.attributes)===JSON.stringify(t.attributes)&&e.isSVG===t.isSVG&&e.needBlock===t.needBlock:!1}function Mr(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?tt(t):null}function Cr(e,t,r){return t==="INPUT"&&(r==="radio"||r==="checkbox")?e.getAttribute("value")||"":e.value}function Nt(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 hr={};function Tr(e){let t=hr[e];if(t)return t;let r=window.document,n=window[e];if(r&&typeof r.createElement=="function")try{let s=r.createElement("iframe");s.hidden=!0,r.head.appendChild(s);let o=s.contentWindow;o&&o[e]&&(n=o[e]),r.head.removeChild(s)}catch{}return hr[e]=n.bind(window)}function bt(...e){return Tr("setTimeout")(...e)}function Nr(...e){return Tr("clearTimeout")(...e)}function kr(e){try{return e.contentDocument}catch{}}function ns(e){try{return e.contentWindow}catch{}}var ss=1,os=new RegExp("[^a-z0-9-_:]"),Je=-2;function Dr(){return ss++}function is(e){if(e instanceof HTMLFormElement)return"form";let t=tt(e.tagName);return os.test(t)?"div":t}function as(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var Se,pr,ls=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,cs=/^(?:[a-z+]+:)?\/\//i,us=/^www\..*/i,ds=/^(data:)([^,]*),(.*)/i;function hs(e,t){if(!e||t.size===0)return e;try{let r=e.split(";"),n=[];for(let s of r){if(s=s.trim(),!s)continue;let o=s.indexOf(":");if(o===-1){n.push(s);continue}let i=s.slice(0,o).trim();t.has(i)||n.push(s)}return n.join("; ")+(n.length>0&&e.endsWith(";")?";":"")}catch(r){return console.warn("Error filtering CSS properties:",r),e}}function Ze(e,t){return(e||"").replace(ls,(r,n,s,o,i,u)=>{let l=s||i||u,c=n||o||"";if(!l)return r;if(cs.test(l)||us.test(l))return`url(${c}${l}${c})`;if(ds.test(l))return`url(${c}${l}${c})`;if(l[0]==="/")return`url(${c}${as(t)+l}${c})`;let d=t.split("/"),h=l.split("/");d.pop();for(let p of h)p!=="."&&(p===".."?d.pop():d.push(p));return`url(${c}${d.join("/")}${c})`})}var ps=/^[^ \t\n\r\u000c]+/,fs=/^[, \t\n\r\u000c]+/;function ms(e,t){if(t.trim()==="")return t;let r=0;function n(o){let i,u=o.exec(t.substring(r));return u?(i=u[0],r+=i.length,i):""}let s=[];for(;n(fs),!(r>=t.length);){let o=n(ps);if(o.slice(-1)===",")o=ve(e,o.substring(0,o.length-1)),s.push(o);else{let i="";o=ve(e,o);let u=!1;for(;;){let l=t.charAt(r);if(l===""){s.push((o+i).trim());break}else if(u)l===")"&&(u=!1);else if(l===","){r+=1,s.push((o+i).trim());break}else l==="("&&(u=!0);i+=l,r+=1}}}return s.join(", ")}var fr=new WeakMap;function ve(e,t){return!t||t.trim()===""?t:rt(e,t)}function gs(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function rt(e,t){let r=fr.get(e);if(r||(r=e.createElement("a"),fr.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function Rr(e,t,r,n,s,o,i){if(!n)return n;if(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#"))return ve(e,n);if(r==="xlink:href"&&n[0]!=="#")return ve(e,n);if(r==="background"&&(t==="table"||t==="td"||t==="th"))return ve(e,n);if(r==="srcset")return ms(e,n);if(r==="style"){let u=Ze(n,rt(e));return i&&i.size>0&&(u=hs(u,i)),u}else if(t==="object"&&r==="data")return ve(e,n);return typeof o=="function"?o(r,n,s):n}function xr(e,t,r){return(e==="video"||e==="audio")&&t==="autoplay"}function ys(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 s=e.classList.length;s--;){let o=e.classList[s];if(t.test(o))return!0}if(r)return e.matches(r)}catch{}return!1}function Ss(e,t){for(let r=e.classList.length;r--;){let n=e.classList[r];if(t.test(n))return!0}return!1}function fe(e,t,r=1/0,n=0){return!e||e.nodeType!==e.ELEMENT_NODE||n>r?-1:t(e)?n:fe(e.parentNode,t,r,n+1)}function Ee(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(Ss(n,e))return!0}return!!(t&&n.matches(t))}catch{return!1}}}function Ke(e,t,r,n,s,o){try{let i=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(i===null)return!1;if(i.tagName==="INPUT"){let c=i.getAttribute("autocomplete");if(["current-password","new-password","cc-number","cc-exp","cc-exp-month","cc-exp-year","cc-csc"].includes(c))return!0}let u=-1,l=-1;if(o){if(l=fe(i,Ee(n,s)),l<0)return!0;u=fe(i,Ee(t,r),l>=0?l:1/0)}else{if(u=fe(i,Ee(t,r)),u<0)return!1;l=fe(i,Ee(n,s),u>=0?u:1/0)}return u>=0?l>=0?u<=l:!0:l>=0?!1:!!o}catch{}return!!o}function bs(e,t,r){let n=ns(e);if(!n)return;let s=!1,o;try{o=n.document.readyState}catch{return}if(o!=="complete"){let u=bt(()=>{s||(t(),s=!0)},r);e.addEventListener("load",()=>{Nr(u),s=!0,t()});return}let i="about:blank";if(n.location.href!==i||e.src===i||e.src==="")return bt(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function vs(e,t,r){let n=!1,s;try{s=e.sheet}catch{s=null}if(s)return;let o=bt(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{Nr(o),n=!0,t()})}function Es(e,t){let{doc:r,mirror:n,blockClass:s,blockSelector:o,unblockSelector:i,maskAllText:u,maskAttributeFn:l,maskTextClass:c,unmaskTextClass:d,maskTextSelector:h,unmaskTextSelector:p,inlineStylesheet:m,maskInputOptions:f={},maskTextFn:b,maskInputFn:y,dataURLOptions:g={},inlineImages:v,recordCanvas:w,keepIframeSrcFn:N,newlyAddedElement:U=!1,ignoreCSSAttributes:D}=t,I=ws(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:A.Document,childNodes:[],compatMode:e.compatMode}:{type:A.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:A.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:I};case e.ELEMENT_NODE:return Ms(e,{doc:r,blockClass:s,blockSelector:o,unblockSelector:i,inlineStylesheet:m,maskAttributeFn:l,maskInputOptions:f,maskInputFn:y,dataURLOptions:g,inlineImages:v,recordCanvas:w,keepIframeSrcFn:N,newlyAddedElement:U,rootId:I,maskTextClass:c,unmaskTextClass:d,maskTextSelector:h,unmaskTextSelector:p,ignoreCSSAttributes:D});case e.TEXT_NODE:return Is(e,{doc:r,maskAllText:u,maskTextClass:c,unmaskTextClass:d,maskTextSelector:h,unmaskTextSelector:p,maskTextFn:b,maskInputOptions:f,maskInputFn:y,rootId:I});case e.CDATA_SECTION_NODE:return{type:A.CDATA,textContent:"",rootId:I};case e.COMMENT_NODE:return{type:A.Comment,textContent:e.textContent||"",rootId:I};default:return!1}}function ws(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function Is(e,t){let{maskAllText:r,maskTextClass:n,unmaskTextClass:s,maskTextSelector:o,unmaskTextSelector:i,maskTextFn:u,maskInputOptions:l,maskInputFn:c,rootId:d}=t,h=e.parentNode&&e.parentNode.tagName,p=e.textContent,m=h==="STYLE"?!0:void 0,f=h==="SCRIPT"?!0:void 0,b=h==="TEXTAREA"?!0:void 0;if(m&&p){try{e.nextSibling||e.previousSibling||e.parentNode.sheet?.cssRules&&(p=Qe(e.parentNode.sheet))}catch(g){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${g}`,e)}p=Ze(p,rt(t.doc))}f&&(p="SCRIPT_PLACEHOLDER");let y=Ke(e,n,o,s,i,r);if(!m&&!f&&!b&&p&&y&&(p=u?u(p,e.parentElement):p.replace(/[\S]/g,"*")),b&&p&&(l.textarea||y)&&(p=c?c(p,e.parentNode):p.replace(/[\S]/g,"*")),h==="OPTION"&&p){let g=Ct({type:null,tagName:h,maskInputOptions:l});p=Tt({isMasked:Ke(e,n,o,s,i,g),element:e,value:p,maskInputFn:c})}return{type:A.Text,textContent:p||"",isStyle:m,rootId:d}}function Ms(e,t){let{doc:r,blockClass:n,blockSelector:s,unblockSelector:o,inlineStylesheet:i,maskInputOptions:u={},maskAttributeFn:l,maskInputFn:c,dataURLOptions:d={},inlineImages:h,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:f=!1,rootId:b,maskTextClass:y,unmaskTextClass:g,maskTextSelector:v,unmaskTextSelector:w,ignoreCSSAttributes:N}=t,U=ys(e,n,s,o),D=is(e),I={},_=e.attributes.length;for(let C=0;C<_;C++){let R=e.attributes[C];R.name&&!xr(D,R.name,R.value)&&(I[R.name]=Rr(r,D,tt(R.name),R.value,e,l,N))}if(D==="link"&&i){let C=Array.from(r.styleSheets).find(B=>B.href===e.href),R=null;C&&(R=Qe(C)),R&&(I.rel=null,I.href=null,I.crossorigin=null,I._cssText=Ze(R,C.href))}if(D==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){let C=Qe(e.sheet);C&&(I._cssText=Ze(C,rt(r)))}if(D==="input"||D==="textarea"||D==="select"||D==="option"){let C=e,R=Mr(C),B=Cr(C,St(D),R),H=C.checked;if(R!=="submit"&&R!=="button"&&B){let $=Ke(C,y,v,g,w,Ct({type:R,tagName:St(D),maskInputOptions:u}));I.value=Tt({isMasked:$,element:C,value:B,maskInputFn:c})}H&&(I.checked=H)}if(D==="option"&&(e.selected&&!u.select?I.selected=!0:delete I.selected),D==="canvas"&&p){if(e.__context==="2d")ts(e)||(I.rr_dataURL=e.toDataURL(d.type,d.quality));else if(!("__context"in e)){let C=e.toDataURL(d.type,d.quality),R=r.createElement("canvas");R.width=e.width,R.height=e.height;let B=R.toDataURL(d.type,d.quality);C!==B&&(I.rr_dataURL=C)}}if(D==="img"&&h){Se||(Se=r.createElement("canvas"),pr=Se.getContext("2d"));let C=e,R=C.currentSrc||C.getAttribute("src")||"<unknown-src>",B=C.crossOrigin,H=()=>{C.removeEventListener("load",H);try{Se.width=C.naturalWidth,Se.height=C.naturalHeight,pr.drawImage(C,0,0),I.rr_dataURL=Se.toDataURL(d.type,d.quality)}catch($){if(C.crossOrigin!=="anonymous"){C.crossOrigin="anonymous",C.complete&&C.naturalWidth!==0?H():C.addEventListener("load",H);return}else console.warn(`Cannot inline img src=${R}! Error: ${$}`)}C.crossOrigin==="anonymous"&&(B?I.crossOrigin=B:C.removeAttribute("crossorigin"))};C.complete&&C.naturalWidth!==0?H():C.addEventListener("load",H)}if((D==="audio"||D==="video")&&(I.rr_mediaState=e.paused?"paused":"played",I.rr_mediaCurrentTime=e.currentTime),f||(e.scrollLeft&&(I.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(I.rr_scrollTop=e.scrollTop)),U){let{width:C,height:R}=e.getBoundingClientRect();I={class:I.class,rr_width:`${C}px`,rr_height:`${R}px`}}D==="iframe"&&!m(I.src)&&(!U&&!kr(e)&&(I.rr_src=I.src),delete I.src);let Y;try{customElements.get(D)&&(Y=!0)}catch{}return{type:A.Element,tagName:D,attributes:I,childNodes:[],isSVG:gs(e)||void 0,needBlock:U,rootId:b,isCustom:Y}}function z(e){return e==null?"":e.toLowerCase()}function Cs(e,t){if(t.comment&&e.type===A.Comment)return!0;if(e.type===A.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"&&Nt(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(z(e.attributes.name).match(/^msapplication-tile(image|color)$/)||z(e.attributes.name)==="application-name"||z(e.attributes.rel)==="icon"||z(e.attributes.rel)==="apple-touch-icon"||z(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&z(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(z(e.attributes.property).match(/^(og|twitter|fb):/)||z(e.attributes.name).match(/^(og|twitter):/)||z(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(z(e.attributes.name)==="robots"||z(e.attributes.name)==="googlebot"||z(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(z(e.attributes.name)==="author"||z(e.attributes.name)==="generator"||z(e.attributes.name)==="framework"||z(e.attributes.name)==="publisher"||z(e.attributes.name)==="progid"||z(e.attributes.property).match(/^article:/)||z(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(z(e.attributes.name)==="google-site-verification"||z(e.attributes.name)==="yandex-verification"||z(e.attributes.name)==="csrf-token"||z(e.attributes.name)==="p:domain_verify"||z(e.attributes.name)==="verify-v1"||z(e.attributes.name)==="verification"||z(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function we(e,t){let{doc:r,mirror:n,blockClass:s,blockSelector:o,unblockSelector:i,maskAllText:u,maskTextClass:l,unmaskTextClass:c,maskTextSelector:d,unmaskTextSelector:h,skipChild:p=!1,inlineStylesheet:m=!0,maskInputOptions:f={},maskAttributeFn:b,maskTextFn:y,maskInputFn:g,slimDOMOptions:v,dataURLOptions:w={},inlineImages:N=!1,recordCanvas:U=!1,onSerialize:D,onIframeLoad:I,iframeLoadTimeout:_=5e3,onBlockedImageLoad:Y,onStylesheetLoad:C,stylesheetLoadTimeout:R=5e3,keepIframeSrcFn:B=()=>!1,newlyAddedElement:H=!1,ignoreCSSAttributes:$}=t,{preserveWhiteSpace:Z=!0}=t,X=Es(e,{doc:r,mirror:n,blockClass:s,blockSelector:o,maskAllText:u,unblockSelector:i,maskTextClass:l,unmaskTextClass:c,maskTextSelector:d,unmaskTextSelector:h,inlineStylesheet:m,maskInputOptions:f,maskAttributeFn:b,maskTextFn:y,maskInputFn:g,dataURLOptions:w,inlineImages:N,recordCanvas:U,keepIframeSrcFn:B,newlyAddedElement:H,ignoreCSSAttributes:$});if(!X)return console.warn(e,"not serialized"),null;let W;n.hasNode(e)?W=n.getId(e):Cs(X,v)||!Z&&X.type===A.Text&&!X.isStyle&&!X.textContent.trim().length?W=Je:W=Dr();let x=Object.assign(X,{id:W});if(n.add(e,x),W===Je)return null;D&&D(e);let J=!p;if(x.type===A.Element){J=J&&!x.needBlock;let E=e.shadowRoot;E&&Ye(E)&&(x.isShadowHost=!0)}if((x.type===A.Document||x.type===A.Element)&&J){v.headWhitespace&&x.type===A.Element&&x.tagName==="head"&&(Z=!1);let E={doc:r,mirror:n,blockClass:s,blockSelector:o,maskAllText:u,unblockSelector:i,maskTextClass:l,unmaskTextClass:c,maskTextSelector:d,unmaskTextSelector:h,skipChild:p,inlineStylesheet:m,maskInputOptions:f,maskAttributeFn:b,maskTextFn:y,maskInputFn:g,slimDOMOptions:v,dataURLOptions:w,inlineImages:N,recordCanvas:U,preserveWhiteSpace:Z,onSerialize:D,onIframeLoad:I,iframeLoadTimeout:_,onBlockedImageLoad:Y,onStylesheetLoad:C,stylesheetLoadTimeout:R,keepIframeSrcFn:B,ignoreCSSAttributes:$},S=e.childNodes?Array.from(e.childNodes):[];for(let k of S){let O=we(k,E);O&&x.childNodes.push(O)}if(wr(e)&&e.shadowRoot)for(let k of Array.from(e.shadowRoot.childNodes)){let O=we(k,E);O&&(Ye(e.shadowRoot)&&(O.isShadow=!0),x.childNodes.push(O))}}if(e.parentNode&&Mt(e.parentNode)&&Ye(e.parentNode)&&(x.isShadow=!0),x.type===A.Element&&x.tagName==="iframe"&&!x.needBlock&&bs(e,()=>{let E=kr(e);if(E&&I){let S=we(E,{doc:E,mirror:n,blockClass:s,blockSelector:o,unblockSelector:i,maskAllText:u,maskTextClass:l,unmaskTextClass:c,maskTextSelector:d,unmaskTextSelector:h,skipChild:!1,inlineStylesheet:m,maskInputOptions:f,maskAttributeFn:b,maskTextFn:y,maskInputFn:g,slimDOMOptions:v,dataURLOptions:w,inlineImages:N,recordCanvas:U,preserveWhiteSpace:Z,onSerialize:D,onIframeLoad:I,iframeLoadTimeout:_,onStylesheetLoad:C,stylesheetLoadTimeout:R,keepIframeSrcFn:B,ignoreCSSAttributes:$});S&&I(e,S)}},_),x.type===A.Element&&x.tagName==="img"&&!e.complete&&x.needBlock){let E=e,S=()=>{if(E.isConnected&&!E.complete&&Y)try{let k=E.getBoundingClientRect();k.width>0&&k.height>0&&Y(E,x,k)}catch{}E.removeEventListener("load",S)};E.isConnected&&E.addEventListener("load",S)}return x.type===A.Element&&x.tagName==="link"&&typeof x.attributes.rel=="string"&&(x.attributes.rel==="stylesheet"||x.attributes.rel==="preload"&&typeof x.attributes.href=="string"&&Nt(x.attributes.href)==="css")&&vs(e,()=>{if(C){let E=we(e,{doc:r,mirror:n,blockClass:s,blockSelector:o,unblockSelector:i,maskAllText:u,maskTextClass:l,unmaskTextClass:c,maskTextSelector:d,unmaskTextSelector:h,skipChild:!1,inlineStylesheet:m,maskInputOptions:f,maskAttributeFn:b,maskTextFn:y,maskInputFn:g,slimDOMOptions:v,dataURLOptions:w,inlineImages:N,recordCanvas:U,preserveWhiteSpace:Z,onSerialize:D,onIframeLoad:I,iframeLoadTimeout:_,onStylesheetLoad:C,stylesheetLoadTimeout:R,keepIframeSrcFn:B,ignoreCSSAttributes:$});E&&C(e,E)}},R),x.type===A.Element&&delete x.needBlock,x}function Ts(e,t){let{mirror:r=new Fe,blockClass:n="rr-block",blockSelector:s=null,unblockSelector:o=null,maskAllText:i=!1,maskTextClass:u="rr-mask",unmaskTextClass:l=null,maskTextSelector:c=null,unmaskTextSelector:d=null,inlineStylesheet:h=!0,inlineImages:p=!1,recordCanvas:m=!1,maskAllInputs:f=!1,maskAttributeFn:b,maskTextFn:y,maskInputFn:g,slimDOM:v=!1,dataURLOptions:w,preserveWhiteSpace:N,onSerialize:U,onIframeLoad:D,iframeLoadTimeout:I,onBlockedImageLoad:_,onStylesheetLoad:Y,stylesheetLoadTimeout:C,keepIframeSrcFn:R=()=>!1,ignoreCSSAttributes:B=new Set([])}=t||{};return we(e,{doc:e,mirror:r,blockClass:n,blockSelector:s,unblockSelector:o,maskAllText:i,maskTextClass:u,unmaskTextClass:l,maskTextSelector:c,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:h,maskInputOptions: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}:f===!1?{}:f,maskAttributeFn:b,maskTextFn:y,maskInputFn:g,slimDOMOptions:v===!0||v==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:v==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:v===!1?{}:v,dataURLOptions:w,inlineImages:p,recordCanvas:m,preserveWhiteSpace:N,onSerialize:U,onIframeLoad:D,iframeLoadTimeout:I,onBlockedImageLoad:_,onStylesheetLoad:Y,stylesheetLoadTimeout:C,keepIframeSrcFn:R,newlyAddedElement:!1,ignoreCSSAttributes:B})}var mr=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function Ns(e,t={}){let r=1,n=1;function s(E){let S=E.match(/\n/g);S&&(r+=S.length);let k=E.lastIndexOf(` `);n=k===-1?n+E.length:E.length-k}function o(){let E={line:r,column:n};return S=>(S.position=new u(E),b(),S)}let i=class Or{constructor(S){pe(this,"content"),pe(this,"start"),pe(this,"end"),pe(this,"source"),this.start=S,this.end={line:r,column:n},this.source=t.source,this.content=Or.content}};pe(i,"content");let u=i;u.content=e;let l=[];function c(E){let S=new Error(`${t.source||""}:${r}:${n}: ${E}`);if(S.reason=E,S.filename=t.source,S.line=r,S.column=n,S.source=e,t.silent)l.push(S);else throw S}function d(){let E=m();return{type:"stylesheet",stylesheet:{source:t.source,rules:E,parsingErrors:l}}}function h(){return f(/^{\s*/)}function p(){return f(/^}/)}function m(){let E,S=[];for(b(),y(S);e.length&&e.charAt(0)!=="}"&&(E=x()||J());)E&&(S.push(E),y(S));return S}function f(E){let S=E.exec(e);if(!S)return;let k=S[0];return s(k),e=e.slice(k.length),S}function b(){f(/^\s*/)}function y(E=[]){let S;for(;S=g();)S&&E.push(S),S=g();return E}function g(){let E=o();if(e.charAt(0)!=="/"||e.charAt(1)!=="*")return;let S=2;for(;e.charAt(S)!==""&&(e.charAt(S)!=="*"||e.charAt(S+1)!=="/");)++S;if(S+=2,e.charAt(S-1)==="")return c("End of comment missing");let k=e.slice(2,S-2);return n+=2,s(k),e=e.slice(S),n+=2,E({type:"comment",comment:k})}function v(){let E=f(/^([^{]+)/);if(!E)return;let S=oe(E[0]).replace(/\/\*[\s\S]*?\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,te=>te.replace(/,/g,"\u200C")).split(/\s*(?![^(]*\)),\s*/);if(S.length<=1)return S.map(te=>te.replace(/\u200C/g,","));let k=0,O=0,j=S.length,K=[];for(;k<j;){let te=(S[k].match(/\(/g)||[]).length,xe=(S[k].match(/\)/g)||[]).length,ue=te-xe;if(ue>=1){let Oe=!1;for(O=k+1;O<j;){let se=(S[O].match(/\(/g)||[]).length,$e=(S[O].match(/\)/g)||[]).length-se;if($e===ue){K.push(S.slice(k,O+1).join(",")),k=O+1,Oe=!0;break}O++,ue-=$e}if(Oe)continue;S.slice(k,j).forEach(se=>se&&K.push(se));break}S[k]&&K.push(S[k]),k++}return K.map(te=>te.replace(/\u200C/g,","))}function w(){let E=o(),S=f(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(!S)return;let k=oe(S[0]);if(!f(/^:\s*/))return c("property missing ':'");let O=f(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),j=E({type:"declaration",property:k.replace(mr,""),value:O?oe(O[0]).replace(mr,""):""});return f(/^[;\s]*/),j}function N(){let E=[];if(!h())return c("missing '{'");y(E);let S;for(;S=w();)S!==!1&&(E.push(S),y(E)),S=w();return p()?E:c("missing '}'")}function U(){let E,S=[],k=o();for(;E=f(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)S.push(E[1]),f(/^,\s*/);if(S.length)return k({type:"keyframe",values:S,declarations:N()})}function D(){let E=o(),S=f(/^@([-\w]+)?keyframes\s*/);if(!S)return;let k=S[1];if(S=f(/^([-\w]+)\s*/),!S)return c("@keyframes missing name");let O=S[1];if(!h())return c("@keyframes missing '{'");let j,K=y();for(;j=U();)K.push(j),K=K.concat(y());return p()?E({type:"keyframes",name:O,vendor:k,keyframes:K}):c("@keyframes missing '}'")}function I(){let E=o(),S=f(/^@supports *([^{]+)/);if(!S)return;let k=oe(S[1]);if(!h())return c("@supports missing '{'");let O=y().concat(m());return p()?E({type:"supports",supports:k,rules:O}):c("@supports missing '}'")}function _(){let E=o();if(!f(/^@host\s*/))return;if(!h())return c("@host missing '{'");let k=y().concat(m());return p()?E({type:"host",rules:k}):c("@host missing '}'")}function Y(){let E=o(),S=f(/^@media *([^{]+)/);if(!S)return;let k=oe(S[1]);if(!h())return c("@media missing '{'");let O=y().concat(m());return p()?E({type:"media",media:k,rules:O}):c("@media missing '}'")}function C(){let E=o(),S=f(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(S)return E({type:"custom-media",name:oe(S[1]),media:oe(S[2])})}function R(){let E=o();if(!f(/^@page */))return;let k=v()||[];if(!h())return c("@page missing '{'");let O=y(),j;for(;j=w();)O.push(j),O=O.concat(y());return p()?E({type:"page",selectors:k,declarations:O}):c("@page missing '}'")}function B(){let E=o(),S=f(/^@([-\w]+)?document *([^{]+)/);if(!S)return;let k=oe(S[1]),O=oe(S[2]);if(!h())return c("@document missing '{'");let j=y().concat(m());return p()?E({type:"document",document:O,vendor:k,rules:j}):c("@document missing '}'")}function H(){let E=o();if(!f(/^@font-face\s*/))return;if(!h())return c("@font-face missing '{'");let k=y(),O;for(;O=w();)k.push(O),k=k.concat(y());return p()?E({type:"font-face",declarations:k}):c("@font-face missing '}'")}let $=W("import"),Z=W("charset"),X=W("namespace");function W(E){let S=new RegExp("^@"+E+"\\s*((?:"+[/[^\\]"(?:\\"|[^"])*"/.source,/[^\\]'(?:\\'|[^'])*'/.source,"[^;]"].join("|")+")+);");return()=>{let k=o(),O=f(S);if(!O)return;let j={type:E};return j[E]=O[1].trim(),k(j)}}function x(){if(e[0]==="@")return D()||Y()||C()||I()||$()||Z()||X()||B()||R()||_()||H()}function J(){let E=o(),S=v();return S?(y(),E({type:"rule",selectors:S,declarations:N()})):c("selector missing")}return vt(d())}function oe(e){return e?e.replace(/^\s+|\s+$/g,""):""}function vt(e,t){let r=e&&typeof e.type=="string",n=r?e:t;for(let s of Object.keys(e)){let o=e[s];Array.isArray(o)?o.forEach(i=>{vt(i,n)}):o&&typeof o=="object"&&vt(o,n)}return r&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var gr={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 ks(e){let t=gr[e.tagName]?gr[e.tagName]:e.tagName;return t==="link"&&e.attributes._cssText&&(t="style"),t}function Ds(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Ar=/([^\\]):hover/,Rs=new RegExp(Ar.source,"g");function yr(e,t){let r=t?.stylesWithHoverClass.get(e);if(r)return r;if(e.length>=1e6)return e;let n=Ns(e,{silent:!0});if(!n.stylesheet)return e;let s=[];if(n.stylesheet.rules.forEach(u=>{"selectors"in u&&(u.selectors||[]).forEach(l=>{Ar.test(l)&&s.push(l)})}),s.length===0)return e;let o=new RegExp(s.filter((u,l)=>s.indexOf(u)===l).sort((u,l)=>l.length-u.length).map(u=>Ds(u)).join("|"),"g"),i=e.replace(o,u=>{let l=u.replace(Rs,"$1.\\:hover");return`${u}, ${l}`});return t?.stylesWithHoverClass.set(e,i),i}function xs(){return{stylesWithHoverClass:new Map}}function Os(e,t){let{doc:r,hackCss:n,cache:s}=t;switch(e.type){case A.Document:return r.implementation.createDocument(null,"",null);case A.DocumentType:return r.implementation.createDocumentType(e.name||"html",e.publicId,e.systemId);case A.Element:{let o=ks(e),i;if(e.isSVG)i=r.createElementNS("http://www.w3.org/2000/svg",o);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(l){console.warn("Cannot define custom element",l)}i=r.createElement(o)}let u={};for(let l in e.attributes){if(!Object.prototype.hasOwnProperty.call(e.attributes,l))continue;let c=e.attributes[l];if(o==="option"&&l==="selected"&&c===!1||c===null)continue;if(c===!0&&(c=""),l.startsWith("rr_")){u[l]=c;continue}let d=o==="textarea"&&l==="value",h=o==="style"&&l==="_cssText";if(h&&n&&typeof c=="string"&&(c=yr(c,s)),(d||h)&&typeof c=="string"){let p=r.createTextNode(c);for(let m of Array.from(i.childNodes))m.nodeType===i.TEXT_NODE&&i.removeChild(m);i.appendChild(p);continue}try{if(e.isSVG&&l==="xlink:href")i.setAttributeNS("http://www.w3.org/1999/xlink",l,c.toString());else if(l==="onload"||l==="onclick"||l.substring(0,7)==="onmouse")i.setAttribute("_"+l,c.toString());else if(o==="meta"&&e.attributes["http-equiv"]==="Content-Security-Policy"&&l==="content"){i.setAttribute("csp-content",c.toString());continue}else o==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")||o==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&Nt(e.attributes.href)==="js"||(o==="img"&&e.attributes.srcset&&e.attributes.rr_dataURL?i.setAttribute("rrweb-original-srcset",e.attributes.srcset):i.setAttribute(l,c.toString()))}catch{}}for(let l in u){let c=u[l];if(o==="canvas"&&l==="rr_dataURL"){let d=r.createElement("img");d.onload=()=>{let h=i.getContext("2d");h&&h.drawImage(d,0,0,d.width,d.height)},d.src=c.toString(),i.RRNodeType&&(i.rr_dataURL=c.toString())}else if(o==="img"&&l==="rr_dataURL"){let d=i;d.currentSrc.startsWith("data:")||(d.setAttribute("rrweb-original-src",e.attributes.src),d.src=c.toString())}if(l==="rr_width")i.style.setProperty("width",c.toString());else if(l==="rr_height")i.style.setProperty("height",c.toString());else if(l==="rr_mediaCurrentTime"&&typeof c=="number")i.currentTime=c;else if(l==="rr_mediaState")switch(c){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 A.Text:return r.createTextNode(e.isStyle&&n?yr(e.textContent,s):e.textContent);case A.CDATA:return r instanceof XMLDocument?r.createCDATASection(e.textContent):null;case A.Comment:return r.createComment(e.textContent);default:return null}}function kt(e,t){let{doc:r,mirror:n,skipChild:s=!1,hackCss:o=!0,afterAppend:i,cache:u}=t;if(n.has(e.id)){let c=n.getNode(e.id),d=n.getMeta(c);if(rs(d,e))return n.getNode(e.id)}let l=Os(e,{doc:r,hackCss:o,cache:u});if(!l)return null;if(e.rootId&&n.getNode(e.rootId)!==r&&n.replace(e.rootId,r),e.type===A.Document&&(r.close(),r.open(),e.compatMode==="BackCompat"&&e.childNodes&&e.childNodes[0].type!==A.DocumentType&&(e.childNodes[0].type===A.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" "">')),l=r),n.add(l,e),(e.type===A.Document||e.type===A.Element)&&!s)for(let c of e.childNodes){let d=kt(c,{doc:r,mirror:n,skipChild:!1,hackCss:o,afterAppend:i,cache:u});if(!d){console.warn("Failed to rebuild",c);continue}if(c.isShadow&&wr(l)&&l.shadowRoot)l.shadowRoot.appendChild(d);else if(e.type===A.Document&&c.type==A.Element){let h=d,p=null;h.childNodes.forEach(m=>{m.nodeName==="BODY"&&(p=m)}),p?(h.removeChild(p),l.appendChild(d),h.appendChild(p)):l.appendChild(d)}else l.appendChild(d);i&&i(d,c.id)}return l}function As(e,t){function r(n){t(n)}for(let n of e.getIds())e.has(n)&&r(e.getNode(n))}function _s(e,t){let r=t.getMeta(e);if(r?.type!==A.Element)return;let n=e;for(let s in r.attributes){if(!(Object.prototype.hasOwnProperty.call(r.attributes,s)&&s.startsWith("rr_")))continue;let o=r.attributes[s];s==="rr_scrollLeft"&&(n.scrollLeft=o),s==="rr_scrollTop"&&(n.scrollTop=o)}}function Ls(e,t){let{doc:r,onVisit:n,hackCss:s=!0,afterAppend:o,cache:i,mirror:u=new Fe}=t,l=kt(e,{doc:r,mirror:u,skipChild:!1,hackCss:s,afterAppend:o,cache:i});return As(u,c=>{n&&n(c),_s(c,u)}),l}function _r(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var be=`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.`,Et={map:{},getId(){return console.error(be),-1},getNode(){return console.error(be),null},removeNodeFromMap(){console.error(be)},has(){return console.error(be),!1},reset(){console.error(be)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Et=new Proxy(Et,{get(e,t,r){return t==="map"&&console.error(be),Reflect.get(e,t,r)}}));function Lr(e,t,r={}){let n=null,s=0;return function(...o){let i=Date.now();!s&&r.leading===!1&&(s=i);let u=t-(i-s),l=this;u<=0||u>t?(n&&(Pt(n),n=null),s=i,e.apply(l,o)):!n&&r.trailing!==!1&&(n=Be(()=>{s=r.leading===!1?0:Date.now(),n=null,e.apply(l,o)},u))}}function We(e,t,r,n,s=window){let o=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,n?r:{set(i){Be(()=>{r.set.call(this,i)},0),o&&o.set&&o.set.call(this,i)}}),()=>We(e,t,o||{},!0)}function Ue(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()=>{}}}M.nowTimestamp=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(M.nowTimestamp=()=>new Date().getTime());function Pr(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 Fr(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Wr(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Dt(e){if(!e)return null;try{return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}catch{return null}}function Me(e,t,r,n,s){if(!e)return!1;let o=Dt(e);if(!o)return!1;let i=Ee(t,r);if(!s){let c=n&&o.matches(n);return i(o)&&!c}let u=fe(o,i),l=-1;return u<0?!1:(n&&(l=fe(o,Ee(null,n))),u>-1&&l<0?!0:u<l)}function Ur(e,t){return t.getId(e)!==-1}function Br(e,t){return t.getId(e)===Je}function Rt(e,t){if(Mt(e))return!1;let r=t.getId(e);return t.has(r)?e.parentNode&&e.parentNode.nodeType===e.DOCUMENT_NODE?!1:e.parentNode?Rt(e.parentNode,t):!0:!0}function Vr(e){return!!e.changedTouches}function zr(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 Hr(e){let t={},r=(s,o)=>{let i={value:s,parent:o,children:[]};return t[s.node.id]=i,i},n=[];for(let s of e){let{nextId:o,parentId:i}=s;if(o&&o in t){let u=t[o];if(u.parent){let l=u.parent.children.indexOf(u);u.parent.children.splice(l,0,r(s,u.parent))}else{let l=n.indexOf(u);n.splice(l,0,r(s,null))}continue}if(i in t){let u=t[i];u.children.push(r(s,u));continue}n.push(r(s,null))}return n}function xt(e,t){t(e.value);for(let r=e.children.length-1;r>=0;r--)xt(e.children[r],t)}function Gr(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function $r(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Ot(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(),s=Ot(r,t),o=n.height/r.clientHeight;return{x:n.x*s.relativeScale+s.x,y:n.y*s.relativeScale+s.y,relativeScale:o,absoluteScale:s.absoluteScale*o}}function jr(e){return!!e?.shadowRoot}function At(e,t){let r=e[t[0]];return t.length===1?r:At(r.cssRules[t[1]].cssRules,t.slice(2))}function Yr(e){let t=[...e],r=t.pop();return{positions:t,index:r}}function Xr(e){let t=new Set,r=[];for(let n=e.length;n--;){let s=e[n];t.has(s.id)||(r.push(s),t.add(s.id))}return r}var et=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 _t(e){let t=null;return e.getRootNode?.()?.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(t=e.getRootNode().host),t}function qr(e){let t=e,r;for(;r=_t(t);)t=r;return t}function Qr(e){let t=e.ownerDocument;if(!t)return!1;let r=qr(e);return t.contains(r)}function Jr(e){let t=e.ownerDocument;return t?t.contains(e)||Qr(e):!1}var Sr={};function Lt(e){let t=Sr[e];if(t)return t;let r=window.document,n=window[e];if(r&&typeof r.createElement=="function")try{let s=r.createElement("iframe");s.hidden=!0,r.head.appendChild(s);let o=s.contentWindow;o&&o[e]&&(n=o[e]),r.head.removeChild(s)}catch{}return Sr[e]=n.bind(window)}function ie(...e){return Lt("requestAnimationFrame")(...e)}function Be(...e){return Lt("setTimeout")(...e)}function Pt(...e){return Lt("clearTimeout")(...e)}var Ps=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:et,get _mirror(){return Et},clearTimeout:Pt,closestElementOfNode:Dt,getBaseDimension:Ot,getNestedRule:At,getPositionsAndIndex:Yr,getRootShadowHost:qr,getShadowHost:_t,getWindowHeight:Fr,getWindowScroll:Pr,getWindowWidth:Wr,hasShadowRoot:jr,hookSetter:We,inDom:Jr,isAncestorRemoved:Rt,isBlocked:Me,isIgnored:Br,isSerialized:Ur,isSerializedIframe:Gr,isSerializedStylesheet:$r,iterateResolveTree:xt,legacy_isTouchEvent:Vr,get nowTimestamp(){return M.nowTimestamp},on:_r,onRequestAnimationFrame:ie,patch:Ue,polyfill:zr,queueToResolveTrees:Hr,setTimeout:Be,shadowHostInDom:Qr,throttle:Lr,uniqueTextMutations:Xr},Symbol.toStringTag,{value:"Module"})),Zr=(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))(Zr||{}),Kr=(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))(Kr||{}),en=(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))(en||{}),tn=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(tn||{}),me=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(me||{}),rn=(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))(rn||{}),nn=(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))(nn||{}),Pe;function sn(e){Pe=e}function Fs(){Pe=void 0}var Xe=e=>Pe?((...r)=>{try{return e(...r)}catch(n){if(Pe&&Pe(n)===!0)return()=>{};throw n}}):e,Ie="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Le=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(_e=0;_e<Ie.length;_e++)Le[Ie.charCodeAt(_e)]=_e;var _e,Ws=function(e){var t=new Uint8Array(e),r,n=t.length,s="";for(r=0;r<n;r+=3)s+=Ie[t[r]>>2],s+=Ie[(t[r]&3)<<4|t[r+1]>>4],s+=Ie[(t[r+1]&15)<<2|t[r+2]>>6],s+=Ie[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},Us=function(e){var t=e.length*.75,r=e.length,n,s=0,o,i,u,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var c=new ArrayBuffer(t),d=new Uint8Array(c);for(n=0;n<r;n+=4)o=Le[e.charCodeAt(n)],i=Le[e.charCodeAt(n+1)],u=Le[e.charCodeAt(n+2)],l=Le[e.charCodeAt(n+3)],d[s++]=o<<2|i>>4,d[s++]=(i&15)<<4|u>>2,d[s++]=(u&3)<<6|l&63;return c},br=new Map;function Bs(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 on=(e,t,r)=>{if(!e||!(ln(e,t)||typeof e=="object"))return;let n=e.constructor.name,s=Bs(r,n),o=s.indexOf(e);return o===-1&&(o=s.length,s.push(e)),o};function qe(e,t,r){if(e instanceof Array)return e.map(n=>qe(n,t,r));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let n=e.constructor.name,s=Ws(e);return{rr_type:n,base64:s}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[qe(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:[qe(e.data,t,r),e.width,e.height]};if(ln(e,t)||typeof e=="object"){let n=e.constructor.name,s=on(e,t,r);return{rr_type:n,index:s}}}}return e}var an=(e,t,r)=>e.map(n=>qe(n,t,r)),ln=(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 Vs(e,t,r,n,s){let o=[],i=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let u of i)try{if(typeof t.CanvasRenderingContext2D.prototype[u]!="function")continue;let l=Ue(t.CanvasRenderingContext2D.prototype,u,function(c){return function(...d){return Me(this.canvas,r,n,s,!0)||Be(()=>{let h=an(d,t,this);e(this.canvas,{type:me["2D"],property:u,args:h})},0),c.apply(this,d)}});o.push(l)}catch{let l=We(t.CanvasRenderingContext2D.prototype,u,{set(c){e(this.canvas,{type:me["2D"],property:u,args:[c],setter:!0})}});o.push(l)}return()=>{o.forEach(u=>u())}}function zs(e){return e==="experimental-webgl"?"webgl":e}function vr(e,t,r,n,s){let o=[];try{let i=Ue(e.HTMLCanvasElement.prototype,"getContext",function(u){return function(l,...c){if(!Me(this,t,r,n,!0)){let d=zs(l);if("__context"in this||(this.__context=d),s&&["webgl","webgl2"].includes(d))if(c[0]&&typeof c[0]=="object"){let h=c[0];h.preserveDrawingBuffer||(h.preserveDrawingBuffer=!0)}else c.splice(0,1,{preserveDrawingBuffer:!0})}return u.apply(this,[l,...c])}});o.push(i)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach(i=>i())}}function Er(e,t,r,n,s,o,i,u){let l=[],c=Object.getOwnPropertyNames(e);for(let d of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(d))try{if(typeof e[d]!="function")continue;let h=Ue(e,d,function(p){return function(...m){let f=p.apply(this,m);if(on(f,u,this),"tagName"in this.canvas&&!Me(this.canvas,n,s,o,!0)){let b=an(m,u,this),y={type:t,property:d,args:b};r(this.canvas,y)}return f}});l.push(h)}catch{let h=We(e,d,{set(p){r(this.canvas,{type:t,property:d,args:[p],setter:!0})}});l.push(h)}return l}function Hs(e,t,r,n,s,o){let i=[];return i.push(...Er(t.WebGLRenderingContext.prototype,me.WebGL,e,r,n,s,o,t)),typeof t.WebGL2RenderingContext<"u"&&i.push(...Er(t.WebGL2RenderingContext.prototype,me.WebGL2,e,r,n,s,o,t)),()=>{i.forEach(u=>u())}}var Gs='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 $s(){let e=new Blob([Gs]);return URL.createObjectURL(e)}var wt=class{reset(){}freeze(){}unfreeze(){}lock(){}unlock(){}snapshot(){}addWindow(){}addShadowRoot(){}resetShadowRoots(){}},It=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=(u,l)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(u)||this.pendingCanvasMutations.set(u,[]),this.pendingCanvasMutations.get(u).push(l)};let{enableManualSnapshot:r,sampling:n="all",win:s,recordCanvas:o,errorHandler:i}=t;t.sampling=n,this.mutationCb=t.mutationCb,this.mirror=t.mirror,this.options=t,i&&sn(i),(o&&typeof n=="number"||r)&&(this.worker=this.initFPSWorker()),this.addWindow(s),!r&&Xe(()=>{o&&n==="all"&&(this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher()),o&&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:s,unblockSelector:o,recordCanvas:i,enableManualSnapshot:u}=this.options;if(!this.windowsSet.has(t)){if(u){this.windowsSet.add(t),this.windows.push(new WeakRef(t));return}Xe(()=>{if(i&&r==="all"&&this.initCanvasMutationObserver(t,n,s,o),i&&typeof r=="number"){let l=vr(t,n,s,o,!0);this.restoreHandlers.push(()=>{l()})}})(),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}ie(n=>this.takeSnapshot(n,!0,t))}initFPSWorker(){let t=new Worker($s());return t.onmessage=r=>{let n=r.data,{id:s}=n;if(this.snapshotInProgressMap.set(s,!1),!("base64"in n))return;let{base64:o,type:i,width:u,height:l}=n;this.mutationCb({id:s,type:me["2D"],commands:[{property:"clearRect",args:[0,0,u,l]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:o}],type:i}]},0,0,u,l]}]})},t}initCanvasFPSObserver(){let t;if(!this.windows.length&&!this.shadowDoms.size)return;let r=n=>{this.takeSnapshot(n,!1),t=ie(r)};t=ie(r),this.restoreH