@posthog/rrweb-record 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.
- package/dist/rrweb-record.cjs +3 -0
- package/dist/rrweb-record.cjs.map +1 -1
- package/dist/rrweb-record.js +3 -0
- package/dist/rrweb-record.js.map +1 -1
- package/dist/rrweb-record.umd.cjs +3 -0
- package/dist/rrweb-record.umd.cjs.map +2 -2
- package/dist/rrweb-record.umd.min.cjs +1 -1
- package/dist/rrweb-record.umd.min.cjs.map +2 -2
- package/package.json +4 -4
|
@@ -55,7 +55,7 @@ https://www.w3ctech.com/topic/2226`));let O=y(...M);return O.postcssPlugin=x,O.p
|
|
|
55
55
|
https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(x+`: \u91CC\u9762 postcss.plugin \u88AB\u5F03\u7528. \u8FC1\u79FB\u6307\u5357:
|
|
56
56
|
https://www.w3ctech.com/topic/2226`));let O=y(...M);return O.postcssPlugin=x,O.postcssVersion=new l().version,O}let R;return Object.defineProperty(C,"postcss",{get(){return R||(R=C()),R}}),C.process=function(M,O,N){return w([C(N)]).process(M,O)},C},w.stringify=g,w.parse=u,w.fromJSON=c,w.list=h,w.comment=v=>new t(v),w.atRule=v=>new e(v),w.decl=v=>new i(v),w.rule=v=>new f(v),w.root=v=>new p(v),w.document=v=>new a(v),w.CssSyntaxError=o,w.Declaration=i,w.Container=s,w.Processor=l,w.Document=a,w.Comment=t,w.Warning=S,w.AtRule=e,w.Result=n,w.Input=d,w.Rule=f,w.Root=p,w.Node=r,m.registerPostcss(w),Ir=w,w.default=w,Ir}var Mr,Si;function ta(){if(Si)return Mr;Si=1;let e=Ve(),t=an(),s=on();class o extends t{checkMissedSemicolon(){}comment(a){let c=new e;this.init(c,a[2]);let d=this.input.fromOffset(a[3])||this.input.fromOffset(this.input.css.length-1);c.source.end={column:d.col,line:d.line,offset:a[3]+1};let m=a[1].slice(2);if(m.slice(-2)==="*/"&&(m=m.slice(0,-2)),/^\s*$/.test(m))c.text="",c.raws.left=m,c.raws.right="";else{let h=m.match(/^(\s*)([^]*\S)(\s*)$/);c.text=h[2],c.raws.left=h[1],c.raws.right=h[3]}}createTokenizer(){this.tokenizer=s(this.input,{ignoreErrors:!0})}decl(a){a.length>1&&a.some(c=>c[0]==="word")&&super.decl(a)}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(a){let c=this.colon(a);if(c===!1)return;let d,m;for(d=c-1;d>=0&&a[d][0]!=="word";d--);if(d===0||d<0)return;for(m=d-1;m>=0;m--)if(a[m][0]!=="space"){m+=1;break}let h=a.slice(d),r=a.slice(m,d);a.splice(m,a.length-m),this.spaces=r.map(u=>u[1]).join(""),this.decl(h)}unclosedBracket(){}unexpectedClose(){this.current.raws.after+="}"}unknownWord(a){this.spaces+=a.map(c=>c[1]).join("")}unnamedAtrule(a){a.name=""}}return Mr=o,Mr}var Er,vi;function ra(){if(vi)return Er;vi=1;let{Input:e}=hn(),t=ta();return Er=function(o,i){let a=new e(o,i),c=new t(a);return c.parse(),c.root},Er}ra();var sa=hn();const q=Vo(sa);q.stringify;q.fromJSON;q.plugin;q.parse;q.list;q.document;q.comment;q.atRule;q.rule;q.decl;q.root;q.CssSyntaxError;q.Declaration;q.Container;q.Processor;q.Document;q.Comment;q.Warning;q.AtRule;q.Result;q.Input;q.Rule;q.Root;q.Node;class es{constructor(...t){ue(this,"parentElement",null),ue(this,"parentNode",null),ue(this,"ownerDocument"),ue(this,"firstChild",null),ue(this,"lastChild",null),ue(this,"previousSibling",null),ue(this,"nextSibling",null),ue(this,"ELEMENT_NODE",1),ue(this,"TEXT_NODE",3),ue(this,"nodeType"),ue(this,"nodeName"),ue(this,"RRNodeType")}get childNodes(){const t=[];let s=this.firstChild;for(;s;)t.push(s),s=s.nextSibling;return t}contains(t){if(t instanceof es){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,s){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"}}const Ci={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},xi={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},tt={};function ia(e){var t,s;const o=(s=(t=globalThis==null?void 0:globalThis.Zone)==null?void 0:t.__symbol__)==null?void 0:s.call(t,e);if(o&&globalThis[o])return globalThis[o]}function ts(e){if(tt[e])return tt[e];const t=ia(e)||globalThis[e],s=t.prototype,o=e in Ci?Ci[e]:void 0,i=!!(o&&o.every(d=>{var m,h;return!!((h=(m=Object.getOwnPropertyDescriptor(s,d))==null?void 0:m.get)!=null&&h.toString().includes("[native code]"))})),a=e in xi?xi[e]:void 0,c=!!(a&&a.every(d=>{var m;return typeof s[d]=="function"&&((m=s[d])==null?void 0:m.toString().includes("[native code]"))}));if(i&&c)return tt[e]=t.prototype,t.prototype;try{const d=document.createElement("iframe");document.body.appendChild(d);const m=d.contentWindow;if(!m)return t.prototype;const h=m[e].prototype;return document.body.removeChild(d),h?tt[e]=h:s}catch(d){return s}}const Ar={};function Ce(e,t,s){var o;const i=`${e}.${String(s)}`;if(Ar[i])return Ar[i].call(t);const a=ts(e),c=(o=Object.getOwnPropertyDescriptor(a,s))==null?void 0:o.get;return c?(Ar[i]=c,c.call(t)):t[s]}const Pr={};function fn(e,t,s){const o=`${e}.${String(s)}`;if(Pr[o])return Pr[o].bind(t);const a=ts(e)[s];return typeof a!="function"?t[s]:(Pr[o]=a,a.bind(t))}function na(e){return Ce("Node",e,"childNodes")}function oa(e){return Ce("Node",e,"parentNode")}function aa(e){return Ce("Node",e,"parentElement")}function la(e){return Ce("Node",e,"textContent")}function ua(e,t){return fn("Node",e,"contains")(t)}function ca(e){return fn("Node",e,"getRootNode")()}function ha(e){return!e||!("host"in e)?null:Ce("ShadowRoot",e,"host")}function fa(e){return e.styleSheets}function pa(e){return!e||!("shadowRoot"in e)?null:Ce("Element",e,"shadowRoot")}function da(e,t){return Ce("Element",e,"querySelector")(t)}function ma(e,t){return Ce("Element",e,"querySelectorAll")(t)}function pn(){return ts("MutationObserver").constructor}function Ee(e,t,s){try{if(!(t in e))return()=>{};const o=e[t],i=s(o);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:o}})),e[t]=i,()=>{e[t]=o}}catch(o){return()=>{}}}const k={childNodes:na,parentNode:oa,parentElement:aa,textContent:la,contains:ua,getRootNode:ca,host:ha,styleSheets:fa,shadowRoot:pa,querySelector:da,querySelectorAll:ma,mutationObserver:pn,patch:Ee};function se(e,t,s=document){const o={capture:!0,passive:!0};return s.addEventListener(e,t,o),()=>s.removeEventListener(e,t,o)}const ke=`Please stop import mirror directly. Instead of that,\r
|
|
57
57
|
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
|
|
58
|
-
or you can use record.mirror to access the mirror instance during recording.`;let Ri={map:{},getId(){return console.error(ke),-1},getNode(){return console.error(ke),null},removeNodeFromMap(){console.error(ke)},has(){return console.error(ke),!1},reset(){console.error(ke)}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(Ri=new Proxy(Ri,{get(e,t,s){return t==="map"&&console.error(ke),Reflect.get(e,t,s)}}));function qe(e,t,s={}){let o=null,i=0;return function(...a){const c=Date.now();!i&&s.leading===!1&&(i=c);const d=t-(c-i),m=this;d<=0||d>t?(o&&(clearTimeout(o),o=null),i=c,e.apply(m,a)):!o&&s.trailing!==!1&&(o=setTimeout(()=>{i=s.leading===!1?0:Date.now(),o=null,e.apply(m,a)},d))}}function vt(e,t,s,o,i=window){const a=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,o?s:{set(c){setTimeout(()=>{s.set.call(this,c)},0),a&&a.set&&a.set.call(this,c)}}),()=>vt(e,t,a||{},!0)}let ct=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(ct=()=>new Date().getTime());function dn(e){var t,s,o,i;const a=e.document;return{left:a.scrollingElement?a.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:a.documentElement.scrollLeft||(a==null?void 0:a.body)&&((t=k.parentElement(a.body))==null?void 0:t.scrollLeft)||((s=a==null?void 0:a.body)==null?void 0:s.scrollLeft)||0,top:a.scrollingElement?a.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:(a==null?void 0:a.documentElement.scrollTop)||(a==null?void 0:a.body)&&((o=k.parentElement(a.body))==null?void 0:o.scrollTop)||((i=a==null?void 0:a.body)==null?void 0:i.scrollTop)||0}}function mn(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function gn(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function yn(e){return e?e.nodeType===e.ELEMENT_NODE?e:k.parentElement(e):null}function ie(e,t,s,o){if(!e)return!1;const i=yn(e);if(!i)return!1;try{if(typeof t=="string"){if(i.classList.contains(t)||o&&i.closest("."+t)!==null)return!0}else if(ut(i,t,o))return!0}catch(a){}return!!(s&&(i.matches(s)||o&&i.closest(s)!==null))}function ga(e,t){return t.getId(e)!==-1}function Nr(e,t,s){return e.tagName==="TITLE"&&s.headTitleMutations?!0:t.getId(e)===ze}function wn(e,t){if($e(e))return!1;const s=t.getId(e);if(!t.has(s))return!0;const o=k.parentNode(e);return o&&o.nodeType===e.DOCUMENT_NODE?!1:o?wn(o,t):!0}function kr(e){return!!e.changedTouches}function ya(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 bn(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Sn(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Lr(e){return e?e instanceof es&&"shadowRoot"in e?!!e.shadowRoot:!!k.shadowRoot(e):!1}class wa{constructor(){P(this,"id",1),P(this,"styleIDMap",new WeakMap),P(this,"idStyleMap",new Map)}getId(t){var s;return(s=this.styleIDMap.get(t))!=null?s:-1}has(t){return this.styleIDMap.has(t)}add(t,s){if(this.has(t))return this.getId(t);let o;return s===void 0?o=this.id++:o=s,this.styleIDMap.set(t,o),this.idStyleMap.set(o,t),o}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 vn(e){var t;let s=null;return"getRootNode"in e&&((t=k.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&k.host(k.getRootNode(e))&&(s=k.host(k.getRootNode(e))),s}function ba(e){let t=e,s;for(;s=vn(t);)t=s;return t}function Sa(e){const t=e.ownerDocument;if(!t)return!1;const s=ba(e);return k.contains(t,s)}function Cn(e){const t=e.ownerDocument;return t?k.contains(t,e)||Sa(e):!1}var B=(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))(B||{}),D=(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))(D||{}),ne=(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))(ne||{}),ye=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(ye||{}),Be=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Be||{}),Le=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(Le||{}),xn=(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))(xn||{});function Oi(e){return"__ln"in e}class va{constructor(){P(this,"length",0),P(this,"head",null),P(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let s=this.head;for(let o=0;o<t;o++)s=(s==null?void 0:s.next)||null;return s}addNode(t){const s={value:t,previous:null,next:null};if(t.__ln=s,t.previousSibling&&Oi(t.previousSibling)){const o=t.previousSibling.__ln.next;s.next=o,s.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=s,o&&(o.previous=s)}else if(t.nextSibling&&Oi(t.nextSibling)&&t.nextSibling.__ln.previous){const o=t.nextSibling.__ln.previous;s.previous=o,s.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=s,o&&(o.next=s)}else this.head&&(this.head.previous=s),s.next=this.head,this.head=s;s.next===null&&(this.tail=s),this.length++}removeNode(t){const s=t.__ln;this.head&&(s.previous?(s.previous.next=s.next,s.next?s.next.previous=s.previous:this.tail=s.previous):(this.head=s.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}}const Ii=(e,t)=>`${e}@${t}`;class Ca{constructor(){P(this,"frozen",!1),P(this,"locked",!1),P(this,"texts",[]),P(this,"attributes",[]),P(this,"attributeMap",new WeakMap),P(this,"removes",[]),P(this,"mapRemoves",[]),P(this,"movedMap",{}),P(this,"addedSet",new Set),P(this,"movedSet",new Set),P(this,"droppedSet",new Set),P(this,"removesSubTreeCache",new Set),P(this,"mutationCb"),P(this,"blockClass"),P(this,"blockSelector"),P(this,"maskTextClass"),P(this,"maskTextSelector"),P(this,"inlineStylesheet"),P(this,"maskInputOptions"),P(this,"maskTextFn"),P(this,"maskInputFn"),P(this,"keepIframeSrcFn"),P(this,"recordCanvas"),P(this,"inlineImages"),P(this,"slimDOMOptions"),P(this,"dataURLOptions"),P(this,"doc"),P(this,"mirror"),P(this,"iframeManager"),P(this,"stylesheetManager"),P(this,"shadowDomManager"),P(this,"canvasManager"),P(this,"processedNodeManager"),P(this,"unattachedDoc"),P(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),P(this,"emit",()=>{if(this.frozen||this.locked)return;const t=[],s=new Set,o=new va,i=m=>{let h=m,r=ze;for(;r===ze;)h=h&&h.nextSibling,r=h&&this.mirror.getId(h);return r},a=m=>{const h=k.parentNode(m);if(!h||!Cn(m)||h.tagName==="TEXTAREA")return;const r=$e(h)?this.mirror.getId(vn(m)):this.mirror.getId(h),u=i(m);if(r===-1||u===-1)return o.addNode(m);const l=Te(m,{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:n=>{bn(n,this.mirror)&&this.iframeManager.addIframe(n),Sn(n,this.mirror)&&this.stylesheetManager.trackLinkElement(n),Lr(m)&&this.shadowDomManager.addShadowRoot(k.shadowRoot(m),this.doc)},onIframeLoad:(n,p)=>{this.iframeManager.attachIframe(n,p),this.shadowDomManager.observeAttachShadow(n)},onStylesheetLoad:(n,p)=>{this.stylesheetManager.attachLinkElement(n,p)}});l&&(t.push({parentId:r,nextId:u,node:l}),s.add(l.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const m of this.movedSet)Mi(this.removesSubTreeCache,m,this.mirror)&&!this.movedSet.has(k.parentNode(m))||a(m);for(const m of this.addedSet)!Ei(this.droppedSet,m)&&!Mi(this.removesSubTreeCache,m,this.mirror)||Ei(this.movedSet,m)?a(m):this.droppedSet.add(m);let c=null;for(;o.length;){let m=null;if(c){const h=this.mirror.getId(k.parentNode(c.value)),r=i(c.value);h!==-1&&r!==-1&&(m=c)}if(!m){let h=o.tail;for(;h;){const r=h;if(h=h.previous,r){const u=this.mirror.getId(k.parentNode(r.value));if(i(r.value)===-1)continue;if(u!==-1){m=r;break}else{const n=r.value,p=k.parentNode(n);if(p&&p.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const f=k.host(p);if(this.mirror.getId(f)!==-1){m=r;break}}}}}}if(!m){for(;o.head;)o.removeNode(o.head.value);break}c=m.previous,o.removeNode(m.value),a(m.value)}const d={texts:this.texts.map(m=>{const h=m.node,r=k.parentNode(h);return r&&r.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(r),{id:this.mirror.getId(h),value:m.value}}).filter(m=>!s.has(m.id)).filter(m=>this.mirror.has(m.id)),attributes:this.attributes.map(m=>{const{attributes:h}=m;if(typeof h.style=="string"){const r=JSON.stringify(m.styleDiff),u=JSON.stringify(m._unchangedStyles);r.length<h.style.length&&(r+u).split("var(").length===h.style.split("var(").length&&(h.style=m.styleDiff)}return{id:this.mirror.getId(m.node),attributes:h}}).filter(m=>!s.has(m.id)).filter(m=>this.mirror.has(m.id)),removes:this.removes,adds:t};!d.texts.length&&!d.attributes.length&&!d.removes.length&&!d.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(d))}),P(this,"genTextAreaValueMutation",t=>{let s=this.attributeMap.get(t);s||(s={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(s),this.attributeMap.set(t,s)),s.attributes.value=Array.from(k.childNodes(t),o=>k.textContent(o)||"").join("")}),P(this,"processMutation",t=>{if(!Nr(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const s=k.textContent(t.target);!ie(t.target,this.blockClass,this.blockSelector,!1)&&s!==t.oldValue&&this.texts.push({value:ji(t.target,this.maskTextClass,this.maskTextSelector,!0)&&s?this.maskTextFn?this.maskTextFn(s,yn(t.target)):s.replace(/[\S]/g,"*"):s,node:t.target});break}case"attributes":{const s=t.target;let o=t.attributeName,i=t.target.getAttribute(o);if(o==="value"){const c=Br(s);i=Fr({element:s,maskInputOptions:this.maskInputOptions,tagName:s.tagName,type:c,value:i,maskInputFn:this.maskInputFn})}if(ie(t.target,this.blockClass,this.blockSelector,!1)||i===t.oldValue)return;let a=this.attributeMap.get(t.target);if(s.tagName==="IFRAME"&&o==="src"&&!this.keepIframeSrcFn(i))if(!s.contentDocument)o="rr_src";else return;if(a||(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(t.target,a)),o==="type"&&s.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&s.setAttribute("data-rr-is-password","true"),!qi(s.tagName,o))if(a.attributes[o]=zi(this.doc,Oe(s.tagName),Oe(o),i,s,this.dataURLOptions),o==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(d){this.unattachedDoc=this.doc}const c=this.unattachedDoc.createElement("span");t.oldValue&&c.setAttribute("style",t.oldValue);for(const d of Array.from(s.style)){const m=s.style.getPropertyValue(d),h=s.style.getPropertyPriority(d);m!==c.style.getPropertyValue(d)||h!==c.style.getPropertyPriority(d)?h===""?a.styleDiff[d]=m:a.styleDiff[d]=[m,h]:a._unchangedStyles[d]=[m,h]}for(const d of Array.from(c.style))s.style.getPropertyValue(d)===""&&(a.styleDiff[d]=!1)}else o==="open"&&s.tagName==="DIALOG"&&(s.matches("dialog:modal")?a.attributes.rr_open_mode="modal":a.attributes.rr_open_mode="non-modal");break}case"childList":{if(ie(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(s=>this.genAdds(s,t.target)),t.removedNodes.forEach(s=>{const o=this.mirror.getId(s),i=$e(t.target)?this.mirror.getId(k.host(t.target)):this.mirror.getId(t.target);ie(t.target,this.blockClass,this.blockSelector,!1)||Nr(s,this.mirror,this.slimDOMOptions)||!ga(s,this.mirror)||(this.addedSet.has(s)?(Dr(this.addedSet,s),this.droppedSet.add(s)):this.addedSet.has(t.target)&&o===-1||wn(t.target,this.mirror)||(this.movedSet.has(s)&&this.movedMap[Ii(o,i)]?Dr(this.movedSet,s):(this.removes.push({parentId:i,id:o,isShadow:$e(t.target)&&Ue(t.target)?!0:void 0}),xa(s,this.removesSubTreeCache))),this.mapRemoves.push(s))});break}}}),P(this,"genAdds",(t,s)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(Nr(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let o=null;s&&this.mirror.hasNode(s)&&(o=this.mirror.getId(s)),o&&o!==-1&&(this.movedMap[Ii(this.mirror.getId(t),o)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);ie(t,this.blockClass,this.blockSelector,!1)||(k.childNodes(t).forEach(o=>this.genAdds(o)),Lr(t)&&k.childNodes(k.shadowRoot(t)).forEach(o=>{this.processedNodeManager.add(o,this),this.genAdds(o,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(s=>{this[s]=t[s]})}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 Dr(e,t){e.delete(t),k.childNodes(t).forEach(s=>Dr(e,s))}function xa(e,t){const s=[e];for(;s.length;){const o=s.pop();t.has(o)||(t.add(o),k.childNodes(o).forEach(i=>s.push(i)))}}function Mi(e,t,s){return e.size===0?!1:Ra(e,t)}function Ra(e,t,s){const o=k.parentNode(t);return o?e.has(o):!1}function Ei(e,t){return e.size===0?!1:Rn(e,t)}function Rn(e,t){const s=k.parentNode(t);return s?e.has(s)?!0:Rn(e,s):!1}let We;function Oa(e){We=e}function Ia(){We=void 0}const F=e=>We?(...s)=>{try{return e(...s)}catch(o){if(We&&We(o)===!0)return;throw o}}:e,we=[];function Je(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 On(e,t){const s=new Ca;we.push(s),s.init(e);const o=new(pn())(F(s.processMutations.bind(s)));return o.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),o}function Ma({mousemoveCb:e,sampling:t,doc:s,mirror:o}){if(t.mousemove===!1)return()=>{};const i=typeof t.mousemove=="number"?t.mousemove:50,a=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500;let c=[],d;const m=qe(F(u=>{const l=Date.now()-d;e(c.map(n=>(n.timeOffset-=l,n)),u),c=[],d=null}),a),h=F(qe(F(u=>{const l=Je(u),{clientX:n,clientY:p}=kr(u)?u.changedTouches[0]:u;d||(d=ct()),c.push({x:n,y:p,id:o.getId(l),timeOffset:ct()-d}),m(typeof DragEvent!="undefined"&&u instanceof DragEvent?D.Drag:u instanceof MouseEvent?D.MouseMove:D.TouchMove)}),i,{trailing:!1})),r=[se("mousemove",h,s),se("touchmove",h,s),se("drag",h,s)];return F(()=>{r.forEach(u=>u())})}function Ea({mouseInteractionCb:e,doc:t,mirror:s,blockClass:o,blockSelector:i,sampling:a}){if(a.mouseInteraction===!1)return()=>{};const c=a.mouseInteraction===!0||a.mouseInteraction===void 0?{}:a.mouseInteraction,d=[];let m=null;const h=r=>u=>{const l=Je(u);if(ie(l,o,i,!0))return;let n=null,p=r;if("pointerType"in u){switch(u.pointerType){case"mouse":n=ye.Mouse;break;case"touch":n=ye.Touch;break;case"pen":n=ye.Pen;break}n===ye.Touch?ne[r]===ne.MouseDown?p="TouchStart":ne[r]===ne.MouseUp&&(p="TouchEnd"):ye.Pen}else kr(u)&&(n=ye.Touch);n!==null?(m=n,(p.startsWith("Touch")&&n===ye.Touch||p.startsWith("Mouse")&&n===ye.Mouse)&&(n=null)):ne[r]===ne.Click&&(n=m,m=null);const f=kr(u)?u.changedTouches[0]:u;if(!f)return;const g=s.getId(l),{clientX:S,clientY:w}=f;F(e)(L({type:ne[p],id:g,x:S,y:w},n!==null&&{pointerType:n}))};return Object.keys(ne).filter(r=>Number.isNaN(Number(r))&&!r.endsWith("_Departed")&&c[r]!==!1).forEach(r=>{let u=Oe(r);const l=h(r);if(window.PointerEvent)switch(ne[r]){case ne.MouseDown:case ne.MouseUp:u=u.replace("mouse","pointer");break;case ne.TouchStart:case ne.TouchEnd:return}d.push(se(u,l,t))}),F(()=>{d.forEach(r=>r())})}function In({scrollCb:e,doc:t,mirror:s,blockClass:o,blockSelector:i,sampling:a}){const c=F(qe(F(d=>{const m=Je(d);if(!m||ie(m,o,i,!0))return;const h=s.getId(m);if(m===t&&t.defaultView){const r=dn(t.defaultView);e({id:h,x:r.left,y:r.top})}else e({id:h,x:m.scrollLeft,y:m.scrollTop})}),a.scroll||100));return se("scroll",c,t)}function Aa({viewportResizeCb:e},{win:t}){let s=-1,o=-1;const i=F(qe(F(()=>{const a=mn(),c=gn();(s!==a||o!==c)&&(e({width:Number(c),height:Number(a)}),s=a,o=c)}),200));return se("resize",i,t)}const Pa=["INPUT","TEXTAREA","SELECT"],Ai=new WeakMap;function Na({inputCb:e,doc:t,mirror:s,blockClass:o,blockSelector:i,ignoreClass:a,ignoreSelector:c,maskInputOptions:d,maskInputFn:m,sampling:h,userTriggeredOnInput:r}){function u(w){let v=Je(w);const x=w.isTrusted,y=v&&v.tagName;if(v&&y==="OPTION"&&(v=k.parentElement(v)),!v||!y||Pa.indexOf(y)<0||ie(v,o,i,!0)||v.classList.contains(a)||c&&v.matches(c))return;let b=v.value,C=!1;const R=Br(v)||"";R==="radio"||R==="checkbox"?C=v.checked:(d[y.toLowerCase()]||d[R])&&(b=Fr({element:v,maskInputOptions:d,tagName:y,type:R,value:b,maskInputFn:m})),l(v,r?{text:b,isChecked:C,userTriggered:x}:{text:b,isChecked:C});const M=v.name;R==="radio"&&M&&C&&t.querySelectorAll(`input[type="radio"][name="${M}"]`).forEach(O=>{if(O!==v){const N=O.value;l(O,r?{text:N,isChecked:!C,userTriggered:!1}:{text:N,isChecked:!C})}})}function l(w,v){const x=Ai.get(w);if(!x||x.text!==v.text||x.isChecked!==v.isChecked){Ai.set(w,v);const y=s.getId(w);F(e)(le(L({},v),{id:y}))}}const p=(h.input==="last"?["change"]:["input","change"]).map(w=>se(w,F(u),t)),f=t.defaultView;if(!f)return()=>{p.forEach(w=>w())};const g=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),S=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return g&&g.set&&p.push(...S.map(w=>vt(w[0],w[1],{set(){F(u)({target:this,isTrusted:!1})}},!1,f))),F(()=>{p.forEach(w=>w())})}function ht(e){const t=[];function s(o,i){if(rt("CSSGroupingRule")&&o.parentRule instanceof CSSGroupingRule||rt("CSSMediaRule")&&o.parentRule instanceof CSSMediaRule||rt("CSSSupportsRule")&&o.parentRule instanceof CSSSupportsRule||rt("CSSConditionRule")&&o.parentRule instanceof CSSConditionRule){const c=Array.from(o.parentRule.cssRules).indexOf(o);i.unshift(c)}else if(o.parentStyleSheet){const c=Array.from(o.parentStyleSheet.cssRules).indexOf(o);i.unshift(c)}return i}return s(e,t)}function Se(e,t,s){let o,i;return e?(e.ownerNode?o=t.getId(e.ownerNode):i=s.getId(e),{styleId:i,id:o}):{}}function _a({styleSheetRuleCb:e,mirror:t,stylesheetManager:s},{win:o}){if(!o.CSSStyleSheet||!o.CSSStyleSheet.prototype)return()=>{};const i=o.CSSStyleSheet.prototype.insertRule;o.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:F((r,u,l)=>{const[n,p]=l,{id:f,styleId:g}=Se(u,t,s.styleMirror);return(f&&f!==-1||g&&g!==-1)&&e({id:f,styleId:g,adds:[{rule:n,index:p}]}),r.apply(u,l)})}),o.CSSStyleSheet.prototype.addRule=function(r,u,l=this.cssRules.length){const n=`${r} { ${u} }`;return o.CSSStyleSheet.prototype.insertRule.apply(this,[n,l])};const a=o.CSSStyleSheet.prototype.deleteRule;o.CSSStyleSheet.prototype.deleteRule=new Proxy(a,{apply:F((r,u,l)=>{const[n]=l,{id:p,styleId:f}=Se(u,t,s.styleMirror);return(p&&p!==-1||f&&f!==-1)&&e({id:p,styleId:f,removes:[{index:n}]}),r.apply(u,l)})}),o.CSSStyleSheet.prototype.removeRule=function(r){return o.CSSStyleSheet.prototype.deleteRule.apply(this,[r])};let c;o.CSSStyleSheet.prototype.replace&&(c=o.CSSStyleSheet.prototype.replace,o.CSSStyleSheet.prototype.replace=new Proxy(c,{apply:F((r,u,l)=>{const[n]=l,{id:p,styleId:f}=Se(u,t,s.styleMirror);return(p&&p!==-1||f&&f!==-1)&&e({id:p,styleId:f,replace:n}),r.apply(u,l)})}));let d;o.CSSStyleSheet.prototype.replaceSync&&(d=o.CSSStyleSheet.prototype.replaceSync,o.CSSStyleSheet.prototype.replaceSync=new Proxy(d,{apply:F((r,u,l)=>{const[n]=l,{id:p,styleId:f}=Se(u,t,s.styleMirror);return(p&&p!==-1||f&&f!==-1)&&e({id:p,styleId:f,replaceSync:n}),r.apply(u,l)})}));const m={};st("CSSGroupingRule")?m.CSSGroupingRule=o.CSSGroupingRule:(st("CSSMediaRule")&&(m.CSSMediaRule=o.CSSMediaRule),st("CSSConditionRule")&&(m.CSSConditionRule=o.CSSConditionRule),st("CSSSupportsRule")&&(m.CSSSupportsRule=o.CSSSupportsRule));const h={};return Object.entries(m).forEach(([r,u])=>{h[r]={insertRule:u.prototype.insertRule,deleteRule:u.prototype.deleteRule},u.prototype.insertRule=new Proxy(h[r].insertRule,{apply:F((l,n,p)=>{const[f,g]=p,{id:S,styleId:w}=Se(n.parentStyleSheet,t,s.styleMirror);return(S&&S!==-1||w&&w!==-1)&&e({id:S,styleId:w,adds:[{rule:f,index:[...ht(n),g||0]}]}),l.apply(n,p)})}),u.prototype.deleteRule=new Proxy(h[r].deleteRule,{apply:F((l,n,p)=>{const[f]=p,{id:g,styleId:S}=Se(n.parentStyleSheet,t,s.styleMirror);return(g&&g!==-1||S&&S!==-1)&&e({id:g,styleId:S,removes:[{index:[...ht(n),f]}]}),l.apply(n,p)})})}),F(()=>{o.CSSStyleSheet.prototype.insertRule=i,o.CSSStyleSheet.prototype.deleteRule=a,c&&(o.CSSStyleSheet.prototype.replace=c),d&&(o.CSSStyleSheet.prototype.replaceSync=d),Object.entries(m).forEach(([r,u])=>{u.prototype.insertRule=h[r].insertRule,u.prototype.deleteRule=h[r].deleteRule})})}function Mn({mirror:e,stylesheetManager:t},s){var o,i,a;let c=null;s.nodeName==="#document"?c=e.getId(s):c=e.getId(k.host(s));const d=s.nodeName==="#document"?(o=s.defaultView)==null?void 0:o.Document:(a=(i=s.ownerDocument)==null?void 0:i.defaultView)==null?void 0:a.ShadowRoot,m=d!=null&&d.prototype?Object.getOwnPropertyDescriptor(d==null?void 0:d.prototype,"adoptedStyleSheets"):void 0;return c===null||c===-1||!d||!m?()=>{}:(Object.defineProperty(s,"adoptedStyleSheets",{configurable:m.configurable,enumerable:m.enumerable,get(){var h;return(h=m.get)==null?void 0:h.call(this)},set(h){var r;const u=(r=m.set)==null?void 0:r.call(this,h);if(c!==null&&c!==-1)try{t.adoptStyleSheets(h,c)}catch(l){}return u}}),F(()=>{Object.defineProperty(s,"adoptedStyleSheets",{configurable:m.configurable,enumerable:m.enumerable,get:m.get,set:m.set})}))}function ka({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:s,stylesheetManager:o},{win:i}){const a=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:F((d,m,h)=>{var r;const[u,l,n]=h;if(s.has(u))return a.apply(m,[u,l,n]);const{id:p,styleId:f}=Se((r=m.parentRule)==null?void 0:r.parentStyleSheet,t,o.styleMirror);return(p&&p!==-1||f&&f!==-1)&&e({id:p,styleId:f,set:{property:u,value:l,priority:n},index:ht(m.parentRule)}),d.apply(m,h)})});const c=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(c,{apply:F((d,m,h)=>{var r;const[u]=h;if(s.has(u))return c.apply(m,[u]);const{id:l,styleId:n}=Se((r=m.parentRule)==null?void 0:r.parentStyleSheet,t,o.styleMirror);return(l&&l!==-1||n&&n!==-1)&&e({id:l,styleId:n,remove:{property:u},index:ht(m.parentRule)}),d.apply(m,h)})}),F(()=>{i.CSSStyleDeclaration.prototype.setProperty=a,i.CSSStyleDeclaration.prototype.removeProperty=c})}function La({mediaInteractionCb:e,blockClass:t,blockSelector:s,mirror:o,sampling:i,doc:a}){const c=F(m=>qe(F(h=>{const r=Je(h);if(!r||ie(r,t,s,!0))return;const{currentTime:u,volume:l,muted:n,playbackRate:p,loop:f}=r;e({type:m,id:o.getId(r),currentTime:u,volume:l,muted:n,playbackRate:p,loop:f})}),i.media||500)),d=[se("play",c(Le.Play),a),se("pause",c(Le.Pause),a),se("seeked",c(Le.Seeked),a),se("volumechange",c(Le.VolumeChange),a),se("ratechange",c(Le.RateChange),a)];return F(()=>{d.forEach(m=>m())})}function Da({fontCb:e,doc:t}){const s=t.defaultView;if(!s)return()=>{};const o=[],i=new WeakMap,a=s.FontFace;s.FontFace=function(m,h,r){const u=new a(m,h,r);return i.set(u,{family:m,buffer:typeof h!="string",descriptors:r,fontSource:typeof h=="string"?h:JSON.stringify(Array.from(new Uint8Array(h)))}),u};const c=Ee(t.fonts,"add",function(d){return function(m){return setTimeout(F(()=>{const h=i.get(m);h&&(e(h),i.delete(m))}),0),d.apply(this,[m])}});return o.push(()=>{s.FontFace=a}),o.push(c),F(()=>{o.forEach(d=>d())})}function Ta(e){const{doc:t,mirror:s,blockClass:o,blockSelector:i,selectionCb:a}=e;let c=!0;const d=F(()=>{const m=t.getSelection();if(!m||c&&(m!=null&&m.isCollapsed))return;c=m.isCollapsed||!1;const h=[],r=m.rangeCount||0;for(let u=0;u<r;u++){const l=m.getRangeAt(u),{startContainer:n,startOffset:p,endContainer:f,endOffset:g}=l;ie(n,o,i,!0)||ie(f,o,i,!0)||h.push({start:s.getId(n),startOffset:p,end:s.getId(f),endOffset:g})}a({ranges:h})});return d(),se("selectionchange",d)}function Fa({doc:e,customElementCb:t}){const s=e.defaultView;return!s||!s.customElements?()=>{}:Ee(s.customElements,"define",function(i){return function(a,c,d){try{t({define:{name:a}})}catch(m){console.warn(`Custom element callback failed for ${a}`)}return i.apply(this,[a,c,d])}})}function Ba(e,t){const{mutationCb:s,mousemoveCb:o,mouseInteractionCb:i,scrollCb:a,viewportResizeCb:c,inputCb:d,mediaInteractionCb:m,styleSheetRuleCb:h,styleDeclarationCb:r,canvasMutationCb:u,fontCb:l,selectionCb:n,customElementCb:p}=e;e.mutationCb=(...f)=>{t.mutation&&t.mutation(...f),s(...f)},e.mousemoveCb=(...f)=>{t.mousemove&&t.mousemove(...f),o(...f)},e.mouseInteractionCb=(...f)=>{t.mouseInteraction&&t.mouseInteraction(...f),i(...f)},e.scrollCb=(...f)=>{t.scroll&&t.scroll(...f),a(...f)},e.viewportResizeCb=(...f)=>{t.viewportResize&&t.viewportResize(...f),c(...f)},e.inputCb=(...f)=>{t.input&&t.input(...f),d(...f)},e.mediaInteractionCb=(...f)=>{t.mediaInteaction&&t.mediaInteaction(...f),m(...f)},e.styleSheetRuleCb=(...f)=>{t.styleSheetRule&&t.styleSheetRule(...f),h(...f)},e.styleDeclarationCb=(...f)=>{t.styleDeclaration&&t.styleDeclaration(...f),r(...f)},e.canvasMutationCb=(...f)=>{t.canvasMutation&&t.canvasMutation(...f),u(...f)},e.fontCb=(...f)=>{t.font&&t.font(...f),l(...f)},e.selectionCb=(...f)=>{t.selection&&t.selection(...f),n(...f)},e.customElementCb=(...f)=>{t.customElement&&t.customElement(...f),p(...f)}}function $a(e,t={}){const s=e.doc.defaultView;if(!s)return()=>{};Ba(e,t);let o;e.recordDOM&&(o=On(e,e.doc));const i=Ma(e),a=Ea(e),c=In(e),d=Aa(e,{win:s}),m=Na(e),h=La(e);let r=()=>{},u=()=>{},l=()=>{},n=()=>{};e.recordDOM&&(r=_a(e,{win:s}),u=Mn(e,e.doc),l=ka(e,{win:s}),e.collectFonts&&(n=Da(e)));const p=Ta(e),f=Fa(e),g=[];for(const S of e.plugins)g.push(S.observer(S.callback,s,S.options));return F(()=>{we.forEach(S=>S.destroy()),we.forEach(S=>S.reset()),o==null||o.disconnect(),i(),a(),c(),d(),m(),h(),r(),u(),l(),n(),p(),f(),g.forEach(S=>S()),we.length=0})}function rt(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 Pi{constructor(t){P(this,"iframeIdToRemoteIdMap",new WeakMap),P(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,s,o,i){const a=o||this.getIdToRemoteIdMap(t),c=i||this.getRemoteIdToIdMap(t);let d=a.get(s);return d||(d=this.generateIdFn(),a.set(s,d),c.set(d,s)),d}getIds(t,s){const o=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return s.map(a=>this.getId(t,a,o,i))}getRemoteId(t,s,o){const i=o||this.getRemoteIdToIdMap(t);if(typeof s!="number")return s;const a=i.get(s);return a||-1}getRemoteIds(t,s){const o=this.getRemoteIdToIdMap(t);return s.map(i=>this.getRemoteId(t,i,o))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let s=this.iframeIdToRemoteIdMap.get(t);return s||(s=new Map,this.iframeIdToRemoteIdMap.set(t,s)),s}getRemoteIdToIdMap(t){let s=this.iframeRemoteIdToIdMap.get(t);return s||(s=new Map,this.iframeRemoteIdToIdMap.set(t,s)),s}}class Ua{constructor(t){P(this,"iframes",new WeakMap),P(this,"crossOriginIframeMap",new WeakMap),P(this,"crossOriginIframeMirror",new Pi(Wi)),P(this,"crossOriginIframeStyleMirror"),P(this,"crossOriginIframeRootIdMap",new WeakMap),P(this,"mirror"),P(this,"mutationCb"),P(this,"wrappedEmit"),P(this,"loadListener"),P(this,"stylesheetManager"),P(this,"recordCrossOriginIframes"),P(this,"messageHandler"),P(this,"nestedIframeListeners",new Map),P(this,"attachedIframes",new Map),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Pi(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,s){const o=this.mirror.getId(t);return this.attachedIframes.set(o,{element:t,content:s}),o}attachIframe(t,s){var o;const i=this.trackIframeContent(t,s);this.mutationCb({adds:[{parentId:i,nextId:null,node:s}],removes:[],texts:[],attributes:[],isAttachIframe:!0});const a=t.contentWindow;if(this.recordCrossOriginIframes&&a&&!this.nestedIframeListeners.has(a)){const c=this.handleMessage.bind(this);this.nestedIframeListeners.set(a,c),a.addEventListener("message",c)}(o=this.loadListener)==null||o.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 s=t;if(s.data.type!=="rrweb"||s.origin!==s.data.origin||!t.source)return;const i=this.crossOriginIframeMap.get(t.source);if(!i)return;const a=this.transformCrossOriginEvent(i,s.data.event);a&&this.wrappedEmit(a,s.data.isCheckout)}transformCrossOriginEvent(t,s){var o;switch(s.type){case B.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(s.data.node,t);const i=s.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(s.data.node,i),this.trackIframeContent(t,s.data.node),{timestamp:s.timestamp,type:B.IncrementalSnapshot,data:{source:D.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:s.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case B.Meta:case B.Load:case B.DomContentLoaded:return!1;case B.Plugin:return s;case B.Custom:return this.replaceIds(s.data.payload,t,["id","parentId","previousId","nextId"]),s;case B.IncrementalSnapshot:switch(s.data.source){case D.Mutation:return s.data.adds.forEach(i=>{this.replaceIds(i,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,t);const a=this.crossOriginIframeRootIdMap.get(t);a&&this.patchRootIdOnNode(i.node,a)}),s.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"])}),s.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"])}),s.data.texts.forEach(i=>{this.replaceIds(i,t,["id"])}),s;case D.Drag:case D.TouchMove:case D.MouseMove:return s.data.positions.forEach(i=>{this.replaceIds(i,t,["id"])}),s;case D.ViewportResize:return!1;case D.MediaInteraction:case D.MouseInteraction:case D.Scroll:case D.CanvasMutation:case D.Input:return this.replaceIds(s.data,t,["id"]),s;case D.StyleSheetRule:case D.StyleDeclaration:return this.replaceIds(s.data,t,["id"]),this.replaceStyleIds(s.data,t,["styleId"]),s;case D.Font:return s;case D.Selection:return s.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"])}),s;case D.AdoptedStyleSheet:return this.replaceIds(s.data,t,["id"]),this.replaceStyleIds(s.data,t,["styleIds"]),(o=s.data.styles)==null||o.forEach(i=>{this.replaceStyleIds(i,t,["styleId"])}),s}}return!1}replace(t,s,o,i){for(const a of i)!Array.isArray(s[a])&&typeof s[a]!="number"||(Array.isArray(s[a])?s[a]=t.getIds(o,s[a]):s[a]=t.getId(o,s[a]));return s}replaceIds(t,s,o){return this.replace(this.crossOriginIframeMirror,t,s,o)}replaceStyleIds(t,s,o){return this.replace(this.crossOriginIframeStyleMirror,t,s,o)}replaceIdOnNode(t,s){this.replaceIds(t,s,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(o=>{this.replaceIdOnNode(o,s)})}patchRootIdOnNode(t,s){t.type!==xn.Document&&!t.rootId&&(t.rootId=s),"childNodes"in t&&t.childNodes.forEach(o=>{this.patchRootIdOnNode(o,s)})}removeIframeById(t){const s=this.attachedIframes.get(t);if(!s)return;const o=s.element.contentWindow;if(o&&this.nestedIframeListeners.has(o)){const i=this.nestedIframeListeners.get(o);o.removeEventListener("message",i),this.nestedIframeListeners.delete(o)}this.attachedIframes.delete(t)}reattachIframes(){this.attachedIframes.forEach(({content:t},s)=>{if(!this.mirror.has(s)){this.attachedIframes.delete(s);return}this.mutationCb({adds:[{parentId:s,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0})})}destroy(){this.recordCrossOriginIframes&&window.removeEventListener("message",this.messageHandler),this.nestedIframeListeners.forEach((t,s)=>{s.removeEventListener("message",t)}),this.nestedIframeListeners.clear(),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear()}}class Wa{constructor(t){P(this,"shadowDoms",new WeakSet),P(this,"mutationCb"),P(this,"scrollCb"),P(this,"bypassOptions"),P(this,"mirror"),P(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,s){if(!Ue(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);const o=On(le(L({},this.bypassOptions),{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push(()=>o.disconnect()),this.restoreHandlers.push(In(le(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(k.host(t))),this.restoreHandlers.push(Mn({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,s){const o=this;this.restoreHandlers.push(Ee(t.prototype,"attachShadow",function(i){return function(a){const c=i.call(this,a),d=k.shadowRoot(this);return d&&Cn(this)&&o.addShadowRoot(d,s),c}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch(s){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}var Fe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",za=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(var it=0;it<Fe.length;it++)za[Fe.charCodeAt(it)]=it;var qa=function(e){var t=new Uint8Array(e),s,o=t.length,i="";for(s=0;s<o;s+=3)i+=Fe[t[s]>>2],i+=Fe[(t[s]&3)<<4|t[s+1]>>4],i+=Fe[(t[s+1]&15)<<2|t[s+2]>>6],i+=Fe[t[s+2]&63];return o%3===2?i=i.substring(0,i.length-1)+"=":o%3===1&&(i=i.substring(0,i.length-2)+"=="),i};const Ni=new Map;function ja(e,t){let s=Ni.get(e);return s||(s=new Map,Ni.set(e,s)),s.has(t)||s.set(t,[]),s.get(t)}const En=(e,t,s)=>{if(!e||!(Pn(e,t)||typeof e=="object"))return;const o=e.constructor.name,i=ja(s,o);let a=i.indexOf(e);return a===-1&&(a=i.length,i.push(e)),a};function nt(e,t,s,o){if(e instanceof Array)return e.map(i=>nt(i,t,s,o));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,a=qa(e);return{rr_type:i,base64:a}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[nt(e.buffer,t,s,o),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const i=e.constructor.name,{src:a}=e;return{rr_type:i,src:a}}else if(e instanceof HTMLCanvasElement){const i="HTMLImageElement",a=e.toDataURL(o.type,o.quality);return{rr_type:i,src:a}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[nt(e.data,t,s,o),e.width,e.height]};if(Pn(e,t)||typeof e=="object"){const i=e.constructor.name,a=En(e,t,s);return{rr_type:i,index:a}}}}return e}const An=(e,t,s,o)=>e.map(i=>nt(i,t,s,o)),Pn=(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 Ha(e,t,s,o,i){const a=[],c=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const d of c)try{if(typeof t.CanvasRenderingContext2D.prototype[d]!="function")continue;const m=Ee(t.CanvasRenderingContext2D.prototype,d,function(h){return function(...r){return ie(this.canvas,s,o,!0)||setTimeout(()=>{const u=An(r,t,this,i);e(this.canvas,{type:Be["2D"],property:d,args:u})},0),h.apply(this,r)}});a.push(m)}catch(m){const h=vt(t.CanvasRenderingContext2D.prototype,d,{set(r){e(this.canvas,{type:Be["2D"],property:d,args:[r],setter:!0})}});a.push(h)}return()=>{a.forEach(d=>d())}}function Va(e){return e==="experimental-webgl"?"webgl":e}function _i(e,t,s,o){const i=[];try{const a=Ee(e.HTMLCanvasElement.prototype,"getContext",function(c){return function(d,...m){if(!ie(this,t,s,!0)){const h=Va(d);if("__context"in this||(this.__context=h),o&&["webgl","webgl2"].includes(h))if(m[0]&&typeof m[0]=="object"){const r=m[0];r.preserveDrawingBuffer||(r.preserveDrawingBuffer=!0)}else m.splice(0,1,{preserveDrawingBuffer:!0})}return c.apply(this,[d,...m])}});i.push(a)}catch(a){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(a=>a())}}function ki(e,t,s,o,i,a,c){const d=[],m=Object.getOwnPropertyNames(e);for(const h of m)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(h))try{if(typeof e[h]!="function")continue;const r=Ee(e,h,function(u){return function(...l){const n=u.apply(this,l);if(En(n,a,this),"tagName"in this.canvas&&!ie(this.canvas,o,i,!0)){const p=An(l,a,this,c),f={type:t,property:h,args:p};s(this.canvas,f)}return n}});d.push(r)}catch(r){const u=vt(e,h,{set(l){s(this.canvas,{type:t,property:h,args:[l],setter:!0})}});d.push(u)}return d}function Ga(e,t,s,o,i){const a=[];return a.push(...ki(t.WebGLRenderingContext.prototype,Be.WebGL,e,s,o,t,i)),typeof t.WebGL2RenderingContext!="undefined"&&a.push(...ki(t.WebGL2RenderingContext.prototype,Be.WebGL2,e,s,o,t,i)),()=>{a.forEach(c=>c())}}const Nn=`(function() {
|
|
58
|
+
or you can use record.mirror to access the mirror instance during recording.`;let Ri={map:{},getId(){return console.error(ke),-1},getNode(){return console.error(ke),null},removeNodeFromMap(){console.error(ke)},has(){return console.error(ke),!1},reset(){console.error(ke)}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(Ri=new Proxy(Ri,{get(e,t,s){return t==="map"&&console.error(ke),Reflect.get(e,t,s)}}));function qe(e,t,s={}){let o=null,i=0;return function(...a){const c=Date.now();!i&&s.leading===!1&&(i=c);const d=t-(c-i),m=this;d<=0||d>t?(o&&(clearTimeout(o),o=null),i=c,e.apply(m,a)):!o&&s.trailing!==!1&&(o=setTimeout(()=>{i=s.leading===!1?0:Date.now(),o=null,e.apply(m,a)},d))}}function vt(e,t,s,o,i=window){const a=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,o?s:{set(c){setTimeout(()=>{s.set.call(this,c)},0),a&&a.set&&a.set.call(this,c)}}),()=>vt(e,t,a||{},!0)}let ct=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(ct=()=>new Date().getTime());function dn(e){var t,s,o,i;const a=e.document;return{left:a.scrollingElement?a.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:a.documentElement.scrollLeft||(a==null?void 0:a.body)&&((t=k.parentElement(a.body))==null?void 0:t.scrollLeft)||((s=a==null?void 0:a.body)==null?void 0:s.scrollLeft)||0,top:a.scrollingElement?a.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:(a==null?void 0:a.documentElement.scrollTop)||(a==null?void 0:a.body)&&((o=k.parentElement(a.body))==null?void 0:o.scrollTop)||((i=a==null?void 0:a.body)==null?void 0:i.scrollTop)||0}}function mn(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function gn(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function yn(e){return e?e.nodeType===e.ELEMENT_NODE?e:k.parentElement(e):null}function ie(e,t,s,o){if(!e)return!1;const i=yn(e);if(!i)return!1;try{if(typeof t=="string"){if(i.classList.contains(t)||o&&i.closest("."+t)!==null)return!0}else if(ut(i,t,o))return!0}catch(a){}return!!(s&&(i.matches(s)||o&&i.closest(s)!==null))}function ga(e,t){return t.getId(e)!==-1}function Nr(e,t,s){return e.tagName==="TITLE"&&s.headTitleMutations?!0:t.getId(e)===ze}function wn(e,t){if($e(e))return!1;const s=t.getId(e);if(!t.has(s))return!0;const o=k.parentNode(e);return o&&o.nodeType===e.DOCUMENT_NODE?!1:o?wn(o,t):!0}function kr(e){return!!e.changedTouches}function ya(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 bn(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Sn(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Lr(e){return e?e instanceof es&&"shadowRoot"in e?!!e.shadowRoot:!!k.shadowRoot(e):!1}class wa{constructor(){P(this,"id",1),P(this,"styleIDMap",new WeakMap),P(this,"idStyleMap",new Map)}getId(t){var s;return(s=this.styleIDMap.get(t))!=null?s:-1}has(t){return this.styleIDMap.has(t)}add(t,s){if(this.has(t))return this.getId(t);let o;return s===void 0?o=this.id++:o=s,this.styleIDMap.set(t,o),this.idStyleMap.set(o,t),o}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 vn(e){var t;let s=null;return"getRootNode"in e&&((t=k.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&k.host(k.getRootNode(e))&&(s=k.host(k.getRootNode(e))),s}function ba(e){let t=e,s;for(;s=vn(t);)t=s;return t}function Sa(e){const t=e.ownerDocument;if(!t)return!1;const s=ba(e);return k.contains(t,s)}function Cn(e){const t=e.ownerDocument;return t?k.contains(t,e)||Sa(e):!1}var B=(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))(B||{}),D=(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))(D||{}),ne=(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))(ne||{}),ye=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(ye||{}),Be=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Be||{}),Le=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(Le||{}),xn=(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))(xn||{});function Oi(e){return"__ln"in e}class va{constructor(){P(this,"length",0),P(this,"head",null),P(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let s=this.head;for(let o=0;o<t;o++)s=(s==null?void 0:s.next)||null;return s}addNode(t){const s={value:t,previous:null,next:null};if(t.__ln=s,t.previousSibling&&Oi(t.previousSibling)){const o=t.previousSibling.__ln.next;s.next=o,s.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=s,o&&(o.previous=s)}else if(t.nextSibling&&Oi(t.nextSibling)&&t.nextSibling.__ln.previous){const o=t.nextSibling.__ln.previous;s.previous=o,s.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=s,o&&(o.next=s)}else this.head&&(this.head.previous=s),s.next=this.head,this.head=s;s.next===null&&(this.tail=s),this.length++}removeNode(t){const s=t.__ln;this.head&&(s.previous?(s.previous.next=s.next,s.next?s.next.previous=s.previous:this.tail=s.previous):(this.head=s.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}}const Ii=(e,t)=>`${e}@${t}`;class Ca{constructor(){P(this,"frozen",!1),P(this,"locked",!1),P(this,"texts",[]),P(this,"attributes",[]),P(this,"attributeMap",new WeakMap),P(this,"removes",[]),P(this,"mapRemoves",[]),P(this,"movedMap",{}),P(this,"addedSet",new Set),P(this,"movedSet",new Set),P(this,"droppedSet",new Set),P(this,"removesSubTreeCache",new Set),P(this,"mutationCb"),P(this,"blockClass"),P(this,"blockSelector"),P(this,"maskTextClass"),P(this,"maskTextSelector"),P(this,"inlineStylesheet"),P(this,"maskInputOptions"),P(this,"maskTextFn"),P(this,"maskInputFn"),P(this,"keepIframeSrcFn"),P(this,"recordCanvas"),P(this,"inlineImages"),P(this,"slimDOMOptions"),P(this,"dataURLOptions"),P(this,"doc"),P(this,"mirror"),P(this,"iframeManager"),P(this,"stylesheetManager"),P(this,"shadowDomManager"),P(this,"canvasManager"),P(this,"processedNodeManager"),P(this,"unattachedDoc"),P(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),P(this,"emit",()=>{if(this.frozen||this.locked)return;const t=[],s=new Set,o=new va,i=m=>{let h=m,r=ze;for(;r===ze;)h=h&&h.nextSibling,r=h&&this.mirror.getId(h);return r},a=m=>{const h=k.parentNode(m);if(!h||!Cn(m)||h.tagName==="TEXTAREA")return;const r=$e(h)?this.mirror.getId(vn(m)):this.mirror.getId(h),u=i(m);if(r===-1||u===-1)return o.addNode(m);const l=Te(m,{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:n=>{bn(n,this.mirror)&&this.iframeManager.addIframe(n),Sn(n,this.mirror)&&this.stylesheetManager.trackLinkElement(n),Lr(m)&&this.shadowDomManager.addShadowRoot(k.shadowRoot(m),this.doc)},onIframeLoad:(n,p)=>{this.iframeManager.attachIframe(n,p),this.shadowDomManager.observeAttachShadow(n)},onStylesheetLoad:(n,p)=>{this.stylesheetManager.attachLinkElement(n,p)}});l&&(t.push({parentId:r,nextId:u,node:l}),s.add(l.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const m of this.movedSet)Mi(this.removesSubTreeCache,m,this.mirror)&&!this.movedSet.has(k.parentNode(m))||a(m);for(const m of this.addedSet)!Ei(this.droppedSet,m)&&!Mi(this.removesSubTreeCache,m,this.mirror)||Ei(this.movedSet,m)?a(m):this.droppedSet.add(m);let c=null;for(;o.length;){let m=null;if(c){const h=this.mirror.getId(k.parentNode(c.value)),r=i(c.value);h!==-1&&r!==-1&&(m=c)}if(!m){let h=o.tail;for(;h;){const r=h;if(h=h.previous,r){const u=this.mirror.getId(k.parentNode(r.value));if(i(r.value)===-1)continue;if(u!==-1){m=r;break}else{const n=r.value,p=k.parentNode(n);if(p&&p.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const f=k.host(p);if(this.mirror.getId(f)!==-1){m=r;break}}}}}}if(!m){for(;o.head;)o.removeNode(o.head.value);break}c=m.previous,o.removeNode(m.value),a(m.value)}const d={texts:this.texts.map(m=>{const h=m.node,r=k.parentNode(h);return r&&r.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(r),{id:this.mirror.getId(h),value:m.value}}).filter(m=>!s.has(m.id)).filter(m=>this.mirror.has(m.id)),attributes:this.attributes.map(m=>{const{attributes:h}=m;if(typeof h.style=="string"){const r=JSON.stringify(m.styleDiff),u=JSON.stringify(m._unchangedStyles);r.length<h.style.length&&(r+u).split("var(").length===h.style.split("var(").length&&(h.style=m.styleDiff)}return{id:this.mirror.getId(m.node),attributes:h}}).filter(m=>!s.has(m.id)).filter(m=>this.mirror.has(m.id)),removes:this.removes,adds:t};!d.texts.length&&!d.attributes.length&&!d.removes.length&&!d.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(d))}),P(this,"genTextAreaValueMutation",t=>{let s=this.attributeMap.get(t);s||(s={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(s),this.attributeMap.set(t,s)),s.attributes.value=Array.from(k.childNodes(t),o=>k.textContent(o)||"").join("")}),P(this,"processMutation",t=>{if(!Nr(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const s=k.textContent(t.target);!ie(t.target,this.blockClass,this.blockSelector,!1)&&s!==t.oldValue&&this.texts.push({value:ji(t.target,this.maskTextClass,this.maskTextSelector,!0)&&s?this.maskTextFn?this.maskTextFn(s,yn(t.target)):s.replace(/[\S]/g,"*"):s,node:t.target});break}case"attributes":{const s=t.target;let o=t.attributeName,i=t.target.getAttribute(o);if(o==="value"){const c=Br(s);i=Fr({element:s,maskInputOptions:this.maskInputOptions,tagName:s.tagName,type:c,value:i,maskInputFn:this.maskInputFn})}if(ie(t.target,this.blockClass,this.blockSelector,!1)||i===t.oldValue)return;let a=this.attributeMap.get(t.target);if(s.tagName==="IFRAME"&&o==="src"&&!this.keepIframeSrcFn(i))if(!s.contentDocument)o="rr_src";else return;if(a||(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(t.target,a)),o==="type"&&s.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&s.setAttribute("data-rr-is-password","true"),!qi(s.tagName,o))if(a.attributes[o]=zi(this.doc,Oe(s.tagName),Oe(o),i,s,this.dataURLOptions),o==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(d){this.unattachedDoc=this.doc}const c=this.unattachedDoc.createElement("span");t.oldValue&&c.setAttribute("style",t.oldValue);for(const d of Array.from(s.style)){const m=s.style.getPropertyValue(d),h=s.style.getPropertyPriority(d);m!==c.style.getPropertyValue(d)||h!==c.style.getPropertyPriority(d)?h===""?a.styleDiff[d]=m:a.styleDiff[d]=[m,h]:a._unchangedStyles[d]=[m,h]}for(const d of Array.from(c.style))s.style.getPropertyValue(d)===""&&(a.styleDiff[d]=!1)}else o==="open"&&s.tagName==="DIALOG"&&(s.matches("dialog:modal")?a.attributes.rr_open_mode="modal":a.attributes.rr_open_mode="non-modal");break}case"childList":{if(ie(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(s=>this.genAdds(s,t.target)),t.removedNodes.forEach(s=>{const o=this.mirror.getId(s),i=$e(t.target)?this.mirror.getId(k.host(t.target)):this.mirror.getId(t.target);ie(t.target,this.blockClass,this.blockSelector,!1)||Nr(s,this.mirror,this.slimDOMOptions)||!ga(s,this.mirror)||(this.addedSet.has(s)?(Dr(this.addedSet,s),this.droppedSet.add(s)):this.addedSet.has(t.target)&&o===-1||wn(t.target,this.mirror)||(this.movedSet.has(s)&&this.movedMap[Ii(o,i)]?Dr(this.movedSet,s):(this.removes.push({parentId:i,id:o,isShadow:$e(t.target)&&Ue(t.target)?!0:void 0}),xa(s,this.removesSubTreeCache))),this.mapRemoves.push(s))});break}}}),P(this,"genAdds",(t,s)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(Nr(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let o=null;s&&this.mirror.hasNode(s)&&(o=this.mirror.getId(s)),o&&o!==-1&&(this.movedMap[Ii(this.mirror.getId(t),o)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);ie(t,this.blockClass,this.blockSelector,!1)||(k.childNodes(t).forEach(o=>this.genAdds(o)),Lr(t)&&k.childNodes(k.shadowRoot(t)).forEach(o=>{this.processedNodeManager.add(o,this),this.genAdds(o,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(s=>{this[s]=t[s]})}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 Dr(e,t){e.delete(t),k.childNodes(t).forEach(s=>Dr(e,s))}function xa(e,t){const s=[e];for(;s.length;){const o=s.pop();t.has(o)||(t.add(o),k.childNodes(o).forEach(i=>s.push(i)))}}function Mi(e,t,s){return e.size===0?!1:Ra(e,t)}function Ra(e,t,s){const o=k.parentNode(t);return o?e.has(o):!1}function Ei(e,t){return e.size===0?!1:Rn(e,t)}function Rn(e,t){const s=k.parentNode(t);return s?e.has(s)?!0:Rn(e,s):!1}let We;function Oa(e){We=e}function Ia(){We=void 0}const F=e=>We?(...s)=>{try{return e(...s)}catch(o){if(We&&We(o)===!0)return;throw o}}:e,we=[];function Je(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 On(e,t){const s=new Ca;we.push(s),s.init(e);const o=new(pn())(F(s.processMutations.bind(s)));return o.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),o}function Ma({mousemoveCb:e,sampling:t,doc:s,mirror:o}){if(t.mousemove===!1)return()=>{};const i=typeof t.mousemove=="number"?t.mousemove:50,a=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500;let c=[],d;const m=qe(F(u=>{const l=Date.now()-d;e(c.map(n=>(n.timeOffset-=l,n)),u),c=[],d=null}),a),h=F(qe(F(u=>{const l=Je(u),{clientX:n,clientY:p}=kr(u)?u.changedTouches[0]:u;d||(d=ct()),c.push({x:n,y:p,id:o.getId(l),timeOffset:ct()-d}),m(typeof DragEvent!="undefined"&&u instanceof DragEvent?D.Drag:u instanceof MouseEvent?D.MouseMove:D.TouchMove)}),i,{trailing:!1})),r=[se("mousemove",h,s),se("touchmove",h,s),se("drag",h,s)];return F(()=>{r.forEach(u=>u())})}function Ea({mouseInteractionCb:e,doc:t,mirror:s,blockClass:o,blockSelector:i,sampling:a}){if(a.mouseInteraction===!1)return()=>{};const c=a.mouseInteraction===!0||a.mouseInteraction===void 0?{}:a.mouseInteraction,d=[];let m=null;const h=r=>u=>{const l=Je(u);if(ie(l,o,i,!0))return;let n=null,p=r;if("pointerType"in u){switch(u.pointerType){case"mouse":n=ye.Mouse;break;case"touch":n=ye.Touch;break;case"pen":n=ye.Pen;break}n===ye.Touch?ne[r]===ne.MouseDown?p="TouchStart":ne[r]===ne.MouseUp&&(p="TouchEnd"):ye.Pen}else kr(u)&&(n=ye.Touch);n!==null?(m=n,(p.startsWith("Touch")&&n===ye.Touch||p.startsWith("Mouse")&&n===ye.Mouse)&&(n=null)):ne[r]===ne.Click&&(n=m,m=null);const f=kr(u)?u.changedTouches[0]:u;if(!f)return;const g=s.getId(l),{clientX:S,clientY:w}=f;F(e)(L({type:ne[p],id:g,x:S,y:w},n!==null&&{pointerType:n}))};return Object.keys(ne).filter(r=>Number.isNaN(Number(r))&&!r.endsWith("_Departed")&&c[r]!==!1).forEach(r=>{let u=Oe(r);const l=h(r);if(window.PointerEvent)switch(ne[r]){case ne.MouseDown:case ne.MouseUp:u=u.replace("mouse","pointer");break;case ne.TouchStart:case ne.TouchEnd:return}d.push(se(u,l,t))}),F(()=>{d.forEach(r=>r())})}function In({scrollCb:e,doc:t,mirror:s,blockClass:o,blockSelector:i,sampling:a}){const c=F(qe(F(d=>{const m=Je(d);if(!m||ie(m,o,i,!0))return;const h=s.getId(m);if(m===t&&t.defaultView){const r=dn(t.defaultView);e({id:h,x:r.left,y:r.top})}else e({id:h,x:m.scrollLeft,y:m.scrollTop})}),a.scroll||100));return se("scroll",c,t)}function Aa({viewportResizeCb:e},{win:t}){let s=-1,o=-1;const i=F(qe(F(()=>{const a=mn(),c=gn();(s!==a||o!==c)&&(e({width:Number(c),height:Number(a)}),s=a,o=c)}),200));return se("resize",i,t)}const Pa=["INPUT","TEXTAREA","SELECT"],Ai=new WeakMap;function Na({inputCb:e,doc:t,mirror:s,blockClass:o,blockSelector:i,ignoreClass:a,ignoreSelector:c,maskInputOptions:d,maskInputFn:m,sampling:h,userTriggeredOnInput:r}){function u(w){let v=Je(w);const x=w.isTrusted,y=v&&v.tagName;if(v&&y==="OPTION"&&(v=k.parentElement(v)),!v||!y||Pa.indexOf(y)<0||ie(v,o,i,!0)||v.classList.contains(a)||c&&v.matches(c))return;let b=v.value,C=!1;const R=Br(v)||"";R==="radio"||R==="checkbox"?C=v.checked:(d[y.toLowerCase()]||d[R])&&(b=Fr({element:v,maskInputOptions:d,tagName:y,type:R,value:b,maskInputFn:m})),l(v,r?{text:b,isChecked:C,userTriggered:x}:{text:b,isChecked:C});const M=v.name;R==="radio"&&M&&C&&t.querySelectorAll(`input[type="radio"][name="${M}"]`).forEach(O=>{if(O!==v){const N=O.value;l(O,r?{text:N,isChecked:!C,userTriggered:!1}:{text:N,isChecked:!C})}})}function l(w,v){const x=Ai.get(w);if(!x||x.text!==v.text||x.isChecked!==v.isChecked){Ai.set(w,v);const y=s.getId(w);F(e)(le(L({},v),{id:y}))}}const p=(h.input==="last"?["change"]:["input","change"]).map(w=>se(w,F(u),t)),f=t.defaultView;if(!f)return()=>{p.forEach(w=>w())};const g=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),S=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return g&&g.set&&p.push(...S.map(w=>vt(w[0],w[1],{set(){F(u)({target:this,isTrusted:!1})}},!1,f))),F(()=>{p.forEach(w=>w())})}function ht(e){const t=[];function s(o,i){if(rt("CSSGroupingRule")&&o.parentRule instanceof CSSGroupingRule||rt("CSSMediaRule")&&o.parentRule instanceof CSSMediaRule||rt("CSSSupportsRule")&&o.parentRule instanceof CSSSupportsRule||rt("CSSConditionRule")&&o.parentRule instanceof CSSConditionRule){const c=Array.from(o.parentRule.cssRules).indexOf(o);i.unshift(c)}else if(o.parentStyleSheet){const c=Array.from(o.parentStyleSheet.cssRules).indexOf(o);i.unshift(c)}return i}return s(e,t)}function Se(e,t,s){let o,i;return e?(e.ownerNode?o=t.getId(e.ownerNode):i=s.getId(e),{styleId:i,id:o}):{}}function _a({styleSheetRuleCb:e,mirror:t,stylesheetManager:s},{win:o}){if(!o.CSSStyleSheet||!o.CSSStyleSheet.prototype)return()=>{};const i=o.CSSStyleSheet.prototype.insertRule;o.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:F((r,u,l)=>{const[n,p]=l,{id:f,styleId:g}=Se(u,t,s.styleMirror);return(f&&f!==-1||g&&g!==-1)&&e({id:f,styleId:g,adds:[{rule:n,index:p}]}),r.apply(u,l)})}),o.CSSStyleSheet.prototype.addRule=function(r,u,l=this.cssRules.length){const n=`${r} { ${u} }`;return o.CSSStyleSheet.prototype.insertRule.apply(this,[n,l])};const a=o.CSSStyleSheet.prototype.deleteRule;o.CSSStyleSheet.prototype.deleteRule=new Proxy(a,{apply:F((r,u,l)=>{const[n]=l,{id:p,styleId:f}=Se(u,t,s.styleMirror);return(p&&p!==-1||f&&f!==-1)&&e({id:p,styleId:f,removes:[{index:n}]}),r.apply(u,l)})}),o.CSSStyleSheet.prototype.removeRule=function(r){return o.CSSStyleSheet.prototype.deleteRule.apply(this,[r])};let c;o.CSSStyleSheet.prototype.replace&&(c=o.CSSStyleSheet.prototype.replace,o.CSSStyleSheet.prototype.replace=new Proxy(c,{apply:F((r,u,l)=>{const[n]=l,{id:p,styleId:f}=Se(u,t,s.styleMirror);return(p&&p!==-1||f&&f!==-1)&&e({id:p,styleId:f,replace:n}),r.apply(u,l)})}));let d;o.CSSStyleSheet.prototype.replaceSync&&(d=o.CSSStyleSheet.prototype.replaceSync,o.CSSStyleSheet.prototype.replaceSync=new Proxy(d,{apply:F((r,u,l)=>{const[n]=l,{id:p,styleId:f}=Se(u,t,s.styleMirror);return(p&&p!==-1||f&&f!==-1)&&e({id:p,styleId:f,replaceSync:n}),r.apply(u,l)})}));const m={};st("CSSGroupingRule")?m.CSSGroupingRule=o.CSSGroupingRule:(st("CSSMediaRule")&&(m.CSSMediaRule=o.CSSMediaRule),st("CSSConditionRule")&&(m.CSSConditionRule=o.CSSConditionRule),st("CSSSupportsRule")&&(m.CSSSupportsRule=o.CSSSupportsRule));const h={};return Object.entries(m).forEach(([r,u])=>{h[r]={insertRule:u.prototype.insertRule,deleteRule:u.prototype.deleteRule},u.prototype.insertRule=new Proxy(h[r].insertRule,{apply:F((l,n,p)=>{const[f,g]=p,{id:S,styleId:w}=Se(n.parentStyleSheet,t,s.styleMirror);return(S&&S!==-1||w&&w!==-1)&&e({id:S,styleId:w,adds:[{rule:f,index:[...ht(n),g||0]}]}),l.apply(n,p)})}),u.prototype.deleteRule=new Proxy(h[r].deleteRule,{apply:F((l,n,p)=>{const[f]=p,{id:g,styleId:S}=Se(n.parentStyleSheet,t,s.styleMirror);return(g&&g!==-1||S&&S!==-1)&&e({id:g,styleId:S,removes:[{index:[...ht(n),f]}]}),l.apply(n,p)})})}),F(()=>{o.CSSStyleSheet.prototype.insertRule=i,o.CSSStyleSheet.prototype.deleteRule=a,c&&(o.CSSStyleSheet.prototype.replace=c),d&&(o.CSSStyleSheet.prototype.replaceSync=d),Object.entries(m).forEach(([r,u])=>{u.prototype.insertRule=h[r].insertRule,u.prototype.deleteRule=h[r].deleteRule})})}function Mn({mirror:e,stylesheetManager:t},s){var o,i,a;let c=null;s.nodeName==="#document"?c=e.getId(s):c=e.getId(k.host(s));const d=s.nodeName==="#document"?(o=s.defaultView)==null?void 0:o.Document:(a=(i=s.ownerDocument)==null?void 0:i.defaultView)==null?void 0:a.ShadowRoot,m=d!=null&&d.prototype?Object.getOwnPropertyDescriptor(d==null?void 0:d.prototype,"adoptedStyleSheets"):void 0;return c===null||c===-1||!d||!m?()=>{}:(Object.defineProperty(s,"adoptedStyleSheets",{configurable:m.configurable,enumerable:m.enumerable,get(){var h;return(h=m.get)==null?void 0:h.call(this)},set(h){var r;const u=(r=m.set)==null?void 0:r.call(this,h);if(c!==null&&c!==-1)try{t.adoptStyleSheets(h,c)}catch(l){}return u}}),F(()=>{Object.defineProperty(s,"adoptedStyleSheets",{configurable:m.configurable,enumerable:m.enumerable,get:m.get,set:m.set})}))}function ka({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:s,stylesheetManager:o},{win:i}){const a=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:F((d,m,h)=>{var r;const[u,l,n]=h;if(s.has(u))return a.apply(m,[u,l,n]);const{id:p,styleId:f}=Se((r=m.parentRule)==null?void 0:r.parentStyleSheet,t,o.styleMirror);return(p&&p!==-1||f&&f!==-1)&&e({id:p,styleId:f,set:{property:u,value:l,priority:n},index:ht(m.parentRule)}),d.apply(m,h)})});const c=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(c,{apply:F((d,m,h)=>{var r;const[u]=h;if(s.has(u))return c.apply(m,[u]);const{id:l,styleId:n}=Se((r=m.parentRule)==null?void 0:r.parentStyleSheet,t,o.styleMirror);return(l&&l!==-1||n&&n!==-1)&&e({id:l,styleId:n,remove:{property:u},index:ht(m.parentRule)}),d.apply(m,h)})}),F(()=>{i.CSSStyleDeclaration.prototype.setProperty=a,i.CSSStyleDeclaration.prototype.removeProperty=c})}function La({mediaInteractionCb:e,blockClass:t,blockSelector:s,mirror:o,sampling:i,doc:a}){const c=F(m=>qe(F(h=>{const r=Je(h);if(!r||ie(r,t,s,!0))return;const{currentTime:u,volume:l,muted:n,playbackRate:p,loop:f}=r;e({type:m,id:o.getId(r),currentTime:u,volume:l,muted:n,playbackRate:p,loop:f})}),i.media||500)),d=[se("play",c(Le.Play),a),se("pause",c(Le.Pause),a),se("seeked",c(Le.Seeked),a),se("volumechange",c(Le.VolumeChange),a),se("ratechange",c(Le.RateChange),a)];return F(()=>{d.forEach(m=>m())})}function Da({fontCb:e,doc:t}){const s=t.defaultView;if(!s)return()=>{};const o=[],i=new WeakMap,a=s.FontFace;s.FontFace=function(m,h,r){const u=new a(m,h,r);return i.set(u,{family:m,buffer:typeof h!="string",descriptors:r,fontSource:typeof h=="string"?h:JSON.stringify(Array.from(new Uint8Array(h)))}),u};const c=Ee(t.fonts,"add",function(d){return function(m){return setTimeout(F(()=>{const h=i.get(m);h&&(e(h),i.delete(m))}),0),d.apply(this,[m])}});return o.push(()=>{s.FontFace=a}),o.push(c),F(()=>{o.forEach(d=>d())})}function Ta(e){const{doc:t,mirror:s,blockClass:o,blockSelector:i,selectionCb:a}=e;let c=!0;const d=F(()=>{const m=t.getSelection();if(!m||c&&(m!=null&&m.isCollapsed))return;c=m.isCollapsed||!1;const h=[],r=m.rangeCount||0;for(let u=0;u<r;u++){const l=m.getRangeAt(u),{startContainer:n,startOffset:p,endContainer:f,endOffset:g}=l;ie(n,o,i,!0)||ie(f,o,i,!0)||h.push({start:s.getId(n),startOffset:p,end:s.getId(f),endOffset:g})}a({ranges:h})});return d(),se("selectionchange",d)}function Fa({doc:e,customElementCb:t}){const s=e.defaultView;return!s||!s.customElements?()=>{}:Ee(s.customElements,"define",function(i){return function(a,c,d){try{t({define:{name:a}})}catch(m){console.warn(`Custom element callback failed for ${a}`)}return i.apply(this,[a,c,d])}})}function Ba(e,t){const{mutationCb:s,mousemoveCb:o,mouseInteractionCb:i,scrollCb:a,viewportResizeCb:c,inputCb:d,mediaInteractionCb:m,styleSheetRuleCb:h,styleDeclarationCb:r,canvasMutationCb:u,fontCb:l,selectionCb:n,customElementCb:p}=e;e.mutationCb=(...f)=>{t.mutation&&t.mutation(...f),s(...f)},e.mousemoveCb=(...f)=>{t.mousemove&&t.mousemove(...f),o(...f)},e.mouseInteractionCb=(...f)=>{t.mouseInteraction&&t.mouseInteraction(...f),i(...f)},e.scrollCb=(...f)=>{t.scroll&&t.scroll(...f),a(...f)},e.viewportResizeCb=(...f)=>{t.viewportResize&&t.viewportResize(...f),c(...f)},e.inputCb=(...f)=>{t.input&&t.input(...f),d(...f)},e.mediaInteractionCb=(...f)=>{t.mediaInteaction&&t.mediaInteaction(...f),m(...f)},e.styleSheetRuleCb=(...f)=>{t.styleSheetRule&&t.styleSheetRule(...f),h(...f)},e.styleDeclarationCb=(...f)=>{t.styleDeclaration&&t.styleDeclaration(...f),r(...f)},e.canvasMutationCb=(...f)=>{t.canvasMutation&&t.canvasMutation(...f),u(...f)},e.fontCb=(...f)=>{t.font&&t.font(...f),l(...f)},e.selectionCb=(...f)=>{t.selection&&t.selection(...f),n(...f)},e.customElementCb=(...f)=>{t.customElement&&t.customElement(...f),p(...f)}}function $a(e,t={}){const s=e.doc.defaultView;if(!s)return()=>{};Ba(e,t);let o;e.recordDOM&&(o=On(e,e.doc));const i=Ma(e),a=Ea(e),c=In(e),d=Aa(e,{win:s}),m=Na(e),h=La(e);let r=()=>{},u=()=>{},l=()=>{},n=()=>{};e.recordDOM&&(r=_a(e,{win:s}),u=Mn(e,e.doc),l=ka(e,{win:s}),e.collectFonts&&(n=Da(e)));const p=Ta(e),f=Fa(e),g=[];for(const S of e.plugins)g.push(S.observer(S.callback,s,S.options));return F(()=>{we.forEach(S=>S.destroy()),we.forEach(S=>S.reset()),o==null||o.disconnect(),i(),a(),c(),d(),m(),h(),r(),u(),l(),n(),p(),f(),g.forEach(S=>S()),we.length=0})}function rt(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 Pi{constructor(t){P(this,"iframeIdToRemoteIdMap",new WeakMap),P(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,s,o,i){const a=o||this.getIdToRemoteIdMap(t),c=i||this.getRemoteIdToIdMap(t);let d=a.get(s);return d||(d=this.generateIdFn(),a.set(s,d),c.set(d,s)),d}getIds(t,s){const o=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return s.map(a=>this.getId(t,a,o,i))}getRemoteId(t,s,o){const i=o||this.getRemoteIdToIdMap(t);if(typeof s!="number")return s;const a=i.get(s);return a||-1}getRemoteIds(t,s){const o=this.getRemoteIdToIdMap(t);return s.map(i=>this.getRemoteId(t,i,o))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let s=this.iframeIdToRemoteIdMap.get(t);return s||(s=new Map,this.iframeIdToRemoteIdMap.set(t,s)),s}getRemoteIdToIdMap(t){let s=this.iframeRemoteIdToIdMap.get(t);return s||(s=new Map,this.iframeRemoteIdToIdMap.set(t,s)),s}}class Ua{constructor(t){P(this,"iframes",new WeakMap),P(this,"crossOriginIframeMap",new WeakMap),P(this,"crossOriginIframeMirror",new Pi(Wi)),P(this,"crossOriginIframeStyleMirror"),P(this,"crossOriginIframeRootIdMap",new WeakMap),P(this,"mirror"),P(this,"mutationCb"),P(this,"wrappedEmit"),P(this,"loadListener"),P(this,"stylesheetManager"),P(this,"recordCrossOriginIframes"),P(this,"messageHandler"),P(this,"nestedIframeListeners",new Map),P(this,"attachedIframes",new Map),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Pi(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,s){const o=this.mirror.getId(t);return this.attachedIframes.set(o,{element:t,content:s}),o}attachIframe(t,s){var o;const i=this.trackIframeContent(t,s);this.mutationCb({adds:[{parentId:i,nextId:null,node:s}],removes:[],texts:[],attributes:[],isAttachIframe:!0});const a=t.contentWindow;if(this.recordCrossOriginIframes&&a&&!this.nestedIframeListeners.has(a)){const c=this.handleMessage.bind(this);this.nestedIframeListeners.set(a,c),a.addEventListener("message",c)}(o=this.loadListener)==null||o.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 s=t;if(s.data.type!=="rrweb"||s.origin!==s.data.origin||!t.source)return;const i=this.crossOriginIframeMap.get(t.source);if(!i)return;const a=this.transformCrossOriginEvent(i,s.data.event);a&&this.wrappedEmit(a,s.data.isCheckout)}transformCrossOriginEvent(t,s){var o;switch(s.type){case B.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(s.data.node,t);const i=s.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(s.data.node,i),this.trackIframeContent(t,s.data.node),{timestamp:s.timestamp,type:B.IncrementalSnapshot,data:{source:D.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:s.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case B.Meta:case B.Load:case B.DomContentLoaded:return!1;case B.Plugin:return s;case B.Custom:return this.replaceIds(s.data.payload,t,["id","parentId","previousId","nextId"]),s;case B.IncrementalSnapshot:switch(s.data.source){case D.Mutation:return s.data.adds.forEach(i=>{this.replaceIds(i,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,t);const a=this.crossOriginIframeRootIdMap.get(t);a&&this.patchRootIdOnNode(i.node,a)}),s.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"])}),s.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"])}),s.data.texts.forEach(i=>{this.replaceIds(i,t,["id"])}),s;case D.Drag:case D.TouchMove:case D.MouseMove:return s.data.positions.forEach(i=>{this.replaceIds(i,t,["id"])}),s;case D.ViewportResize:return!1;case D.MediaInteraction:case D.MouseInteraction:case D.Scroll:case D.CanvasMutation:case D.Input:return this.replaceIds(s.data,t,["id"]),s;case D.StyleSheetRule:case D.StyleDeclaration:return this.replaceIds(s.data,t,["id"]),this.replaceStyleIds(s.data,t,["styleId"]),s;case D.Font:return s;case D.Selection:return s.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"])}),s;case D.AdoptedStyleSheet:return this.replaceIds(s.data,t,["id"]),this.replaceStyleIds(s.data,t,["styleIds"]),(o=s.data.styles)==null||o.forEach(i=>{this.replaceStyleIds(i,t,["styleId"])}),s}}return!1}replace(t,s,o,i){for(const a of i)!Array.isArray(s[a])&&typeof s[a]!="number"||(Array.isArray(s[a])?s[a]=t.getIds(o,s[a]):s[a]=t.getId(o,s[a]));return s}replaceIds(t,s,o){return this.replace(this.crossOriginIframeMirror,t,s,o)}replaceStyleIds(t,s,o){return this.replace(this.crossOriginIframeStyleMirror,t,s,o)}replaceIdOnNode(t,s){this.replaceIds(t,s,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(o=>{this.replaceIdOnNode(o,s)})}patchRootIdOnNode(t,s){t.type!==xn.Document&&!t.rootId&&(t.rootId=s),"childNodes"in t&&t.childNodes.forEach(o=>{this.patchRootIdOnNode(o,s)})}removeIframeById(t){const s=this.attachedIframes.get(t);if(!s)return;const o=s.element.contentWindow;if(o&&this.nestedIframeListeners.has(o)){const i=this.nestedIframeListeners.get(o);o.removeEventListener("message",i),this.nestedIframeListeners.delete(o)}this.attachedIframes.delete(t)}reattachIframes(){this.attachedIframes.forEach(({content:t},s)=>{if(!this.mirror.has(s)){this.attachedIframes.delete(s);return}this.mutationCb({adds:[{parentId:s,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0})})}destroy(){this.recordCrossOriginIframes&&window.removeEventListener("message",this.messageHandler),this.nestedIframeListeners.forEach((t,s)=>{s.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 Wa{constructor(t){P(this,"shadowDoms",new WeakSet),P(this,"mutationCb"),P(this,"scrollCb"),P(this,"bypassOptions"),P(this,"mirror"),P(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,s){if(!Ue(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);const o=On(le(L({},this.bypassOptions),{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push(()=>o.disconnect()),this.restoreHandlers.push(In(le(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(k.host(t))),this.restoreHandlers.push(Mn({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,s){const o=this;this.restoreHandlers.push(Ee(t.prototype,"attachShadow",function(i){return function(a){const c=i.call(this,a),d=k.shadowRoot(this);return d&&Cn(this)&&o.addShadowRoot(d,s),c}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch(s){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}var Fe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",za=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(var it=0;it<Fe.length;it++)za[Fe.charCodeAt(it)]=it;var qa=function(e){var t=new Uint8Array(e),s,o=t.length,i="";for(s=0;s<o;s+=3)i+=Fe[t[s]>>2],i+=Fe[(t[s]&3)<<4|t[s+1]>>4],i+=Fe[(t[s+1]&15)<<2|t[s+2]>>6],i+=Fe[t[s+2]&63];return o%3===2?i=i.substring(0,i.length-1)+"=":o%3===1&&(i=i.substring(0,i.length-2)+"=="),i};const Ni=new Map;function ja(e,t){let s=Ni.get(e);return s||(s=new Map,Ni.set(e,s)),s.has(t)||s.set(t,[]),s.get(t)}const En=(e,t,s)=>{if(!e||!(Pn(e,t)||typeof e=="object"))return;const o=e.constructor.name,i=ja(s,o);let a=i.indexOf(e);return a===-1&&(a=i.length,i.push(e)),a};function nt(e,t,s,o){if(e instanceof Array)return e.map(i=>nt(i,t,s,o));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,a=qa(e);return{rr_type:i,base64:a}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[nt(e.buffer,t,s,o),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const i=e.constructor.name,{src:a}=e;return{rr_type:i,src:a}}else if(e instanceof HTMLCanvasElement){const i="HTMLImageElement",a=e.toDataURL(o.type,o.quality);return{rr_type:i,src:a}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[nt(e.data,t,s,o),e.width,e.height]};if(Pn(e,t)||typeof e=="object"){const i=e.constructor.name,a=En(e,t,s);return{rr_type:i,index:a}}}}return e}const An=(e,t,s,o)=>e.map(i=>nt(i,t,s,o)),Pn=(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 Ha(e,t,s,o,i){const a=[],c=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const d of c)try{if(typeof t.CanvasRenderingContext2D.prototype[d]!="function")continue;const m=Ee(t.CanvasRenderingContext2D.prototype,d,function(h){return function(...r){return ie(this.canvas,s,o,!0)||setTimeout(()=>{const u=An(r,t,this,i);e(this.canvas,{type:Be["2D"],property:d,args:u})},0),h.apply(this,r)}});a.push(m)}catch(m){const h=vt(t.CanvasRenderingContext2D.prototype,d,{set(r){e(this.canvas,{type:Be["2D"],property:d,args:[r],setter:!0})}});a.push(h)}return()=>{a.forEach(d=>d())}}function Va(e){return e==="experimental-webgl"?"webgl":e}function _i(e,t,s,o){const i=[];try{const a=Ee(e.HTMLCanvasElement.prototype,"getContext",function(c){return function(d,...m){if(!ie(this,t,s,!0)){const h=Va(d);if("__context"in this||(this.__context=h),o&&["webgl","webgl2"].includes(h))if(m[0]&&typeof m[0]=="object"){const r=m[0];r.preserveDrawingBuffer||(r.preserveDrawingBuffer=!0)}else m.splice(0,1,{preserveDrawingBuffer:!0})}return c.apply(this,[d,...m])}});i.push(a)}catch(a){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(a=>a())}}function ki(e,t,s,o,i,a,c){const d=[],m=Object.getOwnPropertyNames(e);for(const h of m)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(h))try{if(typeof e[h]!="function")continue;const r=Ee(e,h,function(u){return function(...l){const n=u.apply(this,l);if(En(n,a,this),"tagName"in this.canvas&&!ie(this.canvas,o,i,!0)){const p=An(l,a,this,c),f={type:t,property:h,args:p};s(this.canvas,f)}return n}});d.push(r)}catch(r){const u=vt(e,h,{set(l){s(this.canvas,{type:t,property:h,args:[l],setter:!0})}});d.push(u)}return d}function Ga(e,t,s,o,i){const a=[];return a.push(...ki(t.WebGLRenderingContext.prototype,Be.WebGL,e,s,o,t,i)),typeof t.WebGL2RenderingContext!="undefined"&&a.push(...ki(t.WebGL2RenderingContext.prototype,Be.WebGL2,e,s,o,t,i)),()=>{a.forEach(c=>c())}}const Nn=`(function() {
|
|
59
59
|
"use strict";
|
|
60
60
|
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
61
61
|
var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
|