@highlight-run/rrweb 2.0.0-lambda.2 → 2.0.0-lambda.3

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.
@@ -1,4 +1,16 @@
1
- (function (g, f) {if ("object" == typeof exports && "object" == typeof module) {module.exports = f();} else if ("function" == typeof define && define.amd) {define("rrweb", [], f);} else if ("object" == typeof exports) {exports["rrweb"] = f();} else {g["rrweb"] = f();}}(typeof self !== 'undefined' ? self : typeof globalThis !== 'undefined' ? globalThis : this, () => {var exports = {};var module = { exports };
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 };
2
14
  "use strict";var yl=Object.defineProperty,wl=Object.defineProperties;var bl=Object.getOwnPropertyDescriptors;var zt=Object.getOwnPropertySymbols;var Hi=Object.prototype.hasOwnProperty,Zi=Object.prototype.propertyIsEnumerable;var Yi=(s,e,t)=>e in s?yl(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,O=(s,e)=>{for(var t in e||(e={}))Hi.call(e,t)&&Yi(s,t,e[t]);if(zt)for(var t of zt(e))Zi.call(e,t)&&Yi(s,t,e[t]);return s},te=(s,e)=>wl(s,bl(e));var Ve=(s,e)=>{var t={};for(var r in s)Hi.call(s,r)&&e.indexOf(r)<0&&(t[r]=s[r]);if(s!=null&&zt)for(var r of zt(s))e.indexOf(r)<0&&Zi.call(s,r)&&(t[r]=s[r]);return t};var vl=Object.defineProperty,Sl=(s,e,t)=>e in s?vl(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,w=(s,e,t)=>Sl(s,typeof e!="symbol"?e+"":e,t),Xi;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Cl=Object.defineProperty,Il=(s,e,t)=>e in s?Cl(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Ji=(s,e,t)=>Il(s,typeof e!="symbol"?e+"":e,t),L=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))(L||{});const Ki={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Qi={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Vt={},El=()=>!!globalThis.Zone;function ei(s){if(Vt[s])return Vt[s];const e=globalThis[s],t=e.prototype,r=s in Ki?Ki[s]:void 0,i=!!(r&&r.every(l=>{var a,c;return!!((c=(a=Object.getOwnPropertyDescriptor(t,l))==null?void 0:a.get)!=null&&c.toString().includes("[native code]"))})),n=s in Qi?Qi[s]:void 0,o=!!(n&&n.every(l=>{var a;return typeof t[l]=="function"&&((a=t[l])==null?void 0:a.toString().includes("[native code]"))}));if(i&&o&&!El())return Vt[s]=e.prototype,e.prototype;try{const l=document.createElement("iframe");document.body.appendChild(l);const a=l.contentWindow;if(!a)return e.prototype;const c=a[s].prototype;return document.body.removeChild(l),c?Vt[s]=c:t}catch(l){return t}}const ts={};function De(s,e,t){var r;const i=`${s}.${String(t)}`;if(ts[i])return ts[i].call(e);const n=ei(s),o=(r=Object.getOwnPropertyDescriptor(n,t))==null?void 0:r.get;return o?(ts[i]=o,o.call(e)):e[t]}const rs={};function co(s,e,t){const r=`${s}.${String(t)}`;if(rs[r])return rs[r].bind(e);const n=ei(s)[t];return typeof n!="function"?e[t]:(rs[r]=n,n.bind(e))}function xl(s){return De("Node",s,"childNodes")}function Ml(s){return De("Node",s,"parentNode")}function Rl(s){return De("Node",s,"parentElement")}function Nl(s){return De("Node",s,"textContent")}function Al(s,e){return co("Node",s,"contains")(e)}function Ol(s){return co("Node",s,"getRootNode")()}function Tl(s){return!s||!("host"in s)?null:De("ShadowRoot",s,"host")}function Dl(s){return s.styleSheets}function _l(s){return!s||!("shadowRoot"in s)?null:De("Element",s,"shadowRoot")}function kl(s,e){return De("Element",s,"querySelector")(e)}function Ll(s,e){return De("Element",s,"querySelectorAll")(e)}function Pl(){return ei("MutationObserver").constructor}function $l(s,e,t){try{if(!(e in s))return()=>{};const r=s[e],i=t(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),s[e]=i,()=>{s[e]=r}}catch(r){return()=>{}}}const ne={childNodes:xl,parentNode:Ml,parentElement:Rl,textContent:Nl,contains:Al,getRootNode:Ol,host:Tl,styleSheets:Dl,shadowRoot:_l,querySelector:kl,querySelectorAll:Ll,mutationObserver:Pl,patch:$l};function ti(s){return s.nodeType===s.ELEMENT_NODE}function yt(s){const e=s&&"host"in s&&"mode"in s&&ne.host(s)||null;return!!(e&&"shadowRoot"in e&&ne.shadowRoot(e)===s)}function wt(s){return Object.prototype.toString.call(s)==="[object ShadowRoot]"}function Fl(s){return s.includes(" background-clip: text;")&&!s.includes(" -webkit-background-clip: text;")&&(s=s.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),s}function Bl(s){const{cssText:e}=s;if(e.split('"').length<3)return e;const t=["@import",`url(${JSON.stringify(s.href)})`];return s.layerName===""?t.push("layer"):s.layerName&&t.push(`layer(${s.layerName})`),s.supportsText&&t.push(`supports(${s.supportsText})`),s.media.length&&t.push(s.media.mediaText),t.join(" ")+";"}function ys(s){try{const e=s.rules||s.cssRules;if(!e)return null;let t=s.href;!t&&s.ownerNode&&s.ownerNode.ownerDocument&&(t=s.ownerNode.ownerDocument.location.href);const r=Array.from(e,i=>uo(i,t)).join("");return Fl(r)}catch(e){return null}}function uo(s,e){if(Wl(s)){let t;try{t=ys(s.styleSheet)||Bl(s)}catch(r){t=s.cssText}return s.styleSheet.href?Sr(t,s.styleSheet.href):t}else{let t=s.cssText;return zl(s)&&s.selectorText.includes(":")&&(t=Ul(t)),e?Sr(t,e):t}}function Ul(s){const e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return s.replace(e,"$1\\$2")}function Wl(s){return"styleSheet"in s}function zl(s){return"selectorText"in s}class ri{constructor(){Ji(this,"idNodeMap",new Map),Ji(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;const r=(t=this.getMeta(e))==null?void 0:t.id;return r!=null?r:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)}replace(e,t){const r=this.getNode(e);if(r){const i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(t,i)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function ho(){return new ri}function br({element:s,maskInputOptions:e,tagName:t,type:r,value:i,overwriteRecord:n,maskInputFn:o}){let l=i||"";return po({maskInputOptions:e,tagName:t,type:r,overwriteRecord:n})&&(o?l=o(l,s):l="*".repeat(l.length)),l}function Be(s){return s.toLowerCase()}const qi="__rrweb_original__";function Vl(s){const e=s.getContext("2d");if(!e)return!0;const t=50;for(let r=0;r<s.width;r+=t)for(let i=0;i<s.height;i+=t){const n=e.getImageData,o=qi in n?n[qi]:n;if(new Uint32Array(o.call(e,r,i,Math.min(t,s.width-r),Math.min(t,s.height-i)).data.buffer).some(a=>a!==0))return!1}return!0}function Gl(s,e){return!s||!e||s.type!==e.type?!1:s.type===L.Document?s.compatMode===e.compatMode:s.type===L.DocumentType?s.name===e.name&&s.publicId===e.publicId&&s.systemId===e.systemId:s.type===L.Comment||s.type===L.Text||s.type===L.CDATA?s.textContent===e.textContent:s.type===L.Element?s.tagName===e.tagName&&JSON.stringify(s.attributes)===JSON.stringify(e.attributes)&&s.isSVG===e.isSVG&&s.needBlock===e.needBlock:!1}function vr(s){const e=s.type;return s.hasAttribute("data-rr-is-password")?"password":e?Be(e):null}function si(s,e){var n;let t;try{t=new URL(s,e!=null?e:window.location.href)}catch(o){return null}const r=/\.([0-9a-z]+)(?:$)/i,i=t.pathname.match(r);return(n=i==null?void 0:i[1])!=null?n:null}function jl(s){let e="";return s.indexOf("//")>-1?e=s.split("/").slice(0,3).join("/"):e=s.split("/")[0],e=e.split("?")[0],e}const Yl=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Hl=/^(?:[a-z+]+:)?\/\//i,Zl=/^www\..*/i,Xl=/^(data:)([^,]*),(.*)/i;function Sr(s,e){return(s||"").replace(Yl,(t,r,i,n,o,l)=>{const a=i||o||l,c=r||n||"";if(!a)return t;if(Hl.test(a)||Zl.test(a))return`url(${c}${a}${c})`;if(Xl.test(a))return`url(${c}${a}${c})`;if(a[0]==="/")return`url(${c}${jl(e)+a}${c})`;const u=e.split("/"),h=a.split("/");u.pop();for(const f of h)f!=="."&&(f===".."?u.pop():u.push(f));return`url(${c}${u.join("/")}${c})`})}function Gt(s,e=!1){return e?s.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):s.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function Jl(s,e,t=!1){const r=Array.from(e.childNodes),i=[];let n=0;if(r.length>1&&s&&typeof s=="string"){let o=Gt(s,t);const l=o.length/s.length;for(let a=1;a<r.length;a++)if(r[a].textContent&&typeof r[a].textContent=="string"){const c=Gt(r[a].textContent,t),u=100;let h=3;for(;h<c.length&&(c[h].match(/[a-zA-Z0-9]/)||c.indexOf(c.substring(0,h),1)!==-1);h++);for(;h<c.length;h++){let f=c.substring(0,h),d=o.split(f),m=-1;if(d.length===2)m=d[0].length;else if(d.length>2&&d[0]===""&&r[a-1].textContent!=="")m=o.indexOf(f,1);else if(d.length===1){if(f=f.substring(0,f.length-1),d=o.split(f),d.length<=1)return i.push(s),i;h=u+1}else h===c.length-1&&(m=o.indexOf(f));if(d.length>=2&&h>u){const g=r[a-1].textContent;if(g&&typeof g=="string"){const p=Gt(g).length;m=o.indexOf(f,p)}m===-1&&(m=d[0].length)}if(m!==-1){let g=Math.floor(m/l);for(;g>0&&g<s.length;){if(n+=1,n>50*r.length)return i.push(s),i;const p=Gt(s.substring(0,g),t);if(p.length===m){i.push(s.substring(0,g)),s=s.substring(g),o=o.substring(m);break}else p.length<m?g+=Math.max(1,Math.floor((m-p.length)/l)):g-=Math.max(1,Math.floor((p.length-m)*l))}break}}}}return i.push(s),i}function Kl(s,e){return Jl(s,e).join("/* rr_split */")}function ii(s){return s=s.replace(/[^ -~]+/g,""),s=(s==null?void 0:s.split(" ").map(e=>Math.random().toString(20).substring(2,e.length)).join(" "))||"",s}function ws(s){return s==="img"||s==="video"||s==="audio"||s==="source"}const Ql=new RegExp(/[a-zA-Z0-9.!#$%&'*+=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*/),ql=new RegExp(/[0-9]{9,16}/),ec=new RegExp(/[0-9]{3}-?[0-9]{2}-?[0-9]{4}/),tc=new RegExp(/[+]?[(]?[0-9]{3}[)]?[-\s.]?[0-9]{3}[-\s.]?[0-9]{4,6}/),rc=new RegExp(/[0-9]{4}-?[0-9]{4}-?[0-9]{4}-?[0-9]{4}/),sc=new RegExp(/[0-9]{1,5}.?[0-9]{0,3}\s[a-zA-Z]{2,30}\s[a-zA-Z]{2,15}/),ic=new RegExp(/(?:[0-9]{1,3}.){3}[0-9]{1,3}/),nc=[Ql,ql,ec,tc,rc,sc,ic];function fo(s){return s?nc.some(e=>e.test(s)):!1}const po=({maskInputOptions:s,tagName:e,type:t,overwriteRecord:r})=>{const i=t&&t.toLowerCase();return r!=="true"&&(!!s[e.toLowerCase()]||!!(i&&s[i]))};let oc=1;const ac=new RegExp("[^a-z0-9-_:]"),Ct=-2;function mo(){return oc++}function lc(s){if(s instanceof HTMLFormElement)return"form";const e=Be(s.tagName);return ac.test(e)?"div":e}let Ge,en;const cc=/^[^ \t\n\r\u000c]+/,uc=/^[, \t\n\r\u000c]+/;function hc(s,e){if(e.trim()==="")return e;let t=0;function r(n){let o;const l=n.exec(e.substring(t));return l?(o=l[0],t+=o.length,o):""}const i=[];for(;r(uc),!(t>=e.length);){let n=r(cc);if(n.slice(-1)===",")n=He(s,n.substring(0,n.length-1)),i.push(n);else{let o="";n=He(s,n);let l=!1;for(;;){const a=e.charAt(t);if(a===""){i.push((n+o).trim());break}else if(l)a===")"&&(l=!1);else if(a===","){t+=1,i.push((n+o).trim());break}else a==="("&&(l=!0);o+=a,t+=1}}}return i.join(", ")}const tn=new WeakMap;function He(s,e){return!e||e.trim()===""?e:ni(s,e)}function fc(s){return!!(s.tagName==="svg"||s.ownerSVGElement)}function ni(s,e){let t=tn.get(s);if(t||(t=s.createElement("a"),tn.set(s,t)),!e)e="";else if(e.startsWith("blob:")||e.startsWith("data:"))return e;return t.setAttribute("href",e),t.href}function go(s,e,t,r){return r&&(t==="src"||t==="href"&&!(e==="use"&&r[0]==="#")||t==="xlink:href"&&r[0]!=="#"||t==="background"&&(e==="table"||e==="td"||e==="th")?He(s,r):t==="srcset"?hc(s,r):t==="style"?Sr(r,ni(s)):e==="object"&&t==="data"?He(s,r):r)}function yo(s,e,t){return(s==="video"||s==="audio")&&e==="autoplay"}function rn(s,e,t){try{if(typeof e=="string"){if(s.classList.contains(e))return!0}else for(let r=s.classList.length;r--;){const i=s.classList[r];if(e.test(i))return!0}if(t)return s.matches(t)}catch(r){}return!1}function Cr(s,e,t){if(!s)return!1;if(s.nodeType!==s.ELEMENT_NODE)return t?Cr(ne.parentNode(s),e,t):!1;for(let r=s.classList.length;r--;){const i=s.classList[r];if(e.test(i))return!0}return t?Cr(ne.parentNode(s),e,t):!1}function wo(s,e,t,r){let i;if(ti(s)){if(i=s,!ne.childNodes(i).length)return!1}else{if(ne.parentElement(s)===null)return!1;i=ne.parentElement(s)}try{if(typeof e=="string"){if(r){if(i.closest(`.${e}`))return!0}else if(i.classList.contains(e))return!0}else if(Cr(i,e,r))return!0;if(t){if(r){if(i.closest(t))return!0}else if(i.matches(t))return!0}}catch(n){}return!1}function dc(s,e,t){const r=s.contentWindow;if(!r)return;let i=!1,n;try{n=r.document.readyState}catch(l){return}if(n!=="complete"){const l=setTimeout(()=>{i||(e(),i=!0)},t);s.addEventListener("load",()=>{clearTimeout(l),i=!0,e()});return}const o="about:blank";if(r.location.href!==o||s.src===o||s.src==="")return setTimeout(e,0),s.addEventListener("load",e);s.addEventListener("load",e)}function pc(s,e,t){let r=!1,i;try{i=s.sheet}catch(o){return}if(i)return;const n=setTimeout(()=>{r||(e(),r=!0)},t);s.addEventListener("load",()=>{clearTimeout(n),r=!0,e()})}function mc(s,e){const{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:o,inlineStylesheet:l,maskInputOptions:a={},maskTextClass:c,maskTextFn:u,maskInputFn:h,dataURLOptions:f={},inlineImages:d,inlineVideos:m,recordCanvas:g,keepIframeSrcFn:p,newlyAddedElement:y=!1,cssCaptured:v=!1,privacySetting:b}=e,S=gc(t,r);switch(s.nodeType){case s.DOCUMENT_NODE:return s.compatMode!=="CSS1Compat"?{type:L.Document,childNodes:[],compatMode:s.compatMode}:{type:L.Document,childNodes:[]};case s.DOCUMENT_TYPE_NODE:return{type:L.DocumentType,name:s.name,publicId:s.publicId,systemId:s.systemId,rootId:S};case s.ELEMENT_NODE:return wc(s,{doc:t,blockClass:i,blockSelector:n,inlineStylesheet:l,maskInputOptions:a,maskInputFn:h,maskTextClass:c,dataURLOptions:f,inlineImages:d,inlineVideos:m,recordCanvas:g,keepIframeSrcFn:p,newlyAddedElement:y,privacySetting:b,rootId:S});case s.TEXT_NODE:return yc(s,{doc:t,needsMask:o,maskTextFn:u,privacySetting:b,rootId:S,cssCaptured:v});case s.CDATA_SECTION_NODE:return{type:L.CDATA,textContent:"",rootId:S};case s.COMMENT_NODE:return{type:L.Comment,textContent:ne.textContent(s)||"",rootId:S};default:return!1}}function gc(s,e){if(!e.hasNode(s))return;const t=e.getId(s);return t===1?void 0:t}function yc(s,e){var t;const{needsMask:r,maskTextFn:i,privacySetting:n,rootId:o,cssCaptured:l}=e,a=ne.parentNode(s),c=a&&a.tagName;let u="";const h=c==="STYLE"?!0:void 0,f=c==="SCRIPT"?!0:void 0;f?u="SCRIPT_PLACEHOLDER":l||(u=ne.textContent(s),h&&u&&(u=Sr(u,ni(e.doc)))),!h&&!f&&u&&r&&(u=i?i(u,ne.parentElement(s)):u.replace(/[\S]/g,"*"));const d=n==="strict",m=(t=s.parentElement)==null?void 0:t.getAttribute("data-hl-record"),g=n==="default"&&fo(u);return(d||g)&&!m&&c&&!new Set(["HEAD","TITLE","STYLE","SCRIPT","HTML","BODY","NOSCRIPT"]).has(c)&&u&&(u=ii(u)),{type:L.Text,textContent:u||"",rootId:o}}function wc(s,e){const{doc:t,blockClass:r,blockSelector:i,inlineStylesheet:n,maskInputOptions:o={},maskInputFn:l,maskTextClass:a,dataURLOptions:c={},inlineImages:u,inlineVideos:h,recordCanvas:f,keepIframeSrcFn:d,newlyAddedElement:m=!1,privacySetting:g,rootId:p}=e;let y=rn(s,r,i);const v=rn(s,a,null),b=g==="strict";let S=lc(s),C={};const R=s.attributes.length;for(let I=0;I<R;I++){const x=s.attributes[I];yo(S,x.name,x.value)||(C[x.name]=go(t,S,Be(x.name),x.value))}if(S==="link"&&n){const I=Array.from(t.styleSheets).find(U=>U.href===s.href);let x=null;I&&(x=ys(I)),x&&(delete C.rel,delete C.href,C._cssText=x)}if(S==="style"&&s.sheet){let I=ys(s.sheet);I&&(s.childNodes.length>1&&(I=Kl(I,s)),C._cssText=I)}if(S==="input"||S==="textarea"||S==="select"){const I=s.value,x=s.checked;C.type!=="radio"&&C.type!=="checkbox"&&C.type!=="submit"&&C.type!=="button"&&I?C.value=br({element:s,type:vr(s),tagName:S,value:I,overwriteRecord:s.getAttribute("data-hl-record"),maskInputOptions:o,maskInputFn:l}):x&&(C.checked=x)}if(S==="option"&&(s.selected&&!o.select?C.selected=!0:delete C.selected),S==="dialog"&&s.open&&(C.rr_open_mode=s.matches("dialog:modal")?"modal":"non-modal"),S==="canvas"&&f){if(s.__context==="2d")Vl(s);else if(!("__context"in s)){const I=s.toDataURL(c.type,c.quality),x=t.createElement("canvas");x.width=s.width,x.height=s.height;const U=x.toDataURL(c.type,c.quality);I!==U&&(C.rr_dataURL=I)}}if(S==="img"&&u&&!y&&!v&&!b){Ge||(Ge=t.createElement("canvas"),en=Ge.getContext("2d"));const I=s,x=I.currentSrc||I.getAttribute("src")||"<unknown-src>",U=I.crossOrigin,j=()=>{I.removeEventListener("load",j);try{Ge.width=I.naturalWidth,Ge.height=I.naturalHeight,en.drawImage(I,0,0),C.rr_dataURL=Ge.toDataURL(c.type,c.quality)}catch(ee){if(I.crossOrigin!=="anonymous"){I.crossOrigin="anonymous",I.complete&&I.naturalWidth!==0?j():I.addEventListener("load",j);return}else console.warn(`Cannot inline img src=${x}! Error: ${ee}`)}I.crossOrigin==="anonymous"&&(U?C.crossOrigin=U:I.removeAttribute("crossorigin"))};I.complete&&I.naturalWidth!==0?j():I.addEventListener("load",j)}if(S==="audio"||S==="video"){const I=C;I.rr_mediaState=s.paused?"paused":"played",I.rr_mediaCurrentTime=s.currentTime,I.rr_mediaPlaybackRate=s.playbackRate,I.rr_mediaMuted=s.muted,I.rr_mediaLoop=s.loop,I.rr_mediaVolume=s.volume}if(m||(s.scrollLeft&&(C.rr_scrollLeft=s.scrollLeft),s.scrollTop&&(C.rr_scrollTop=s.scrollTop)),y||v||b&&ws(S)){const{width:I,height:x}=s.getBoundingClientRect();C={class:C.class,rr_width:`${I}px`,rr_height:`${x}px`}}b&&ws(S)&&(y=!0),S==="iframe"&&!d(C.src)&&(s.contentDocument||(C.rr_src=C.src),delete C.src);let T;try{customElements.get(S)&&(T=!0)}catch(I){}const D=I=>{const{width:x,height:U}=I.getBoundingClientRect();C={width:x,height:U,rr_width:`${x}px`,rr_height:`${U}px`,rr_inlined_video:!0,class:C.class,style:C.style},S="canvas";const j=t.createElement("canvas");j.width=s.width,j.height=s.height,C.rr_dataURL=j.toDataURL(c.type,c.quality)};if(S==="video"){const I=s;u&&(I.src===""||I.src.indexOf("blob:")!==-1)&&D(I),h&&I.src!==""&&I.src.indexOf("blob:")===-1&&D(I)}return{type:L.Element,tagName:S,attributes:C,childNodes:[],isSVG:fc(s)||void 0,needBlock:y,needMask:v,rootId:p,isCustom:T}}function H(s){return s==null?"":s.toLowerCase()}function bc(s,e){if(e.comment&&s.type===L.Comment)return!0;if(s.type===L.Element){if(e.script&&(s.tagName==="script"||s.tagName==="link"&&(s.attributes.rel==="preload"&&s.attributes.as==="script"||s.attributes.rel==="modulepreload")||s.tagName==="link"&&s.attributes.rel==="prefetch"&&typeof s.attributes.href=="string"&&si(s.attributes.href)==="js"))return!0;if(e.headFavicon&&(s.tagName==="link"&&s.attributes.rel==="shortcut icon"||s.tagName==="meta"&&(H(s.attributes.name).match(/^msapplication-tile(image|color)$/)||H(s.attributes.name)==="application-name"||H(s.attributes.rel)==="icon"||H(s.attributes.rel)==="apple-touch-icon"||H(s.attributes.rel)==="shortcut icon")))return!0;if(s.tagName==="meta"){if(e.headMetaDescKeywords&&H(s.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(H(s.attributes.property).match(/^(og|twitter|fb):/)||H(s.attributes.name).match(/^(og|twitter):/)||H(s.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(H(s.attributes.name)==="robots"||H(s.attributes.name)==="googlebot"||H(s.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&s.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(H(s.attributes.name)==="author"||H(s.attributes.name)==="generator"||H(s.attributes.name)==="framework"||H(s.attributes.name)==="publisher"||H(s.attributes.name)==="progid"||H(s.attributes.property).match(/^article:/)||H(s.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(H(s.attributes.name)==="google-site-verification"||H(s.attributes.name)==="yandex-verification"||H(s.attributes.name)==="csrf-token"||H(s.attributes.name)==="p:domain_verify"||H(s.attributes.name)==="verify-v1"||H(s.attributes.name)==="verification"||H(s.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Ze(s,e){const{doc:t,mirror:r,blockClass:i,blockSelector:n,maskTextClass:o,maskTextSelector:l,skipChild:a=!1,inlineStylesheet:c=!0,maskInputOptions:u={},maskTextFn:h,maskInputFn:f,slimDOMOptions:d,dataURLOptions:m={},inlineImages:g=!1,inlineVideos:p=!1,recordCanvas:y=!1,onSerialize:v,onIframeLoad:b,iframeLoadTimeout:S=5e3,onStylesheetLoad:C,stylesheetLoadTimeout:R=5e3,keepIframeSrcFn:T=()=>!1,newlyAddedElement:D=!1,cssCaptured:I=!1,privacySetting:x}=e;let{needsMask:U}=e,{preserveWhiteSpace:j=!0}=e;U||(U=wo(s,o,l,U===void 0));const ee=mc(s,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:U,inlineStylesheet:c,maskInputOptions:u,maskTextClass:o,maskTextFn:h,maskInputFn:f,dataURLOptions:m,inlineImages:g,inlineVideos:p,recordCanvas:y,keepIframeSrcFn:T,newlyAddedElement:D,cssCaptured:I,privacySetting:x});if(!ee)return console.warn(s,"not serialized"),null;let ae;r.hasNode(s)?ae=r.getId(s):bc(ee,d)||!j&&ee.type===L.Text&&!ee.textContent.replace(/^\s+|\s+$/gm,"").length?ae=Ct:ae=mo();const N=Object.assign(ee,{id:ae});if(r.add(s,N),ae===Ct)return null;v&&v(s);let ce=!a,ue=x,se=x==="strict";if(N.type===L.Element){if(ce=ce&&!N.needBlock,se||(se=!!N.needBlock||!!N.needMask),ue=se?"strict":ue,se&&ws(N.tagName)){const ie=s.cloneNode();ie.src="",r.add(ie,N)}delete N.needBlock,delete N.needMask;const J=ne.shadowRoot(s);J&&wt(J)&&(N.isShadowHost=!0)}if((N.type===L.Document||N.type===L.Element)&&ce){d.headWhitespace&&N.type===L.Element&&N.tagName==="head"&&(j=!1);const J={doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:U,maskTextClass:o,maskTextSelector:l,skipChild:a,inlineStylesheet:c,maskInputOptions:u,maskTextFn:h,maskInputFn:f,slimDOMOptions:d,dataURLOptions:m,inlineImages:g,inlineVideos:p,recordCanvas:y,preserveWhiteSpace:j,onSerialize:v,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:C,stylesheetLoadTimeout:R,keepIframeSrcFn:T,cssCaptured:!1,privacySetting:ue};if(!(N.type===L.Element&&N.tagName==="textarea"&&N.attributes.value!==void 0)){N.type===L.Element&&N.attributes._cssText!==void 0&&typeof N.attributes._cssText=="string"&&(J.cssCaptured=!0);for(const ke of Array.from(ne.childNodes(s))){const Re=Ze(ke,J);Re&&N.childNodes.push(Re)}}let ie=null;if(ti(s)&&(ie=ne.shadowRoot(s)))for(const ke of Array.from(ne.childNodes(ie))){const Re=Ze(ke,J);Re&&(wt(ie)&&(Re.isShadow=!0),N.childNodes.push(Re))}}const he=ne.parentNode(s);return he&&yt(he)&&wt(he)&&(N.isShadow=!0),N.type===L.Element&&N.tagName==="iframe"&&dc(s,()=>{const J=s.contentDocument;if(J&&b){const ie=Ze(J,{doc:J,mirror:r,blockClass:i,blockSelector:n,needsMask:U,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:h,maskInputFn:f,slimDOMOptions:d,dataURLOptions:m,inlineImages:g,inlineVideos:p,recordCanvas:y,preserveWhiteSpace:j,onSerialize:v,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:C,stylesheetLoadTimeout:R,keepIframeSrcFn:T,privacySetting:x});ie&&b(s,ie)}},S),N.type===L.Element&&N.tagName==="link"&&typeof N.attributes.rel=="string"&&(N.attributes.rel==="stylesheet"||N.attributes.rel==="preload"&&typeof N.attributes.href=="string"&&si(N.attributes.href)==="css")&&pc(s,()=>{if(C){const J=Ze(s,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:U,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:h,maskInputFn:f,slimDOMOptions:d,dataURLOptions:m,inlineImages:g,inlineVideos:p,recordCanvas:y,preserveWhiteSpace:j,onSerialize:v,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:C,stylesheetLoadTimeout:R,keepIframeSrcFn:T,privacySetting:x});J&&C(s,J)}},R),N}function vc(s,e){const{mirror:t=new ri,blockClass:r="highlight-block",blockSelector:i=null,maskTextClass:n="highlight-mask",maskTextSelector:o=null,inlineStylesheet:l=!0,inlineImages:a=!1,inlineVideos:c=!1,recordCanvas:u=!1,maskAllInputs:h=!1,maskTextFn:f,maskInputFn:d,slimDOM:m=!1,dataURLOptions:g,preserveWhiteSpace:p,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:b,onStylesheetLoad:S,stylesheetLoadTimeout:C,keepIframeSrcFn:R=()=>!1,privacySetting:T="default"}=e||{};return Ze(s,{doc:s,mirror:t,blockClass:r,blockSelector:i,maskTextClass:n,maskTextSelector:o,skipChild:!1,inlineStylesheet:l,maskInputOptions:h===!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}:h===!1?{password:!0}:h,maskTextFn:f,maskInputFn:d,slimDOMOptions:m||m==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:m==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:m||{},dataURLOptions:g,inlineImages:a,inlineVideos:c,recordCanvas:u,preserveWhiteSpace:p,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:b,onStylesheetLoad:S,stylesheetLoadTimeout:C,keepIframeSrcFn:R,newlyAddedElement:!1,privacySetting:T})}const Sc=/(max|min)-device-(width|height)/,sn=new RegExp(Sc.source,"g"),Cc={postcssPlugin:"postcss-custom-selectors",prepare(){return{postcssPlugin:"postcss-custom-selectors",AtRule:function(s){s.params.match(sn)&&(s.params=s.params.replace(sn,"$1-$2"))}}}},Ic={postcssPlugin:"postcss-hover-classes",prepare:function(){const s=[];return{Rule:function(e){s.indexOf(e)===-1&&(s.push(e),e.selectors.forEach(function(t){t.includes(":hover")&&(e.selector+=`,
3
15
  `+t.replace(/:hover/g,".\\:hover"))}))}}}};function Ec(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function xc(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var i=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return s[r]}})}),t}var oi={exports:{}},_=String,bo=function(){return{isColorSupported:!1,reset:_,bold:_,dim:_,italic:_,underline:_,inverse:_,hidden:_,strikethrough:_,black:_,red:_,green:_,yellow:_,blue:_,magenta:_,cyan:_,white:_,gray:_,bgBlack:_,bgRed:_,bgGreen:_,bgYellow:_,bgBlue:_,bgMagenta:_,bgCyan:_,bgWhite:_,blackBright:_,redBright:_,greenBright:_,yellowBright:_,blueBright:_,magentaBright:_,cyanBright:_,whiteBright:_,bgBlackBright:_,bgRedBright:_,bgGreenBright:_,bgYellowBright:_,bgBlueBright:_,bgMagentaBright:_,bgCyanBright:_,bgWhiteBright:_}};oi.exports=bo();oi.exports.createColors=bo;var Mc=oi.exports;const Rc={},Nc=Object.freeze(Object.defineProperty({__proto__:null,default:Rc},Symbol.toStringTag,{value:"Module"})),pe=xc(Nc);let nn=Mc,on=pe,bs=class vo extends Error{constructor(e,t,r,i,n,o){super(e),this.name="CssSyntaxError",this.reason=e,n&&(this.file=n),i&&(this.source=i),o&&(this.plugin=o),typeof t!="undefined"&&typeof r!="undefined"&&(typeof t=="number"?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,vo)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line!="undefined"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;e==null&&(e=nn.isColorSupported);let r=u=>u,i=u=>u,n=u=>u;if(e){let{bold:u,gray:h,red:f}=nn.createColors(!0);i=d=>u(f(d)),r=d=>h(d),on&&(n=d=>on(d))}let o=t.split(/\r?\n/),l=Math.max(this.line-3,0),a=Math.min(this.line+2,o.length),c=String(a).length;return o.slice(l,a).map((u,h)=>{let f=l+1+h,d=" "+(" "+f).slice(-c)+" | ";if(f===this.line){if(u.length>160){let g=20,p=Math.max(0,this.column-g),y=Math.max(this.column+g,this.endColumn+g),v=u.slice(p,y),b=r(d.replace(/\d/g," "))+u.slice(0,Math.min(this.column-1,g-1)).replace(/[^\t]/g," ");return i(">")+r(d)+n(v)+`
4
16
  `+b+i("^")}let m=r(d.replace(/\d/g," "))+u.slice(0,this.column-1).replace(/[^\t]/g," ");return i(">")+r(d)+n(u)+`
@@ -56,7 +68,7 @@ https://www.w3ctech.com/topic/2226`));let l=t(...o);return l.postcssPlugin=e,l.p
56
68
  https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+`: \u91CC\u9762 postcss.plugin \u88AB\u5F03\u7528. \u8FC1\u79FB\u6307\u5357:
57
69
  https://www.w3ctech.com/topic/2226`));let l=t(...o);return l.postcssPlugin=e,l.postcssVersion=new xi().version,l}let n;return Object.defineProperty(i,"postcss",{get(){return n||(n=i()),n}}),i.process=function(o,l,a){return G([i(a)]).process(o,l)},i};G.stringify=hd;G.parse=cd;G.fromJSON=id;G.list=ad;G.comment=s=>new Da(s);G.atRule=s=>new Ta(s);G.decl=s=>new _a(s);G.rule=s=>new Pa(s);G.root=s=>new La(s);G.document=s=>new ka(s);G.CssSyntaxError=sd;G.Declaration=_a;G.Container=rd;G.Processor=xi;G.Document=ka;G.Comment=Da;G.Warning=fd;G.AtRule=Ta;G.Result=ud;G.Input=nd;G.Rule=Pa;G.Root=La;G.Node=ld;od.registerPostcss(G);var dd=G;G.default=G;const X=xh(dd);X.stringify;X.fromJSON;X.plugin;X.parse;X.list;X.document;X.comment;X.atRule;X.rule;X.decl;X.root;X.CssSyntaxError;X.Declaration;X.Container;X.Processor;X.Document;X.Comment;X.Warning;X.AtRule;X.Result;X.Input;X.Rule;X.Root;X.Node;var $=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))($||{});function pd(s){const e={},t=/;(?![^(]*\))/g,r=/:(.+)/,i=/\/\*.*?\*\//g;return s.replace(i,"").split(t).forEach(function(n){if(n){const o=n.split(r);o.length>1&&(e[Xs(o[0].trim())]=o[1].trim())}}),e}function Un(s){const e=[];for(const t in s){const r=s[t];if(typeof r!="string")continue;const i=wd(t);e.push(`${i}: ${r};`)}return e.join(" ")}const md=/-([a-z])/g,gd=/^--[a-zA-Z0-9-]+$/,Xs=s=>gd.test(s)?s:s.replace(md,(e,t)=>t?t.toUpperCase():""),yd=/\B([A-Z])/g,wd=s=>s.replace(yd,"-$1").toLowerCase();class ge{constructor(...e){E(this,"parentElement",null),E(this,"parentNode",null),E(this,"ownerDocument"),E(this,"firstChild",null),E(this,"lastChild",null),E(this,"previousSibling",null),E(this,"nextSibling",null),E(this,"ELEMENT_NODE",1),E(this,"TEXT_NODE",3),E(this,"nodeType"),E(this,"nodeName"),E(this,"RRNodeType")}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(e instanceof ge){if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0}else return!1;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}class Mi extends ge{constructor(...e){super(e),E(this,"nodeType",9),E(this,"nodeName","#document"),E(this,"compatMode","CSS1Compat"),E(this,"RRNodeType",$.Document),E(this,"textContent",null),this.ownerDocument=this}get documentElement(){return this.childNodes.find(e=>e.RRNodeType===$.Element&&e.tagName==="HTML")||null}get body(){var e;return((e=this.documentElement)==null?void 0:e.childNodes.find(t=>t.RRNodeType===$.Element&&t.tagName==="BODY"))||null}get head(){var e;return((e=this.documentElement)==null?void 0:e.childNodes.find(t=>t.RRNodeType===$.Element&&t.tagName==="HEAD"))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(e){const t=e.RRNodeType;if((t===$.Element||t===$.DocumentType)&&this.childNodes.some(i=>i.RRNodeType===t))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${t===$.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const r=Ri(this,e);return r.parentElement=null,r}insertBefore(e,t){const r=e.RRNodeType;if((r===$.Element||r===$.DocumentType)&&this.childNodes.some(n=>n.RRNodeType===r))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${r===$.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const i=Wa(this,e,t);return i.parentElement=null,i}removeChild(e){return za(this,e)}open(){this.firstChild=null,this.lastChild=null}close(){}write(e){let t;if(e==='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'?t="-//W3C//DTD XHTML 1.0 Transitional//EN":e==='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'&&(t="-//W3C//DTD HTML 4.0 Transitional//EN"),t){const r=this.createDocumentType("html",t,"");this.open(),this.appendChild(r)}}createDocument(e,t,r){return new Mi}createDocumentType(e,t,r){const i=new $a(e,t,r);return i.ownerDocument=this,i}createElement(e){const t=new Zr(e);return t.ownerDocument=this,t}createElementNS(e,t){return this.createElement(t)}createTextNode(e){const t=new Fa(e);return t.ownerDocument=this,t}createComment(e){const t=new Ba(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new Ua(e);return t.ownerDocument=this,t}toString(){return"RRDocument"}}class $a extends ge{constructor(e,t,r){super(),E(this,"nodeType",10),E(this,"RRNodeType",$.DocumentType),E(this,"name"),E(this,"publicId"),E(this,"systemId"),E(this,"textContent",null),this.name=e,this.publicId=t,this.systemId=r,this.nodeName=e}toString(){return"RRDocumentType"}}class Zr extends ge{constructor(e){super(),E(this,"nodeType",1),E(this,"RRNodeType",$.Element),E(this,"tagName"),E(this,"attributes",{}),E(this,"shadowRoot",null),E(this,"scrollLeft"),E(this,"scrollTop"),this.tagName=e.toUpperCase(),this.nodeName=e.toUpperCase()}get textContent(){let e="";return this.childNodes.forEach(t=>e+=t.textContent),e}set textContent(e){this.firstChild=null,this.lastChild=null,this.appendChild(this.ownerDocument.createTextNode(e))}get classList(){return new Sd(this.attributes.class,e=>{this.attributes.class=e})}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const e=this.attributes.style?pd(this.attributes.style):{},t=/\B([A-Z])/g;return e.setProperty=(r,i,n)=>{if(t.test(r))return;const o=Xs(r);i?e[o]=i:delete e[o],n==="important"&&(e[o]+=" !important"),this.attributes.style=Un(e)},e.removeProperty=r=>{if(t.test(r))return"";const i=Xs(r),n=e[i]||"";return delete e[i],this.attributes.style=Un(e),n},e}getAttribute(e){return this.attributes[e]===void 0?null:this.attributes[e]}setAttribute(e,t){this.attributes[e]=t}setAttributeNS(e,t,r){this.setAttribute(t,r)}removeAttribute(e){delete this.attributes[e]}appendChild(e){return Ri(this,e)}insertBefore(e,t){return Wa(this,e,t)}removeChild(e){return za(this,e)}attachShadow(e){const t=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=t,t}dispatchEvent(e){return!0}toString(){let e="";for(const t in this.attributes)e+=`${t}="${this.attributes[t]}" `;return`${this.tagName} ${e}`}}class bd extends Zr{constructor(){super(...arguments),E(this,"currentTime"),E(this,"volume"),E(this,"paused"),E(this,"muted"),E(this,"playbackRate"),E(this,"loop")}attachShadow(e){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}class vd extends Zr{constructor(){super(...arguments),E(this,"tagName","DIALOG"),E(this,"nodeName","DIALOG")}get isModal(){return this.getAttribute("rr_open_mode")==="modal"}get open(){return this.getAttribute("open")!==null}close(){this.removeAttribute("open"),this.removeAttribute("rr_open_mode")}show(){this.setAttribute("open",""),this.setAttribute("rr_open_mode","non-modal")}showModal(){this.setAttribute("open",""),this.setAttribute("rr_open_mode","modal")}}class Fa extends ge{constructor(e){super(),E(this,"nodeType",3),E(this,"nodeName","#text"),E(this,"RRNodeType",$.Text),E(this,"data"),this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRText text=${JSON.stringify(this.data)}`}}class Ba extends ge{constructor(e){super(),E(this,"nodeType",8),E(this,"nodeName","#comment"),E(this,"RRNodeType",$.Comment),E(this,"data"),this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}class Ua extends ge{constructor(e){super(),E(this,"nodeName","#cdata-section"),E(this,"nodeType",4),E(this,"RRNodeType",$.CDATA),E(this,"data"),this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}class Sd{constructor(e,t){if(E(this,"onChange"),E(this,"classes",[]),E(this,"add",(...r)=>{for(const i of r){const n=String(i);this.classes.indexOf(n)>=0||this.classes.push(n)}this.onChange&&this.onChange(this.classes.join(" "))}),E(this,"remove",(...r)=>{this.classes=this.classes.filter(i=>r.indexOf(i)===-1),this.onChange&&this.onChange(this.classes.join(" "))}),e){const r=e.trim().split(/\s+/);this.classes.push(...r)}this.onChange=t}}function Ri(s,e){return e.parentNode&&e.parentNode.removeChild(e),s.lastChild?(s.lastChild.nextSibling=e,e.previousSibling=s.lastChild):(s.firstChild=e,e.previousSibling=null),s.lastChild=e,e.nextSibling=null,e.parentNode=s,e.parentElement=s,e.ownerDocument=s.ownerDocument,e}function Wa(s,e,t){if(!t)return Ri(s,e);if(t.parentNode!==s)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return e===t||(e.parentNode&&e.parentNode.removeChild(e),e.previousSibling=t.previousSibling,t.previousSibling=e,e.nextSibling=t,e.previousSibling?e.previousSibling.nextSibling=e:s.firstChild=e,e.parentElement=s,e.parentNode=s,e.ownerDocument=s.ownerDocument),e}function za(s,e){if(e.parentNode!==s)throw new Error("Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode.");return e.previousSibling?e.previousSibling.nextSibling=e.nextSibling:s.firstChild=e.nextSibling,e.nextSibling?e.nextSibling.previousSibling=e.previousSibling:s.lastChild=e.previousSibling,e.previousSibling=null,e.nextSibling=null,e.parentElement=null,e.parentNode=null,e}var le=(s=>(s[s.PLACEHOLDER=0]="PLACEHOLDER",s[s.ELEMENT_NODE=1]="ELEMENT_NODE",s[s.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",s[s.TEXT_NODE=3]="TEXT_NODE",s[s.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",s[s.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",s[s.ENTITY_NODE=6]="ENTITY_NODE",s[s.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",s[s.COMMENT_NODE=8]="COMMENT_NODE",s[s.DOCUMENT_NODE=9]="DOCUMENT_NODE",s[s.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",s[s.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE",s))(le||{});const Js={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},Cd={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};let ve=null;function Tr(s,e,t,r=e.mirror||e.ownerDocument.mirror){s=Id(s,e,t,r),Va(s,e,t,r),Ed(s,e,t)}function Id(s,e,t,r){var i;if(t.afterAppend&&!ve&&(ve=new WeakSet,setTimeout(()=>{ve=null},0)),!Ni(s,e)){const n=Dr(e,t.mirror,r);(i=s.parentNode)==null||i.replaceChild(n,s),s=n}switch(e.RRNodeType){case $.Document:{if(!je(s,e,t.mirror,r)){const n=r.getMeta(e);n&&(t.mirror.removeNodeFromMap(s),s.close(),s.open(),t.mirror.add(s,n),ve==null||ve.add(s))}break}case $.Element:{const n=s,o=e;switch(o.tagName){case"IFRAME":{const l=s.contentDocument;if(!l)break;Tr(l,e.contentDocument,t,r);break}}o.shadowRoot&&(n.shadowRoot||n.attachShadow({mode:"open"}),Va(n.shadowRoot,o.shadowRoot,t,r)),xd(n,o,r);break}}return s}function Ed(s,e,t){var r;switch(e.RRNodeType){case $.Document:{const i=e.scrollData;i&&t.applyScroll(i,!0);break}case $.Element:{const i=s,n=e;switch(n.scrollData&&t.applyScroll(n.scrollData,!0),n.inputData&&t.applyInput(n.inputData),n.tagName){case"AUDIO":case"VIDEO":{const o=s,l=n;l.paused!==void 0&&(l.paused?o.pause():o.play()),l.muted!==void 0&&(o.muted=l.muted),l.volume!==void 0&&(o.volume=l.volume),l.currentTime!==void 0&&(o.currentTime=l.currentTime),l.playbackRate!==void 0&&(o.playbackRate=l.playbackRate),l.loop!==void 0&&(o.loop=l.loop);break}case"CANVAS":{const o=e;if(o.rr_dataURL!==null){const l=document.createElement("img");l.onload=()=>{const a=i.getContext("2d");a&&a.drawImage(l,0,0,l.width,l.height)},l.src=o.rr_dataURL}o.canvasMutations.forEach(l=>t.applyCanvas(l.event,l.mutation,s));break}case"STYLE":{const o=i.sheet;o&&e.rules.forEach(l=>t.applyStyleSheetMutation(l,o));break}case"DIALOG":{const o=i,l=n,a=o.open,c=o.matches("dialog:modal"),u=l.open,h=l.isModal,f=c!==h,d=a!==u;if((f||a&&d)&&o.close(),u&&(d||f))try{h?o.showModal():o.show()}catch(m){console.warn(m)}break}}break}case $.Text:case $.Comment:case $.CDATA:{s.textContent!==e.data&&(s.textContent=e.data);break}}ve!=null&&ve.has(s)&&(ve.delete(s),(r=t.afterAppend)==null||r.call(t,s,t.mirror.getId(s)))}function xd(s,e,t){const r=s.attributes,i=e.attributes;for(const n in i){const o=i[n],l=t.getMeta(e);if(l!=null&&l.isSVG&&Js[n])s.setAttributeNS(Js[n],n,o);else if(e.tagName==="CANVAS"&&n==="rr_dataURL"){const a=document.createElement("img");a.src=o,a.onload=()=>{const c=s.getContext("2d");c&&c.drawImage(a,0,0,a.width,a.height)}}else{if(e.tagName==="IFRAME"&&n==="srcdoc")continue;try{s.setAttribute(n,o)}catch(a){console.warn(a)}}}for(const{name:n}of Array.from(r))n in i||s.removeAttribute(n);e.scrollLeft&&(s.scrollLeft=e.scrollLeft),e.scrollTop&&(s.scrollTop=e.scrollTop)}function Va(s,e,t,r){const i=Array.from(s.childNodes),n=e.childNodes;if(i.length===0&&n.length===0)return;let o=0,l=i.length-1,a=0,c=n.length-1,u=i[o],h=i[l],f=n[a],d=n[c],m,g;for(;o<=l&&a<=c;)if(u===void 0)u=i[++o];else if(h===void 0)h=i[--l];else if(je(u,f,t.mirror,r))u=i[++o],f=n[++a];else if(je(h,d,t.mirror,r))h=i[--l],d=n[--c];else if(je(u,d,t.mirror,r)){try{s.insertBefore(u,h.nextSibling)}catch(v){console.warn(v)}u=i[++o],d=n[--c]}else if(je(h,f,t.mirror,r)){try{s.insertBefore(h,u)}catch(v){console.warn(v)}h=i[--l],f=n[++a]}else{if(!m){m={};for(let b=o;b<=l;b++){const S=i[b];S&&t.mirror.hasNode(S)&&(m[t.mirror.getId(S)]=b)}}g=m[r.getId(f)];const v=i[g];if(g!==void 0&&v&&je(v,f,t.mirror,r)){try{s.insertBefore(v,u)}catch(b){console.warn(b)}i[g]=void 0}else{const b=Dr(f,t.mirror,r);s.nodeName==="#document"&&u&&(b.nodeType===b.DOCUMENT_TYPE_NODE&&u.nodeType===u.DOCUMENT_TYPE_NODE||b.nodeType===b.ELEMENT_NODE&&u.nodeType===u.ELEMENT_NODE)&&(s.removeChild(u),t.mirror.removeNodeFromMap(u),u=i[++o]);try{s.insertBefore(b,u||null)}catch(S){console.warn(S)}}f=n[++a]}if(o>l){const v=n[c+1];let b=null;for(v&&(b=t.mirror.getNode(r.getId(v)));a<=c;++a){const S=Dr(n[a],t.mirror,r);try{s.insertBefore(S,b)}catch(C){console.warn(C)}}}else if(a>c)for(;o<=l;o++){const v=i[o];if(!(!v||v.parentNode!==s))try{s.removeChild(v),t.mirror.removeNodeFromMap(v)}catch(b){console.warn(b)}}let p=s.firstChild,y=e.firstChild;for(;p!==null&&y!==null;)Tr(p,y,t,r),p=p.nextSibling,y=y.nextSibling}function Dr(s,e,t){const r=t.getId(s),i=t.getMeta(s);let n=null;if(r>-1&&(n=e.getNode(r)),n!==null&&Ni(n,s))return n;switch(s.RRNodeType){case $.Document:n=new Document;break;case $.DocumentType:n=document.implementation.createDocumentType(s.name,s.publicId,s.systemId);break;case $.Element:{let o=s.tagName.toLowerCase();o=Cd[o]||o,i&&"isSVG"in i&&(i!=null&&i.isSVG)?n=document.createElementNS(Js.svg,o):n=document.createElement(s.tagName);break}case $.Text:n=document.createTextNode(s.data);break;case $.Comment:n=document.createComment(s.data);break;case $.CDATA:n=document.createCDATASection(s.data);break}i&&e.add(n,O({},i));try{ve==null||ve.add(n)}catch(o){}return n}function Ni(s,e){return s.nodeType!==e.nodeType?!1:s.nodeType!==s.ELEMENT_NODE||s.tagName.toUpperCase()===e.tagName}function je(s,e,t,r){const i=t.getId(s),n=r.getId(e);return i===-1||i!==n?!1:Ni(s,e)}class ot extends Mi{constructor(e){super(),E(this,"UNSERIALIZED_STARTING_ID",-2),E(this,"_unserializedId",this.UNSERIALIZED_STARTING_ID),E(this,"mirror",$d()),E(this,"scrollData",null),e&&(this.mirror=e)}get unserializedId(){return this._unserializedId--}createDocument(e,t,r){return new ot}createDocumentType(e,t,r){const i=new Md(e,t,r);return i.ownerDocument=this,i}createElement(e){const t=e.toUpperCase();let r;switch(t){case"AUDIO":case"VIDEO":r=new Rd(t);break;case"IFRAME":r=new Td(t,this.mirror);break;case"CANVAS":r=new Ad(t);break;case"STYLE":r=new Od(t);break;case"DIALOG":r=new Nd(t);break;default:r=new Xr(t);break}return r.ownerDocument=this,r}createComment(e){const t=new _d(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new kd(e);return t.ownerDocument=this,t}createTextNode(e){const t=new Dd(e);return t.ownerDocument=this,t}destroyTree(){this.firstChild=null,this.lastChild=null,this.mirror.reset()}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID}}const Md=$a;class Xr extends Zr{constructor(){super(...arguments),E(this,"inputData",null),E(this,"scrollData",null)}}class Rd extends bd{}class Nd extends vd{}class Ad extends Xr{constructor(){super(...arguments),E(this,"rr_dataURL",null),E(this,"canvasMutations",[])}getContext(){return null}}class Od extends Xr{constructor(){super(...arguments),E(this,"rules",[])}}class Td extends Xr{constructor(e,t){super(e),E(this,"contentDocument",new ot),this.contentDocument.mirror=t}}const Dd=Fa,_d=Ba,kd=Ua;function Ld(s){return s instanceof HTMLFormElement?"FORM":s.tagName.toUpperCase()}function Ga(s,e,t,r){let i;switch(s.nodeType){case le.DOCUMENT_NODE:r&&r.nodeName==="IFRAME"?i=r.contentDocument:(i=e,i.compatMode=s.compatMode);break;case le.DOCUMENT_TYPE_NODE:{const o=s;i=e.createDocumentType(o.name,o.publicId,o.systemId);break}case le.ELEMENT_NODE:{const o=s,l=Ld(o);i=e.createElement(l);const a=i;for(const{name:c,value:u}of Array.from(o.attributes))a.attributes[c]=u;o.scrollLeft&&(a.scrollLeft=o.scrollLeft),o.scrollTop&&(a.scrollTop=o.scrollTop);break}case le.TEXT_NODE:i=e.createTextNode(s.textContent||"");break;case le.CDATA_SECTION_NODE:i=e.createCDATASection(s.data);break;case le.COMMENT_NODE:i=e.createComment(s.textContent||"");break;case le.DOCUMENT_FRAGMENT_NODE:i=r.attachShadow({mode:"open"});break;default:return null}let n=t.getMeta(s);return e instanceof ot&&(n||(n=ja(i,e.unserializedId),t.add(s,n)),e.mirror.add(i,O({},n))),i}function Pd(s,e=Eh(),t=new ot){function r(i,n){const o=Ga(i,t,e,n);if(o!==null)if((n==null?void 0:n.nodeName)!=="IFRAME"&&i.nodeType!==le.DOCUMENT_FRAGMENT_NODE&&(n==null||n.appendChild(o),o.parentNode=n,o.parentElement=n),i.nodeName==="IFRAME"){const l=i.contentDocument;l&&r(l,o)}else(i.nodeType===le.DOCUMENT_NODE||i.nodeType===le.ELEMENT_NODE||i.nodeType===le.DOCUMENT_FRAGMENT_NODE)&&(i.nodeType===le.ELEMENT_NODE&&i.shadowRoot&&r(i.shadowRoot,o),i.childNodes.forEach(l=>r(l,o)))}return r(s,null),t}function $d(){return new Fd}class Fd{constructor(){E(this,"idNodeMap",new Map),E(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;const r=(t=this.getMeta(e))==null?void 0:t.id;return r!=null?r:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)}replace(e,t){const r=this.getNode(e);if(r){const i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(t,i)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function ja(s,e){switch(s.RRNodeType){case $.Document:return{id:e,type:s.RRNodeType,childNodes:[]};case $.DocumentType:{const t=s;return{id:e,type:s.RRNodeType,name:t.name,publicId:t.publicId,systemId:t.systemId}}case $.Element:return{id:e,type:s.RRNodeType,tagName:s.tagName.toLowerCase(),attributes:{},childNodes:[]};case $.Text:return{id:e,type:s.RRNodeType,textContent:s.textContent||""};case $.Comment:return{id:e,type:s.RRNodeType,textContent:s.textContent||""};case $.CDATA:return{id:e,type:s.RRNodeType,textContent:""}}}const Wn={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},zn={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},ar={},Bd=()=>!!globalThis.Zone;function Ai(s){if(ar[s])return ar[s];const e=globalThis[s],t=e.prototype,r=s in Wn?Wn[s]:void 0,i=!!(r&&r.every(l=>{var a,c;return!!((c=(a=Object.getOwnPropertyDescriptor(t,l))==null?void 0:a.get)!=null&&c.toString().includes("[native code]"))})),n=s in zn?zn[s]:void 0,o=!!(n&&n.every(l=>{var a;return typeof t[l]=="function"&&((a=t[l])==null?void 0:a.toString().includes("[native code]"))}));if(i&&o&&!Bd())return ar[s]=e.prototype,e.prototype;try{const l=document.createElement("iframe");document.body.appendChild(l);const a=l.contentWindow;if(!a)return e.prototype;const c=a[s].prototype;return document.body.removeChild(l),c?ar[s]=c:t}catch(l){return t}}const hs={};function _e(s,e,t){var r;const i=`${s}.${String(t)}`;if(hs[i])return hs[i].call(e);const n=Ai(s),o=(r=Object.getOwnPropertyDescriptor(n,t))==null?void 0:r.get;return o?(hs[i]=o,o.call(e)):e[t]}const fs={};function Ya(s,e,t){const r=`${s}.${String(t)}`;if(fs[r])return fs[r].bind(e);const n=Ai(s)[t];return typeof n!="function"?e[t]:(fs[r]=n,n.bind(e))}function Ud(s){return _e("Node",s,"childNodes")}function Wd(s){return _e("Node",s,"parentNode")}function zd(s){return _e("Node",s,"parentElement")}function Vd(s){return _e("Node",s,"textContent")}function Gd(s,e){return Ya("Node",s,"contains")(e)}function jd(s){return Ya("Node",s,"getRootNode")()}function Yd(s){return!s||!("host"in s)?null:_e("ShadowRoot",s,"host")}function Hd(s){return s.styleSheets}function Zd(s){return!s||!("shadowRoot"in s)?null:_e("Element",s,"shadowRoot")}function Xd(s,e){return _e("Element",s,"querySelector")(e)}function Jd(s,e){return _e("Element",s,"querySelectorAll")(e)}function Ha(){return Ai("MutationObserver").constructor}function ze(s,e,t){try{if(!(e in s))return()=>{};const r=s[e],i=t(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),s[e]=i,()=>{s[e]=r}}catch(r){return()=>{}}}const P={childNodes:Ud,parentNode:Wd,parentElement:zd,textContent:Vd,contains:Gd,getRootNode:jd,host:Yd,styleSheets:Hd,shadowRoot:Zd,querySelector:Xd,querySelectorAll:Jd,mutationObserver:Ha,patch:ze};function oe(s,e,t=document){const r={capture:!0};return t.addEventListener(s,e,r),()=>t.removeEventListener(s,e,r)}const Ye=`Please stop import mirror directly. Instead of that,\r
58
70
  now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
59
- or you can use record.mirror to access the mirror instance during recording.`;exports.mirror={map:{},getId(){return console.error(Ye),-1},getNode(){return console.error(Ye),null},removeNodeFromMap(){console.error(Ye)},has(){return console.error(Ye),!1},reset(){console.error(Ye)}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(exports.mirror=new Proxy(exports.mirror,{get(s,e,t){return e==="map"&&console.error(Ye),Reflect.get(s,e,t)}}));function nt(s,e,t={}){let r=null,i=0;return function(...n){const o=Date.now();!i&&t.leading===!1&&(i=o);const l=e-(o-i),a=this;l<=0||l>e?(r&&(clearTimeout(r),r=null),i=o,s.apply(a,n)):!r&&t.trailing!==!1&&(r=setTimeout(()=>{i=t.leading===!1?0:Date.now(),r=null,s.apply(a,n)},l))}}function Pt(s,e,t,r,i=window){const n=i.Object.getOwnPropertyDescriptor(s,e);return i.Object.defineProperty(s,e,r?t:{set(o){setTimeout(()=>{t.set.call(this,o)},0),n&&n.set&&n.set.call(this,o)}}),()=>Pt(s,e,n||{},!0)}let Tt=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Tt=()=>new Date().getTime());function Oi(s){var e,t,r,i;const n=s.document;return{left:n.scrollingElement?n.scrollingElement.scrollLeft:s.pageXOffset!==void 0?s.pageXOffset:n.documentElement.scrollLeft||(n==null?void 0:n.body)&&((e=P.parentElement(n.body))==null?void 0:e.scrollLeft)||((t=n==null?void 0:n.body)==null?void 0:t.scrollLeft)||0,top:n.scrollingElement?n.scrollingElement.scrollTop:s.pageYOffset!==void 0?s.pageYOffset:(n==null?void 0:n.documentElement.scrollTop)||(n==null?void 0:n.body)&&((r=P.parentElement(n.body))==null?void 0:r.scrollTop)||((i=n==null?void 0:n.body)==null?void 0:i.scrollTop)||0}}function Ti(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Di(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function _i(s){return s?s.nodeType===s.ELEMENT_NODE?s:P.parentElement(s):null}const Za=s=>{try{if(s instanceof HTMLElement)return s.tagName==="CANVAS"}catch(e){return!1}return!1};function re(s,e,t,r){if(!s)return!1;const i=_i(s);if(!i)return!1;try{if(typeof e=="string"){if(i.classList.contains(e)||r&&i.closest("."+e)!==null)return!0}else if(Cr(i,e,r))return!0}catch(n){}return!!(t&&(i.matches(t)||r&&i.closest(t)!==null))}function Xa(s,e){return e.getId(s)!==-1}function gr(s,e,t){return s.tagName==="TITLE"&&t.headTitleMutations?!0:e.getId(s)===Ct}function ki(s,e){if(yt(s))return!1;const t=e.getId(s);if(!e.has(t))return!0;const r=P.parentNode(s);return r&&r.nodeType===s.DOCUMENT_NODE?!1:r?ki(r,e):!0}function _r(s){return!!s.changedTouches}function Li(s=window){"NodeList"in s&&!s.NodeList.prototype.forEach&&(s.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in s&&!s.DOMTokenList.prototype.forEach&&(s.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Ja(s){const e={},t=(i,n)=>{const o={value:i,parent:n,children:[]};return e[i.node.id]=o,o},r=[];for(const i of s){const{nextId:n,parentId:o}=i;if(n&&n in e){const l=e[n];if(l.parent){const a=l.parent.children.indexOf(l);l.parent.children.splice(a,0,t(i,l.parent))}else{const a=r.indexOf(l);r.splice(a,0,t(i,null))}continue}if(o in e){const l=e[o];l.children.push(t(i,l));continue}r.push(t(i,null))}return r}function Pi(s,e){e(s.value);for(let t=s.children.length-1;t>=0;t--)Pi(s.children[t],e)}function Qe(s,e){return!!(s.nodeName==="IFRAME"&&e.getMeta(s))}function $i(s,e){return!!(s.nodeName==="LINK"&&s.nodeType===s.ELEMENT_NODE&&s.getAttribute&&s.getAttribute("rel")==="stylesheet"&&e.getMeta(s))}function Fi(s,e){var t,r;const i=(r=(t=s.ownerDocument)==null?void 0:t.defaultView)==null?void 0:r.frameElement;if(!i||i===e)return{x:0,y:0,relativeScale:1,absoluteScale:1};const n=i.getBoundingClientRect(),o=Fi(i,e),l=n.height/i.clientHeight;return{x:n.x*o.relativeScale+o.x,y:n.y*o.relativeScale+o.y,relativeScale:l,absoluteScale:o.absoluteScale*l}}function Oe(s){return s?s instanceof ge&&"shadowRoot"in s?!!s.shadowRoot:!!P.shadowRoot(s):!1}function Xe(s,e){const t=s[e[0]];return e.length===1?t:Xe(t.cssRules[e[1]].cssRules,e.slice(2))}function Ks(s){const e=[...s],t=e.pop();return{positions:e,index:t}}function Ka(s){const e=new Set,t=[];for(let r=s.length;r--;){const i=s[r];e.has(i.id)||(t.push(i),e.add(i.id))}return t}class Bi{constructor(){w(this,"id",1),w(this,"styleIDMap",new WeakMap),w(this,"idStyleMap",new Map)}getId(e){var t;return(t=this.styleIDMap.get(e))!=null?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return t===void 0?r=this.id++:r=t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function Ui(s){var e;let t=null;return"getRootNode"in s&&((e=P.getRootNode(s))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&P.host(P.getRootNode(s))&&(t=P.host(P.getRootNode(s))),t}function Qa(s){let e=s,t;for(;t=Ui(e);)e=t;return e}function qa(s){const e=s.ownerDocument;if(!e)return!1;const t=Qa(s);return P.contains(e,t)}function Wi(s){const e=s.ownerDocument;return e?P.contains(e,s)||qa(s):!1}const Kd=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:Bi,get _mirror(){return exports.mirror},closestElementOfNode:_i,getBaseDimension:Fi,getNestedRule:Xe,getPositionsAndIndex:Ks,getRootShadowHost:Qa,getShadowHost:Ui,getWindowHeight:Ti,getWindowScroll:Oi,getWindowWidth:Di,hasShadowRoot:Oe,hookSetter:Pt,inDom:Wi,isAncestorRemoved:ki,isBlocked:re,isCanvasNode:Za,isIgnored:gr,isSerialized:Xa,isSerializedIframe:Qe,isSerializedStylesheet:$i,iterateResolveTree:Pi,legacy_isTouchEvent:_r,get nowTimestamp(){return Tt},on:oe,polyfill:Li,queueToResolveTrees:Ja,shadowHostInDom:qa,throttle:nt,uniqueTextMutations:Ka},Symbol.toStringTag,{value:"Module"}));var A=(s=>(s[s.DomContentLoaded=0]="DomContentLoaded",s[s.Load=1]="Load",s[s.FullSnapshot=2]="FullSnapshot",s[s.IncrementalSnapshot=3]="IncrementalSnapshot",s[s.Meta=4]="Meta",s[s.Custom=5]="Custom",s[s.Plugin=6]="Plugin",s))(A||{}),M=(s=>(s[s.Mutation=0]="Mutation",s[s.MouseMove=1]="MouseMove",s[s.MouseInteraction=2]="MouseInteraction",s[s.Scroll=3]="Scroll",s[s.ViewportResize=4]="ViewportResize",s[s.Input=5]="Input",s[s.TouchMove=6]="TouchMove",s[s.MediaInteraction=7]="MediaInteraction",s[s.StyleSheetRule=8]="StyleSheetRule",s[s.CanvasMutation=9]="CanvasMutation",s[s.Font=10]="Font",s[s.Log=11]="Log",s[s.Drag=12]="Drag",s[s.StyleDeclaration=13]="StyleDeclaration",s[s.Selection=14]="Selection",s[s.AdoptedStyleSheet=15]="AdoptedStyleSheet",s[s.CustomElement=16]="CustomElement",s))(M||{}),W=(s=>(s[s.MouseUp=0]="MouseUp",s[s.MouseDown=1]="MouseDown",s[s.Click=2]="Click",s[s.ContextMenu=3]="ContextMenu",s[s.DblClick=4]="DblClick",s[s.Focus=5]="Focus",s[s.Blur=6]="Blur",s[s.TouchStart=7]="TouchStart",s[s.TouchMove_Departed=8]="TouchMove_Departed",s[s.TouchEnd=9]="TouchEnd",s[s.TouchCancel=10]="TouchCancel",s))(W||{}),Se=(s=>(s[s.Mouse=0]="Mouse",s[s.Pen=1]="Pen",s[s.Touch=2]="Touch",s))(Se||{}),xe=(s=>(s[s["2D"]=0]="2D",s[s.WebGL=1]="WebGL",s[s.WebGL2=2]="WebGL2",s))(xe||{}),Ae=(s=>(s[s.Play=0]="Play",s[s.Pause=1]="Pause",s[s.Seeked=2]="Seeked",s[s.VolumeChange=3]="VolumeChange",s[s.RateChange=4]="RateChange",s))(Ae||{}),F=(s=>(s.Start="start",s.Pause="pause",s.Resume="resume",s.Resize="resize",s.Finish="finish",s.FullsnapshotRebuilded="fullsnapshot-rebuilded",s.LoadStylesheetStart="load-stylesheet-start",s.LoadStylesheetEnd="load-stylesheet-end",s.SkipStart="skip-start",s.SkipEnd="skip-end",s.MouseInteraction="mouse-interaction",s.EventCast="event-cast",s.CustomEvent="custom-event",s.Flush="flush",s.StateChange="state-change",s.PlayBack="play-back",s.Destroy="destroy",s))(F||{}),Ce=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))(Ce||{});function Vn(s){return"__ln"in s}class Qd{constructor(){w(this,"length",0),w(this,"head",null),w(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)t=(t==null?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&Vn(e.previousSibling)){const r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&Vn(e.nextSibling)&&e.nextSibling.__ln.previous){const r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const Gn=(s,e)=>`${s}@${e}`;class qd{constructor(){w(this,"frozen",!1),w(this,"locked",!1),w(this,"texts",[]),w(this,"attributes",[]),w(this,"attributeMap",new WeakMap),w(this,"removes",[]),w(this,"mapRemoves",[]),w(this,"movedMap",{}),w(this,"addedSet",new Set),w(this,"movedSet",new Set),w(this,"droppedSet",new Set),w(this,"removesSubTreeCache",new Set),w(this,"mutationCb"),w(this,"blockClass"),w(this,"blockSelector"),w(this,"maskTextClass"),w(this,"maskTextSelector"),w(this,"inlineStylesheet"),w(this,"maskInputOptions"),w(this,"maskTextFn"),w(this,"maskInputFn"),w(this,"keepIframeSrcFn"),w(this,"recordCanvas"),w(this,"inlineImages"),w(this,"inlineVideos"),w(this,"privacySetting"),w(this,"slimDOMOptions"),w(this,"dataURLOptions"),w(this,"doc"),w(this,"mirror"),w(this,"iframeManager"),w(this,"stylesheetManager"),w(this,"shadowDomManager"),w(this,"canvasManager"),w(this,"processedNodeManager"),w(this,"unattachedDoc"),w(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),w(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,r=new Qd,i=a=>{let c=a,u=Ct;for(;u===Ct;)c=c&&c.nextSibling,u=c&&this.mirror.getId(c);return u},n=a=>{const c=P.parentNode(a);if(!c||!Wi(a))return;let u=!1;if(a.nodeType===Node.TEXT_NODE){const m=c.tagName;if(m==="TEXTAREA")return;m==="STYLE"&&this.addedSet.has(c)&&(u=!0)}const h=yt(c)?this.mirror.getId(Ui(a)):this.mirror.getId(c),f=i(a);if(h===-1||f===-1)return r.addNode(a);const d=Ze(a,{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,inlineVideos:this.inlineVideos,privacySetting:this.privacySetting,onSerialize:m=>{Qe(m,this.mirror)&&this.iframeManager.addIframe(m),$i(m,this.mirror)&&this.stylesheetManager.trackLinkElement(m),Oe(a)&&this.shadowDomManager.addShadowRoot(P.shadowRoot(a),this.doc)},onIframeLoad:(m,g)=>{this.iframeManager.attachIframe(m,g),this.shadowDomManager.observeAttachShadow(m)},onStylesheetLoad:(m,g)=>{this.stylesheetManager.attachLinkElement(m,g)},cssCaptured:u});d&&(e.push({parentId:h,nextId:f,node:d}),t.add(d.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const a of this.movedSet)jn(this.removesSubTreeCache,a,this.mirror)&&!this.movedSet.has(P.parentNode(a))||n(a);for(const a of this.addedSet)!Yn(this.droppedSet,a)&&!jn(this.removesSubTreeCache,a,this.mirror)||Yn(this.movedSet,a)?n(a):this.droppedSet.add(a);let o=null;for(;r.length;){let a=null;if(o){const c=this.mirror.getId(P.parentNode(o.value)),u=i(o.value);c!==-1&&u!==-1&&(a=o)}if(!a){let c=r.tail;for(;c;){const u=c;if(c=c.previous,u){const h=this.mirror.getId(P.parentNode(u.value));if(i(u.value)===-1)continue;if(h!==-1){a=u;break}else{const d=u.value,m=P.parentNode(d);if(m&&m.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const g=P.host(m);if(this.mirror.getId(g)!==-1){a=u;break}}}}}}if(!a){for(;r.head;)r.removeNode(r.head.value);break}o=a.previous,r.removeNode(a.value),n(a.value)}const l={texts:this.texts.map(a=>{var c,u;const h=a.node,f=P.parentNode(h);f&&f.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(f);let d=a.value;const m=this.privacySetting==="strict",g=this.privacySetting==="default"&&fo(d),p=(u=(c=a.node)==null?void 0:c.parentElement)==null?void 0:u.getAttribute("data-hl-record");return(m||g)&&!p&&d&&(d=ii(d)),{id:this.mirror.getId(h),value:d}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>{const{attributes:c}=a;if(typeof c.style=="string"){const u=JSON.stringify(a.styleDiff),h=JSON.stringify(a._unchangedStyles);u.length<c.style.length&&(u+h).split("var(").length===c.style.split("var(").length&&(c.style=a.styleDiff)}return{id:this.mirror.getId(a.node),attributes:c}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.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(l))}),w(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));const r=Array.from(P.childNodes(e),i=>P.textContent(i)||"").join("");t.attributes.value=br({overwriteRecord:null,element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:vr(e),value:r,maskInputFn:this.maskInputFn})}),w(this,"processMutation",e=>{if(!gr(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=P.textContent(e.target);!re(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:wo(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,_i(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let r=e.attributeName,i=e.target.getAttribute(r);if(r==="value"){const o=vr(t);i=br({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:o,value:i,overwriteRecord:t.getAttribute("data-hl-record"),maskInputFn:this.maskInputFn})}if(re(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let n=this.attributeMap.get(e.target);if(t.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!t.contentDocument)r="rr_src";else return;if(n||(n={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(e.target,n)),r==="type"&&t.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&t.setAttribute("data-rr-is-password","true"),!yo(t.tagName,r)){if(e.target.tagName==="INPUT"){const l=e.target;if(l.type==="password"){n.attributes.value="*".repeat(l.value.length);break}}if(n.attributes[r]=go(this.doc,Be(t.tagName),Be(r),i),r==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(a){this.unattachedDoc=this.doc}const l=this.unattachedDoc.createElement("span");e.oldValue&&l.setAttribute("style",e.oldValue);for(const a of Array.from(t.style)){const c=t.style.getPropertyValue(a),u=t.style.getPropertyPriority(a);c!==l.style.getPropertyValue(a)||u!==l.style.getPropertyPriority(a)?u===""?n.styleDiff[a]=c:n.styleDiff[a]=[c,u]:n._unchangedStyles[a]=[c,u]}for(const a of Array.from(l.style))t.style.getPropertyValue(a)===""&&(n.styleDiff[a]=!1)}else r==="open"&&t.tagName==="DIALOG"&&(t.matches("dialog:modal")?n.attributes.rr_open_mode="modal":n.attributes.rr_open_mode="non-modal")}break}case"childList":{if(re(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const r=this.mirror.getId(t),i=yt(e.target)?this.mirror.getId(P.host(e.target)):this.mirror.getId(e.target);re(e.target,this.blockClass,this.blockSelector,!1)||gr(t,this.mirror,this.slimDOMOptions)||!Xa(t,this.mirror)||(this.addedSet.has(t)?(Qs(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&r===-1||ki(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Gn(r,i)]?Qs(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:yt(e.target)&&wt(e.target)?!0:void 0}),ep(t,this.removesSubTreeCache))),this.mapRemoves.push(t))});break}}}),w(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(gr(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&r!==-1&&(this.movedMap[Gn(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);re(e,this.blockClass,this.blockSelector,!1)||(P.childNodes(e).forEach(r=>this.genAdds(r)),Oe(e)&&P.childNodes(P.shadowRoot(e)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","inlineVideos","privacySetting","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}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 Qs(s,e){s.delete(e),P.childNodes(e).forEach(t=>Qs(s,t))}function ep(s,e){const t=[s];for(;t.length;){const r=t.pop();e.has(r)||(e.add(r),P.childNodes(r).forEach(i=>t.push(i)))}}function jn(s,e,t){return s.size===0?!1:tp(s,e)}function tp(s,e,t){const r=P.parentNode(e);return r?s.has(r):!1}function Yn(s,e){return s.size===0?!1:el(s,e)}function el(s,e){const t=P.parentNode(e);return t?s.has(t)?!0:el(s,t):!1}let vt;function rp(s){vt=s}function sp(){vt=void 0}const B=s=>vt?(...t)=>{try{return s(...t)}catch(r){if(vt&&vt(r)===!0)return;throw r}}:s,Fe=[];function $t(s){try{if("composedPath"in s){const e=s.composedPath();if(e.length)return e[0]}else if("path"in s&&s.path.length)return s.path[0]}catch(e){}return s&&s.target}function tl(s,e){const t=new qd;Fe.push(t),t.init(s);const r=new(Ha())(B(t.processMutations.bind(t)));return r.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function ip({mousemoveCb:s,sampling:e,doc:t,mirror:r}){if(e.mousemove===!1)return()=>{};const i=typeof e.mousemove=="number"?e.mousemove:50,n=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let o=[],l;const a=nt(B(h=>{const f=Date.now()-l;s(o.map(d=>(d.timeOffset-=f,d)),h),o=[],l=null}),n),c=B(nt(B(h=>{const f=$t(h),{clientX:d,clientY:m}=_r(h)?h.changedTouches[0]:h;l||(l=Tt()),o.push({x:d,y:m,id:r.getId(f),timeOffset:Tt()-l}),a(typeof DragEvent!="undefined"&&h instanceof DragEvent?M.Drag:h instanceof MouseEvent?M.MouseMove:M.TouchMove)}),i,{trailing:!1})),u=[oe("mousemove",c,t),oe("touchmove",c,t),oe("drag",c,t)];return B(()=>{u.forEach(h=>h())})}function np({mouseInteractionCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){if(n.mouseInteraction===!1)return()=>{};const o=n.mouseInteraction===!0||n.mouseInteraction===void 0?{}:n.mouseInteraction,l=[];let a=null;const c=u=>h=>{const f=$t(h);if(re(f,r,i,!0)||Za(f))return;let d=null,m=u;if("pointerType"in h){switch(h.pointerType){case"mouse":d=Se.Mouse;break;case"touch":d=Se.Touch;break;case"pen":d=Se.Pen;break}d===Se.Touch?W[u]===W.MouseDown?m="TouchStart":W[u]===W.MouseUp&&(m="TouchEnd"):Se.Pen}else _r(h)&&(d=Se.Touch);d!==null?(a=d,(m.startsWith("Touch")&&d===Se.Touch||m.startsWith("Mouse")&&d===Se.Mouse)&&(d=null)):W[u]===W.Click&&(d=a,a=null);const g=_r(h)?h.changedTouches[0]:h;if(!g)return;const p=t.getId(f),{clientX:y,clientY:v}=g;B(s)(O({type:W[m],id:p,x:y,y:v},d!==null&&{pointerType:d}))};return Object.keys(W).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&o[u]!==!1).forEach(u=>{let h=Be(u);const f=c(u);if(window.PointerEvent)switch(W[u]){case W.MouseDown:case W.MouseUp:h=h.replace("mouse","pointer");break;case W.TouchStart:case W.TouchEnd:return}l.push(oe(h,f,e))}),B(()=>{l.forEach(u=>u())})}function rl({scrollCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){const o=B(nt(B(l=>{const a=$t(l);if(!a||re(a,r,i,!0))return;const c=t.getId(a);if(a===e&&e.defaultView){const u=Oi(e.defaultView);s({id:c,x:u.left,y:u.top})}else s({id:c,x:a.scrollLeft,y:a.scrollTop})}),n.scroll||100));return oe("scroll",o,e)}function op({viewportResizeCb:s},{win:e}){let t=-1,r=-1;const i=B(nt(B(()=>{const n=Ti(),o=Di();(t!==n||r!==o)&&(s({width:Number(o),height:Number(n)}),t=n,r=o)}),200));return oe("resize",i,e)}const ap=["INPUT","TEXTAREA","SELECT"],Hn=new WeakMap;function lp({inputCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,ignoreClass:n,ignoreSelector:o,maskInputOptions:l,maskInputFn:a,sampling:c,userTriggeredOnInput:u}){function h(v){let b=$t(v);const S=v.isTrusted,C=b&&b.tagName;if(b&&C==="OPTION"&&(b=P.parentElement(b)),!b||!C||ap.indexOf(C)<0||re(b,r,i,!0)||b.classList.contains(n)||o&&b.matches(o))return;let R=b.value,T=!1;const D=vr(b)||"",I=b.getAttribute("data-hl-record");D==="radio"||D==="checkbox"?T=b.checked:po({maskInputOptions:l,type:D,tagName:C,overwriteRecord:I})&&(R=br({element:b,maskInputOptions:l,tagName:C,type:D,value:R,overwriteRecord:I,maskInputFn:a})),f(b,u?{text:R,isChecked:T,userTriggered:S}:{text:R,isChecked:T});const x=b.name;D==="radio"&&x&&T&&e.querySelectorAll(`input[type="radio"][name="${x}"]`).forEach(U=>{if(U!==b){const j=U.value;f(U,u?{text:j,isChecked:!T,userTriggered:!1}:{text:j,isChecked:!T})}})}function f(v,b){const S=Hn.get(v);if(!S||S.text!==b.text||S.isChecked!==b.isChecked){Hn.set(v,b);const C=t.getId(v);B(s)(te(O({},b),{id:C}))}}const m=(c.input==="last"?["change"]:["input","change"]).map(v=>oe(v,B(h),e)),g=e.defaultView;if(!g)return()=>{m.forEach(v=>v())};const p=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value"),y=[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]];return p&&p.set&&m.push(...y.map(v=>Pt(v[0],v[1],{set(){B(h)({target:this,isTrusted:!1})}},!1,g))),B(()=>{m.forEach(v=>v())})}function kr(s){const e=[];function t(r,i){if(lr("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||lr("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||lr("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||lr("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){const o=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(o)}else if(r.parentStyleSheet){const o=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(o)}return i}return t(s,e)}function Ne(s,e,t){let r,i;return s?(s.ownerNode?r=e.getId(s.ownerNode):i=t.getId(s),{styleId:i,id:r}):{}}function cp({styleSheetRuleCb:s,mirror:e,stylesheetManager:t},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:B((u,h,f)=>{const[d,m]=f,{id:g,styleId:p}=Ne(h,e,t.styleMirror);return(g&&g!==-1||p&&p!==-1)&&s({id:g,styleId:p,adds:[{rule:d,index:m}]}),u.apply(h,f)})}),r.CSSStyleSheet.prototype.addRule=function(u,h,f=this.cssRules.length){const d=`${u} { ${h} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[d,f])};const n=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(n,{apply:B((u,h,f)=>{const[d]=f,{id:m,styleId:g}=Ne(h,e,t.styleMirror);return(m&&m!==-1||g&&g!==-1)&&s({id:m,styleId:g,removes:[{index:d}]}),u.apply(h,f)})}),r.CSSStyleSheet.prototype.removeRule=function(u){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let o;r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:B((u,h,f)=>{const[d]=f,{id:m,styleId:g}=Ne(h,e,t.styleMirror);return(m&&m!==-1||g&&g!==-1)&&s({id:m,styleId:g,replace:d}),u.apply(h,f)})}));let l;r.CSSStyleSheet.prototype.replaceSync&&(l=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:B((u,h,f)=>{const[d]=f,{id:m,styleId:g}=Ne(h,e,t.styleMirror);return(m&&m!==-1||g&&g!==-1)&&s({id:m,styleId:g,replaceSync:d}),u.apply(h,f)})}));const a={};cr("CSSGroupingRule")?a.CSSGroupingRule=r.CSSGroupingRule:(cr("CSSMediaRule")&&(a.CSSMediaRule=r.CSSMediaRule),cr("CSSConditionRule")&&(a.CSSConditionRule=r.CSSConditionRule),cr("CSSSupportsRule")&&(a.CSSSupportsRule=r.CSSSupportsRule));const c={};return Object.entries(a).forEach(([u,h])=>{c[u]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(c[u].insertRule,{apply:B((f,d,m)=>{const[g,p]=m,{id:y,styleId:v}=Ne(d.parentStyleSheet,e,t.styleMirror);return(y&&y!==-1||v&&v!==-1)&&s({id:y,styleId:v,adds:[{rule:g,index:[...kr(d),p||0]}]}),f.apply(d,m)})}),h.prototype.deleteRule=new Proxy(c[u].deleteRule,{apply:B((f,d,m)=>{const[g]=m,{id:p,styleId:y}=Ne(d.parentStyleSheet,e,t.styleMirror);return(p&&p!==-1||y&&y!==-1)&&s({id:p,styleId:y,removes:[{index:[...kr(d),g]}]}),f.apply(d,m)})})}),B(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=n,o&&(r.CSSStyleSheet.prototype.replace=o),l&&(r.CSSStyleSheet.prototype.replaceSync=l),Object.entries(a).forEach(([u,h])=>{h.prototype.insertRule=c[u].insertRule,h.prototype.deleteRule=c[u].deleteRule})})}function sl({mirror:s,stylesheetManager:e},t){var r,i,n;let o=null;t.nodeName==="#document"?o=s.getId(t):o=s.getId(P.host(t));const l=t.nodeName==="#document"?(r=t.defaultView)==null?void 0:r.Document:(n=(i=t.ownerDocument)==null?void 0:i.defaultView)==null?void 0:n.ShadowRoot,a=l!=null&&l.prototype?Object.getOwnPropertyDescriptor(l==null?void 0:l.prototype,"adoptedStyleSheets"):void 0;return o===null||o===-1||!l||!a?()=>{}:(Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var c;return(c=a.get)==null?void 0:c.call(this)},set(c){var u;const h=(u=a.set)==null?void 0:u.call(this,c);if(o!==null&&o!==-1)try{e.adoptStyleSheets(c,o)}catch(f){}return h}}),B(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function up({styleDeclarationCb:s,mirror:e,ignoreCSSAttributes:t,stylesheetManager:r},{win:i}){const n=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(n,{apply:B((l,a,c)=>{var u;const[h,f,d]=c;if(t.has(h))return n.apply(a,[h,f,d]);const{id:m,styleId:g}=Ne((u=a.parentRule)==null?void 0:u.parentStyleSheet,e,r.styleMirror);return(m&&m!==-1||g&&g!==-1)&&s({id:m,styleId:g,set:{property:h,value:f,priority:d},index:kr(a.parentRule)}),l.apply(a,c)})});const o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:B((l,a,c)=>{var u;const[h]=c;if(t.has(h))return o.apply(a,[h]);const{id:f,styleId:d}=Ne((u=a.parentRule)==null?void 0:u.parentStyleSheet,e,r.styleMirror);return(f&&f!==-1||d&&d!==-1)&&s({id:f,styleId:d,remove:{property:h},index:kr(a.parentRule)}),l.apply(a,c)})}),B(()=>{i.CSSStyleDeclaration.prototype.setProperty=n,i.CSSStyleDeclaration.prototype.removeProperty=o})}function hp({mediaInteractionCb:s,blockClass:e,blockSelector:t,mirror:r,sampling:i,doc:n}){const o=B(a=>nt(B(c=>{const u=$t(c);if(!u||re(u,e,t,!0))return;const{currentTime:h,volume:f,muted:d,playbackRate:m,loop:g}=u;s({type:a,id:r.getId(u),currentTime:h,volume:f,muted:d,playbackRate:m,loop:g})}),i.media||500)),l=[oe("play",o(Ae.Play),n),oe("pause",o(Ae.Pause),n),oe("seeked",o(Ae.Seeked),n),oe("volumechange",o(Ae.VolumeChange),n),oe("ratechange",o(Ae.RateChange),n)];return B(()=>{l.forEach(a=>a())})}function fp({fontCb:s,doc:e}){const t=e.defaultView;if(!t)return()=>{};const r=[],i=new WeakMap,n=t.FontFace;t.FontFace=function(a,c,u){const h=new n(a,c,u);return i.set(h,{family:a,buffer:typeof c!="string",descriptors:u,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),h};const o=ze(e.fonts,"add",function(l){return function(a){return setTimeout(B(()=>{const c=i.get(a);c&&(s(c),i.delete(a))}),0),l.apply(this,[a])}});return r.push(()=>{t.FontFace=n}),r.push(o),B(()=>{r.forEach(l=>l())})}function dp(s){const{doc:e,mirror:t,blockClass:r,blockSelector:i,selectionCb:n}=s;let o=!0;const l=B(()=>{const a=e.getSelection();if(!a||o&&(a!=null&&a.isCollapsed))return;o=a.isCollapsed||!1;const c=[],u=a.rangeCount||0;for(let h=0;h<u;h++){const f=a.getRangeAt(h),{startContainer:d,startOffset:m,endContainer:g,endOffset:p}=f;re(d,r,i,!0)||re(g,r,i,!0)||c.push({start:t.getId(d),startOffset:m,end:t.getId(g),endOffset:p})}n({ranges:c})});return l(),oe("selectionchange",l)}function pp({doc:s,customElementCb:e}){const t=s.defaultView;return!t||!t.customElements?()=>{}:ze(t.customElements,"define",function(i){return function(n,o,l){try{e({define:{name:n}})}catch(a){console.warn(`Custom element callback failed for ${n}`)}return i.apply(this,[n,o,l])}})}function mp(s,e){const{mutationCb:t,mousemoveCb:r,mouseInteractionCb:i,scrollCb:n,viewportResizeCb:o,inputCb:l,mediaInteractionCb:a,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:h,fontCb:f,selectionCb:d,customElementCb:m}=s;s.mutationCb=(...g)=>{e.mutation&&e.mutation(...g),t(...g)},s.mousemoveCb=(...g)=>{e.mousemove&&e.mousemove(...g),r(...g)},s.mouseInteractionCb=(...g)=>{e.mouseInteraction&&e.mouseInteraction(...g),i(...g)},s.scrollCb=(...g)=>{e.scroll&&e.scroll(...g),n(...g)},s.viewportResizeCb=(...g)=>{e.viewportResize&&e.viewportResize(...g),o(...g)},s.inputCb=(...g)=>{e.input&&e.input(...g),l(...g)},s.mediaInteractionCb=(...g)=>{e.mediaInteaction&&e.mediaInteaction(...g),a(...g)},s.styleSheetRuleCb=(...g)=>{e.styleSheetRule&&e.styleSheetRule(...g),c(...g)},s.styleDeclarationCb=(...g)=>{e.styleDeclaration&&e.styleDeclaration(...g),u(...g)},s.canvasMutationCb=(...g)=>{e.canvasMutation&&e.canvasMutation(...g),h(...g)},s.fontCb=(...g)=>{e.font&&e.font(...g),f(...g)},s.selectionCb=(...g)=>{e.selection&&e.selection(...g),d(...g)},s.customElementCb=(...g)=>{e.customElement&&e.customElement(...g),m(...g)}}function gp(s,e={}){const t=s.doc.defaultView;if(!t)return()=>{};mp(s,e);let r;s.recordDOM&&(r=tl(s,s.doc));const i=ip(s),n=np(s),o=rl(s),l=op(s,{win:t}),a=lp(s),c=hp(s);let u=()=>{},h=()=>{},f=()=>{},d=()=>{};s.recordDOM&&(u=cp(s,{win:t}),h=sl(s,s.doc),f=up(s,{win:t}),s.collectFonts&&(d=fp(s)));const m=dp(s),g=pp(s),p=[];for(const y of s.plugins)p.push(y.observer(y.callback,t,y.options));return B(()=>{Fe.forEach(y=>y.reset()),r==null||r.disconnect(),i(),n(),o(),l(),a(),c(),u(),h(),f(),d(),m(),g(),p.forEach(y=>y())})}function lr(s){return typeof window[s]!="undefined"}function cr(s){return!!(typeof window[s]!="undefined"&&window[s].prototype&&"insertRule"in window[s].prototype&&"deleteRule"in window[s].prototype)}class Zn{constructor(e){w(this,"iframeIdToRemoteIdMap",new WeakMap),w(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){const n=r||this.getIdToRemoteIdMap(e),o=i||this.getRemoteIdToIdMap(e);let l=n.get(t);return l||(l=this.generateIdFn(),n.set(t,l),o.set(l,t)),l}getIds(e,t){const r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map(n=>this.getId(e,n,r,i))}getRemoteId(e,t,r){const i=r||this.getRemoteIdToIdMap(e);if(typeof t!="number")return t;const n=i.get(t);return n||-1}getRemoteIds(e,t){const r=this.getRemoteIdToIdMap(e);return t.map(i=>this.getRemoteId(e,i,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class yp{constructor(e){w(this,"iframes",new WeakMap),w(this,"crossOriginIframeMap",new WeakMap),w(this,"crossOriginIframeMirror",new Zn(mo)),w(this,"crossOriginIframeStyleMirror"),w(this,"crossOriginIframeRootIdMap",new WeakMap),w(this,"mirror"),w(this,"mutationCb"),w(this,"wrappedEmit"),w(this,"loadListener"),w(this,"stylesheetManager"),w(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Zn(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var r,i;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=e.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if(t.data.type!=="rrweb"||t.origin!==t.data.origin)return;const r=e.source;if(!r)return;const i=this.crossOriginIframeMap.get(r);if(!i)return;const n=this.transformCrossOriginEvent(i,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){var r;switch(t.type){case A.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),{timestamp:t.timestamp,type:A.IncrementalSnapshot,data:{source:M.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case A.Meta:case A.Load:case A.DomContentLoaded:return!1;case A.Plugin:return t;case A.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case A.IncrementalSnapshot:switch(t.data.source){case M.Mutation:return t.data.adds.forEach(i=>{this.replaceIds(i,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(i.node,n)}),t.data.removes.forEach(i=>{this.replaceIds(i,e,["parentId","id"])}),t.data.attributes.forEach(i=>{this.replaceIds(i,e,["id"])}),t.data.texts.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case M.Drag:case M.TouchMove:case M.MouseMove:return t.data.positions.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case M.ViewportResize:return!1;case M.MediaInteraction:case M.MouseInteraction:case M.Scroll:case M.CanvasMutation:case M.Input:return this.replaceIds(t.data,e,["id"]),t;case M.StyleSheetRule:case M.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case M.Font:return t;case M.Selection:return t.data.ranges.forEach(i=>{this.replaceIds(i,e,["start","end"])}),t;case M.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),(r=t.data.styles)==null||r.forEach(i=>{this.replaceStyleIds(i,e,["styleId"])}),t}}return!1}replace(e,t,r,i){for(const n of i)!Array.isArray(t[n])&&typeof t[n]!="number"||(Array.isArray(t[n])?t[n]=e.getIds(r,t[n]):t[n]=e.getId(r,t[n]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,t)})}patchRootIdOnNode(e,t){e.type!==Ce.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}}class wp{constructor(e){w(this,"shadowDoms",new WeakSet),w(this,"mutationCb"),w(this,"scrollCb"),w(this,"bypassOptions"),w(this,"mirror"),w(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!wt(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);const r=tl(te(O({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(rl(te(O({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(P.host(e))),this.restoreHandlers.push(sl({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const r=this;this.restoreHandlers.push(ze(e.prototype,"attachShadow",function(i){return function(n){const o=i.call(this,n),l=P.shadowRoot(this);return l&&Wi(this)&&r.addShadowRoot(l,t),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}var Je="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gt=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(var ur=0;ur<Je.length;ur++)gt[Je.charCodeAt(ur)]=ur;var bp=function(s){var e=new Uint8Array(s),t,r=e.length,i="";for(t=0;t<r;t+=3)i+=Je[e[t]>>2],i+=Je[(e[t]&3)<<4|e[t+1]>>4],i+=Je[(e[t+1]&15)<<2|e[t+2]>>6],i+=Je[e[t+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i},vp=function(s){var e=s.length*.75,t=s.length,r,i=0,n,o,l,a;s[s.length-1]==="="&&(e--,s[s.length-2]==="="&&e--);var c=new ArrayBuffer(e),u=new Uint8Array(c);for(r=0;r<t;r+=4)n=gt[s.charCodeAt(r)],o=gt[s.charCodeAt(r+1)],l=gt[s.charCodeAt(r+2)],a=gt[s.charCodeAt(r+3)],u[i++]=n<<2|o>>4,u[i++]=(o&15)<<4|l>>2,u[i++]=(l&3)<<6|a&63;return c};const Xn=new Map;function Sp(s,e){let t=Xn.get(s);return t||(t=new Map,Xn.set(s,t)),t.has(e)||t.set(e,[]),t.get(e)}const il=(s,e,t)=>{if(!s||!(ol(s,e)||typeof s=="object"))return;const r=s.constructor.name,i=Sp(t,r);let n=i.indexOf(s);return n===-1&&(n=i.length,i.push(s)),n};function yr(s,e,t){if(s instanceof Array)return s.map(r=>yr(r,e,t));if(s===null)return s;if(s instanceof Float32Array||s instanceof Float64Array||s instanceof Int32Array||s instanceof Uint32Array||s instanceof Uint8Array||s instanceof Uint16Array||s instanceof Int16Array||s instanceof Int8Array||s instanceof Uint8ClampedArray)return{rr_type:s.constructor.name,args:[Object.values(s)]};if(s instanceof ArrayBuffer){const r=s.constructor.name,i=bp(s);return{rr_type:r,base64:i}}else{if(s instanceof DataView)return{rr_type:s.constructor.name,args:[yr(s.buffer,e,t),s.byteOffset,s.byteLength]};if(s instanceof HTMLImageElement){const r=s.constructor.name,{src:i}=s;return{rr_type:r,src:i}}else if(s instanceof HTMLCanvasElement){const r="HTMLImageElement",i=s.toDataURL();return{rr_type:r,src:i}}else{if(s instanceof ImageData)return{rr_type:s.constructor.name,args:[yr(s.data,e,t),s.width,s.height]};if(ol(s,e)||typeof s=="object"){const r=s.constructor.name,i=il(s,e,t);return{rr_type:r,index:i}}}}return s}const nl=(s,e,t)=>s.map(r=>yr(r,e,t)),ol=(s,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof e[i]=="function").find(i=>s instanceof e[i]);function Cp(s,e,t,r){const i=[],n=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const o of n)try{if(typeof e.CanvasRenderingContext2D.prototype[o]!="function")continue;const l=ze(e.CanvasRenderingContext2D.prototype,o,function(a){return function(...c){return re(this.canvas,t,r,!0)||setTimeout(()=>{const u=nl(c,e,this);s(this.canvas,{type:xe["2D"],property:o,args:u})},0),a.apply(this,c)}});i.push(l)}catch(l){const a=Pt(e.CanvasRenderingContext2D.prototype,o,{set(c){s(this.canvas,{type:xe["2D"],property:o,args:[c],setter:!0})}});i.push(a)}return()=>{i.forEach(o=>o())}}function Ip(s){return s==="experimental-webgl"?"webgl":s}function Jn(s,e,t,r){const i=[];try{const n=ze(s.HTMLCanvasElement.prototype,"getContext",function(o){return function(l,...a){if(!re(this,e,t,!0)){const c=Ip(l);if("__context"in this||(this.__context=c),r&&["webgl","webgl2"].includes(c))if(a[0]&&typeof a[0]=="object"){const u=a[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return o.apply(this,[l,...a])}});i.push(n)}catch(n){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(n=>n())}}function Kn(s,e,t,r,i,n){const o=[],l=Object.getOwnPropertyNames(s);for(const a of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof s[a]!="function")continue;const c=ze(s,a,function(u){return function(...h){const f=u.apply(this,h);if(il(f,n,this),"tagName"in this.canvas&&!re(this.canvas,r,i,!0)){const d=nl(h,n,this),m={type:e,property:a,args:d};t(this.canvas,m)}return f}});o.push(c)}catch(c){const u=Pt(s,a,{set(h){t(this.canvas,{type:e,property:a,args:[h],setter:!0})}});o.push(u)}return o}function Ep(s,e,t,r){const i=[];return i.push(...Kn(e.WebGLRenderingContext.prototype,xe.WebGL,s,t,r,e)),typeof e.WebGL2RenderingContext!="undefined"&&i.push(...Kn(e.WebGL2RenderingContext.prototype,xe.WebGL2,s,t,r,e)),()=>{i.forEach(n=>n())}}const al="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIGxldCBsb2dEZWJ1ZyA9IGZhbHNlOwogIGNvbnN0IGRlYnVnID0gKC4uLmFyZ3MpID0+IHsKICAgIGlmIChsb2dEZWJ1ZykgewogICAgICBjb25zb2xlLmRlYnVnKC4uLmFyZ3MpOwogICAgfQogIH07CiAgd29ya2VyLm9ubWVzc2FnZSA9IGFzeW5jIGZ1bmN0aW9uKGUpIHsKICAgIGxvZ0RlYnVnID0gISFlLmRhdGEubG9nRGVidWc7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGR4LCBkeSwgZHcsIGRoLCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOwogICAgICBjb25zdCB0cmFuc3BhcmVudEJhc2U2NCA9IGdldFRyYW5zcGFyZW50QmxvYkZvcigKICAgICAgICB3aWR0aCwKICAgICAgICBoZWlnaHQsCiAgICAgICAgZGF0YVVSTE9wdGlvbnMKICAgICAgKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgY29uc3QgY3R4ID0gb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwLCB3aWR0aCwgaGVpZ2h0KTsKICAgICAgYml0bWFwLmNsb3NlKCk7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgYXdhaXQgdHJhbnNwYXJlbnRCYXNlNjQgPT09IGJhc2U2NCkgewogICAgICAgIGRlYnVnKCJbaGlnaGxpZ2h0LXdvcmtlcl0gY2FudmFzIGJpdG1hcCBpcyB0cmFuc3BhcmVudCIsIHsKICAgICAgICAgIGlkLAogICAgICAgICAgYmFzZTY0CiAgICAgICAgfSk7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCwgc3RhdHVzOiAidHJhbnNwYXJlbnQiIH0pOwogICAgICB9CiAgICAgIGlmIChsYXN0QmxvYk1hcC5nZXQoaWQpID09PSBiYXNlNjQpIHsKICAgICAgICBkZWJ1ZygiW2hpZ2hsaWdodC13b3JrZXJdIGNhbnZhcyBiaXRtYXAgaXMgdW5jaGFuZ2VkIiwgewogICAgICAgICAgaWQsCiAgICAgICAgICBiYXNlNjQKICAgICAgICB9KTsKICAgICAgfQogICAgICBjb25zdCBtc2cgPSB7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0LAogICAgICAgIGR4LAogICAgICAgIGR5LAogICAgICAgIGR3LAogICAgICAgIGRoCiAgICAgIH07CiAgICAgIGRlYnVnKCJbaGlnaGxpZ2h0LXdvcmtlcl0gY2FudmFzIGJpdG1hcCBwcm9jZXNzZWQiLCBtc2cpOwogICAgICB3b3JrZXIucG9zdE1lc3NhZ2UobXNnKTsKICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgfSBlbHNlIHsKICAgICAgZGVidWcoIltoaWdobGlnaHQtd29ya2VyXSBubyBvZmZzY3JlZW5jYW52YXMgc3VwcG9ydCIsIHsKICAgICAgICBpZDogZS5kYXRhLmlkCiAgICAgIH0pOwogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCwgc3RhdHVzOiAidW5zdXBwb3J0ZWQiIH0pOwogICAgfQogIH07Cn0pKCk7Ci8vIyBzb3VyY2VNYXBwaW5nVVJMPWltYWdlLWJpdG1hcC1kYXRhLXVybC13b3JrZXItRHd0SzhBMHouanMubWFwCg==",xp=s=>Uint8Array.from(atob(s),e=>e.charCodeAt(0)),Qn=typeof self!="undefined"&&self.Blob&&new Blob([xp(al)],{type:"text/javascript;charset=utf-8"});function Mp(s){let e;try{if(e=Qn&&(self.URL||self.webkitURL).createObjectURL(Qn),!e)throw"";const t=new Worker(e,{name:s==null?void 0:s.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),t}catch(t){return new Worker("data:text/javascript;base64,"+al,{name:s==null?void 0:s.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}class Rp{constructor(e){w(this,"pendingCanvasMutations",new Map),w(this,"rafStamps",{latestId:0,invokeId:null}),w(this,"mirror"),w(this,"logger"),w(this,"worker"),w(this,"snapshotInProgressMap",new Map),w(this,"lastSnapshotTime",new Map),w(this,"options"),w(this,"mutationCb"),w(this,"resetObservers"),w(this,"frozen",!1),w(this,"locked",!1),w(this,"processMutation",(h,f)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(h)||this.pendingCanvasMutations.set(h,[]),this.pendingCanvasMutations.get(h).push(f)});const{sampling:t,win:r,blockClass:i,blockSelector:n,recordCanvas:o,recordLocalVideos:l,recordRemoteVideos:a,initialSnapshotDelay:c,dataURLOptions:u}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,this.logger=e.logger,this.worker=new Mp,this.worker.onmessage=h=>{const{id:f}=h.data;if(this.snapshotInProgressMap.set(f,!1),!("base64"in h.data)){this.debug(null,"canvas worker received empty message",{id:f,data:h.data,status:h.data.status});return}const{base64:d,type:m,dx:g,dy:p,dw:y,dh:v}=h.data,b={id:f,type:xe["2D"],commands:[{property:"clearRect",args:[g,p,y,v]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:d}],type:m}]},g,p,y,v]}]};this.debug(null,"canvas worker recording mutation",b),this.mutationCb(b)},this.options=e,o&&t==="all"?(this.debug(null,"initializing canvas mutation observer",{sampling:t}),this.initCanvasMutationObserver(r,i,n)):o&&typeof t=="number"&&(this.debug(null,"initializing canvas fps observer",{sampling:t}),this.initCanvasFPSObserver(l,a,t,r,i,n,{initialSnapshotDelay:c,dataURLOptions:u},e.resizeFactor,e.maxSnapshotDimension))}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}debug(e,...t){if(!this.logger)return;const r=this.mirror.getId(e);let i="[highlight-canvas-manager]";e&&(i=`[highlight-canvas] [id:${r}]`,e.tagName.toLowerCase()==="canvas"&&(i+=` [ctx:${e.__context}]`)),this.logger.debug(i,e,...t)}async snapshot(e){var t;const r=this.mirror.getId(e);if(this.snapshotInProgressMap.get(r)){this.debug(e,"snapshotting already in progress for",r);return}const i=1e3/(typeof this.options.samplingManual=="number"?this.options.samplingManual:1),n=this.lastSnapshotTime.get(r);if(!(n&&new Date().getTime()-n<i)){if(this.debug(e,"starting snapshotting"),e.width===0||e.height===0){this.debug(e,"not yet ready",{width:e.width,height:e.height});return}this.lastSnapshotTime.set(r,new Date().getTime()),this.snapshotInProgressMap.set(r,!0);try{if(this.options.clearWebGLBuffer!==!1&&["webgl","webgl2"].includes(e.__context)){const u=e.getContext(e.__context);((t=u==null?void 0:u.getContextAttributes())==null?void 0:t.preserveDrawingBuffer)===!1&&(u.clear(u.COLOR_BUFFER_BIT),this.debug(e,"cleared webgl canvas to load it into memory",{attributes:u==null?void 0:u.getContextAttributes()}))}if(e.width===0||e.height===0){this.debug(e,"not yet ready",{width:e.width,height:e.height});return}let o=this.options.resizeFactor||1;if(this.options.maxSnapshotDimension){const u=Math.max(e.width,e.height);o=Math.min(o,this.options.maxSnapshotDimension/u)}const l=e.width*o,a=e.height*o,c=await createImageBitmap(e,{resizeWidth:l,resizeHeight:a});this.debug(e,"created image bitmap",{width:c.width,height:c.height}),this.worker.postMessage({id:r,bitmap:c,width:l,height:a,dx:0,dy:0,dw:e.width,dh:e.height,dataURLOptions:this.options.dataURLOptions,logDebug:!!this.logger},[c]),this.debug(e,"sent message")}catch(o){this.debug(e,"failed to snapshot",o)}finally{this.snapshotInProgressMap.set(r,!1)}}}initCanvasFPSObserver(e,t,r,i,n,o,l,a,c){const u=Jn(i,n,o,!0),h=1e3/r;let f=0,d;const m=new Map,g=(b,S)=>{const C=[];b.querySelectorAll(S).forEach(D=>C.push(D));const R=document.createNodeIterator(b,Node.ELEMENT_NODE);let T;for(;T=R.nextNode();)T!=null&&T.shadowRoot&&C.push(...g(T.shadowRoot,S));return C},p=b=>{const S=[];return g(i.document,"canvas").forEach(C=>{if(!re(C,n,o,!0)){this.debug(C,"discovered canvas"),S.push(C);const R=this.mirror.getId(C);m.has(R)||m.set(R,b)}}),S},y=b=>{const S=[];return(e||t)&&g(i.document,"video").forEach(C=>{if(!(!t&&C.src!==""&&C.src.indexOf("blob:")===-1)&&!(!e&&(C.src===""||C.src.indexOf("blob:")!==-1))&&!re(C,n,o,!0)){S.push(C);const R=this.mirror.getId(C);m.has(R)||m.set(R,b)}}),S},v=async b=>{if(f&&b-f<h){d=requestAnimationFrame(v);return}f=b;const S=R=>{const T=this.mirror.getId(R),D=m.get(T),I=!l.initialSnapshotDelay||b-D>l.initialSnapshotDelay;return this.debug(R,{delay:l.initialSnapshotDelay,delta:b-D,hadLoadingTime:I}),I},C=[];C.push(...p(b).filter(S).map(R=>this.snapshot(R))),C.push(...y(b).filter(S).map(async R=>{this.debug(R,"starting video snapshotting");const T=this.mirror.getId(R);if(this.snapshotInProgressMap.get(T)){this.debug(R,"video snapshotting already in progress for",T);return}this.snapshotInProgressMap.set(T,!0);try{const{width:D,height:I}=R.getBoundingClientRect(),{actualWidth:x,actualHeight:U}={actualWidth:R.videoWidth,actualHeight:R.videoHeight},j=Math.max(x,U);if(j===0){this.debug(R,"not yet ready",{width:R.width,height:R.height,actualWidth:x,actualHeight:U,boxWidth:D,boxHeight:I});return}let ee=a||1;c&&(ee=Math.min(ee,c/j));const ae=x*ee,N=U*ee,ce=await createImageBitmap(R,{resizeWidth:ae,resizeHeight:N}),ue=Math.max(D,I)/j,se=x*ue,he=U*ue,J=(D-se)/2,ie=(I-he)/2;this.debug(R,"created image bitmap",{actualWidth:x,actualHeight:U,boxWidth:D,boxHeight:I,outputWidth:se,outputHeight:he,resizeWidth:ae,resizeHeight:N,scale:ee,outputScale:ue,offsetX:J,offsetY:ie}),this.worker.postMessage({id:T,bitmap:ce,width:ae,height:N,dx:J,dy:ie,dw:se,dh:he,dataURLOptions:l.dataURLOptions,logDebug:!!this.logger},[ce]),this.debug(R,"send message")}catch(D){this.debug(R,"failed to snapshot",D)}finally{this.snapshotInProgressMap.set(T,!1)}})),await Promise.all(C).catch(console.error),d=requestAnimationFrame(v)};d=requestAnimationFrame(v),this.resetObservers=()=>{u(),d&&cancelAnimationFrame(d)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=Jn(e,t,r,!1),n=Cp(this.processMutation.bind(this),e,t,r),o=Ep(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{i(),n(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const r=this.pendingCanvasMutations.get(e);if(!r||t===-1)return;const i=r.map(o=>{const c=o,{type:l}=c;return Ve(c,["type"])}),{type:n}=r[0];this.mutationCb({id:t,type:n,commands:i}),this.pendingCanvasMutations.delete(e)}}class Np{constructor(e){w(this,"trackedLinkElements",new WeakSet),w(this,"mutationCb"),w(this,"adoptedStyleSheetCb"),w(this,"styleMirror",new Bi),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;const r={id:t,styleIds:[]},i=[];for(const n of e){let o;this.styleMirror.has(n)?o=this.styleMirror.getId(n):(o=this.styleMirror.add(n),i.push({styleId:o,rules:Array.from(n.rules||CSSRule,(l,a)=>({rule:uo(l,n.href),index:a}))})),r.styleIds.push(o)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class Ap{constructor(){w(this,"nodeMap",new WeakMap),w(this,"active",!1)}inOtherBuffer(e,t){const r=this.nodeMap.get(e);return r&&Array.from(r).some(i=>i!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}}let q,wr,St,Lr=!1;try{if(Array.from([1],s=>s*2)[0]!==2){const s=document.createElement("iframe");document.body.appendChild(s),Array.from=((Xi=s.contentWindow)==null?void 0:Xi.Array.from)||Array.from,document.body.removeChild(s)}}catch(s){console.debug("Unable to override Array.from",s)}const de=ho();function Me(s={}){var e,t,r,i,n,o,l,a;const{emit:c,checkoutEveryNms:u,checkoutEveryNth:h,blockClass:f="highlight-block",blockSelector:d=null,ignoreClass:m="highlight-ignore",ignoreSelector:g=null,maskTextClass:p="highlight-mask",maskTextSelector:y=null,inlineStylesheet:v=!0,maskAllInputs:b,maskInputOptions:S,slimDOMOptions:C,maskInputFn:R,maskTextFn:T=ii,hooks:D,packFn:I,sampling:x={},mousemoveWait:U,recordDOM:j=!0,recordCanvas:ee=!1,recordCrossOriginIframes:ae=!1,recordAfter:N=s.recordAfter==="DOMContentLoaded"?s.recordAfter:"load",userTriggeredOnInput:ce=!1,collectFonts:ue=!1,inlineImages:se=!1,inlineVideos:he=!1,plugins:J,keepIframeSrcFn:ie=()=>!1,privacySetting:ke="default",ignoreCSSAttributes:Re=new Set([]),errorHandler:pl,logger:ml}=s,Ft=O(O({},s.dataURLOptions),(t=(e=s.sampling)==null?void 0:e.canvas)==null?void 0:t.dataURLOptions);rp(pl);const Bt=ae?window.parent===window:!0;let at=!1;if(!Bt)try{window.parent.document&&(at=!1)}catch(z){at=!0}if(Bt&&!c)throw new Error("emit function is required");if(!Bt&&!at)return()=>{};U!==void 0&&x.mousemove===void 0&&(x.mousemove=U),de.reset();const Jr=b===!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}:S!==void 0?S:{password:!0},Kr=C===!0||C==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:C==="all",headMetaDescKeywords:C==="all",headTitleMutations:C==="all"}:C||{};Li();let zi,Qr=0;const Vi=z=>{for(const fe of J||[])fe.eventProcessor&&(z=fe.eventProcessor(z));return I&&!at&&(z=I(z)),z};q=(z,fe)=>{var K;const Q=z;if(Q.timestamp=Tt(),(K=Fe[0])!=null&&K.isFrozen()&&Q.type!==A.FullSnapshot&&!(Q.type===A.IncrementalSnapshot&&Q.data.source===M.Mutation)&&Fe.forEach(ye=>ye.unfreeze()),Bt)c==null||c(Vi(Q),fe);else if(at){const ye={type:"rrweb",event:Vi(Q),origin:window.location.origin,isCheckout:fe};window.parent.postMessage(ye,"*")}if(Q.type===A.FullSnapshot)zi=Q,Qr=0;else if(Q.type===A.IncrementalSnapshot){if(Q.data.source===M.Mutation&&Q.data.isAttachIframe)return;Qr++;const ye=h&&Qr>=h,Y=u&&Q.timestamp-zi.timestamp>u;(ye||Y)&&wr(!0)}};const Ut=z=>{q({type:A.IncrementalSnapshot,data:O({source:M.Mutation},z)})},Gi=z=>q({type:A.IncrementalSnapshot,data:O({source:M.Scroll},z)}),ji=z=>q({type:A.IncrementalSnapshot,data:O({source:M.CanvasMutation},z)}),gl=z=>q({type:A.IncrementalSnapshot,data:O({source:M.AdoptedStyleSheet},z)}),Le=new Np({mutationCb:Ut,adoptedStyleSheetCb:gl}),Pe=new yp({mirror:de,mutationCb:Ut,stylesheetManager:Le,recordCrossOriginIframes:ae,wrappedEmit:q});for(const z of J||[])z.getMirror&&z.getMirror({nodeMirror:de,crossOriginIframeMirror:Pe.crossOriginIframeMirror,crossOriginIframeStyleMirror:Pe.crossOriginIframeStyleMirror});const qr=new Ap;St=new Rp({recordCanvas:ee,recordLocalVideos:se,recordRemoteVideos:he,mutationCb:ji,win:window,blockClass:f,blockSelector:d,mirror:de,sampling:(r=x==null?void 0:x.canvas)==null?void 0:r.fps,samplingManual:(i=x==null?void 0:x.canvas)==null?void 0:i.fpsManual,clearWebGLBuffer:(n=x==null?void 0:x.canvas)==null?void 0:n.clearWebGLBuffer,initialSnapshotDelay:(o=x==null?void 0:x.canvas)==null?void 0:o.initialSnapshotDelay,dataURLOptions:Ft,resizeFactor:(l=x==null?void 0:x.canvas)==null?void 0:l.resizeFactor,maxSnapshotDimension:(a=x==null?void 0:x.canvas)==null?void 0:a.maxSnapshotDimension,logger:ml});const Wt=new wp({mutationCb:Ut,scrollCb:Gi,bypassOptions:{blockClass:f,blockSelector:d,maskTextClass:p,maskTextSelector:y,inlineStylesheet:v,maskInputOptions:Jr,dataURLOptions:Ft,maskTextFn:T,maskInputFn:R,recordCanvas:ee,inlineImages:se,inlineVideos:he,privacySetting:ke,sampling:x,slimDOMOptions:Kr,iframeManager:Pe,stylesheetManager:Le,canvasManager:St,keepIframeSrcFn:ie,processedNodeManager:qr},mirror:de});wr=(z=!1)=>{if(!j)return;q({type:A.Meta,data:{href:window.location.href,width:Di(),height:Ti()}},z),Le.reset(),Wt.init(),Fe.forEach(K=>K.lock());const fe=vc(document,{mirror:de,blockClass:f,blockSelector:d,maskTextClass:p,maskTextSelector:y,inlineStylesheet:v,maskAllInputs:Jr,maskTextFn:T,maskInputFn:R,slimDOM:Kr,dataURLOptions:Ft,recordCanvas:ee,inlineImages:se,inlineVideos:he,privacySetting:ke,onSerialize:K=>{Qe(K,de)&&Pe.addIframe(K),$i(K,de)&&Le.trackLinkElement(K),Oe(K)&&Wt.addShadowRoot(P.shadowRoot(K),document)},onIframeLoad:(K,Q)=>{Pe.attachIframe(K,Q),Wt.observeAttachShadow(K)},onStylesheetLoad:(K,Q)=>{Le.attachLinkElement(K,Q)},keepIframeSrcFn:ie});if(!fe)return console.warn("Failed to snapshot the document");q({type:A.FullSnapshot,data:{node:fe,initialOffset:Oi(window)}},z),Fe.forEach(K=>K.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Le.adoptStyleSheets(document.adoptedStyleSheets,de.getId(document))};try{const z=[],fe=Q=>{var ye;return B(gp)({mutationCb:Ut,mousemoveCb:(Y,es)=>q({type:A.IncrementalSnapshot,data:{source:es,positions:Y}}),mouseInteractionCb:Y=>q({type:A.IncrementalSnapshot,data:O({source:M.MouseInteraction},Y)}),scrollCb:Gi,viewportResizeCb:Y=>q({type:A.IncrementalSnapshot,data:O({source:M.ViewportResize},Y)}),inputCb:Y=>q({type:A.IncrementalSnapshot,data:O({source:M.Input},Y)}),mediaInteractionCb:Y=>q({type:A.IncrementalSnapshot,data:O({source:M.MediaInteraction},Y)}),styleSheetRuleCb:Y=>q({type:A.IncrementalSnapshot,data:O({source:M.StyleSheetRule},Y)}),styleDeclarationCb:Y=>q({type:A.IncrementalSnapshot,data:O({source:M.StyleDeclaration},Y)}),canvasMutationCb:ji,fontCb:Y=>q({type:A.IncrementalSnapshot,data:O({source:M.Font},Y)}),selectionCb:Y=>{q({type:A.IncrementalSnapshot,data:O({source:M.Selection},Y)})},customElementCb:Y=>{q({type:A.IncrementalSnapshot,data:O({source:M.CustomElement},Y)})},blockClass:f,ignoreClass:m,ignoreSelector:g,maskTextClass:p,maskTextSelector:y,maskInputOptions:Jr,inlineStylesheet:v,sampling:x,recordDOM:j,recordCanvas:ee,inlineImages:se,inlineVideos:he,userTriggeredOnInput:ce,collectFonts:ue,doc:Q,maskInputFn:R,maskTextFn:T,keepIframeSrcFn:ie,blockSelector:d,slimDOMOptions:Kr,dataURLOptions:Ft,mirror:de,iframeManager:Pe,stylesheetManager:Le,shadowDomManager:Wt,processedNodeManager:qr,canvasManager:St,ignoreCSSAttributes:Re,privacySetting:ke,plugins:((ye=J==null?void 0:J.filter(Y=>Y.observer))==null?void 0:ye.map(Y=>({observer:Y.observer,options:Y.options,callback:es=>q({type:A.Plugin,data:{plugin:Y.name,payload:es}})})))||[]},D)};Pe.addLoadListener(Q=>{try{z.push(fe(Q.contentDocument))}catch(ye){console.warn(ye)}});const K=()=>{wr(),z.push(fe(document)),Lr=!0};return document.readyState==="interactive"||document.readyState==="complete"?K():(z.push(oe("DOMContentLoaded",()=>{q({type:A.DomContentLoaded,data:{}}),N==="DOMContentLoaded"&&K()})),z.push(oe("load",()=>{q({type:A.Load,data:{}}),N==="load"&&K()},window))),()=>{z.forEach(Q=>Q()),qr.destroy(),Lr=!1,sp()}}catch(z){console.warn(z)}}Me.addCustomEvent=(s,e)=>{Lr&&q({type:A.Custom,data:{tag:s,payload:e}})};Me.freezePage=()=>{Fe.forEach(s=>s.freeze())};Me.takeFullSnapshot=s=>{if(!Lr)throw new Error("please take full snapshot after start recording");wr(s)};Me.snapshotCanvas=async s=>{if(!St)throw new Error("canvas manager is not initialized");await St.snapshot(s)};Me.mirror=de;function ll(s){return{all:s=s||new Map,on:function(e,t){var r=s.get(e);r?r.push(t):s.set(e,[t])},off:function(e,t){var r=s.get(e);r&&(t?r.splice(r.indexOf(t)>>>0,1):s.set(e,[]))},emit:function(e,t){var r=s.get(e);r&&r.slice().map(function(i){i(t)}),(r=s.get("*"))&&r.slice().map(function(i){i(e,t)})}}}const Op=Object.freeze(Object.defineProperty({__proto__:null,default:ll},Symbol.toStringTag,{value:"Module"}));function Tp(s=window,e=document){if("scrollBehavior"in e.documentElement.style&&s.__forceSmoothScrollPolyfill__!==!0)return;const t=s.HTMLElement||s.Element,r=468,i={scroll:s.scroll||s.scrollTo,scrollBy:s.scrollBy,elementScroll:t.prototype.scroll||a,scrollIntoView:t.prototype.scrollIntoView},n=s.performance&&s.performance.now?s.performance.now.bind(s.performance):Date.now;function o(y){const v=["MSIE ","Trident/","Edge/"];return new RegExp(v.join("|")).test(y)}const l=o(s.navigator.userAgent)?1:0;function a(y,v){this.scrollLeft=y,this.scrollTop=v}function c(y){return .5*(1-Math.cos(Math.PI*y))}function u(y){if(y===null||typeof y!="object"||y.behavior===void 0||y.behavior==="auto"||y.behavior==="instant")return!0;if(typeof y=="object"&&y.behavior==="smooth")return!1;throw new TypeError("behavior member of ScrollOptions "+y.behavior+" is not a valid value for enumeration ScrollBehavior.")}function h(y,v){if(v==="Y")return y.clientHeight+l<y.scrollHeight;if(v==="X")return y.clientWidth+l<y.scrollWidth}function f(y,v){const b=s.getComputedStyle(y,null)["overflow"+v];return b==="auto"||b==="scroll"}function d(y){const v=h(y,"Y")&&f(y,"Y"),b=h(y,"X")&&f(y,"X");return v||b}function m(y){for(;y!==e.body&&d(y)===!1;)y=y.parentNode||y.host;return y}function g(y){const v=n();let b,S,C,R=(v-y.startTime)/r;R=R>1?1:R,b=c(R),S=y.startX+(y.x-y.startX)*b,C=y.startY+(y.y-y.startY)*b,y.method.call(y.scrollable,S,C),(S!==y.x||C!==y.y)&&s.requestAnimationFrame(g.bind(s,y))}function p(y,v,b){let S,C,R,T;const D=n();y===e.body?(S=s,C=s.scrollX||s.pageXOffset,R=s.scrollY||s.pageYOffset,T=i.scroll):(S=y,C=y.scrollLeft,R=y.scrollTop,T=a),g({scrollable:S,method:T,startTime:D,startX:C,startY:R,x:v,y:b})}s.scroll=s.scrollTo=function(){if(arguments[0]!==void 0){if(u(arguments[0])===!0){i.scroll.call(s,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:s.scrollX||s.pageXOffset,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:s.scrollY||s.pageYOffset);return}p.call(s,e.body,arguments[0].left!==void 0?~~arguments[0].left:s.scrollX||s.pageXOffset,arguments[0].top!==void 0?~~arguments[0].top:s.scrollY||s.pageYOffset)}},s.scrollBy=function(){if(arguments[0]!==void 0){if(u(arguments[0])){i.scrollBy.call(s,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:0,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:0);return}p.call(s,e.body,~~arguments[0].left+(s.scrollX||s.pageXOffset),~~arguments[0].top+(s.scrollY||s.pageYOffset))}},t.prototype.scroll=t.prototype.scrollTo=function(){if(arguments[0]===void 0)return;if(u(arguments[0])===!0){if(typeof arguments[0]=="number"&&arguments[1]===void 0)throw new SyntaxError("Value could not be converted");i.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left:typeof arguments[0]!="object"?~~arguments[0]:this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top:arguments[1]!==void 0?~~arguments[1]:this.scrollTop);return}const y=arguments[0].left,v=arguments[0].top;p.call(this,this,typeof y=="undefined"?this.scrollLeft:~~y,typeof v=="undefined"?this.scrollTop:~~v)},t.prototype.scrollBy=function(){if(arguments[0]!==void 0){if(u(arguments[0])===!0){i.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop);return}this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior})}},t.prototype.scrollIntoView=function(){if(u(arguments[0])===!0){i.scrollIntoView.call(this,arguments[0]===void 0?!0:arguments[0]);return}const y=m(this),v=y.getBoundingClientRect(),b=this.getBoundingClientRect();y!==e.body?(p.call(this,y,y.scrollLeft+b.left-v.left,y.scrollTop+b.top-v.top),s.getComputedStyle(y).position!=="fixed"&&s.scrollBy({left:v.left,top:v.top,behavior:"smooth"})):s.scrollBy({left:b.left,top:b.top,behavior:"smooth"})}}class Dp{constructor(e=[],t){w(this,"timeOffset",0),w(this,"speed"),w(this,"actions"),w(this,"raf",null),w(this,"lastTimestamp"),this.actions=e,this.speed=t.speed}addAction(e){const t=this.raf===!0;if(!this.actions.length||this.actions[this.actions.length-1].delay<=e.delay)this.actions.push(e);else{const r=this.findActionIndex(e);this.actions.splice(r,0,e)}t&&(this.raf=requestAnimationFrame(this.rafCheck.bind(this)))}addActions(e){this.actions=this.actions.concat(e)}replaceActions(e){this.actions.length=0,this.actions.splice(0,0,...e)}start(){this.timeOffset=0,this.lastTimestamp=performance.now(),this.raf=requestAnimationFrame(this.rafCheck.bind(this))}rafCheck(){const e=performance.now();for(this.timeOffset+=(e-this.lastTimestamp)*this.speed,this.lastTimestamp=e;this.actions.length;){const t=this.actions[0];if(this.timeOffset>=t.delay)this.actions.shift(),t.doAction();else break}this.actions.length>0?this.raf=requestAnimationFrame(this.rafCheck.bind(this)):this.raf=!0}clear(){this.raf&&(this.raf!==!0&&cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(e){this.speed=e}isActive(){return this.raf!==null}findActionIndex(e){let t=0,r=this.actions.length-1;for(;t<=r;){const i=Math.floor((t+r)/2);if(this.actions[i].delay<e.delay)t=i+1;else if(this.actions[i].delay>e.delay)r=i-1;else return i+1}return t}}function ds(s,e){if(s.type===A.IncrementalSnapshot&&s.data.source===M.MouseMove&&s.data.positions&&s.data.positions.length){const t=s.data.positions[0].timeOffset,r=s.timestamp+t;return s.delay=r-e,r-e}return s.delay=s.timestamp-e,s.delay}/*! *****************************************************************************
71
+ or you can use record.mirror to access the mirror instance during recording.`;exports.mirror={map:{},getId(){return console.error(Ye),-1},getNode(){return console.error(Ye),null},removeNodeFromMap(){console.error(Ye)},has(){return console.error(Ye),!1},reset(){console.error(Ye)}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(exports.mirror=new Proxy(exports.mirror,{get(s,e,t){return e==="map"&&console.error(Ye),Reflect.get(s,e,t)}}));function nt(s,e,t={}){let r=null,i=0;return function(...n){const o=Date.now();!i&&t.leading===!1&&(i=o);const l=e-(o-i),a=this;l<=0||l>e?(r&&(clearTimeout(r),r=null),i=o,s.apply(a,n)):!r&&t.trailing!==!1&&(r=setTimeout(()=>{i=t.leading===!1?0:Date.now(),r=null,s.apply(a,n)},l))}}function Pt(s,e,t,r,i=window){const n=i.Object.getOwnPropertyDescriptor(s,e);return i.Object.defineProperty(s,e,r?t:{set(o){setTimeout(()=>{t.set.call(this,o)},0),n&&n.set&&n.set.call(this,o)}}),()=>Pt(s,e,n||{},!0)}let Tt=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Tt=()=>new Date().getTime());function Oi(s){var e,t,r,i;const n=s.document;return{left:n.scrollingElement?n.scrollingElement.scrollLeft:s.pageXOffset!==void 0?s.pageXOffset:n.documentElement.scrollLeft||(n==null?void 0:n.body)&&((e=P.parentElement(n.body))==null?void 0:e.scrollLeft)||((t=n==null?void 0:n.body)==null?void 0:t.scrollLeft)||0,top:n.scrollingElement?n.scrollingElement.scrollTop:s.pageYOffset!==void 0?s.pageYOffset:(n==null?void 0:n.documentElement.scrollTop)||(n==null?void 0:n.body)&&((r=P.parentElement(n.body))==null?void 0:r.scrollTop)||((i=n==null?void 0:n.body)==null?void 0:i.scrollTop)||0}}function Ti(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Di(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function _i(s){return s?s.nodeType===s.ELEMENT_NODE?s:P.parentElement(s):null}const Za=s=>{try{if(s instanceof HTMLElement)return s.tagName==="CANVAS"}catch(e){return!1}return!1};function re(s,e,t,r){if(!s)return!1;const i=_i(s);if(!i)return!1;try{if(typeof e=="string"){if(i.classList.contains(e)||r&&i.closest("."+e)!==null)return!0}else if(Cr(i,e,r))return!0}catch(n){}return!!(t&&(i.matches(t)||r&&i.closest(t)!==null))}function Xa(s,e){return e.getId(s)!==-1}function gr(s,e,t){return s.tagName==="TITLE"&&t.headTitleMutations?!0:e.getId(s)===Ct}function ki(s,e){if(yt(s))return!1;const t=e.getId(s);if(!e.has(t))return!0;const r=P.parentNode(s);return r&&r.nodeType===s.DOCUMENT_NODE?!1:r?ki(r,e):!0}function _r(s){return!!s.changedTouches}function Li(s=window){"NodeList"in s&&!s.NodeList.prototype.forEach&&(s.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in s&&!s.DOMTokenList.prototype.forEach&&(s.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Ja(s){const e={},t=(i,n)=>{const o={value:i,parent:n,children:[]};return e[i.node.id]=o,o},r=[];for(const i of s){const{nextId:n,parentId:o}=i;if(n&&n in e){const l=e[n];if(l.parent){const a=l.parent.children.indexOf(l);l.parent.children.splice(a,0,t(i,l.parent))}else{const a=r.indexOf(l);r.splice(a,0,t(i,null))}continue}if(o in e){const l=e[o];l.children.push(t(i,l));continue}r.push(t(i,null))}return r}function Pi(s,e){e(s.value);for(let t=s.children.length-1;t>=0;t--)Pi(s.children[t],e)}function Qe(s,e){return!!(s.nodeName==="IFRAME"&&e.getMeta(s))}function $i(s,e){return!!(s.nodeName==="LINK"&&s.nodeType===s.ELEMENT_NODE&&s.getAttribute&&s.getAttribute("rel")==="stylesheet"&&e.getMeta(s))}function Fi(s,e){var t,r;const i=(r=(t=s.ownerDocument)==null?void 0:t.defaultView)==null?void 0:r.frameElement;if(!i||i===e)return{x:0,y:0,relativeScale:1,absoluteScale:1};const n=i.getBoundingClientRect(),o=Fi(i,e),l=n.height/i.clientHeight;return{x:n.x*o.relativeScale+o.x,y:n.y*o.relativeScale+o.y,relativeScale:l,absoluteScale:o.absoluteScale*l}}function Oe(s){return s?s instanceof ge&&"shadowRoot"in s?!!s.shadowRoot:!!P.shadowRoot(s):!1}function Xe(s,e){const t=s[e[0]];return e.length===1?t:Xe(t.cssRules[e[1]].cssRules,e.slice(2))}function Ks(s){const e=[...s],t=e.pop();return{positions:e,index:t}}function Ka(s){const e=new Set,t=[];for(let r=s.length;r--;){const i=s[r];e.has(i.id)||(t.push(i),e.add(i.id))}return t}class Bi{constructor(){w(this,"id",1),w(this,"styleIDMap",new WeakMap),w(this,"idStyleMap",new Map)}getId(e){var t;return(t=this.styleIDMap.get(e))!=null?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return t===void 0?r=this.id++:r=t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function Ui(s){var e;let t=null;return"getRootNode"in s&&((e=P.getRootNode(s))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&P.host(P.getRootNode(s))&&(t=P.host(P.getRootNode(s))),t}function Qa(s){let e=s,t;for(;t=Ui(e);)e=t;return e}function qa(s){const e=s.ownerDocument;if(!e)return!1;const t=Qa(s);return P.contains(e,t)}function Wi(s){const e=s.ownerDocument;return e?P.contains(e,s)||qa(s):!1}const Kd=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:Bi,get _mirror(){return exports.mirror},closestElementOfNode:_i,getBaseDimension:Fi,getNestedRule:Xe,getPositionsAndIndex:Ks,getRootShadowHost:Qa,getShadowHost:Ui,getWindowHeight:Ti,getWindowScroll:Oi,getWindowWidth:Di,hasShadowRoot:Oe,hookSetter:Pt,inDom:Wi,isAncestorRemoved:ki,isBlocked:re,isCanvasNode:Za,isIgnored:gr,isSerialized:Xa,isSerializedIframe:Qe,isSerializedStylesheet:$i,iterateResolveTree:Pi,legacy_isTouchEvent:_r,get nowTimestamp(){return Tt},on:oe,polyfill:Li,queueToResolveTrees:Ja,shadowHostInDom:qa,throttle:nt,uniqueTextMutations:Ka},Symbol.toStringTag,{value:"Module"}));var A=(s=>(s[s.DomContentLoaded=0]="DomContentLoaded",s[s.Load=1]="Load",s[s.FullSnapshot=2]="FullSnapshot",s[s.IncrementalSnapshot=3]="IncrementalSnapshot",s[s.Meta=4]="Meta",s[s.Custom=5]="Custom",s[s.Plugin=6]="Plugin",s))(A||{}),M=(s=>(s[s.Mutation=0]="Mutation",s[s.MouseMove=1]="MouseMove",s[s.MouseInteraction=2]="MouseInteraction",s[s.Scroll=3]="Scroll",s[s.ViewportResize=4]="ViewportResize",s[s.Input=5]="Input",s[s.TouchMove=6]="TouchMove",s[s.MediaInteraction=7]="MediaInteraction",s[s.StyleSheetRule=8]="StyleSheetRule",s[s.CanvasMutation=9]="CanvasMutation",s[s.Font=10]="Font",s[s.Log=11]="Log",s[s.Drag=12]="Drag",s[s.StyleDeclaration=13]="StyleDeclaration",s[s.Selection=14]="Selection",s[s.AdoptedStyleSheet=15]="AdoptedStyleSheet",s[s.CustomElement=16]="CustomElement",s))(M||{}),W=(s=>(s[s.MouseUp=0]="MouseUp",s[s.MouseDown=1]="MouseDown",s[s.Click=2]="Click",s[s.ContextMenu=3]="ContextMenu",s[s.DblClick=4]="DblClick",s[s.Focus=5]="Focus",s[s.Blur=6]="Blur",s[s.TouchStart=7]="TouchStart",s[s.TouchMove_Departed=8]="TouchMove_Departed",s[s.TouchEnd=9]="TouchEnd",s[s.TouchCancel=10]="TouchCancel",s))(W||{}),Se=(s=>(s[s.Mouse=0]="Mouse",s[s.Pen=1]="Pen",s[s.Touch=2]="Touch",s))(Se||{}),xe=(s=>(s[s["2D"]=0]="2D",s[s.WebGL=1]="WebGL",s[s.WebGL2=2]="WebGL2",s))(xe||{}),Ae=(s=>(s[s.Play=0]="Play",s[s.Pause=1]="Pause",s[s.Seeked=2]="Seeked",s[s.VolumeChange=3]="VolumeChange",s[s.RateChange=4]="RateChange",s))(Ae||{}),F=(s=>(s.Start="start",s.Pause="pause",s.Resume="resume",s.Resize="resize",s.Finish="finish",s.FullsnapshotRebuilded="fullsnapshot-rebuilded",s.LoadStylesheetStart="load-stylesheet-start",s.LoadStylesheetEnd="load-stylesheet-end",s.SkipStart="skip-start",s.SkipEnd="skip-end",s.MouseInteraction="mouse-interaction",s.EventCast="event-cast",s.CustomEvent="custom-event",s.Flush="flush",s.StateChange="state-change",s.PlayBack="play-back",s.Destroy="destroy",s))(F||{}),Ce=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))(Ce||{});function Vn(s){return"__ln"in s}class Qd{constructor(){w(this,"length",0),w(this,"head",null),w(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)t=(t==null?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&Vn(e.previousSibling)){const r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&Vn(e.nextSibling)&&e.nextSibling.__ln.previous){const r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const Gn=(s,e)=>`${s}@${e}`;class qd{constructor(){w(this,"frozen",!1),w(this,"locked",!1),w(this,"texts",[]),w(this,"attributes",[]),w(this,"attributeMap",new WeakMap),w(this,"removes",[]),w(this,"mapRemoves",[]),w(this,"movedMap",{}),w(this,"addedSet",new Set),w(this,"movedSet",new Set),w(this,"droppedSet",new Set),w(this,"removesSubTreeCache",new Set),w(this,"mutationCb"),w(this,"blockClass"),w(this,"blockSelector"),w(this,"maskTextClass"),w(this,"maskTextSelector"),w(this,"inlineStylesheet"),w(this,"maskInputOptions"),w(this,"maskTextFn"),w(this,"maskInputFn"),w(this,"keepIframeSrcFn"),w(this,"recordCanvas"),w(this,"inlineImages"),w(this,"inlineVideos"),w(this,"privacySetting"),w(this,"slimDOMOptions"),w(this,"dataURLOptions"),w(this,"doc"),w(this,"mirror"),w(this,"iframeManager"),w(this,"stylesheetManager"),w(this,"shadowDomManager"),w(this,"canvasManager"),w(this,"processedNodeManager"),w(this,"unattachedDoc"),w(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),w(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,r=new Qd,i=a=>{let c=a,u=Ct;for(;u===Ct;)c=c&&c.nextSibling,u=c&&this.mirror.getId(c);return u},n=a=>{const c=P.parentNode(a);if(!c||!Wi(a))return;let u=!1;if(a.nodeType===Node.TEXT_NODE){const m=c.tagName;if(m==="TEXTAREA")return;m==="STYLE"&&this.addedSet.has(c)&&(u=!0)}const h=yt(c)?this.mirror.getId(Ui(a)):this.mirror.getId(c),f=i(a);if(h===-1||f===-1)return r.addNode(a);const d=Ze(a,{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,inlineVideos:this.inlineVideos,privacySetting:this.privacySetting,onSerialize:m=>{Qe(m,this.mirror)&&this.iframeManager.addIframe(m),$i(m,this.mirror)&&this.stylesheetManager.trackLinkElement(m),Oe(a)&&this.shadowDomManager.addShadowRoot(P.shadowRoot(a),this.doc)},onIframeLoad:(m,g)=>{this.iframeManager.attachIframe(m,g),this.shadowDomManager.observeAttachShadow(m)},onStylesheetLoad:(m,g)=>{this.stylesheetManager.attachLinkElement(m,g)},cssCaptured:u});d&&(e.push({parentId:h,nextId:f,node:d}),t.add(d.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const a of this.movedSet)jn(this.removesSubTreeCache,a,this.mirror)&&!this.movedSet.has(P.parentNode(a))||n(a);for(const a of this.addedSet)!Yn(this.droppedSet,a)&&!jn(this.removesSubTreeCache,a,this.mirror)||Yn(this.movedSet,a)?n(a):this.droppedSet.add(a);let o=null;for(;r.length;){let a=null;if(o){const c=this.mirror.getId(P.parentNode(o.value)),u=i(o.value);c!==-1&&u!==-1&&(a=o)}if(!a){let c=r.tail;for(;c;){const u=c;if(c=c.previous,u){const h=this.mirror.getId(P.parentNode(u.value));if(i(u.value)===-1)continue;if(h!==-1){a=u;break}else{const d=u.value,m=P.parentNode(d);if(m&&m.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const g=P.host(m);if(this.mirror.getId(g)!==-1){a=u;break}}}}}}if(!a){for(;r.head;)r.removeNode(r.head.value);break}o=a.previous,r.removeNode(a.value),n(a.value)}const l={texts:this.texts.map(a=>{var c,u;const h=a.node,f=P.parentNode(h);f&&f.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(f);let d=a.value;const m=this.privacySetting==="strict",g=this.privacySetting==="default"&&fo(d),p=(u=(c=a.node)==null?void 0:c.parentElement)==null?void 0:u.getAttribute("data-hl-record");return(m||g)&&!p&&d&&(d=ii(d)),{id:this.mirror.getId(h),value:d}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>{const{attributes:c}=a;if(typeof c.style=="string"){const u=JSON.stringify(a.styleDiff),h=JSON.stringify(a._unchangedStyles);u.length<c.style.length&&(u+h).split("var(").length===c.style.split("var(").length&&(c.style=a.styleDiff)}return{id:this.mirror.getId(a.node),attributes:c}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.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(l))}),w(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));const r=Array.from(P.childNodes(e),i=>P.textContent(i)||"").join("");t.attributes.value=br({overwriteRecord:null,element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:vr(e),value:r,maskInputFn:this.maskInputFn})}),w(this,"processMutation",e=>{if(!gr(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=P.textContent(e.target);!re(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:wo(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,_i(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let r=e.attributeName,i=e.target.getAttribute(r);if(r==="value"){const o=vr(t);i=br({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:o,value:i,overwriteRecord:t.getAttribute("data-hl-record"),maskInputFn:this.maskInputFn})}if(re(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let n=this.attributeMap.get(e.target);if(t.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!t.contentDocument)r="rr_src";else return;if(n||(n={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(e.target,n)),r==="type"&&t.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&t.setAttribute("data-rr-is-password","true"),!yo(t.tagName,r)){if(e.target.tagName==="INPUT"){const l=e.target;if(l.type==="password"){n.attributes.value="*".repeat(l.value.length);break}}if(n.attributes[r]=go(this.doc,Be(t.tagName),Be(r),i),r==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(a){this.unattachedDoc=this.doc}const l=this.unattachedDoc.createElement("span");e.oldValue&&l.setAttribute("style",e.oldValue);for(const a of Array.from(t.style)){const c=t.style.getPropertyValue(a),u=t.style.getPropertyPriority(a);c!==l.style.getPropertyValue(a)||u!==l.style.getPropertyPriority(a)?u===""?n.styleDiff[a]=c:n.styleDiff[a]=[c,u]:n._unchangedStyles[a]=[c,u]}for(const a of Array.from(l.style))t.style.getPropertyValue(a)===""&&(n.styleDiff[a]=!1)}else r==="open"&&t.tagName==="DIALOG"&&(t.matches("dialog:modal")?n.attributes.rr_open_mode="modal":n.attributes.rr_open_mode="non-modal")}break}case"childList":{if(re(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const r=this.mirror.getId(t),i=yt(e.target)?this.mirror.getId(P.host(e.target)):this.mirror.getId(e.target);re(e.target,this.blockClass,this.blockSelector,!1)||gr(t,this.mirror,this.slimDOMOptions)||!Xa(t,this.mirror)||(this.addedSet.has(t)?(Qs(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&r===-1||ki(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Gn(r,i)]?Qs(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:yt(e.target)&&wt(e.target)?!0:void 0}),ep(t,this.removesSubTreeCache))),this.mapRemoves.push(t))});break}}}),w(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(gr(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&r!==-1&&(this.movedMap[Gn(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);re(e,this.blockClass,this.blockSelector,!1)||(P.childNodes(e).forEach(r=>this.genAdds(r)),Oe(e)&&P.childNodes(P.shadowRoot(e)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","inlineVideos","privacySetting","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}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 Qs(s,e){s.delete(e),P.childNodes(e).forEach(t=>Qs(s,t))}function ep(s,e){const t=[s];for(;t.length;){const r=t.pop();e.has(r)||(e.add(r),P.childNodes(r).forEach(i=>t.push(i)))}}function jn(s,e,t){return s.size===0?!1:tp(s,e)}function tp(s,e,t){const r=P.parentNode(e);return r?s.has(r):!1}function Yn(s,e){return s.size===0?!1:el(s,e)}function el(s,e){const t=P.parentNode(e);return t?s.has(t)?!0:el(s,t):!1}let vt;function rp(s){vt=s}function sp(){vt=void 0}const B=s=>vt?(...t)=>{try{return s(...t)}catch(r){if(vt&&vt(r)===!0)return;throw r}}:s,Fe=[];function $t(s){try{if("composedPath"in s){const e=s.composedPath();if(e.length)return e[0]}else if("path"in s&&s.path.length)return s.path[0]}catch(e){}return s&&s.target}function tl(s,e){const t=new qd;Fe.push(t),t.init(s);const r=new(Ha())(B(t.processMutations.bind(t)));return r.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function ip({mousemoveCb:s,sampling:e,doc:t,mirror:r}){if(e.mousemove===!1)return()=>{};const i=typeof e.mousemove=="number"?e.mousemove:50,n=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let o=[],l;const a=nt(B(h=>{const f=Date.now()-l;s(o.map(d=>(d.timeOffset-=f,d)),h),o=[],l=null}),n),c=B(nt(B(h=>{const f=$t(h),{clientX:d,clientY:m}=_r(h)?h.changedTouches[0]:h;l||(l=Tt()),o.push({x:d,y:m,id:r.getId(f),timeOffset:Tt()-l}),a(typeof DragEvent!="undefined"&&h instanceof DragEvent?M.Drag:h instanceof MouseEvent?M.MouseMove:M.TouchMove)}),i,{trailing:!1})),u=[oe("mousemove",c,t),oe("touchmove",c,t),oe("drag",c,t)];return B(()=>{u.forEach(h=>h())})}function np({mouseInteractionCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){if(n.mouseInteraction===!1)return()=>{};const o=n.mouseInteraction===!0||n.mouseInteraction===void 0?{}:n.mouseInteraction,l=[];let a=null;const c=u=>h=>{const f=$t(h);if(re(f,r,i,!0)||Za(f))return;let d=null,m=u;if("pointerType"in h){switch(h.pointerType){case"mouse":d=Se.Mouse;break;case"touch":d=Se.Touch;break;case"pen":d=Se.Pen;break}d===Se.Touch?W[u]===W.MouseDown?m="TouchStart":W[u]===W.MouseUp&&(m="TouchEnd"):Se.Pen}else _r(h)&&(d=Se.Touch);d!==null?(a=d,(m.startsWith("Touch")&&d===Se.Touch||m.startsWith("Mouse")&&d===Se.Mouse)&&(d=null)):W[u]===W.Click&&(d=a,a=null);const g=_r(h)?h.changedTouches[0]:h;if(!g)return;const p=t.getId(f),{clientX:y,clientY:v}=g;B(s)(O({type:W[m],id:p,x:y,y:v},d!==null&&{pointerType:d}))};return Object.keys(W).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&o[u]!==!1).forEach(u=>{let h=Be(u);const f=c(u);if(window.PointerEvent)switch(W[u]){case W.MouseDown:case W.MouseUp:h=h.replace("mouse","pointer");break;case W.TouchStart:case W.TouchEnd:return}l.push(oe(h,f,e))}),B(()=>{l.forEach(u=>u())})}function rl({scrollCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){const o=B(nt(B(l=>{const a=$t(l);if(!a||re(a,r,i,!0))return;const c=t.getId(a);if(a===e&&e.defaultView){const u=Oi(e.defaultView);s({id:c,x:u.left,y:u.top})}else s({id:c,x:a.scrollLeft,y:a.scrollTop})}),n.scroll||100));return oe("scroll",o,e)}function op({viewportResizeCb:s},{win:e}){let t=-1,r=-1;const i=B(nt(B(()=>{const n=Ti(),o=Di();(t!==n||r!==o)&&(s({width:Number(o),height:Number(n)}),t=n,r=o)}),200));return oe("resize",i,e)}const ap=["INPUT","TEXTAREA","SELECT"],Hn=new WeakMap;function lp({inputCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,ignoreClass:n,ignoreSelector:o,maskInputOptions:l,maskInputFn:a,sampling:c,userTriggeredOnInput:u}){function h(v){let b=$t(v);const S=v.isTrusted,C=b&&b.tagName;if(b&&C==="OPTION"&&(b=P.parentElement(b)),!b||!C||ap.indexOf(C)<0||re(b,r,i,!0)||b.classList.contains(n)||o&&b.matches(o))return;let R=b.value,T=!1;const D=vr(b)||"",I=b.getAttribute("data-hl-record");D==="radio"||D==="checkbox"?T=b.checked:po({maskInputOptions:l,type:D,tagName:C,overwriteRecord:I})&&(R=br({element:b,maskInputOptions:l,tagName:C,type:D,value:R,overwriteRecord:I,maskInputFn:a})),f(b,u?{text:R,isChecked:T,userTriggered:S}:{text:R,isChecked:T});const x=b.name;D==="radio"&&x&&T&&e.querySelectorAll(`input[type="radio"][name="${x}"]`).forEach(U=>{if(U!==b){const j=U.value;f(U,u?{text:j,isChecked:!T,userTriggered:!1}:{text:j,isChecked:!T})}})}function f(v,b){const S=Hn.get(v);if(!S||S.text!==b.text||S.isChecked!==b.isChecked){Hn.set(v,b);const C=t.getId(v);B(s)(te(O({},b),{id:C}))}}const m=(c.input==="last"?["change"]:["input","change"]).map(v=>oe(v,B(h),e)),g=e.defaultView;if(!g)return()=>{m.forEach(v=>v())};const p=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value"),y=[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]];return p&&p.set&&m.push(...y.map(v=>Pt(v[0],v[1],{set(){B(h)({target:this,isTrusted:!1})}},!1,g))),B(()=>{m.forEach(v=>v())})}function kr(s){const e=[];function t(r,i){if(lr("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||lr("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||lr("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||lr("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){const o=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(o)}else if(r.parentStyleSheet){const o=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(o)}return i}return t(s,e)}function Ne(s,e,t){let r,i;return s?(s.ownerNode?r=e.getId(s.ownerNode):i=t.getId(s),{styleId:i,id:r}):{}}function cp({styleSheetRuleCb:s,mirror:e,stylesheetManager:t},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:B((u,h,f)=>{const[d,m]=f,{id:g,styleId:p}=Ne(h,e,t.styleMirror);return(g&&g!==-1||p&&p!==-1)&&s({id:g,styleId:p,adds:[{rule:d,index:m}]}),u.apply(h,f)})}),r.CSSStyleSheet.prototype.addRule=function(u,h,f=this.cssRules.length){const d=`${u} { ${h} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[d,f])};const n=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(n,{apply:B((u,h,f)=>{const[d]=f,{id:m,styleId:g}=Ne(h,e,t.styleMirror);return(m&&m!==-1||g&&g!==-1)&&s({id:m,styleId:g,removes:[{index:d}]}),u.apply(h,f)})}),r.CSSStyleSheet.prototype.removeRule=function(u){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let o;r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:B((u,h,f)=>{const[d]=f,{id:m,styleId:g}=Ne(h,e,t.styleMirror);return(m&&m!==-1||g&&g!==-1)&&s({id:m,styleId:g,replace:d}),u.apply(h,f)})}));let l;r.CSSStyleSheet.prototype.replaceSync&&(l=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:B((u,h,f)=>{const[d]=f,{id:m,styleId:g}=Ne(h,e,t.styleMirror);return(m&&m!==-1||g&&g!==-1)&&s({id:m,styleId:g,replaceSync:d}),u.apply(h,f)})}));const a={};cr("CSSGroupingRule")?a.CSSGroupingRule=r.CSSGroupingRule:(cr("CSSMediaRule")&&(a.CSSMediaRule=r.CSSMediaRule),cr("CSSConditionRule")&&(a.CSSConditionRule=r.CSSConditionRule),cr("CSSSupportsRule")&&(a.CSSSupportsRule=r.CSSSupportsRule));const c={};return Object.entries(a).forEach(([u,h])=>{c[u]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(c[u].insertRule,{apply:B((f,d,m)=>{const[g,p]=m,{id:y,styleId:v}=Ne(d.parentStyleSheet,e,t.styleMirror);return(y&&y!==-1||v&&v!==-1)&&s({id:y,styleId:v,adds:[{rule:g,index:[...kr(d),p||0]}]}),f.apply(d,m)})}),h.prototype.deleteRule=new Proxy(c[u].deleteRule,{apply:B((f,d,m)=>{const[g]=m,{id:p,styleId:y}=Ne(d.parentStyleSheet,e,t.styleMirror);return(p&&p!==-1||y&&y!==-1)&&s({id:p,styleId:y,removes:[{index:[...kr(d),g]}]}),f.apply(d,m)})})}),B(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=n,o&&(r.CSSStyleSheet.prototype.replace=o),l&&(r.CSSStyleSheet.prototype.replaceSync=l),Object.entries(a).forEach(([u,h])=>{h.prototype.insertRule=c[u].insertRule,h.prototype.deleteRule=c[u].deleteRule})})}function sl({mirror:s,stylesheetManager:e},t){var r,i,n;let o=null;t.nodeName==="#document"?o=s.getId(t):o=s.getId(P.host(t));const l=t.nodeName==="#document"?(r=t.defaultView)==null?void 0:r.Document:(n=(i=t.ownerDocument)==null?void 0:i.defaultView)==null?void 0:n.ShadowRoot,a=l!=null&&l.prototype?Object.getOwnPropertyDescriptor(l==null?void 0:l.prototype,"adoptedStyleSheets"):void 0;return o===null||o===-1||!l||!a?()=>{}:(Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var c;return(c=a.get)==null?void 0:c.call(this)},set(c){var u;const h=(u=a.set)==null?void 0:u.call(this,c);if(o!==null&&o!==-1)try{e.adoptStyleSheets(c,o)}catch(f){}return h}}),B(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function up({styleDeclarationCb:s,mirror:e,ignoreCSSAttributes:t,stylesheetManager:r},{win:i}){const n=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(n,{apply:B((l,a,c)=>{var u;const[h,f,d]=c;if(t.has(h))return n.apply(a,[h,f,d]);const{id:m,styleId:g}=Ne((u=a.parentRule)==null?void 0:u.parentStyleSheet,e,r.styleMirror);return(m&&m!==-1||g&&g!==-1)&&s({id:m,styleId:g,set:{property:h,value:f,priority:d},index:kr(a.parentRule)}),l.apply(a,c)})});const o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:B((l,a,c)=>{var u;const[h]=c;if(t.has(h))return o.apply(a,[h]);const{id:f,styleId:d}=Ne((u=a.parentRule)==null?void 0:u.parentStyleSheet,e,r.styleMirror);return(f&&f!==-1||d&&d!==-1)&&s({id:f,styleId:d,remove:{property:h},index:kr(a.parentRule)}),l.apply(a,c)})}),B(()=>{i.CSSStyleDeclaration.prototype.setProperty=n,i.CSSStyleDeclaration.prototype.removeProperty=o})}function hp({mediaInteractionCb:s,blockClass:e,blockSelector:t,mirror:r,sampling:i,doc:n}){const o=B(a=>nt(B(c=>{const u=$t(c);if(!u||re(u,e,t,!0))return;const{currentTime:h,volume:f,muted:d,playbackRate:m,loop:g}=u;s({type:a,id:r.getId(u),currentTime:h,volume:f,muted:d,playbackRate:m,loop:g})}),i.media||500)),l=[oe("play",o(Ae.Play),n),oe("pause",o(Ae.Pause),n),oe("seeked",o(Ae.Seeked),n),oe("volumechange",o(Ae.VolumeChange),n),oe("ratechange",o(Ae.RateChange),n)];return B(()=>{l.forEach(a=>a())})}function fp({fontCb:s,doc:e}){const t=e.defaultView;if(!t)return()=>{};const r=[],i=new WeakMap,n=t.FontFace;t.FontFace=function(a,c,u){const h=new n(a,c,u);return i.set(h,{family:a,buffer:typeof c!="string",descriptors:u,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),h};const o=ze(e.fonts,"add",function(l){return function(a){return setTimeout(B(()=>{const c=i.get(a);c&&(s(c),i.delete(a))}),0),l.apply(this,[a])}});return r.push(()=>{t.FontFace=n}),r.push(o),B(()=>{r.forEach(l=>l())})}function dp(s){const{doc:e,mirror:t,blockClass:r,blockSelector:i,selectionCb:n}=s;let o=!0;const l=B(()=>{const a=e.getSelection();if(!a||o&&(a!=null&&a.isCollapsed))return;o=a.isCollapsed||!1;const c=[],u=a.rangeCount||0;for(let h=0;h<u;h++){const f=a.getRangeAt(h),{startContainer:d,startOffset:m,endContainer:g,endOffset:p}=f;re(d,r,i,!0)||re(g,r,i,!0)||c.push({start:t.getId(d),startOffset:m,end:t.getId(g),endOffset:p})}n({ranges:c})});return l(),oe("selectionchange",l)}function pp({doc:s,customElementCb:e}){const t=s.defaultView;return!t||!t.customElements?()=>{}:ze(t.customElements,"define",function(i){return function(n,o,l){try{e({define:{name:n}})}catch(a){console.warn(`Custom element callback failed for ${n}`)}return i.apply(this,[n,o,l])}})}function mp(s,e){const{mutationCb:t,mousemoveCb:r,mouseInteractionCb:i,scrollCb:n,viewportResizeCb:o,inputCb:l,mediaInteractionCb:a,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:h,fontCb:f,selectionCb:d,customElementCb:m}=s;s.mutationCb=(...g)=>{e.mutation&&e.mutation(...g),t(...g)},s.mousemoveCb=(...g)=>{e.mousemove&&e.mousemove(...g),r(...g)},s.mouseInteractionCb=(...g)=>{e.mouseInteraction&&e.mouseInteraction(...g),i(...g)},s.scrollCb=(...g)=>{e.scroll&&e.scroll(...g),n(...g)},s.viewportResizeCb=(...g)=>{e.viewportResize&&e.viewportResize(...g),o(...g)},s.inputCb=(...g)=>{e.input&&e.input(...g),l(...g)},s.mediaInteractionCb=(...g)=>{e.mediaInteaction&&e.mediaInteaction(...g),a(...g)},s.styleSheetRuleCb=(...g)=>{e.styleSheetRule&&e.styleSheetRule(...g),c(...g)},s.styleDeclarationCb=(...g)=>{e.styleDeclaration&&e.styleDeclaration(...g),u(...g)},s.canvasMutationCb=(...g)=>{e.canvasMutation&&e.canvasMutation(...g),h(...g)},s.fontCb=(...g)=>{e.font&&e.font(...g),f(...g)},s.selectionCb=(...g)=>{e.selection&&e.selection(...g),d(...g)},s.customElementCb=(...g)=>{e.customElement&&e.customElement(...g),m(...g)}}function gp(s,e={}){const t=s.doc.defaultView;if(!t)return()=>{};mp(s,e);let r;s.recordDOM&&(r=tl(s,s.doc));const i=ip(s),n=np(s),o=rl(s),l=op(s,{win:t}),a=lp(s),c=hp(s);let u=()=>{},h=()=>{},f=()=>{},d=()=>{};s.recordDOM&&(u=cp(s,{win:t}),h=sl(s,s.doc),f=up(s,{win:t}),s.collectFonts&&(d=fp(s)));const m=dp(s),g=pp(s),p=[];for(const y of s.plugins)p.push(y.observer(y.callback,t,y.options));return B(()=>{Fe.forEach(y=>y.reset()),r==null||r.disconnect(),i(),n(),o(),l(),a(),c(),u(),h(),f(),d(),m(),g(),p.forEach(y=>y())})}function lr(s){return typeof window[s]!="undefined"}function cr(s){return!!(typeof window[s]!="undefined"&&window[s].prototype&&"insertRule"in window[s].prototype&&"deleteRule"in window[s].prototype)}class Zn{constructor(e){w(this,"iframeIdToRemoteIdMap",new WeakMap),w(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){const n=r||this.getIdToRemoteIdMap(e),o=i||this.getRemoteIdToIdMap(e);let l=n.get(t);return l||(l=this.generateIdFn(),n.set(t,l),o.set(l,t)),l}getIds(e,t){const r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map(n=>this.getId(e,n,r,i))}getRemoteId(e,t,r){const i=r||this.getRemoteIdToIdMap(e);if(typeof t!="number")return t;const n=i.get(t);return n||-1}getRemoteIds(e,t){const r=this.getRemoteIdToIdMap(e);return t.map(i=>this.getRemoteId(e,i,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class yp{constructor(e){w(this,"iframes",new WeakMap),w(this,"crossOriginIframeMap",new WeakMap),w(this,"crossOriginIframeMirror",new Zn(mo)),w(this,"crossOriginIframeStyleMirror"),w(this,"crossOriginIframeRootIdMap",new WeakMap),w(this,"mirror"),w(this,"mutationCb"),w(this,"wrappedEmit"),w(this,"loadListener"),w(this,"stylesheetManager"),w(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Zn(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var r,i;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=e.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if(t.data.type!=="rrweb"||t.origin!==t.data.origin)return;const r=e.source;if(!r)return;const i=this.crossOriginIframeMap.get(r);if(!i)return;const n=this.transformCrossOriginEvent(i,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){var r;switch(t.type){case A.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),{timestamp:t.timestamp,type:A.IncrementalSnapshot,data:{source:M.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case A.Meta:case A.Load:case A.DomContentLoaded:return!1;case A.Plugin:return t;case A.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case A.IncrementalSnapshot:switch(t.data.source){case M.Mutation:return t.data.adds.forEach(i=>{this.replaceIds(i,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(i.node,n)}),t.data.removes.forEach(i=>{this.replaceIds(i,e,["parentId","id"])}),t.data.attributes.forEach(i=>{this.replaceIds(i,e,["id"])}),t.data.texts.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case M.Drag:case M.TouchMove:case M.MouseMove:return t.data.positions.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case M.ViewportResize:return!1;case M.MediaInteraction:case M.MouseInteraction:case M.Scroll:case M.CanvasMutation:case M.Input:return this.replaceIds(t.data,e,["id"]),t;case M.StyleSheetRule:case M.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case M.Font:return t;case M.Selection:return t.data.ranges.forEach(i=>{this.replaceIds(i,e,["start","end"])}),t;case M.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),(r=t.data.styles)==null||r.forEach(i=>{this.replaceStyleIds(i,e,["styleId"])}),t}}return!1}replace(e,t,r,i){for(const n of i)!Array.isArray(t[n])&&typeof t[n]!="number"||(Array.isArray(t[n])?t[n]=e.getIds(r,t[n]):t[n]=e.getId(r,t[n]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,t)})}patchRootIdOnNode(e,t){e.type!==Ce.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}}class wp{constructor(e){w(this,"shadowDoms",new WeakSet),w(this,"mutationCb"),w(this,"scrollCb"),w(this,"bypassOptions"),w(this,"mirror"),w(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!wt(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);const r=tl(te(O({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(rl(te(O({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(P.host(e))),this.restoreHandlers.push(sl({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const r=this;this.restoreHandlers.push(ze(e.prototype,"attachShadow",function(i){return function(n){const o=i.call(this,n),l=P.shadowRoot(this);return l&&Wi(this)&&r.addShadowRoot(l,t),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}var Je="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gt=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(var ur=0;ur<Je.length;ur++)gt[Je.charCodeAt(ur)]=ur;var bp=function(s){var e=new Uint8Array(s),t,r=e.length,i="";for(t=0;t<r;t+=3)i+=Je[e[t]>>2],i+=Je[(e[t]&3)<<4|e[t+1]>>4],i+=Je[(e[t+1]&15)<<2|e[t+2]>>6],i+=Je[e[t+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i},vp=function(s){var e=s.length*.75,t=s.length,r,i=0,n,o,l,a;s[s.length-1]==="="&&(e--,s[s.length-2]==="="&&e--);var c=new ArrayBuffer(e),u=new Uint8Array(c);for(r=0;r<t;r+=4)n=gt[s.charCodeAt(r)],o=gt[s.charCodeAt(r+1)],l=gt[s.charCodeAt(r+2)],a=gt[s.charCodeAt(r+3)],u[i++]=n<<2|o>>4,u[i++]=(o&15)<<4|l>>2,u[i++]=(l&3)<<6|a&63;return c};const Xn=new Map;function Sp(s,e){let t=Xn.get(s);return t||(t=new Map,Xn.set(s,t)),t.has(e)||t.set(e,[]),t.get(e)}const il=(s,e,t)=>{if(!s||!(ol(s,e)||typeof s=="object"))return;const r=s.constructor.name,i=Sp(t,r);let n=i.indexOf(s);return n===-1&&(n=i.length,i.push(s)),n};function yr(s,e,t){if(s instanceof Array)return s.map(r=>yr(r,e,t));if(s===null)return s;if(s instanceof Float32Array||s instanceof Float64Array||s instanceof Int32Array||s instanceof Uint32Array||s instanceof Uint8Array||s instanceof Uint16Array||s instanceof Int16Array||s instanceof Int8Array||s instanceof Uint8ClampedArray)return{rr_type:s.constructor.name,args:[Object.values(s)]};if(s instanceof ArrayBuffer){const r=s.constructor.name,i=bp(s);return{rr_type:r,base64:i}}else{if(s instanceof DataView)return{rr_type:s.constructor.name,args:[yr(s.buffer,e,t),s.byteOffset,s.byteLength]};if(s instanceof HTMLImageElement){const r=s.constructor.name,{src:i}=s;return{rr_type:r,src:i}}else if(s instanceof HTMLCanvasElement){const r="HTMLImageElement",i=s.toDataURL();return{rr_type:r,src:i}}else{if(s instanceof ImageData)return{rr_type:s.constructor.name,args:[yr(s.data,e,t),s.width,s.height]};if(ol(s,e)||typeof s=="object"){const r=s.constructor.name,i=il(s,e,t);return{rr_type:r,index:i}}}}return s}const nl=(s,e,t)=>s.map(r=>yr(r,e,t)),ol=(s,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof e[i]=="function").find(i=>s instanceof e[i]);function Cp(s,e,t,r){const i=[],n=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const o of n)try{if(typeof e.CanvasRenderingContext2D.prototype[o]!="function")continue;const l=ze(e.CanvasRenderingContext2D.prototype,o,function(a){return function(...c){return re(this.canvas,t,r,!0)||setTimeout(()=>{const u=nl(c,e,this);s(this.canvas,{type:xe["2D"],property:o,args:u})},0),a.apply(this,c)}});i.push(l)}catch(l){const a=Pt(e.CanvasRenderingContext2D.prototype,o,{set(c){s(this.canvas,{type:xe["2D"],property:o,args:[c],setter:!0})}});i.push(a)}return()=>{i.forEach(o=>o())}}function Ip(s){return s==="experimental-webgl"?"webgl":s}function Jn(s,e,t,r){const i=[];try{const n=ze(s.HTMLCanvasElement.prototype,"getContext",function(o){return function(l,...a){if(!re(this,e,t,!0)){const c=Ip(l);if("__context"in this||(this.__context=c),r&&["webgl","webgl2"].includes(c))if(a[0]&&typeof a[0]=="object"){const u=a[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return o.apply(this,[l,...a])}});i.push(n)}catch(n){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(n=>n())}}function Kn(s,e,t,r,i,n){const o=[],l=Object.getOwnPropertyNames(s);for(const a of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof s[a]!="function")continue;const c=ze(s,a,function(u){return function(...h){const f=u.apply(this,h);if(il(f,n,this),"tagName"in this.canvas&&!re(this.canvas,r,i,!0)){const d=nl(h,n,this),m={type:e,property:a,args:d};t(this.canvas,m)}return f}});o.push(c)}catch(c){const u=Pt(s,a,{set(h){t(this.canvas,{type:e,property:a,args:[h],setter:!0})}});o.push(u)}return o}function Ep(s,e,t,r){const i=[];return i.push(...Kn(e.WebGLRenderingContext.prototype,xe.WebGL,s,t,r,e)),typeof e.WebGL2RenderingContext!="undefined"&&i.push(...Kn(e.WebGL2RenderingContext.prototype,xe.WebGL2,s,t,r,e)),()=>{i.forEach(n=>n())}}const al="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIGxldCBsb2dEZWJ1ZyA9IGZhbHNlOwogIGNvbnN0IGRlYnVnID0gKC4uLmFyZ3MpID0+IHsKICAgIGlmIChsb2dEZWJ1ZykgewogICAgICBjb25zb2xlLmRlYnVnKC4uLmFyZ3MpOwogICAgfQogIH07CiAgd29ya2VyLm9ubWVzc2FnZSA9IGFzeW5jIGZ1bmN0aW9uKGUpIHsKICAgIGxvZ0RlYnVnID0gISFlLmRhdGEubG9nRGVidWc7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGR4LCBkeSwgZHcsIGRoLCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOwogICAgICBjb25zdCB0cmFuc3BhcmVudEJhc2U2NCA9IGdldFRyYW5zcGFyZW50QmxvYkZvcigKICAgICAgICB3aWR0aCwKICAgICAgICBoZWlnaHQsCiAgICAgICAgZGF0YVVSTE9wdGlvbnMKICAgICAgKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgY29uc3QgY3R4ID0gb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwLCB3aWR0aCwgaGVpZ2h0KTsKICAgICAgYml0bWFwLmNsb3NlKCk7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgYXdhaXQgdHJhbnNwYXJlbnRCYXNlNjQgPT09IGJhc2U2NCkgewogICAgICAgIGRlYnVnKCJbaGlnaGxpZ2h0LXdvcmtlcl0gY2FudmFzIGJpdG1hcCBpcyB0cmFuc3BhcmVudCIsIHsKICAgICAgICAgIGlkLAogICAgICAgICAgYmFzZTY0CiAgICAgICAgfSk7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCwgc3RhdHVzOiAidHJhbnNwYXJlbnQiIH0pOwogICAgICB9CiAgICAgIGlmIChsYXN0QmxvYk1hcC5nZXQoaWQpID09PSBiYXNlNjQpIHsKICAgICAgICBkZWJ1ZygiW2hpZ2hsaWdodC13b3JrZXJdIGNhbnZhcyBiaXRtYXAgaXMgdW5jaGFuZ2VkIiwgewogICAgICAgICAgaWQsCiAgICAgICAgICBiYXNlNjQKICAgICAgICB9KTsKICAgICAgfQogICAgICBjb25zdCBtc2cgPSB7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0LAogICAgICAgIGR4LAogICAgICAgIGR5LAogICAgICAgIGR3LAogICAgICAgIGRoCiAgICAgIH07CiAgICAgIGRlYnVnKCJbaGlnaGxpZ2h0LXdvcmtlcl0gY2FudmFzIGJpdG1hcCBwcm9jZXNzZWQiLCBtc2cpOwogICAgICB3b3JrZXIucG9zdE1lc3NhZ2UobXNnKTsKICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgfSBlbHNlIHsKICAgICAgZGVidWcoIltoaWdobGlnaHQtd29ya2VyXSBubyBvZmZzY3JlZW5jYW52YXMgc3VwcG9ydCIsIHsKICAgICAgICBpZDogZS5kYXRhLmlkCiAgICAgIH0pOwogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCwgc3RhdHVzOiAidW5zdXBwb3J0ZWQiIH0pOwogICAgfQogIH07Cn0pKCk7Ci8vIyBzb3VyY2VNYXBwaW5nVVJMPWltYWdlLWJpdG1hcC1kYXRhLXVybC13b3JrZXItRHd0SzhBMHouanMubWFwCg==",xp=s=>Uint8Array.from(atob(s),e=>e.charCodeAt(0)),Qn=typeof self!="undefined"&&self.Blob&&new Blob([xp(al)],{type:"text/javascript;charset=utf-8"});function Mp(s){let e;try{if(e=Qn&&(self.URL||self.webkitURL).createObjectURL(Qn),!e)throw"";const t=new Worker(e,{name:s==null?void 0:s.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),t}catch(t){return new Worker("data:text/javascript;base64,"+al,{name:s==null?void 0:s.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}class Rp{constructor(e){w(this,"pendingCanvasMutations",new Map),w(this,"rafStamps",{latestId:0,invokeId:null}),w(this,"mirror"),w(this,"logger"),w(this,"worker"),w(this,"snapshotInProgressMap",new Map),w(this,"lastSnapshotTime",new Map),w(this,"options"),w(this,"mutationCb"),w(this,"resetObservers"),w(this,"frozen",!1),w(this,"locked",!1),w(this,"processMutation",(h,f)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(h)||this.pendingCanvasMutations.set(h,[]),this.pendingCanvasMutations.get(h).push(f)});const{sampling:t,win:r,blockClass:i,blockSelector:n,recordCanvas:o,recordLocalVideos:l,recordRemoteVideos:a,initialSnapshotDelay:c,dataURLOptions:u}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,this.logger=e.logger,this.worker=new Mp,this.worker.onmessage=h=>{const{id:f}=h.data;if(this.snapshotInProgressMap.set(f,!1),!("base64"in h.data)){this.debug(null,"canvas worker received empty message",{id:f,data:h.data,status:h.data.status});return}const{base64:d,type:m,dx:g,dy:p,dw:y,dh:v}=h.data,b={id:f,type:xe["2D"],commands:[{property:"clearRect",args:[g,p,y,v]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:d}],type:m}]},g,p,y,v]}]};this.debug(null,"canvas worker recording mutation",b),this.mutationCb(b)},this.options=e,o&&t==="all"?(this.debug(null,"initializing canvas mutation observer",{sampling:t}),this.initCanvasMutationObserver(r,i,n)):o&&typeof t=="number"&&(this.debug(null,"initializing canvas fps observer",{sampling:t}),this.initCanvasFPSObserver(l,a,t,r,i,n,{initialSnapshotDelay:c,dataURLOptions:u},e.resizeFactor,e.maxSnapshotDimension))}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}debug(e,...t){if(!this.logger)return;const r=this.mirror.getId(e);let i="[highlight-canvas-manager]";e&&(i=`[highlight-canvas] [id:${r}]`,e.tagName.toLowerCase()==="canvas"&&(i+=` [ctx:${e.__context}]`)),this.logger.debug(i,e,...t)}async snapshot(e){var t;const r=this.mirror.getId(e);if(this.snapshotInProgressMap.get(r)){this.debug(e,"snapshotting already in progress for",r);return}const i=1e3/(typeof this.options.samplingManual=="number"?this.options.samplingManual:1),n=this.lastSnapshotTime.get(r);if(!(n&&new Date().getTime()-n<i)){if(this.debug(e,"starting snapshotting"),e.width===0||e.height===0){this.debug(e,"not yet ready",{width:e.width,height:e.height});return}this.lastSnapshotTime.set(r,new Date().getTime()),this.snapshotInProgressMap.set(r,!0);try{if(this.options.clearWebGLBuffer!==!1&&["webgl","webgl2"].includes(e.__context)){const u=e.getContext(e.__context);((t=u==null?void 0:u.getContextAttributes())==null?void 0:t.preserveDrawingBuffer)===!1&&(u.clear(u.COLOR_BUFFER_BIT),this.debug(e,"cleared webgl canvas to load it into memory",{attributes:u==null?void 0:u.getContextAttributes()}))}if(e.width===0||e.height===0){this.debug(e,"not yet ready",{width:e.width,height:e.height});return}let o=this.options.resizeFactor||1;if(this.options.maxSnapshotDimension){const u=Math.max(e.width,e.height);o=Math.min(o,this.options.maxSnapshotDimension/u)}const l=e.width*o,a=e.height*o,c=await createImageBitmap(e,{resizeWidth:l,resizeHeight:a});this.debug(e,"created image bitmap",{width:c.width,height:c.height}),this.worker.postMessage({id:r,bitmap:c,width:l,height:a,dx:0,dy:0,dw:e.width,dh:e.height,dataURLOptions:this.options.dataURLOptions,logDebug:!!this.logger},[c]),this.debug(e,"sent message")}catch(o){this.debug(e,"failed to snapshot",o)}finally{this.snapshotInProgressMap.set(r,!1)}}}initCanvasFPSObserver(e,t,r,i,n,o,l,a,c){const u=Jn(i,n,o,!0),h=1e3/r;let f=0,d;const m=new Map,g=(b,S)=>{const C=[];b.querySelectorAll(S).forEach(D=>C.push(D));const R=document.createNodeIterator(b,Node.ELEMENT_NODE);let T;for(;T=R.nextNode();)T!=null&&T.shadowRoot&&C.push(...g(T.shadowRoot,S));return C},p=b=>{const S=[];return g(i.document,"canvas").forEach(C=>{if(!re(C,n,o,!0)){this.debug(C,"discovered canvas"),S.push(C);const R=this.mirror.getId(C);m.has(R)||m.set(R,b)}}),S},y=b=>{const S=[];return(e||t)&&g(i.document,"video").forEach(C=>{if(!(!t&&C.src!==""&&C.src.indexOf("blob:")===-1)&&!(!e&&(C.src===""||C.src.indexOf("blob:")!==-1))&&!re(C,n,o,!0)){S.push(C);const R=this.mirror.getId(C);m.has(R)||m.set(R,b)}}),S},v=async b=>{if(f&&b-f<h){d=requestAnimationFrame(v);return}f=b;const S=R=>{const T=this.mirror.getId(R),D=m.get(T),I=!l.initialSnapshotDelay||b-D>l.initialSnapshotDelay;return this.debug(R,{delay:l.initialSnapshotDelay,delta:b-D,hadLoadingTime:I}),I},C=[];C.push(...p(b).filter(S).map(R=>this.snapshot(R))),C.push(...y(b).filter(S).map(async R=>{this.debug(R,"starting video snapshotting");const T=this.mirror.getId(R);if(this.snapshotInProgressMap.get(T)){this.debug(R,"video snapshotting already in progress for",T);return}this.snapshotInProgressMap.set(T,!0);try{const{width:D,height:I}=R.getBoundingClientRect(),{actualWidth:x,actualHeight:U}={actualWidth:R.videoWidth,actualHeight:R.videoHeight},j=Math.max(x,U);if(j===0){this.debug(R,"not yet ready",{width:R.width,height:R.height,actualWidth:x,actualHeight:U,boxWidth:D,boxHeight:I});return}let ee=a||1;c&&(ee=Math.min(ee,c/j));const ae=x*ee,N=U*ee,ce=await createImageBitmap(R,{resizeWidth:ae,resizeHeight:N}),ue=Math.max(D,I)/j,se=x*ue,he=U*ue,J=(D-se)/2,ie=(I-he)/2;this.debug(R,"created image bitmap",{actualWidth:x,actualHeight:U,boxWidth:D,boxHeight:I,outputWidth:se,outputHeight:he,resizeWidth:ae,resizeHeight:N,scale:ee,outputScale:ue,offsetX:J,offsetY:ie}),this.worker.postMessage({id:T,bitmap:ce,width:ae,height:N,dx:J,dy:ie,dw:se,dh:he,dataURLOptions:l.dataURLOptions,logDebug:!!this.logger},[ce]),this.debug(R,"send message")}catch(D){this.debug(R,"failed to snapshot",D)}finally{this.snapshotInProgressMap.set(T,!1)}})),await Promise.all(C).catch(console.error),d=requestAnimationFrame(v)};d=requestAnimationFrame(v),this.resetObservers=()=>{u(),d&&cancelAnimationFrame(d)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=Jn(e,t,r,!1),n=Cp(this.processMutation.bind(this),e,t,r),o=Ep(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{i(),n(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const r=this.pendingCanvasMutations.get(e);if(!r||t===-1)return;const i=r.map(o=>{const c=o,{type:l}=c;return Ve(c,["type"])}),{type:n}=r[0];this.mutationCb({id:t,type:n,commands:i}),this.pendingCanvasMutations.delete(e)}}class Np{constructor(e){w(this,"trackedLinkElements",new WeakSet),w(this,"mutationCb"),w(this,"adoptedStyleSheetCb"),w(this,"styleMirror",new Bi),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;const r={id:t,styleIds:[]},i=[];for(const n of e){let o;this.styleMirror.has(n)?o=this.styleMirror.getId(n):(o=this.styleMirror.add(n),i.push({styleId:o,rules:Array.from(n.rules||CSSRule,(l,a)=>({rule:uo(l,n.href),index:a}))})),r.styleIds.push(o)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class Ap{constructor(){w(this,"nodeMap",new WeakMap),w(this,"active",!1)}inOtherBuffer(e,t){const r=this.nodeMap.get(e);return r&&Array.from(r).some(i=>i!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}}let q,wr,St,Lr=!1;try{if(Array.from([1],s=>s*2)[0]!==2){const s=document.createElement("iframe");document.body.appendChild(s),Array.from=((Xi=s.contentWindow)==null?void 0:Xi.Array.from)||Array.from,document.body.removeChild(s)}}catch(s){console.debug("Unable to override Array.from",s)}const de=ho();function Me(s={}){var e,t,r,i,n,o,l,a;const{emit:c,checkoutEveryNms:u,checkoutEveryNth:h,blockClass:f="highlight-block",blockSelector:d=null,ignoreClass:m="highlight-ignore",ignoreSelector:g=null,maskTextClass:p="highlight-mask",maskTextSelector:y=null,inlineStylesheet:v=!0,maskAllInputs:b,maskInputOptions:S,slimDOMOptions:C,maskInputFn:R,maskTextFn:T=ii,hooks:D,packFn:I,sampling:x={},mousemoveWait:U,recordDOM:j=!0,recordCanvas:ee=!1,recordCrossOriginIframes:ae=!1,recordAfter:N=s.recordAfter==="DOMContentLoaded"?s.recordAfter:"load",userTriggeredOnInput:ce=!1,collectFonts:ue=!1,inlineImages:se=!1,inlineVideos:he=!1,plugins:J,keepIframeSrcFn:ie=()=>!1,privacySetting:ke="default",ignoreCSSAttributes:Re=new Set([]),errorHandler:pl,logger:ml}=s,Ft=O(O({},s.dataURLOptions),(t=(e=s.sampling)==null?void 0:e.canvas)==null?void 0:t.dataURLOptions);rp(pl);const Bt=ae?window.parent===window:!0;let at=!1;if(!Bt)try{window.parent.document&&(at=!1)}catch(z){at=!0}if(Bt&&!c)throw new Error("emit function is required");if(!Bt&&!at)return()=>{};U!==void 0&&x.mousemove===void 0&&(x.mousemove=U),de.reset();const Jr=b===!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}:S!==void 0?S:{password:!0},Kr=C===!0||C==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:C==="all",headMetaDescKeywords:C==="all",headTitleMutations:C==="all"}:C||{};Li();let zi,Qr=0;const Vi=z=>{for(const fe of J||[])fe.eventProcessor&&(z=fe.eventProcessor(z));return I&&!at&&(z=I(z)),z};q=(z,fe)=>{var K;const Q=z;if(Q.timestamp=Tt(),(K=Fe[0])!=null&&K.isFrozen()&&Q.type!==A.FullSnapshot&&!(Q.type===A.IncrementalSnapshot&&Q.data.source===M.Mutation)&&Fe.forEach(ye=>ye.unfreeze()),Bt)c==null||c(Vi(Q),fe);else if(at){const ye={type:"rrweb",event:Vi(Q),origin:window.location.origin,isCheckout:fe};window.parent.postMessage(ye,"*")}if(Q.type===A.FullSnapshot)zi=Q,Qr=0;else if(Q.type===A.IncrementalSnapshot){if(Q.data.source===M.Mutation&&Q.data.isAttachIframe)return;Qr++;const ye=h&&Qr>=h,Y=u&&Q.timestamp-zi.timestamp>u;(ye||Y)&&wr(!0)}};const Ut=z=>{q({type:A.IncrementalSnapshot,data:O({source:M.Mutation},z)})},Gi=z=>q({type:A.IncrementalSnapshot,data:O({source:M.Scroll},z)}),ji=z=>q({type:A.IncrementalSnapshot,data:O({source:M.CanvasMutation},z)}),gl=z=>q({type:A.IncrementalSnapshot,data:O({source:M.AdoptedStyleSheet},z)}),Le=new Np({mutationCb:Ut,adoptedStyleSheetCb:gl}),Pe=new yp({mirror:de,mutationCb:Ut,stylesheetManager:Le,recordCrossOriginIframes:ae,wrappedEmit:q});for(const z of J||[])z.getMirror&&z.getMirror({nodeMirror:de,crossOriginIframeMirror:Pe.crossOriginIframeMirror,crossOriginIframeStyleMirror:Pe.crossOriginIframeStyleMirror});const qr=new Ap;St=new Rp({recordCanvas:ee,recordLocalVideos:se,recordRemoteVideos:he,mutationCb:ji,win:window,blockClass:f,blockSelector:d,mirror:de,sampling:(r=x==null?void 0:x.canvas)==null?void 0:r.fps,samplingManual:(i=x==null?void 0:x.canvas)==null?void 0:i.fpsManual,clearWebGLBuffer:(n=x==null?void 0:x.canvas)==null?void 0:n.clearWebGLBuffer,initialSnapshotDelay:(o=x==null?void 0:x.canvas)==null?void 0:o.initialSnapshotDelay,dataURLOptions:Ft,resizeFactor:(l=x==null?void 0:x.canvas)==null?void 0:l.resizeFactor,maxSnapshotDimension:(a=x==null?void 0:x.canvas)==null?void 0:a.maxSnapshotDimension,logger:ml});const Wt=new wp({mutationCb:Ut,scrollCb:Gi,bypassOptions:{blockClass:f,blockSelector:d,maskTextClass:p,maskTextSelector:y,inlineStylesheet:v,maskInputOptions:Jr,dataURLOptions:Ft,maskTextFn:T,maskInputFn:R,recordCanvas:ee,inlineImages:se,inlineVideos:he,privacySetting:ke,sampling:x,slimDOMOptions:Kr,iframeManager:Pe,stylesheetManager:Le,canvasManager:St,keepIframeSrcFn:ie,processedNodeManager:qr},mirror:de});wr=(z=!1)=>{if(!j)return;q({type:A.Meta,data:{href:window.location.href,width:Di(),height:Ti()}},z),Le.reset(),Wt.init(),Fe.forEach(K=>K.lock());const fe=vc(document,{mirror:de,blockClass:f,blockSelector:d,maskTextClass:p,maskTextSelector:y,inlineStylesheet:v,maskAllInputs:Jr,maskTextFn:T,maskInputFn:R,slimDOM:Kr,dataURLOptions:Ft,recordCanvas:ee,inlineImages:se,inlineVideos:he,privacySetting:ke,onSerialize:K=>{Qe(K,de)&&Pe.addIframe(K),$i(K,de)&&Le.trackLinkElement(K),Oe(K)&&Wt.addShadowRoot(P.shadowRoot(K),document)},onIframeLoad:(K,Q)=>{Pe.attachIframe(K,Q),Wt.observeAttachShadow(K)},onStylesheetLoad:(K,Q)=>{Le.attachLinkElement(K,Q)},keepIframeSrcFn:ie});if(!fe)return console.warn("Failed to snapshot the document");q({type:A.FullSnapshot,data:{node:fe,initialOffset:Oi(window)}},z),Fe.forEach(K=>K.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Le.adoptStyleSheets(document.adoptedStyleSheets,de.getId(document))};try{const z=[],fe=Q=>{var ye;return B(gp)({mutationCb:Ut,mousemoveCb:(Y,es)=>q({type:A.IncrementalSnapshot,data:{source:es,positions:Y}}),mouseInteractionCb:Y=>q({type:A.IncrementalSnapshot,data:O({source:M.MouseInteraction},Y)}),scrollCb:Gi,viewportResizeCb:Y=>q({type:A.IncrementalSnapshot,data:O({source:M.ViewportResize},Y)}),inputCb:Y=>q({type:A.IncrementalSnapshot,data:O({source:M.Input},Y)}),mediaInteractionCb:Y=>q({type:A.IncrementalSnapshot,data:O({source:M.MediaInteraction},Y)}),styleSheetRuleCb:Y=>q({type:A.IncrementalSnapshot,data:O({source:M.StyleSheetRule},Y)}),styleDeclarationCb:Y=>q({type:A.IncrementalSnapshot,data:O({source:M.StyleDeclaration},Y)}),canvasMutationCb:ji,fontCb:Y=>q({type:A.IncrementalSnapshot,data:O({source:M.Font},Y)}),selectionCb:Y=>{q({type:A.IncrementalSnapshot,data:O({source:M.Selection},Y)})},customElementCb:Y=>{q({type:A.IncrementalSnapshot,data:O({source:M.CustomElement},Y)})},blockClass:f,ignoreClass:m,ignoreSelector:g,maskTextClass:p,maskTextSelector:y,maskInputOptions:Jr,inlineStylesheet:v,sampling:x,recordDOM:j,recordCanvas:ee,inlineImages:se,inlineVideos:he,userTriggeredOnInput:ce,collectFonts:ue,doc:Q,maskInputFn:R,maskTextFn:T,keepIframeSrcFn:ie,blockSelector:d,slimDOMOptions:Kr,dataURLOptions:Ft,mirror:de,iframeManager:Pe,stylesheetManager:Le,shadowDomManager:Wt,processedNodeManager:qr,canvasManager:St,ignoreCSSAttributes:Re,privacySetting:ke,plugins:((ye=J==null?void 0:J.filter(Y=>Y.observer))==null?void 0:ye.map(Y=>({observer:Y.observer,options:Y.options,callback:es=>q({type:A.Plugin,data:{plugin:Y.name,payload:es}})})))||[]},D)};Pe.addLoadListener(Q=>{try{z.push(fe(Q.contentDocument))}catch(ye){console.warn(ye)}});const K=()=>{wr(),z.push(fe(document)),Lr=!0};return document.readyState==="interactive"||document.readyState==="complete"?K():(z.push(oe("DOMContentLoaded",()=>{q({type:A.DomContentLoaded,data:{}}),N==="DOMContentLoaded"&&K()})),z.push(oe("load",()=>{q({type:A.Load,data:{}}),N==="load"&&K()},window))),()=>{z.forEach(Q=>Q()),qr.destroy(),Lr=!1,sp()}}catch(z){console.warn(z)}}Me.addCustomEvent=(s,e)=>{Lr&&q({type:A.Custom,data:{tag:s,payload:e}})};Me.freezePage=()=>{Fe.forEach(s=>s.freeze())};Me.takeFullSnapshot=s=>{if(!Lr)throw new Error("please take full snapshot after start recording");wr(s)};Me.snapshotCanvas=async s=>{if(!St)throw new Error("canvas manager is not initialized");await St.snapshot(s)};Me.mirror=de;function ll(s){return{all:s=s||new Map,on:function(e,t){var r=s.get(e);r?r.push(t):s.set(e,[t])},off:function(e,t){var r=s.get(e);r&&(t?r.splice(r.indexOf(t)>>>0,1):s.set(e,[]))},emit:function(e,t){var r=s.get(e);r&&r.slice().map(function(i){i(t)}),(r=s.get("*"))&&r.slice().map(function(i){i(e,t)})}}}const Op=Object.freeze(Object.defineProperty({__proto__:null,default:ll},Symbol.toStringTag,{value:"Module"}));function Tp(s=window,e=document){if("scrollBehavior"in e.documentElement.style&&s.__forceSmoothScrollPolyfill__!==!0)return;const t=s.HTMLElement||s.Element,r=468,i={scroll:s.scroll||s.scrollTo,scrollBy:s.scrollBy,elementScroll:t.prototype.scroll||a,scrollIntoView:t.prototype.scrollIntoView},n=s.performance&&s.performance.now?s.performance.now.bind(s.performance):Date.now;function o(y){const v=["MSIE ","Trident/","Edge/"];return new RegExp(v.join("|")).test(y)}const l=o(s.navigator.userAgent)?1:0;function a(y,v){this.scrollLeft=y,this.scrollTop=v}function c(y){return .5*(1-Math.cos(Math.PI*y))}function u(y){if(y===null||typeof y!="object"||y.behavior===void 0||y.behavior==="auto"||y.behavior==="instant")return!0;if(typeof y=="object"&&y.behavior==="smooth")return!1;throw new TypeError("behavior member of ScrollOptions "+y.behavior+" is not a valid value for enumeration ScrollBehavior.")}function h(y,v){if(v==="Y")return y.clientHeight+l<y.scrollHeight;if(v==="X")return y.clientWidth+l<y.scrollWidth}function f(y,v){const b=s.getComputedStyle(y,null)["overflow"+v];return b==="auto"||b==="scroll"}function d(y){const v=h(y,"Y")&&f(y,"Y"),b=h(y,"X")&&f(y,"X");return v||b}function m(y){for(;y!==e.body&&d(y)===!1;)y=y.parentNode||y.host;return y}function g(y){const v=n();let b,S,C,R=(v-y.startTime)/r;R=R>1?1:R,b=c(R),S=y.startX+(y.x-y.startX)*b,C=y.startY+(y.y-y.startY)*b,y.method.call(y.scrollable,S,C),(S!==y.x||C!==y.y)&&s.requestAnimationFrame(g.bind(s,y))}function p(y,v,b){let S,C,R,T;const D=n();y===e.body?(S=s,C=s.scrollX||s.pageXOffset,R=s.scrollY||s.pageYOffset,T=i.scroll):(S=y,C=y.scrollLeft,R=y.scrollTop,T=a),g({scrollable:S,method:T,startTime:D,startX:C,startY:R,x:v,y:b})}s.scroll=s.scrollTo=function(){if(arguments[0]!==void 0){if(u(arguments[0])===!0){i.scroll.call(s,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:s.scrollX||s.pageXOffset,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:s.scrollY||s.pageYOffset);return}p.call(s,e.body,arguments[0].left!==void 0?~~arguments[0].left:s.scrollX||s.pageXOffset,arguments[0].top!==void 0?~~arguments[0].top:s.scrollY||s.pageYOffset)}},s.scrollBy=function(){if(arguments[0]!==void 0){if(u(arguments[0])){i.scrollBy.call(s,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:0,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:0);return}p.call(s,e.body,~~arguments[0].left+(s.scrollX||s.pageXOffset),~~arguments[0].top+(s.scrollY||s.pageYOffset))}},t.prototype.scroll=t.prototype.scrollTo=function(){if(arguments[0]===void 0)return;if(u(arguments[0])===!0){if(typeof arguments[0]=="number"&&arguments[1]===void 0)throw new SyntaxError("Value could not be converted");i.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left:typeof arguments[0]!="object"?~~arguments[0]:this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top:arguments[1]!==void 0?~~arguments[1]:this.scrollTop);return}const y=arguments[0].left,v=arguments[0].top;p.call(this,this,typeof y=="undefined"?this.scrollLeft:~~y,typeof v=="undefined"?this.scrollTop:~~v)},t.prototype.scrollBy=function(){if(arguments[0]!==void 0){if(u(arguments[0])===!0){i.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop);return}this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior})}},t.prototype.scrollIntoView=function(){if(u(arguments[0])===!0){i.scrollIntoView.call(this,arguments[0]===void 0?!0:arguments[0]);return}const y=m(this),v=y.getBoundingClientRect(),b=this.getBoundingClientRect();y!==e.body?(p.call(this,y,y.scrollLeft+b.left-v.left,y.scrollTop+b.top-v.top),s.getComputedStyle(y).position!=="fixed"&&s.scrollBy({left:v.left,top:v.top,behavior:"smooth"})):s.scrollBy({left:b.left,top:b.top,behavior:"smooth"})}}class Dp{constructor(e=[],t){w(this,"timeOffset",0),w(this,"speed"),w(this,"actions"),w(this,"raf",null),w(this,"lastTimestamp"),this.actions=e,this.speed=t.speed}addAction(e){const t=this.raf===!0;if(!this.actions.length||this.actions[this.actions.length-1].delay<=e.delay)this.actions.push(e);else{const r=this.findActionIndex(e);this.actions.splice(r,0,e)}t&&(this.raf=requestAnimationFrame(this.rafCheck.bind(this)))}addActions(e){this.actions=this.actions.concat(e)}replaceActions(e){const t=this.raf===!0;this.actions.length=0,this.actions=[...e],t&&(this.raf=requestAnimationFrame(this.rafCheck.bind(this)))}start(){this.timeOffset=0,this.lastTimestamp=performance.now(),this.raf=requestAnimationFrame(this.rafCheck.bind(this))}rafCheck(){const e=performance.now();for(this.timeOffset+=(e-this.lastTimestamp)*this.speed,this.lastTimestamp=e;this.actions.length;){const t=this.actions[0];if(this.timeOffset>=t.delay)this.actions.shift(),t.doAction();else break}this.actions.length>0?this.raf=requestAnimationFrame(this.rafCheck.bind(this)):this.raf=!0}clear(){this.raf&&(this.raf!==!0&&cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(e){this.speed=e}isActive(){return this.raf!==null}findActionIndex(e){let t=0,r=this.actions.length-1;for(;t<=r;){const i=Math.floor((t+r)/2);if(this.actions[i].delay<e.delay)t=i+1;else if(this.actions[i].delay>e.delay)r=i-1;else return i+1}return t}}function ds(s,e){if(s.type===A.IncrementalSnapshot&&s.data.source===M.MouseMove&&s.data.positions&&s.data.positions.length){const t=s.data.positions[0].timeOffset,r=s.timestamp+t;return s.delay=r-e,r-e}return s.delay=s.timestamp-e,s.delay}/*! *****************************************************************************
60
72
  Copyright (c) Microsoft Corporation.
61
73
 
62
74
  Permission to use, copy, modify, and/or distribute this software for any
@@ -69,8 +81,8 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
69
81
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
70
82
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
71
83
  PERFORMANCE OF THIS SOFTWARE.
72
- ***************************************************************************** */function qn(s,e){var t=typeof Symbol=="function"&&s[Symbol.iterator];if(!t)return s;var r,i,n=t.call(s),o=[];try{for(;(e===void 0||e-- >0)&&!(r=n.next()).done;)o.push(r.value)}catch(l){i={error:l}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return o}var Ke;(function(s){s[s.NotStarted=0]="NotStarted",s[s.Running=1]="Running",s[s.Stopped=2]="Stopped"})(Ke||(Ke={}));var cl={type:"xstate.init"};function ps(s){return s===void 0?[]:[].concat(s)}function $e(s){return{type:"xstate.assign",assignment:s}}function eo(s,e){return typeof(s=typeof s=="string"&&e&&e[s]?e[s]:s)=="string"?{type:s}:typeof s=="function"?{type:s.name,exec:s}:s}function Pr(s){return function(e){return s===e}}function ul(s){return typeof s=="string"?{type:s}:s}function to(s,e){return{value:s,context:e,actions:[],changed:!1,matches:Pr(s)}}function ro(s,e,t){var r=e,i=!1;return[s.filter(function(n){if(n.type==="xstate.assign"){i=!0;var o=Object.assign({},r);return typeof n.assignment=="function"?o=n.assignment(r,t):Object.keys(n.assignment).forEach(function(l){o[l]=typeof n.assignment[l]=="function"?n.assignment[l](r,t):n.assignment[l]}),r=o,!1}return!0}),r,i]}function hl(s,e){e===void 0&&(e={});var t=qn(ro(ps(s.states[s.initial].entry).map(function(o){return eo(o,e.actions)}),s.context,cl),2),r=t[0],i=t[1],n={config:s,_options:e,initialState:{value:s.initial,actions:r,context:i,matches:Pr(s.initial)},transition:function(o,l){var a,c,u=typeof o=="string"?{value:o,context:s.context}:o,h=u.value,f=u.context,d=ul(l),m=s.states[h];if(m.on){var g=ps(m.on[d.type]);try{for(var p=function(N){var ce=typeof Symbol=="function"&&Symbol.iterator,ue=ce&&N[ce],se=0;if(ue)return ue.call(N);if(N&&typeof N.length=="number")return{next:function(){return N&&se>=N.length&&(N=void 0),{value:N&&N[se++],done:!N}}};throw new TypeError(ce?"Object is not iterable.":"Symbol.iterator is not defined.")}(g),y=p.next();!y.done;y=p.next()){var v=y.value;if(v===void 0)return to(h,f);var b=typeof v=="string"?{target:v}:v,S=b.target,C=b.actions,R=C===void 0?[]:C,T=b.cond,D=S===void 0;if((T===void 0?function(){return!0}:T)(f,d)){var I=s.states[S!=null?S:h],x=qn(ro((D?ps(R):[].concat(m.exit,R,I.entry).filter(function(N){return N})).map(function(N){return eo(N,n._options.actions)}),f,d),3),U=x[0],j=x[1],ee=x[2],ae=S!=null?S:h;return{value:ae,context:j,actions:U,changed:S!==h||U.length>0||ee,matches:Pr(ae)}}}}catch(N){a={error:N}}finally{try{y&&!y.done&&(c=p.return)&&c.call(p)}finally{if(a)throw a.error}}}return to(h,f)}};return n}var so=function(s,e){return s.actions.forEach(function(t){var r=t.exec;return r&&r(s.context,e)})};function fl(s){var e=s.initialState,t=Ke.NotStarted,r=new Set,i={_machine:s,send:function(n){t===Ke.Running&&(e=s.transition(e,n),so(e,ul(n)),r.forEach(function(o){return o(e)}))},subscribe:function(n){return r.add(n),n(e),{unsubscribe:function(){return r.delete(n)}}},start:function(n){if(n){var o=typeof n=="object"?n:{context:s.config.context,value:n};e={value:o.value,actions:[],context:o.context,matches:Pr(o.value)}}return t=Ke.Running,so(e,cl),i},stop:function(){return t=Ke.Stopped,r.clear(),i},get state(){return e},get status(){return t}};return i}function _p(s,e){for(let t=s.length-1;t>=0;t--){const r=s[t];if(r.type===A.Meta&&r.timestamp<=e)return s.slice(t)}return s}function kp(s,{getCastFn:e,applyEventsSynchronously:t,emitter:r}){const i=hl({id:"player",context:s,initial:"paused",states:{playing:{on:{PAUSE:{target:"paused",actions:["pause"]},CAST_EVENT:{target:"playing",actions:"castEvent"},END:{target:"paused",actions:["resetLastPlayedEvent","pause"]},ADD_EVENT:{target:"playing",actions:["addEvent"]},REPLACE_EVENTS:{target:"playing",actions:["replaceEvents"]}}},paused:{on:{PLAY:{target:"playing",actions:["recordTimeOffset","play"]},CAST_EVENT:{target:"paused",actions:"castEvent"},TO_LIVE:{target:"live",actions:["startLive"]},ADD_EVENT:{target:"paused",actions:["addEvent"]},REPLACE_EVENTS:{target:"paused",actions:["replaceEvents"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]},CAST_EVENT:{target:"live",actions:["castEvent"]}}}}},{actions:{castEvent:$e({lastPlayedEvent:(n,o)=>o.type==="CAST_EVENT"?o.payload.event:n.lastPlayedEvent}),recordTimeOffset:$e((n,o)=>{let l=n.timeOffset;return"payload"in o&&"timeOffset"in o.payload&&(l=o.payload.timeOffset),te(O({},n),{timeOffset:l,baselineTime:n.events[0].timestamp+l})}),play(n){var o;const{timer:l,events:a,baselineTime:c,lastPlayedEvent:u}=n;l.clear();for(const m of a)ds(m,c);const h=_p(a,c);let f=u==null?void 0:u.timestamp;(u==null?void 0:u.type)===A.IncrementalSnapshot&&u.data.source===M.MouseMove&&(f=u.timestamp+((o=u.data.positions[0])==null?void 0:o.timeOffset)),c<(f||0)&&r.emit(F.PlayBack);const d=new Array;for(const m of h)if(!(f&&f<c&&(m.timestamp<=f||m===u)))if(m.timestamp<c)d.push(m);else{const g=e(m,!1);l.addAction({doAction:()=>{g()},delay:m.delay})}t(d),r.emit(F.Flush),l.start()},pause(n){n.timer.clear()},resetLastPlayedEvent:$e(n=>te(O({},n),{lastPlayedEvent:null})),startLive:$e({baselineTime:(n,o)=>(n.timer.start(),o.type==="TO_LIVE"&&o.payload.baselineTime?o.payload.baselineTime:Date.now())}),replaceEvents:$e((n,o)=>{const{events:l,timer:a,baselineTime:c}=n;if(o.type==="REPLACE_EVENTS"){const{events:u}=o.payload;l.length=0;const h=[];for(const f of u)if(ds(f,c),l.push(f),f.timestamp>=a.timeOffset+c){const d=e(f,!1);h.push({doAction:()=>{d()},delay:f.delay})}a.isActive()&&a.replaceActions(h)}return te(O({},n),{events:l})}),addEvent:$e((n,o)=>{const{baselineTime:l,timer:a,events:c}=n;if(o.type==="ADD_EVENT"){const{event:u}=o.payload;ds(u,l);let h=c.length-1;if(!c[h]||c[h].timestamp<=u.timestamp)c.push(u);else{let m=-1,g=0;for(;g<=h;){const p=Math.floor((g+h)/2);c[p].timestamp<=u.timestamp?g=p+1:h=p-1}m===-1&&(m=g),c.splice(m,0,u)}const f=u.timestamp<l,d=e(u,f);f?d():a.isActive()&&a.addAction({doAction:()=>{d()},delay:u.delay})}return te(O({},n),{events:c})})}});return fl(i)}function Lp(s){const e=hl({id:"speed",context:s,initial:"normal",states:{normal:{on:{FAST_FORWARD:{target:"skipping",actions:["recordSpeed","setSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}},skipping:{on:{BACK_TO_NORMAL:{target:"normal",actions:["restoreSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}}}},{actions:{setSpeed:(t,r)=>{"payload"in r&&t.timer.setSpeed(r.payload.speed)},recordSpeed:$e({normalSpeed:t=>t.timer.speed}),restoreSpeed:t=>{t.timer.setSpeed(t.normalSpeed)}}});return fl(e)}const Pp=s=>["noscript { display: none !important; }",`.${s} { background: currentColor; border-radius: 5px; }`,`.${s}:hover::after {content: 'Redacted'; color: white; background: black; text-align: center; width: 100%; display: block;}`],io=new Map;function dl(s,e){let t=io.get(s);return t||(t=new Map,io.set(s,t)),t.has(e)||t.set(e,[]),t.get(e)}function Te(s,e,t){return async r=>{if(r&&typeof r=="object"&&"rr_type"in r)if(t&&(t.isUnchanged=!1),r.rr_type==="ImageBitmap"&&"args"in r){const i=await Te(s,e,t)(r.args);return await createImageBitmap.apply(null,i)}else if("index"in r){if(t||e===null)return r;const{rr_type:i,index:n}=r;return dl(e,i)[n]}else if("args"in r){const{rr_type:i,args:n}=r,o=window[i];return new o(...await Promise.all(n.map(Te(s,e,t))))}else{if("base64"in r)return vp(r.base64);if("src"in r){const i=s.get(r.src);if(i)return i;{const n=new Image;return n.src=r.src,s.set(r.src,n),n}}else if("data"in r&&r.rr_type==="Blob"){const i=await Promise.all(r.data.map(Te(s,e,t)));return new Blob(i,{type:r.type})}}else if(Array.isArray(r))return await Promise.all(r.map(Te(s,e,t)));return r}}function $p(s,e){try{return e===xe.WebGL?s.getContext("webgl")||s.getContext("experimental-webgl"):s.getContext("webgl2")}catch(t){return null}}const Fp=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function Bp(s,e){if(!(e!=null&&e.constructor))return;const{name:t}=e.constructor;if(!Fp.includes(t))return;const r=dl(s,t);r.includes(e)||r.push(e)}async function Up({mutation:s,target:e,type:t,imageMap:r,errorHandler:i}){try{const n=$p(e,t);if(!n)return;if(s.setter){n[s.property]=s.args[0];return}const o=n[s.property],l=await Promise.all(s.args.map(Te(r,n))),a=o.apply(n,l);Bp(n,a);const c=!1}catch(n){i(s,n)}}async function Wp({event:s,mutations:e,target:t,imageMap:r,errorHandler:i}){const n=t.getContext("2d");if(!n){i(e[0],new Error("Canvas context is null"));return}const o=e.map(async a=>Promise.all(a.args.map(Te(r,n))));(await Promise.all(o)).forEach((a,c)=>{const u=e[c];try{if(u.setter){n[u.property]=u.args[0];return}const h=n[u.property];u.property==="drawImage"&&typeof u.args[0]=="string"?(r.get(s),h.apply(n,u.args)):h.apply(n,a)}catch(h){i(u,h)}})}async function qs({event:s,mutation:e,target:t,imageMap:r,canvasEventMap:i,errorHandler:n}){try{const o=i.get(s)||e,l="commands"in o?o.commands:[o];if([xe.WebGL,xe.WebGL2].includes(e.type)){for(let a=0;a<l.length;a++){const c=l[a];await Up({mutation:c,type:e.type,target:t,imageMap:r,errorHandler:n})}return}await Wp({event:s,mutations:l,target:t,imageMap:r,errorHandler:n})}catch(o){n(e,o)}}class zp{constructor(e){w(this,"mediaMap",new Map),w(this,"warn"),w(this,"service"),w(this,"speedService"),w(this,"emitter"),w(this,"getCurrentTime"),w(this,"metadataCallbackMap",new Map),this.warn=e.warn,this.service=e.service,this.speedService=e.speedService,this.emitter=e.emitter,this.getCurrentTime=e.getCurrentTime,this.emitter.on(F.Start,this.start.bind(this)),this.emitter.on(F.SkipStart,this.start.bind(this)),this.emitter.on(F.Pause,this.pause.bind(this)),this.emitter.on(F.Finish,this.pause.bind(this)),this.speedService.subscribe(()=>{this.syncAllMediaElements()})}syncAllMediaElements(e={pause:!1}){this.mediaMap.forEach((t,r)=>{this.syncTargetWithState(r),e.pause&&r.pause&&r.pause()})}start(){this.syncAllMediaElements()}pause(){this.syncAllMediaElements({pause:!0})}seekTo({time:e,target:t,mediaState:r}){if(r.isPlaying){const n=(e-r.lastInteractionTimeOffset)/1e3*r.playbackRate,o="duration"in t&&t.duration;if(Number.isNaN(o)){this.waitForMetadata(t);return}let l=r.currentTimeAtLastInteraction+n;t.loop&&o!==!1&&(l=l%o),t.currentTime=l}else t.pause(),t.currentTime=r.currentTimeAtLastInteraction}waitForMetadata(e){if(this.metadataCallbackMap.has(e)||!("addEventListener"in e))return;const t=()=>{this.metadataCallbackMap.delete(e);const r=this.mediaMap.get(e);r&&this.seekTo({time:this.getCurrentTime(),target:e,mediaState:r})};this.metadataCallbackMap.set(e,t),e.addEventListener("loadedmetadata",t,{once:!0})}getMediaStateFromMutation({target:e,timeOffset:t,mutation:r}){var d,m,g,p,y;const i=this.mediaMap.get(e),{type:n,playbackRate:o,currentTime:l,muted:a,volume:c,loop:u}=r;return{isPlaying:n===Ae.Play||n!==Ae.Pause&&((i==null?void 0:i.isPlaying)||e.getAttribute("autoplay")!==null),currentTimeAtLastInteraction:(d=l!=null?l:i==null?void 0:i.currentTimeAtLastInteraction)!=null?d:0,lastInteractionTimeOffset:t,playbackRate:(m=o!=null?o:i==null?void 0:i.playbackRate)!=null?m:1,volume:(g=c!=null?c:i==null?void 0:i.volume)!=null?g:1,muted:(p=a!=null?a:i==null?void 0:i.muted)!=null?p:e.getAttribute("muted")===null,loop:(y=u!=null?u:i==null?void 0:i.loop)!=null?y:e.getAttribute("loop")===null}}syncTargetWithState(e){const t=this.mediaMap.get(e);if(!t)return;const{muted:r,loop:i,volume:n,isPlaying:o}=t,l=this.service.state.matches("paused"),a=t.playbackRate*this.speedService.state.context.timer.speed;try{this.seekTo({time:this.getCurrentTime(),target:e,mediaState:t}),e.volume!==n&&(e.volume=n),e.muted=r,e.loop=i,e.playbackRate!==a&&(e.playbackRate=a),o&&!l?e.play():e.pause()}catch(c){this.warn(`Failed to replay media interactions: ${c.message||c}`)}}addMediaElements(e,t,r){if(!["AUDIO","VIDEO"].includes(e.nodeName))return;const i=e,n=r.getMeta(i);if(!n||!("attributes"in n))return;const o=this.service.state.matches("paused"),l=n.attributes;let a=!1;l.rr_mediaState?a=l.rr_mediaState==="played":a=i.getAttribute("autoplay")!==null,a&&o&&i.pause();let c=1;typeof l.rr_mediaPlaybackRate=="number"&&(c=l.rr_mediaPlaybackRate);let u=!1;typeof l.rr_mediaMuted=="boolean"?u=l.rr_mediaMuted:u=i.getAttribute("muted")!==null;let h=!1;typeof l.rr_mediaLoop=="boolean"?h=l.rr_mediaLoop:h=i.getAttribute("loop")!==null;let f=1;typeof l.rr_mediaVolume=="number"&&(f=l.rr_mediaVolume);let d=0;typeof l.rr_mediaCurrentTime=="number"&&(d=l.rr_mediaCurrentTime),this.mediaMap.set(i,{isPlaying:a,currentTimeAtLastInteraction:d,lastInteractionTimeOffset:t,playbackRate:c,volume:f,muted:u,loop:h}),this.syncTargetWithState(i)}mediaMutation({target:e,timeOffset:t,mutation:r}){this.mediaMap.set(e,this.getMediaStateFromMutation({target:e,timeOffset:t,mutation:r})),this.syncTargetWithState(e)}isSupportedMediaElement(e){return["AUDIO","VIDEO"].includes(e.nodeName)}reset(){this.mediaMap.clear()}}function hr(s,e){if(s.nodeName!=="DIALOG"||s instanceof ge)return;const t=s,r=t.open,i=r&&t.matches("dialog:modal"),n=t.getAttribute("rr_open_mode"),o=typeof(e==null?void 0:e.attributes.open)=="string"||typeof t.getAttribute("open")=="string",l=n==="modal";if(!(r&&!(i&&n==="non-modal"||!i&&l))){if(!t.isConnected){console.warn("dialog is not attached to the dom",t);return}r&&t.close(),o&&(l?t.showModal():t.show())}}function Vp(s,e){if(s.nodeName!=="DIALOG"||s instanceof ge)return;const t=s;if(!t.isConnected){console.warn("dialog is not attached to the dom",t);return}e.attributes.open===null&&(t.removeAttribute("open"),t.removeAttribute("rr_open_mode"))}const no=5*1e3,oo=1*1e3,ao=60*60*1e3,Gp=ll||Op,lo="[replayer]",ms={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function gs(s){return s.type==A.IncrementalSnapshot&&(s.data.source==M.TouchMove||s.data.source==M.MouseInteraction&&s.data.type==W.TouchStart)}class jp{constructor(e,t){if(w(this,"wrapper"),w(this,"iframe"),w(this,"service"),w(this,"speedService"),w(this,"config"),w(this,"usingVirtualDom",!1),w(this,"virtualDom",new ot),w(this,"mouse"),w(this,"mouseTail",null),w(this,"tailPositions",[]),w(this,"emitter",Gp()),w(this,"nextUserInteractionEvent"),w(this,"activityIntervals",[]),w(this,"inactiveEndTimestamp"),w(this,"legacy_missingNodeRetryMap",{}),w(this,"cache",Cn()),w(this,"imageMap",new Map),w(this,"canvasEventMap",new Map),w(this,"mirror",ho()),w(this,"styleMirror",new Bi),w(this,"mediaManager"),w(this,"firstFullSnapshot",null),w(this,"newDocumentQueue",[]),w(this,"mousePos",null),w(this,"touchActive",null),w(this,"lastMouseDownEvent",null),w(this,"lastHoveredRootNode"),w(this,"lastSelectionData",null),w(this,"constructedStyleMutations",[]),w(this,"adoptedStyleSheets",[]),w(this,"handleResize",l=>{this.iframe.style.display="inherit";for(const a of[this.mouseTail,this.iframe])a&&(a.setAttribute("width",String(l.width)),a.setAttribute("height",String(l.height)))}),w(this,"applyEventsSynchronously",l=>{for(const a of l){switch(a.type){case A.DomContentLoaded:case A.Load:case A.Custom:continue;case A.FullSnapshot:case A.Meta:case A.Plugin:case A.IncrementalSnapshot:break}this.getCastFn(a,!0)()}}),w(this,"getCastFn",(l,a=!1)=>{let c;switch(l.type){case A.DomContentLoaded:case A.Load:break;case A.Custom:c=()=>{this.emitter.emit(F.CustomEvent,l)};break;case A.Meta:c=()=>this.emitter.emit(F.Resize,{width:l.data.width,height:l.data.height});break;case A.FullSnapshot:c=()=>{var h;if(this.firstFullSnapshot){if(this.firstFullSnapshot===l){this.firstFullSnapshot=!0;return}}else this.firstFullSnapshot=!0;this.mediaManager.reset(),this.styleMirror.reset(),this.rebuildFullSnapshot(l,a),(h=this.iframe.contentWindow)==null||h.scrollTo(l.data.initialOffset)};break;case A.IncrementalSnapshot:c=()=>{if(this.applyIncremental(l,a),!a&&(this.handleInactivity(l.timestamp),l===this.nextUserInteractionEvent&&(this.nextUserInteractionEvent=null,this.backToNormal()),this.config.skipInactive&&!this.nextUserInteractionEvent)){for(const h of this.service.state.context.events)if(!(h.timestamp<=l.timestamp)&&this.isUserInteraction(h)){h.delay-l.delay>this.config.inactivePeriodThreshold*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=h);break}if(this.nextUserInteractionEvent){const h=this.nextUserInteractionEvent.delay-l.delay,f={speed:Math.min(Math.round(h/no),this.config.maxSpeed)};this.speedService.send({type:"FAST_FORWARD",payload:f}),this.emitter.emit(F.SkipStart,f)}}};break}return()=>{c&&c();for(const f of this.config.plugins||[])f.handler&&f.handler(l,a,{replayer:this});this.service.send({type:"CAST_EVENT",payload:{event:l}});const h=this.service.state.context.events.length-1;if(!this.config.liveMode&&l===this.service.state.context.events[h]){const f=()=>{h<this.service.state.context.events.length-1||(this.backToNormal(),this.service.send("END"),this.emitter.emit(F.Finish))};let d=50;l.type===A.IncrementalSnapshot&&l.data.source===M.MouseMove&&l.data.positions.length&&(d+=Math.max(0,-l.data.positions[0].timeOffset)),setTimeout(f,d)}this.emitter.emit(F.EventCast,l)}}),!(t!=null&&t.liveMode)&&e.length<2)throw new Error("Replayer need at least 2 events.");const r={speed:1,maxSpeed:360,root:document.body,loadTimeout:0,skipInactive:!1,inactivePeriodThreshold:10*1e3,showWarning:!0,showDebug:!1,blockClass:"highlight-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:ms,useVirtualDom:!0,logger:console,inactiveThreshold:.02,inactiveSkipTime:no};this.config=Object.assign({},r,t),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on(F.Resize,this.handleResize),this.setupDom();for(const l of this.config.plugins||[])l.getMirror&&l.getMirror({nodeMirror:this.mirror});this.emitter.on(F.Flush,()=>{if(this.usingVirtualDom){const l={mirror:this.mirror,applyCanvas:(a,c,u)=>{qs({event:a,mutation:c,target:u,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this),applyStyleSheetMutation:(a,c)=>{a.source===M.StyleSheetRule?this.applyStyleSheetRule(a,c):a.source===M.StyleDeclaration&&this.applyStyleDeclaration(a,c)},afterAppend:(a,c)=>{for(const u of this.config.plugins||[])u.onBuild&&u.onBuild(a,{id:c,replayer:this})}};if(this.iframe.contentDocument)try{Tr(this.iframe.contentDocument,this.virtualDom,l,this.virtualDom.mirror)}catch(a){console.warn(a)}if(this.virtualDom.destroyTree(),this.usingVirtualDom=!1,Object.keys(this.legacy_missingNodeRetryMap).length)for(const a in this.legacy_missingNodeRetryMap)try{const c=this.legacy_missingNodeRetryMap[a],u=Dr(c.node,this.mirror,this.virtualDom.mirror);Tr(u,c.node,l,this.virtualDom.mirror),c.node=u}catch(c){this.warn(c)}this.constructedStyleMutations.forEach(a=>{this.applyStyleSheetMutation(a)}),this.constructedStyleMutations=[],this.adoptedStyleSheets.forEach(a=>{this.applyAdoptedStyleSheet(a)}),this.adoptedStyleSheets=[]}if(this.mousePos&&(this.moveAndHover(this.mousePos.x,this.mousePos.y,this.mousePos.id,!0,this.mousePos.debugData),this.mousePos=null),this.touchActive===!0?this.mouse.classList.add("touch-active"):this.touchActive===!1&&this.mouse.classList.remove("touch-active"),this.touchActive=null,this.lastMouseDownEvent){const[l,a]=this.lastMouseDownEvent;l.dispatchEvent(a)}this.lastMouseDownEvent=null,this.lastSelectionData&&(this.applySelection(this.lastSelectionData),this.lastSelectionData=null)}),this.emitter.on(F.PlayBack,()=>{this.firstFullSnapshot=null,this.mirror.reset(),this.styleMirror.reset(),this.mediaManager.reset()});const i=new Dp([],{speed:this.config.speed});this.service=kp({events:e.map(l=>t&&t.unpackFn?t.unpackFn(l):l).sort((l,a)=>l.timestamp-a.timestamp),timer:i,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe(l=>{this.emitter.emit(F.StateChange,{player:l})}),this.speedService=Lp({normalSpeed:-1,timer:i}),this.speedService.start(),this.speedService.subscribe(l=>{this.emitter.emit(F.StateChange,{speed:l})}),this.mediaManager=new zp({warn:this.warn.bind(this),service:this.service,speedService:this.speedService,emitter:this.emitter,getCurrentTime:this.getCurrentTime.bind(this)});const n=this.service.state.context.events.find(l=>l.type===A.Meta),o=this.service.state.context.events.find(l=>l.type===A.FullSnapshot);if(n){const{width:l,height:a}=n.data;setTimeout(()=>{this.emitter.emit(F.Resize,{width:l,height:a})},0)}o&&setTimeout(()=>{var l;this.firstFullSnapshot||(this.firstFullSnapshot=o,this.rebuildFullSnapshot(o),(l=this.iframe.contentWindow)==null||l.scrollTo(o.data.initialOffset))},1),this.service.state.context.events.find(gs)&&this.mouse.classList.add("touch-device")}get timer(){return this.service.state.context.timer}on(e,t){return this.emitter.on(e,t),this}off(e,t){return this.emitter.off(e,t),this}setConfig(e){Object.keys(e).forEach(t=>{e[t],this.config[t]=e[t]}),this.config.skipInactive||this.backToNormal(),typeof e.speed!="undefined"&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}}),typeof e.mouseTail!="undefined"&&(e.mouseTail===!1?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"))}getActivityIntervals(){if(this.activityIntervals.length==0){const e=[],t=this.getMetaData(),r=[{timestamp:t.startTime},...this.service.state.context.events.filter(o=>this.isUserInteraction(o)),{timestamp:t.endTime}];for(let o=1;o<r.length;o++){const l=r[o-1],a=r[o];a.timestamp-l.timestamp>this.config.inactivePeriodThreshold?e.push({startTime:l.timestamp,endTime:a.timestamp,duration:a.timestamp-l.timestamp,active:!1}):e.push({startTime:l.timestamp,endTime:a.timestamp,duration:a.timestamp-l.timestamp,active:!0})}const i=[];let n=e[0];for(let o=1;o<e.length;o++)e[o].active!=e[o-1].active&&(i.push({startTime:n.startTime,endTime:e[o-1].endTime,duration:e[o-1].endTime-n.startTime,active:e[o-1].active}),n=e[o]);n&&e.length>0&&i.push({startTime:n.startTime,endTime:e[e.length-1].endTime,duration:e[e.length-1].endTime-n.startTime,active:e[e.length-1].active}),n=i[0];for(let o=1;o<i.length;o++)(!i[o].active&&i[o].duration>this.config.inactiveThreshold*t.totalTime||!i[o-1].active&&i[o-1].duration>this.config.inactiveThreshold*t.totalTime)&&(this.activityIntervals.push({startTime:n.startTime,endTime:i[o-1].endTime,duration:i[o-1].endTime-n.startTime,active:i[o-1].active}),n=i[o]);n&&i.length>0&&this.activityIntervals.push({startTime:n.startTime,endTime:i[i.length-1].endTime,duration:i[i.length-1].endTime-n.startTime,active:i[i.length-1].active})}return this.activityIntervals}getMetaData(){const e=this.service.state.context.events[0],t=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:e.timestamp,endTime:t.timestamp,totalTime:t.timestamp-e.timestamp}}getCurrentTime(){return this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){const{baselineTime:e,events:t}=this.service.state.context;return e-t[0].timestamp}getMirror(){return this.mirror}play(e=0){var t,r;this.service.state.matches("paused")?this.service.send({type:"PLAY",payload:{timeOffset:e}}):(this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:e}})),(r=(t=this.iframe.contentDocument)==null?void 0:t.getElementsByTagName("html")[0])==null||r.classList.remove("rrweb-paused"),this.emitter.emit(F.Start)}pause(e){var t,r;e===void 0&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),typeof e=="number"&&(this.play(e),this.service.send({type:"PAUSE"})),(r=(t=this.iframe.contentDocument)==null?void 0:t.getElementsByTagName("html")[0])==null||r.classList.add("rrweb-paused"),this.emitter.emit(F.Pause)}resume(e=0){this.warn("The 'resume' was deprecated in 1.0. Please use 'play' method which has the same interface."),this.play(e),this.emitter.emit(F.Resume)}destroy(){this.pause(),this.mirror.reset(),this.styleMirror.reset(),this.mediaManager.reset(),this.config.root.removeChild(this.wrapper),this.emitter.emit(F.Destroy)}startLive(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})}addEvent(e){const t=this.config.unpackFn?this.config.unpackFn(e):e;gs(t)&&this.mouse.classList.add("touch-device"),Promise.resolve().then(()=>this.service.send({type:"ADD_EVENT",payload:{event:t}}))}replaceEvents(e){for(const t of e)if(gs(t)){this.mouse.classList.add("touch-device");break}this.service.send({type:"REPLACE_EVENTS",payload:{events:e}})}enableInteract(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"}disableInteract(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"}resetCache(){this.cache=Cn()}setupDom(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),this.config.mouseTail!==!1&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.iframe=document.createElement("iframe");const e=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&e.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",e.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe),this.iframe.contentWindow&&this.iframe.contentDocument&&(Tp(this.iframe.contentWindow,this.iframe.contentDocument),Li(this.iframe.contentWindow))}handleInactivity(e,t){if((e===this.inactiveEndTimestamp||t)&&(this.inactiveEndTimestamp=null,this.backToNormal()),this.config.skipInactive&&!this.inactiveEndTimestamp){for(const r of this.getActivityIntervals())if(e>=r.startTime&&e<r.endTime&&!r.active){this.inactiveEndTimestamp=r.endTime;break}if(this.inactiveEndTimestamp){const r=this.inactiveEndTimestamp-e,i={speed:r/ao*this.config.inactiveSkipTime<oo?r/oo:Math.round(Math.max(r,ao)/this.config.inactiveSkipTime)};this.speedService.send({type:"FAST_FORWARD",payload:i}),this.emitter.emit(F.SkipStart,i)}}}rebuildFullSnapshot(e,t=!1){if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&this.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={};const r=[],i=new Set,n=(a,c)=>{if(a.nodeName==="DIALOG"&&i.add(a),this.collectIframeAndAttachDocument(r,a),this.mediaManager.isSupportedMediaElement(a)){const{events:u}=this.service.state.context;this.mediaManager.addMediaElements(a,e.timestamp-u[0].timestamp,this.mirror)}for(const u of this.config.plugins||[])u.onBuild&&u.onBuild(a,{id:c,replayer:this})};this.usingVirtualDom&&(this.virtualDom.destroyTree(),this.usingVirtualDom=!1),this.mirror.reset(),wh(e.data.node,{doc:this.iframe.contentDocument,afterAppend:n,cache:this.cache,mirror:this.mirror}),n(this.iframe.contentDocument,e.data.node.id);for(const{mutationInQueue:a,builtNode:c}of r)this.attachDocumentToIframe(a,c),this.newDocumentQueue=this.newDocumentQueue.filter(u=>u!==a);const{documentElement:o,head:l}=this.iframe.contentDocument;this.insertStyleRules(o,l),i.forEach(a=>hr(a)),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(F.FullsnapshotRebuilded,e),t||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()}insertStyleRules(e,t){var r;const i=Pp(this.config.blockClass).concat(this.config.insertStyleRules);if(this.config.pauseAnimation&&i.push("html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }"),!!i.length)if(this.usingVirtualDom){const n=this.virtualDom.createElement("style");this.virtualDom.mirror.add(n,ja(n,this.virtualDom.unserializedId)),e.insertBefore(n,t),n.rules.push({source:M.StyleSheetRule,adds:i.map((o,l)=>({rule:o,index:l}))})}else{const n=document.createElement("style");e.insertBefore(n,t);for(let o=0;o<i.length;o++)(r=n.sheet)==null||r.insertRule(i[o],o)}}attachDocumentToIframe(e,t){const r=this.usingVirtualDom?this.virtualDom.mirror:this.mirror,i=[],n=new Set,o=(l,a)=>{l.nodeName==="DIALOG"&&n.add(l),this.collectIframeAndAttachDocument(i,l);const c=r.getMeta(l);if((c==null?void 0:c.type)===Ce.Element&&(c==null?void 0:c.tagName.toUpperCase())==="HTML"){const{documentElement:u,head:h}=t.contentDocument;this.insertStyleRules(u,h)}if(!this.usingVirtualDom)for(const u of this.config.plugins||[])u.onBuild&&u.onBuild(l,{id:a,replayer:this})};bt(e.node,{doc:t.contentDocument,mirror:r,hackCss:!0,skipChild:!1,afterAppend:o,cache:this.cache}),o(t.contentDocument,e.node.id);for(const{mutationInQueue:l,builtNode:a}of i)this.attachDocumentToIframe(l,a),this.newDocumentQueue=this.newDocumentQueue.filter(c=>c!==l);n.forEach(l=>hr(l))}collectIframeAndAttachDocument(e,t){if(Qe(t,this.mirror)){const r=this.newDocumentQueue.find(i=>i.parentId===this.mirror.getId(t));r&&e.push({mutationInQueue:r,builtNode:t})}}waitForStylesheetLoad(){var e;const t=(e=this.iframe.contentDocument)==null?void 0:e.head;if(t){const r=new Set;let i,n=this.service.state;const o=()=>{n=this.service.state};this.emitter.on(F.Start,o),this.emitter.on(F.Pause,o);const l=()=>{this.emitter.off(F.Start,o),this.emitter.off(F.Pause,o)};t.querySelectorAll('link[rel="stylesheet"]').forEach(a=>{a.sheet||(r.add(a),a.addEventListener("load",()=>{r.delete(a),r.size===0&&i!==-1&&(n.matches("playing")&&this.play(this.getCurrentTime()),this.emitter.emit(F.LoadStylesheetEnd),i&&clearTimeout(i),l())}))}),r.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(F.LoadStylesheetStart),i=setTimeout(()=>{n.matches("playing")&&this.play(this.getCurrentTime()),i=-1,l()},this.config.loadTimeout))}}async preloadAllImages(){const e=[];for(const t of this.service.state.context.events)t.type===A.IncrementalSnapshot&&t.data.source===M.CanvasMutation&&(e.push(this.deserializeAndPreloadCanvasEvents(t.data,t)),("commands"in t.data?t.data.commands:[t.data]).forEach(i=>{this.preloadImages(i,t)}));return Promise.all(e)}preloadImages(e,t){if(e.property==="drawImage"&&typeof e.args[0]=="string"&&!this.imageMap.has(t)){const r=document.createElement("canvas"),i=r.getContext("2d"),n=i==null?void 0:i.createImageData(r.width,r.height);i==null||i.putImageData(n,0,0)}}async deserializeAndPreloadCanvasEvents(e,t){if(!this.canvasEventMap.has(t)){const r={isUnchanged:!0};if("commands"in e){const i=await Promise.all(e.commands.map(async n=>{const o=await Promise.all(n.args.map(Te(this.imageMap,null,r)));return te(O({},n),{args:o})}));r.isUnchanged===!1&&this.canvasEventMap.set(t,te(O({},e),{commands:i}))}else{const i=await Promise.all(e.args.map(Te(this.imageMap,null,r)));r.isUnchanged===!1&&this.canvasEventMap.set(t,te(O({},e),{args:i}))}}}applyIncremental(e,t){var r,i,n;const{data:o}=e;switch(o.source){case M.Mutation:{try{this.applyMutation(o,t)}catch(l){this.warn(`Exception in mutation ${l.message||l}`,o)}break}case M.Drag:case M.TouchMove:case M.MouseMove:if(t){const l=o.positions[o.positions.length-1];this.mousePos={x:l.x,y:l.y,id:l.id,debugData:o}}else o.positions.forEach(l=>{const a={doAction:()=>{this.moveAndHover(l.x,l.y,l.id,t,o)},delay:l.timeOffset+e.timestamp-this.service.state.context.baselineTime};this.timer.addAction(a)}),this.timer.addAction({doAction(){},delay:e.delay-((r=o.positions[0])==null?void 0:r.timeOffset)});break;case M.MouseInteraction:{if(o.id===-1)break;const l=new Event(Be(W[o.type])),a=this.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);this.emitter.emit(F.MouseInteraction,{type:o.type,target:a});const{triggerFocus:c}=this.config;switch(o.type){case W.Blur:"blur"in a&&a.blur();break;case W.Focus:c&&a.focus&&a.focus({preventScroll:!0});break;case W.Click:case W.TouchStart:case W.TouchEnd:case W.MouseDown:case W.MouseUp:t?(o.type===W.TouchStart?this.touchActive=!0:o.type===W.TouchEnd&&(this.touchActive=!1),o.type===W.MouseDown?this.lastMouseDownEvent=[a,l]:o.type===W.MouseUp&&(this.lastMouseDownEvent=null),this.mousePos={x:o.x||0,y:o.y||0,id:o.id,debugData:o}):(o.type===W.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(o.x||0,o.y||0,o.id,t,o),o.type===W.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):o.type===W.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):o.type===W.TouchEnd?this.mouse.classList.remove("touch-active"):a.dispatchEvent(l));break;case W.TouchCancel:t?this.touchActive=!1:this.mouse.classList.remove("touch-active");break;default:a.dispatchEvent(l)}break}case M.Scroll:{if(o.id===-1)break;if(this.usingVirtualDom){const l=this.virtualDom.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);l.scrollData=o;break}this.applyScroll(o,t);break}case M.ViewportResize:this.emitter.emit(F.Resize,{width:o.width,height:o.height});break;case M.Input:{if(o.id===-1)break;if(this.usingVirtualDom){const l=this.virtualDom.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);l.inputData=o;break}this.applyInput(o);break}case M.MediaInteraction:{const l=this.usingVirtualDom?this.virtualDom.mirror.getNode(o.id):this.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);const a=l,{events:c}=this.service.state.context;this.mediaManager.mediaMutation({target:a,timeOffset:e.timestamp-c[0].timestamp,mutation:o});break}case M.StyleSheetRule:case M.StyleDeclaration:{this.usingVirtualDom?o.styleId?this.constructedStyleMutations.push(o):o.id&&((i=this.virtualDom.mirror.getNode(o.id))==null||i.rules.push(o)):this.applyStyleSheetMutation(o);break}case M.CanvasMutation:{if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){const l=this.virtualDom.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);l.canvasMutations.push({event:e,mutation:o})}else{const l=this.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);qs({event:e,mutation:o,target:l,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})}break}case M.Font:{try{const l=new FontFace(o.family,o.buffer?new Uint8Array(JSON.parse(o.fontSource)):o.fontSource,o.descriptors);(n=this.iframe.contentDocument)==null||n.fonts.add(l)}catch(l){this.warn(l)}break}case M.Selection:{if(t){this.lastSelectionData=o;break}this.applySelection(o);break}case M.AdoptedStyleSheet:{this.usingVirtualDom?this.adoptedStyleSheets.push(o):this.applyAdoptedStyleSheet(o);break}}}applyMutation(e,t){if(this.config.useVirtualDom&&!this.usingVirtualDom&&t&&(this.usingVirtualDom=!0,Pd(this.iframe.contentDocument,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length))for(const c in this.legacy_missingNodeRetryMap)try{const u=this.legacy_missingNodeRetryMap[c],h=Ga(u.node,this.virtualDom,this.mirror);h&&(u.node=h)}catch(u){this.warn(u)}const r=this.usingVirtualDom?this.virtualDom.mirror:this.mirror;e.removes=e.removes.filter(c=>r.getNode(c.id)?!0:(this.warnNodeNotFound(e,c.id),!1)),e.removes.forEach(c=>{var u;const h=r.getNode(c.id);if(!h)return;let f=r.getNode(c.parentId);if(!f)return this.warnNodeNotFound(e,c.parentId);if(c.isShadow&&Oe(f)&&(f=f.shadowRoot),r.removeNodeFromMap(h),f)try{f.removeChild(h),this.usingVirtualDom&&h.nodeName==="#text"&&f.nodeName==="STYLE"&&((u=f.rules)==null?void 0:u.length)>0&&(f.rules=[])}catch(d){if(d instanceof DOMException)this.warn("parent could not remove child in mutation",f,h,e);else throw d}});const i=O({},this.legacy_missingNodeRetryMap),n=[],o=c=>{let u=null;return c.nextId&&(u=r.getNode(c.nextId)),c.nextId!==null&&c.nextId!==void 0&&c.nextId!==-1&&!u},l=c=>{var u,h;if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");let f=r.getNode(c.parentId);if(!f)return c.node.type===Ce.Document?this.newDocumentQueue.push(c):n.push(c);c.node.isShadow&&(Oe(f)||f.attachShadow({mode:"open"}),f=f.shadowRoot);let d=null,m=null;if(c.previousId&&(d=r.getNode(c.previousId)),c.nextId&&(m=r.getNode(c.nextId)),o(c))return n.push(c);if(c.node.rootId&&!r.getNode(c.node.rootId))return;const g=c.node.rootId?r.getNode(c.node.rootId):this.usingVirtualDom?this.virtualDom:this.iframe.contentDocument;if(Qe(f,r)){this.attachDocumentToIframe(c,f);return}const p=(b,S)=>{if(!this.usingVirtualDom){hr(b);for(const C of this.config.plugins||[])C.onBuild&&C.onBuild(b,{id:S,replayer:this})}},y=bt(c.node,{doc:g,mirror:r,skipChild:!0,hackCss:!0,cache:this.cache,afterAppend:p});if(c.previousId===-1||c.nextId===-1){i[c.node.id]={node:y,mutation:c};return}const v=r.getMeta(f);if(v&&v.type===Ce.Element&&c.node.type===Ce.Text){const b=Array.isArray(f.childNodes)?f.childNodes:Array.from(f.childNodes);if(v.tagName==="textarea")for(const S of b)S.nodeType===f.TEXT_NODE&&f.removeChild(S);else if(v.tagName==="style"&&b.length===1)for(const S of b)S.nodeType===f.TEXT_NODE&&!r.hasNode(S)&&(y.textContent=S.textContent,f.removeChild(S))}else if((v==null?void 0:v.type)===Ce.Document){const b=f;c.node.type===Ce.DocumentType&&((u=b.childNodes[0])==null?void 0:u.nodeType)===Node.DOCUMENT_TYPE_NODE&&b.removeChild(b.childNodes[0]),y.nodeName==="HTML"&&b.documentElement&&b.removeChild(b.documentElement)}if(d&&d.nextSibling&&d.nextSibling.parentNode?f.insertBefore(y,d.nextSibling):m&&m.parentNode?f.contains(m)?f.insertBefore(y,m):f.insertBefore(y,null):f.appendChild(y),p(y,c.node.id),this.usingVirtualDom&&y.nodeName==="#text"&&f.nodeName==="STYLE"&&((h=f.rules)==null?void 0:h.length)>0&&(f.rules=[]),Qe(y,this.mirror)){const b=this.mirror.getId(y),S=this.newDocumentQueue.find(C=>C.parentId===b);S&&(this.attachDocumentToIframe(S,y),this.newDocumentQueue=this.newDocumentQueue.filter(C=>C!==S))}(c.previousId||c.nextId)&&this.legacy_resolveMissingNode(i,f,y,c)};e.adds.forEach(c=>{l(c)});const a=Date.now();for(;n.length;){const c=Ja(n);if(n.length=0,Date.now()-a>500){this.warn("Timeout in the loop, please check the resolve tree data:",c);break}for(const u of c)r.getNode(u.value.parentId)?Pi(u,f=>{l(f)}):this.debug("Drop resolve tree since there is no parent for the root node.",u)}Object.keys(i).length&&Object.assign(this.legacy_missingNodeRetryMap,i),Ka(e.texts).forEach(c=>{var u;const h=r.getNode(c.id);if(!h)return e.removes.find(d=>d.id===c.id)?void 0:this.warnNodeNotFound(e,c.id);const f=h.parentElement;if(c.value&&f&&f.tagName==="STYLE"?h.textContent=zr(c.value,this.cache):h.textContent=c.value,this.usingVirtualDom){const d=h.parentNode;((u=d==null?void 0:d.rules)==null?void 0:u.length)>0&&(d.rules=[])}}),e.attributes.forEach(c=>{var u;const h=r.getNode(c.id);if(!h)return e.removes.find(f=>f.id===c.id)?void 0:this.warnNodeNotFound(e,c.id);for(const f in c.attributes)if(typeof f=="string"){const d=c.attributes[f];if(d===null)h.removeAttribute(f),f==="open"&&Vp(h,c);else if(typeof d=="string")try{if(f==="_cssText"&&(h.nodeName==="LINK"||h.nodeName==="STYLE"))try{const m=r.getMeta(h),g=bt(te(O({},m),{attributes:O(O({},m.attributes),c.attributes)}),{doc:h.ownerDocument,mirror:r,skipChild:!0,hackCss:!0,cache:this.cache});Object.assign(m.attributes,c.attributes);const p=h.nextSibling,y=h.parentNode;if(g&&y){y.removeChild(h),y.insertBefore(g,p),r.replace(c.id,g);break}}catch(m){}if(f==="value"&&h.nodeName==="TEXTAREA"){const m=h;m.childNodes.forEach(p=>m.removeChild(p));const g=(u=h.ownerDocument)==null?void 0:u.createTextNode(d);g&&m.appendChild(g)}else h.setAttribute(f,d);f==="rr_open_mode"&&h.nodeName==="DIALOG"&&hr(h,c)}catch(m){this.warn("An error occurred may due to the checkout feature.",m)}else if(f==="style"){const m=d,g=h;for(const p in m)if(m[p]===!1)g.style.removeProperty(p);else if(m[p]instanceof Array){const y=m[p];g.style.setProperty(p,y[0],y[1])}else{const y=m[p];g.style.setProperty(p,y)}}}})}applyScroll(e,t){var r,i;const n=this.mirror.getNode(e.id);if(!n)return this.debugNodeNotFound(e,e.id);const o=this.mirror.getMeta(n);if(n===this.iframe.contentDocument)(r=this.iframe.contentWindow)==null||r.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"});else if((o==null?void 0:o.type)===Ce.Document)(i=n.defaultView)==null||i.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"});else try{n.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"})}catch(l){}}applyInput(e){const t=this.mirror.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);try{t.checked=e.isChecked,t.value=e.text}catch(r){}}applySelection(e){try{const t=new Set,r=e.ranges.map(({start:i,startOffset:n,end:o,endOffset:l})=>{const a=this.mirror.getNode(i),c=this.mirror.getNode(o);if(!a||!c)return;const u=new Range;u.setStart(a,n),u.setEnd(c,l);const h=a.ownerDocument,f=h==null?void 0:h.getSelection();return f&&t.add(f),{range:u,selection:f}});t.forEach(i=>i.removeAllRanges()),r.forEach(i=>{var n;return i&&((n=i.selection)==null?void 0:n.addRange(i.range))})}catch(t){}}applyStyleSheetMutation(e){var t;let r=null;e.styleId?r=this.styleMirror.getStyle(e.styleId):e.id&&(r=((t=this.mirror.getNode(e.id))==null?void 0:t.sheet)||null),r&&(e.source===M.StyleSheetRule?this.applyStyleSheetRule(e,r):e.source===M.StyleDeclaration&&this.applyStyleDeclaration(e,r))}applyStyleSheetRule(e,t){var r,i,n,o;if((r=e.adds)==null||r.forEach(({rule:l,index:a})=>{try{if(Array.isArray(a)){const{positions:c,index:u}=Ks(a);Xe(t.cssRules,c).insertRule(l,u)}else{const c=a===void 0?void 0:Math.min(a,t.cssRules.length);t==null||t.insertRule(l,c)}}catch(c){}}),(i=e.removes)==null||i.forEach(({index:l})=>{try{if(Array.isArray(l)){const{positions:a,index:c}=Ks(l);Xe(t.cssRules,a).deleteRule(c||0)}else t==null||t.deleteRule(l)}catch(a){}}),e.replace)try{(n=t.replace)==null||n.call(t,e.replace)}catch(l){}if(e.replaceSync)try{(o=t.replaceSync)==null||o.call(t,e.replaceSync)}catch(l){}}applyStyleDeclaration(e,t){e.set&&Xe(t.rules,e.index).style.setProperty(e.set.property,e.set.value,e.set.priority),e.remove&&Xe(t.rules,e.index).style.removeProperty(e.remove.property)}applyAdoptedStyleSheet(e){var t;const r=this.mirror.getNode(e.id);if(!r)return;(t=e.styles)==null||t.forEach(l=>{var a;let c=null,u=null;if(Oe(r)?u=((a=r.ownerDocument)==null?void 0:a.defaultView)||null:r.nodeName==="#document"&&(u=r.defaultView),!!u)try{c=new u.CSSStyleSheet,this.styleMirror.add(c,l.styleId),this.applyStyleSheetRule({source:M.StyleSheetRule,adds:l.rules},c)}catch(h){}});const i=10;let n=0;const o=(l,a)=>{const c=a.map(u=>this.styleMirror.getStyle(u)).filter(u=>u!==null);Oe(l)?l.shadowRoot.adoptedStyleSheets=c:l.nodeName==="#document"&&(l.adoptedStyleSheets=c),c.length!==a.length&&n<i&&(setTimeout(()=>o(l,a),0+100*n),n++)};o(r,e.styleIds)}legacy_resolveMissingNode(e,t,r,i){const{previousId:n,nextId:o}=i,l=n&&e[n],a=o&&e[o];if(l){const{node:c,mutation:u}=l;t.insertBefore(c,r),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,c,u)}if(a){const{node:c,mutation:u}=a;t.insertBefore(c,r.nextSibling),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,c,u)}}moveAndHover(e,t,r,i,n){const o=this.mirror.getNode(r);if(!o)return this.debugNodeNotFound(n,r);const l=Fi(o,this.iframe),a=e*l.absoluteScale+l.x,c=t*l.absoluteScale+l.y;this.mouse.style.left=`${a}px`,this.mouse.style.top=`${c}px`,i||this.drawMouseTail({x:a,y:c}),this.hoverElements(o)}drawMouseTail(e){if(!this.mouseTail)return;const{lineCap:t,lineWidth:r,strokeStyle:i,duration:n}=this.config.mouseTail===!0?ms:Object.assign({},ms,this.config.mouseTail),o=()=>{if(!this.mouseTail)return;const l=this.mouseTail.getContext("2d");!l||!this.tailPositions.length||(l.clearRect(0,0,this.mouseTail.width,this.mouseTail.height),l.beginPath(),l.lineWidth=r,l.lineCap=t,l.strokeStyle=i,l.moveTo(this.tailPositions[0].x,this.tailPositions[0].y),this.tailPositions.forEach(a=>l.lineTo(a.x,a.y)),l.stroke())};this.tailPositions.push(e),o(),setTimeout(()=>{this.tailPositions=this.tailPositions.filter(l=>l!==e),o()},n/this.speedService.state.context.timer.speed)}hoverElements(e){var t;(t=this.lastHoveredRootNode||this.iframe.contentDocument)==null||t.querySelectorAll(".\\:hover").forEach(i=>{i.classList.remove(":hover")}),this.lastHoveredRootNode=e.getRootNode();let r=e;for(;r;)r.classList&&r.classList.add(":hover"),r=r.parentElement}isUserInteraction(e){return e.type!==A.IncrementalSnapshot?!1:e.data.source>M.Mutation&&e.data.source<=M.Input}backToNormal(){this.nextUserInteractionEvent=null,!this.speedService.state.matches("normal")&&(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(F.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))}warnNodeNotFound(e,t){this.warn(`Node with id '${t}' not found. `,e)}warnCanvasMutationFailed(e,t){this.warn("Has error on canvas update",t,"canvas mutation:",e)}debugNodeNotFound(e,t){this.debug(`Node with id '${t}' not found. `,e)}warn(...e){this.config.showWarning&&this.config.logger.warn(lo,...e)}debug(...e){this.config.showDebug&&this.config.logger.log(lo,...e)}}const{addCustomEvent:Yp}=Me,{freezePage:Hp}=Me,{takeFullSnapshot:Zp}=Me;exports.EventType=A;exports.IncrementalSource=M;exports.MouseInteractions=W;exports.Replayer=jp;exports.ReplayerEvents=F;exports.addCustomEvent=Yp;exports.canvasMutation=qs;exports.freezePage=Hp;exports.record=Me;exports.takeFullSnapshot=Zp;exports.utils=Kd;
73
- ;if (typeof module.exports == "object" && typeof exports == "object") {
84
+ ***************************************************************************** */function qn(s,e){var t=typeof Symbol=="function"&&s[Symbol.iterator];if(!t)return s;var r,i,n=t.call(s),o=[];try{for(;(e===void 0||e-- >0)&&!(r=n.next()).done;)o.push(r.value)}catch(l){i={error:l}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(i)throw i.error}}return o}var Ke;(function(s){s[s.NotStarted=0]="NotStarted",s[s.Running=1]="Running",s[s.Stopped=2]="Stopped"})(Ke||(Ke={}));var cl={type:"xstate.init"};function ps(s){return s===void 0?[]:[].concat(s)}function $e(s){return{type:"xstate.assign",assignment:s}}function eo(s,e){return typeof(s=typeof s=="string"&&e&&e[s]?e[s]:s)=="string"?{type:s}:typeof s=="function"?{type:s.name,exec:s}:s}function Pr(s){return function(e){return s===e}}function ul(s){return typeof s=="string"?{type:s}:s}function to(s,e){return{value:s,context:e,actions:[],changed:!1,matches:Pr(s)}}function ro(s,e,t){var r=e,i=!1;return[s.filter(function(n){if(n.type==="xstate.assign"){i=!0;var o=Object.assign({},r);return typeof n.assignment=="function"?o=n.assignment(r,t):Object.keys(n.assignment).forEach(function(l){o[l]=typeof n.assignment[l]=="function"?n.assignment[l](r,t):n.assignment[l]}),r=o,!1}return!0}),r,i]}function hl(s,e){e===void 0&&(e={});var t=qn(ro(ps(s.states[s.initial].entry).map(function(o){return eo(o,e.actions)}),s.context,cl),2),r=t[0],i=t[1],n={config:s,_options:e,initialState:{value:s.initial,actions:r,context:i,matches:Pr(s.initial)},transition:function(o,l){var a,c,u=typeof o=="string"?{value:o,context:s.context}:o,h=u.value,f=u.context,d=ul(l),m=s.states[h];if(m.on){var g=ps(m.on[d.type]);try{for(var p=function(N){var ce=typeof Symbol=="function"&&Symbol.iterator,ue=ce&&N[ce],se=0;if(ue)return ue.call(N);if(N&&typeof N.length=="number")return{next:function(){return N&&se>=N.length&&(N=void 0),{value:N&&N[se++],done:!N}}};throw new TypeError(ce?"Object is not iterable.":"Symbol.iterator is not defined.")}(g),y=p.next();!y.done;y=p.next()){var v=y.value;if(v===void 0)return to(h,f);var b=typeof v=="string"?{target:v}:v,S=b.target,C=b.actions,R=C===void 0?[]:C,T=b.cond,D=S===void 0;if((T===void 0?function(){return!0}:T)(f,d)){var I=s.states[S!=null?S:h],x=qn(ro((D?ps(R):[].concat(m.exit,R,I.entry).filter(function(N){return N})).map(function(N){return eo(N,n._options.actions)}),f,d),3),U=x[0],j=x[1],ee=x[2],ae=S!=null?S:h;return{value:ae,context:j,actions:U,changed:S!==h||U.length>0||ee,matches:Pr(ae)}}}}catch(N){a={error:N}}finally{try{y&&!y.done&&(c=p.return)&&c.call(p)}finally{if(a)throw a.error}}}return to(h,f)}};return n}var so=function(s,e){return s.actions.forEach(function(t){var r=t.exec;return r&&r(s.context,e)})};function fl(s){var e=s.initialState,t=Ke.NotStarted,r=new Set,i={_machine:s,send:function(n){t===Ke.Running&&(e=s.transition(e,n),so(e,ul(n)),r.forEach(function(o){return o(e)}))},subscribe:function(n){return r.add(n),n(e),{unsubscribe:function(){return r.delete(n)}}},start:function(n){if(n){var o=typeof n=="object"?n:{context:s.config.context,value:n};e={value:o.value,actions:[],context:o.context,matches:Pr(o.value)}}return t=Ke.Running,so(e,cl),i},stop:function(){return t=Ke.Stopped,r.clear(),i},get state(){return e},get status(){return t}};return i}function _p(s,e){for(let t=s.length-1;t>=0;t--){const r=s[t];if(r.type===A.Meta&&r.timestamp<=e)return s.slice(t)}return s}function kp(s,{getCastFn:e,applyEventsSynchronously:t,emitter:r}){const i=hl({id:"player",context:s,initial:"paused",states:{playing:{on:{PAUSE:{target:"paused",actions:["pause"]},CAST_EVENT:{target:"playing",actions:"castEvent"},END:{target:"paused",actions:["resetLastPlayedEvent","pause"]},ADD_EVENT:{target:"playing",actions:["addEvent"]},REPLACE_EVENTS:{target:"playing",actions:["replaceEvents"]}}},paused:{on:{PLAY:{target:"playing",actions:["recordTimeOffset","play"]},CAST_EVENT:{target:"paused",actions:"castEvent"},TO_LIVE:{target:"live",actions:["startLive"]},ADD_EVENT:{target:"paused",actions:["addEvent"]},REPLACE_EVENTS:{target:"paused",actions:["replaceEvents"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]},CAST_EVENT:{target:"live",actions:["castEvent"]}}}}},{actions:{castEvent:$e({lastPlayedEvent:(n,o)=>o.type==="CAST_EVENT"?o.payload.event:n.lastPlayedEvent}),recordTimeOffset:$e((n,o)=>{let l=n.timeOffset;return"payload"in o&&"timeOffset"in o.payload&&(l=o.payload.timeOffset),te(O({},n),{timeOffset:l,baselineTime:n.events[0].timestamp+l})}),play(n){var o;const{timer:l,events:a,baselineTime:c,lastPlayedEvent:u}=n;l.clear();for(const m of a)ds(m,c);const h=_p(a,c);let f=u==null?void 0:u.timestamp;(u==null?void 0:u.type)===A.IncrementalSnapshot&&u.data.source===M.MouseMove&&(f=u.timestamp+((o=u.data.positions[0])==null?void 0:o.timeOffset)),c<(f||0)&&r.emit(F.PlayBack);const d=new Array;for(const m of h)if(!(f&&f<c&&(m.timestamp<=f||m===u)))if(m.timestamp<c)d.push(m);else{const g=e(m,!1);l.addAction({doAction:()=>{g()},delay:m.delay})}t(d),r.emit(F.Flush),l.start()},pause(n){n.timer.clear()},resetLastPlayedEvent:$e(n=>te(O({},n),{lastPlayedEvent:null})),startLive:$e({baselineTime:(n,o)=>(n.timer.start(),o.type==="TO_LIVE"&&o.payload.baselineTime?o.payload.baselineTime:Date.now())}),replaceEvents:$e((n,o)=>{if(o.type!=="REPLACE_EVENTS")return n;const{events:l,timer:a,baselineTime:c}=n,{events:u}=o.payload;if(u.length===0)return n;l.length=0;const h=[],f=a.timeOffset+c;for(const d of u)ds(d,c),l.push(d),d.timestamp>=f&&h.push({doAction:e(d,!1),delay:d.delay});return a.isActive()&&a.replaceActions(h),te(O({},n),{events:l})}),addEvent:$e((n,o)=>{const{baselineTime:l,timer:a,events:c}=n;if(o.type==="ADD_EVENT"){const{event:u}=o.payload;ds(u,l);let h=c.length-1;if(!c[h]||c[h].timestamp<=u.timestamp)c.push(u);else{let m=-1,g=0;for(;g<=h;){const p=Math.floor((g+h)/2);c[p].timestamp<=u.timestamp?g=p+1:h=p-1}m===-1&&(m=g),c.splice(m,0,u)}const f=u.timestamp<l,d=e(u,f);f?d():a.isActive()&&a.addAction({doAction:()=>{d()},delay:u.delay})}return te(O({},n),{events:c})})}});return fl(i)}function Lp(s){const e=hl({id:"speed",context:s,initial:"normal",states:{normal:{on:{FAST_FORWARD:{target:"skipping",actions:["recordSpeed","setSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}},skipping:{on:{BACK_TO_NORMAL:{target:"normal",actions:["restoreSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}}}},{actions:{setSpeed:(t,r)=>{"payload"in r&&t.timer.setSpeed(r.payload.speed)},recordSpeed:$e({normalSpeed:t=>t.timer.speed}),restoreSpeed:t=>{t.timer.setSpeed(t.normalSpeed)}}});return fl(e)}const Pp=s=>["noscript { display: none !important; }",`.${s} { background: currentColor; border-radius: 5px; }`,`.${s}:hover::after {content: 'Redacted'; color: white; background: black; text-align: center; width: 100%; display: block;}`],io=new Map;function dl(s,e){let t=io.get(s);return t||(t=new Map,io.set(s,t)),t.has(e)||t.set(e,[]),t.get(e)}function Te(s,e,t){return async r=>{if(r&&typeof r=="object"&&"rr_type"in r)if(t&&(t.isUnchanged=!1),r.rr_type==="ImageBitmap"&&"args"in r){const i=await Te(s,e,t)(r.args);return await createImageBitmap.apply(null,i)}else if("index"in r){if(t||e===null)return r;const{rr_type:i,index:n}=r;return dl(e,i)[n]}else if("args"in r){const{rr_type:i,args:n}=r,o=window[i];return new o(...await Promise.all(n.map(Te(s,e,t))))}else{if("base64"in r)return vp(r.base64);if("src"in r){const i=s.get(r.src);if(i)return i;{const n=new Image;return n.src=r.src,s.set(r.src,n),n}}else if("data"in r&&r.rr_type==="Blob"){const i=await Promise.all(r.data.map(Te(s,e,t)));return new Blob(i,{type:r.type})}}else if(Array.isArray(r))return await Promise.all(r.map(Te(s,e,t)));return r}}function $p(s,e){try{return e===xe.WebGL?s.getContext("webgl")||s.getContext("experimental-webgl"):s.getContext("webgl2")}catch(t){return null}}const Fp=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function Bp(s,e){if(!(e!=null&&e.constructor))return;const{name:t}=e.constructor;if(!Fp.includes(t))return;const r=dl(s,t);r.includes(e)||r.push(e)}async function Up({mutation:s,target:e,type:t,imageMap:r,errorHandler:i}){try{const n=$p(e,t);if(!n)return;if(s.setter){n[s.property]=s.args[0];return}const o=n[s.property],l=await Promise.all(s.args.map(Te(r,n))),a=o.apply(n,l);Bp(n,a);const c=!1}catch(n){i(s,n)}}async function Wp({event:s,mutations:e,target:t,imageMap:r,errorHandler:i}){const n=t.getContext("2d");if(!n){i(e[0],new Error("Canvas context is null"));return}const o=e.map(async a=>Promise.all(a.args.map(Te(r,n))));(await Promise.all(o)).forEach((a,c)=>{const u=e[c];try{if(u.setter){n[u.property]=u.args[0];return}const h=n[u.property];u.property==="drawImage"&&typeof u.args[0]=="string"?(r.get(s),h.apply(n,u.args)):h.apply(n,a)}catch(h){i(u,h)}})}async function qs({event:s,mutation:e,target:t,imageMap:r,canvasEventMap:i,errorHandler:n}){try{const o=i.get(s)||e,l="commands"in o?o.commands:[o];if([xe.WebGL,xe.WebGL2].includes(e.type)){for(let a=0;a<l.length;a++){const c=l[a];await Up({mutation:c,type:e.type,target:t,imageMap:r,errorHandler:n})}return}await Wp({event:s,mutations:l,target:t,imageMap:r,errorHandler:n})}catch(o){n(e,o)}}class zp{constructor(e){w(this,"mediaMap",new Map),w(this,"warn"),w(this,"service"),w(this,"speedService"),w(this,"emitter"),w(this,"getCurrentTime"),w(this,"metadataCallbackMap",new Map),this.warn=e.warn,this.service=e.service,this.speedService=e.speedService,this.emitter=e.emitter,this.getCurrentTime=e.getCurrentTime,this.emitter.on(F.Start,this.start.bind(this)),this.emitter.on(F.SkipStart,this.start.bind(this)),this.emitter.on(F.Pause,this.pause.bind(this)),this.emitter.on(F.Finish,this.pause.bind(this)),this.speedService.subscribe(()=>{this.syncAllMediaElements()})}syncAllMediaElements(e={pause:!1}){this.mediaMap.forEach((t,r)=>{this.syncTargetWithState(r),e.pause&&r.pause&&r.pause()})}start(){this.syncAllMediaElements()}pause(){this.syncAllMediaElements({pause:!0})}seekTo({time:e,target:t,mediaState:r}){if(r.isPlaying){const n=(e-r.lastInteractionTimeOffset)/1e3*r.playbackRate,o="duration"in t&&t.duration;if(Number.isNaN(o)){this.waitForMetadata(t);return}let l=r.currentTimeAtLastInteraction+n;t.loop&&o!==!1&&(l=l%o),t.currentTime=l}else t.pause(),t.currentTime=r.currentTimeAtLastInteraction}waitForMetadata(e){if(this.metadataCallbackMap.has(e)||!("addEventListener"in e))return;const t=()=>{this.metadataCallbackMap.delete(e);const r=this.mediaMap.get(e);r&&this.seekTo({time:this.getCurrentTime(),target:e,mediaState:r})};this.metadataCallbackMap.set(e,t),e.addEventListener("loadedmetadata",t,{once:!0})}getMediaStateFromMutation({target:e,timeOffset:t,mutation:r}){var d,m,g,p,y;const i=this.mediaMap.get(e),{type:n,playbackRate:o,currentTime:l,muted:a,volume:c,loop:u}=r;return{isPlaying:n===Ae.Play||n!==Ae.Pause&&((i==null?void 0:i.isPlaying)||e.getAttribute("autoplay")!==null),currentTimeAtLastInteraction:(d=l!=null?l:i==null?void 0:i.currentTimeAtLastInteraction)!=null?d:0,lastInteractionTimeOffset:t,playbackRate:(m=o!=null?o:i==null?void 0:i.playbackRate)!=null?m:1,volume:(g=c!=null?c:i==null?void 0:i.volume)!=null?g:1,muted:(p=a!=null?a:i==null?void 0:i.muted)!=null?p:e.getAttribute("muted")===null,loop:(y=u!=null?u:i==null?void 0:i.loop)!=null?y:e.getAttribute("loop")===null}}syncTargetWithState(e){const t=this.mediaMap.get(e);if(!t)return;const{muted:r,loop:i,volume:n,isPlaying:o}=t,l=this.service.state.matches("paused"),a=t.playbackRate*this.speedService.state.context.timer.speed;try{this.seekTo({time:this.getCurrentTime(),target:e,mediaState:t}),e.volume!==n&&(e.volume=n),e.muted=r,e.loop=i,e.playbackRate!==a&&(e.playbackRate=a),o&&!l?e.play():e.pause()}catch(c){this.warn(`Failed to replay media interactions: ${c.message||c}`)}}addMediaElements(e,t,r){if(!["AUDIO","VIDEO"].includes(e.nodeName))return;const i=e,n=r.getMeta(i);if(!n||!("attributes"in n))return;const o=this.service.state.matches("paused"),l=n.attributes;let a=!1;l.rr_mediaState?a=l.rr_mediaState==="played":a=i.getAttribute("autoplay")!==null,a&&o&&i.pause();let c=1;typeof l.rr_mediaPlaybackRate=="number"&&(c=l.rr_mediaPlaybackRate);let u=!1;typeof l.rr_mediaMuted=="boolean"?u=l.rr_mediaMuted:u=i.getAttribute("muted")!==null;let h=!1;typeof l.rr_mediaLoop=="boolean"?h=l.rr_mediaLoop:h=i.getAttribute("loop")!==null;let f=1;typeof l.rr_mediaVolume=="number"&&(f=l.rr_mediaVolume);let d=0;typeof l.rr_mediaCurrentTime=="number"&&(d=l.rr_mediaCurrentTime),this.mediaMap.set(i,{isPlaying:a,currentTimeAtLastInteraction:d,lastInteractionTimeOffset:t,playbackRate:c,volume:f,muted:u,loop:h}),this.syncTargetWithState(i)}mediaMutation({target:e,timeOffset:t,mutation:r}){this.mediaMap.set(e,this.getMediaStateFromMutation({target:e,timeOffset:t,mutation:r})),this.syncTargetWithState(e)}isSupportedMediaElement(e){return["AUDIO","VIDEO"].includes(e.nodeName)}reset(){this.mediaMap.clear()}}function hr(s,e){if(s.nodeName!=="DIALOG"||s instanceof ge)return;const t=s,r=t.open,i=r&&t.matches("dialog:modal"),n=t.getAttribute("rr_open_mode"),o=typeof(e==null?void 0:e.attributes.open)=="string"||typeof t.getAttribute("open")=="string",l=n==="modal";if(!(r&&!(i&&n==="non-modal"||!i&&l))){if(!t.isConnected){console.warn("dialog is not attached to the dom",t);return}r&&t.close(),o&&(l?t.showModal():t.show())}}function Vp(s,e){if(s.nodeName!=="DIALOG"||s instanceof ge)return;const t=s;if(!t.isConnected){console.warn("dialog is not attached to the dom",t);return}e.attributes.open===null&&(t.removeAttribute("open"),t.removeAttribute("rr_open_mode"))}const no=5*1e3,oo=1*1e3,ao=60*60*1e3,Gp=ll||Op,lo="[replayer]",ms={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function gs(s){return s.type==A.IncrementalSnapshot&&(s.data.source==M.TouchMove||s.data.source==M.MouseInteraction&&s.data.type==W.TouchStart)}class jp{constructor(e,t){if(w(this,"wrapper"),w(this,"iframe"),w(this,"service"),w(this,"speedService"),w(this,"config"),w(this,"usingVirtualDom",!1),w(this,"virtualDom",new ot),w(this,"mouse"),w(this,"mouseTail",null),w(this,"tailPositions",[]),w(this,"emitter",Gp()),w(this,"nextUserInteractionEvent"),w(this,"activityIntervals",[]),w(this,"inactiveEndTimestamp"),w(this,"legacy_missingNodeRetryMap",{}),w(this,"cache",Cn()),w(this,"imageMap",new Map),w(this,"canvasEventMap",new Map),w(this,"mirror",ho()),w(this,"styleMirror",new Bi),w(this,"mediaManager"),w(this,"firstFullSnapshot",null),w(this,"newDocumentQueue",[]),w(this,"mousePos",null),w(this,"touchActive",null),w(this,"lastMouseDownEvent",null),w(this,"lastHoveredRootNode"),w(this,"lastSelectionData",null),w(this,"constructedStyleMutations",[]),w(this,"adoptedStyleSheets",[]),w(this,"handleResize",l=>{this.iframe.style.display="inherit";for(const a of[this.mouseTail,this.iframe])a&&(a.setAttribute("width",String(l.width)),a.setAttribute("height",String(l.height)))}),w(this,"applyEventsSynchronously",l=>{for(const a of l){switch(a.type){case A.DomContentLoaded:case A.Load:case A.Custom:continue;case A.FullSnapshot:case A.Meta:case A.Plugin:case A.IncrementalSnapshot:break}this.getCastFn(a,!0)()}}),w(this,"getCastFn",(l,a=!1)=>{let c;switch(l.type){case A.DomContentLoaded:case A.Load:break;case A.Custom:c=()=>{this.emitter.emit(F.CustomEvent,l)};break;case A.Meta:c=()=>this.emitter.emit(F.Resize,{width:l.data.width,height:l.data.height});break;case A.FullSnapshot:c=()=>{var h;if(this.firstFullSnapshot){if(this.firstFullSnapshot===l){this.firstFullSnapshot=!0;return}}else this.firstFullSnapshot=!0;this.mediaManager.reset(),this.styleMirror.reset(),this.rebuildFullSnapshot(l,a),(h=this.iframe.contentWindow)==null||h.scrollTo(l.data.initialOffset)};break;case A.IncrementalSnapshot:c=()=>{if(this.applyIncremental(l,a),!a&&(this.handleInactivity(l.timestamp),l===this.nextUserInteractionEvent&&(this.nextUserInteractionEvent=null,this.backToNormal()),this.config.skipInactive&&!this.nextUserInteractionEvent)){for(const h of this.service.state.context.events)if(!(h.timestamp<=l.timestamp)&&this.isUserInteraction(h)){h.delay-l.delay>this.config.inactivePeriodThreshold*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=h);break}if(this.nextUserInteractionEvent){const h=this.nextUserInteractionEvent.delay-l.delay,f={speed:Math.min(Math.round(h/no),this.config.maxSpeed)};this.speedService.send({type:"FAST_FORWARD",payload:f}),this.emitter.emit(F.SkipStart,f)}}};break}return()=>{c&&c();for(const f of this.config.plugins||[])f.handler&&f.handler(l,a,{replayer:this});this.service.send({type:"CAST_EVENT",payload:{event:l}});const h=this.service.state.context.events.length-1;if(!this.config.liveMode&&l===this.service.state.context.events[h]){const f=()=>{h<this.service.state.context.events.length-1||(this.backToNormal(),this.service.send("END"),this.emitter.emit(F.Finish))};let d=50;l.type===A.IncrementalSnapshot&&l.data.source===M.MouseMove&&l.data.positions.length&&(d+=Math.max(0,-l.data.positions[0].timeOffset)),setTimeout(f,d)}this.emitter.emit(F.EventCast,l)}}),!(t!=null&&t.liveMode)&&e.length<2)throw new Error("Replayer need at least 2 events.");const r={speed:1,maxSpeed:360,root:document.body,loadTimeout:0,skipInactive:!1,inactivePeriodThreshold:10*1e3,showWarning:!0,showDebug:!1,blockClass:"highlight-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:ms,useVirtualDom:!0,logger:console,inactiveThreshold:.02,inactiveSkipTime:no};this.config=Object.assign({},r,t),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on(F.Resize,this.handleResize),this.setupDom();for(const l of this.config.plugins||[])l.getMirror&&l.getMirror({nodeMirror:this.mirror});this.emitter.on(F.Flush,()=>{if(this.usingVirtualDom){const l={mirror:this.mirror,applyCanvas:(a,c,u)=>{qs({event:a,mutation:c,target:u,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this),applyStyleSheetMutation:(a,c)=>{a.source===M.StyleSheetRule?this.applyStyleSheetRule(a,c):a.source===M.StyleDeclaration&&this.applyStyleDeclaration(a,c)},afterAppend:(a,c)=>{for(const u of this.config.plugins||[])u.onBuild&&u.onBuild(a,{id:c,replayer:this})}};if(this.iframe.contentDocument)try{Tr(this.iframe.contentDocument,this.virtualDom,l,this.virtualDom.mirror)}catch(a){console.warn(a)}if(this.virtualDom.destroyTree(),this.usingVirtualDom=!1,Object.keys(this.legacy_missingNodeRetryMap).length)for(const a in this.legacy_missingNodeRetryMap)try{const c=this.legacy_missingNodeRetryMap[a],u=Dr(c.node,this.mirror,this.virtualDom.mirror);Tr(u,c.node,l,this.virtualDom.mirror),c.node=u}catch(c){this.warn(c)}this.constructedStyleMutations.forEach(a=>{this.applyStyleSheetMutation(a)}),this.constructedStyleMutations=[],this.adoptedStyleSheets.forEach(a=>{this.applyAdoptedStyleSheet(a)}),this.adoptedStyleSheets=[]}if(this.mousePos&&(this.moveAndHover(this.mousePos.x,this.mousePos.y,this.mousePos.id,!0,this.mousePos.debugData),this.mousePos=null),this.touchActive===!0?this.mouse.classList.add("touch-active"):this.touchActive===!1&&this.mouse.classList.remove("touch-active"),this.touchActive=null,this.lastMouseDownEvent){const[l,a]=this.lastMouseDownEvent;l.dispatchEvent(a)}this.lastMouseDownEvent=null,this.lastSelectionData&&(this.applySelection(this.lastSelectionData),this.lastSelectionData=null)}),this.emitter.on(F.PlayBack,()=>{this.firstFullSnapshot=null,this.mirror.reset(),this.styleMirror.reset(),this.mediaManager.reset()});const i=new Dp([],{speed:this.config.speed});this.service=kp({events:e.map(l=>t&&t.unpackFn?t.unpackFn(l):l).sort((l,a)=>l.timestamp-a.timestamp),timer:i,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe(l=>{this.emitter.emit(F.StateChange,{player:l})}),this.speedService=Lp({normalSpeed:-1,timer:i}),this.speedService.start(),this.speedService.subscribe(l=>{this.emitter.emit(F.StateChange,{speed:l})}),this.mediaManager=new zp({warn:this.warn.bind(this),service:this.service,speedService:this.speedService,emitter:this.emitter,getCurrentTime:this.getCurrentTime.bind(this)});const n=this.service.state.context.events.find(l=>l.type===A.Meta),o=this.service.state.context.events.find(l=>l.type===A.FullSnapshot);if(n){const{width:l,height:a}=n.data;setTimeout(()=>{this.emitter.emit(F.Resize,{width:l,height:a})},0)}o&&setTimeout(()=>{var l;this.firstFullSnapshot||(this.firstFullSnapshot=o,this.rebuildFullSnapshot(o),(l=this.iframe.contentWindow)==null||l.scrollTo(o.data.initialOffset))},1),this.service.state.context.events.find(gs)&&this.mouse.classList.add("touch-device")}get timer(){return this.service.state.context.timer}on(e,t){return this.emitter.on(e,t),this}off(e,t){return this.emitter.off(e,t),this}setConfig(e){Object.keys(e).forEach(t=>{e[t],this.config[t]=e[t]}),this.config.skipInactive||this.backToNormal(),typeof e.speed!="undefined"&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}}),typeof e.mouseTail!="undefined"&&(e.mouseTail===!1?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"))}getActivityIntervals(){if(this.activityIntervals.length==0){const e=[],t=this.getMetaData(),r=[{timestamp:t.startTime},...this.service.state.context.events.filter(o=>this.isUserInteraction(o)),{timestamp:t.endTime}];for(let o=1;o<r.length;o++){const l=r[o-1],a=r[o];a.timestamp-l.timestamp>this.config.inactivePeriodThreshold?e.push({startTime:l.timestamp,endTime:a.timestamp,duration:a.timestamp-l.timestamp,active:!1}):e.push({startTime:l.timestamp,endTime:a.timestamp,duration:a.timestamp-l.timestamp,active:!0})}const i=[];let n=e[0];for(let o=1;o<e.length;o++)e[o].active!=e[o-1].active&&(i.push({startTime:n.startTime,endTime:e[o-1].endTime,duration:e[o-1].endTime-n.startTime,active:e[o-1].active}),n=e[o]);n&&e.length>0&&i.push({startTime:n.startTime,endTime:e[e.length-1].endTime,duration:e[e.length-1].endTime-n.startTime,active:e[e.length-1].active}),n=i[0];for(let o=1;o<i.length;o++)(!i[o].active&&i[o].duration>this.config.inactiveThreshold*t.totalTime||!i[o-1].active&&i[o-1].duration>this.config.inactiveThreshold*t.totalTime)&&(this.activityIntervals.push({startTime:n.startTime,endTime:i[o-1].endTime,duration:i[o-1].endTime-n.startTime,active:i[o-1].active}),n=i[o]);n&&i.length>0&&this.activityIntervals.push({startTime:n.startTime,endTime:i[i.length-1].endTime,duration:i[i.length-1].endTime-n.startTime,active:i[i.length-1].active})}return this.activityIntervals}getMetaData(){const e=this.service.state.context.events[0],t=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:e.timestamp,endTime:t.timestamp,totalTime:t.timestamp-e.timestamp}}getCurrentTime(){return this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){const{baselineTime:e,events:t}=this.service.state.context;return e-t[0].timestamp}getMirror(){return this.mirror}play(e=0){var t,r;this.service.state.matches("paused")?this.service.send({type:"PLAY",payload:{timeOffset:e}}):(this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:e}})),(r=(t=this.iframe.contentDocument)==null?void 0:t.getElementsByTagName("html")[0])==null||r.classList.remove("rrweb-paused"),this.emitter.emit(F.Start)}pause(e){var t,r;e===void 0&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),typeof e=="number"&&(this.play(e),this.service.send({type:"PAUSE"})),(r=(t=this.iframe.contentDocument)==null?void 0:t.getElementsByTagName("html")[0])==null||r.classList.add("rrweb-paused"),this.emitter.emit(F.Pause)}resume(e=0){this.warn("The 'resume' was deprecated in 1.0. Please use 'play' method which has the same interface."),this.play(e),this.emitter.emit(F.Resume)}destroy(){this.pause(),this.mirror.reset(),this.styleMirror.reset(),this.mediaManager.reset(),this.config.root.removeChild(this.wrapper),this.emitter.emit(F.Destroy)}startLive(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})}addEvent(e){const t=this.config.unpackFn?this.config.unpackFn(e):e;gs(t)&&this.mouse.classList.add("touch-device"),Promise.resolve().then(()=>this.service.send({type:"ADD_EVENT",payload:{event:t}}))}replaceEvents(e){for(const t of e)if(gs(t)){this.mouse.classList.add("touch-device");break}this.service.send({type:"REPLACE_EVENTS",payload:{events:e}})}enableInteract(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"}disableInteract(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"}resetCache(){this.cache=Cn()}setupDom(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),this.config.mouseTail!==!1&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.iframe=document.createElement("iframe");const e=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&e.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",e.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe),this.iframe.contentWindow&&this.iframe.contentDocument&&(Tp(this.iframe.contentWindow,this.iframe.contentDocument),Li(this.iframe.contentWindow))}handleInactivity(e,t){if((e===this.inactiveEndTimestamp||t)&&(this.inactiveEndTimestamp=null,this.backToNormal()),this.config.skipInactive&&!this.inactiveEndTimestamp){for(const r of this.getActivityIntervals())if(e>=r.startTime&&e<r.endTime&&!r.active){this.inactiveEndTimestamp=r.endTime;break}if(this.inactiveEndTimestamp){const r=this.inactiveEndTimestamp-e,i={speed:r/ao*this.config.inactiveSkipTime<oo?r/oo:Math.round(Math.max(r,ao)/this.config.inactiveSkipTime)};this.speedService.send({type:"FAST_FORWARD",payload:i}),this.emitter.emit(F.SkipStart,i)}}}rebuildFullSnapshot(e,t=!1){if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&this.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={};const r=[],i=new Set,n=(a,c)=>{if(a.nodeName==="DIALOG"&&i.add(a),this.collectIframeAndAttachDocument(r,a),this.mediaManager.isSupportedMediaElement(a)){const{events:u}=this.service.state.context;this.mediaManager.addMediaElements(a,e.timestamp-u[0].timestamp,this.mirror)}for(const u of this.config.plugins||[])u.onBuild&&u.onBuild(a,{id:c,replayer:this})};this.usingVirtualDom&&(this.virtualDom.destroyTree(),this.usingVirtualDom=!1),this.mirror.reset(),wh(e.data.node,{doc:this.iframe.contentDocument,afterAppend:n,cache:this.cache,mirror:this.mirror}),n(this.iframe.contentDocument,e.data.node.id);for(const{mutationInQueue:a,builtNode:c}of r)this.attachDocumentToIframe(a,c),this.newDocumentQueue=this.newDocumentQueue.filter(u=>u!==a);const{documentElement:o,head:l}=this.iframe.contentDocument;this.insertStyleRules(o,l),i.forEach(a=>hr(a)),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(F.FullsnapshotRebuilded,e),t||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()}insertStyleRules(e,t){var r;const i=Pp(this.config.blockClass).concat(this.config.insertStyleRules);if(this.config.pauseAnimation&&i.push("html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }"),!!i.length)if(this.usingVirtualDom){const n=this.virtualDom.createElement("style");this.virtualDom.mirror.add(n,ja(n,this.virtualDom.unserializedId)),e.insertBefore(n,t),n.rules.push({source:M.StyleSheetRule,adds:i.map((o,l)=>({rule:o,index:l}))})}else{const n=document.createElement("style");e.insertBefore(n,t);for(let o=0;o<i.length;o++)(r=n.sheet)==null||r.insertRule(i[o],o)}}attachDocumentToIframe(e,t){const r=this.usingVirtualDom?this.virtualDom.mirror:this.mirror,i=[],n=new Set,o=(l,a)=>{l.nodeName==="DIALOG"&&n.add(l),this.collectIframeAndAttachDocument(i,l);const c=r.getMeta(l);if((c==null?void 0:c.type)===Ce.Element&&(c==null?void 0:c.tagName.toUpperCase())==="HTML"){const{documentElement:u,head:h}=t.contentDocument;this.insertStyleRules(u,h)}if(!this.usingVirtualDom)for(const u of this.config.plugins||[])u.onBuild&&u.onBuild(l,{id:a,replayer:this})};bt(e.node,{doc:t.contentDocument,mirror:r,hackCss:!0,skipChild:!1,afterAppend:o,cache:this.cache}),o(t.contentDocument,e.node.id);for(const{mutationInQueue:l,builtNode:a}of i)this.attachDocumentToIframe(l,a),this.newDocumentQueue=this.newDocumentQueue.filter(c=>c!==l);n.forEach(l=>hr(l))}collectIframeAndAttachDocument(e,t){if(Qe(t,this.mirror)){const r=this.newDocumentQueue.find(i=>i.parentId===this.mirror.getId(t));r&&e.push({mutationInQueue:r,builtNode:t})}}waitForStylesheetLoad(){var e;const t=(e=this.iframe.contentDocument)==null?void 0:e.head;if(t){const r=new Set;let i,n=this.service.state;const o=()=>{n=this.service.state};this.emitter.on(F.Start,o),this.emitter.on(F.Pause,o);const l=()=>{this.emitter.off(F.Start,o),this.emitter.off(F.Pause,o)};t.querySelectorAll('link[rel="stylesheet"]').forEach(a=>{a.sheet||(r.add(a),a.addEventListener("load",()=>{r.delete(a),r.size===0&&i!==-1&&(n.matches("playing")&&this.play(this.getCurrentTime()),this.emitter.emit(F.LoadStylesheetEnd),i&&clearTimeout(i),l())}))}),r.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(F.LoadStylesheetStart),i=setTimeout(()=>{n.matches("playing")&&this.play(this.getCurrentTime()),i=-1,l()},this.config.loadTimeout))}}async preloadAllImages(){const e=[];for(const t of this.service.state.context.events)t.type===A.IncrementalSnapshot&&t.data.source===M.CanvasMutation&&(e.push(this.deserializeAndPreloadCanvasEvents(t.data,t)),("commands"in t.data?t.data.commands:[t.data]).forEach(i=>{this.preloadImages(i,t)}));return Promise.all(e)}preloadImages(e,t){if(e.property==="drawImage"&&typeof e.args[0]=="string"&&!this.imageMap.has(t)){const r=document.createElement("canvas"),i=r.getContext("2d"),n=i==null?void 0:i.createImageData(r.width,r.height);i==null||i.putImageData(n,0,0)}}async deserializeAndPreloadCanvasEvents(e,t){if(!this.canvasEventMap.has(t)){const r={isUnchanged:!0};if("commands"in e){const i=await Promise.all(e.commands.map(async n=>{const o=await Promise.all(n.args.map(Te(this.imageMap,null,r)));return te(O({},n),{args:o})}));r.isUnchanged===!1&&this.canvasEventMap.set(t,te(O({},e),{commands:i}))}else{const i=await Promise.all(e.args.map(Te(this.imageMap,null,r)));r.isUnchanged===!1&&this.canvasEventMap.set(t,te(O({},e),{args:i}))}}}applyIncremental(e,t){var r,i,n;const{data:o}=e;switch(o.source){case M.Mutation:{try{this.applyMutation(o,t)}catch(l){this.warn(`Exception in mutation ${l.message||l}`,o)}break}case M.Drag:case M.TouchMove:case M.MouseMove:if(t){const l=o.positions[o.positions.length-1];this.mousePos={x:l.x,y:l.y,id:l.id,debugData:o}}else o.positions.forEach(l=>{const a={doAction:()=>{this.moveAndHover(l.x,l.y,l.id,t,o)},delay:l.timeOffset+e.timestamp-this.service.state.context.baselineTime};this.timer.addAction(a)}),this.timer.addAction({doAction(){},delay:e.delay-((r=o.positions[0])==null?void 0:r.timeOffset)});break;case M.MouseInteraction:{if(o.id===-1)break;const l=new Event(Be(W[o.type])),a=this.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);this.emitter.emit(F.MouseInteraction,{type:o.type,target:a});const{triggerFocus:c}=this.config;switch(o.type){case W.Blur:"blur"in a&&a.blur();break;case W.Focus:c&&a.focus&&a.focus({preventScroll:!0});break;case W.Click:case W.TouchStart:case W.TouchEnd:case W.MouseDown:case W.MouseUp:t?(o.type===W.TouchStart?this.touchActive=!0:o.type===W.TouchEnd&&(this.touchActive=!1),o.type===W.MouseDown?this.lastMouseDownEvent=[a,l]:o.type===W.MouseUp&&(this.lastMouseDownEvent=null),this.mousePos={x:o.x||0,y:o.y||0,id:o.id,debugData:o}):(o.type===W.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(o.x||0,o.y||0,o.id,t,o),o.type===W.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):o.type===W.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):o.type===W.TouchEnd?this.mouse.classList.remove("touch-active"):a.dispatchEvent(l));break;case W.TouchCancel:t?this.touchActive=!1:this.mouse.classList.remove("touch-active");break;default:a.dispatchEvent(l)}break}case M.Scroll:{if(o.id===-1)break;if(this.usingVirtualDom){const l=this.virtualDom.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);l.scrollData=o;break}this.applyScroll(o,t);break}case M.ViewportResize:this.emitter.emit(F.Resize,{width:o.width,height:o.height});break;case M.Input:{if(o.id===-1)break;if(this.usingVirtualDom){const l=this.virtualDom.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);l.inputData=o;break}this.applyInput(o);break}case M.MediaInteraction:{const l=this.usingVirtualDom?this.virtualDom.mirror.getNode(o.id):this.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);const a=l,{events:c}=this.service.state.context;this.mediaManager.mediaMutation({target:a,timeOffset:e.timestamp-c[0].timestamp,mutation:o});break}case M.StyleSheetRule:case M.StyleDeclaration:{this.usingVirtualDom?o.styleId?this.constructedStyleMutations.push(o):o.id&&((i=this.virtualDom.mirror.getNode(o.id))==null||i.rules.push(o)):this.applyStyleSheetMutation(o);break}case M.CanvasMutation:{if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){const l=this.virtualDom.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);l.canvasMutations.push({event:e,mutation:o})}else{const l=this.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);qs({event:e,mutation:o,target:l,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})}break}case M.Font:{try{const l=new FontFace(o.family,o.buffer?new Uint8Array(JSON.parse(o.fontSource)):o.fontSource,o.descriptors);(n=this.iframe.contentDocument)==null||n.fonts.add(l)}catch(l){this.warn(l)}break}case M.Selection:{if(t){this.lastSelectionData=o;break}this.applySelection(o);break}case M.AdoptedStyleSheet:{this.usingVirtualDom?this.adoptedStyleSheets.push(o):this.applyAdoptedStyleSheet(o);break}}}applyMutation(e,t){if(this.config.useVirtualDom&&!this.usingVirtualDom&&t&&(this.usingVirtualDom=!0,Pd(this.iframe.contentDocument,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length))for(const c in this.legacy_missingNodeRetryMap)try{const u=this.legacy_missingNodeRetryMap[c],h=Ga(u.node,this.virtualDom,this.mirror);h&&(u.node=h)}catch(u){this.warn(u)}const r=this.usingVirtualDom?this.virtualDom.mirror:this.mirror;e.removes=e.removes.filter(c=>r.getNode(c.id)?!0:(this.warnNodeNotFound(e,c.id),!1)),e.removes.forEach(c=>{var u;const h=r.getNode(c.id);if(!h)return;let f=r.getNode(c.parentId);if(!f)return this.warnNodeNotFound(e,c.parentId);if(c.isShadow&&Oe(f)&&(f=f.shadowRoot),r.removeNodeFromMap(h),f)try{f.removeChild(h),this.usingVirtualDom&&h.nodeName==="#text"&&f.nodeName==="STYLE"&&((u=f.rules)==null?void 0:u.length)>0&&(f.rules=[])}catch(d){if(d instanceof DOMException)this.warn("parent could not remove child in mutation",f,h,e);else throw d}});const i=O({},this.legacy_missingNodeRetryMap),n=[],o=c=>{let u=null;return c.nextId&&(u=r.getNode(c.nextId)),c.nextId!==null&&c.nextId!==void 0&&c.nextId!==-1&&!u},l=c=>{var u,h;if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");let f=r.getNode(c.parentId);if(!f)return c.node.type===Ce.Document?this.newDocumentQueue.push(c):n.push(c);c.node.isShadow&&(Oe(f)||f.attachShadow({mode:"open"}),f=f.shadowRoot);let d=null,m=null;if(c.previousId&&(d=r.getNode(c.previousId)),c.nextId&&(m=r.getNode(c.nextId)),o(c))return n.push(c);if(c.node.rootId&&!r.getNode(c.node.rootId))return;const g=c.node.rootId?r.getNode(c.node.rootId):this.usingVirtualDom?this.virtualDom:this.iframe.contentDocument;if(Qe(f,r)){this.attachDocumentToIframe(c,f);return}const p=(b,S)=>{if(!this.usingVirtualDom){hr(b);for(const C of this.config.plugins||[])C.onBuild&&C.onBuild(b,{id:S,replayer:this})}},y=bt(c.node,{doc:g,mirror:r,skipChild:!0,hackCss:!0,cache:this.cache,afterAppend:p});if(c.previousId===-1||c.nextId===-1){i[c.node.id]={node:y,mutation:c};return}const v=r.getMeta(f);if(v&&v.type===Ce.Element&&c.node.type===Ce.Text){const b=Array.isArray(f.childNodes)?f.childNodes:Array.from(f.childNodes);if(v.tagName==="textarea")for(const S of b)S.nodeType===f.TEXT_NODE&&f.removeChild(S);else if(v.tagName==="style"&&b.length===1)for(const S of b)S.nodeType===f.TEXT_NODE&&!r.hasNode(S)&&(y.textContent=S.textContent,f.removeChild(S))}else if((v==null?void 0:v.type)===Ce.Document){const b=f;c.node.type===Ce.DocumentType&&((u=b.childNodes[0])==null?void 0:u.nodeType)===Node.DOCUMENT_TYPE_NODE&&b.removeChild(b.childNodes[0]),y.nodeName==="HTML"&&b.documentElement&&b.removeChild(b.documentElement)}if(d&&d.nextSibling&&d.nextSibling.parentNode?f.insertBefore(y,d.nextSibling):m&&m.parentNode?f.contains(m)?f.insertBefore(y,m):f.insertBefore(y,null):f.appendChild(y),p(y,c.node.id),this.usingVirtualDom&&y.nodeName==="#text"&&f.nodeName==="STYLE"&&((h=f.rules)==null?void 0:h.length)>0&&(f.rules=[]),Qe(y,this.mirror)){const b=this.mirror.getId(y),S=this.newDocumentQueue.find(C=>C.parentId===b);S&&(this.attachDocumentToIframe(S,y),this.newDocumentQueue=this.newDocumentQueue.filter(C=>C!==S))}(c.previousId||c.nextId)&&this.legacy_resolveMissingNode(i,f,y,c)};e.adds.forEach(c=>{l(c)});const a=Date.now();for(;n.length;){const c=Ja(n);if(n.length=0,Date.now()-a>500){this.warn("Timeout in the loop, please check the resolve tree data:",c);break}for(const u of c)r.getNode(u.value.parentId)?Pi(u,f=>{l(f)}):this.debug("Drop resolve tree since there is no parent for the root node.",u)}Object.keys(i).length&&Object.assign(this.legacy_missingNodeRetryMap,i),Ka(e.texts).forEach(c=>{var u;const h=r.getNode(c.id);if(!h)return e.removes.find(d=>d.id===c.id)?void 0:this.warnNodeNotFound(e,c.id);const f=h.parentElement;if(c.value&&f&&f.tagName==="STYLE"?h.textContent=zr(c.value,this.cache):h.textContent=c.value,this.usingVirtualDom){const d=h.parentNode;((u=d==null?void 0:d.rules)==null?void 0:u.length)>0&&(d.rules=[])}}),e.attributes.forEach(c=>{var u;const h=r.getNode(c.id);if(!h)return e.removes.find(f=>f.id===c.id)?void 0:this.warnNodeNotFound(e,c.id);for(const f in c.attributes)if(typeof f=="string"){const d=c.attributes[f];if(d===null)h.removeAttribute(f),f==="open"&&Vp(h,c);else if(typeof d=="string")try{if(f==="_cssText"&&(h.nodeName==="LINK"||h.nodeName==="STYLE"))try{const m=r.getMeta(h),g=bt(te(O({},m),{attributes:O(O({},m.attributes),c.attributes)}),{doc:h.ownerDocument,mirror:r,skipChild:!0,hackCss:!0,cache:this.cache});Object.assign(m.attributes,c.attributes);const p=h.nextSibling,y=h.parentNode;if(g&&y){y.removeChild(h),y.insertBefore(g,p),r.replace(c.id,g);break}}catch(m){}if(f==="value"&&h.nodeName==="TEXTAREA"){const m=h;m.childNodes.forEach(p=>m.removeChild(p));const g=(u=h.ownerDocument)==null?void 0:u.createTextNode(d);g&&m.appendChild(g)}else h.setAttribute(f,d);f==="rr_open_mode"&&h.nodeName==="DIALOG"&&hr(h,c)}catch(m){this.warn("An error occurred may due to the checkout feature.",m)}else if(f==="style"){const m=d,g=h;for(const p in m)if(m[p]===!1)g.style.removeProperty(p);else if(m[p]instanceof Array){const y=m[p];g.style.setProperty(p,y[0],y[1])}else{const y=m[p];g.style.setProperty(p,y)}}}})}applyScroll(e,t){var r,i;const n=this.mirror.getNode(e.id);if(!n)return this.debugNodeNotFound(e,e.id);const o=this.mirror.getMeta(n);if(n===this.iframe.contentDocument)(r=this.iframe.contentWindow)==null||r.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"});else if((o==null?void 0:o.type)===Ce.Document)(i=n.defaultView)==null||i.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"});else try{n.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"})}catch(l){}}applyInput(e){const t=this.mirror.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);try{t.checked=e.isChecked,t.value=e.text}catch(r){}}applySelection(e){try{const t=new Set,r=e.ranges.map(({start:i,startOffset:n,end:o,endOffset:l})=>{const a=this.mirror.getNode(i),c=this.mirror.getNode(o);if(!a||!c)return;const u=new Range;u.setStart(a,n),u.setEnd(c,l);const h=a.ownerDocument,f=h==null?void 0:h.getSelection();return f&&t.add(f),{range:u,selection:f}});t.forEach(i=>i.removeAllRanges()),r.forEach(i=>{var n;return i&&((n=i.selection)==null?void 0:n.addRange(i.range))})}catch(t){}}applyStyleSheetMutation(e){var t;let r=null;e.styleId?r=this.styleMirror.getStyle(e.styleId):e.id&&(r=((t=this.mirror.getNode(e.id))==null?void 0:t.sheet)||null),r&&(e.source===M.StyleSheetRule?this.applyStyleSheetRule(e,r):e.source===M.StyleDeclaration&&this.applyStyleDeclaration(e,r))}applyStyleSheetRule(e,t){var r,i,n,o;if((r=e.adds)==null||r.forEach(({rule:l,index:a})=>{try{if(Array.isArray(a)){const{positions:c,index:u}=Ks(a);Xe(t.cssRules,c).insertRule(l,u)}else{const c=a===void 0?void 0:Math.min(a,t.cssRules.length);t==null||t.insertRule(l,c)}}catch(c){}}),(i=e.removes)==null||i.forEach(({index:l})=>{try{if(Array.isArray(l)){const{positions:a,index:c}=Ks(l);Xe(t.cssRules,a).deleteRule(c||0)}else t==null||t.deleteRule(l)}catch(a){}}),e.replace)try{(n=t.replace)==null||n.call(t,e.replace)}catch(l){}if(e.replaceSync)try{(o=t.replaceSync)==null||o.call(t,e.replaceSync)}catch(l){}}applyStyleDeclaration(e,t){e.set&&Xe(t.rules,e.index).style.setProperty(e.set.property,e.set.value,e.set.priority),e.remove&&Xe(t.rules,e.index).style.removeProperty(e.remove.property)}applyAdoptedStyleSheet(e){var t;const r=this.mirror.getNode(e.id);if(!r)return;(t=e.styles)==null||t.forEach(l=>{var a;let c=null,u=null;if(Oe(r)?u=((a=r.ownerDocument)==null?void 0:a.defaultView)||null:r.nodeName==="#document"&&(u=r.defaultView),!!u)try{c=new u.CSSStyleSheet,this.styleMirror.add(c,l.styleId),this.applyStyleSheetRule({source:M.StyleSheetRule,adds:l.rules},c)}catch(h){}});const i=10;let n=0;const o=(l,a)=>{const c=a.map(u=>this.styleMirror.getStyle(u)).filter(u=>u!==null);Oe(l)?l.shadowRoot.adoptedStyleSheets=c:l.nodeName==="#document"&&(l.adoptedStyleSheets=c),c.length!==a.length&&n<i&&(setTimeout(()=>o(l,a),0+100*n),n++)};o(r,e.styleIds)}legacy_resolveMissingNode(e,t,r,i){const{previousId:n,nextId:o}=i,l=n&&e[n],a=o&&e[o];if(l){const{node:c,mutation:u}=l;t.insertBefore(c,r),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,c,u)}if(a){const{node:c,mutation:u}=a;t.insertBefore(c,r.nextSibling),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,c,u)}}moveAndHover(e,t,r,i,n){const o=this.mirror.getNode(r);if(!o)return this.debugNodeNotFound(n,r);const l=Fi(o,this.iframe),a=e*l.absoluteScale+l.x,c=t*l.absoluteScale+l.y;this.mouse.style.left=`${a}px`,this.mouse.style.top=`${c}px`,i||this.drawMouseTail({x:a,y:c}),this.hoverElements(o)}drawMouseTail(e){if(!this.mouseTail)return;const{lineCap:t,lineWidth:r,strokeStyle:i,duration:n}=this.config.mouseTail===!0?ms:Object.assign({},ms,this.config.mouseTail),o=()=>{if(!this.mouseTail)return;const l=this.mouseTail.getContext("2d");!l||!this.tailPositions.length||(l.clearRect(0,0,this.mouseTail.width,this.mouseTail.height),l.beginPath(),l.lineWidth=r,l.lineCap=t,l.strokeStyle=i,l.moveTo(this.tailPositions[0].x,this.tailPositions[0].y),this.tailPositions.forEach(a=>l.lineTo(a.x,a.y)),l.stroke())};this.tailPositions.push(e),o(),setTimeout(()=>{this.tailPositions=this.tailPositions.filter(l=>l!==e),o()},n/this.speedService.state.context.timer.speed)}hoverElements(e){var t;(t=this.lastHoveredRootNode||this.iframe.contentDocument)==null||t.querySelectorAll(".\\:hover").forEach(i=>{i.classList.remove(":hover")}),this.lastHoveredRootNode=e.getRootNode();let r=e;for(;r;)r.classList&&r.classList.add(":hover"),r=r.parentElement}isUserInteraction(e){return e.type!==A.IncrementalSnapshot?!1:e.data.source>M.Mutation&&e.data.source<=M.Input}backToNormal(){this.nextUserInteractionEvent=null,!this.speedService.state.matches("normal")&&(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(F.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))}warnNodeNotFound(e,t){this.warn(`Node with id '${t}' not found. `,e)}warnCanvasMutationFailed(e,t){this.warn("Has error on canvas update",t,"canvas mutation:",e)}debugNodeNotFound(e,t){this.debug(`Node with id '${t}' not found. `,e)}warn(...e){this.config.showWarning&&this.config.logger.warn(lo,...e)}debug(...e){this.config.showDebug&&this.config.logger.log(lo,...e)}}const{addCustomEvent:Yp}=Me,{freezePage:Hp}=Me,{takeFullSnapshot:Zp}=Me;exports.EventType=A;exports.IncrementalSource=M;exports.MouseInteractions=W;exports.Replayer=jp;exports.ReplayerEvents=F;exports.addCustomEvent=Yp;exports.canvasMutation=qs;exports.freezePage=Hp;exports.record=Me;exports.takeFullSnapshot=Zp;exports.utils=Kd;
85
+ if (typeof module.exports == "object" && typeof exports == "object") {
74
86
  var __cp = (to, from, except, desc) => {
75
87
  if ((from && typeof from === "object") || typeof from === "function") {
76
88
  for (let key of Object.getOwnPropertyNames(from)) {