@screeb/rrweb 1.0.20 → 2.1.6-screeb.1

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.
@@ -0,0 +1,109 @@
1
+ (function (g, f) {
2
+ if ("object" == typeof exports && "object" == typeof module) {
3
+ module.exports = f();
4
+ } else if ("function" == typeof define && define.amd) {
5
+ define("rrweb", [], f);
6
+ } else if ("object" == typeof exports) {
7
+ exports["rrweb"] = f();
8
+ } else {
9
+ g["rrweb"] = f();
10
+ }
11
+ }(this, () => {
12
+ var exports = {};
13
+ var module = { exports };
14
+ "use strict";var sr=Object.defineProperty,or=Object.defineProperties;var ir=Object.getOwnPropertyDescriptors;var Oe=Object.getOwnPropertySymbols;var ut=Object.prototype.hasOwnProperty,dt=Object.prototype.propertyIsEnumerable;var ct=(e,t,r)=>t in e?sr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,P=(e,t)=>{for(var r in t||(t={}))ut.call(t,r)&&ct(e,r,t[r]);if(Oe)for(var r of Oe(t))dt.call(t,r)&&ct(e,r,t[r]);return e},Ne=(e,t)=>or(e,ir(t));var ht=(e,t)=>{var r={};for(var n in e)ut.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Oe)for(var n of Oe(e))t.indexOf(n)<0&&dt.call(e,n)&&(r[n]=e[n]);return r};var ar=Object.defineProperty,lr=(e,t,r)=>t in e?ar(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,g=(e,t,r)=>lr(e,typeof t!="symbol"?t+"":t,r),ft;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var O=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e[e.Asset=7]="Asset",e))(O||{}),I=(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))(I||{}),z=(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))(z||{}),Q=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Q||{}),me=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(me||{}),ue=(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))(ue||{}),F=(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))(F||{});const pt={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument","firstChild","lastChild","nextSibling","previousSibling"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},mt={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Ee={},Et={},cr=()=>!!globalThis.Zone;function rt(e){if(Ee[e])return Ee[e];const t=globalThis[e],r=t.prototype,n=e in pt?pt[e]:void 0,s=!!(n&&n.every(c=>{var i,d;return!!((d=(i=Object.getOwnPropertyDescriptor(r,c))==null?void 0:i.get)!=null&&d.toString().includes("[native code]"))})),o=e in mt?mt[e]:void 0,a=!!(o&&o.every(c=>{var i;return typeof r[c]=="function"&&((i=r[c])==null?void 0:i.toString().includes("[native code]"))}));if(s&&a&&!cr())return Ee[e]=t.prototype,t.prototype;try{const c=document.createElement("iframe");c.style.display="none",document.body.appendChild(c);const i=c.contentWindow;if(!i)return t.prototype;const d=i[e].prototype;if(!d)return c.remove(),r;const p=navigator.userAgent;return p.includes("Safari")&&!p.includes("Chrome")?(c.classList.add("rr-block"),c.setAttribute("__rrwebUntaintedMutationObserver",""),Et[e]=()=>c.remove()):c.remove(),Ee[e]=d}catch(c){return r}}const Xe={};function j(e,t,r){var n,s;const o=(n=Xe[e])==null?void 0:n[r];if(o)return o.call(t);const a=rt(e),c=(s=Object.getOwnPropertyDescriptor(a,r))==null?void 0:s.get;return c?((Xe[e]||(Xe[e]={}))[r]=c,c.call(t)):t[r]}const Ye={};function kt(e,t,r){const n=`${e}.${String(r)}`;if(Ye[n])return Ye[n].bind(t);const o=rt(e)[r];return typeof o!="function"?t[r]:(Ye[n]=o,o.bind(t))}function ur(e){return j("Node",e,"ownerDocument")}function dr(e){return j("Node",e,"childNodes")}function hr(e){return j("Node",e,"parentNode")}function fr(e){return j("Node",e,"parentElement")}function pr(e){return j("Node",e,"textContent")}function mr(e){return j("Node",e,"firstChild")}function gr(e){return j("Node",e,"lastChild")}function yr(e){return j("Node",e,"nextSibling")}function Sr(e){return j("Node",e,"previousSibling")}function br(e,t){return kt("Node",e,"contains")(t)}function Cr(e){return kt("Node",e,"getRootNode")()}function Mr(e){return!e||!("host"in e)?null:j("ShadowRoot",e,"host")}function vr(e){return e.styleSheets}function Ir(e){return!e||!("shadowRoot"in e)?null:j("Element",e,"shadowRoot")}function wr(e,t){return j("Element",e,"querySelector")(t)}function Rr(e,t){return j("Element",e,"querySelectorAll")(t)}function Tt(){var e;return[rt("MutationObserver").constructor,(e=Et.MutationObserver)!=null?e:()=>{}]}let Ce=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Ce=()=>new Date().getTime());function le(e,t,r){try{if(!(t in e))return()=>{};const n=e[t],s=r(n);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=s,()=>{e[t]=n}}catch(n){return()=>{}}}const b={ownerDocument:ur,childNodes:dr,parentNode:hr,parentElement:fr,textContent:pr,firstChild:mr,lastChild:gr,nextSibling:yr,previousSibling:Sr,contains:br,getRootNode:Cr,host:Mr,styleSheets:vr,shadowRoot:Ir,querySelector:wr,querySelectorAll:Rr,nowTimestamp:Ce,mutationObserverCtor:Tt,patch:le};function Dt(e){return e.nodeType===e.ELEMENT_NODE}function ye(e){const t=e&&"host"in e&&"mode"in e&&b.host(e)||null;return!!(t&&"shadowRoot"in t&&b.shadowRoot(t)===e)}function Se(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Or(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function Nr(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function Qe(e){try{const t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);const n=Array.from(t,s=>xt(s,r)).join("");return Or(n)}catch(t){return null}}function xt(e,t){if(kr(e)){let r;try{r=Qe(e.styleSheet)||Nr(e)}catch(n){r=e.cssText}return e.styleSheet.href?Pe(r,e.styleSheet.href):r}else{let r=e.cssText;return Tr(e)&&e.selectorText.includes(":")&&(r=Er(r)),t?Pe(r,t):r}}function Er(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function kr(e){return"styleSheet"in e}function Tr(e){return"selectorText"in e}class Lt{constructor(){g(this,"idNodeMap",new Map),g(this,"nodeMetaMap",new WeakMap)}getId(t){var r;if(!t)return-1;const n=(r=this.getMeta(t))==null?void 0:r.id;return n!=null?n:-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(n=>this.removeNodeFromMap(n))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){const n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){const n=this.getNode(t);if(n){const s=this.nodeMetaMap.get(n);s&&this.nodeMetaMap.set(r,s)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Dr(){return new Lt}function Ae({element:e,maskInputOptions:t,tagName:r,type:n,value:s,maskInputFn:o}){let a=s||"";const c=n&&re(n);return(t[r.toLowerCase()]||c&&t[c])&&(o?a=o(a,e):a="*".repeat(a.length)),a}function re(e){return e.toLowerCase()}const gt="__rrweb_original__";function xr(e){const t=e.getContext("2d");if(!t)return!0;const r=50;for(let n=0;n<e.width;n+=r)for(let s=0;s<e.height;s+=r){const o=t.getImageData,a=gt in o?o[gt]:o;if(new Uint32Array(a.call(t,n,s,Math.min(r,e.width-n),Math.min(r,e.height-s)).data.buffer).some(i=>i!==0))return!1}return!0}function Fe(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?re(t):null}function _t(e,t){var o;let r;try{r=new URL(e,t!=null?t:window.location.href)}catch(a){return null}const n=/\.([0-9a-z]+)(?:$)/i,s=r.pathname.match(n);return(o=s==null?void 0:s[1])!=null?o:null}function Lr(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}const _r=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Ar=/^(?:[a-z+]+:)?\/\//i,Fr=/^www\..*/i,Pr=/^(data:)([^,]*),(.*)/i;function Pe(e,t){return(e||"").replace(_r,(r,n,s,o,a,c)=>{const i=s||a||c,d=n||o||"";if(!i)return r;if(Ar.test(i)||Fr.test(i))return`url(${d}${i}${d})`;if(Pr.test(i))return`url(${d}${i}${d})`;if(i[0]==="/")return`url(${d}${Lr(t)+i}${d})`;const p=i.split("#")[0],u=i.substring(p.length),f=t.split("#")[0].split("/"),m=p.split("/");f.pop();for(const h of m)h!=="."&&(h===".."?f.pop():f.push(h));return`url(${d}${f.join("/")}${u}${d})`})}function ke(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function Wr(e,t,r=!1){const n=Array.from(t.childNodes),s=[];let o=0;if(n.length>1&&e&&typeof e=="string"){let a=ke(e,r);const c=a.length/e.length;for(let i=1;i<n.length;i++)if(n[i].textContent&&typeof n[i].textContent=="string"){const d=ke(n[i].textContent,r),p=100;let u=3;for(;u<d.length&&(d[u].match(/[a-zA-Z0-9]/)||d.indexOf(d.substring(0,u),1)!==-1);u++);for(;u<d.length;u++){let f=d.substring(0,u),m=a.split(f),h=-1;if(m.length===2)h=m[0].length;else if(m.length>2&&m[0]===""&&n[i-1].textContent!=="")h=a.indexOf(f,1);else if(m.length===1){if(f=f.substring(0,f.length-1),m=a.split(f),m.length<=1)return s.push(e),s;u=p+1}else u===d.length-1&&(h=a.indexOf(f));if(m.length>=2&&u>p){const l=n[i-1].textContent;if(l&&typeof l=="string"){const S=ke(l).length;h=a.indexOf(f,S)}h===-1&&(h=m[0].length)}if(h!==-1){let l=Math.floor(h/c);for(;l>0&&l<e.length;){if(o+=1,o>50*n.length)return s.push(e),s;const S=ke(e.substring(0,l),r);if(S.length===h){s.push(e.substring(0,l)),e=e.substring(l),a=a.substring(h);break}else S.length<h?l+=Math.max(1,Math.floor((h-S.length)/c)):l-=Math.max(1,Math.floor((S.length-h)*c))}break}}}}return s.push(e),s}function Ur(e,t){return Wr(e,t).join("/* rr_split */")}let Br=1;const Hr=new RegExp("[^a-z0-9-_:]"),We=-2;function At(){return Br++}function zr(e){if(Object.prototype.toString.call(e)==="[object HTMLFormElement]")return"form";const t=re(e.tagName);return Hr.test(t)?"div":t}let ce,yt;const Gr=/^[^ \t\n\r\u000c]+/,jr=/^[, \t\n\r\u000c]+/;function Vr(e,t){if(t.trim()==="")return t;let r=0;function n(o){let a;const c=o.exec(t.substring(r));return c?(a=c[0],r+=a.length,a):""}const s=[];for(;n(jr),!(r>=t.length);){let o=n(Gr);if(o.slice(-1)===",")o=he(e,o.substring(0,o.length-1)),s.push(o);else{let a="";o=he(e,o);let c=!1;for(;;){const i=t.charAt(r);if(i===""){s.push((o+a).trim());break}else if(c)i===")"&&(c=!1);else if(i===","){r+=1,s.push((o+a).trim());break}else i==="("&&(c=!0);a+=i,r+=1}}}return s.join(", ")}const St=new WeakMap;function he(e,t){return!t||t.trim()===""?t:nt(e,t)}function $r(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function nt(e,t){let r=St.get(e);if(r||(r=e.createElement("a"),St.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function Ft(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&["table","td","th"].includes(t)?he(e,n):r==="srcset"?Vr(e,n):r==="style"?Pe(n,nt(e)):t==="object"&&r==="data"?he(e,n):n)}function Pt(e,t,r){return["video","audio"].includes(e)&&re(t)==="autoplay"}function qr(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const s=e.classList[n];if(t.test(s))return!0}if(r)return e.matches(r)}catch(n){}return!1}function Ue(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?Ue(b.parentNode(e),t,r):!1;for(let n=e.classList.length;n--;){const s=e.classList[n];if(t.test(s))return!0}return r?Ue(b.parentNode(e),t,r):!1}function Wt(e,t,r,n){let s;if(Dt(e)){if(s=e,!b.childNodes(s).length)return!1}else{if(b.parentElement(e)===null)return!1;s=b.parentElement(e)}try{if(typeof t=="string"){if(n){if(s.closest(`.${t}`))return!0}else if(s.classList.contains(t))return!0}else if(Ue(s,t,n))return!0;if(r){if(n){if(s.closest(r))return!0}else if(s.matches(r))return!0}}catch(o){}return!1}function Xr(e,t,r){const n=e.contentWindow;if(!n)return;let s=!1,o;try{o=n.document.readyState}catch(c){return}if(o!=="complete"){const c=setTimeout(()=>{s||(t(),s=!0)},r);e.addEventListener("load",()=>{clearTimeout(c),s=!0,t()});return}const a="about:blank";if(n.location.href!==a||e.src===a||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function Yr(e,t,r){let n=!1,s;try{s=e.sheet}catch(a){return}if(s)return;const o=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(o),n=!0,t()})}function Jr(e,t){const{doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:a,inlineStylesheet:c,maskInputOptions:i={},maskTextFn:d,maskInputFn:p,dataURLOptions:u={},inlineImages:f,recordCanvas:m,keepIframeSrcFn:h,newlyAddedElement:l=!1,cssCaptured:S=!1}=t,M=Zr(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:F.Document,childNodes:[],compatMode:e.compatMode}:{type:F.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:F.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:M};case e.ELEMENT_NODE:return Kr(e,{doc:r,blockClass:s,blockSelector:o,inlineStylesheet:c,maskInputOptions:i,maskInputFn:p,dataURLOptions:u,inlineImages:f,recordCanvas:m,keepIframeSrcFn:h,newlyAddedElement:l,rootId:M});case e.TEXT_NODE:return Qr(e,{doc:r,needsMask:a,maskTextFn:d,rootId:M,cssCaptured:S});case e.CDATA_SECTION_NODE:return{type:F.CDATA,textContent:"",rootId:M};case e.COMMENT_NODE:return{type:F.Comment,textContent:b.textContent(e)||"",rootId:M};default:return!1}}function Zr(e,t){if(!t.hasNode(e))return;const r=t.getId(e);return r===1?void 0:r}function Qr(e,t){const{needsMask:r,maskTextFn:n,rootId:s,cssCaptured:o}=t,a=b.parentNode(e),c=a&&a.tagName;let i="";const d=c==="STYLE"?!0:void 0,p=c==="SCRIPT"?!0:void 0;return p?i="SCRIPT_PLACEHOLDER":o||(i=b.textContent(e),d&&i&&(i=Pe(i,nt(t.doc)))),!d&&!p&&i&&r&&(i=n?n(i,b.parentElement(e)):i.replace(/[\S]/g,"*")),{type:F.Text,textContent:i||"",rootId:s}}function Kr(e,t){const{doc:r,blockClass:n,blockSelector:s,inlineStylesheet:o,maskInputOptions:a={},maskInputFn:c,dataURLOptions:i={},inlineImages:d,recordCanvas:p,keepIframeSrcFn:u,newlyAddedElement:f=!1,rootId:m}=t,h=qr(e,n,s),l=zr(e);let S={};const M=e.attributes.length;for(let y=0;y<M;y++){const v=e.attributes[y];Pt(l,v.name,v.value)||(S[v.name]=Ft(r,l,re(v.name),v.value))}if(l==="link"&&o){const y=Array.from(r.styleSheets).find(D=>D.href===e.href);let v=null;y&&(v=Qe(y)),v&&(delete S.rel,delete S.href,S._cssText=v)}if(l==="style"&&e.sheet){let y=Qe(e.sheet);y&&(e.childNodes.length>1&&(y=Ur(y,e)),S._cssText=y)}if(["input","textarea","select"].includes(l)){const y=e.value,v=e.checked;S.type!=="radio"&&S.type!=="checkbox"&&S.type!=="submit"&&S.type!=="button"&&y?S.value=Ae({element:e,type:Fe(e),tagName:l,value:y,maskInputOptions:a,maskInputFn:c}):v&&(S.checked=v)}if(l==="option"&&(e.selected&&!a.select?S.selected=!0:delete S.selected),l==="dialog"&&e.open&&(S.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),l==="canvas"&&p){if(e.__context==="2d")xr(e)||(S.rr_dataURL=e.toDataURL(i.type,i.quality));else if(!("__context"in e)){const y=e.toDataURL(i.type,i.quality),v=r.createElement("canvas");v.width=e.width,v.height=e.height;const D=v.toDataURL(i.type,i.quality);y!==D&&(S.rr_dataURL=y)}}if(l==="img"&&d){ce||(ce=r.createElement("canvas"),yt=ce.getContext("2d"));const y=e,v=y.currentSrc||y.getAttribute("src")||"<unknown-src>",D=y.crossOrigin,x=()=>{y.removeEventListener("load",x);try{ce.width=y.naturalWidth,ce.height=y.naturalHeight,yt.drawImage(y,0,0),S.rr_dataURL=ce.toDataURL(i.type,i.quality)}catch(U){if(y.crossOrigin!=="anonymous"){y.crossOrigin="anonymous",y.complete&&y.naturalWidth!==0?x():y.addEventListener("load",x);return}else console.warn(`Cannot inline img src=${v}! Error: ${U}`)}y.crossOrigin==="anonymous"&&(D?S.crossOrigin=D:y.removeAttribute("crossorigin"))};y.complete&&y.naturalWidth!==0?x():y.addEventListener("load",x)}if(["audio","video"].includes(l)){const y=S;y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime,y.rr_mediaPlaybackRate=e.playbackRate,y.rr_mediaMuted=e.muted,y.rr_mediaLoop=e.loop,y.rr_mediaVolume=e.volume}if(f||(e.scrollLeft&&(S.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(S.rr_scrollTop=e.scrollTop)),h){const{width:y,height:v}=e.getBoundingClientRect();S={class:S.class,rr_width:`${y}px`,rr_height:`${v}px`}}l==="iframe"&&!u(S.src)&&(e.contentDocument||(S.rr_src=S.src),delete S.src);let C;try{customElements.get(l)&&(C=!0)}catch(y){}return{type:F.Element,tagName:l,attributes:S,childNodes:[],isSVG:$r(e)||void 0,needBlock:h,rootId:m,isCustom:C}}function T(e){return e==null?"":e.toLowerCase()}function Ut(e){return e===!0||e==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}function en(e,t){if(t.comment&&e.type===F.Comment)return!0;if(e.type===F.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&_t(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(T(e.attributes.name).match(/^msapplication-tile(image|color)$/)||T(e.attributes.name)==="application-name"||T(e.attributes.rel)==="icon"||T(e.attributes.rel)==="apple-touch-icon"||T(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&T(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(T(e.attributes.property).match(/^(og|twitter|fb):/)||T(e.attributes.name).match(/^(og|twitter):/)||T(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(T(e.attributes.name)==="robots"||T(e.attributes.name)==="googlebot"||T(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(T(e.attributes.name)==="author"||T(e.attributes.name)==="generator"||T(e.attributes.name)==="framework"||T(e.attributes.name)==="publisher"||T(e.attributes.name)==="progid"||T(e.attributes.property).match(/^article:/)||T(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(T(e.attributes.name)==="google-site-verification"||T(e.attributes.name)==="yandex-verification"||T(e.attributes.name)==="csrf-token"||T(e.attributes.name)==="p:domain_verify"||T(e.attributes.name)==="verify-v1"||T(e.attributes.name)==="verification"||T(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function fe(e,t){const{doc:r,mirror:n,blockClass:s,blockSelector:o,maskTextClass:a,maskTextSelector:c,skipChild:i=!1,inlineStylesheet:d=!0,maskInputOptions:p={},maskTextFn:u,maskInputFn:f,slimDOMOptions:m,dataURLOptions:h={},inlineImages:l=!1,recordCanvas:S=!1,onSerialize:M,onIframeLoad:C,iframeLoadTimeout:y=5e3,onStylesheetLoad:v,stylesheetLoadTimeout:D=5e3,keepIframeSrcFn:x=()=>!1,newlyAddedElement:U=!1,cssCaptured:Z=!1}=t;let{needsMask:V}=t,{preserveWhiteSpace:X=!0}=t;V||(V=Wt(e,a,c,V===void 0));const $=Jr(e,{doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:V,inlineStylesheet:d,maskInputOptions:p,maskTextFn:u,maskInputFn:f,dataURLOptions:h,inlineImages:l,recordCanvas:S,keepIframeSrcFn:x,newlyAddedElement:U,cssCaptured:Z});if(!$)return console.warn(e,"not serialized"),null;let ne;n.hasNode(e)?ne=n.getId(e):en($,m)||!X&&$.type===F.Text&&!$.textContent.replace(/^\s+|\s+$/gm,"").length?ne=We:ne=At();const R=Object.assign($,{id:ne});if(n.add(e,R),ne===We)return null;M&&M(e);let se=!i;if(R.type===F.Element){se=se&&!R.needBlock,delete R.needBlock;const W=b.shadowRoot(e);W&&Se(W)&&(R.isShadowHost=!0)}if((R.type===F.Document||R.type===F.Element)&&se){m.headWhitespace&&R.type===F.Element&&R.tagName==="head"&&(X=!1);const W={doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:V,maskTextClass:a,maskTextSelector:c,skipChild:i,inlineStylesheet:d,maskInputOptions:p,maskTextFn:u,maskInputFn:f,slimDOMOptions:m,dataURLOptions:h,inlineImages:l,recordCanvas:S,preserveWhiteSpace:X,onSerialize:M,onIframeLoad:C,iframeLoadTimeout:y,onStylesheetLoad:v,stylesheetLoadTimeout:D,keepIframeSrcFn:x,cssCaptured:!1};if(!(R.type===F.Element&&R.tagName==="textarea"&&R.attributes.value!==void 0)){R.type===F.Element&&R.attributes._cssText!==void 0&&typeof R.attributes._cssText=="string"&&(W.cssCaptured=!0);for(const K of Array.from(b.childNodes(e))){const q=fe(K,W);q&&R.childNodes.push(q)}}let N=null;if(Dt(e)&&(N=b.shadowRoot(e)))for(const K of Array.from(b.childNodes(N))){const q=fe(K,W);q&&(Se(N)&&(q.isShadow=!0),R.childNodes.push(q))}}const ge=b.parentNode(e);return ge&&ye(ge)&&Se(ge)&&(R.isShadow=!0),R.type===F.Element&&R.tagName==="iframe"&&Xr(e,()=>{const W=e.contentDocument;if(W&&C){const N=fe(W,{doc:W,mirror:n,blockClass:s,blockSelector:o,needsMask:V,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:d,maskInputOptions:p,maskTextFn:u,maskInputFn:f,slimDOMOptions:m,dataURLOptions:h,inlineImages:l,recordCanvas:S,preserveWhiteSpace:X,onSerialize:M,onIframeLoad:C,iframeLoadTimeout:y,onStylesheetLoad:v,stylesheetLoadTimeout:D,keepIframeSrcFn:x});N&&C(e,N)}},y),R.type===F.Element&&R.tagName==="link"&&typeof R.attributes.rel=="string"&&(R.attributes.rel==="stylesheet"||R.attributes.rel==="preload"&&typeof R.attributes.href=="string"&&_t(R.attributes.href)==="css")&&Yr(e,()=>{if(v){const W=fe(e,{doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:V,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:d,maskInputOptions:p,maskTextFn:u,maskInputFn:f,slimDOMOptions:m,dataURLOptions:h,inlineImages:l,recordCanvas:S,preserveWhiteSpace:X,onSerialize:M,onIframeLoad:C,iframeLoadTimeout:y,onStylesheetLoad:v,stylesheetLoadTimeout:D,keepIframeSrcFn:x});W&&v(e,W)}},D),R}function tn(e,t){const{mirror:r=new Lt,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:o="rr-mask",maskTextSelector:a=null,inlineStylesheet:c=!0,inlineImages:i=!1,recordCanvas:d=!1,maskAllInputs:p=!1,maskTextFn:u,maskInputFn:f,slimDOM:m=!1,dataURLOptions:h,preserveWhiteSpace:l,onSerialize:S,onIframeLoad:M,iframeLoadTimeout:C,onStylesheetLoad:y,stylesheetLoadTimeout:v,keepIframeSrcFn:D=()=>!1}=t,x=p===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p===!1?{password:!0}:p,U=Ut(m);return fe(e,{doc:e,mirror:r,blockClass:n,blockSelector:s,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:x,maskTextFn:u,maskInputFn:f,slimDOMOptions:U,dataURLOptions:h,inlineImages:i,recordCanvas:d,preserveWhiteSpace:l,onSerialize:S,onIframeLoad:M,iframeLoadTimeout:C,onStylesheetLoad:y,stylesheetLoadTimeout:v,keepIframeSrcFn:D,newlyAddedElement:!1})}class st{constructor(...t){g(this,"parentElement",null),g(this,"parentNode",null),g(this,"ownerDocument"),g(this,"firstChild",null),g(this,"lastChild",null),g(this,"previousSibling",null),g(this,"nextSibling",null),g(this,"ELEMENT_NODE",1),g(this,"TEXT_NODE",3),g(this,"nodeType"),g(this,"nodeName"),g(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 st){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function B(e,t,r=document){const n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}const de=`Please stop import mirror directly. Instead of that,\r
15
+ now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
16
+ or you can use record.mirror to access the mirror instance during recording.`;let bt={map:{},getId(){return console.error(de),-1},getNode(){return console.error(de),null},removeNodeFromMap(){console.error(de)},has(){return console.error(de),!1},reset(){console.error(de)}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(bt=new Proxy(bt,{get(e,t,r){return t==="map"&&console.error(de),Reflect.get(e,t,r)}}));function Me(e,t,r={}){let n=null,s=0;return function(...o){const a=Date.now();!s&&r.leading===!1&&(s=a);const c=t-(a-s),i=this;c<=0||c>t?(n&&(clearTimeout(n),n=null),s=a,e.apply(i,o)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{s=r.leading===!1?0:Date.now(),n=null,e.apply(i,o)},c))}}function ze(e,t,r,n,s=window){const o=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,n?r:{set(a){setTimeout(()=>{r.set.call(this,a)},0),o&&o.set&&o.set.call(this,a)}}),()=>ze(e,t,o||{},!0)}function Bt(e){var t,r,n,s;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=b.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)&&((n=b.parentElement(o.body))==null?void 0:n.scrollTop)||((s=o==null?void 0:o.body)==null?void 0:s.scrollTop)||0}}function Ht(e){var t,r;return e.innerHeight||((t=e.document.documentElement)==null?void 0:t.clientHeight)||((r=e.document.body)==null?void 0:r.clientHeight)}function zt(e){var t,r;return e.innerWidth||((t=e.document.documentElement)==null?void 0:t.clientWidth)||((r=e.document.body)==null?void 0:r.clientWidth)}function Gt(e){return e?e.nodeType===e.ELEMENT_NODE?e:b.parentElement(e):null}function H(e,t,r,n){if(!e)return!1;const s=Gt(e);if(!s)return!1;try{if(typeof t=="string"){if(s.classList.contains(t)||n&&s.closest("."+t)!==null)return!0}else if(Ue(s,t,n))return!0}catch(o){}return!!(r&&(s.matches(r)||n&&s.closest(r)!==null))}function rn(e,t){return t.getId(e)!==-1}function Je(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===We}function jt(e,t){if(ye(e))return!1;const r=t.getId(e);if(!t.has(r))return!0;const n=b.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?!1:n?jt(n,t):!0}function Ke(e){return!!e.changedTouches}function ee(e,t){var r,n;const s=(n=(r=e.Zone)==null?void 0:r.__symbol__)==null?void 0:n.call(r,"requestAnimationFrame");return(s&&e[s]||e.requestAnimationFrame).call(e,t)}function nn(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 Vt(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function $t(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function et(e){return e?e instanceof st&&"shadowRoot"in e?!!e.shadowRoot:!!b.shadowRoot(e):!1}class sn{constructor(){g(this,"id",1),g(this,"styleIDMap",new WeakMap),g(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 n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function qt(e){var t;let r=null;return"getRootNode"in e&&((t=b.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&b.host(b.getRootNode(e))&&(r=b.host(b.getRootNode(e))),r}function on(e){let t=e,r;for(;r=qt(t);)t=r;return t}function an(e){const t=b.ownerDocument(e);if(!t)return!1;const r=on(e);return b.contains(t,r)}function Xt(e){const t=b.ownerDocument(e);return t?b.contains(t,e)||an(e):!1}const Ct=(e,t)=>`${e}@${t}`;class ln{constructor(){g(this,"frozen",!1),g(this,"locked",!1),g(this,"texts",[]),g(this,"attributes",[]),g(this,"attributeMap",new WeakMap),g(this,"removes",[]),g(this,"mapRemoves",[]),g(this,"movedMap",{}),g(this,"addedSet",new Set),g(this,"movedSet",new Set),g(this,"droppedSet",new Set),g(this,"removesSubTreeCache",new Set),g(this,"mutationCb"),g(this,"blockClass"),g(this,"blockSelector"),g(this,"maskTextClass"),g(this,"maskTextSelector"),g(this,"inlineStylesheet"),g(this,"maskInputOptions"),g(this,"maskTextFn"),g(this,"maskInputFn"),g(this,"keepIframeSrcFn"),g(this,"recordCanvas"),g(this,"inlineImages"),g(this,"slimDOMOptions"),g(this,"dataURLOptions"),g(this,"doc"),g(this,"mirror"),g(this,"iframeManager"),g(this,"stylesheetManager"),g(this,"shadowDomManager"),g(this,"canvasManager"),g(this,"processedNodeManager"),g(this,"unattachedDoc"),g(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),g(this,"emit",()=>{if(this.frozen||this.locked)return;const t=[],r=new Set;for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const f of this.movedSet){const m=b.parentNode(f);this.removesSubTreeCache.has(m)&&!this.movedSet.has(m)||this.addedSet.add(f)}let n=null,s=null,o=-1,a=null,c=!1;const i=new Set,d=this.addedSet.values();let p=d.next();for(;this.addedSet.size;){if(n!==null&&this.addedSet.has(b.previousSibling(n)))a=n,n=b.previousSibling(n);else{for(this.addedSet.has(p.value)||(p=d.next()),n=p.value;;){if(s=b.parentNode(n),this.addedSet.has(s)){n=s;continue}break}if(i.has(s))s=null;else if(s){if(Xt(s)?(c=Mt(this.droppedSet,s)||this.removesSubTreeCache.has(s),c&&Mt(this.movedSet,n)&&(c=!1)):c=!0,this.addedSet.has(b.lastChild(s)))n=b.lastChild(s),a=null;else for(;;){if(a=b.nextSibling(n),this.addedSet.has(a)){n=a;continue}break}if(o=ye(s)?this.mirror.getId(qt(n)):this.mirror.getId(s),o===-1&&s.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const l=b.host(s);o=this.mirror.getId(l)}}}if(this.addedSet.delete(n),!s||o===-1){i.add(n);continue}else if(c){this.droppedSet.add(n);continue}let f=!1;if(n.nodeType===Node.TEXT_NODE){const l=s.tagName;if(l==="TEXTAREA")continue;l==="STYLE"&&r.has(o)&&(f=!0)}let m=a?this.mirror.getId(a):null;for(;m===We;)a=a&&b.nextSibling(a),m=a&&this.mirror.getId(a);if(m===-1){console.warn("Couldn't record new node. Couldn't find mirror id for nextSibling:",a),n=null;continue}const h=fe(n,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:l=>{Vt(l,this.mirror)&&this.iframeManager.addIframe(l),$t(l,this.mirror)&&this.stylesheetManager.trackLinkElement(l),et(n)&&this.shadowDomManager.addShadowRoot(b.shadowRoot(n),this.doc)},onIframeLoad:(l,S)=>{this.iframeManager.attachIframe(l,S),this.shadowDomManager.observeAttachShadow(l)},onStylesheetLoad:(l,S)=>{this.stylesheetManager.attachLinkElement(l,S)},cssCaptured:f});h&&(t.push({parentId:o,nextId:m,node:h}),r.add(h.id))}const u={texts:this.texts.map(f=>{const m=f.node,h=b.parentNode(m);return h&&h.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(h),{id:this.mirror.getId(m),value:f.value}}).filter(f=>!r.has(f.id)).filter(f=>this.mirror.has(f.id)),attributes:this.attributes.map(f=>{const{attributes:m}=f;if(typeof m.style=="string"){const h=JSON.stringify(f.styleDiff),l=JSON.stringify(f._unchangedStyles);h.length<m.style.length&&(h+l).split("var(").length===m.style.split("var(").length&&(m.style=f.styleDiff)}return{id:this.mirror.getId(f.node),attributes:m}}).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))}),g(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));const n=Array.from(b.childNodes(t),s=>b.textContent(s)||"").join("");r.attributes.value=Ae({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Fe(t),value:n,maskInputFn:this.maskInputFn})}),g(this,"processMutation",t=>{if(!Je(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const r=b.textContent(t.target);!H(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:Wt(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,Gt(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{const r=t.target,n=re(r.tagName);let s=t.attributeName,o=t.target.getAttribute(s);if(s==="value"){const c=Fe(r);o=Ae({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:c,value:o,maskInputFn:this.maskInputFn})}if(H(t.target,this.blockClass,this.blockSelector,!1)||o===t.oldValue)return;let a=this.attributeMap.get(t.target);if(n==="iframe"&&s==="src"&&!this.keepIframeSrcFn(o))if(!r.contentDocument)s="rr_src";else return;if(a||(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(t.target,a)),s==="type"&&n==="input"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!Pt(n,s))if(a.attributes[s]=Ft(this.doc,n,re(s),o),s==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(i){this.unattachedDoc=this.doc}const c=this.unattachedDoc.createElement("span");t.oldValue&&c.setAttribute("style",t.oldValue);for(const i of Array.from(r.style)){const d=r.style.getPropertyValue(i),p=r.style.getPropertyPriority(i);d!==c.style.getPropertyValue(i)||p!==c.style.getPropertyPriority(i)?p===""?a.styleDiff[i]=d:a.styleDiff[i]=[d,p]:a._unchangedStyles[i]=[d,p]}for(const i of Array.from(c.style))r.style.getPropertyValue(i)===""&&(a.styleDiff[i]=!1)}else s==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?a.attributes.rr_open_mode="modal":a.attributes.rr_open_mode="non-modal");break}case"childList":{if(H(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 n=this.mirror.getId(r),s=ye(t.target)?this.mirror.getId(b.host(t.target)):this.mirror.getId(t.target);H(t.target,this.blockClass,this.blockSelector,!1)||Je(r,this.mirror,this.slimDOMOptions)||!rn(r,this.mirror)||(this.addedSet.has(r)?(tt(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||jt(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[Ct(n,s)]?tt(this.movedSet,r):(this.removes.push({parentId:s,id:n,isShadow:ye(t.target)&&Se(t.target)?!0:void 0}),cn(r,this.removesSubTreeCache))),this.mapRemoves.push(r))});break}}}),g(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(Je(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[Ct(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);H(t,this.blockClass,this.blockSelector,!1)||(b.childNodes(t).forEach(n=>this.genAdds(n)),et(t)&&b.childNodes(b.shadowRoot(t)).forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","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()}}function tt(e,t){e.delete(t),b.childNodes(t).forEach(r=>tt(e,r))}function cn(e,t){const r=[e];for(;r.length;){const n=r.pop();t.has(n)||(t.add(n),b.childNodes(n).forEach(s=>r.push(s)))}}function Mt(e,t){return e.size===0?!1:Yt(e,t)}function Yt(e,t){if(e.has(t))return!0;const r=b.parentNode(t);return r?Yt(e,r):!1}let be;function un(e){be=e}function dn(){be=void 0}const w=e=>be?(...r)=>{try{return e(...r)}catch(n){if(be&&be(n)===!0)return;throw n}}:e,ae=[];function ve(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 Jt(e,t){const r=new ln;ae.push(r),r.init(e);const[n,s]=Tt(),o=new n(w(r.processMutations.bind(r)));return o.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),[o,s]}function hn({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};const s=typeof t.mousemove=="number"?t.mousemove:50,o=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500;let a=[],c;const i=Me(w(u=>{const f=Date.now()-c;e(a.map(m=>(m.timeOffset-=f,m)),u),a=[],c=null}),o),d=w(Me(w(u=>{const f=ve(u),{clientX:m,clientY:h}=Ke(u)?u.changedTouches[0]:u;c||(c=Ce()),a.push({x:m,y:h,id:n.getId(f),timeOffset:Ce()-c}),i(typeof DragEvent!="undefined"&&u instanceof DragEvent?I.Drag:u instanceof MouseEvent?I.MouseMove:I.TouchMove)}),s,{trailing:!1})),p=[B("mousemove",d,r),B("touchmove",d,r),B("drag",d,r)];return w(()=>{p.forEach(u=>u())})}function fn({mouseInteractionCb:e,doc:t,win:r,mirror:n,blockClass:s,blockSelector:o,sampling:a}){if(a.mouseInteraction===!1)return()=>{};const c=a.mouseInteraction===!0||a.mouseInteraction===void 0?{}:a.mouseInteraction,i=[];let d=null;const p=u=>f=>{const m=ve(f);if(H(m,s,o,!0))return;let h=null,l=u;if("pointerType"in f){switch(f.pointerType){case"mouse":h=Q.Mouse;break;case"touch":h=Q.Touch;break;case"pen":h=Q.Pen;break}h===Q.Touch?z[u]===z.MouseDown?l="TouchStart":z[u]===z.MouseUp&&(l="TouchEnd"):Q.Pen}else Ke(f)&&(h=Q.Touch);h!==null?(d=h,(l.startsWith("Touch")&&h===Q.Touch||l.startsWith("Mouse")&&h===Q.Mouse)&&(h=null)):z[u]===z.Click&&(h=d,d=null);const S=Ke(f)?f.changedTouches[0]:f;if(!S)return;const M=n.getId(m),{clientX:C,clientY:y}=S;w(e)(P({type:z[l],id:M,x:C,y},h!==null&&{pointerType:h}))};return Object.keys(z).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&c[u]!==!1).forEach(u=>{let f=re(u);const m=p(u);if(r.PointerEvent)switch(z[u]){case z.MouseDown:case z.MouseUp:f=f.replace("mouse","pointer");break;case z.TouchStart:case z.TouchEnd:return}i.push(B(f,m,t))}),w(()=>{i.forEach(u=>u())})}function Zt({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,sampling:o}){const a=w(Me(w(c=>{const i=ve(c);if(!i||H(i,n,s,!0))return;const d=r.getId(i);if(i===t&&t.defaultView){const p=Bt(t.defaultView);e({id:d,x:p.left,y:p.top})}else e({id:d,x:i.scrollLeft,y:i.scrollTop})}),o.scroll||100));return B("scroll",a,t)}function pn({viewportResizeCb:e,win:t},{win:r}){let n=-1,s=-1;const o=w(Me(w(()=>{const a=Ht(t),c=zt(t);(n!==a||s!==c)&&(e({width:Number(c),height:Number(a)}),n=a,s=c)}),200));return B("resize",o,r)}const mn=["INPUT","TEXTAREA","SELECT"],vt=new WeakMap;function gn({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,ignoreClass:o,ignoreSelector:a,maskInputOptions:c,maskInputFn:i,sampling:d,userTriggeredOnInput:p}){function u(C){let y=ve(C);const v=C.isTrusted,D=y&&y.tagName;if(y&&D==="OPTION"&&(y=b.parentElement(y)),!y||!D||mn.indexOf(D)<0||H(y,n,s,!0)||y.classList.contains(o)||a&&y.matches(a))return;let x=y.value,U=!1;const Z=Fe(y)||"";Z==="radio"||Z==="checkbox"?U=y.checked:(c[D.toLowerCase()]||c[Z])&&(x=Ae({element:y,maskInputOptions:c,tagName:D,type:Z,value:x,maskInputFn:i})),f(y,p?{text:x,isChecked:U,userTriggered:v}:{text:x,isChecked:U});const V=y.name;Z==="radio"&&V&&U&&t.querySelectorAll(`input[type="radio"][name="${V}"]`).forEach(X=>{if(X!==y){const $=X.value;f(X,p?{text:$,isChecked:!U,userTriggered:!1}:{text:$,isChecked:!U})}})}function f(C,y){const v=vt.get(C);if(!v||v.text!==y.text||v.isChecked!==y.isChecked){vt.set(C,y);const D=r.getId(C);w(e)(Ne(P({},y),{id:D}))}}const h=(d.input==="last"?["change"]:["input","change"]).map(C=>B(C,w(u),t)),l=t.defaultView;if(!l)return()=>{h.forEach(C=>C())};const S=l.Object.getOwnPropertyDescriptor(l.HTMLInputElement.prototype,"value"),M=[[l.HTMLInputElement.prototype,"value"],[l.HTMLInputElement.prototype,"checked"],[l.HTMLSelectElement.prototype,"value"],[l.HTMLTextAreaElement.prototype,"value"],[l.HTMLSelectElement.prototype,"selectedIndex"],[l.HTMLOptionElement.prototype,"selected"]];return S&&S.set&&h.push(...M.map(C=>ze(C[0],C[1],{set(){w(u)({target:this,isTrusted:!1})}},!1,l))),w(()=>{h.forEach(C=>C())})}function Be(e,t){const r=[];function n(s,o){if(Te(e,"CSSGroupingRule")&&s.parentRule instanceof e.CSSGroupingRule||Te(e,"CSSMediaRule")&&s.parentRule instanceof e.CSSMediaRule||Te(e,"CSSSupportsRule")&&s.parentRule instanceof e.CSSSupportsRule||Te(e,"CSSConditionRule")&&s.parentRule instanceof e.CSSConditionRule){const c=Array.from(s.parentRule.cssRules).indexOf(s);return o.unshift(c),n(s.parentRule,o)}else if(s.parentStyleSheet){const c=Array.from(s.parentStyleSheet.cssRules).indexOf(s);o.unshift(c)}return o}return n(t,r)}function te(e,t,r){let n,s;return e?(e.ownerNode?n=t.getId(e.ownerNode):s=r.getId(e),{styleId:s,id:n}):{}}function yn({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};const s=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:w((p,u,f)=>{const[m,h]=f,{id:l,styleId:S}=te(u,t,r.styleMirror);return(l&&l!==-1||S&&S!==-1)&&e({id:l,styleId:S,adds:[{rule:m,index:h}]}),p.apply(u,f)})}),n.CSSStyleSheet.prototype.addRule=function(p,u,f=this.cssRules.length){const m=`${p} { ${u} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[m,f])};const o=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:w((p,u,f)=>{const[m]=f,{id:h,styleId:l}=te(u,t,r.styleMirror);return(h&&h!==-1||l&&l!==-1)&&e({id:h,styleId:l,removes:[{index:m}]}),p.apply(u,f)})}),n.CSSStyleSheet.prototype.removeRule=function(p){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[p])};let a;n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:w((p,u,f)=>{const[m]=f,{id:h,styleId:l}=te(u,t,r.styleMirror);return(h&&h!==-1||l&&l!==-1)&&e({id:h,styleId:l,replace:m}),p.apply(u,f)})}));let c;n.CSSStyleSheet.prototype.replaceSync&&(c=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(c,{apply:w((p,u,f)=>{const[m]=f,{id:h,styleId:l}=te(u,t,r.styleMirror);return(h&&h!==-1||l&&l!==-1)&&e({id:h,styleId:l,replaceSync:m}),p.apply(u,f)})}));const i={};De(n,"CSSGroupingRule")?i.CSSGroupingRule=n.CSSGroupingRule:(De(n,"CSSMediaRule")&&(i.CSSMediaRule=n.CSSMediaRule),De(n,"CSSConditionRule")&&(i.CSSConditionRule=n.CSSConditionRule),De(n,"CSSSupportsRule")&&(i.CSSSupportsRule=n.CSSSupportsRule));const d={};return Object.entries(i).forEach(([p,u])=>{d[p]={insertRule:u.prototype.insertRule,deleteRule:u.prototype.deleteRule},u.prototype.insertRule=new Proxy(d[p].insertRule,{apply:w((f,m,h)=>{const[l,S]=h,{id:M,styleId:C}=te(m.parentStyleSheet,t,r.styleMirror);return(M&&M!==-1||C&&C!==-1)&&e({id:M,styleId:C,adds:[{rule:l,index:[...Be(n,m),S||0]}]}),f.apply(m,h)})}),u.prototype.deleteRule=new Proxy(d[p].deleteRule,{apply:w((f,m,h)=>{const[l]=h,{id:S,styleId:M}=te(m.parentStyleSheet,t,r.styleMirror);return(S&&S!==-1||M&&M!==-1)&&e({id:S,styleId:M,removes:[{index:[...Be(n,m),l]}]}),f.apply(m,h)})})}),w(()=>{n.CSSStyleSheet.prototype.insertRule=s,n.CSSStyleSheet.prototype.deleteRule=o,a&&(n.CSSStyleSheet.prototype.replace=a),c&&(n.CSSStyleSheet.prototype.replaceSync=c),Object.entries(i).forEach(([p,u])=>{u.prototype.insertRule=d[p].insertRule,u.prototype.deleteRule=d[p].deleteRule})})}function Qt({mirror:e,stylesheetManager:t},r){var n,s,o;let a=null;r.nodeName==="#document"?a=e.getId(r):a=e.getId(b.host(r));const c=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(o=(s=r.ownerDocument)==null?void 0:s.defaultView)==null?void 0:o.ShadowRoot,i=c!=null&&c.prototype?Object.getOwnPropertyDescriptor(c==null?void 0:c.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!c||!i?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get(){var d;return(d=i.get)==null?void 0:d.call(this)},set(d){var p;const u=(p=i.set)==null?void 0:p.call(this,d);if(a!==null&&a!==-1)try{t.adoptStyleSheets(d,a)}catch(f){}return u}}),w(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get:i.get,set:i.set})}))}function Sn({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:s}){const o=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:w((c,i,d)=>{var p;const[u,f,m]=d;if(r.has(u))return o.apply(i,[u,f,m]);const{id:h,styleId:l}=te((p=i.parentRule)==null?void 0:p.parentStyleSheet,t,n.styleMirror);return(h&&h!==-1||l&&l!==-1)&&e({id:h,styleId:l,set:{property:u,value:f,priority:m},index:Be(s,i.parentRule)}),c.apply(i,d)})});const a=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:w((c,i,d)=>{var p;const[u]=d;if(r.has(u))return a.apply(i,[u]);const{id:f,styleId:m}=te((p=i.parentRule)==null?void 0:p.parentStyleSheet,t,n.styleMirror);return(f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,remove:{property:u},index:Be(s,i.parentRule)}),c.apply(i,d)})}),w(()=>{s.CSSStyleDeclaration.prototype.setProperty=o,s.CSSStyleDeclaration.prototype.removeProperty=a})}function bn({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:s,doc:o}){const a=w(i=>Me(w(d=>{const p=ve(d);if(!p||H(p,t,r,!0))return;const{currentTime:u,volume:f,muted:m,playbackRate:h,loop:l}=p;e({type:i,id:n.getId(p),currentTime:u,volume:f,muted:m,playbackRate:h,loop:l})}),s.media||500)),c=[B("play",a(ue.Play),o),B("pause",a(ue.Pause),o),B("seeked",a(ue.Seeked),o),B("volumechange",a(ue.VolumeChange),o),B("ratechange",a(ue.RateChange),o)];return w(()=>{c.forEach(i=>i())})}function Cn({fontCb:e,doc:t}){const r=t.defaultView;if(!r)return()=>{};const n=[],s=new WeakMap,o=r.FontFace;r.FontFace=function(i,d,p){const u=new o(i,d,p);return s.set(u,{family:i,buffer:typeof d!="string",descriptors:p,fontSource:typeof d=="string"?d:JSON.stringify(Array.from(new Uint8Array(d)))}),u};const a=le(t.fonts,"add",function(c){return function(i){return setTimeout(w(()=>{const d=s.get(i);d&&(e(d),s.delete(i))}),0),c.apply(this,[i])}});return n.push(()=>{r.FontFace=o}),n.push(a),w(()=>{n.forEach(c=>c())})}function Mn(e){const{doc:t,mirror:r,blockClass:n,blockSelector:s,selectionCb:o}=e;let a=!0;const c=w(()=>{const i=t.getSelection();if(!i||a&&(i!=null&&i.isCollapsed))return;a=i.isCollapsed||!1;const d=[],p=i.rangeCount||0;for(let u=0;u<p;u++){const f=i.getRangeAt(u),{startContainer:m,startOffset:h,endContainer:l,endOffset:S}=f;H(m,n,s,!0)||H(l,n,s,!0)||d.push({start:r.getId(m),startOffset:h,end:r.getId(l),endOffset:S})}o({ranges:d})});return c(),B("selectionchange",c)}function vn({doc:e,customElementCb:t}){const r=e.defaultView;return!r||!r.customElements?()=>{}:le(r.customElements,"define",function(s){return function(o,a,c){try{t({define:{name:o}})}catch(i){console.warn(`Custom element callback failed for ${o}`)}return s.apply(this,[o,a,c])}})}function In(e,t){const{mutationCb:r,mousemoveCb:n,mouseInteractionCb:s,scrollCb:o,viewportResizeCb:a,inputCb:c,mediaInteractionCb:i,styleSheetRuleCb:d,styleDeclarationCb:p,canvasMutationCb:u,fontCb:f,selectionCb:m,customElementCb:h}=e;e.mutationCb=(...l)=>{t.mutation&&t.mutation(...l),r(...l)},e.mousemoveCb=(...l)=>{t.mousemove&&t.mousemove(...l),n(...l)},e.mouseInteractionCb=(...l)=>{t.mouseInteraction&&t.mouseInteraction(...l),s(...l)},e.scrollCb=(...l)=>{t.scroll&&t.scroll(...l),o(...l)},e.viewportResizeCb=(...l)=>{t.viewportResize&&t.viewportResize(...l),a(...l)},e.inputCb=(...l)=>{t.input&&t.input(...l),c(...l)},e.mediaInteractionCb=(...l)=>{t.mediaInteaction&&t.mediaInteaction(...l),i(...l)},e.styleSheetRuleCb=(...l)=>{t.styleSheetRule&&t.styleSheetRule(...l),d(...l)},e.styleDeclarationCb=(...l)=>{t.styleDeclaration&&t.styleDeclaration(...l),p(...l)},e.canvasMutationCb=(...l)=>{t.canvasMutation&&t.canvasMutation(...l),u(...l)},e.fontCb=(...l)=>{t.font&&t.font(...l),f(...l)},e.selectionCb=(...l)=>{t.selection&&t.selection(...l),m(...l)},e.customElementCb=(...l)=>{t.customElement&&t.customElement(...l),h(...l)}}function wn(e,t={}){const r=e.doc.defaultView;if(!r)return()=>{};In(e,t);let n,s=()=>{};e.recordDOM&&([n,s]=Jt(e,e.doc));const o=hn(e),a=fn(e),c=Zt(e),i=pn(e,{win:r}),d=gn(e),p=bn(e);let u=()=>{},f=()=>{},m=()=>{},h=()=>{};e.recordDOM&&(u=yn(e,{win:r}),f=Qt(e,e.doc),m=Sn(e,{win:r}),e.collectFonts&&(h=Cn(e)));const l=Mn(e),S=vn(e),M=[];for(const C of e.plugins)M.push(C.observer(C.callback,r,C.options));return w(()=>{ae.forEach(C=>C.reset()),n==null||n.disconnect(),s(),o(),a(),c(),i(),d(),p(),u(),f(),m(),h(),l(),S(),M.forEach(C=>C())})}function Te(e,t){return typeof e[t]!="undefined"}function De(e,t){return!!(typeof e[t]!="undefined"&&e[t].prototype&&"insertRule"in e[t].prototype&&"deleteRule"in e[t].prototype)}class It{constructor(t){g(this,"iframeIdToRemoteIdMap",new WeakMap),g(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,n,s){const o=n||this.getIdToRemoteIdMap(t),a=s||this.getRemoteIdToIdMap(t);let c=o.get(r);return c||(c=this.generateIdFn(),o.set(r,c),a.set(c,r)),c}getIds(t,r){const n=this.getIdToRemoteIdMap(t),s=this.getRemoteIdToIdMap(t);return r.map(o=>this.getId(t,o,n,s))}getRemoteId(t,r,n){const s=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;const o=s.get(r);return o||-1}getRemoteIds(t,r){const n=this.getRemoteIdToIdMap(t);return r.map(s=>this.getRemoteId(t,s,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}}class Rn{constructor(t){g(this,"iframes",new WeakMap),g(this,"crossOriginIframeMap",new WeakMap),g(this,"crossOriginIframeMirror",new It(At)),g(this,"crossOriginIframeStyleMirror"),g(this,"crossOriginIframeRootIdMap",new WeakMap),g(this,"mirror"),g(this,"mutationCb"),g(this,"wrappedEmit"),g(this,"loadListener"),g(this,"stylesheetManager"),g(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new It(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&t.win.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,r){var n,s;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((n=t.contentWindow)==null||n.addEventListener("message",this.handleMessage.bind(this))),(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 s=this.crossOriginIframeMap.get(t.source);if(!s)return;const o=this.transformCrossOriginEvent(s,r.data.event);o&&this.wrappedEmit(o,r.data.isCheckout)}transformCrossOriginEvent(t,r){var n;switch(r.type){case O.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);const s=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,s),this.patchRootIdOnNode(r.data.node,s),{timestamp:r.timestamp,type:O.IncrementalSnapshot,data:{source:I.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case O.Meta:case O.Load:case O.DomContentLoaded:return!1;case O.Plugin:return r;case O.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case O.IncrementalSnapshot:switch(r.data.source){case I.Mutation:return r.data.adds.forEach(s=>{this.replaceIds(s,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(s.node,t);const o=this.crossOriginIframeRootIdMap.get(t);o&&this.patchRootIdOnNode(s.node,o)}),r.data.removes.forEach(s=>{this.replaceIds(s,t,["parentId","id"])}),r.data.attributes.forEach(s=>{this.replaceIds(s,t,["id"])}),r.data.texts.forEach(s=>{this.replaceIds(s,t,["id"])}),r;case I.Drag:case I.TouchMove:case I.MouseMove:return r.data.positions.forEach(s=>{this.replaceIds(s,t,["id"])}),r;case I.ViewportResize:return!1;case I.MediaInteraction:case I.MouseInteraction:case I.Scroll:case I.CanvasMutation:case I.Input:return this.replaceIds(r.data,t,["id"]),r;case I.StyleSheetRule:case I.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case I.Font:return r;case I.Selection:return r.data.ranges.forEach(s=>{this.replaceIds(s,t,["start","end"])}),r;case I.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(s=>{this.replaceStyleIds(s,t,["styleId"])}),r}}return!1}replace(t,r,n,s){for(const o of s)!Array.isArray(r[o])&&typeof r[o]!="number"||(Array.isArray(r[o])?r[o]=t.getIds(n,r[o]):r[o]=t.getId(n,r[o]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(t,r){t.type!==F.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}}class On{constructor(t){g(this,"shadowDoms",new WeakSet),g(this,"mutationCb"),g(this,"scrollCb"),g(this,"bypassOptions"),g(this,"mirror"),g(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(this.bypassOptions.win.Element,this.bypassOptions.win.document)}addShadowRoot(t,r){if(!Se(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);const[n]=Jt(Ne(P({},this.bypassOptions),{doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(Zt(Ne(P({},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(b.host(t))),this.restoreHandlers.push(Qt({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 n=this;this.restoreHandlers.push(le(t.prototype,"attachShadow",function(s){return function(o){const a=s.call(this,o),c=b.shadowRoot(this);return c&&Xt(this)&&n.addShadowRoot(c,r),a}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch(r){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}var pe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Nn=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(var xe=0;xe<pe.length;xe++)Nn[pe.charCodeAt(xe)]=xe;var En=function(e){var t=new Uint8Array(e),r,n=t.length,s="";for(r=0;r<n;r+=3)s+=pe[t[r]>>2],s+=pe[(t[r]&3)<<4|t[r+1]>>4],s+=pe[(t[r+1]&15)<<2|t[r+2]>>6],s+=pe[t[r+2]&63];return n%3===2?s=s.substring(0,s.length-1)+"=":n%3===1&&(s=s.substring(0,s.length-2)+"=="),s};const wt=new Map;function kn(e,t){let r=wt.get(e);return r||(r=new Map,wt.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}const Kt=(e,t,r)=>{if(!e||!(tr(e,t)||typeof e=="object"))return;const n=e.constructor.name,s=kn(r,n);let o=s.indexOf(e);return o===-1&&(o=s.length,s.push(e)),o};function Le(e,t,r){if(e instanceof Array)return e.map(n=>Le(n,t,r));if(e===null)return e;if(e instanceof t.Float32Array||e instanceof t.Float64Array||e instanceof t.Int32Array||e instanceof t.Uint32Array||e instanceof t.Uint8Array||e instanceof t.Uint16Array||e instanceof t.Int16Array||e instanceof t.Int8Array||e instanceof t.Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof t.ArrayBuffer){const n=e.constructor.name,s=En(e);return{rr_type:n,base64:s}}else{if(e instanceof t.DataView)return{rr_type:e.constructor.name,args:[Le(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof t.HTMLImageElement){const n=e.constructor.name,{src:s}=e;return{rr_type:n,src:s}}else if(e instanceof t.HTMLCanvasElement){const n="HTMLImageElement",s=e.toDataURL();return{rr_type:n,src:s}}else{if(e instanceof t.ImageData)return{rr_type:e.constructor.name,args:[Le(e.data,t,r),e.width,e.height]};if(tr(e,t)||typeof e=="object"){const n=e.constructor.name,s=Kt(e,t,r);return{rr_type:n,index:s}}}}return e}const er=(e,t,r)=>e.map(n=>Le(n,t,r)),tr=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(s=>typeof t[s]=="function").find(s=>e instanceof t[s]);function Tn(e,t,r,n){const s=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const a of o)try{if(typeof t.CanvasRenderingContext2D.prototype[a]!="function")continue;const c=le(t.CanvasRenderingContext2D.prototype,a,function(i){return function(...d){return H(this.canvas,r,n,!0)||setTimeout(()=>{const p=er(d,t,this);e(this.canvas,{type:me["2D"],property:a,args:p})},0),i.apply(this,d)}});s.push(c)}catch(c){const i=ze(t.CanvasRenderingContext2D.prototype,a,{set(d){e(this.canvas,{type:me["2D"],property:a,args:[d],setter:!0})}});s.push(i)}return()=>{s.forEach(a=>a())}}function Dn(e){return e==="experimental-webgl"?"webgl":e}function Rt(e,t,r,n){const s=[];try{const o=le(e.HTMLCanvasElement.prototype,"getContext",function(a){return function(c,...i){if(!H(this,t,r,!0)){const d=Dn(c);if("__context"in this||(this.__context=d),n&&["webgl","webgl2"].includes(d))if(i[0]&&typeof i[0]=="object"){const p=i[0];p.preserveDrawingBuffer||(p.preserveDrawingBuffer=!0)}else i.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[c,...i])}});s.push(o)}catch(o){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(o=>o())}}function Ot(e,t,r,n,s,o){const a=[],c=Object.getOwnPropertyNames(e);for(const i of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(i))try{if(typeof e[i]!="function")continue;const d=le(e,i,function(p){return function(...u){const f=p.apply(this,u);if(Kt(f,o,this),"tagName"in this.canvas&&!H(this.canvas,n,s,!0)){const m=er(u,o,this),h={type:t,property:i,args:m};r(this.canvas,h)}return f}});a.push(d)}catch(d){const p=ze(e,i,{set(u){r(this.canvas,{type:t,property:i,args:[u],setter:!0})}});a.push(p)}return a}function xn(e,t,r,n){const s=[];return typeof t.WebGLRenderingContext!="undefined"&&s.push(...Ot(t.WebGLRenderingContext.prototype,me.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext!="undefined"&&s.push(...Ot(t.WebGL2RenderingContext.prototype,me.WebGL2,e,r,n,t)),()=>{s.forEach(o=>o())}}const rr=`(function() {
17
+ "use strict";
18
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
19
+ var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
20
+ for (var i = 0; i < chars.length; i++) {
21
+ lookup[chars.charCodeAt(i)] = i;
22
+ }
23
+ var encode = function(arraybuffer) {
24
+ var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";
25
+ for (i2 = 0; i2 < len; i2 += 3) {
26
+ base64 += chars[bytes[i2] >> 2];
27
+ base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];
28
+ base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];
29
+ base64 += chars[bytes[i2 + 2] & 63];
30
+ }
31
+ if (len % 3 === 2) {
32
+ base64 = base64.substring(0, base64.length - 1) + "=";
33
+ } else if (len % 3 === 1) {
34
+ base64 = base64.substring(0, base64.length - 2) + "==";
35
+ }
36
+ return base64;
37
+ };
38
+ const lastBlobMap = /* @__PURE__ */ new Map();
39
+ const transparentBlobMap = /* @__PURE__ */ new Map();
40
+ async function getTransparentBlobFor(width, height, dataURLOptions) {
41
+ const id = \`\${width}-\${height}\`;
42
+ if ("OffscreenCanvas" in globalThis) {
43
+ if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);
44
+ const offscreen = new OffscreenCanvas(width, height);
45
+ offscreen.getContext("2d");
46
+ const blob = await offscreen.convertToBlob(dataURLOptions);
47
+ const arrayBuffer = await blob.arrayBuffer();
48
+ const base64 = encode(arrayBuffer);
49
+ transparentBlobMap.set(id, base64);
50
+ return base64;
51
+ } else {
52
+ return "";
53
+ }
54
+ }
55
+ const worker = self;
56
+ worker.onmessage = async function(e) {
57
+ if ("OffscreenCanvas" in globalThis) {
58
+ const { id, bitmap, width, height, dataURLOptions } = e.data;
59
+ const transparentBase64 = getTransparentBlobFor(
60
+ width,
61
+ height,
62
+ dataURLOptions
63
+ );
64
+ const offscreen = new OffscreenCanvas(width, height);
65
+ const ctx = offscreen.getContext("2d");
66
+ ctx.drawImage(bitmap, 0, 0);
67
+ bitmap.close();
68
+ const blob = await offscreen.convertToBlob(dataURLOptions);
69
+ const type = blob.type;
70
+ const arrayBuffer = await blob.arrayBuffer();
71
+ const base64 = encode(arrayBuffer);
72
+ if (!lastBlobMap.has(id) && await transparentBase64 === base64) {
73
+ lastBlobMap.set(id, base64);
74
+ return worker.postMessage({ id });
75
+ }
76
+ if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });
77
+ worker.postMessage({
78
+ id,
79
+ type,
80
+ base64,
81
+ width,
82
+ height
83
+ });
84
+ lastBlobMap.set(id, base64);
85
+ } else {
86
+ return worker.postMessage({ id: e.data.id });
87
+ }
88
+ };
89
+ })();
90
+ //# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map
91
+ `,Nt=typeof self!="undefined"&&self.Blob&&new Blob([rr],{type:"text/javascript;charset=utf-8"});function Ln(e){let t;try{if(t=Nt&&(self.URL||self.webkitURL).createObjectURL(Nt),!t)throw"";const r=new Worker(t,{name:e==null?void 0:e.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch(r){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(rr),{name:e==null?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}class _n{constructor(t){g(this,"pendingCanvasMutations",new Map),g(this,"rafStamps",{latestId:0,invokeId:null}),g(this,"mirror"),g(this,"mutationCb"),g(this,"resetObservers"),g(this,"frozen",!1),g(this,"locked",!1),g(this,"win"),g(this,"processMutation",(i,d)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(i)||this.pendingCanvasMutations.set(i,[]),this.pendingCanvasMutations.get(i).push(d)});const{sampling:r="all",win:n,blockClass:s,blockSelector:o,recordCanvas:a,dataURLOptions:c}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,this.win=n,a&&r==="all"&&this.initCanvasMutationObserver(n,s,o),a&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,s,o,{dataURLOptions:c})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,r,n,s,o){const a=Rt(r,n,s,!0),c=new Map,i=new Ln;i.onmessage=h=>{const{id:l}=h.data;if(c.set(l,!1),!("base64"in h.data))return;const{base64:S,type:M,width:C,height:y}=h.data;this.mutationCb({id:l,type:me["2D"],commands:[{property:"clearRect",args:[0,0,C,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:S}],type:M}]},0,0]}]})};const d=1e3/t;let p=0,u;const f=()=>{const h=[];return r.document.querySelectorAll("canvas").forEach(l=>{H(l,n,s,!0)||h.push(l)}),h},m=h=>{if(p&&h-p<d){u=ee(r,m);return}p=h,f().forEach(async l=>{var S;const M=this.mirror.getId(l);if(c.get(M)||l.width===0||l.height===0)return;if(c.set(M,!0),["webgl","webgl2"].includes(l.__context)){const y=l.getContext(l.__context);((S=y==null?void 0:y.getContextAttributes())==null?void 0:S.preserveDrawingBuffer)===!1&&y.clear(y.COLOR_BUFFER_BIT)}const C=await createImageBitmap(l);i.postMessage({id:M,bitmap:C,width:l.width,height:l.height,dataURLOptions:o.dataURLOptions},[C])}),u=ee(r,m)};u=ee(r,m),this.resetObservers=()=>{a(),r.cancelAnimationFrame(u)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const s=Rt(t,r,n,!1),o=Tn(this.processMutation.bind(this),t,r,n),a=xn(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{s(),o(),a()}}startPendingCanvasMutationFlusher(){ee(this.win,()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=r=>{this.rafStamps.latestId=r,ee(this.win,t)};ee(this.win,t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{const n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),ee(this.win,()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;const s=n.map(a=>{const d=a,{type:c}=d;return ht(d,["type"])}),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:s}),this.pendingCanvasMutations.delete(t)}}class An{constructor(t){g(this,"trackedLinkElements",new WeakSet),g(this,"mutationCb"),g(this,"adoptedStyleSheetCb"),g(this,"styleMirror",new sn),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;const n={id:r,styleIds:[]},s=[];for(const o of t){let a;this.styleMirror.has(o)?a=this.styleMirror.getId(o):(a=this.styleMirror.add(o),s.push({styleId:a,rules:Array.from(o.rules||CSSRule,(c,i)=>({rule:xt(c,o.href),index:i}))})),n.styleIds.push(a)}s.length>0&&(n.styles=s),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}class Fn{constructor(t){g(this,"nodeMap",new WeakMap),g(this,"active",!1),this.win=t}inOtherBuffer(t,r){const n=this.nodeMap.get(t);return n&&Array.from(n).some(s=>s!==r)}add(t,r){this.active||(this.active=!0,ee(this.win,()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}destroy(){}}let A,_e,Ze,He=!1;try{if(Array.from([1],e=>e*2)[0]!==2){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=((ft=e.contentWindow)==null?void 0:ft.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}const J=Dr();function Ie(e={}){const{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:s="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:c=null,maskTextClass:i="rr-mask",maskTextSelector:d=null,inlineStylesheet:p=!0,maskAllInputs:u,maskInputOptions:f,slimDOMOptions:m,maskInputFn:h,maskTextFn:l,hooks:S,packFn:M,sampling:C={},dataURLOptions:y={},mousemoveWait:v,recordDOM:D=!0,recordCanvas:x=!1,recordCrossOriginIframes:U=!1,recordAfter:Z=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:V=!1,collectFonts:X=!1,inlineImages:$=!1,win:ne=window,plugins:R,keepIframeSrcFn:se=()=>!1,ignoreCSSAttributes:ge=new Set([]),errorHandler:W}=e,N=ne;un(W);const K=U?N.parent===N:!0;let q=!1;if(!K)try{N.parent.document&&(q=!1)}catch(E){q=!0}if(K&&!t)throw new Error("emit function is required");if(!K&&!q)return()=>{};v!==void 0&&C.mousemove===void 0&&(C.mousemove=v),J.reset();const Ge=u===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:f!==void 0?f:{password:!0},je=Ut(m);nn(N);let ot,Ve=0;const it=E=>{for(const Y of R||[])Y.eventProcessor&&(E=Y.eventProcessor(E));return M&&!q&&(E=M(E)),E};A=(E,Y)=>{var L;const _=E;if(_.timestamp=Ce(),(L=ae[0])!=null&&L.isFrozen()&&_.type!==O.FullSnapshot&&!(_.type===O.IncrementalSnapshot&&_.data.source===I.Mutation)&&ae.forEach(G=>G.unfreeze()),K)t==null||t(it(_),Y);else if(q){const G={type:"rrweb",event:it(_),origin:N.location.origin,isCheckout:Y};N.parent.postMessage(G,"*")}if(_.type===O.FullSnapshot)ot=_,Ve=0;else if(_.type===O.IncrementalSnapshot){if(_.data.source===I.Mutation&&_.data.isAttachIframe)return;Ve++;const G=n&&Ve>=n,k=r&&_.timestamp-ot.timestamp>r;(G||k)&&_e(!0)}};const we=E=>{A({type:O.IncrementalSnapshot,data:P({source:I.Mutation},E)})},at=E=>A({type:O.IncrementalSnapshot,data:P({source:I.Scroll},E)}),lt=E=>A({type:O.IncrementalSnapshot,data:P({source:I.CanvasMutation},E)}),nr=E=>A({type:O.IncrementalSnapshot,data:P({source:I.AdoptedStyleSheet},E)}),oe=new An({mutationCb:we,adoptedStyleSheetCb:nr}),ie=new Rn({win:N,mirror:J,mutationCb:we,stylesheetManager:oe,recordCrossOriginIframes:U,wrappedEmit:A});for(const E of R||[])E.getMirror&&E.getMirror({nodeMirror:J,crossOriginIframeMirror:ie.crossOriginIframeMirror,crossOriginIframeStyleMirror:ie.crossOriginIframeStyleMirror});const $e=new Fn(N);Ze=new _n({recordCanvas:x,mutationCb:lt,win:N,blockClass:s,blockSelector:o,mirror:J,sampling:C.canvas,dataURLOptions:y});const Re=new On({mutationCb:we,scrollCb:at,bypassOptions:{win:N,blockClass:s,blockSelector:o,maskTextClass:i,maskTextSelector:d,inlineStylesheet:p,maskInputOptions:Ge,dataURLOptions:y,maskTextFn:l,maskInputFn:h,recordCanvas:x,inlineImages:$,sampling:C,slimDOMOptions:je,iframeManager:ie,stylesheetManager:oe,canvasManager:Ze,keepIframeSrcFn:se,processedNodeManager:$e},mirror:J});_e=(E=!1)=>{if(!D)return;A({type:O.Meta,data:{href:N.location.href,width:zt(N),height:Ht(N)}},E),oe.reset(),Re.init(),ae.forEach(L=>L.lock());const Y=tn(N.document,{mirror:J,blockClass:s,blockSelector:o,maskTextClass:i,maskTextSelector:d,inlineStylesheet:p,maskAllInputs:Ge,maskTextFn:l,maskInputFn:h,slimDOM:je,dataURLOptions:y,recordCanvas:x,inlineImages:$,onSerialize:L=>{Vt(L,J)&&ie.addIframe(L),$t(L,J)&&oe.trackLinkElement(L),et(L)&&Re.addShadowRoot(b.shadowRoot(L),N.document)},onIframeLoad:(L,_)=>{ie.attachIframe(L,_),Re.observeAttachShadow(L)},onStylesheetLoad:(L,_)=>{oe.attachLinkElement(L,_)},keepIframeSrcFn:se});if(!Y)return console.warn("Failed to snapshot the document");A({type:O.FullSnapshot,data:{node:Y,initialOffset:Bt(N)}},E),ae.forEach(L=>L.unlock()),N.document.adoptedStyleSheets&&N.document.adoptedStyleSheets.length>0&&oe.adoptStyleSheets(N.document.adoptedStyleSheets,J.getId(N.document))};try{const E=[],Y=_=>{var G;return w(wn)({mutationCb:we,mousemoveCb:(k,qe)=>A({type:O.IncrementalSnapshot,data:{source:qe,positions:k}}),mouseInteractionCb:k=>A({type:O.IncrementalSnapshot,data:P({source:I.MouseInteraction},k)}),scrollCb:at,viewportResizeCb:k=>A({type:O.IncrementalSnapshot,data:P({source:I.ViewportResize},k)}),inputCb:k=>A({type:O.IncrementalSnapshot,data:P({source:I.Input},k)}),mediaInteractionCb:k=>A({type:O.IncrementalSnapshot,data:P({source:I.MediaInteraction},k)}),styleSheetRuleCb:k=>A({type:O.IncrementalSnapshot,data:P({source:I.StyleSheetRule},k)}),styleDeclarationCb:k=>A({type:O.IncrementalSnapshot,data:P({source:I.StyleDeclaration},k)}),canvasMutationCb:lt,fontCb:k=>A({type:O.IncrementalSnapshot,data:P({source:I.Font},k)}),selectionCb:k=>{A({type:O.IncrementalSnapshot,data:P({source:I.Selection},k)})},customElementCb:k=>{A({type:O.IncrementalSnapshot,data:P({source:I.CustomElement},k)})},blockClass:s,ignoreClass:a,ignoreSelector:c,maskTextClass:i,maskTextSelector:d,maskInputOptions:Ge,inlineStylesheet:p,sampling:C,recordDOM:D,recordCanvas:x,inlineImages:$,userTriggeredOnInput:V,collectFonts:X,win:N,doc:_,maskInputFn:h,maskTextFn:l,keepIframeSrcFn:se,blockSelector:o,slimDOMOptions:je,dataURLOptions:y,mirror:J,iframeManager:ie,stylesheetManager:oe,shadowDomManager:Re,processedNodeManager:$e,canvasManager:Ze,ignoreCSSAttributes:ge,plugins:((G=R==null?void 0:R.filter(k=>k.observer))==null?void 0:G.map(k=>({observer:k.observer,options:k.options,callback:qe=>A({type:O.Plugin,data:{plugin:k.name,payload:qe}})})))||[]},S)};ie.addLoadListener(_=>{try{E.push(Y(_.contentDocument))}catch(G){console.warn(G)}});const L=()=>{_e(),E.push(Y(N.document)),He=!0};return["interactive","complete"].includes(N.document.readyState)?L():(E.push(B("DOMContentLoaded",()=>{A({type:O.DomContentLoaded,data:{}}),Z==="DOMContentLoaded"&&L()},N.document)),E.push(B("load",()=>{A({type:O.Load,data:{}}),Z==="load"&&L()},N))),()=>{E.forEach(_=>{try{_()}catch(G){String(G).toLowerCase().includes("cross-origin")||console.warn(G)}}),$e.destroy(),He=!1,dn()}}catch(E){console.warn(E)}}Ie.addCustomEvent=(e,t)=>{if(!He)throw new Error("please add custom event after start recording");A({type:O.Custom,data:{tag:e,payload:t}})};Ie.freezePage=()=>{ae.forEach(e=>e.freeze())};Ie.takeFullSnapshot=e=>{if(!He)throw new Error("please take full snapshot after start recording");_e(e)};Ie.mirror=J;exports.record=Ie;
92
+ if (typeof module.exports == "object" && typeof exports == "object") {
93
+ var __cp = (to, from, except, desc) => {
94
+ if ((from && typeof from === "object") || typeof from === "function") {
95
+ for (let key of Object.getOwnPropertyNames(from)) {
96
+ if (!Object.prototype.hasOwnProperty.call(to, key) && key !== except)
97
+ Object.defineProperty(to, key, {
98
+ get: () => from[key],
99
+ enumerable: !(desc = Object.getOwnPropertyDescriptor(from, key)) || desc.enumerable,
100
+ });
101
+ }
102
+ }
103
+ return to;
104
+ };
105
+ module.exports = __cp(module.exports, exports);
106
+ }
107
+ return module.exports;
108
+ }))
109
+ //# sourceMappingURL=rrweb-record.umd.min.cjs.map
package/package.json CHANGED
@@ -1,46 +1,50 @@
1
1
  {
2
2
  "name": "@screeb/rrweb",
3
- "version": "1.0.20",
3
+ "version": "2.1.6-screeb.1",
4
4
  "description": "record and replay the web",
5
5
  "scripts": {
6
- "retest": "vitest run --exclude test/benchmark",
6
+ "prepare": "npm run prepack",
7
+ "prepack": "npm run build",
8
+ "retest": "cross-env PUPPETEER_HEADLESS=true yarn retest:headful",
9
+ "retest:headful": "vitest run --exclude test/benchmark",
7
10
  "build-and-test": "yarn build && yarn retest",
8
- "test:headless": "PUPPETEER_HEADLESS=true yarn build-and-test",
9
- "test:headful": "PUPPETEER_HEADLESS=false yarn build-and-test",
11
+ "test:headless": "cross-env PUPPETEER_HEADLESS=true yarn build-and-test",
12
+ "test:headful": "cross-env PUPPETEER_HEADLESS=false yarn build-and-test",
10
13
  "test": "yarn test:headless",
11
- "test:watch": "yarn build && PUPPETEER_HEADLESS=true yarn vitest --exclude test/benchmark",
14
+ "test:watch": "yarn build && cross-env PUPPETEER_HEADLESS=true yarn vitest --exclude test/benchmark",
12
15
  "test:update": "yarn test:headless --update",
13
- "retest:update": "PUPPETEER_HEADLESS=true yarn retest --update",
16
+ "retest:update": "cross-env PUPPETEER_HEADLESS=true yarn retest --update",
14
17
  "repl": "yarn build && node scripts/repl.js",
15
- "live-stream": "yarn build && node scripts/stream.js",
18
+ "live-stream": "yarn turbo run prepublish --filter=rrweb --filter=@rrweb/rrweb-plugin-canvas-webrtc-record --filter=@rrweb/rrweb-plugin-canvas-webrtc-replay && node scripts/stream.js",
16
19
  "dev": "vite build --watch",
17
- "build": "yarn run check-types && vite build",
18
- "build:tarball": "npm pack",
19
- "typings:downlevel": "downlevel-dts dist dist/ts3.8 --to ts3.8",
20
- "check-types": "tsc --noEmit",
21
- "prepack": "yarn run build && yarn run typings:downlevel",
20
+ "build": "yarn turbo run prepublish",
21
+ "check-types": "tsc -noEmit",
22
+ "prepublish": "tsc -noEmit && vite build && vite build --config vite.config.entries.js",
22
23
  "lint": "yarn eslint src",
23
- "benchmark": "vitest run --maxConcurrency 1 --no-file-parallelism test/benchmark"
24
+ "benchmark": "vitest run --maxConcurrency 1 --no-file-parallelism test/benchmark",
25
+ "benchmark:mutation": "vitest run --maxConcurrency 1 --no-file-parallelism test/benchmark/dom-mutation.test.ts",
26
+ "benchmark:mutation:firefox": "cross-env BROWSER=firefox yarn benchmark:mutation",
27
+ "benchmark:mutation:webkit": "cross-env BROWSER=webkit yarn benchmark:mutation",
28
+ "test:webkit": "yarn build && vitest run --config vitest.config.webkit.ts"
24
29
  },
25
30
  "type": "module",
26
31
  "repository": {
27
32
  "type": "git",
28
- "url": "git+ssh://git@github.com/rrweb-io/rrweb.git"
33
+ "url": "git+ssh://git@github.com/rrweb-io/rrweb.git",
34
+ "directory": "packages/rrweb"
29
35
  },
30
36
  "keywords": [
37
+ "devtools",
38
+ "product-analytics",
39
+ "real-user-monitoring",
31
40
  "rrweb"
32
41
  ],
33
42
  "main": "./dist/rrweb.umd.cjs",
34
43
  "module": "./dist/rrweb.js",
35
44
  "unpkg": "./dist/rrweb.umd.cjs",
45
+ "jsdelivr": "./umd/rrweb.js",
46
+ "style": "./dist/style.css",
36
47
  "typings": "dist/rrweb.d.ts",
37
- "typesVersions": {
38
- "<3.9": {
39
- "dist/rrweb.d.ts": [
40
- "dist/ts3.8/rrweb.d.ts"
41
- ]
42
- }
43
- },
44
48
  "exports": {
45
49
  ".": {
46
50
  "import": {
@@ -52,50 +56,59 @@
52
56
  "default": "./dist/rrweb.cjs"
53
57
  }
54
58
  },
59
+ "./record": {
60
+ "import": {
61
+ "types": "./dist/rrweb.d.ts",
62
+ "default": "./dist/entries/rrweb-record.js"
63
+ },
64
+ "require": {
65
+ "types": "./dist/rrweb.d.cts",
66
+ "default": "./dist/entries/rrweb-record.cjs"
67
+ }
68
+ },
55
69
  "./dist/style.css": "./dist/style.css"
56
70
  },
57
71
  "files": [
72
+ "umd",
58
73
  "dist",
59
74
  "package.json"
60
75
  ],
61
76
  "sideEffects": false,
62
- "author": "yanzhen@smartx.com",
77
+ "author": "rrweb Core Team <maintainers@rrweb.com>",
63
78
  "license": "MIT",
64
79
  "bugs": {
65
80
  "url": "https://github.com/rrweb-io/rrweb/issues"
66
81
  },
67
82
  "homepage": "https://github.com/rrweb-io/rrweb#readme",
68
83
  "devDependencies": {
69
- "@sentry-internal/rrweb-worker": "2.39.0",
70
84
  "@types/dom-mediacapture-transform": "0.1.4",
71
85
  "@types/inquirer": "^8.2.1",
72
86
  "@types/jest-image-snapshot": "^6.1.0",
73
87
  "@types/node": "^18.15.11",
74
88
  "@types/offscreencanvas": "^2019.6.4",
75
89
  "construct-style-sheets-polyfill": "^3.1.0",
76
- "cross-env": "^5.2.0",
77
- "downlevel-dts": "https://github.com/getsentry/downlevel-dts",
78
90
  "fast-mhtml": "^1.1.9",
79
91
  "identity-obj-proxy": "^3.0.0",
80
92
  "ignore-styles": "^5.0.1",
81
93
  "inquirer": "^9.0.0",
82
94
  "jest-image-snapshot": "^6.2.0",
95
+ "playwright": "1.61.1",
83
96
  "puppeteer": "^20.9.0",
84
97
  "simple-peer-light": "^9.10.0",
85
98
  "ts-node": "^10.9.1",
86
99
  "tslib": "^2.3.1",
87
- "typescript": "^4.7.3",
88
- "vite": "^5.2.8",
89
- "vite-plugin-dts": "^3.8.1"
100
+ "typescript": "^5.4.5",
101
+ "vite": "^6.0.1",
102
+ "vite-plugin-dts": "^3.9.1"
90
103
  },
91
104
  "dependencies": {
92
- "@sentry-internal/rrdom": "2.39.0",
93
- "@sentry-internal/rrweb-snapshot": "2.39.0",
94
- "@sentry-internal/rrweb-types": "2.39.0",
105
+ "@rrweb/types": "^2.1.6",
106
+ "@rrweb/utils": "^2.1.6",
95
107
  "@types/css-font-loading-module": "0.0.7",
96
108
  "@xstate/fsm": "^1.4.0",
97
109
  "base64-arraybuffer": "^1.0.1",
98
- "fflate": "^0.4.4",
99
- "mitt": "^3.0.0"
110
+ "mitt": "^3.0.0",
111
+ "rrdom": "^2.1.6",
112
+ "rrweb-snapshot": "^2.1.6"
100
113
  }
101
114
  }