@posthog/rrweb 0.0.35 → 0.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -56,7 +56,7 @@ https://www.w3ctech.com/topic/2226`));let M=v(...N);return M.postcssPlugin=E,M.p
56
56
  https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(E+`: \u91CC\u9762 postcss.plugin \u88AB\u5F03\u7528. \u8FC1\u79FB\u6307\u5357:
57
57
  https://www.w3ctech.com/topic/2226`));let M=v(...N);return M.postcssPlugin=E,M.postcssVersion=new d().version,M}let x;return Object.defineProperty(C,"postcss",{get(){return x||(x=C()),x}}),C.process=function(N,M,_){return y([C(_)]).process(N,M)},C},y.stringify=g,y.parse=c,y.fromJSON=a,y.list=l,y.comment=S=>new t(S),y.atRule=S=>new e(S),y.decl=S=>new i(S),y.rule=S=>new m(S),y.root=S=>new p(S),y.document=S=>new o(S),y.CssSyntaxError=s,y.Declaration=i,y.Container=r,y.Processor=d,y.Document=o,y.Comment=t,y.Warning=w,y.AtRule=e,y.Result=h,y.Input=u,y.Rule=m,y.Root=p,y.Node=n,f.registerPostcss(y),Xr=y,y.default=y,Xr}var Qr,mn;function Nl(){if(mn)return Qr;mn=1;let e=ut(),t=co(),r=uo();class s extends t{checkMissedSemicolon(){}comment(o){let a=new e;this.init(a,o[2]);let u=this.input.fromOffset(o[3])||this.input.fromOffset(this.input.css.length-1);a.source.end={column:u.col,line:u.line,offset:o[3]+1};let f=o[1].slice(2);if(f.slice(-2)==="*/"&&(f=f.slice(0,-2)),/^\s*$/.test(f))a.text="",a.raws.left=f,a.raws.right="";else{let l=f.match(/^(\s*)([^]*\S)(\s*)$/);a.text=l[2],a.raws.left=l[1],a.raws.right=l[3]}}createTokenizer(){this.tokenizer=r(this.input,{ignoreErrors:!0})}decl(o){o.length>1&&o.some(a=>a[0]==="word")&&super.decl(o)}doubleColon(){}endFile(){for(this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces;this.current.parent;)this.current=this.current.parent,this.current.raws.after="";this.root.source.end=this.getPosition(this.tokenizer.position())}precheckMissedSemicolon(o){let a=this.colon(o);if(a===!1)return;let u,f;for(u=a-1;u>=0&&o[u][0]!=="word";u--);if(u===0||u<0)return;for(f=u-1;f>=0;f--)if(o[f][0]!=="space"){f+=1;break}let l=o.slice(u),n=o.slice(f,u);o.splice(f,o.length-f),this.spaces=n.map(c=>c[1]).join(""),this.decl(l)}unclosedBracket(){}unexpectedClose(){this.current.raws.after+="}"}unknownWord(o){this.spaces+=o.map(a=>a[1]).join("")}unnamedAtrule(o){o.name=""}}return Qr=s,Qr}var Zr,gn;function Ol(){if(gn)return Zr;gn=1;let{Input:e}=mo(),t=Nl();return Zr=function(s,i){let o=new e(s,i),a=new t(o);return a.parse(),a.root},Zr}Ol();var Dl=mo();const J=vl(Dl);J.stringify;J.fromJSON;J.plugin;J.parse;J.list;J.document;J.comment;J.atRule;J.rule;J.decl;J.root;J.CssSyntaxError;J.Declaration;J.Container;J.Processor;J.Document;J.Comment;J.Warning;J.AtRule;J.Result;J.Input;J.Rule;J.Root;J.Node;var W=(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))(W||{});function Al(e){const t={},r=/;(?![^(]*\))/g,s=/:(.+)/,i=/\/\*.*?\*\//g;return e.replace(i,"").split(r).forEach(function(o){if(o){const a=o.split(s);a.length>1&&(t[is(a[0].trim())]=a[1].trim())}}),t}function yn(e){const t=[];for(const r in e){const s=e[r];if(typeof s!="string")continue;const i=kl(r);t.push(`${i}: ${s};`)}return t.join(" ")}const Tl=/-([a-z])/g,_l=/^--[a-zA-Z0-9-]+$/,is=e=>_l.test(e)?e:e.replace(Tl,(t,r)=>r?r.toUpperCase():""),Pl=/\B([A-Z])/g,kl=e=>e.replace(Pl,"-$1").toLowerCase();class we{constructor(...t){A(this,"parentElement",null),A(this,"parentNode",null),A(this,"ownerDocument"),A(this,"firstChild",null),A(this,"lastChild",null),A(this,"previousSibling",null),A(this,"nextSibling",null),A(this,"ELEMENT_NODE",1),A(this,"TEXT_NODE",3),A(this,"nodeType"),A(this,"nodeName"),A(this,"RRNodeType")}get childNodes(){const t=[];let r=this.firstChild;for(;r;)t.push(r),r=r.nextSibling;return t}contains(t){if(t instanceof we){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}class Ds extends we{constructor(...t){super(t),A(this,"nodeType",9),A(this,"nodeName","#document"),A(this,"compatMode","CSS1Compat"),A(this,"RRNodeType",W.Document),A(this,"textContent",null),this.ownerDocument=this}get documentElement(){return this.childNodes.find(t=>t.RRNodeType===W.Element&&t.tagName==="HTML")||null}get body(){var t;return((t=this.documentElement)==null?void 0:t.childNodes.find(r=>r.RRNodeType===W.Element&&r.tagName==="BODY"))||null}get head(){var t;return((t=this.documentElement)==null?void 0:t.childNodes.find(r=>r.RRNodeType===W.Element&&r.tagName==="HEAD"))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(t){const r=t.RRNodeType;if((r===W.Element||r===W.DocumentType)&&this.childNodes.some(i=>i.RRNodeType===r))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${r===W.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const s=As(this,t);return s.parentElement=null,s}insertBefore(t,r){const s=t.RRNodeType;if((s===W.Element||s===W.DocumentType)&&this.childNodes.some(o=>o.RRNodeType===s))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${s===W.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const i=bo(this,t,r);return i.parentElement=null,i}removeChild(t){return So(this,t)}open(){this.firstChild=null,this.lastChild=null}close(){}write(t){let r;if(t==='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'?r="-//W3C//DTD XHTML 1.0 Transitional//EN":t==='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'&&(r="-//W3C//DTD HTML 4.0 Transitional//EN"),r){const s=this.createDocumentType("html",r,"");this.open(),this.appendChild(s)}}createDocument(t,r,s){return new Ds}createDocumentType(t,r,s){const i=new go(t,r,s);return i.ownerDocument=this,i}createElement(t){const r=new qt(t);return r.ownerDocument=this,r}createElementNS(t,r){return this.createElement(r)}createTextNode(t){const r=new yo(t);return r.ownerDocument=this,r}createComment(t){const r=new wo(t);return r.ownerDocument=this,r}createCDATASection(t){const r=new vo(t);return r.ownerDocument=this,r}toString(){return"RRDocument"}}class go extends we{constructor(t,r,s){super(),A(this,"nodeType",10),A(this,"RRNodeType",W.DocumentType),A(this,"name"),A(this,"publicId"),A(this,"systemId"),A(this,"textContent",null),this.name=t,this.publicId=r,this.systemId=s,this.nodeName=t}toString(){return"RRDocumentType"}}class qt extends we{constructor(t){super(),A(this,"nodeType",1),A(this,"RRNodeType",W.Element),A(this,"tagName"),A(this,"attributes",{}),A(this,"shadowRoot",null),A(this,"scrollLeft"),A(this,"scrollTop"),this.tagName=t.toUpperCase(),this.nodeName=t.toUpperCase()}get textContent(){let t="";return this.childNodes.forEach(r=>t+=r.textContent),t}set textContent(t){this.firstChild=null,this.lastChild=null,this.appendChild(this.ownerDocument.createTextNode(t))}get classList(){return new Bl(this.attributes.class,t=>{this.attributes.class=t})}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const t=this.attributes.style?Al(this.attributes.style):{},r=/\B([A-Z])/g;return t.setProperty=(s,i,o)=>{if(r.test(s))return;const a=is(s);i?t[a]=i:delete t[a],o==="important"&&(t[a]+=" !important"),this.attributes.style=yn(t)},t.removeProperty=s=>{if(r.test(s))return"";const i=is(s),o=t[i]||"";return delete t[i],this.attributes.style=yn(t),o},t}getAttribute(t){return this.attributes[t]===void 0?null:this.attributes[t]}setAttribute(t,r){this.attributes[t]=r}setAttributeNS(t,r,s){this.setAttribute(r,s)}removeAttribute(t){delete this.attributes[t]}appendChild(t){return As(this,t)}insertBefore(t,r){return bo(this,t,r)}removeChild(t){return So(this,t)}attachShadow(t){const r=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=r,r}dispatchEvent(t){return!0}toString(){let t="";for(const r in this.attributes)t+=`${r}="${this.attributes[r]}" `;return`${this.tagName} ${t}`}}class Ll extends qt{constructor(){super(...arguments),A(this,"currentTime"),A(this,"volume"),A(this,"paused"),A(this,"muted"),A(this,"playbackRate"),A(this,"loop")}attachShadow(t){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}class Fl extends qt{constructor(){super(...arguments),A(this,"tagName","DIALOG"),A(this,"nodeName","DIALOG")}get isModal(){return this.getAttribute("rr_open_mode")==="modal"}get open(){return this.getAttribute("open")!==null}close(){this.removeAttribute("open"),this.removeAttribute("rr_open_mode")}show(){this.setAttribute("open",""),this.setAttribute("rr_open_mode","non-modal")}showModal(){this.setAttribute("open",""),this.setAttribute("rr_open_mode","modal")}}class yo extends we{constructor(t){super(),A(this,"nodeType",3),A(this,"nodeName","#text"),A(this,"RRNodeType",W.Text),A(this,"data"),this.data=t}get textContent(){return this.data}set textContent(t){this.data=t}toString(){return`RRText text=${JSON.stringify(this.data)}`}}class wo extends we{constructor(t){super(),A(this,"nodeType",8),A(this,"nodeName","#comment"),A(this,"RRNodeType",W.Comment),A(this,"data"),this.data=t}get textContent(){return this.data}set textContent(t){this.data=t}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}class vo extends we{constructor(t){super(),A(this,"nodeName","#cdata-section"),A(this,"nodeType",4),A(this,"RRNodeType",W.CDATA),A(this,"data"),this.data=t}get textContent(){return this.data}set textContent(t){this.data=t}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}class Bl{constructor(t,r){if(A(this,"onChange"),A(this,"classes",[]),A(this,"add",(...s)=>{for(const i of s){const o=String(i);this.classes.indexOf(o)>=0||this.classes.push(o)}this.onChange&&this.onChange(this.classes.join(" "))}),A(this,"remove",(...s)=>{this.classes=this.classes.filter(i=>s.indexOf(i)===-1),this.onChange&&this.onChange(this.classes.join(" "))}),t){const s=t.trim().split(/\s+/);this.classes.push(...s)}this.onChange=r}}function As(e,t){return t.parentNode&&t.parentNode.removeChild(t),e.lastChild?(e.lastChild.nextSibling=t,t.previousSibling=e.lastChild):(e.firstChild=t,t.previousSibling=null),e.lastChild=t,t.nextSibling=null,t.parentNode=e,t.parentElement=e,t.ownerDocument=e.ownerDocument,t}function bo(e,t,r){if(!r)return As(e,t);if(r.parentNode!==e)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return t===r||(t.parentNode&&t.parentNode.removeChild(t),t.previousSibling=r.previousSibling,r.previousSibling=t,t.nextSibling=r,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,t.parentElement=e,t.parentNode=e,t.ownerDocument=e.ownerDocument),t}function So(e,t){if(t.parentNode!==e)throw new Error("Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode.");return t.previousSibling?t.previousSibling.nextSibling=t.nextSibling:e.firstChild=t.nextSibling,t.nextSibling?t.nextSibling.previousSibling=t.previousSibling:e.lastChild=t.previousSibling,t.previousSibling=null,t.nextSibling=null,t.parentElement=null,t.parentNode=null,t}var ce=(e=>(e[e.PLACEHOLDER=0]="PLACEHOLDER",e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",e[e.ENTITY_NODE=6]="ENTITY_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE",e))(ce||{});const ns={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},Ul={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"};let ve=null;function Dt(e,t,r,s=t.mirror||t.ownerDocument.mirror){e=Wl(e,t,r,s),Co(e,t,r,s),$l(e,t,r)}function Wl(e,t,r,s){var i;if(r.afterAppend&&!ve&&(ve=new WeakSet,setTimeout(()=>{ve=null},0)),!Ts(e,t)){const o=At(t,r.mirror,s);(i=e.parentNode)==null||i.replaceChild(o,e),e=o}switch(t.RRNodeType){case W.Document:{if(!Ve(e,t,r.mirror,s)){const o=s.getMeta(t);o&&(r.mirror.removeNodeFromMap(e),e.close(),e.open(),r.mirror.add(e,o),ve==null||ve.add(e))}break}case W.Element:{const o=e,a=t;switch(a.tagName){case"IFRAME":{const u=e.contentDocument;if(!u)break;Dt(u,t.contentDocument,r,s);break}}a.shadowRoot&&(o.shadowRoot||o.attachShadow({mode:"open"}),Co(o.shadowRoot,a.shadowRoot,r,s)),zl(o,a,s);break}}return e}function $l(e,t,r){var s;switch(t.RRNodeType){case W.Document:{const i=t.scrollData;i&&r.applyScroll(i,!0);break}case W.Element:{const i=e,o=t;switch(o.scrollData&&r.applyScroll(o.scrollData,!0),o.inputData&&r.applyInput(o.inputData),o.tagName){case"AUDIO":case"VIDEO":{const a=e,u=o;u.paused!==void 0&&(u.paused?a.pause():a.play()),u.muted!==void 0&&(a.muted=u.muted),u.volume!==void 0&&(a.volume=u.volume),u.currentTime!==void 0&&(a.currentTime=u.currentTime),u.playbackRate!==void 0&&(a.playbackRate=u.playbackRate),u.loop!==void 0&&(a.loop=u.loop);break}case"CANVAS":{const a=t;if(a.rr_dataURL!==null){const u=document.createElement("img");u.onload=()=>{const f=i.getContext("2d");f&&f.drawImage(u,0,0,u.width,u.height)},u.src=a.rr_dataURL}a.canvasMutations.forEach(u=>r.applyCanvas(u.event,u.mutation,e));break}case"STYLE":{const a=i.sheet;a&&t.rules.forEach(u=>r.applyStyleSheetMutation(u,a));break}case"DIALOG":{const a=i,u=o,f=a.open,l=a.matches("dialog:modal"),n=u.open,c=u.isModal,d=l!==c,h=f!==n;if((d||f&&h)&&a.close(),n&&(h||d))try{c?a.showModal():a.show()}catch(p){console.warn(p)}break}}break}case W.Text:case W.Comment:case W.CDATA:{e.textContent!==t.data&&(e.textContent=t.data);break}}ve!=null&&ve.has(e)&&(ve.delete(e),(s=r.afterAppend)==null||s.call(r,e,r.mirror.getId(e)))}function zl(e,t,r){const s=e.attributes,i=t.attributes;for(const o in i){const a=i[o],u=r.getMeta(t);if(u!=null&&u.isSVG&&ns[o])e.setAttributeNS(ns[o],o,a);else if(t.tagName==="CANVAS"&&o==="rr_dataURL"){const f=document.createElement("img");f.src=a,f.onload=()=>{const l=e.getContext("2d");l&&l.drawImage(f,0,0,f.width,f.height)}}else{if(t.tagName==="IFRAME"&&o==="srcdoc")continue;try{e.setAttribute(o,a)}catch(f){console.warn(f)}}}for(const{name:o}of Array.from(s))o in i||e.removeAttribute(o);t.scrollLeft&&(e.scrollLeft=t.scrollLeft),t.scrollTop&&(e.scrollTop=t.scrollTop)}function Co(e,t,r,s){const i=Array.from(e.childNodes),o=t.childNodes;if(i.length===0&&o.length===0)return;let a=0,u=i.length-1,f=0,l=o.length-1,n=i[a],c=i[u],d=o[f],h=o[l],p,m;for(;a<=u&&f<=l;)if(n===void 0)n=i[++a];else if(c===void 0)c=i[--u];else if(Ve(n,d,r.mirror,s))n=i[++a],d=o[++f];else if(Ve(c,h,r.mirror,s))c=i[--u],h=o[--l];else if(Ve(n,h,r.mirror,s)){try{e.insertBefore(n,c.nextSibling)}catch(y){console.warn(y)}n=i[++a],h=o[--l]}else if(Ve(c,d,r.mirror,s)){try{e.insertBefore(c,n)}catch(y){console.warn(y)}c=i[--u],d=o[++f]}else{if(!p){p={};for(let S=a;S<=u;S++){const E=i[S];E&&r.mirror.hasNode(E)&&(p[r.mirror.getId(E)]=S)}}m=p[s.getId(d)];const y=i[m];if(m!==void 0&&y&&Ve(y,d,r.mirror,s)){try{e.insertBefore(y,n)}catch(S){console.warn(S)}i[m]=void 0}else{const S=At(d,r.mirror,s);e.nodeName==="#document"&&n&&(S.nodeType===S.DOCUMENT_TYPE_NODE&&n.nodeType===n.DOCUMENT_TYPE_NODE||S.nodeType===S.ELEMENT_NODE&&n.nodeType===n.ELEMENT_NODE)&&(e.removeChild(n),r.mirror.removeNodeFromMap(n),n=i[++a]);try{e.insertBefore(S,n||null)}catch(E){console.warn(E)}}d=o[++f]}if(a>u){const y=o[l+1];let S=null;for(y&&(S=r.mirror.getNode(s.getId(y)));f<=l;++f){const E=At(o[f],r.mirror,s);try{e.insertBefore(E,S)}catch(v){console.warn(v)}}}else if(f>l)for(;a<=u;a++){const y=i[a];if(!(!y||y.parentNode!==e))try{e.removeChild(y),r.mirror.removeNodeFromMap(y)}catch(S){console.warn(S)}}let g=e.firstChild,w=t.firstChild;for(;g!==null&&w!==null;)Dt(g,w,r,s),g=g.nextSibling,w=w.nextSibling}function At(e,t,r){const s=r.getId(e),i=r.getMeta(e);let o=null;if(s>-1&&(o=t.getNode(s)),o!==null&&Ts(o,e))return o;switch(e.RRNodeType){case W.Document:o=new Document;break;case W.DocumentType:o=document.implementation.createDocumentType(e.name,e.publicId,e.systemId);break;case W.Element:{let a=e.tagName.toLowerCase();a=Ul[a]||a,i&&"isSVG"in i&&(i!=null&&i.isSVG)?o=document.createElementNS(ns.svg,a):o=document.createElement(e.tagName);break}case W.Text:o=document.createTextNode(e.data);break;case W.Comment:o=document.createComment(e.data);break;case W.CDATA:o=document.createCDATASection(e.data);break}i&&t.add(o,L({},i));try{ve==null||ve.add(o)}catch(a){}return o}function Ts(e,t){return e.nodeType!==t.nodeType?!1:e.nodeType!==e.ELEMENT_NODE||e.tagName.toUpperCase()===t.tagName}function Ve(e,t,r,s){const i=r.getId(e),o=s.getId(t);return i===-1||i!==o?!1:Ts(e,t)}class Ke extends Ds{constructor(t){super(),A(this,"UNSERIALIZED_STARTING_ID",-2),A(this,"_unserializedId",this.UNSERIALIZED_STARTING_ID),A(this,"mirror",eu()),A(this,"scrollData",null),t&&(this.mirror=t)}get unserializedId(){return this._unserializedId--}createDocument(t,r,s){return new Ke}createDocumentType(t,r,s){const i=new Vl(t,r,s);return i.ownerDocument=this,i}createElement(t){const r=t.toUpperCase();let s;switch(r){case"AUDIO":case"VIDEO":s=new ql(r);break;case"IFRAME":s=new Yl(r,this.mirror);break;case"CANVAS":s=new Hl(r);break;case"STYLE":s=new Gl(r);break;case"DIALOG":s=new jl(r);break;default:s=new jt(r);break}return s.ownerDocument=this,s}createComment(t){const r=new Xl(t);return r.ownerDocument=this,r}createCDATASection(t){const r=new Ql(t);return r.ownerDocument=this,r}createTextNode(t){const r=new Jl(t);return r.ownerDocument=this,r}destroyTree(){this.firstChild=null,this.lastChild=null,this.mirror.reset()}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID}}const Vl=go;class jt extends qt{constructor(){super(...arguments),A(this,"inputData",null),A(this,"scrollData",null)}}class ql extends Ll{}class jl extends Fl{}class Hl extends jt{constructor(){super(...arguments),A(this,"rr_dataURL",null),A(this,"canvasMutations",[])}getContext(){return null}}class Gl extends jt{constructor(){super(...arguments),A(this,"rules",[])}}class Yl extends jt{constructor(t,r){super(t),A(this,"contentDocument",new Ke),this.contentDocument.mirror=r}}const Jl=yo,Xl=wo,Ql=vo;function Zl(e){return e instanceof HTMLFormElement?"FORM":e.tagName.toUpperCase()}function Eo(e,t,r,s){let i;switch(e.nodeType){case ce.DOCUMENT_NODE:s&&s.nodeName==="IFRAME"?i=s.contentDocument:(i=t,i.compatMode=e.compatMode);break;case ce.DOCUMENT_TYPE_NODE:{const a=e;i=t.createDocumentType(a.name,a.publicId,a.systemId);break}case ce.ELEMENT_NODE:{const a=e,u=Zl(a);i=t.createElement(u);const f=i;for(const{name:l,value:n}of Array.from(a.attributes))f.attributes[l]=n;a.scrollLeft&&(f.scrollLeft=a.scrollLeft),a.scrollTop&&(f.scrollTop=a.scrollTop);break}case ce.TEXT_NODE:i=t.createTextNode(e.textContent||"");break;case ce.CDATA_SECTION_NODE:i=t.createCDATASection(e.data);break;case ce.COMMENT_NODE:i=t.createComment(e.textContent||"");break;case ce.DOCUMENT_FRAGMENT_NODE:i=s.attachShadow({mode:"open"});break;default:return null}let o=r.getMeta(e);return t instanceof Ke&&(o||(o=xo(i,t.unserializedId),r.add(e,o)),t.mirror.add(i,L({},o))),i}function Kl(e,t=wl(),r=new Ke){function s(i,o){const a=Eo(i,r,t,o);if(a!==null)if((o==null?void 0:o.nodeName)!=="IFRAME"&&i.nodeType!==ce.DOCUMENT_FRAGMENT_NODE&&(o==null||o.appendChild(a),a.parentNode=o,a.parentElement=o),i.nodeName==="IFRAME"){const u=i.contentDocument;u&&s(u,a)}else(i.nodeType===ce.DOCUMENT_NODE||i.nodeType===ce.ELEMENT_NODE||i.nodeType===ce.DOCUMENT_FRAGMENT_NODE)&&(i.nodeType===ce.ELEMENT_NODE&&i.shadowRoot&&s(i.shadowRoot,a),i.childNodes.forEach(u=>s(u,a)))}return s(e,null),r}function eu(){return new tu}class tu{constructor(){A(this,"idNodeMap",new Map),A(this,"nodeMetaMap",new WeakMap)}getId(t){var r;if(!t)return-1;const s=(r=this.getMeta(t))==null?void 0:r.id;return s!=null?s:-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){const r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(s=>this.removeNodeFromMap(s))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){const s=r.id;this.idNodeMap.set(s,t),this.nodeMetaMap.set(t,r)}replace(t,r){const s=this.getNode(t);if(s){const i=this.nodeMetaMap.get(s);i&&this.nodeMetaMap.set(r,i)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function xo(e,t){switch(e.RRNodeType){case W.Document:return{id:t,type:e.RRNodeType,childNodes:[]};case W.DocumentType:{const r=e;return{id:t,type:e.RRNodeType,name:r.name,publicId:r.publicId,systemId:r.systemId}}case W.Element:return{id:t,type:e.RRNodeType,tagName:e.tagName.toLowerCase(),attributes:{},childNodes:[]};case W.Text:return{id:t,type:e.RRNodeType,textContent:e.textContent||""};case W.Comment:return{id:t,type:e.RRNodeType,textContent:e.textContent||""};case W.CDATA:return{id:t,type:e.RRNodeType,textContent:""}}}const wn={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},vn={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},vt={};function ru(e){var t,r;const s=(r=(t=globalThis==null?void 0:globalThis.Zone)==null?void 0:t.__symbol__)==null?void 0:r.call(t,e);if(s&&globalThis[s])return globalThis[s]}function _s(e){if(vt[e])return vt[e];const t=ru(e)||globalThis[e],r=t.prototype,s=e in wn?wn[e]:void 0,i=!!(s&&s.every(u=>{var f,l;return!!((l=(f=Object.getOwnPropertyDescriptor(r,u))==null?void 0:f.get)!=null&&l.toString().includes("[native code]"))})),o=e in vn?vn[e]:void 0,a=!!(o&&o.every(u=>{var f;return typeof r[u]=="function"&&((f=r[u])==null?void 0:f.toString().includes("[native code]"))}));if(i&&a)return vt[e]=t.prototype,t.prototype;try{const u=document.createElement("iframe");document.body.appendChild(u);const f=u.contentWindow;if(!f)return t.prototype;const l=f[e].prototype;return document.body.removeChild(u),l?vt[e]=l:r}catch(u){return r}}const Kr={};function _e(e,t,r){var s;const i=`${e}.${String(r)}`;if(Kr[i])return Kr[i].call(t);const o=_s(e),a=(s=Object.getOwnPropertyDescriptor(o,r))==null?void 0:s.get;return a?(Kr[i]=a,a.call(t)):t[r]}const es={};function Mo(e,t,r){const s=`${e}.${String(r)}`;if(es[s])return es[s].bind(t);const o=_s(e)[r];return typeof o!="function"?t[r]:(es[s]=o,o.bind(t))}function su(e){return _e("Node",e,"childNodes")}function iu(e){return _e("Node",e,"parentNode")}function nu(e){return _e("Node",e,"parentElement")}function ou(e){return _e("Node",e,"textContent")}function au(e,t){return Mo("Node",e,"contains")(t)}function lu(e){return Mo("Node",e,"getRootNode")()}function uu(e){return!e||!("host"in e)?null:_e("ShadowRoot",e,"host")}function cu(e){return e.styleSheets}function hu(e){return!e||!("shadowRoot"in e)?null:_e("Element",e,"shadowRoot")}function fu(e,t){return _e("Element",e,"querySelector")(t)}function du(e,t){return _e("Element",e,"querySelectorAll")(t)}function Ro(){return _s("MutationObserver").constructor}function Be(e,t,r){try{if(!(t in e))return()=>{};const s=e[t],i=r(s);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:s}})),e[t]=i,()=>{e[t]=s}}catch(s){return()=>{}}}const U={childNodes:su,parentNode:iu,parentElement:nu,textContent:ou,contains:au,getRootNode:lu,host:uu,styleSheets:cu,shadowRoot:hu,querySelector:fu,querySelectorAll:du,mutationObserver:Ro,patch:Be};function ae(e,t,r=document){const s={capture:!0,passive:!0};return r.addEventListener(e,t,s),()=>r.removeEventListener(e,t,s)}const qe=`Please stop import mirror directly. Instead of that,\r
58
58
  now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
59
- or you can use record.mirror to access the mirror instance during recording.`;exports.mirror={map:{},getId(){return console.error(qe),-1},getNode(){return console.error(qe),null},removeNodeFromMap(){console.error(qe)},has(){return console.error(qe),!1},reset(){console.error(qe)}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(exports.mirror=new Proxy(exports.mirror,{get(e,t,r){return t==="map"&&console.error(qe),Reflect.get(e,t,r)}}));function Ze(e,t,r={}){let s=null,i=0;return function(...o){const a=Date.now();!i&&r.leading===!1&&(i=a);const u=t-(a-i),f=this;u<=0||u>t?(s&&(clearTimeout(s),s=null),i=a,e.apply(f,o)):!s&&r.trailing!==!1&&(s=setTimeout(()=>{i=r.leading===!1?0:Date.now(),s=null,e.apply(f,o)},u))}}function ht(e,t,r,s,i=window){const o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,s?r:{set(a){setTimeout(()=>{r.set.call(this,a)},0),o&&o.set&&o.set.call(this,a)}}),()=>ht(e,t,o||{},!0)}let ot=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(ot=()=>new Date().getTime());function Ps(e){var t,r,s,i;const o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:o.documentElement.scrollLeft||(o==null?void 0:o.body)&&((t=U.parentElement(o.body))==null?void 0:t.scrollLeft)||((r=o==null?void 0:o.body)==null?void 0:r.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:(o==null?void 0:o.documentElement.scrollTop)||(o==null?void 0:o.body)&&((s=U.parentElement(o.body))==null?void 0:s.scrollTop)||((i=o==null?void 0:o.body)==null?void 0:i.scrollTop)||0}}function ks(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Ls(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Fs(e){return e?e.nodeType===e.ELEMENT_NODE?e:U.parentElement(e):null}function le(e,t,r,s){if(!e)return!1;const i=Fs(e);if(!i)return!1;try{if(typeof t=="string"){if(i.classList.contains(t)||s&&i.closest("."+t)!==null)return!0}else if(Ot(i,t,s))return!0}catch(o){}return!!(r&&(i.matches(r)||s&&i.closest(r)!==null))}function Io(e,t){return t.getId(e)!==-1}function xt(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===nt}function Bs(e,t){if(tt(e))return!1;const r=t.getId(e);if(!t.has(r))return!0;const s=U.parentNode(e);return s&&s.nodeType===e.DOCUMENT_NODE?!1:s?Bs(s,t):!0}function Tt(e){return!!e.changedTouches}function Us(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function No(e){const t={},r=(i,o)=>{const a={value:i,parent:o,children:[]};return t[i.node.id]=a,a},s=[];for(const i of e){const{nextId:o,parentId:a}=i;if(o&&o in t){const u=t[o];if(u.parent){const f=u.parent.children.indexOf(u);u.parent.children.splice(f,0,r(i,u.parent))}else{const f=s.indexOf(u);s.splice(f,0,r(i,null))}continue}if(a in t){const u=t[a];u.children.push(r(i,u));continue}s.push(r(i,null))}return s}function Ws(e,t){t(e.value);for(let r=e.children.length-1;r>=0;r--)Ws(e.children[r],t)}function Qe(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function $s(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function zs(e,t){var r,s;const i=(s=(r=e.ownerDocument)==null?void 0:r.defaultView)==null?void 0:s.frameElement;if(!i||i===t)return{x:0,y:0,relativeScale:1,absoluteScale:1};const o=i.getBoundingClientRect(),a=zs(i,t),u=o.height/i.clientHeight;return{x:o.x*a.relativeScale+a.x,y:o.y*a.relativeScale+a.y,relativeScale:u,absoluteScale:a.absoluteScale*u}}function Oe(e){return e?e instanceof we&&"shadowRoot"in e?!!e.shadowRoot:!!U.shadowRoot(e):!1}function Ye(e,t){const r=e[t[0]];return t.length===1?r:Ye(r.cssRules[t[1]].cssRules,t.slice(2))}function os(e){const t=[...e],r=t.pop();return{positions:t,index:r}}function Oo(e){const t=new Set,r=[];for(let s=e.length;s--;){const i=e[s];t.has(i.id)||(r.push(i),t.add(i.id))}return r}class Vs{constructor(){I(this,"id",1),I(this,"styleIDMap",new WeakMap),I(this,"idStyleMap",new Map)}getId(t){var r;return(r=this.styleIDMap.get(t))!=null?r:-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let s;return r===void 0?s=this.id++:s=r,this.styleIDMap.set(t,s),this.idStyleMap.set(s,t),s}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 qs(e){var t;let r=null;return"getRootNode"in e&&((t=U.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&U.host(U.getRootNode(e))&&(r=U.host(U.getRootNode(e))),r}function Do(e){let t=e,r;for(;r=qs(t);)t=r;return t}function Ao(e){const t=e.ownerDocument;if(!t)return!1;const r=Do(e);return U.contains(t,r)}function js(e){const t=e.ownerDocument;return t?U.contains(t,e)||Ao(e):!1}const pu=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:Vs,get _mirror(){return exports.mirror},closestElementOfNode:Fs,getBaseDimension:zs,getNestedRule:Ye,getPositionsAndIndex:os,getRootShadowHost:Do,getShadowHost:qs,getWindowHeight:ks,getWindowScroll:Ps,getWindowWidth:Ls,hasShadowRoot:Oe,hookSetter:ht,inDom:js,isAncestorRemoved:Bs,isBlocked:le,isIgnored:xt,isSerialized:Io,isSerializedIframe:Qe,isSerializedStylesheet:$s,iterateResolveTree:Ws,legacy_isTouchEvent:Tt,get nowTimestamp(){return ot},on:ae,polyfill:Us,queueToResolveTrees:No,shadowHostInDom:Ao,throttle:Ze,uniqueTextMutations:Oo},Symbol.toStringTag,{value:"Module"}));var P=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(P||{}),T=(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))(T||{}),q=(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))(q||{}),Ce=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Ce||{}),Me=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Me||{}),Ne=(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))(Ne||{}),V=(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))(V||{}),Ee=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(Ee||{});function bn(e){return"__ln"in e}class mu{constructor(){I(this,"length",0),I(this,"head",null),I(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let s=0;s<t;s++)r=(r==null?void 0:r.next)||null;return r}addNode(t){const r={value:t,previous:null,next:null};if(t.__ln=r,t.previousSibling&&bn(t.previousSibling)){const s=t.previousSibling.__ln.next;r.next=s,r.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=r,s&&(s.previous=r)}else if(t.nextSibling&&bn(t.nextSibling)&&t.nextSibling.__ln.previous){const s=t.nextSibling.__ln.previous;r.previous=s,r.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=r,s&&(s.next=r)}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;r.next===null&&(this.tail=r),this.length++}removeNode(t){const r=t.__ln;this.head&&(r.previous?(r.previous.next=r.next,r.next?r.next.previous=r.previous:this.tail=r.previous):(this.head=r.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}}const Sn=(e,t)=>`${e}@${t}`;class gu{constructor(){I(this,"frozen",!1),I(this,"locked",!1),I(this,"texts",[]),I(this,"attributes",[]),I(this,"attributeMap",new WeakMap),I(this,"removes",[]),I(this,"mapRemoves",[]),I(this,"movedMap",{}),I(this,"addedSet",new Set),I(this,"movedSet",new Set),I(this,"droppedSet",new Set),I(this,"removesSubTreeCache",new Set),I(this,"mutationCb"),I(this,"blockClass"),I(this,"blockSelector"),I(this,"maskTextClass"),I(this,"maskTextSelector"),I(this,"inlineStylesheet"),I(this,"maskInputOptions"),I(this,"maskTextFn"),I(this,"maskInputFn"),I(this,"keepIframeSrcFn"),I(this,"recordCanvas"),I(this,"inlineImages"),I(this,"slimDOMOptions"),I(this,"dataURLOptions"),I(this,"doc"),I(this,"mirror"),I(this,"iframeManager"),I(this,"stylesheetManager"),I(this,"shadowDomManager"),I(this,"canvasManager"),I(this,"processedNodeManager"),I(this,"unattachedDoc"),I(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),I(this,"emit",()=>{if(this.frozen||this.locked)return;const t=[],r=new Set,s=new mu,i=f=>{let l=f,n=nt;for(;n===nt;)l=l&&l.nextSibling,n=l&&this.mirror.getId(l);return n},o=f=>{const l=U.parentNode(f);if(!l||!js(f)||l.tagName==="TEXTAREA")return;const n=tt(l)?this.mirror.getId(qs(f)):this.mirror.getId(l),c=i(f);if(n===-1||c===-1)return s.addNode(f);const d=Ge(f,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:h=>{Qe(h,this.mirror)&&this.iframeManager.addIframe(h),$s(h,this.mirror)&&this.stylesheetManager.trackLinkElement(h),Oe(f)&&this.shadowDomManager.addShadowRoot(U.shadowRoot(f),this.doc)},onIframeLoad:(h,p)=>{this.iframeManager.attachIframe(h,p),this.shadowDomManager.observeAttachShadow(h)},onStylesheetLoad:(h,p)=>{this.stylesheetManager.attachLinkElement(h,p)}});d&&(t.push({parentId:n,nextId:c,node:d}),r.add(d.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const f of this.movedSet)Cn(this.removesSubTreeCache,f,this.mirror)&&!this.movedSet.has(U.parentNode(f))||o(f);for(const f of this.addedSet)!En(this.droppedSet,f)&&!Cn(this.removesSubTreeCache,f,this.mirror)||En(this.movedSet,f)?o(f):this.droppedSet.add(f);let a=null;for(;s.length;){let f=null;if(a){const l=this.mirror.getId(U.parentNode(a.value)),n=i(a.value);l!==-1&&n!==-1&&(f=a)}if(!f){let l=s.tail;for(;l;){const n=l;if(l=l.previous,n){const c=this.mirror.getId(U.parentNode(n.value));if(i(n.value)===-1)continue;if(c!==-1){f=n;break}else{const h=n.value,p=U.parentNode(h);if(p&&p.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const m=U.host(p);if(this.mirror.getId(m)!==-1){f=n;break}}}}}}if(!f){for(;s.head;)s.removeNode(s.head.value);break}a=f.previous,s.removeNode(f.value),o(f.value)}const u={texts:this.texts.map(f=>{const l=f.node,n=U.parentNode(l);return n&&n.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(n),{id:this.mirror.getId(l),value:f.value}}).filter(f=>!r.has(f.id)).filter(f=>this.mirror.has(f.id)),attributes:this.attributes.map(f=>{const{attributes:l}=f;if(typeof l.style=="string"){const n=JSON.stringify(f.styleDiff),c=JSON.stringify(f._unchangedStyles);n.length<l.style.length&&(n+c).split("var(").length===l.style.split("var(").length&&(l.style=f.styleDiff)}return{id:this.mirror.getId(f.node),attributes:l}}).filter(f=>!r.has(f.id)).filter(f=>this.mirror.has(f.id)),removes:this.removes,adds:t};!u.texts.length&&!u.attributes.length&&!u.removes.length&&!u.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(u))}),I(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r)),r.attributes.value=Array.from(U.childNodes(t),s=>U.textContent(s)||"").join("")}),I(this,"processMutation",t=>{if(!xt(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const r=U.textContent(t.target);!le(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:Hn(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,Fs(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{const r=t.target;let s=t.attributeName,i=t.target.getAttribute(s);if(s==="value"){const a=ds(r);i=fs({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:a,value:i,maskInputFn:this.maskInputFn})}if(le(t.target,this.blockClass,this.blockSelector,!1)||i===t.oldValue)return;let o=this.attributeMap.get(t.target);if(r.tagName==="IFRAME"&&s==="src"&&!this.keepIframeSrcFn(i))if(!r.contentDocument)s="rr_src";else return;if(o||(o={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(t.target,o)),s==="type"&&r.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!jn(r.tagName,s))if(o.attributes[s]=qn(this.doc,Ae(r.tagName),Ae(s),i,r,this.dataURLOptions),s==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(u){this.unattachedDoc=this.doc}const a=this.unattachedDoc.createElement("span");t.oldValue&&a.setAttribute("style",t.oldValue);for(const u of Array.from(r.style)){const f=r.style.getPropertyValue(u),l=r.style.getPropertyPriority(u);f!==a.style.getPropertyValue(u)||l!==a.style.getPropertyPriority(u)?l===""?o.styleDiff[u]=f:o.styleDiff[u]=[f,l]:o._unchangedStyles[u]=[f,l]}for(const u of Array.from(a.style))r.style.getPropertyValue(u)===""&&(o.styleDiff[u]=!1)}else s==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?o.attributes.rr_open_mode="modal":o.attributes.rr_open_mode="non-modal");break}case"childList":{if(le(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{const s=this.mirror.getId(r),i=tt(t.target)?this.mirror.getId(U.host(t.target)):this.mirror.getId(t.target);le(t.target,this.blockClass,this.blockSelector,!1)||xt(r,this.mirror,this.slimDOMOptions)||!Io(r,this.mirror)||(this.addedSet.has(r)?(as(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&s===-1||Bs(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[Sn(s,i)]?as(this.movedSet,r):(this.removes.push({parentId:i,id:s,isShadow:tt(t.target)&&rt(t.target)?!0:void 0}),yu(r,this.removesSubTreeCache))),this.mapRemoves.push(r))});break}}}),I(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(xt(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let s=null;r&&this.mirror.hasNode(r)&&(s=this.mirror.getId(r)),s&&s!==-1&&(this.movedMap[Sn(this.mirror.getId(t),s)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);le(t,this.blockClass,this.blockSelector,!1)||(U.childNodes(t).forEach(s=>this.genAdds(s)),Oe(t)&&U.childNodes(U.shadowRoot(t)).forEach(s=>{this.processedNodeManager.add(s,this),this.genAdds(s,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(r=>{this[r]=t[r]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}destroy(){for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift())}}function as(e,t){e.delete(t),U.childNodes(t).forEach(r=>as(e,r))}function yu(e,t){const r=[e];for(;r.length;){const s=r.pop();t.has(s)||(t.add(s),U.childNodes(s).forEach(i=>r.push(i)))}}function Cn(e,t,r){return e.size===0?!1:wu(e,t)}function wu(e,t,r){const s=U.parentNode(t);return s?e.has(s):!1}function En(e,t){return e.size===0?!1:To(e,t)}function To(e,t){const r=U.parentNode(t);return r?e.has(r)?!0:To(e,r):!1}let it;function vu(e){it=e}function bu(){it=void 0}const z=e=>it?(...r)=>{try{return e(...r)}catch(s){if(it&&it(s)===!0)return;throw s}}:e,xe=[];function ft(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(t){}return e&&e.target}function _o(e,t){const r=new gu;xe.push(r),r.init(e);const s=new(Ro())(z(r.processMutations.bind(r)));return s.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),s}function Su({mousemoveCb:e,sampling:t,doc:r,mirror:s}){if(t.mousemove===!1)return()=>{};const i=typeof t.mousemove=="number"?t.mousemove:50,o=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500;let a=[],u;const f=Ze(z(c=>{const d=Date.now()-u;e(a.map(h=>(h.timeOffset-=d,h)),c),a=[],u=null}),o),l=z(Ze(z(c=>{const d=ft(c),{clientX:h,clientY:p}=Tt(c)?c.changedTouches[0]:c;u||(u=ot()),a.push({x:h,y:p,id:s.getId(d),timeOffset:ot()-u}),f(typeof DragEvent!="undefined"&&c instanceof DragEvent?T.Drag:c instanceof MouseEvent?T.MouseMove:T.TouchMove)}),i,{trailing:!1})),n=[ae("mousemove",l,r),ae("touchmove",l,r),ae("drag",l,r)];return z(()=>{n.forEach(c=>c())})}function Cu({mouseInteractionCb:e,doc:t,mirror:r,blockClass:s,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};const a=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,u=[];let f=null;const l=n=>c=>{const d=ft(c);if(le(d,s,i,!0))return;let h=null,p=n;if("pointerType"in c){switch(c.pointerType){case"mouse":h=Ce.Mouse;break;case"touch":h=Ce.Touch;break;case"pen":h=Ce.Pen;break}h===Ce.Touch?q[n]===q.MouseDown?p="TouchStart":q[n]===q.MouseUp&&(p="TouchEnd"):Ce.Pen}else Tt(c)&&(h=Ce.Touch);h!==null?(f=h,(p.startsWith("Touch")&&h===Ce.Touch||p.startsWith("Mouse")&&h===Ce.Mouse)&&(h=null)):q[n]===q.Click&&(h=f,f=null);const m=Tt(c)?c.changedTouches[0]:c;if(!m)return;const g=r.getId(d),{clientX:w,clientY:y}=m;z(e)(L({type:q[p],id:g,x:w,y},h!==null&&{pointerType:h}))};return Object.keys(q).filter(n=>Number.isNaN(Number(n))&&!n.endsWith("_Departed")&&a[n]!==!1).forEach(n=>{let c=Ae(n);const d=l(n);if(window.PointerEvent)switch(q[n]){case q.MouseDown:case q.MouseUp:c=c.replace("mouse","pointer");break;case q.TouchStart:case q.TouchEnd:return}u.push(ae(c,d,t))}),z(()=>{u.forEach(n=>n())})}function Po({scrollCb:e,doc:t,mirror:r,blockClass:s,blockSelector:i,sampling:o}){const a=z(Ze(z(u=>{const f=ft(u);if(!f||le(f,s,i,!0))return;const l=r.getId(f);if(f===t&&t.defaultView){const n=Ps(t.defaultView);e({id:l,x:n.left,y:n.top})}else e({id:l,x:f.scrollLeft,y:f.scrollTop})}),o.scroll||100));return ae("scroll",a,t)}function Eu({viewportResizeCb:e},{win:t}){let r=-1,s=-1;const i=z(Ze(z(()=>{const o=ks(),a=Ls();(r!==o||s!==a)&&(e({width:Number(a),height:Number(o)}),r=o,s=a)}),200));return ae("resize",i,t)}const xu=["INPUT","TEXTAREA","SELECT"],xn=new WeakMap;function Mu({inputCb:e,doc:t,mirror:r,blockClass:s,blockSelector:i,ignoreClass:o,ignoreSelector:a,maskInputOptions:u,maskInputFn:f,sampling:l,userTriggeredOnInput:n}){function c(y){let S=ft(y);const E=y.isTrusted,v=S&&S.tagName;if(S&&v==="OPTION"&&(S=U.parentElement(S)),!S||!v||xu.indexOf(v)<0||le(S,s,i,!0)||S.classList.contains(o)||a&&S.matches(a))return;let b=S.value,C=!1;const x=ds(S)||"";x==="radio"||x==="checkbox"?C=S.checked:(u[v.toLowerCase()]||u[x])&&(b=fs({element:S,maskInputOptions:u,tagName:v,type:x,value:b,maskInputFn:f})),d(S,n?{text:b,isChecked:C,userTriggered:E}:{text:b,isChecked:C});const N=S.name;x==="radio"&&N&&C&&t.querySelectorAll(`input[type="radio"][name="${N}"]`).forEach(M=>{if(M!==S){const _=M.value;d(M,n?{text:_,isChecked:!C,userTriggered:!1}:{text:_,isChecked:!C})}})}function d(y,S){const E=xn.get(y);if(!E||E.text!==S.text||E.isChecked!==S.isChecked){xn.set(y,S);const v=r.getId(y);z(e)(ie(L({},S),{id:v}))}}const p=(l.input==="last"?["change"]:["input","change"]).map(y=>ae(y,z(c),t)),m=t.defaultView;if(!m)return()=>{p.forEach(y=>y())};const g=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),w=[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]];return g&&g.set&&p.push(...w.map(y=>ht(y[0],y[1],{set(){z(c)({target:this,isTrusted:!1})}},!1,m))),z(()=>{p.forEach(y=>y())})}function _t(e){const t=[];function r(s,i){if(bt("CSSGroupingRule")&&s.parentRule instanceof CSSGroupingRule||bt("CSSMediaRule")&&s.parentRule instanceof CSSMediaRule||bt("CSSSupportsRule")&&s.parentRule instanceof CSSSupportsRule||bt("CSSConditionRule")&&s.parentRule instanceof CSSConditionRule){const a=Array.from(s.parentRule.cssRules).indexOf(s);i.unshift(a)}else if(s.parentStyleSheet){const a=Array.from(s.parentStyleSheet.cssRules).indexOf(s);i.unshift(a)}return i}return r(e,t)}function Ie(e,t,r){let s,i;return e?(e.ownerNode?s=t.getId(e.ownerNode):i=r.getId(e),{styleId:i,id:s}):{}}function Ru({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:s}){if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};const i=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:z((n,c,d)=>{const[h,p]=d,{id:m,styleId:g}=Ie(c,t,r.styleMirror);return(m&&m!==-1||g&&g!==-1)&&e({id:m,styleId:g,adds:[{rule:h,index:p}]}),n.apply(c,d)})}),s.CSSStyleSheet.prototype.addRule=function(n,c,d=this.cssRules.length){const h=`${n} { ${c} }`;return s.CSSStyleSheet.prototype.insertRule.apply(this,[h,d])};const o=s.CSSStyleSheet.prototype.deleteRule;s.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:z((n,c,d)=>{const[h]=d,{id:p,styleId:m}=Ie(c,t,r.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,removes:[{index:h}]}),n.apply(c,d)})}),s.CSSStyleSheet.prototype.removeRule=function(n){return s.CSSStyleSheet.prototype.deleteRule.apply(this,[n])};let a;s.CSSStyleSheet.prototype.replace&&(a=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:z((n,c,d)=>{const[h]=d,{id:p,styleId:m}=Ie(c,t,r.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,replace:h}),n.apply(c,d)})}));let u;s.CSSStyleSheet.prototype.replaceSync&&(u=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:z((n,c,d)=>{const[h]=d,{id:p,styleId:m}=Ie(c,t,r.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,replaceSync:h}),n.apply(c,d)})}));const f={};St("CSSGroupingRule")?f.CSSGroupingRule=s.CSSGroupingRule:(St("CSSMediaRule")&&(f.CSSMediaRule=s.CSSMediaRule),St("CSSConditionRule")&&(f.CSSConditionRule=s.CSSConditionRule),St("CSSSupportsRule")&&(f.CSSSupportsRule=s.CSSSupportsRule));const l={};return Object.entries(f).forEach(([n,c])=>{l[n]={insertRule:c.prototype.insertRule,deleteRule:c.prototype.deleteRule},c.prototype.insertRule=new Proxy(l[n].insertRule,{apply:z((d,h,p)=>{const[m,g]=p,{id:w,styleId:y}=Ie(h.parentStyleSheet,t,r.styleMirror);return(w&&w!==-1||y&&y!==-1)&&e({id:w,styleId:y,adds:[{rule:m,index:[..._t(h),g||0]}]}),d.apply(h,p)})}),c.prototype.deleteRule=new Proxy(l[n].deleteRule,{apply:z((d,h,p)=>{const[m]=p,{id:g,styleId:w}=Ie(h.parentStyleSheet,t,r.styleMirror);return(g&&g!==-1||w&&w!==-1)&&e({id:g,styleId:w,removes:[{index:[..._t(h),m]}]}),d.apply(h,p)})})}),z(()=>{s.CSSStyleSheet.prototype.insertRule=i,s.CSSStyleSheet.prototype.deleteRule=o,a&&(s.CSSStyleSheet.prototype.replace=a),u&&(s.CSSStyleSheet.prototype.replaceSync=u),Object.entries(f).forEach(([n,c])=>{c.prototype.insertRule=l[n].insertRule,c.prototype.deleteRule=l[n].deleteRule})})}function ko({mirror:e,stylesheetManager:t},r){var s,i,o;let a=null;r.nodeName==="#document"?a=e.getId(r):a=e.getId(U.host(r));const u=r.nodeName==="#document"?(s=r.defaultView)==null?void 0:s.Document:(o=(i=r.ownerDocument)==null?void 0:i.defaultView)==null?void 0:o.ShadowRoot,f=u!=null&&u.prototype?Object.getOwnPropertyDescriptor(u==null?void 0:u.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!u||!f?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:f.configurable,enumerable:f.enumerable,get(){var l;return(l=f.get)==null?void 0:l.call(this)},set(l){var n;const c=(n=f.set)==null?void 0:n.call(this,l);if(a!==null&&a!==-1)try{t.adoptStyleSheets(l,a)}catch(d){}return c}}),z(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:f.configurable,enumerable:f.enumerable,get:f.get,set:f.set})}))}function Iu({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:s},{win:i}){const o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:z((u,f,l)=>{var n;const[c,d,h]=l;if(r.has(c))return o.apply(f,[c,d,h]);const{id:p,styleId:m}=Ie((n=f.parentRule)==null?void 0:n.parentStyleSheet,t,s.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,set:{property:c,value:d,priority:h},index:_t(f.parentRule)}),u.apply(f,l)})});const a=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:z((u,f,l)=>{var n;const[c]=l;if(r.has(c))return a.apply(f,[c]);const{id:d,styleId:h}=Ie((n=f.parentRule)==null?void 0:n.parentStyleSheet,t,s.styleMirror);return(d&&d!==-1||h&&h!==-1)&&e({id:d,styleId:h,remove:{property:c},index:_t(f.parentRule)}),u.apply(f,l)})}),z(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=a})}function Nu({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:s,sampling:i,doc:o}){const a=z(f=>Ze(z(l=>{const n=ft(l);if(!n||le(n,t,r,!0))return;const{currentTime:c,volume:d,muted:h,playbackRate:p,loop:m}=n;e({type:f,id:s.getId(n),currentTime:c,volume:d,muted:h,playbackRate:p,loop:m})}),i.media||500)),u=[ae("play",a(Ne.Play),o),ae("pause",a(Ne.Pause),o),ae("seeked",a(Ne.Seeked),o),ae("volumechange",a(Ne.VolumeChange),o),ae("ratechange",a(Ne.RateChange),o)];return z(()=>{u.forEach(f=>f())})}function Ou({fontCb:e,doc:t}){const r=t.defaultView;if(!r)return()=>{};const s=[],i=new WeakMap,o=r.FontFace;r.FontFace=function(f,l,n){const c=new o(f,l,n);return i.set(c,{family:f,buffer:typeof l!="string",descriptors:n,fontSource:typeof l=="string"?l:JSON.stringify(Array.from(new Uint8Array(l)))}),c};const a=Be(t.fonts,"add",function(u){return function(f){return setTimeout(z(()=>{const l=i.get(f);l&&(e(l),i.delete(f))}),0),u.apply(this,[f])}});return s.push(()=>{r.FontFace=o}),s.push(a),z(()=>{s.forEach(u=>u())})}function Du(e){const{doc:t,mirror:r,blockClass:s,blockSelector:i,selectionCb:o}=e;let a=!0;const u=z(()=>{const f=t.getSelection();if(!f||a&&(f!=null&&f.isCollapsed))return;a=f.isCollapsed||!1;const l=[],n=f.rangeCount||0;for(let c=0;c<n;c++){const d=f.getRangeAt(c),{startContainer:h,startOffset:p,endContainer:m,endOffset:g}=d;le(h,s,i,!0)||le(m,s,i,!0)||l.push({start:r.getId(h),startOffset:p,end:r.getId(m),endOffset:g})}o({ranges:l})});return u(),ae("selectionchange",u)}function Au({doc:e,customElementCb:t}){const r=e.defaultView;return!r||!r.customElements?()=>{}:Be(r.customElements,"define",function(i){return function(o,a,u){try{t({define:{name:o}})}catch(f){console.warn(`Custom element callback failed for ${o}`)}return i.apply(this,[o,a,u])}})}function Tu(e,t){const{mutationCb:r,mousemoveCb:s,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:a,inputCb:u,mediaInteractionCb:f,styleSheetRuleCb:l,styleDeclarationCb:n,canvasMutationCb:c,fontCb:d,selectionCb:h,customElementCb:p}=e;e.mutationCb=(...m)=>{t.mutation&&t.mutation(...m),r(...m)},e.mousemoveCb=(...m)=>{t.mousemove&&t.mousemove(...m),s(...m)},e.mouseInteractionCb=(...m)=>{t.mouseInteraction&&t.mouseInteraction(...m),i(...m)},e.scrollCb=(...m)=>{t.scroll&&t.scroll(...m),o(...m)},e.viewportResizeCb=(...m)=>{t.viewportResize&&t.viewportResize(...m),a(...m)},e.inputCb=(...m)=>{t.input&&t.input(...m),u(...m)},e.mediaInteractionCb=(...m)=>{t.mediaInteaction&&t.mediaInteaction(...m),f(...m)},e.styleSheetRuleCb=(...m)=>{t.styleSheetRule&&t.styleSheetRule(...m),l(...m)},e.styleDeclarationCb=(...m)=>{t.styleDeclaration&&t.styleDeclaration(...m),n(...m)},e.canvasMutationCb=(...m)=>{t.canvasMutation&&t.canvasMutation(...m),c(...m)},e.fontCb=(...m)=>{t.font&&t.font(...m),d(...m)},e.selectionCb=(...m)=>{t.selection&&t.selection(...m),h(...m)},e.customElementCb=(...m)=>{t.customElement&&t.customElement(...m),p(...m)}}function _u(e,t={}){const r=e.doc.defaultView;if(!r)return()=>{};Tu(e,t);let s;e.recordDOM&&(s=_o(e,e.doc));const i=Su(e),o=Cu(e),a=Po(e),u=Eu(e,{win:r}),f=Mu(e),l=Nu(e);let n=()=>{},c=()=>{},d=()=>{},h=()=>{};e.recordDOM&&(n=Ru(e,{win:r}),c=ko(e,e.doc),d=Iu(e,{win:r}),e.collectFonts&&(h=Ou(e)));const p=Du(e),m=Au(e),g=[];for(const w of e.plugins)g.push(w.observer(w.callback,r,w.options));return z(()=>{xe.forEach(w=>w.destroy()),xe.forEach(w=>w.reset()),s==null||s.disconnect(),i(),o(),a(),u(),f(),l(),n(),c(),d(),h(),p(),m(),g.forEach(w=>w()),xe.length=0})}function bt(e){return typeof window[e]!="undefined"}function St(e){return!!(typeof window[e]!="undefined"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class Mn{constructor(t){I(this,"iframeIdToRemoteIdMap",new WeakMap),I(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,s,i){const o=s||this.getIdToRemoteIdMap(t),a=i||this.getRemoteIdToIdMap(t);let u=o.get(r);return u||(u=this.generateIdFn(),o.set(r,u),a.set(u,r)),u}getIds(t,r){const s=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return r.map(o=>this.getId(t,o,s,i))}getRemoteId(t,r,s){const i=s||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;const o=i.get(r);return o||-1}getRemoteIds(t,r){const s=this.getRemoteIdToIdMap(t);return r.map(i=>this.getRemoteId(t,i,s))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}}class Pu{constructor(t){I(this,"iframes",new WeakMap),I(this,"crossOriginIframeMap",new WeakMap),I(this,"crossOriginIframeMirror",new Mn(Vn)),I(this,"crossOriginIframeStyleMirror"),I(this,"crossOriginIframeRootIdMap",new WeakMap),I(this,"mirror"),I(this,"mutationCb"),I(this,"wrappedEmit"),I(this,"loadListener"),I(this,"stylesheetManager"),I(this,"recordCrossOriginIframes"),I(this,"messageHandler"),I(this,"nestedIframeListeners",new Map),I(this,"attachedIframes",new Map),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Mn(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}removeLoadListener(){this.loadListener=void 0}trackIframeContent(t,r){const s=this.mirror.getId(t);return this.attachedIframes.set(s,{element:t,content:r}),s}attachIframe(t,r){var s;const i=this.trackIframeContent(t,r);this.mutationCb({adds:[{parentId:i,nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0});const o=t.contentWindow;if(this.recordCrossOriginIframes&&o&&!this.nestedIframeListeners.has(o)){const a=this.handleMessage.bind(this);this.nestedIframeListeners.set(o,a),o.addEventListener("message",a)}(s=this.loadListener)==null||s.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){const r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;const i=this.crossOriginIframeMap.get(t.source);if(!i)return;const o=this.transformCrossOriginEvent(i,r.data.event);o&&this.wrappedEmit(o,r.data.isCheckout)}transformCrossOriginEvent(t,r){var s;switch(r.type){case P.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);const i=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(r.data.node,i),this.trackIframeContent(t,r.data.node),{timestamp:r.timestamp,type:P.IncrementalSnapshot,data:{source:T.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case P.Meta:case P.Load:case P.DomContentLoaded:return!1;case P.Plugin:return r;case P.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case P.IncrementalSnapshot:switch(r.data.source){case T.Mutation:return r.data.adds.forEach(i=>{this.replaceIds(i,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,t);const o=this.crossOriginIframeRootIdMap.get(t);o&&this.patchRootIdOnNode(i.node,o)}),r.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"])}),r.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"])}),r.data.texts.forEach(i=>{this.replaceIds(i,t,["id"])}),r;case T.Drag:case T.TouchMove:case T.MouseMove:return r.data.positions.forEach(i=>{this.replaceIds(i,t,["id"])}),r;case T.ViewportResize:return!1;case T.MediaInteraction:case T.MouseInteraction:case T.Scroll:case T.CanvasMutation:case T.Input:return this.replaceIds(r.data,t,["id"]),r;case T.StyleSheetRule:case T.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case T.Font:return r;case T.Selection:return r.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"])}),r;case T.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(s=r.data.styles)==null||s.forEach(i=>{this.replaceStyleIds(i,t,["styleId"])}),r}}return!1}replace(t,r,s,i){for(const o of i)!Array.isArray(r[o])&&typeof r[o]!="number"||(Array.isArray(r[o])?r[o]=t.getIds(s,r[o]):r[o]=t.getId(s,r[o]));return r}replaceIds(t,r,s){return this.replace(this.crossOriginIframeMirror,t,r,s)}replaceStyleIds(t,r,s){return this.replace(this.crossOriginIframeStyleMirror,t,r,s)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(s=>{this.replaceIdOnNode(s,r)})}patchRootIdOnNode(t,r){t.type!==Ee.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(s=>{this.patchRootIdOnNode(s,r)})}removeIframeById(t){const r=this.attachedIframes.get(t);if(!r)return;const s=r.element.contentWindow;if(s&&this.nestedIframeListeners.has(s)){const i=this.nestedIframeListeners.get(s);s.removeEventListener("message",i),this.nestedIframeListeners.delete(s)}this.attachedIframes.delete(t)}reattachIframes(){this.attachedIframes.forEach(({content:t},r)=>{if(!this.mirror.has(r)){this.attachedIframes.delete(r);return}this.mutationCb({adds:[{parentId:r,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0})})}destroy(){this.recordCrossOriginIframes&&window.removeEventListener("message",this.messageHandler),this.nestedIframeListeners.forEach((t,r)=>{r.removeEventListener("message",t)}),this.nestedIframeListeners.clear(),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear()}}class ku{constructor(t){I(this,"shadowDoms",new WeakSet),I(this,"mutationCb"),I(this,"scrollCb"),I(this,"bypassOptions"),I(this,"mirror"),I(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,r){if(!rt(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);const s=_o(ie(L({},this.bypassOptions),{doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push(()=>s.disconnect()),this.restoreHandlers.push(Po(ie(L({},this.bypassOptions),{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(U.host(t))),this.restoreHandlers.push(ko({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){const s=this;this.restoreHandlers.push(Be(t.prototype,"attachShadow",function(i){return function(o){const a=i.call(this,o),u=U.shadowRoot(this);return u&&js(this)&&s.addShadowRoot(u,r),a}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch(r){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}var Je="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",et=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(var Ct=0;Ct<Je.length;Ct++)et[Je.charCodeAt(Ct)]=Ct;var Lu=function(e){var t=new Uint8Array(e),r,s=t.length,i="";for(r=0;r<s;r+=3)i+=Je[t[r]>>2],i+=Je[(t[r]&3)<<4|t[r+1]>>4],i+=Je[(t[r+1]&15)<<2|t[r+2]>>6],i+=Je[t[r+2]&63];return s%3===2?i=i.substring(0,i.length-1)+"=":s%3===1&&(i=i.substring(0,i.length-2)+"=="),i},Fu=function(e){var t=e.length*.75,r=e.length,s,i=0,o,a,u,f;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var l=new ArrayBuffer(t),n=new Uint8Array(l);for(s=0;s<r;s+=4)o=et[e.charCodeAt(s)],a=et[e.charCodeAt(s+1)],u=et[e.charCodeAt(s+2)],f=et[e.charCodeAt(s+3)],n[i++]=o<<2|a>>4,n[i++]=(a&15)<<4|u>>2,n[i++]=(u&3)<<6|f&63;return l};const Rn=new Map;function Bu(e,t){let r=Rn.get(e);return r||(r=new Map,Rn.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}const Lo=(e,t,r)=>{if(!e||!(Bo(e,t)||typeof e=="object"))return;const s=e.constructor.name,i=Bu(r,s);let o=i.indexOf(e);return o===-1&&(o=i.length,i.push(e)),o};function Mt(e,t,r,s){if(e instanceof Array)return e.map(i=>Mt(i,t,r,s));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){const i=e.constructor.name,o=Lu(e);return{rr_type:i,base64:o}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Mt(e.buffer,t,r,s),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const i=e.constructor.name,{src:o}=e;return{rr_type:i,src:o}}else if(e instanceof HTMLCanvasElement){const i="HTMLImageElement",o=e.toDataURL(s.type,s.quality);return{rr_type:i,src:o}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[Mt(e.data,t,r,s),e.width,e.height]};if(Bo(e,t)||typeof e=="object"){const i=e.constructor.name,o=Lo(e,t,r);return{rr_type:i,index:o}}}}return e}const Fo=(e,t,r,s)=>e.map(i=>Mt(i,t,r,s)),Bo=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof t[i]=="function").find(i=>e instanceof t[i]);function Uu(e,t,r,s,i){const o=[],a=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const u of a)try{if(typeof t.CanvasRenderingContext2D.prototype[u]!="function")continue;const f=Be(t.CanvasRenderingContext2D.prototype,u,function(l){return function(...n){return le(this.canvas,r,s,!0)||setTimeout(()=>{const c=Fo(n,t,this,i);e(this.canvas,{type:Me["2D"],property:u,args:c})},0),l.apply(this,n)}});o.push(f)}catch(f){const l=ht(t.CanvasRenderingContext2D.prototype,u,{set(n){e(this.canvas,{type:Me["2D"],property:u,args:[n],setter:!0})}});o.push(l)}return()=>{o.forEach(u=>u())}}function Wu(e){return e==="experimental-webgl"?"webgl":e}function In(e,t,r,s){const i=[];try{const o=Be(e.HTMLCanvasElement.prototype,"getContext",function(a){return function(u,...f){if(!le(this,t,r,!0)){const l=Wu(u);if("__context"in this||(this.__context=l),s&&["webgl","webgl2"].includes(l))if(f[0]&&typeof f[0]=="object"){const n=f[0];n.preserveDrawingBuffer||(n.preserveDrawingBuffer=!0)}else f.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[u,...f])}});i.push(o)}catch(o){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(o=>o())}}function Nn(e,t,r,s,i,o,a){const u=[],f=Object.getOwnPropertyNames(e);for(const l of f)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if(typeof e[l]!="function")continue;const n=Be(e,l,function(c){return function(...d){const h=c.apply(this,d);if(Lo(h,o,this),"tagName"in this.canvas&&!le(this.canvas,s,i,!0)){const p=Fo(d,o,this,a),m={type:t,property:l,args:p};r(this.canvas,m)}return h}});u.push(n)}catch(n){const c=ht(e,l,{set(d){r(this.canvas,{type:t,property:l,args:[d],setter:!0})}});u.push(c)}return u}function $u(e,t,r,s,i){const o=[];return o.push(...Nn(t.WebGLRenderingContext.prototype,Me.WebGL,e,r,s,t,i)),typeof t.WebGL2RenderingContext!="undefined"&&o.push(...Nn(t.WebGL2RenderingContext.prototype,Me.WebGL2,e,r,s,t,i)),()=>{o.forEach(a=>a())}}const Uo=`(function() {
59
+ or you can use record.mirror to access the mirror instance during recording.`;exports.mirror={map:{},getId(){return console.error(qe),-1},getNode(){return console.error(qe),null},removeNodeFromMap(){console.error(qe)},has(){return console.error(qe),!1},reset(){console.error(qe)}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(exports.mirror=new Proxy(exports.mirror,{get(e,t,r){return t==="map"&&console.error(qe),Reflect.get(e,t,r)}}));function Ze(e,t,r={}){let s=null,i=0;return function(...o){const a=Date.now();!i&&r.leading===!1&&(i=a);const u=t-(a-i),f=this;u<=0||u>t?(s&&(clearTimeout(s),s=null),i=a,e.apply(f,o)):!s&&r.trailing!==!1&&(s=setTimeout(()=>{i=r.leading===!1?0:Date.now(),s=null,e.apply(f,o)},u))}}function ht(e,t,r,s,i=window){const o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,s?r:{set(a){setTimeout(()=>{r.set.call(this,a)},0),o&&o.set&&o.set.call(this,a)}}),()=>ht(e,t,o||{},!0)}let ot=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(ot=()=>new Date().getTime());function Ps(e){var t,r,s,i;const o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:o.documentElement.scrollLeft||(o==null?void 0:o.body)&&((t=U.parentElement(o.body))==null?void 0:t.scrollLeft)||((r=o==null?void 0:o.body)==null?void 0:r.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:(o==null?void 0:o.documentElement.scrollTop)||(o==null?void 0:o.body)&&((s=U.parentElement(o.body))==null?void 0:s.scrollTop)||((i=o==null?void 0:o.body)==null?void 0:i.scrollTop)||0}}function ks(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Ls(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Fs(e){return e?e.nodeType===e.ELEMENT_NODE?e:U.parentElement(e):null}function le(e,t,r,s){if(!e)return!1;const i=Fs(e);if(!i)return!1;try{if(typeof t=="string"){if(i.classList.contains(t)||s&&i.closest("."+t)!==null)return!0}else if(Ot(i,t,s))return!0}catch(o){}return!!(r&&(i.matches(r)||s&&i.closest(r)!==null))}function Io(e,t){return t.getId(e)!==-1}function xt(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===nt}function Bs(e,t){if(tt(e))return!1;const r=t.getId(e);if(!t.has(r))return!0;const s=U.parentNode(e);return s&&s.nodeType===e.DOCUMENT_NODE?!1:s?Bs(s,t):!0}function Tt(e){return!!e.changedTouches}function Us(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function No(e){const t={},r=(i,o)=>{const a={value:i,parent:o,children:[]};return t[i.node.id]=a,a},s=[];for(const i of e){const{nextId:o,parentId:a}=i;if(o&&o in t){const u=t[o];if(u.parent){const f=u.parent.children.indexOf(u);u.parent.children.splice(f,0,r(i,u.parent))}else{const f=s.indexOf(u);s.splice(f,0,r(i,null))}continue}if(a in t){const u=t[a];u.children.push(r(i,u));continue}s.push(r(i,null))}return s}function Ws(e,t){t(e.value);for(let r=e.children.length-1;r>=0;r--)Ws(e.children[r],t)}function Qe(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function $s(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function zs(e,t){var r,s;const i=(s=(r=e.ownerDocument)==null?void 0:r.defaultView)==null?void 0:s.frameElement;if(!i||i===t)return{x:0,y:0,relativeScale:1,absoluteScale:1};const o=i.getBoundingClientRect(),a=zs(i,t),u=o.height/i.clientHeight;return{x:o.x*a.relativeScale+a.x,y:o.y*a.relativeScale+a.y,relativeScale:u,absoluteScale:a.absoluteScale*u}}function Oe(e){return e?e instanceof we&&"shadowRoot"in e?!!e.shadowRoot:!!U.shadowRoot(e):!1}function Ye(e,t){const r=e[t[0]];return t.length===1?r:Ye(r.cssRules[t[1]].cssRules,t.slice(2))}function os(e){const t=[...e],r=t.pop();return{positions:t,index:r}}function Oo(e){const t=new Set,r=[];for(let s=e.length;s--;){const i=e[s];t.has(i.id)||(r.push(i),t.add(i.id))}return r}class Vs{constructor(){I(this,"id",1),I(this,"styleIDMap",new WeakMap),I(this,"idStyleMap",new Map)}getId(t){var r;return(r=this.styleIDMap.get(t))!=null?r:-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let s;return r===void 0?s=this.id++:s=r,this.styleIDMap.set(t,s),this.idStyleMap.set(s,t),s}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 qs(e){var t;let r=null;return"getRootNode"in e&&((t=U.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&U.host(U.getRootNode(e))&&(r=U.host(U.getRootNode(e))),r}function Do(e){let t=e,r;for(;r=qs(t);)t=r;return t}function Ao(e){const t=e.ownerDocument;if(!t)return!1;const r=Do(e);return U.contains(t,r)}function js(e){const t=e.ownerDocument;return t?U.contains(t,e)||Ao(e):!1}const pu=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:Vs,get _mirror(){return exports.mirror},closestElementOfNode:Fs,getBaseDimension:zs,getNestedRule:Ye,getPositionsAndIndex:os,getRootShadowHost:Do,getShadowHost:qs,getWindowHeight:ks,getWindowScroll:Ps,getWindowWidth:Ls,hasShadowRoot:Oe,hookSetter:ht,inDom:js,isAncestorRemoved:Bs,isBlocked:le,isIgnored:xt,isSerialized:Io,isSerializedIframe:Qe,isSerializedStylesheet:$s,iterateResolveTree:Ws,legacy_isTouchEvent:Tt,get nowTimestamp(){return ot},on:ae,polyfill:Us,queueToResolveTrees:No,shadowHostInDom:Ao,throttle:Ze,uniqueTextMutations:Oo},Symbol.toStringTag,{value:"Module"}));var P=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(P||{}),T=(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))(T||{}),q=(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))(q||{}),Ce=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Ce||{}),Me=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Me||{}),Ne=(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))(Ne||{}),V=(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))(V||{}),Ee=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(Ee||{});function bn(e){return"__ln"in e}class mu{constructor(){I(this,"length",0),I(this,"head",null),I(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let s=0;s<t;s++)r=(r==null?void 0:r.next)||null;return r}addNode(t){const r={value:t,previous:null,next:null};if(t.__ln=r,t.previousSibling&&bn(t.previousSibling)){const s=t.previousSibling.__ln.next;r.next=s,r.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=r,s&&(s.previous=r)}else if(t.nextSibling&&bn(t.nextSibling)&&t.nextSibling.__ln.previous){const s=t.nextSibling.__ln.previous;r.previous=s,r.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=r,s&&(s.next=r)}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;r.next===null&&(this.tail=r),this.length++}removeNode(t){const r=t.__ln;this.head&&(r.previous?(r.previous.next=r.next,r.next?r.next.previous=r.previous:this.tail=r.previous):(this.head=r.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}}const Sn=(e,t)=>`${e}@${t}`;class gu{constructor(){I(this,"frozen",!1),I(this,"locked",!1),I(this,"texts",[]),I(this,"attributes",[]),I(this,"attributeMap",new WeakMap),I(this,"removes",[]),I(this,"mapRemoves",[]),I(this,"movedMap",{}),I(this,"addedSet",new Set),I(this,"movedSet",new Set),I(this,"droppedSet",new Set),I(this,"removesSubTreeCache",new Set),I(this,"mutationCb"),I(this,"blockClass"),I(this,"blockSelector"),I(this,"maskTextClass"),I(this,"maskTextSelector"),I(this,"inlineStylesheet"),I(this,"maskInputOptions"),I(this,"maskTextFn"),I(this,"maskInputFn"),I(this,"keepIframeSrcFn"),I(this,"recordCanvas"),I(this,"inlineImages"),I(this,"slimDOMOptions"),I(this,"dataURLOptions"),I(this,"doc"),I(this,"mirror"),I(this,"iframeManager"),I(this,"stylesheetManager"),I(this,"shadowDomManager"),I(this,"canvasManager"),I(this,"processedNodeManager"),I(this,"unattachedDoc"),I(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),I(this,"emit",()=>{if(this.frozen||this.locked)return;const t=[],r=new Set,s=new mu,i=f=>{let l=f,n=nt;for(;n===nt;)l=l&&l.nextSibling,n=l&&this.mirror.getId(l);return n},o=f=>{const l=U.parentNode(f);if(!l||!js(f)||l.tagName==="TEXTAREA")return;const n=tt(l)?this.mirror.getId(qs(f)):this.mirror.getId(l),c=i(f);if(n===-1||c===-1)return s.addNode(f);const d=Ge(f,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:h=>{Qe(h,this.mirror)&&this.iframeManager.addIframe(h),$s(h,this.mirror)&&this.stylesheetManager.trackLinkElement(h),Oe(f)&&this.shadowDomManager.addShadowRoot(U.shadowRoot(f),this.doc)},onIframeLoad:(h,p)=>{this.iframeManager.attachIframe(h,p),this.shadowDomManager.observeAttachShadow(h)},onStylesheetLoad:(h,p)=>{this.stylesheetManager.attachLinkElement(h,p)}});d&&(t.push({parentId:n,nextId:c,node:d}),r.add(d.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const f of this.movedSet)Cn(this.removesSubTreeCache,f,this.mirror)&&!this.movedSet.has(U.parentNode(f))||o(f);for(const f of this.addedSet)!En(this.droppedSet,f)&&!Cn(this.removesSubTreeCache,f,this.mirror)||En(this.movedSet,f)?o(f):this.droppedSet.add(f);let a=null;for(;s.length;){let f=null;if(a){const l=this.mirror.getId(U.parentNode(a.value)),n=i(a.value);l!==-1&&n!==-1&&(f=a)}if(!f){let l=s.tail;for(;l;){const n=l;if(l=l.previous,n){const c=this.mirror.getId(U.parentNode(n.value));if(i(n.value)===-1)continue;if(c!==-1){f=n;break}else{const h=n.value,p=U.parentNode(h);if(p&&p.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const m=U.host(p);if(this.mirror.getId(m)!==-1){f=n;break}}}}}}if(!f){for(;s.head;)s.removeNode(s.head.value);break}a=f.previous,s.removeNode(f.value),o(f.value)}const u={texts:this.texts.map(f=>{const l=f.node,n=U.parentNode(l);return n&&n.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(n),{id:this.mirror.getId(l),value:f.value}}).filter(f=>!r.has(f.id)).filter(f=>this.mirror.has(f.id)),attributes:this.attributes.map(f=>{const{attributes:l}=f;if(typeof l.style=="string"){const n=JSON.stringify(f.styleDiff),c=JSON.stringify(f._unchangedStyles);n.length<l.style.length&&(n+c).split("var(").length===l.style.split("var(").length&&(l.style=f.styleDiff)}return{id:this.mirror.getId(f.node),attributes:l}}).filter(f=>!r.has(f.id)).filter(f=>this.mirror.has(f.id)),removes:this.removes,adds:t};!u.texts.length&&!u.attributes.length&&!u.removes.length&&!u.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(u))}),I(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r)),r.attributes.value=Array.from(U.childNodes(t),s=>U.textContent(s)||"").join("")}),I(this,"processMutation",t=>{if(!xt(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const r=U.textContent(t.target);!le(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:Hn(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,Fs(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{const r=t.target;let s=t.attributeName,i=t.target.getAttribute(s);if(s==="value"){const a=ds(r);i=fs({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:a,value:i,maskInputFn:this.maskInputFn})}if(le(t.target,this.blockClass,this.blockSelector,!1)||i===t.oldValue)return;let o=this.attributeMap.get(t.target);if(r.tagName==="IFRAME"&&s==="src"&&!this.keepIframeSrcFn(i))if(!r.contentDocument)s="rr_src";else return;if(o||(o={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(t.target,o)),s==="type"&&r.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!jn(r.tagName,s))if(o.attributes[s]=qn(this.doc,Ae(r.tagName),Ae(s),i,r,this.dataURLOptions),s==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(u){this.unattachedDoc=this.doc}const a=this.unattachedDoc.createElement("span");t.oldValue&&a.setAttribute("style",t.oldValue);for(const u of Array.from(r.style)){const f=r.style.getPropertyValue(u),l=r.style.getPropertyPriority(u);f!==a.style.getPropertyValue(u)||l!==a.style.getPropertyPriority(u)?l===""?o.styleDiff[u]=f:o.styleDiff[u]=[f,l]:o._unchangedStyles[u]=[f,l]}for(const u of Array.from(a.style))r.style.getPropertyValue(u)===""&&(o.styleDiff[u]=!1)}else s==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?o.attributes.rr_open_mode="modal":o.attributes.rr_open_mode="non-modal");break}case"childList":{if(le(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{const s=this.mirror.getId(r),i=tt(t.target)?this.mirror.getId(U.host(t.target)):this.mirror.getId(t.target);le(t.target,this.blockClass,this.blockSelector,!1)||xt(r,this.mirror,this.slimDOMOptions)||!Io(r,this.mirror)||(this.addedSet.has(r)?(as(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&s===-1||Bs(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[Sn(s,i)]?as(this.movedSet,r):(this.removes.push({parentId:i,id:s,isShadow:tt(t.target)&&rt(t.target)?!0:void 0}),yu(r,this.removesSubTreeCache))),this.mapRemoves.push(r))});break}}}),I(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(xt(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let s=null;r&&this.mirror.hasNode(r)&&(s=this.mirror.getId(r)),s&&s!==-1&&(this.movedMap[Sn(this.mirror.getId(t),s)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);le(t,this.blockClass,this.blockSelector,!1)||(U.childNodes(t).forEach(s=>this.genAdds(s)),Oe(t)&&U.childNodes(U.shadowRoot(t)).forEach(s=>{this.processedNodeManager.add(s,this),this.genAdds(s,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(r=>{this[r]=t[r]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}destroy(){for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift())}}function as(e,t){e.delete(t),U.childNodes(t).forEach(r=>as(e,r))}function yu(e,t){const r=[e];for(;r.length;){const s=r.pop();t.has(s)||(t.add(s),U.childNodes(s).forEach(i=>r.push(i)))}}function Cn(e,t,r){return e.size===0?!1:wu(e,t)}function wu(e,t,r){const s=U.parentNode(t);return s?e.has(s):!1}function En(e,t){return e.size===0?!1:To(e,t)}function To(e,t){const r=U.parentNode(t);return r?e.has(r)?!0:To(e,r):!1}let it;function vu(e){it=e}function bu(){it=void 0}const z=e=>it?(...r)=>{try{return e(...r)}catch(s){if(it&&it(s)===!0)return;throw s}}:e,xe=[];function ft(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(t){}return e&&e.target}function _o(e,t){const r=new gu;xe.push(r),r.init(e);const s=new(Ro())(z(r.processMutations.bind(r)));return s.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),s}function Su({mousemoveCb:e,sampling:t,doc:r,mirror:s}){if(t.mousemove===!1)return()=>{};const i=typeof t.mousemove=="number"?t.mousemove:50,o=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500;let a=[],u;const f=Ze(z(c=>{const d=Date.now()-u;e(a.map(h=>(h.timeOffset-=d,h)),c),a=[],u=null}),o),l=z(Ze(z(c=>{const d=ft(c),{clientX:h,clientY:p}=Tt(c)?c.changedTouches[0]:c;u||(u=ot()),a.push({x:h,y:p,id:s.getId(d),timeOffset:ot()-u}),f(typeof DragEvent!="undefined"&&c instanceof DragEvent?T.Drag:c instanceof MouseEvent?T.MouseMove:T.TouchMove)}),i,{trailing:!1})),n=[ae("mousemove",l,r),ae("touchmove",l,r),ae("drag",l,r)];return z(()=>{n.forEach(c=>c())})}function Cu({mouseInteractionCb:e,doc:t,mirror:r,blockClass:s,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};const a=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,u=[];let f=null;const l=n=>c=>{const d=ft(c);if(le(d,s,i,!0))return;let h=null,p=n;if("pointerType"in c){switch(c.pointerType){case"mouse":h=Ce.Mouse;break;case"touch":h=Ce.Touch;break;case"pen":h=Ce.Pen;break}h===Ce.Touch?q[n]===q.MouseDown?p="TouchStart":q[n]===q.MouseUp&&(p="TouchEnd"):Ce.Pen}else Tt(c)&&(h=Ce.Touch);h!==null?(f=h,(p.startsWith("Touch")&&h===Ce.Touch||p.startsWith("Mouse")&&h===Ce.Mouse)&&(h=null)):q[n]===q.Click&&(h=f,f=null);const m=Tt(c)?c.changedTouches[0]:c;if(!m)return;const g=r.getId(d),{clientX:w,clientY:y}=m;z(e)(L({type:q[p],id:g,x:w,y},h!==null&&{pointerType:h}))};return Object.keys(q).filter(n=>Number.isNaN(Number(n))&&!n.endsWith("_Departed")&&a[n]!==!1).forEach(n=>{let c=Ae(n);const d=l(n);if(window.PointerEvent)switch(q[n]){case q.MouseDown:case q.MouseUp:c=c.replace("mouse","pointer");break;case q.TouchStart:case q.TouchEnd:return}u.push(ae(c,d,t))}),z(()=>{u.forEach(n=>n())})}function Po({scrollCb:e,doc:t,mirror:r,blockClass:s,blockSelector:i,sampling:o}){const a=z(Ze(z(u=>{const f=ft(u);if(!f||le(f,s,i,!0))return;const l=r.getId(f);if(f===t&&t.defaultView){const n=Ps(t.defaultView);e({id:l,x:n.left,y:n.top})}else e({id:l,x:f.scrollLeft,y:f.scrollTop})}),o.scroll||100));return ae("scroll",a,t)}function Eu({viewportResizeCb:e},{win:t}){let r=-1,s=-1;const i=z(Ze(z(()=>{const o=ks(),a=Ls();(r!==o||s!==a)&&(e({width:Number(a),height:Number(o)}),r=o,s=a)}),200));return ae("resize",i,t)}const xu=["INPUT","TEXTAREA","SELECT"],xn=new WeakMap;function Mu({inputCb:e,doc:t,mirror:r,blockClass:s,blockSelector:i,ignoreClass:o,ignoreSelector:a,maskInputOptions:u,maskInputFn:f,sampling:l,userTriggeredOnInput:n}){function c(y){let S=ft(y);const E=y.isTrusted,v=S&&S.tagName;if(S&&v==="OPTION"&&(S=U.parentElement(S)),!S||!v||xu.indexOf(v)<0||le(S,s,i,!0)||S.classList.contains(o)||a&&S.matches(a))return;let b=S.value,C=!1;const x=ds(S)||"";x==="radio"||x==="checkbox"?C=S.checked:(u[v.toLowerCase()]||u[x])&&(b=fs({element:S,maskInputOptions:u,tagName:v,type:x,value:b,maskInputFn:f})),d(S,n?{text:b,isChecked:C,userTriggered:E}:{text:b,isChecked:C});const N=S.name;x==="radio"&&N&&C&&t.querySelectorAll(`input[type="radio"][name="${N}"]`).forEach(M=>{if(M!==S){const _=M.value;d(M,n?{text:_,isChecked:!C,userTriggered:!1}:{text:_,isChecked:!C})}})}function d(y,S){const E=xn.get(y);if(!E||E.text!==S.text||E.isChecked!==S.isChecked){xn.set(y,S);const v=r.getId(y);z(e)(ie(L({},S),{id:v}))}}const p=(l.input==="last"?["change"]:["input","change"]).map(y=>ae(y,z(c),t)),m=t.defaultView;if(!m)return()=>{p.forEach(y=>y())};const g=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),w=[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]];return g&&g.set&&p.push(...w.map(y=>ht(y[0],y[1],{set(){z(c)({target:this,isTrusted:!1})}},!1,m))),z(()=>{p.forEach(y=>y())})}function _t(e){const t=[];function r(s,i){if(bt("CSSGroupingRule")&&s.parentRule instanceof CSSGroupingRule||bt("CSSMediaRule")&&s.parentRule instanceof CSSMediaRule||bt("CSSSupportsRule")&&s.parentRule instanceof CSSSupportsRule||bt("CSSConditionRule")&&s.parentRule instanceof CSSConditionRule){const a=Array.from(s.parentRule.cssRules).indexOf(s);i.unshift(a)}else if(s.parentStyleSheet){const a=Array.from(s.parentStyleSheet.cssRules).indexOf(s);i.unshift(a)}return i}return r(e,t)}function Ie(e,t,r){let s,i;return e?(e.ownerNode?s=t.getId(e.ownerNode):i=r.getId(e),{styleId:i,id:s}):{}}function Ru({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:s}){if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};const i=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:z((n,c,d)=>{const[h,p]=d,{id:m,styleId:g}=Ie(c,t,r.styleMirror);return(m&&m!==-1||g&&g!==-1)&&e({id:m,styleId:g,adds:[{rule:h,index:p}]}),n.apply(c,d)})}),s.CSSStyleSheet.prototype.addRule=function(n,c,d=this.cssRules.length){const h=`${n} { ${c} }`;return s.CSSStyleSheet.prototype.insertRule.apply(this,[h,d])};const o=s.CSSStyleSheet.prototype.deleteRule;s.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:z((n,c,d)=>{const[h]=d,{id:p,styleId:m}=Ie(c,t,r.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,removes:[{index:h}]}),n.apply(c,d)})}),s.CSSStyleSheet.prototype.removeRule=function(n){return s.CSSStyleSheet.prototype.deleteRule.apply(this,[n])};let a;s.CSSStyleSheet.prototype.replace&&(a=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:z((n,c,d)=>{const[h]=d,{id:p,styleId:m}=Ie(c,t,r.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,replace:h}),n.apply(c,d)})}));let u;s.CSSStyleSheet.prototype.replaceSync&&(u=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:z((n,c,d)=>{const[h]=d,{id:p,styleId:m}=Ie(c,t,r.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,replaceSync:h}),n.apply(c,d)})}));const f={};St("CSSGroupingRule")?f.CSSGroupingRule=s.CSSGroupingRule:(St("CSSMediaRule")&&(f.CSSMediaRule=s.CSSMediaRule),St("CSSConditionRule")&&(f.CSSConditionRule=s.CSSConditionRule),St("CSSSupportsRule")&&(f.CSSSupportsRule=s.CSSSupportsRule));const l={};return Object.entries(f).forEach(([n,c])=>{l[n]={insertRule:c.prototype.insertRule,deleteRule:c.prototype.deleteRule},c.prototype.insertRule=new Proxy(l[n].insertRule,{apply:z((d,h,p)=>{const[m,g]=p,{id:w,styleId:y}=Ie(h.parentStyleSheet,t,r.styleMirror);return(w&&w!==-1||y&&y!==-1)&&e({id:w,styleId:y,adds:[{rule:m,index:[..._t(h),g||0]}]}),d.apply(h,p)})}),c.prototype.deleteRule=new Proxy(l[n].deleteRule,{apply:z((d,h,p)=>{const[m]=p,{id:g,styleId:w}=Ie(h.parentStyleSheet,t,r.styleMirror);return(g&&g!==-1||w&&w!==-1)&&e({id:g,styleId:w,removes:[{index:[..._t(h),m]}]}),d.apply(h,p)})})}),z(()=>{s.CSSStyleSheet.prototype.insertRule=i,s.CSSStyleSheet.prototype.deleteRule=o,a&&(s.CSSStyleSheet.prototype.replace=a),u&&(s.CSSStyleSheet.prototype.replaceSync=u),Object.entries(f).forEach(([n,c])=>{c.prototype.insertRule=l[n].insertRule,c.prototype.deleteRule=l[n].deleteRule})})}function ko({mirror:e,stylesheetManager:t},r){var s,i,o;let a=null;r.nodeName==="#document"?a=e.getId(r):a=e.getId(U.host(r));const u=r.nodeName==="#document"?(s=r.defaultView)==null?void 0:s.Document:(o=(i=r.ownerDocument)==null?void 0:i.defaultView)==null?void 0:o.ShadowRoot,f=u!=null&&u.prototype?Object.getOwnPropertyDescriptor(u==null?void 0:u.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!u||!f?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:f.configurable,enumerable:f.enumerable,get(){var l;return(l=f.get)==null?void 0:l.call(this)},set(l){var n;const c=(n=f.set)==null?void 0:n.call(this,l);if(a!==null&&a!==-1)try{t.adoptStyleSheets(l,a)}catch(d){}return c}}),z(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:f.configurable,enumerable:f.enumerable,get:f.get,set:f.set})}))}function Iu({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:s},{win:i}){const o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:z((u,f,l)=>{var n;const[c,d,h]=l;if(r.has(c))return o.apply(f,[c,d,h]);const{id:p,styleId:m}=Ie((n=f.parentRule)==null?void 0:n.parentStyleSheet,t,s.styleMirror);return(p&&p!==-1||m&&m!==-1)&&e({id:p,styleId:m,set:{property:c,value:d,priority:h},index:_t(f.parentRule)}),u.apply(f,l)})});const a=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:z((u,f,l)=>{var n;const[c]=l;if(r.has(c))return a.apply(f,[c]);const{id:d,styleId:h}=Ie((n=f.parentRule)==null?void 0:n.parentStyleSheet,t,s.styleMirror);return(d&&d!==-1||h&&h!==-1)&&e({id:d,styleId:h,remove:{property:c},index:_t(f.parentRule)}),u.apply(f,l)})}),z(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=a})}function Nu({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:s,sampling:i,doc:o}){const a=z(f=>Ze(z(l=>{const n=ft(l);if(!n||le(n,t,r,!0))return;const{currentTime:c,volume:d,muted:h,playbackRate:p,loop:m}=n;e({type:f,id:s.getId(n),currentTime:c,volume:d,muted:h,playbackRate:p,loop:m})}),i.media||500)),u=[ae("play",a(Ne.Play),o),ae("pause",a(Ne.Pause),o),ae("seeked",a(Ne.Seeked),o),ae("volumechange",a(Ne.VolumeChange),o),ae("ratechange",a(Ne.RateChange),o)];return z(()=>{u.forEach(f=>f())})}function Ou({fontCb:e,doc:t}){const r=t.defaultView;if(!r)return()=>{};const s=[],i=new WeakMap,o=r.FontFace;r.FontFace=function(f,l,n){const c=new o(f,l,n);return i.set(c,{family:f,buffer:typeof l!="string",descriptors:n,fontSource:typeof l=="string"?l:JSON.stringify(Array.from(new Uint8Array(l)))}),c};const a=Be(t.fonts,"add",function(u){return function(f){return setTimeout(z(()=>{const l=i.get(f);l&&(e(l),i.delete(f))}),0),u.apply(this,[f])}});return s.push(()=>{r.FontFace=o}),s.push(a),z(()=>{s.forEach(u=>u())})}function Du(e){const{doc:t,mirror:r,blockClass:s,blockSelector:i,selectionCb:o}=e;let a=!0;const u=z(()=>{const f=t.getSelection();if(!f||a&&(f!=null&&f.isCollapsed))return;a=f.isCollapsed||!1;const l=[],n=f.rangeCount||0;for(let c=0;c<n;c++){const d=f.getRangeAt(c),{startContainer:h,startOffset:p,endContainer:m,endOffset:g}=d;le(h,s,i,!0)||le(m,s,i,!0)||l.push({start:r.getId(h),startOffset:p,end:r.getId(m),endOffset:g})}o({ranges:l})});return u(),ae("selectionchange",u)}function Au({doc:e,customElementCb:t}){const r=e.defaultView;return!r||!r.customElements?()=>{}:Be(r.customElements,"define",function(i){return function(o,a,u){try{t({define:{name:o}})}catch(f){console.warn(`Custom element callback failed for ${o}`)}return i.apply(this,[o,a,u])}})}function Tu(e,t){const{mutationCb:r,mousemoveCb:s,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:a,inputCb:u,mediaInteractionCb:f,styleSheetRuleCb:l,styleDeclarationCb:n,canvasMutationCb:c,fontCb:d,selectionCb:h,customElementCb:p}=e;e.mutationCb=(...m)=>{t.mutation&&t.mutation(...m),r(...m)},e.mousemoveCb=(...m)=>{t.mousemove&&t.mousemove(...m),s(...m)},e.mouseInteractionCb=(...m)=>{t.mouseInteraction&&t.mouseInteraction(...m),i(...m)},e.scrollCb=(...m)=>{t.scroll&&t.scroll(...m),o(...m)},e.viewportResizeCb=(...m)=>{t.viewportResize&&t.viewportResize(...m),a(...m)},e.inputCb=(...m)=>{t.input&&t.input(...m),u(...m)},e.mediaInteractionCb=(...m)=>{t.mediaInteaction&&t.mediaInteaction(...m),f(...m)},e.styleSheetRuleCb=(...m)=>{t.styleSheetRule&&t.styleSheetRule(...m),l(...m)},e.styleDeclarationCb=(...m)=>{t.styleDeclaration&&t.styleDeclaration(...m),n(...m)},e.canvasMutationCb=(...m)=>{t.canvasMutation&&t.canvasMutation(...m),c(...m)},e.fontCb=(...m)=>{t.font&&t.font(...m),d(...m)},e.selectionCb=(...m)=>{t.selection&&t.selection(...m),h(...m)},e.customElementCb=(...m)=>{t.customElement&&t.customElement(...m),p(...m)}}function _u(e,t={}){const r=e.doc.defaultView;if(!r)return()=>{};Tu(e,t);let s;e.recordDOM&&(s=_o(e,e.doc));const i=Su(e),o=Cu(e),a=Po(e),u=Eu(e,{win:r}),f=Mu(e),l=Nu(e);let n=()=>{},c=()=>{},d=()=>{},h=()=>{};e.recordDOM&&(n=Ru(e,{win:r}),c=ko(e,e.doc),d=Iu(e,{win:r}),e.collectFonts&&(h=Ou(e)));const p=Du(e),m=Au(e),g=[];for(const w of e.plugins)g.push(w.observer(w.callback,r,w.options));return z(()=>{xe.forEach(w=>w.destroy()),xe.forEach(w=>w.reset()),s==null||s.disconnect(),i(),o(),a(),u(),f(),l(),n(),c(),d(),h(),p(),m(),g.forEach(w=>w()),xe.length=0})}function bt(e){return typeof window[e]!="undefined"}function St(e){return!!(typeof window[e]!="undefined"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class Mn{constructor(t){I(this,"iframeIdToRemoteIdMap",new WeakMap),I(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,s,i){const o=s||this.getIdToRemoteIdMap(t),a=i||this.getRemoteIdToIdMap(t);let u=o.get(r);return u||(u=this.generateIdFn(),o.set(r,u),a.set(u,r)),u}getIds(t,r){const s=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return r.map(o=>this.getId(t,o,s,i))}getRemoteId(t,r,s){const i=s||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;const o=i.get(r);return o||-1}getRemoteIds(t,r){const s=this.getRemoteIdToIdMap(t);return r.map(i=>this.getRemoteId(t,i,s))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}}class Pu{constructor(t){I(this,"iframes",new WeakMap),I(this,"crossOriginIframeMap",new WeakMap),I(this,"crossOriginIframeMirror",new Mn(Vn)),I(this,"crossOriginIframeStyleMirror"),I(this,"crossOriginIframeRootIdMap",new WeakMap),I(this,"mirror"),I(this,"mutationCb"),I(this,"wrappedEmit"),I(this,"loadListener"),I(this,"stylesheetManager"),I(this,"recordCrossOriginIframes"),I(this,"messageHandler"),I(this,"nestedIframeListeners",new Map),I(this,"attachedIframes",new Map),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Mn(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}removeLoadListener(){this.loadListener=void 0}trackIframeContent(t,r){const s=this.mirror.getId(t);return this.attachedIframes.set(s,{element:t,content:r}),s}attachIframe(t,r){var s;const i=this.trackIframeContent(t,r);this.mutationCb({adds:[{parentId:i,nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0});const o=t.contentWindow;if(this.recordCrossOriginIframes&&o&&!this.nestedIframeListeners.has(o)){const a=this.handleMessage.bind(this);this.nestedIframeListeners.set(o,a),o.addEventListener("message",a)}(s=this.loadListener)==null||s.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){const r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;const i=this.crossOriginIframeMap.get(t.source);if(!i)return;const o=this.transformCrossOriginEvent(i,r.data.event);o&&this.wrappedEmit(o,r.data.isCheckout)}transformCrossOriginEvent(t,r){var s;switch(r.type){case P.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);const i=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(r.data.node,i),this.trackIframeContent(t,r.data.node),{timestamp:r.timestamp,type:P.IncrementalSnapshot,data:{source:T.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case P.Meta:case P.Load:case P.DomContentLoaded:return!1;case P.Plugin:return r;case P.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case P.IncrementalSnapshot:switch(r.data.source){case T.Mutation:return r.data.adds.forEach(i=>{this.replaceIds(i,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,t);const o=this.crossOriginIframeRootIdMap.get(t);o&&this.patchRootIdOnNode(i.node,o)}),r.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"])}),r.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"])}),r.data.texts.forEach(i=>{this.replaceIds(i,t,["id"])}),r;case T.Drag:case T.TouchMove:case T.MouseMove:return r.data.positions.forEach(i=>{this.replaceIds(i,t,["id"])}),r;case T.ViewportResize:return!1;case T.MediaInteraction:case T.MouseInteraction:case T.Scroll:case T.CanvasMutation:case T.Input:return this.replaceIds(r.data,t,["id"]),r;case T.StyleSheetRule:case T.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case T.Font:return r;case T.Selection:return r.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"])}),r;case T.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(s=r.data.styles)==null||s.forEach(i=>{this.replaceStyleIds(i,t,["styleId"])}),r}}return!1}replace(t,r,s,i){for(const o of i)!Array.isArray(r[o])&&typeof r[o]!="number"||(Array.isArray(r[o])?r[o]=t.getIds(s,r[o]):r[o]=t.getId(s,r[o]));return r}replaceIds(t,r,s){return this.replace(this.crossOriginIframeMirror,t,r,s)}replaceStyleIds(t,r,s){return this.replace(this.crossOriginIframeStyleMirror,t,r,s)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(s=>{this.replaceIdOnNode(s,r)})}patchRootIdOnNode(t,r){t.type!==Ee.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(s=>{this.patchRootIdOnNode(s,r)})}removeIframeById(t){const r=this.attachedIframes.get(t);if(!r)return;const s=r.element.contentWindow;if(s&&this.nestedIframeListeners.has(s)){const i=this.nestedIframeListeners.get(s);s.removeEventListener("message",i),this.nestedIframeListeners.delete(s)}this.attachedIframes.delete(t)}reattachIframes(){this.attachedIframes.forEach(({content:t},r)=>{if(!this.mirror.has(r)){this.attachedIframes.delete(r);return}this.mutationCb({adds:[{parentId:r,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0})})}destroy(){this.recordCrossOriginIframes&&window.removeEventListener("message",this.messageHandler),this.nestedIframeListeners.forEach((t,r)=>{r.removeEventListener("message",t)}),this.nestedIframeListeners.clear(),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap}}class ku{constructor(t){I(this,"shadowDoms",new WeakSet),I(this,"mutationCb"),I(this,"scrollCb"),I(this,"bypassOptions"),I(this,"mirror"),I(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,r){if(!rt(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);const s=_o(ie(L({},this.bypassOptions),{doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push(()=>s.disconnect()),this.restoreHandlers.push(Po(ie(L({},this.bypassOptions),{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(U.host(t))),this.restoreHandlers.push(ko({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){const s=this;this.restoreHandlers.push(Be(t.prototype,"attachShadow",function(i){return function(o){const a=i.call(this,o),u=U.shadowRoot(this);return u&&js(this)&&s.addShadowRoot(u,r),a}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch(r){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}var Je="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",et=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(var Ct=0;Ct<Je.length;Ct++)et[Je.charCodeAt(Ct)]=Ct;var Lu=function(e){var t=new Uint8Array(e),r,s=t.length,i="";for(r=0;r<s;r+=3)i+=Je[t[r]>>2],i+=Je[(t[r]&3)<<4|t[r+1]>>4],i+=Je[(t[r+1]&15)<<2|t[r+2]>>6],i+=Je[t[r+2]&63];return s%3===2?i=i.substring(0,i.length-1)+"=":s%3===1&&(i=i.substring(0,i.length-2)+"=="),i},Fu=function(e){var t=e.length*.75,r=e.length,s,i=0,o,a,u,f;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var l=new ArrayBuffer(t),n=new Uint8Array(l);for(s=0;s<r;s+=4)o=et[e.charCodeAt(s)],a=et[e.charCodeAt(s+1)],u=et[e.charCodeAt(s+2)],f=et[e.charCodeAt(s+3)],n[i++]=o<<2|a>>4,n[i++]=(a&15)<<4|u>>2,n[i++]=(u&3)<<6|f&63;return l};const Rn=new Map;function Bu(e,t){let r=Rn.get(e);return r||(r=new Map,Rn.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}const Lo=(e,t,r)=>{if(!e||!(Bo(e,t)||typeof e=="object"))return;const s=e.constructor.name,i=Bu(r,s);let o=i.indexOf(e);return o===-1&&(o=i.length,i.push(e)),o};function Mt(e,t,r,s){if(e instanceof Array)return e.map(i=>Mt(i,t,r,s));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){const i=e.constructor.name,o=Lu(e);return{rr_type:i,base64:o}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Mt(e.buffer,t,r,s),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const i=e.constructor.name,{src:o}=e;return{rr_type:i,src:o}}else if(e instanceof HTMLCanvasElement){const i="HTMLImageElement",o=e.toDataURL(s.type,s.quality);return{rr_type:i,src:o}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[Mt(e.data,t,r,s),e.width,e.height]};if(Bo(e,t)||typeof e=="object"){const i=e.constructor.name,o=Lo(e,t,r);return{rr_type:i,index:o}}}}return e}const Fo=(e,t,r,s)=>e.map(i=>Mt(i,t,r,s)),Bo=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof t[i]=="function").find(i=>e instanceof t[i]);function Uu(e,t,r,s,i){const o=[],a=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const u of a)try{if(typeof t.CanvasRenderingContext2D.prototype[u]!="function")continue;const f=Be(t.CanvasRenderingContext2D.prototype,u,function(l){return function(...n){return le(this.canvas,r,s,!0)||setTimeout(()=>{const c=Fo(n,t,this,i);e(this.canvas,{type:Me["2D"],property:u,args:c})},0),l.apply(this,n)}});o.push(f)}catch(f){const l=ht(t.CanvasRenderingContext2D.prototype,u,{set(n){e(this.canvas,{type:Me["2D"],property:u,args:[n],setter:!0})}});o.push(l)}return()=>{o.forEach(u=>u())}}function Wu(e){return e==="experimental-webgl"?"webgl":e}function In(e,t,r,s){const i=[];try{const o=Be(e.HTMLCanvasElement.prototype,"getContext",function(a){return function(u,...f){if(!le(this,t,r,!0)){const l=Wu(u);if("__context"in this||(this.__context=l),s&&["webgl","webgl2"].includes(l))if(f[0]&&typeof f[0]=="object"){const n=f[0];n.preserveDrawingBuffer||(n.preserveDrawingBuffer=!0)}else f.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[u,...f])}});i.push(o)}catch(o){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(o=>o())}}function Nn(e,t,r,s,i,o,a){const u=[],f=Object.getOwnPropertyNames(e);for(const l of f)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if(typeof e[l]!="function")continue;const n=Be(e,l,function(c){return function(...d){const h=c.apply(this,d);if(Lo(h,o,this),"tagName"in this.canvas&&!le(this.canvas,s,i,!0)){const p=Fo(d,o,this,a),m={type:t,property:l,args:p};r(this.canvas,m)}return h}});u.push(n)}catch(n){const c=ht(e,l,{set(d){r(this.canvas,{type:t,property:l,args:[d],setter:!0})}});u.push(c)}return u}function $u(e,t,r,s,i){const o=[];return o.push(...Nn(t.WebGLRenderingContext.prototype,Me.WebGL,e,r,s,t,i)),typeof t.WebGL2RenderingContext!="undefined"&&o.push(...Nn(t.WebGL2RenderingContext.prototype,Me.WebGL2,e,r,s,t,i)),()=>{o.forEach(a=>a())}}const Uo=`(function() {
60
60
  "use strict";
61
61
  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
62
62
  var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);