@highlight-run/rrweb 2.0.0-lambda.4 → 2.0.0-lambda.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rrweb.cjs +5 -1
- package/dist/rrweb.cjs.map +1 -1
- package/dist/rrweb.js +5 -1
- package/dist/rrweb.js.map +1 -1
- package/dist/rrweb.umd.cjs +5 -1
- package/dist/rrweb.umd.cjs.map +2 -2
- package/dist/rrweb.umd.min.cjs +2 -2
- package/dist/rrweb.umd.min.cjs.map +2 -2
- package/package.json +5 -5
package/dist/rrweb.umd.min.cjs
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
}(this, () => {
|
|
12
12
|
var exports = {};
|
|
13
13
|
var module = { exports };
|
|
14
|
-
"use strict";var Tl=Object.defineProperty,Dl=Object.defineProperties;var _l=Object.getOwnPropertyDescriptors;var zt=Object.getOwnPropertySymbols;var Ji=Object.prototype.hasOwnProperty,Ki=Object.prototype.propertyIsEnumerable;var Xi=(s,e,t)=>e in s?Tl(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,O=(s,e)=>{for(var t in e||(e={}))Ji.call(e,t)&&Xi(s,t,e[t]);if(zt)for(var t of zt(e))Ki.call(e,t)&&Xi(s,t,e[t]);return s},te=(s,e)=>Dl(s,_l(e));var je=(s,e)=>{var t={};for(var r in s)Ji.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&&Ki.call(s,r)&&(t[r]=s[r]);return t};var kl=Object.defineProperty,Ll=(s,e,t)=>e in s?kl(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,w=(s,e,t)=>Ll(s,typeof e!="symbol"?e+"":e,t),Qi;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Pl=Object.defineProperty,$l=(s,e,t)=>e in s?Pl(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,qi=(s,e,t)=>$l(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 Vt=new Map,en=new WeakSet;function tn(s){return s!==null&&typeof s=="object"&&"complete"in s&&"naturalWidth"in s&&"naturalHeight"in s&&"src"in s&&"onload"in s}function So(s){if(en.has(s))return;en.add(s);const e=s.drawImage.bind(s);s.drawImage=function(t,...r){const i=Vt.get(s);i&&(i.cancelled=!0);const n=()=>{r.length===2&&tn(t)&&r.push(t.naturalWidth||t.width,t.naturalHeight||t.height),e(t,...r)};if(tn(t)&&!t.complete){const o={cancelled:!1};Vt.set(s,o);const l=()=>{o.cancelled||(Vt.delete(s),n())},a=()=>{if(!o.cancelled){Vt.delete(s);try{n()}catch(c){}}};t.onload=l,t.onerror=a}else n()}}const rn={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},sn={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Gt={},Fl=()=>!!globalThis.Zone;function si(s){if(Gt[s])return Gt[s];const e=globalThis[s],t=e.prototype,r=s in rn?rn[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 sn?sn[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&&!Fl())return Gt[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?Gt[s]=c:t}catch(l){return t}}const is={};function ke(s,e,t){var r;const i=`${s}.${String(t)}`;if(is[i])return is[i].call(e);const n=si(s),o=(r=Object.getOwnPropertyDescriptor(n,t))==null?void 0:r.get;return o?(is[i]=o,o.call(e)):e[t]}const ns={};function Co(s,e,t){const r=`${s}.${String(t)}`;if(ns[r])return ns[r].bind(e);const n=si(s)[t];return typeof n!="function"?e[t]:(ns[r]=n,n.bind(e))}function Bl(s){return ke("Node",s,"childNodes")}function Wl(s){return ke("Node",s,"parentNode")}function Ul(s){return ke("Node",s,"parentElement")}function zl(s){return ke("Node",s,"textContent")}function Vl(s,e){return Co("Node",s,"contains")(e)}function Gl(s){return Co("Node",s,"getRootNode")()}function jl(s){return!s||!("host"in s)?null:ke("ShadowRoot",s,"host")}function Hl(s){return s.styleSheets}function Yl(s){return!s||!("shadowRoot"in s)?null:ke("Element",s,"shadowRoot")}function Zl(s,e){return ke("Element",s,"querySelector")(e)}function Xl(s,e){return ke("Element",s,"querySelectorAll")(e)}function Jl(){return si("MutationObserver").constructor}function Kl(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:Bl,parentNode:Wl,parentElement:Ul,textContent:zl,contains:Vl,getRootNode:Gl,host:jl,styleSheets:Hl,shadowRoot:Yl,querySelector:Zl,querySelectorAll:Xl,mutationObserver:Jl,patch:Kl,wrapCanvasContextDrawImage:So};function ii(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 Ql(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 ql(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 vs(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=>Io(i,t)).join("");return Ql(r)}catch(e){return null}}function Io(s,e){if(tc(s)){let t;try{t=vs(s.styleSheet)||ql(s)}catch(r){t=s.cssText}return s.styleSheet.href?Er(t,s.styleSheet.href):t}else{let t=s.cssText;return rc(s)&&s.selectorText.includes(":")&&(t=ec(t)),e?Er(t,e):t}}function ec(s){const e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return s.replace(e,"$1\\$2")}function tc(s){return"styleSheet"in s}function rc(s){return"selectorText"in s}class ni{constructor(){qi(this,"idNodeMap",new Map),qi(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 Eo(){return new ni}function Cr({element:s,maskInputOptions:e,tagName:t,type:r,value:i,overwriteRecord:n,maskInputFn:o}){let l=i||"";return Mo({maskInputOptions:e,tagName:t,type:r,overwriteRecord:n})&&(o?l=o(l,s):l="*".repeat(l.length)),l}function Ue(s){return s.toLowerCase()}const nn="__rrweb_original__";function sc(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=nn in n?n[nn]: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 ic(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 Ir(s){const e=s.type;return s.hasAttribute("data-rr-is-password")?"password":e?Ue(e):null}function oi(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 nc(s){let e="";return s.indexOf("//")>-1?e=s.split("/").slice(0,3).join("/"):e=s.split("/")[0],e=e.split("?")[0],e}const oc=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ac=/^(?:[a-z+]+:)?\/\//i,lc=/^www\..*/i,cc=/^(data:)([^,]*),(.*)/i;function Er(s,e){return(s||"").replace(oc,(t,r,i,n,o,l)=>{const a=i||o||l,c=r||n||"";if(!a)return t;if(ac.test(a)||lc.test(a))return`url(${c}${a}${c})`;if(cc.test(a))return`url(${c}${a}${c})`;if(a[0]==="/")return`url(${c}${nc(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 jt(s,e=!1){return e?s.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):s.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function uc(s,e,t=!1){const r=Array.from(e.childNodes),i=[];let n=0;if(r.length>1&&s&&typeof s=="string"){let o=jt(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=jt(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=jt(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=jt(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 hc(s,e){return uc(s,e).join("/* rr_split */")}function ai(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 Ss(s){return s==="img"||s==="video"||s==="audio"||s==="source"}const fc=new RegExp(/[a-zA-Z0-9.!#$%&'*+=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*/),dc=new RegExp(/[0-9]{9,16}/),pc=new RegExp(/[0-9]{3}-?[0-9]{2}-?[0-9]{4}/),mc=new RegExp(/[+]?[(]?[0-9]{3}[)]?[-\s.]?[0-9]{3}[-\s.]?[0-9]{4,6}/),gc=new RegExp(/[0-9]{4}-?[0-9]{4}-?[0-9]{4}-?[0-9]{4}/),yc=new RegExp(/[0-9]{1,5}.?[0-9]{0,3}\s[a-zA-Z]{2,30}\s[a-zA-Z]{2,15}/),wc=new RegExp(/(?:[0-9]{1,3}.){3}[0-9]{1,3}/),bc=[fc,dc,pc,mc,gc,yc,wc];function xo(s){return s?bc.some(e=>e.test(s)):!1}const Mo=({maskInputOptions:s,tagName:e,type:t,overwriteRecord:r})=>{const i=t&&t.toLowerCase();return r!=="true"&&(!!s[e.toLowerCase()]||!!(i&&s[i]))};let vc=1;const Sc=new RegExp("[^a-z0-9-_:]"),Ct=-2;function Ro(){return vc++}function Cc(s){if(s instanceof HTMLFormElement)return"form";const e=Ue(s.tagName);return Sc.test(e)?"div":e}let He,on;const Ic=/^[^ \t\n\r\u000c]+/,Ec=/^[, \t\n\r\u000c]+/;function xc(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(Ec),!(t>=e.length);){let n=r(Ic);if(n.slice(-1)===",")n=Xe(s,n.substring(0,n.length-1)),i.push(n);else{let o="";n=Xe(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 an=new WeakMap;function Xe(s,e){return!e||e.trim()===""?e:li(s,e)}function Mc(s){return!!(s.tagName==="svg"||s.ownerSVGElement)}function li(s,e){let t=an.get(s);if(t||(t=s.createElement("a"),an.set(s,t)),!e)e="";else if(e.startsWith("blob:")||e.startsWith("data:"))return e;return t.setAttribute("href",e),t.href}function Ao(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")?Xe(s,r):t==="srcset"?xc(s,r):t==="style"?Er(r,li(s)):e==="object"&&t==="data"?Xe(s,r):r)}function No(s,e,t){return(s==="video"||s==="audio")&&e==="autoplay"}function ln(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 xr(s,e,t){if(!s)return!1;if(s.nodeType!==s.ELEMENT_NODE)return t?xr(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?xr(ne.parentNode(s),e,t):!1}function Oo(s,e,t,r){let i;if(ii(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(xr(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 Rc(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 Ac(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 Nc(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=Oc(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 Dc(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 Tc(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 Oc(s,e){if(!e.hasNode(s))return;const t=e.getId(s);return t===1?void 0:t}function Tc(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=Er(u,li(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"&&xo(u);return(d||g)&&!m&&c&&!new Set(["HEAD","TITLE","STYLE","SCRIPT","HTML","BODY","NOSCRIPT"]).has(c)&&u&&(u=ai(u)),{type:L.Text,textContent:u||"",rootId:o}}function Dc(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=ln(s,r,i);const v=ln(s,a,null),b=g==="strict";let S=Cc(s),C={};const R=s.attributes.length;for(let I=0;I<R;I++){const x=s.attributes[I];No(S,x.name,x.value)||(C[x.name]=Ao(t,S,Ue(x.name),x.value))}if(S==="link"&&n){const I=Array.from(t.styleSheets).find(W=>W.href===s.href);let x=null;I&&(x=vs(I)),x&&(delete C.rel,delete C.href,C._cssText=x)}if(S==="style"&&s.sheet){let I=vs(s.sheet);I&&(s.childNodes.length>1&&(I=hc(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=Cr({element:s,type:Ir(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")sc(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 W=x.toDataURL(c.type,c.quality);I!==W&&(C.rr_dataURL=I)}}if(S==="img"&&u&&!y&&!v&&!b){He||(He=t.createElement("canvas"),on=He.getContext("2d"));const I=s,x=I.currentSrc||I.getAttribute("src")||"<unknown-src>",W=I.crossOrigin,j=()=>{I.removeEventListener("load",j);try{He.width=I.naturalWidth,He.height=I.naturalHeight,on.drawImage(I,0,0),C.rr_dataURL=He.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"&&(W?C.crossOrigin=W: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&&Ss(S)){const{width:I,height:x}=s.getBoundingClientRect();C={class:C.class,rr_width:`${I}px`,rr_height:`${x}px`}}b&&Ss(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:W}=I.getBoundingClientRect();C={width:x,height:W,rr_width:`${x}px`,rr_height:`${W}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:Mc(s)||void 0,needBlock:y,needMask:v,rootId:p,isCustom:T}}function Y(s){return s==null?"":s.toLowerCase()}function _c(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"&&oi(s.attributes.href)==="js"))return!0;if(e.headFavicon&&(s.tagName==="link"&&s.attributes.rel==="shortcut icon"||s.tagName==="meta"&&(Y(s.attributes.name).match(/^msapplication-tile(image|color)$/)||Y(s.attributes.name)==="application-name"||Y(s.attributes.rel)==="icon"||Y(s.attributes.rel)==="apple-touch-icon"||Y(s.attributes.rel)==="shortcut icon")))return!0;if(s.tagName==="meta"){if(e.headMetaDescKeywords&&Y(s.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(Y(s.attributes.property).match(/^(og|twitter|fb):/)||Y(s.attributes.name).match(/^(og|twitter):/)||Y(s.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(Y(s.attributes.name)==="robots"||Y(s.attributes.name)==="googlebot"||Y(s.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&s.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(Y(s.attributes.name)==="author"||Y(s.attributes.name)==="generator"||Y(s.attributes.name)==="framework"||Y(s.attributes.name)==="publisher"||Y(s.attributes.name)==="progid"||Y(s.attributes.property).match(/^article:/)||Y(s.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(Y(s.attributes.name)==="google-site-verification"||Y(s.attributes.name)==="yandex-verification"||Y(s.attributes.name)==="csrf-token"||Y(s.attributes.name)==="p:domain_verify"||Y(s.attributes.name)==="verify-v1"||Y(s.attributes.name)==="verification"||Y(s.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Je(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:W}=e,{preserveWhiteSpace:j=!0}=e;W||(W=Oo(s,o,l,W===void 0));const ee=Nc(s,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:W,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):_c(ee,d)||!j&&ee.type===L.Text&&!ee.textContent.replace(/^\s+|\s+$/gm,"").length?ae=Ct:ae=Ro();const A=Object.assign(ee,{id:ae});if(r.add(s,A),ae===Ct)return null;v&&v(s);let ce=!a,ue=x,se=x==="strict";if(A.type===L.Element){if(ce=ce&&!A.needBlock,se||(se=!!A.needBlock||!!A.needMask),ue=se?"strict":ue,se&&Ss(A.tagName)){const ie=s.cloneNode();ie.src="",r.add(ie,A)}delete A.needBlock,delete A.needMask;const J=ne.shadowRoot(s);J&&wt(J)&&(A.isShadowHost=!0)}if((A.type===L.Document||A.type===L.Element)&&ce){d.headWhitespace&&A.type===L.Element&&A.tagName==="head"&&(j=!1);const J={doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:W,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(!(A.type===L.Element&&A.tagName==="textarea"&&A.attributes.value!==void 0)){A.type===L.Element&&A.attributes._cssText!==void 0&&typeof A.attributes._cssText=="string"&&(J.cssCaptured=!0);for(const Pe of Array.from(ne.childNodes(s))){const Ne=Je(Pe,J);Ne&&A.childNodes.push(Ne)}}let ie=null;if(ii(s)&&(ie=ne.shadowRoot(s)))for(const Pe of Array.from(ne.childNodes(ie))){const Ne=Je(Pe,J);Ne&&(wt(ie)&&(Ne.isShadow=!0),A.childNodes.push(Ne))}}const he=ne.parentNode(s);return he&&yt(he)&&wt(he)&&(A.isShadow=!0),A.type===L.Element&&A.tagName==="iframe"&&Rc(s,()=>{const J=s.contentDocument;if(J&&b){const ie=Je(J,{doc:J,mirror:r,blockClass:i,blockSelector:n,needsMask:W,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),A.type===L.Element&&A.tagName==="link"&&typeof A.attributes.rel=="string"&&(A.attributes.rel==="stylesheet"||A.attributes.rel==="preload"&&typeof A.attributes.href=="string"&&oi(A.attributes.href)==="css")&&Ac(s,()=>{if(C){const J=Je(s,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:W,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),A}function kc(s,e){const{mirror:t=new ni,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 Je(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 Lc=/(max|min)-device-(width|height)/,cn=new RegExp(Lc.source,"g"),Pc={postcssPlugin:"postcss-custom-selectors",prepare(){return{postcssPlugin:"postcss-custom-selectors",AtRule:function(s){s.params.match(cn)&&(s.params=s.params.replace(cn,"$1-$2"))}}}},$c={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+=`,
|
|
14
|
+
"use strict";var Tl=Object.defineProperty,Dl=Object.defineProperties;var _l=Object.getOwnPropertyDescriptors;var zt=Object.getOwnPropertySymbols;var Ji=Object.prototype.hasOwnProperty,Ki=Object.prototype.propertyIsEnumerable;var Xi=(s,e,t)=>e in s?Tl(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,O=(s,e)=>{for(var t in e||(e={}))Ji.call(e,t)&&Xi(s,t,e[t]);if(zt)for(var t of zt(e))Ki.call(e,t)&&Xi(s,t,e[t]);return s},te=(s,e)=>Dl(s,_l(e));var je=(s,e)=>{var t={};for(var r in s)Ji.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&&Ki.call(s,r)&&(t[r]=s[r]);return t};var kl=Object.defineProperty,Ll=(s,e,t)=>e in s?kl(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,w=(s,e,t)=>Ll(s,typeof e!="symbol"?e+"":e,t),Qi;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Pl=Object.defineProperty,$l=(s,e,t)=>e in s?Pl(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,qi=(s,e,t)=>$l(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 Vt=new Map,en=new WeakSet;function tn(s){return s!==null&&typeof s=="object"&&"complete"in s&&"naturalWidth"in s&&"naturalHeight"in s&&"src"in s&&"onload"in s}function So(s){if(en.has(s))return;en.add(s);const e=s.drawImage.bind(s);s.drawImage=function(t,...r){const i=Vt.get(s);i&&(i.cancelled=!0);const n=()=>{r.length===2&&tn(t)&&r.push(t.naturalWidth||t.width,t.naturalHeight||t.height),e(t,...r)};if(tn(t)&&!t.complete){const o={cancelled:!1};Vt.set(s,o);const l=()=>{o.cancelled||(Vt.delete(s),n())},a=()=>{if(!o.cancelled){Vt.delete(s);try{n()}catch(c){}}};t.onload=l,t.onerror=a}else n()}}const rn={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},sn={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Gt={},Fl=()=>!!globalThis.Zone;function si(s){if(Gt[s])return Gt[s];const e=globalThis[s],t=e.prototype,r=s in rn?rn[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 sn?sn[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&&!Fl())return Gt[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?Gt[s]=c:t}catch(l){return t}}const is={};function ke(s,e,t){var r;const i=`${s}.${String(t)}`;if(is[i])return is[i].call(e);const n=si(s),o=(r=Object.getOwnPropertyDescriptor(n,t))==null?void 0:r.get;return o?(is[i]=o,o.call(e)):e[t]}const ns={};function Co(s,e,t){const r=`${s}.${String(t)}`;if(ns[r])return ns[r].bind(e);const n=si(s)[t];return typeof n!="function"?e[t]:(ns[r]=n,n.bind(e))}function Bl(s){return ke("Node",s,"childNodes")}function Wl(s){return ke("Node",s,"parentNode")}function Ul(s){return ke("Node",s,"parentElement")}function zl(s){return ke("Node",s,"textContent")}function Vl(s,e){return Co("Node",s,"contains")(e)}function Gl(s){return Co("Node",s,"getRootNode")()}function jl(s){return!s||!("host"in s)?null:ke("ShadowRoot",s,"host")}function Hl(s){return s.styleSheets}function Yl(s){return!s||!("shadowRoot"in s)?null:ke("Element",s,"shadowRoot")}function Zl(s,e){return ke("Element",s,"querySelector")(e)}function Xl(s,e){return ke("Element",s,"querySelectorAll")(e)}function Jl(){return si("MutationObserver").constructor}function Kl(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:Bl,parentNode:Wl,parentElement:Ul,textContent:zl,contains:Vl,getRootNode:Gl,host:jl,styleSheets:Hl,shadowRoot:Yl,querySelector:Zl,querySelectorAll:Xl,mutationObserver:Jl,patch:Kl,wrapCanvasContextDrawImage:So};function ii(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 Ql(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 ql(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 vs(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=>Io(i,t)).join("");return Ql(r)}catch(e){return null}}function Io(s,e){if(tc(s)){let t;try{t=vs(s.styleSheet)||ql(s)}catch(r){t=s.cssText}return s.styleSheet.href?Er(t,s.styleSheet.href):t}else{let t=s.cssText;return rc(s)&&s.selectorText.includes(":")&&(t=ec(t)),e?Er(t,e):t}}function ec(s){const e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return s.replace(e,"$1\\$2")}function tc(s){return"styleSheet"in s}function rc(s){return"selectorText"in s}class ni{constructor(){qi(this,"idNodeMap",new Map),qi(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 Eo(){return new ni}function Cr({element:s,maskInputOptions:e,tagName:t,type:r,value:i,overwriteRecord:n,maskInputFn:o}){let l=i||"";return Mo({maskInputOptions:e,tagName:t,type:r,overwriteRecord:n})&&(o?l=o(l,s):l="*".repeat(l.length)),l}function Ue(s){return s.toLowerCase()}const nn="__rrweb_original__";function sc(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=nn in n?n[nn]: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 ic(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 Ir(s){const e=s.type;return s.hasAttribute("data-rr-is-password")?"password":e?Ue(e):null}function oi(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 nc(s){let e="";return s.indexOf("//")>-1?e=s.split("/").slice(0,3).join("/"):e=s.split("/")[0],e=e.split("?")[0],e}const oc=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ac=/^(?:[a-z+]+:)?\/\//i,lc=/^www\..*/i,cc=/^(data:)([^,]*),(.*)/i;function Er(s,e){return(s||"").replace(oc,(t,r,i,n,o,l)=>{const a=i||o||l,c=r||n||"";if(!a)return t;if(ac.test(a)||lc.test(a))return`url(${c}${a}${c})`;if(cc.test(a))return`url(${c}${a}${c})`;if(a[0]==="/")return`url(${c}${nc(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 jt(s,e=!1){return e?s.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):s.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function uc(s,e,t=!1){const r=Array.from(e.childNodes),i=[];let n=0;if(r.length>1&&s&&typeof s=="string"){let o=jt(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=jt(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=jt(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=jt(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 hc(s,e){return uc(s,e).join("/* rr_split */")}function ai(s){return s=s.replace(/[^ -~]+/g,""),s=(s==null?void 0:s.split(" ").map(e=>e?Math.random().toString(20).substring(2,e.length+2):"").join(" "))||"",s}function Ss(s){return s==="img"||s==="video"||s==="audio"||s==="source"}const fc=new RegExp(/[a-zA-Z0-9.!#$%&'*+=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*/),dc=new RegExp(/[0-9]{9,16}/),pc=new RegExp(/[0-9]{3}-?[0-9]{2}-?[0-9]{4}/),mc=new RegExp(/[+]?[(]?[0-9]{3}[)]?[-\s.]?[0-9]{3}[-\s.]?[0-9]{4,6}/),gc=new RegExp(/[0-9]{4}-?[0-9]{4}-?[0-9]{4}-?[0-9]{4}/),yc=new RegExp(/[0-9]{1,5}.?[0-9]{0,3}\s[a-zA-Z]{2,30}\s[a-zA-Z]{2,15}/),wc=new RegExp(/(?:[0-9]{1,3}.){3}[0-9]{1,3}/),bc=[fc,dc,pc,mc,gc,yc,wc];function xo(s){return s?bc.some(e=>e.test(s)):!1}const Mo=({maskInputOptions:s,tagName:e,type:t,overwriteRecord:r})=>{const i=t&&t.toLowerCase();return r!=="true"&&(!!s[e.toLowerCase()]||!!(i&&s[i]))};let vc=1;const Sc=new RegExp("[^a-z0-9-_:]"),Ct=-2;function Ro(){return vc++}function Cc(s){if(s instanceof HTMLFormElement)return"form";const e=Ue(s.tagName);return Sc.test(e)?"div":e}let He,on;const Ic=/^[^ \t\n\r\u000c]+/,Ec=/^[, \t\n\r\u000c]+/;function xc(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(Ec),!(t>=e.length);){let n=r(Ic);if(n.slice(-1)===",")n=Xe(s,n.substring(0,n.length-1)),i.push(n);else{let o="";n=Xe(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 an=new WeakMap;function Xe(s,e){return!e||e.trim()===""?e:li(s,e)}function Mc(s){return!!(s.tagName==="svg"||s.ownerSVGElement)}function li(s,e){let t=an.get(s);if(t||(t=s.createElement("a"),an.set(s,t)),!e)e="";else if(e.startsWith("blob:")||e.startsWith("data:"))return e;return t.setAttribute("href",e),t.href}function Ao(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")?Xe(s,r):t==="srcset"?xc(s,r):t==="style"?Er(r,li(s)):e==="object"&&t==="data"?Xe(s,r):r)}function No(s,e,t){return(s==="video"||s==="audio")&&e==="autoplay"}function ln(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 xr(s,e,t){if(!s)return!1;if(s.nodeType!==s.ELEMENT_NODE)return t?xr(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?xr(ne.parentNode(s),e,t):!1}function Oo(s,e,t,r){let i;if(ii(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(xr(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 Rc(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 Ac(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 Nc(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=Oc(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 Dc(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 Tc(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 Oc(s,e){if(!e.hasNode(s))return;const t=e.getId(s);return t===1?void 0:t}function Tc(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=Er(u,li(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"&&xo(u);return(d||g)&&!m&&c&&!new Set(["HEAD","TITLE","STYLE","SCRIPT","HTML","BODY","NOSCRIPT"]).has(c)&&u&&(u=ai(u)),{type:L.Text,textContent:u||"",rootId:o}}function Dc(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=ln(s,r,i);const v=ln(s,a,null),b=g==="strict";let S=Cc(s),C={};const R=s.attributes.length;for(let I=0;I<R;I++){const x=s.attributes[I];No(S,x.name,x.value)||(C[x.name]=Ao(t,S,Ue(x.name),x.value))}if(S==="link"&&n){const I=Array.from(t.styleSheets).find(W=>W.href===s.href);let x=null;I&&(x=vs(I)),x&&(delete C.rel,delete C.href,C._cssText=x)}if(S==="style"&&s.sheet){let I=vs(s.sheet);I&&(s.childNodes.length>1&&(I=hc(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=Cr({element:s,type:Ir(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")sc(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 W=x.toDataURL(c.type,c.quality);I!==W&&(C.rr_dataURL=I)}}if(S==="img"&&u&&!y&&!v&&!b){He||(He=t.createElement("canvas"),on=He.getContext("2d"));const I=s,x=I.currentSrc||I.getAttribute("src")||"<unknown-src>",W=I.crossOrigin,j=()=>{I.removeEventListener("load",j);try{He.width=I.naturalWidth,He.height=I.naturalHeight,on.drawImage(I,0,0),C.rr_dataURL=He.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"&&(W?C.crossOrigin=W: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&&Ss(S)){const{width:I,height:x}=s.getBoundingClientRect();C={class:C.class,rr_width:`${I}px`,rr_height:`${x}px`}}b&&Ss(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:W}=I.getBoundingClientRect();C={width:x,height:W,rr_width:`${x}px`,rr_height:`${W}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:Mc(s)||void 0,needBlock:y,needMask:v,rootId:p,isCustom:T}}function Y(s){return s==null?"":s.toLowerCase()}function _c(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"&&oi(s.attributes.href)==="js"))return!0;if(e.headFavicon&&(s.tagName==="link"&&s.attributes.rel==="shortcut icon"||s.tagName==="meta"&&(Y(s.attributes.name).match(/^msapplication-tile(image|color)$/)||Y(s.attributes.name)==="application-name"||Y(s.attributes.rel)==="icon"||Y(s.attributes.rel)==="apple-touch-icon"||Y(s.attributes.rel)==="shortcut icon")))return!0;if(s.tagName==="meta"){if(e.headMetaDescKeywords&&Y(s.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(Y(s.attributes.property).match(/^(og|twitter|fb):/)||Y(s.attributes.name).match(/^(og|twitter):/)||Y(s.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(Y(s.attributes.name)==="robots"||Y(s.attributes.name)==="googlebot"||Y(s.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&s.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(Y(s.attributes.name)==="author"||Y(s.attributes.name)==="generator"||Y(s.attributes.name)==="framework"||Y(s.attributes.name)==="publisher"||Y(s.attributes.name)==="progid"||Y(s.attributes.property).match(/^article:/)||Y(s.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(Y(s.attributes.name)==="google-site-verification"||Y(s.attributes.name)==="yandex-verification"||Y(s.attributes.name)==="csrf-token"||Y(s.attributes.name)==="p:domain_verify"||Y(s.attributes.name)==="verify-v1"||Y(s.attributes.name)==="verification"||Y(s.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Je(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:W}=e,{preserveWhiteSpace:j=!0}=e;W||(W=Oo(s,o,l,W===void 0));const ee=Nc(s,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:W,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):_c(ee,d)||!j&&ee.type===L.Text&&!ee.textContent.replace(/^\s+|\s+$/gm,"").length?ae=Ct:ae=Ro();const A=Object.assign(ee,{id:ae});if(r.add(s,A),ae===Ct)return null;v&&v(s);let ce=!a,ue=x,se=x==="strict";if(A.type===L.Element){if(ce=ce&&!A.needBlock,se||(se=!!A.needBlock||!!A.needMask),ue=se?"strict":ue,se&&Ss(A.tagName)){const ie=s.cloneNode();ie.src="",r.add(ie,A)}delete A.needBlock,delete A.needMask;const J=ne.shadowRoot(s);J&&wt(J)&&(A.isShadowHost=!0)}if((A.type===L.Document||A.type===L.Element)&&ce){d.headWhitespace&&A.type===L.Element&&A.tagName==="head"&&(j=!1);const J={doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:W,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(!(A.type===L.Element&&A.tagName==="textarea"&&A.attributes.value!==void 0)){A.type===L.Element&&A.attributes._cssText!==void 0&&typeof A.attributes._cssText=="string"&&(J.cssCaptured=!0);for(const Pe of Array.from(ne.childNodes(s))){const Ne=Je(Pe,J);Ne&&A.childNodes.push(Ne)}}let ie=null;if(ii(s)&&(ie=ne.shadowRoot(s)))for(const Pe of Array.from(ne.childNodes(ie))){const Ne=Je(Pe,J);Ne&&(wt(ie)&&(Ne.isShadow=!0),A.childNodes.push(Ne))}}const he=ne.parentNode(s);return he&&yt(he)&&wt(he)&&(A.isShadow=!0),A.type===L.Element&&A.tagName==="iframe"&&Rc(s,()=>{const J=s.contentDocument;if(J&&b){const ie=Je(J,{doc:J,mirror:r,blockClass:i,blockSelector:n,needsMask:W,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),A.type===L.Element&&A.tagName==="link"&&typeof A.attributes.rel=="string"&&(A.attributes.rel==="stylesheet"||A.attributes.rel==="preload"&&typeof A.attributes.href=="string"&&oi(A.attributes.href)==="css")&&Ac(s,()=>{if(C){const J=Je(s,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:W,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),A}function kc(s,e){const{mirror:t=new ni,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 Je(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 Lc=/(max|min)-device-(width|height)/,cn=new RegExp(Lc.source,"g"),Pc={postcssPlugin:"postcss-custom-selectors",prepare(){return{postcssPlugin:"postcss-custom-selectors",AtRule:function(s){s.params.match(cn)&&(s.params=s.params.replace(cn,"$1-$2"))}}}},$c={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+=`,
|
|
15
15
|
`+t.replace(/:hover/g,".\\:hover"))}))}}}};function Fc(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Bc(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 ci={exports:{}},_=String,To=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:_}};ci.exports=To();ci.exports.createColors=To;var Wc=ci.exports;const Uc={},zc=Object.freeze(Object.defineProperty({__proto__:null,default:Uc},Symbol.toStringTag,{value:"Module"})),pe=Bc(zc);let un=Wc,hn=pe,Cs=class Do 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,Do)}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=un.isColorSupported);let r=u=>u,i=u=>u,n=u=>u;if(e){let{bold:u,gray:h,red:f}=un.createColors(!0);i=d=>u(f(d)),r=d=>h(d),hn&&(n=d=>hn(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)+`
|
|
16
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)+`
|
|
17
17
|
`+m+i("^")}return" "+r(d)+n(u)}).join(`
|
|
@@ -81,7 +81,7 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
81
81
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
82
82
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
83
83
|
PERFORMANCE OF THIS SOFTWARE.
|
|
84
|
-
***************************************************************************** */function uo(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 qe;(function(s){s[s.NotStarted=0]="NotStarted",s[s.Running=1]="Running",s[s.Stopped=2]="Stopped"})(qe||(qe={}));var Il={type:"xstate.init"};function ys(s){return s===void 0?[]:[].concat(s)}function Be(s){return{type:"xstate.assign",assignment:s}}function ho(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 Br(s){return function(e){return s===e}}function El(s){return typeof s=="string"?{type:s}:s}function fo(s,e){return{value:s,context:e,actions:[],changed:!1,matches:Br(s)}}function po(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 xl(s,e){e===void 0&&(e={});var t=uo(po(ys(s.states[s.initial].entry).map(function(o){return ho(o,e.actions)}),s.context,Il),2),r=t[0],i=t[1],n={config:s,_options:e,initialState:{value:s.initial,actions:r,context:i,matches:Br(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=El(l),m=s.states[h];if(m.on){var g=ys(m.on[d.type]);try{for(var p=function(A){var ce=typeof Symbol=="function"&&Symbol.iterator,ue=ce&&A[ce],se=0;if(ue)return ue.call(A);if(A&&typeof A.length=="number")return{next:function(){return A&&se>=A.length&&(A=void 0),{value:A&&A[se++],done:!A}}};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 fo(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=uo(po((D?ys(R):[].concat(m.exit,R,I.entry).filter(function(A){return A})).map(function(A){return ho(A,n._options.actions)}),f,d),3),W=x[0],j=x[1],ee=x[2],ae=S!=null?S:h;return{value:ae,context:j,actions:W,changed:S!==h||W.length>0||ee,matches:Br(ae)}}}}catch(A){a={error:A}}finally{try{y&&!y.done&&(c=p.return)&&c.call(p)}finally{if(a)throw a.error}}}return fo(h,f)}};return n}var mo=function(s,e){return s.actions.forEach(function(t){var r=t.exec;return r&&r(s.context,e)})};function Ml(s){var e=s.initialState,t=qe.NotStarted,r=new Set,i={_machine:s,send:function(n){t===qe.Running&&(e=s.transition(e,n),mo(e,El(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:Br(o.value)}}return t=qe.Running,mo(e,Il),i},stop:function(){return t=qe.Stopped,r.clear(),i},get state(){return e},get status(){return t}};return i}function Yp(s,e){for(let t=s.length-1;t>=0;t--){const r=s[t];if(r.type===N.Meta&&r.timestamp<=e)return s.slice(t)}return s}function Zp(s,{getCastFn:e,applyEventsSynchronously:t,emitter:r}){const i=xl({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:Be({lastPlayedEvent:(n,o)=>o.type==="CAST_EVENT"?o.payload.event:n.lastPlayedEvent}),recordTimeOffset:Be((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)gs(m,c);const h=Yp(a,c);let f=u==null?void 0:u.timestamp;(u==null?void 0:u.type)===N.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:Be(n=>te(O({},n),{lastPlayedEvent:null})),startLive:Be({baselineTime:(n,o)=>(n.timer.start(),o.type==="TO_LIVE"&&o.payload.baselineTime?o.payload.baselineTime:Date.now())}),replaceEvents:Be((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)gs(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:Be((n,o)=>{const{baselineTime:l,timer:a,events:c}=n;if(o.type==="ADD_EVENT"){const{event:u}=o.payload;gs(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 Ml(i)}function Xp(s){const e=xl({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:Be({normalSpeed:t=>t.timer.speed}),restoreSpeed:t=>{t.timer.setSpeed(t.normalSpeed)}}});return Ml(e)}const Jp=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;}`],go=new Map;function Rl(s,e){let t=go.get(s);return t||(t=new Map,go.set(s,t)),t.has(e)||t.set(e,[]),t.get(e)}function _e(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 _e(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 Rl(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(_e(s,e,t))))}else{if("base64"in r)return kp(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(_e(s,e,t)));return new Blob(i,{type:r.type})}}else if(Array.isArray(r))return await Promise.all(r.map(_e(s,e,t)));return r}}function Kp(s,e){try{return e===Re.WebGL?s.getContext("webgl")||s.getContext("experimental-webgl"):s.getContext("webgl2")}catch(t){return null}}const Qp=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function qp(s,e){if(!(e!=null&&e.constructor))return;const{name:t}=e.constructor;if(!Qp.includes(t))return;const r=Rl(s,t);r.includes(e)||r.push(e)}async function em({mutation:s,target:e,type:t,imageMap:r,errorHandler:i}){try{const n=Kp(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(_e(r,n))),a=o.apply(n,l);qp(n,a);const c=!1}catch(n){i(s,n)}}async function tm({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}nl(n);const o=e.map(async a=>Promise.all(a.args.map(_e(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 ri({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([Re.WebGL,Re.WebGL2].includes(e.type)){for(let a=0;a<l.length;a++){const c=l[a];await em({mutation:c,type:e.type,target:t,imageMap:r,errorHandler:n})}return}await tm({event:s,mutations:l,target:t,imageMap:r,errorHandler:n})}catch(o){n(e,o)}}class rm{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===Te.Play||n!==Te.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 pr(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 sm(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 yo=5*1e3,wo=1*1e3,bo=60*60*1e3,im=Cl||Gp,vo="[replayer]",ws={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function bs(s){return s.type==N.IncrementalSnapshot&&(s.data.source==M.TouchMove||s.data.source==M.MouseInteraction&&s.data.type==U.TouchStart)}class nm{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 lt),w(this,"mouse"),w(this,"mouseTail",null),w(this,"tailPositions",[]),w(this,"emitter",im()),w(this,"nextUserInteractionEvent"),w(this,"activityIntervals",[]),w(this,"inactiveEndTimestamp"),w(this,"legacy_missingNodeRetryMap",{}),w(this,"cache",An()),w(this,"imageMap",new Map),w(this,"canvasEventMap",new Map),w(this,"mirror",Eo()),w(this,"styleMirror",new zi),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 N.DomContentLoaded:case N.Load:case N.Custom:continue;case N.FullSnapshot:case N.Meta:case N.Plugin:case N.IncrementalSnapshot:break}this.getCastFn(a,!0)()}}),w(this,"getCastFn",(l,a=!1)=>{let c;switch(l.type){case N.DomContentLoaded:case N.Load:break;case N.Custom:c=()=>{this.emitter.emit(F.CustomEvent,l)};break;case N.Meta:c=()=>this.emitter.emit(F.Resize,{width:l.data.width,height:l.data.height});break;case N.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 N.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/yo),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===N.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:ws,useVirtualDom:!0,logger:console,inactiveThreshold:.02,inactiveSkipTime:yo};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)=>{ri({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{kr(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=Lr(c.node,this.mirror,this.virtualDom.mirror);kr(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 Hp([],{speed:this.config.speed});this.service=Zp({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=Xp({normalSpeed:-1,timer:i}),this.speedService.start(),this.speedService.subscribe(l=>{this.emitter.emit(F.StateChange,{speed:l})}),this.mediaManager=new rm({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===N.Meta),o=this.service.state.context.events.find(l=>l.type===N.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(bs)&&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;bs(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(bs(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=An()}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&&(jp(this.iframe.contentWindow,this.iframe.contentDocument),Fi(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/bo*this.config.inactiveSkipTime<wo?r/wo:Math.round(Math.max(r,bo)/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(),Dh(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=>pr(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=Jp(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,il(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)===Ee.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=>pr(l))}collectIframeAndAttachDocument(e,t){if(et(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===N.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(_e(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(_e(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(Ue(U[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 U.Blur:"blur"in a&&a.blur();break;case U.Focus:c&&a.focus&&a.focus({preventScroll:!0});break;case U.Click:case U.TouchStart:case U.TouchEnd:case U.MouseDown:case U.MouseUp:t?(o.type===U.TouchStart?this.touchActive=!0:o.type===U.TouchEnd&&(this.touchActive=!1),o.type===U.MouseDown?this.lastMouseDownEvent=[a,l]:o.type===U.MouseUp&&(this.lastMouseDownEvent=null),this.mousePos={x:o.x||0,y:o.y||0,id:o.id,debugData:o}):(o.type===U.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(o.x||0,o.y||0,o.id,t,o),o.type===U.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):o.type===U.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):o.type===U.TouchEnd?this.mouse.classList.remove("touch-active"):a.dispatchEvent(l));break;case U.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);ri({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,Jd(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=sl(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&&De(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===Ee.Document?this.newDocumentQueue.push(c):n.push(c);c.node.isShadow&&(De(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(et(f,r)){this.attachDocumentToIframe(c,f);return}const p=(b,S)=>{if(!this.usingVirtualDom){pr(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===Ee.Element&&c.node.type===Ee.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)===Ee.Document){const b=f;c.node.type===Ee.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=[]),et(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=ul(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)?Bi(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),hl(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=jr(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"&&sm(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"&&pr(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)===Ee.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}=ei(a);Ke(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}=ei(l);Ke(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&&Ke(t.rules,e.index).style.setProperty(e.set.property,e.set.value,e.set.priority),e.remove&&Ke(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(De(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);De(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=Ui(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?ws:Object.assign({},ws,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!==N.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(vo,...e)}debug(...e){this.config.showDebug&&this.config.logger.log(vo,...e)}}const{addCustomEvent:om}=Ae,{freezePage:am}=Ae,{takeFullSnapshot:lm}=Ae;exports.EventType=N;exports.IncrementalSource=M;exports.MouseInteractions=U;exports.Replayer=nm;exports.ReplayerEvents=F;exports.addCustomEvent=om;exports.canvasMutation=ri;exports.freezePage=am;exports.record=Ae;exports.takeFullSnapshot=lm;exports.utils=hp;
|
|
84
|
+
***************************************************************************** */function uo(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 qe;(function(s){s[s.NotStarted=0]="NotStarted",s[s.Running=1]="Running",s[s.Stopped=2]="Stopped"})(qe||(qe={}));var Il={type:"xstate.init"};function ys(s){return s===void 0?[]:[].concat(s)}function Be(s){return{type:"xstate.assign",assignment:s}}function ho(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 Br(s){return function(e){return s===e}}function El(s){return typeof s=="string"?{type:s}:s}function fo(s,e){return{value:s,context:e,actions:[],changed:!1,matches:Br(s)}}function po(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 xl(s,e){e===void 0&&(e={});var t=uo(po(ys(s.states[s.initial].entry).map(function(o){return ho(o,e.actions)}),s.context,Il),2),r=t[0],i=t[1],n={config:s,_options:e,initialState:{value:s.initial,actions:r,context:i,matches:Br(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=El(l),m=s.states[h];if(m.on){var g=ys(m.on[d.type]);try{for(var p=function(A){var ce=typeof Symbol=="function"&&Symbol.iterator,ue=ce&&A[ce],se=0;if(ue)return ue.call(A);if(A&&typeof A.length=="number")return{next:function(){return A&&se>=A.length&&(A=void 0),{value:A&&A[se++],done:!A}}};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 fo(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=uo(po((D?ys(R):[].concat(m.exit,R,I.entry).filter(function(A){return A})).map(function(A){return ho(A,n._options.actions)}),f,d),3),W=x[0],j=x[1],ee=x[2],ae=S!=null?S:h;return{value:ae,context:j,actions:W,changed:S!==h||W.length>0||ee,matches:Br(ae)}}}}catch(A){a={error:A}}finally{try{y&&!y.done&&(c=p.return)&&c.call(p)}finally{if(a)throw a.error}}}return fo(h,f)}};return n}var mo=function(s,e){return s.actions.forEach(function(t){var r=t.exec;return r&&r(s.context,e)})};function Ml(s){var e=s.initialState,t=qe.NotStarted,r=new Set,i={_machine:s,send:function(n){t===qe.Running&&(e=s.transition(e,n),mo(e,El(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:Br(o.value)}}return t=qe.Running,mo(e,Il),i},stop:function(){return t=qe.Stopped,r.clear(),i},get state(){return e},get status(){return t}};return i}function Yp(s,e){for(let t=s.length-1;t>=0;t--){const r=s[t];if(r.type===N.Meta&&r.timestamp<=e)return s.slice(t)}return s}function Zp(s,{getCastFn:e,applyEventsSynchronously:t,emitter:r}){const i=xl({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:Be({lastPlayedEvent:(n,o)=>o.type==="CAST_EVENT"?o.payload.event:n.lastPlayedEvent}),recordTimeOffset:Be((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)gs(m,c);const h=Yp(a,c);let f=u==null?void 0:u.timestamp;(u==null?void 0:u.type)===N.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:Be(n=>te(O({},n),{lastPlayedEvent:null})),startLive:Be({baselineTime:(n,o)=>(n.timer.start(),o.type==="TO_LIVE"&&o.payload.baselineTime?o.payload.baselineTime:Date.now())}),replaceEvents:Be((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)gs(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:Be((n,o)=>{const{baselineTime:l,timer:a,events:c}=n;if(o.type==="ADD_EVENT"){const{event:u}=o.payload;gs(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 Ml(i)}function Xp(s){const e=xl({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:Be({normalSpeed:t=>t.timer.speed}),restoreSpeed:t=>{t.timer.setSpeed(t.normalSpeed)}}});return Ml(e)}const Jp=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;}`],go=new Map;function Rl(s,e){let t=go.get(s);return t||(t=new Map,go.set(s,t)),t.has(e)||t.set(e,[]),t.get(e)}function _e(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 _e(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 Rl(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(_e(s,e,t))))}else{if("base64"in r)return kp(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(_e(s,e,t)));return new Blob(i,{type:r.type})}}else if(Array.isArray(r))return await Promise.all(r.map(_e(s,e,t)));return r}}function Kp(s,e){try{return e===Re.WebGL?s.getContext("webgl")||s.getContext("experimental-webgl"):s.getContext("webgl2")}catch(t){return null}}const Qp=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function qp(s,e){if(!(e!=null&&e.constructor))return;const{name:t}=e.constructor;if(!Qp.includes(t))return;const r=Rl(s,t);r.includes(e)||r.push(e)}async function em({mutation:s,target:e,type:t,imageMap:r,errorHandler:i}){try{const n=Kp(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(_e(r,n))),a=o.apply(n,l);qp(n,a);const c=!1}catch(n){i(s,n)}}async function tm({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}nl(n);const o=e.map(async a=>Promise.all(a.args.map(_e(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 ri({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([Re.WebGL,Re.WebGL2].includes(e.type)){for(let a=0;a<l.length;a++){const c=l[a];await em({mutation:c,type:e.type,target:t,imageMap:r,errorHandler:n})}return}await tm({event:s,mutations:l,target:t,imageMap:r,errorHandler:n})}catch(o){n(e,o)}}class rm{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===Te.Play||n!==Te.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 pr(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 sm(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 yo=5*1e3,wo=1*1e3,bo=60*60*1e3,im=Cl||Gp,vo="[replayer]",ws={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function bs(s){return s.type==N.IncrementalSnapshot&&(s.data.source==M.TouchMove||s.data.source==M.MouseInteraction&&s.data.type==U.TouchStart)}class nm{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 lt),w(this,"mouse"),w(this,"mouseTail",null),w(this,"tailPositions",[]),w(this,"emitter",im()),w(this,"nextUserInteractionEvent"),w(this,"activityIntervals",[]),w(this,"inactiveEndTimestamp"),w(this,"legacy_missingNodeRetryMap",{}),w(this,"cache",An()),w(this,"imageMap",new Map),w(this,"canvasEventMap",new Map),w(this,"mirror",Eo()),w(this,"styleMirror",new zi),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 N.DomContentLoaded:case N.Load:case N.Custom:continue;case N.FullSnapshot:case N.Meta:case N.Plugin:case N.IncrementalSnapshot:break}this.getCastFn(a,!0)()}}),w(this,"getCastFn",(l,a=!1)=>{let c;switch(l.type){case N.DomContentLoaded:case N.Load:break;case N.Custom:c=()=>{this.emitter.emit(F.CustomEvent,l)};break;case N.Meta:c=()=>this.emitter.emit(F.Resize,{width:l.data.width,height:l.data.height});break;case N.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 N.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/yo),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===N.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:ws,useVirtualDom:!0,logger:console,inactiveThreshold:.02,inactiveSkipTime:yo};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)=>{ri({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{kr(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=Lr(c.node,this.mirror,this.virtualDom.mirror);kr(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 Hp([],{speed:this.config.speed});this.service=Zp({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=Xp({normalSpeed:-1,timer:i}),this.speedService.start(),this.speedService.subscribe(l=>{this.emitter.emit(F.StateChange,{speed:l})}),this.mediaManager=new rm({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===N.Meta),o=this.service.state.context.events.find(l=>l.type===N.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(bs)&&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;bs(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(bs(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=An()}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&&(jp(this.iframe.contentWindow,this.iframe.contentDocument),Fi(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/bo*this.config.inactiveSkipTime<wo?r/wo:Math.round(Math.max(r,bo)/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(),this.newDocumentQueue=[],Dh(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=>pr(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=Jp(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,il(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)===Ee.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=>pr(l))}collectIframeAndAttachDocument(e,t){if(et(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===N.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(_e(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(_e(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(Ue(U[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 U.Blur:"blur"in a&&a.blur();break;case U.Focus:c&&a.focus&&a.focus({preventScroll:!0});break;case U.Click:case U.TouchStart:case U.TouchEnd:case U.MouseDown:case U.MouseUp:t?(o.type===U.TouchStart?this.touchActive=!0:o.type===U.TouchEnd&&(this.touchActive=!1),o.type===U.MouseDown?this.lastMouseDownEvent=[a,l]:o.type===U.MouseUp&&(this.lastMouseDownEvent=null),this.mousePos={x:o.x||0,y:o.y||0,id:o.id,debugData:o}):(o.type===U.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(o.x||0,o.y||0,o.id,t,o),o.type===U.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):o.type===U.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):o.type===U.TouchEnd?this.mouse.classList.remove("touch-active"):a.dispatchEvent(l));break;case U.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);ri({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,Jd(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=sl(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&&De(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===Ee.Document?this.newDocumentQueue.push(c):n.push(c);c.node.isShadow&&(De(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(et(f,r)){this.attachDocumentToIframe(c,f);return}const p=(b,S)=>{if(!this.usingVirtualDom){pr(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===Ee.Element&&c.node.type===Ee.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)===Ee.Document){const b=f;c.node.type===Ee.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=[]),et(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=ul(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)?Bi(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),hl(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=jr(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"&&sm(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"&&pr(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)===Ee.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}=ei(a);Ke(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}=ei(l);Ke(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&&Ke(t.rules,e.index).style.setProperty(e.set.property,e.set.value,e.set.priority),e.remove&&Ke(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(De(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);De(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=Ui(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?ws:Object.assign({},ws,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!==N.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(vo,...e)}debug(...e){this.config.showDebug&&this.config.logger.log(vo,...e)}}const{addCustomEvent:om}=Ae,{freezePage:am}=Ae,{takeFullSnapshot:lm}=Ae;exports.EventType=N;exports.IncrementalSource=M;exports.MouseInteractions=U;exports.Replayer=nm;exports.ReplayerEvents=F;exports.addCustomEvent=om;exports.canvasMutation=ri;exports.freezePage=am;exports.record=Ae;exports.takeFullSnapshot=lm;exports.utils=hp;
|
|
85
85
|
if (typeof module.exports == "object" && typeof exports == "object") {
|
|
86
86
|
var __cp = (to, from, except, desc) => {
|
|
87
87
|
if ((from && typeof from === "object") || typeof from === "function") {
|