@highlight-run/rrweb 2.0.8 → 2.0.11

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.
Files changed (41) hide show
  1. package/dist/plugins/console-record.js +5 -5
  2. package/dist/plugins/console-record.min.js +5 -5
  3. package/dist/plugins/console-record.min.js.map +1 -1
  4. package/dist/plugins/console-replay.js +3 -3
  5. package/dist/plugins/console-replay.min.js +3 -3
  6. package/dist/plugins/console-replay.min.js.map +1 -1
  7. package/dist/record/rrweb-record-pack.js +2 -2
  8. package/dist/record/rrweb-record-pack.min.js +2 -2
  9. package/dist/record/rrweb-record-pack.min.js.map +1 -1
  10. package/dist/record/rrweb-record.js +3 -3
  11. package/dist/record/rrweb-record.min.js +3 -3
  12. package/dist/record/rrweb-record.min.js.map +1 -1
  13. package/dist/replay/rrweb-replay-unpack.js +3 -4
  14. package/dist/replay/rrweb-replay-unpack.min.js +3 -4
  15. package/dist/replay/rrweb-replay-unpack.min.js.map +1 -1
  16. package/dist/replay/rrweb-replay.js +3 -4
  17. package/dist/replay/rrweb-replay.min.js +3 -4
  18. package/dist/replay/rrweb-replay.min.js.map +1 -1
  19. package/dist/rrweb-all.js +24 -25
  20. package/dist/rrweb-all.min.js +24 -25
  21. package/dist/rrweb-all.min.js.map +1 -1
  22. package/dist/rrweb.js +14 -15
  23. package/dist/rrweb.min.js +14 -15
  24. package/dist/rrweb.min.js.map +1 -1
  25. package/es/rrweb/packages/rrdom/es/virtual-dom.js +51 -90
  26. package/es/rrweb/packages/rrweb/src/index.js +1 -1
  27. package/es/rrweb/packages/rrweb/src/record/index.js +6 -3
  28. package/es/rrweb/packages/rrweb/src/record/mutation.js +1 -1
  29. package/es/rrweb/packages/rrweb/src/record/observer.js +1 -1
  30. package/es/rrweb/packages/rrweb/src/replay/index.js +1 -1
  31. package/es/rrweb/packages/rrweb/src/utils.js +1 -1
  32. package/lib/plugins/console-record.js +1 -9
  33. package/lib/plugins/console-replay.js +1 -9
  34. package/lib/record/rrweb-record-pack.js +3 -9
  35. package/lib/record/rrweb-record.js +21 -1061
  36. package/lib/replay/rrweb-replay-unpack.js +96 -1015
  37. package/lib/replay/rrweb-replay.js +96 -1015
  38. package/lib/rrweb-all.js +141 -2034
  39. package/lib/rrweb.js +141 -2034
  40. package/package.json +4 -4
  41. package/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js +0 -1858
@@ -1,5 +1,4 @@
1
- var rrwebReplay=function(ue){"use strict";var I;(function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"})(I||(I={}));function vt(e){return e.nodeType===e.ELEMENT_NODE}var Se=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(t){var r;if(!t)return-1;var i=(r=this.getMeta(t))===null||r===void 0?void 0:r.id;return i??-1},e.prototype.getNode=function(t){return this.idNodeMap.get(t)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(t){return this.nodeMetaMap.get(t)||null},e.prototype.removeNodeFromMap=function(t){var r=this,i=this.getId(t);this.idNodeMap.delete(i),t.childNodes&&t.childNodes.forEach(function(n){return r.removeNodeFromMap(n)})},e.prototype.has=function(t){return this.idNodeMap.has(t)},e.prototype.hasNode=function(t){return this.nodeMetaMap.has(t)},e.prototype.add=function(t,r){var i=r.id;this.idNodeMap.set(i,t),this.nodeMetaMap.set(t,r)},e.prototype.replace=function(t,r){this.idNodeMap.set(t,r)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function Tt(){return new Se}var Re=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function Nt(e,t){t===void 0&&(t={});var r=1,i=1;function n(y){var p=y.match(/\n/g);p&&(r+=p.length);var b=y.lastIndexOf(`
2
- `);i=b===-1?i+y.length:y.length-b}function s(){var y={line:r,column:i};return function(p){return p.position=new a(y),T(),p}}var a=function(){function y(p){this.start=p,this.end={line:r,column:i},this.source=t.source}return y}();a.prototype.content=e;var l=[];function u(y){var p=new Error(t.source+":"+r+":"+i+": "+y);if(p.reason=y,p.filename=t.source,p.line=r,p.column=i,p.source=e,t.silent)l.push(p);else throw p}function o(){var y=m();return{type:"stylesheet",stylesheet:{source:t.source,rules:y,parsingErrors:l}}}function c(){return f(/^{\s*/)}function d(){return f(/^}/)}function m(){var y,p=[];for(T(),g(p);e.length&&e.charAt(0)!=="}"&&(y=O()||te());)y!==!1&&(p.push(y),g(p));return p}function f(y){var p=y.exec(e);if(p){var b=p[0];return n(b),e=e.slice(b.length),p}}function T(){f(/^\s*/)}function g(y){y===void 0&&(y=[]);for(var p;p=E();)p!==!1&&y.push(p),p=E();return y}function E(){var y=s();if(!(e.charAt(0)!=="/"||e.charAt(1)!=="*")){for(var p=2;e.charAt(p)!==""&&(e.charAt(p)!=="*"||e.charAt(p+1)!=="/");)++p;if(p+=2,e.charAt(p-1)==="")return u("End of comment missing");var b=e.slice(2,p-2);return i+=2,n(b),e=e.slice(p),i+=2,y({type:"comment",comment:b})}}function h(){var y=f(/^([^{]+)/);if(y)return B(y[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,function(p){return p.replace(/,/g,"\u200C")}).split(/\s*(?![^(]*\)),\s*/).map(function(p){return p.replace(/\u200C/g,",")})}function v(){var y=s(),p=f(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(p){var b=B(p[0]);if(!f(/^:\s*/))return u("property missing ':'");var S=f(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),P=y({type:"declaration",property:b.replace(Re,""),value:S?B(S[0]).replace(Re,""):""});return f(/^[;\s]*/),P}}function w(){var y=[];if(!c())return u("missing '{'");g(y);for(var p;p=v();)p!==!1&&(y.push(p),g(y)),p=v();return d()?y:u("missing '}'")}function R(){for(var y,p=[],b=s();y=f(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)p.push(y[1]),f(/^,\s*/);if(p.length)return b({type:"keyframe",values:p,declarations:w()})}function L(){var y=s(),p=f(/^@([-\w]+)?keyframes\s*/);if(p){var b=p[1];if(p=f(/^([-\w]+)\s*/),!p)return u("@keyframes missing name");var S=p[1];if(!c())return u("@keyframes missing '{'");for(var P,le=g();P=R();)le.push(P),le=le.concat(g());return d()?y({type:"keyframes",name:S,vendor:b,keyframes:le}):u("@keyframes missing '}'")}}function k(){var y=s(),p=f(/^@supports *([^{]+)/);if(p){var b=B(p[1]);if(!c())return u("@supports missing '{'");var S=g().concat(m());return d()?y({type:"supports",supports:b,rules:S}):u("@supports missing '}'")}}function A(){var y=s(),p=f(/^@host\s*/);if(p){if(!c())return u("@host missing '{'");var b=g().concat(m());return d()?y({type:"host",rules:b}):u("@host missing '}'")}}function H(){var y=s(),p=f(/^@media *([^{]+)/);if(p){var b=B(p[1]);if(!c())return u("@media missing '{'");var S=g().concat(m());return d()?y({type:"media",media:b,rules:S}):u("@media missing '}'")}}function W(){var y=s(),p=f(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(p)return y({type:"custom-media",name:B(p[1]),media:B(p[2])})}function De(){var y=s(),p=f(/^@page */);if(p){var b=h()||[];if(!c())return u("@page missing '{'");for(var S=g(),P;P=v();)S.push(P),S=S.concat(g());return d()?y({type:"page",selectors:b,declarations:S}):u("@page missing '}'")}}function Me(){var y=s(),p=f(/^@([-\w]+)?document *([^{]+)/);if(p){var b=B(p[1]),S=B(p[2]);if(!c())return u("@document missing '{'");var P=g().concat(m());return d()?y({type:"document",document:S,vendor:b,rules:P}):u("@document missing '}'")}}function ee(){var y=s(),p=f(/^@font-face\s*/);if(p){if(!c())return u("@font-face missing '{'");for(var b=g(),S;S=v();)b.push(S),b=b.concat(g());return d()?y({type:"font-face",declarations:b}):u("@font-face missing '}'")}}var ce=Q("import"),Ce=Q("charset"),xe=Q("namespace");function Q(y){var p=new RegExp("^@"+y+"\\s*([^;]+);");return function(){var b=s(),S=f(p);if(S){var P={type:y};return P[y]=S[1].trim(),b(P)}}}function O(){if(e[0]==="@")return L()||H()||W()||k()||ce()||Ce()||xe()||Me()||De()||A()||ee()}function te(){var y=s(),p=h();return p?(g(),y({type:"rule",selectors:p,declarations:w()})):u("selector missing")}return de(o())}function B(e){return e?e.replace(/^\s+|\s+$/g,""):""}function de(e,t){for(var r=e&&typeof e.type=="string",i=r?e:t,n=0,s=Object.keys(e);n<s.length;n++){var a=s[n],l=e[a];Array.isArray(l)?l.forEach(function(u){de(u,i)}):l&&typeof l=="object"&&de(l,i)}return r&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var Ae={script:"noscript",altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};function Et(e){var t=Ae[e.tagName]?Ae[e.tagName]:e.tagName;return t==="link"&&e.attributes._cssText&&(t="style"),t}function wt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Ie=/([^\\]):hover/,bt=new RegExp(Ie.source,"g");function Oe(e,t){var r;if(!(!((r=window?.HIG_CONFIGURATION)===null||r===void 0)&&r.enableOnHoverClass))return e;var i=t?.stylesWithHoverClass.get(e);if(i)return i;var n=Nt(e,{silent:!0});if(!n.stylesheet)return e;var s=[];if(n.stylesheet.rules.forEach(function(u){"selectors"in u&&(u.selectors||[]).forEach(function(o){Ie.test(o)&&s.push(o)})}),s.length===0)return e;var a=new RegExp(s.filter(function(u,o){return s.indexOf(u)===o}).sort(function(u,o){return o.length-u.length}).map(function(u){return wt(u)}).join("|"),"g"),l=e.replace(a,function(u){var o=u.replace(bt,"$1.\\:hover");return u+", "+o});return t?.stylesWithHoverClass.set(e,l),l}function ke(){var e=new Map;return{stylesWithHoverClass:e}}function Dt(e,t){var r=t.doc,i=t.hackCss,n=t.cache;switch(e.type){case I.Document:return r.implementation.createDocument(null,"",null);case I.DocumentType:return r.implementation.createDocumentType(e.name||"html",e.publicId,e.systemId);case I.Element:var s=Et(e),a;e.isSVG?a=r.createElementNS("http://www.w3.org/2000/svg",s):a=r.createElement(s);var l=function(o){if(!e.attributes.hasOwnProperty(o))return"continue";var c=e.attributes[o];if(s==="option"&&o==="selected"&&c===!1)return"continue";if(c=typeof c=="boolean"||typeof c=="number"?"":c,o.startsWith("rr_")){if(s==="canvas"&&o==="rr_dataURL"){var d=document.createElement("img");d.src=c,d.onload=function(){var A=a.getContext("2d");A&&A.drawImage(d,0,0,d.width,d.height)}}else if(s==="img"&&o==="rr_dataURL"){var m=a;m.currentSrc.startsWith("data:")||(m.setAttribute("rrweb-original-src",e.attributes.src),m.src=c)}if(o==="rr_width")a.style.width=c;else if(o==="rr_height")a.style.height=c;else if(o==="rr_mediaCurrentTime")a.currentTime=e.attributes.rr_mediaCurrentTime;else if(o==="rr_mediaState")switch(c){case"played":a.play().catch(function(A){return console.warn("media playback error",A)});break;case"paused":a.pause();break}}else{var f=s==="textarea"&&o==="value",T=s==="style"&&o==="_cssText";if(T&&i&&(c=Oe(c,n),typeof c=="string")){for(var g=/url\(\"https:\/\/\S*(.eot|.woff2|.ttf|.woff)\S*\"\)/gm,E=void 0,h=[],v="https://replay-cors-proxy.highlightrun.workers.dev";(E=g.exec(c))!==null;)E.index===g.lastIndex&&g.lastIndex++,E.forEach(function(A,H){if(H===0){var W=A.slice(5,A.length-2);h.push({originalUrl:W,proxyUrl:W.replace(W,v+"?url="+W)})}});h.forEach(function(A){c=c.replace(A.originalUrl,A.proxyUrl)})}if(f||T){for(var w=r.createTextNode(c),R=0,L=Array.from(a.childNodes);R<L.length;R++){var k=L[R];k.nodeType===a.TEXT_NODE&&a.removeChild(k)}return a.appendChild(w),"continue"}try{if(e.isSVG&&o==="xlink:href")a.setAttributeNS("http://www.w3.org/1999/xlink",o,c);else if(o==="onload"||o==="onclick"||o.substring(0,7)==="onmouse")a.setAttribute("_"+o,c);else{if(s==="meta"&&e.attributes["http-equiv"]==="Content-Security-Policy"&&o==="content")return a.setAttribute("csp-content",c),"continue";s==="link"&&e.attributes.rel==="preload"&&e.attributes.as==="script"||s==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&e.attributes.href.endsWith(".js")||(s==="img"&&e.attributes.srcset&&e.attributes.rr_dataURL?a.setAttribute("rrweb-original-srcset",e.attributes.srcset):a.setAttribute(o,c))}}catch{}}};for(var u in e.attributes)l(u);if(e.isShadowHost)if(!a.shadowRoot)a.attachShadow({mode:"open"});else for(;a.shadowRoot.firstChild;)a.shadowRoot.removeChild(a.shadowRoot.firstChild);return a;case I.Text:return r.createTextNode(e.isStyle&&i?Oe(e.textContent,n):e.textContent);case I.CDATA:return r.createCDATASection(e.textContent);case I.Comment:return r.createComment(e.textContent);default:return null}}function re(e,t){var r=t.doc,i=t.mirror,n=t.skipChild,s=n===void 0?!1:n,a=t.hackCss,l=a===void 0?!0:a,u=t.afterAppend,o=t.cache,c=Dt(e,{doc:r,hackCss:l,cache:o});if(!c)return null;if(e.rootId&&console.assert(i.getNode(e.rootId)===r,"Target document should have the same root id."),e.type===I.Document&&(r.close(),r.open(),e.compatMode==="BackCompat"&&e.childNodes&&e.childNodes[0].type!==I.DocumentType&&(e.childNodes[0].type===I.Element&&"xmlns"in e.childNodes[0].attributes&&e.childNodes[0].attributes.xmlns==="http://www.w3.org/1999/xhtml"?r.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):r.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),c=r),i.add(c,e),(e.type===I.Document||e.type===I.Element)&&!s)for(var d=0,m=e.childNodes;d<m.length;d++){var f=m[d],T=re(f,{doc:r,mirror:i,skipChild:!1,hackCss:l,afterAppend:u,cache:o});if(!T){console.warn("Failed to rebuild",f);continue}f.isShadow&&vt(c)&&c.shadowRoot?c.shadowRoot.appendChild(T):c.appendChild(T),u&&u(T)}return c}function Mt(e,t){function r(a){t(a)}for(var i=0,n=e.getIds();i<n.length;i++){var s=n[i];e.has(s)&&r(e.getNode(s))}}function Ct(e,t){var r=t.getMeta(e);if(r?.type===I.Element){var i=e;for(var n in r.attributes)if(r.attributes.hasOwnProperty(n)&&n.startsWith("rr_")){var s=r.attributes[n];n==="rr_scrollLeft"&&(i.scrollLeft=s),n==="rr_scrollTop"&&(i.scrollTop=s)}}}function xt(e,t){var r=t.doc,i=t.onVisit,n=t.hackCss,s=n===void 0?!0:n,a=t.afterAppend,l=t.cache,u=t.mirror,o=u===void 0?new Se:u,c=re(e,{doc:r,mirror:o,skipChild:!1,hackCss:s,afterAppend:a,cache:l});return Mt(o,function(d){i&&i(d),Ct(d,o)}),c}var N;(function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"})(N||(N={}));var St=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(t){var r;if(!t)return-1;var i=(r=this.getMeta(t))===null||r===void 0?void 0:r.id;return i??-1},e.prototype.getNode=function(t){return this.idNodeMap.get(t)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(t){return this.nodeMetaMap.get(t)||null},e.prototype.removeNodeFromMap=function(t){var r=this,i=this.getId(t);this.idNodeMap.delete(i),t.childNodes&&t.childNodes.forEach(function(n){return r.removeNodeFromMap(n)})},e.prototype.has=function(t){return this.idNodeMap.has(t)},e.prototype.hasNode=function(t){return this.nodeMetaMap.has(t)},e.prototype.add=function(t,r){var i=r.id;this.idNodeMap.set(i,t),this.nodeMetaMap.set(t,r)},e.prototype.replace=function(t,r){this.idNodeMap.set(t,r)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function Rt(){return new St}function At(e){const t={},r=/;(?![^(]*\))/g,i=/:(.+)/,n=/\/\*.*?\*\//g;return e.replace(n,"").split(r).forEach(function(s){if(s){const a=s.split(i);a.length>1&&(t[he(a[0].trim())]=a[1].trim())}}),t}function _e(e){const t=[];for(const r in e){const i=e[r];if(typeof i!="string")continue;const n=_t(r);t.push(`${n}: ${i};`)}return t.join(" ")}const It=/-([a-z])/g,Ot=/^--[a-zA-Z0-9-]+$/,he=e=>Ot.test(e)?e:e.replace(It,(t,r)=>r?r.toUpperCase():""),kt=/\B([A-Z])/g,_t=e=>e.replace(kt,"-$1").toLowerCase();class F{constructor(...t){this.childNodes=[],this.parentElement=null,this.parentNode=null,this.ELEMENT_NODE=C.ELEMENT_NODE,this.TEXT_NODE=C.TEXT_NODE}get firstChild(){return this.childNodes[0]||null}get lastChild(){return this.childNodes[this.childNodes.length-1]||null}get nextSibling(){const t=this.parentNode;if(!t)return null;const r=t.childNodes,i=r.indexOf(this);return r[i+1]||null}contains(t){if(t===this)return!0;for(const r of this.childNodes)if(r.contains(t))return!0;return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function Lt(e){return class yt extends e{constructor(){super(...arguments),this.nodeType=C.DOCUMENT_NODE,this.nodeName="#document",this.compatMode="CSS1Compat",this.RRNodeType=N.Document,this.textContent=null}get documentElement(){return this.childNodes.find(r=>r.RRNodeType===N.Element&&r.tagName==="HTML")||null}get body(){var r;return((r=this.documentElement)===null||r===void 0?void 0:r.childNodes.find(i=>i.RRNodeType===N.Element&&i.tagName==="BODY"))||null}get head(){var r;return((r=this.documentElement)===null||r===void 0?void 0:r.childNodes.find(i=>i.RRNodeType===N.Element&&i.tagName==="HEAD"))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(r){const i=r.RRNodeType;if((i===N.Element||i===N.DocumentType)&&this.childNodes.some(n=>n.RRNodeType===i))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${i===N.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);return r.parentElement=null,r.parentNode=this,this.childNodes.push(r),r}insertBefore(r,i){const n=r.RRNodeType;if((n===N.Element||n===N.DocumentType)&&this.childNodes.some(a=>a.RRNodeType===n))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${n===N.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);if(i===null)return this.appendChild(r);const s=this.childNodes.indexOf(i);if(s==-1)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return this.childNodes.splice(s,0,r),r.parentElement=null,r.parentNode=this,r}removeChild(r){const i=this.childNodes.indexOf(r);if(i===-1)throw new Error("Failed to execute 'removeChild' on 'RRDocument': The RRNode to be removed is not a child of this RRNode.");return this.childNodes.splice(i,1),r.parentElement=null,r.parentNode=null,r}open(){this.childNodes=[]}close(){}write(r){let i;if(r==='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'?i="-//W3C//DTD XHTML 1.0 Transitional//EN":r==='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'&&(i="-//W3C//DTD HTML 4.0 Transitional//EN"),i){const n=this.createDocumentType("html",i,"");this.open(),this.appendChild(n)}}createDocument(r,i,n){return new yt}createDocumentType(r,i,n){const s=new(Le(F))(r,i,n);return s.ownerDocument=this,s}createElement(r){const i=new(Pe(F))(r);return i.ownerDocument=this,i}createElementNS(r,i){return this.createElement(i)}createTextNode(r){const i=new(Fe(F))(r);return i.ownerDocument=this,i}createComment(r){const i=new($e(F))(r);return i.ownerDocument=this,i}createCDATASection(r){const i=new(Ue(F))(r);return i.ownerDocument=this,i}toString(){return"RRDocument"}}}function Le(e){return class extends e{constructor(t,r,i){super(),this.nodeType=C.DOCUMENT_TYPE_NODE,this.RRNodeType=N.DocumentType,this.textContent=null,this.name=t,this.publicId=r,this.systemId=i,this.nodeName=t}toString(){return"RRDocumentType"}}}function Pe(e){return class extends e{constructor(t){super(),this.nodeType=C.ELEMENT_NODE,this.RRNodeType=N.Element,this.attributes={},this.shadowRoot=null,this.tagName=t.toUpperCase(),this.nodeName=t.toUpperCase()}get textContent(){let t="";return this.childNodes.forEach(r=>t+=r.textContent),t}set textContent(t){this.childNodes=[this.ownerDocument.createTextNode(t)]}get classList(){return new Ft(this.attributes.class,t=>{this.attributes.class=t})}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const t=this.attributes.style?At(this.attributes.style):{},r=/\B([A-Z])/g;return t.setProperty=(i,n,s)=>{if(r.test(i))return;const a=he(i);n?t[a]=n:delete t[a],s==="important"&&(t[a]+=" !important"),this.attributes.style=_e(t)},t.removeProperty=i=>{if(r.test(i))return"";const n=he(i),s=t[n]||"";return delete t[n],this.attributes.style=_e(t),s},t}getAttribute(t){return this.attributes[t]||null}setAttribute(t,r){this.attributes[t]=r}setAttributeNS(t,r,i){this.setAttribute(r,i)}removeAttribute(t){delete this.attributes[t]}appendChild(t){return this.childNodes.push(t),t.parentNode=this,t.parentElement=this,t}insertBefore(t,r){if(r===null)return this.appendChild(t);const i=this.childNodes.indexOf(r);if(i==-1)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return this.childNodes.splice(i,0,t),t.parentElement=this,t.parentNode=this,t}removeChild(t){const r=this.childNodes.indexOf(t);if(r===-1)throw new Error("Failed to execute 'removeChild' on 'RRElement': The RRNode to be removed is not a child of this RRNode.");return this.childNodes.splice(r,1),t.parentElement=null,t.parentNode=null,t}attachShadow(t){const r=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=r,r}dispatchEvent(t){return!0}toString(){let t="";for(const r in this.attributes)t+=`${r}="${this.attributes[r]}" `;return`${this.tagName} ${t}`}}}function Pt(e){return class extends e{attachShadow(t){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}}function Fe(e){return class extends e{constructor(t){super(),this.nodeType=C.TEXT_NODE,this.nodeName="#text",this.RRNodeType=N.Text,this.data=t}get textContent(){return this.data}set textContent(t){this.data=t}toString(){return`RRText text=${JSON.stringify(this.data)}`}}}function $e(e){return class extends e{constructor(t){super(),this.nodeType=C.COMMENT_NODE,this.nodeName="#comment",this.RRNodeType=N.Comment,this.data=t}get textContent(){return this.data}set textContent(t){this.data=t}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}}function Ue(e){return class extends e{constructor(t){super(),this.nodeName="#cdata-section",this.nodeType=C.CDATA_SECTION_NODE,this.RRNodeType=N.CDATA,this.data=t}get textContent(){return this.data}set textContent(t){this.data=t}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}}class Ft{constructor(t,r){if(this.classes=[],this.add=(...i)=>{for(const n of i){const s=String(n);this.classes.indexOf(s)>=0||this.classes.push(s)}this.onChange&&this.onChange(this.classes.join(" "))},this.remove=(...i)=>{this.classes=this.classes.filter(n=>i.indexOf(n)===-1),this.onChange&&this.onChange(this.classes.join(" "))},t){const i=t.trim().split(/\s+/);this.classes.push(...i)}this.onChange=r}}var C;(function(e){e[e.PLACEHOLDER=0]="PLACEHOLDER",e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",e[e.ENTITY_NODE=6]="ENTITY_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"})(C||(C={}));const me={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"};function U(e,t,r,i){const n=e.childNodes,s=t.childNodes;i=i||t.mirror||t.ownerDocument.mirror,(n.length>0||s.length>0)&&Be(Array.from(n),s,e,r,i);let a=null,l=null;switch(t.RRNodeType){case N.Document:{l=t.scrollData;break}case N.Element:{const u=e,o=t;switch($t(u,o,i),l=o.scrollData,a=o.inputData,o.tagName){case"AUDIO":case"VIDEO":{const c=e,d=o;d.paused!==void 0&&(d.paused?c.pause():c.play()),d.muted!==void 0&&(c.muted=d.muted),d.volume!==void 0&&(c.volume=d.volume),d.currentTime!==void 0&&(c.currentTime=d.currentTime);break}case"CANVAS":t.canvasMutations.forEach(c=>r.applyCanvas(c.event,c.mutation,e));break;case"STYLE":Ut(u,t.rules);break}if(o.shadowRoot){u.shadowRoot||u.attachShadow({mode:"open"});const c=u.shadowRoot.childNodes,d=o.shadowRoot.childNodes;(c.length>0||d.length>0)&&Be(Array.from(c),d,u.shadowRoot,r,i)}break}case N.Text:case N.Comment:case N.CDATA:e.textContent!==t.data&&(e.textContent=t.data);break}if(l&&r.applyScroll(l,!0),a&&r.applyInput(a),t.nodeName==="IFRAME"){const u=e.contentDocument,o=t;if(u){const c=i.getMeta(o.contentDocument);c&&r.mirror.add(u,Object.assign({},c)),U(u,o.contentDocument,r,i)}}}function $t(e,t,r){const i=e.attributes,n=t.attributes;for(const s in n){const a=n[s],l=r.getMeta(t);if(l&&"isSVG"in l&&l.isSVG&&me[s])e.setAttributeNS(me[s],s,a);else if(t.tagName==="CANVAS"&&s==="rr_dataURL"){const u=document.createElement("img");u.src=a,u.onload=()=>{const o=e.getContext("2d");o&&o.drawImage(u,0,0,u.width,u.height)}}else e.setAttribute(s,a)}for(const{name:s}of Array.from(i))s in n||e.removeAttribute(s);t.scrollLeft&&(e.scrollLeft=t.scrollLeft),t.scrollTop&&(e.scrollTop=t.scrollTop)}function Be(e,t,r,i,n){var s,a;let l=0,u=e.length-1,o=0,c=t.length-1,d=e[l],m=e[u],f=t[o],T=t[c],g,E;for(;l<=u&&o<=c;)if(d===void 0)d=e[++l];else if(m===void 0)m=e[--u];else if(i.mirror.getId(d)===n.getId(f))U(d,f,i,n),d=e[++l],f=t[++o];else if(i.mirror.getId(m)===n.getId(T))U(m,T,i,n),m=e[--u],T=t[--c];else if(i.mirror.getId(d)===n.getId(T))r.insertBefore(d,m.nextSibling),U(d,T,i,n),d=e[++l],T=t[--c];else if(i.mirror.getId(m)===n.getId(f))r.insertBefore(m,d),U(m,f,i,n),m=e[--u],f=t[++o];else{if(!g){g={};for(let h=l;h<=u;h++){const v=e[h];v&&i.mirror.hasNode(v)&&(g[i.mirror.getId(v)]=h)}}if(E=g[n.getId(f)],E){const h=e[E];r.insertBefore(h,d),U(h,f,i,n),e[E]=void 0}else{const h=pe(f,i.mirror,n);((s=i.mirror.getMeta(r))===null||s===void 0?void 0:s.type)===N.Document&&((a=i.mirror.getMeta(h))===null||a===void 0?void 0:a.type)===N.Element&&r.documentElement&&(r.removeChild(r.documentElement),e[l]=void 0,d=void 0),r.insertBefore(h,d||null),U(h,f,i,n)}f=t[++o]}if(l>u){const h=t[c+1];let v=null;for(h&&r.childNodes.forEach(w=>{i.mirror.getId(w)===n.getId(h)&&(v=w)});o<=c;++o){const w=pe(t[o],i.mirror,n);r.insertBefore(w,v),U(w,t[o],i,n)}}else if(o>c)for(;l<=u;l++){const h=e[l];h&&(r.removeChild(h),i.mirror.removeNodeFromMap(h))}}function pe(e,t,r){let i=t.getNode(r.getId(e));const n=r.getMeta(e);if(i!==null)return i;switch(e.RRNodeType){case N.Document:i=new Document;break;case N.DocumentType:i=document.implementation.createDocumentType(e.name,e.publicId,e.systemId);break;case N.Element:{e.tagName.toLowerCase(),n&&"isSVG"in n&&n?.isSVG?i=document.createElementNS(me.svg,e.tagName.toLowerCase()):i=document.createElement(e.tagName);break}case N.Text:i=document.createTextNode(e.data);break;case N.Comment:i=document.createComment(e.data);break;case N.CDATA:i=document.createCDATASection(e.data);break}return n&&t.add(i,Object.assign({},n)),i}function q(e,t){const r=e[t[0]];return t.length===1?r:q(r.cssRules[t[1]].cssRules,t.slice(2))}var $;(function(e){e[e.Insert=0]="Insert",e[e.Remove=1]="Remove",e[e.Snapshot=2]="Snapshot",e[e.SetProperty=3]="SetProperty",e[e.RemoveProperty=4]="RemoveProperty"})($||($={}));function Ve(e){const t=[...e],r=t.pop();return{positions:t,index:r}}function Ut(e,t){const r=e.sheet;t.forEach(i=>{if(i.type===$.Insert)try{if(Array.isArray(i.index)){const{positions:n,index:s}=Ve(i.index);q(r.cssRules,n).insertRule(i.cssText,s)}else r.insertRule(i.cssText,i.index)}catch{}else if(i.type===$.Remove)try{if(Array.isArray(i.index)){const{positions:n,index:s}=Ve(i.index);q(r.cssRules,n).deleteRule(s||0)}else r.deleteRule(i.index)}catch{}else i.type===$.SetProperty?q(r.cssRules,i.index).style.setProperty(i.property,i.value,i.priority):i.type===$.RemoveProperty&&q(r.cssRules,i.index).style.removeProperty(i.property)})}class G extends Lt(F){constructor(t){super(),this._unserializedId=-1,this.mirror=qt(),this.scrollData=null,t&&(this.mirror=t)}get unserializedId(){return this._unserializedId--}createDocument(t,r,i){return new G}createDocumentType(t,r,i){const n=new Bt(t,r,i);return n.ownerDocument=this,n}createElement(t){const r=t.toUpperCase();let i;switch(r){case"AUDIO":case"VIDEO":i=new Vt(r);break;case"IFRAME":i=new Ht(r,this.mirror);break;case"CANVAS":i=new Wt(r);break;case"STYLE":i=new jt(r);break;default:i=new J(r);break}return i.ownerDocument=this,i}createComment(t){const r=new Yt(t);return r.ownerDocument=this,r}createCDATASection(t){const r=new zt(t);return r.ownerDocument=this,r}createTextNode(t){const r=new Gt(t);return r.ownerDocument=this,r}destroyTree(){this.childNodes=[],this.mirror.reset()}open(){super.open(),this._unserializedId=-1}}const Bt=Le(F);class J extends Pe(F){constructor(){super(...arguments),this.inputData=null,this.scrollData=null}}class Vt extends Pt(J){}class Wt extends J{constructor(){super(...arguments),this.canvasMutations=[]}getContext(){return null}}class jt extends J{constructor(){super(...arguments),this.rules=[]}}class Ht extends J{constructor(t,r){super(t),this.contentDocument=new G,this.contentDocument.mirror=r}}const Gt=Fe(F),Yt=$e(F),zt=Ue(F);function Xt(e){return e instanceof HTMLFormElement?"FORM":e.tagName.toUpperCase()}function We(e,t,r,i){let n;switch(e.nodeType){case C.DOCUMENT_NODE:i&&i.nodeName==="IFRAME"?n=i.contentDocument:(n=t,n.compatMode=e.compatMode);break;case C.DOCUMENT_TYPE_NODE:const a=e;n=t.createDocumentType(a.name,a.publicId,a.systemId);break;case C.ELEMENT_NODE:const l=e,u=Xt(l);n=t.createElement(u);const o=n;for(const{name:c,value:d}of Array.from(l.attributes))o.attributes[c]=d;l.scrollLeft&&(o.scrollLeft=l.scrollLeft),l.scrollTop&&(o.scrollTop=l.scrollTop);break;case C.TEXT_NODE:n=t.createTextNode(e.textContent||"");break;case C.CDATA_SECTION_NODE:n=t.createCDATASection(e.data);break;case C.COMMENT_NODE:n=t.createComment(e.textContent||"");break;case C.DOCUMENT_FRAGMENT_NODE:n=i.attachShadow({mode:"open"});break;default:return null}let s=r.getMeta(e);return t instanceof G&&(s||(s=je(n,t.unserializedId),r.add(e,s)),t.mirror.add(n,Object.assign({},s))),n}function Qt(e,t=Rt(),r=new G){function i(n,s){const a=We(n,r,t,s);a!==null&&(s?.nodeName!=="IFRAME"&&n.nodeType!==C.DOCUMENT_FRAGMENT_NODE&&(s?.appendChild(a),a.parentNode=s,a.parentElement=s),n.nodeName==="IFRAME"?i(n.contentDocument,a):(n.nodeType===C.DOCUMENT_NODE||n.nodeType===C.ELEMENT_NODE||n.nodeType===C.DOCUMENT_FRAGMENT_NODE)&&(n.nodeType===C.ELEMENT_NODE&&n.shadowRoot&&i(n.shadowRoot,a),n.childNodes.forEach(l=>i(l,a))))}return i(e,null),r}function qt(){return new Jt}class Jt{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(t){var r;if(!t)return-1;const i=(r=this.getMeta(t))===null||r===void 0?void 0:r.id;return i??-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(i=>this.removeNodeFromMap(i))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){const i=r.id;this.idNodeMap.set(i,t),this.nodeMetaMap.set(t,r)}replace(t,r){this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function je(e,t){switch(e.RRNodeType){case N.Document:return{id:t,type:e.RRNodeType,childNodes:[]};case N.DocumentType:const r=e;return{id:t,type:e.RRNodeType,name:r.name,publicId:r.publicId,systemId:r.systemId};case N.Element:return{id:t,type:e.RRNodeType,tagName:e.tagName.toLowerCase(),attributes:{},childNodes:[]};case N.Text:return{id:t,type:e.RRNodeType,textContent:e.textContent||""};case N.Comment:return{id:t,type:e.RRNodeType,textContent:e.textContent||""};case N.CDATA:return{id:t,type:e.RRNodeType,textContent:""}}}function He(e){return e=e||Object.create(null),{on:function(r,i){(e[r]||(e[r]=[])).push(i)},off:function(r,i){e[r]&&e[r].splice(e[r].indexOf(i)>>>0,1)},emit:function(r,i){(e[r]||[]).slice().map(function(n){n(i)}),(e["*"]||[]).slice().map(function(n){n(r,i)})}}}var Zt=Object.freeze({__proto__:null,default:He});function Kt(e=window,t=document){if("scrollBehavior"in t.documentElement.style&&e.__forceSmoothScrollPolyfill__!==!0)return;const r=e.HTMLElement||e.Element,i=468,n={scroll:e.scroll||e.scrollTo,scrollBy:e.scrollBy,elementScroll:r.prototype.scroll||u,scrollIntoView:r.prototype.scrollIntoView},s=e.performance&&e.performance.now?e.performance.now.bind(e.performance):Date.now;function a(h){const v=["MSIE ","Trident/","Edge/"];return new RegExp(v.join("|")).test(h)}const l=a(e.navigator.userAgent)?1:0;function u(h,v){this.scrollLeft=h,this.scrollTop=v}function o(h){return .5*(1-Math.cos(Math.PI*h))}function c(h){if(h===null||typeof h!="object"||h.behavior===void 0||h.behavior==="auto"||h.behavior==="instant")return!0;if(typeof h=="object"&&h.behavior==="smooth")return!1;throw new TypeError("behavior member of ScrollOptions "+h.behavior+" is not a valid value for enumeration ScrollBehavior.")}function d(h,v){if(v==="Y")return h.clientHeight+l<h.scrollHeight;if(v==="X")return h.clientWidth+l<h.scrollWidth}function m(h,v){const w=e.getComputedStyle(h,null)["overflow"+v];return w==="auto"||w==="scroll"}function f(h){const v=d(h,"Y")&&m(h,"Y"),w=d(h,"X")&&m(h,"X");return v||w}function T(h){for(;h!==t.body&&f(h)===!1;)h=h.parentNode||h.host;return h}function g(h){const v=s();let w,R,L,k=(v-h.startTime)/i;k=k>1?1:k,w=o(k),R=h.startX+(h.x-h.startX)*w,L=h.startY+(h.y-h.startY)*w,h.method.call(h.scrollable,R,L),(R!==h.x||L!==h.y)&&e.requestAnimationFrame(g.bind(e,h))}function E(h,v,w){let R,L,k,A;const H=s();h===t.body?(R=e,L=e.scrollX||e.pageXOffset,k=e.scrollY||e.pageYOffset,A=n.scroll):(R=h,L=h.scrollLeft,k=h.scrollTop,A=u),g({scrollable:R,method:A,startTime:H,startX:L,startY:k,x:v,y:w})}e.scroll=e.scrollTo=function(){if(arguments[0]!==void 0){if(c(arguments[0])===!0){n.scroll.call(e,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:e.scrollX||e.pageXOffset,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:e.scrollY||e.pageYOffset);return}E.call(e,t.body,arguments[0].left!==void 0?~~arguments[0].left:e.scrollX||e.pageXOffset,arguments[0].top!==void 0?~~arguments[0].top:e.scrollY||e.pageYOffset)}},e.scrollBy=function(){if(arguments[0]!==void 0){if(c(arguments[0])){n.scrollBy.call(e,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:0,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:0);return}E.call(e,t.body,~~arguments[0].left+(e.scrollX||e.pageXOffset),~~arguments[0].top+(e.scrollY||e.pageYOffset))}},r.prototype.scroll=r.prototype.scrollTo=function(){if(arguments[0]===void 0)return;if(c(arguments[0])===!0){if(typeof arguments[0]=="number"&&arguments[1]===void 0)throw new SyntaxError("Value could not be converted");n.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left:typeof arguments[0]!="object"?~~arguments[0]:this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top:arguments[1]!==void 0?~~arguments[1]:this.scrollTop);return}const h=arguments[0].left,v=arguments[0].top;E.call(this,this,typeof h>"u"?this.scrollLeft:~~h,typeof v>"u"?this.scrollTop:~~v)},r.prototype.scrollBy=function(){if(arguments[0]!==void 0){if(c(arguments[0])===!0){n.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop);return}this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior})}},r.prototype.scrollIntoView=function(){if(c(arguments[0])===!0){n.scrollIntoView.call(this,arguments[0]===void 0?!0:arguments[0]);return}const h=T(this),v=h.getBoundingClientRect(),w=this.getBoundingClientRect();h!==t.body?(E.call(this,h,h.scrollLeft+w.left-v.left,h.scrollTop+w.top-v.top),e.getComputedStyle(h).position!=="fixed"&&e.scrollBy({left:v.left,top:v.top,behavior:"smooth"})):e.scrollBy({left:w.left,top:w.top,behavior:"smooth"})}}var M=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(M||{}),x=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e))(x||{}),_=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(_||{}),ie=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(ie||{}),fe=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e))(fe||{}),D=(e=>(e.Start="start",e.Pause="pause",e.Resume="resume",e.Resize="resize",e.Finish="finish",e.FullsnapshotRebuilded="fullsnapshot-rebuilded",e.LoadStylesheetStart="load-stylesheet-start",e.LoadStylesheetEnd="load-stylesheet-end",e.SkipStart="skip-start",e.SkipEnd="skip-end",e.MouseInteraction="mouse-interaction",e.EventCast="event-cast",e.CustomEvent="custom-event",e.Flush="flush",e.StateChange="state-change",e.PlayBack="play-back",e))(D||{});class er{constructor(t=[],r){this.timeOffset=0,this.raf=null,this.actions=t,this.speed=r}addAction(t){const r=this.findActionIndex(t);this.actions.splice(r,0,t)}addActions(t){this.actions=this.actions.concat(t)}replaceActions(t){this.actions.length=0,this.actions.splice(0,0,...t)}start(){this.timeOffset=0;let t=performance.now();const{actions:r}=this,i=this;function n(){const s=performance.now();for(i.timeOffset+=(s-t)*i.speed,t=s;r.length;){const a=r[0];if(i.timeOffset>=a.delay)r.shift(),a.doAction();else break}(r.length>0||i.liveMode)&&(i.raf=requestAnimationFrame(n))}this.raf=requestAnimationFrame(n)}clear(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(t){this.speed=t}toggleLiveMode(t){this.liveMode=t}isActive(){return this.raf!==null}findActionIndex(t){let r=0,i=this.actions.length-1;for(;r<=i;){const n=Math.floor((r+i)/2);if(this.actions[n].delay<t.delay)r=n+1;else if(this.actions[n].delay>t.delay)i=n-1;else return n+1}return r}}function ge(e,t){if(e.type===M.IncrementalSnapshot&&e.data.source===x.MouseMove){const r=e.data.positions[0].timeOffset,i=e.timestamp+r;return e.delay=i-t,i-t}return e.delay=e.timestamp-t,e.delay}/*! *****************************************************************************
1
+ var rrwebReplay=function(Q,y){"use strict";function Ke(t){const e={},i=/;(?![^(]*\))/g,s=/:(.+)/,o=/\/\*.*?\*\//g;return t.replace(o,"").split(i).forEach(function(r){if(r){const a=r.split(s);a.length>1&&(e[q(a[0].trim())]=a[1].trim())}}),e}function ue(t){const e=[];for(const i in t){const s=t[i];if(typeof s!="string")continue;const o=st(i);e.push(`${o}: ${s};`)}return e.join(" ")}const et=/-([a-z])/g,tt=/^--[a-zA-Z0-9-]+$/,q=t=>tt.test(t)?t:t.replace(et,(e,i)=>i?i.toUpperCase():""),it=/\B([A-Z])/g,st=t=>t.replace(it,"-$1").toLowerCase();class S{constructor(...e){this.childNodes=[],this.parentElement=null,this.parentNode=null,this.ELEMENT_NODE=b.ELEMENT_NODE,this.TEXT_NODE=b.TEXT_NODE}get firstChild(){return this.childNodes[0]||null}get lastChild(){return this.childNodes[this.childNodes.length-1]||null}get nextSibling(){const e=this.parentNode;if(!e)return null;const i=e.childNodes,s=i.indexOf(this);return i[s+1]||null}contains(e){if(e===this)return!0;for(const i of this.childNodes)if(i.contains(e))return!0;return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,i){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function ot(t){return class Ze extends t{constructor(){super(...arguments),this.nodeType=b.DOCUMENT_NODE,this.nodeName="#document",this.compatMode="CSS1Compat",this.RRNodeType=y.NodeType.Document,this.textContent=null}get documentElement(){return this.childNodes.find(i=>i.RRNodeType===y.NodeType.Element&&i.tagName==="HTML")||null}get body(){var i;return((i=this.documentElement)===null||i===void 0?void 0:i.childNodes.find(s=>s.RRNodeType===y.NodeType.Element&&s.tagName==="BODY"))||null}get head(){var i;return((i=this.documentElement)===null||i===void 0?void 0:i.childNodes.find(s=>s.RRNodeType===y.NodeType.Element&&s.tagName==="HEAD"))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(i){const s=i.RRNodeType;if((s===y.NodeType.Element||s===y.NodeType.DocumentType)&&this.childNodes.some(o=>o.RRNodeType===s))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${s===y.NodeType.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);return i.parentElement=null,i.parentNode=this,this.childNodes.push(i),i}insertBefore(i,s){const o=i.RRNodeType;if((o===y.NodeType.Element||o===y.NodeType.DocumentType)&&this.childNodes.some(a=>a.RRNodeType===o))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${o===y.NodeType.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);if(s===null)return this.appendChild(i);const r=this.childNodes.indexOf(s);if(r==-1)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return this.childNodes.splice(r,0,i),i.parentElement=null,i.parentNode=this,i}removeChild(i){const s=this.childNodes.indexOf(i);if(s===-1)throw new Error("Failed to execute 'removeChild' on 'RRDocument': The RRNode to be removed is not a child of this RRNode.");return this.childNodes.splice(s,1),i.parentElement=null,i.parentNode=null,i}open(){this.childNodes=[]}close(){}write(i){let s;if(i==='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'?s="-//W3C//DTD XHTML 1.0 Transitional//EN":i==='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'&&(s="-//W3C//DTD HTML 4.0 Transitional//EN"),s){const o=this.createDocumentType("html",s,"");this.open(),this.appendChild(o)}}createDocument(i,s,o){return new Ze}createDocumentType(i,s,o){const r=new(he(S))(i,s,o);return r.ownerDocument=this,r}createElement(i){const s=new(me(S))(i);return s.ownerDocument=this,s}createElementNS(i,s){return this.createElement(s)}createTextNode(i){const s=new(pe(S))(i);return s.ownerDocument=this,s}createComment(i){const s=new(fe(S))(i);return s.ownerDocument=this,s}createCDATASection(i){const s=new(ye(S))(i);return s.ownerDocument=this,s}toString(){return"RRDocument"}}}function he(t){return class extends t{constructor(e,i,s){super(),this.nodeType=b.DOCUMENT_TYPE_NODE,this.RRNodeType=y.NodeType.DocumentType,this.textContent=null,this.name=e,this.publicId=i,this.systemId=s,this.nodeName=e}toString(){return"RRDocumentType"}}}function me(t){return class extends t{constructor(e){super(),this.nodeType=b.ELEMENT_NODE,this.RRNodeType=y.NodeType.Element,this.attributes={},this.shadowRoot=null,this.tagName=e.toUpperCase(),this.nodeName=e.toUpperCase()}get textContent(){let e="";return this.childNodes.forEach(i=>e+=i.textContent),e}set textContent(e){this.childNodes=[this.ownerDocument.createTextNode(e)]}get classList(){return new rt(this.attributes.class,e=>{this.attributes.class=e})}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const e=this.attributes.style?Ke(this.attributes.style):{},i=/\B([A-Z])/g;return e.setProperty=(s,o,r)=>{if(i.test(s))return;const a=q(s);o?e[a]=o:delete e[a],r==="important"&&(e[a]+=" !important"),this.attributes.style=ue(e)},e.removeProperty=s=>{if(i.test(s))return"";const o=q(s),r=e[o]||"";return delete e[o],this.attributes.style=ue(e),r},e}getAttribute(e){return this.attributes[e]||null}setAttribute(e,i){this.attributes[e]=i}setAttributeNS(e,i,s){this.setAttribute(i,s)}removeAttribute(e){delete this.attributes[e]}appendChild(e){return this.childNodes.push(e),e.parentNode=this,e.parentElement=this,e}insertBefore(e,i){if(i===null)return this.appendChild(e);const s=this.childNodes.indexOf(i);if(s==-1)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return this.childNodes.splice(s,0,e),e.parentElement=this,e.parentNode=this,e}removeChild(e){const i=this.childNodes.indexOf(e);if(i===-1)throw new Error("Failed to execute 'removeChild' on 'RRElement': The RRNode to be removed is not a child of this RRNode.");return this.childNodes.splice(i,1),e.parentElement=null,e.parentNode=null,e}attachShadow(e){const i=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=i,i}dispatchEvent(e){return!0}toString(){let e="";for(const i in this.attributes)e+=`${i}="${this.attributes[i]}" `;return`${this.tagName} ${e}`}}}function nt(t){return class extends t{attachShadow(e){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}}function pe(t){return class extends t{constructor(e){super(),this.nodeType=b.TEXT_NODE,this.nodeName="#text",this.RRNodeType=y.NodeType.Text,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRText text=${JSON.stringify(this.data)}`}}}function fe(t){return class extends t{constructor(e){super(),this.nodeType=b.COMMENT_NODE,this.nodeName="#comment",this.RRNodeType=y.NodeType.Comment,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}}function ye(t){return class extends t{constructor(e){super(),this.nodeName="#cdata-section",this.nodeType=b.CDATA_SECTION_NODE,this.RRNodeType=y.NodeType.CDATA,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}}class rt{constructor(e,i){if(this.classes=[],this.add=(...s)=>{for(const o of s){const r=String(o);this.classes.indexOf(r)>=0||this.classes.push(r)}this.onChange&&this.onChange(this.classes.join(" "))},this.remove=(...s)=>{this.classes=this.classes.filter(o=>s.indexOf(o)===-1),this.onChange&&this.onChange(this.classes.join(" "))},e){const s=e.trim().split(/\s+/);this.classes.push(...s)}this.onChange=i}}var b;(function(t){t[t.PLACEHOLDER=0]="PLACEHOLDER",t[t.ELEMENT_NODE=1]="ELEMENT_NODE",t[t.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",t[t.TEXT_NODE=3]="TEXT_NODE",t[t.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",t[t.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",t[t.ENTITY_NODE=6]="ENTITY_NODE",t[t.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",t[t.COMMENT_NODE=8]="COMMENT_NODE",t[t.DOCUMENT_NODE=9]="DOCUMENT_NODE",t[t.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",t[t.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"})(b||(b={}));const J={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"};function A(t,e,i,s){const o=t.childNodes,r=e.childNodes;s=s||e.mirror||e.ownerDocument.mirror,(o.length>0||r.length>0)&&ge(Array.from(o),r,t,i,s);let a=null,c=null;switch(e.RRNodeType){case y.NodeType.Document:{c=e.scrollData;break}case y.NodeType.Element:{const d=t,n=e;switch(at(d,n,s),c=n.scrollData,a=n.inputData,n.tagName){case"AUDIO":case"VIDEO":{const l=t,u=n;u.paused!==void 0&&(u.paused?l.pause():l.play()),u.muted!==void 0&&(l.muted=u.muted),u.volume!==void 0&&(l.volume=u.volume),u.currentTime!==void 0&&(l.currentTime=u.currentTime);break}case"CANVAS":e.canvasMutations.forEach(l=>i.applyCanvas(l.event,l.mutation,t));break;case"STYLE":ct(d,e.rules);break}if(n.shadowRoot){d.shadowRoot||d.attachShadow({mode:"open"});const l=d.shadowRoot.childNodes,u=n.shadowRoot.childNodes;(l.length>0||u.length>0)&&ge(Array.from(l),u,d.shadowRoot,i,s)}break}case y.NodeType.Text:case y.NodeType.Comment:case y.NodeType.CDATA:t.textContent!==e.data&&(t.textContent=e.data);break}if(c&&i.applyScroll(c,!0),a&&i.applyInput(a),e.nodeName==="IFRAME"){const d=t.contentDocument,n=e;if(d){const l=s.getMeta(n.contentDocument);l&&i.mirror.add(d,Object.assign({},l)),A(d,n.contentDocument,i,s)}}}function at(t,e,i){const s=t.attributes,o=e.attributes;for(const r in o){const a=o[r],c=i.getMeta(e);if(c&&"isSVG"in c&&c.isSVG&&J[r])t.setAttributeNS(J[r],r,a);else if(e.tagName==="CANVAS"&&r==="rr_dataURL"){const d=document.createElement("img");d.src=a,d.onload=()=>{const n=t.getContext("2d");n&&n.drawImage(d,0,0,d.width,d.height)}}else t.setAttribute(r,a)}for(const{name:r}of Array.from(s))r in o||t.removeAttribute(r);e.scrollLeft&&(t.scrollLeft=e.scrollLeft),e.scrollTop&&(t.scrollTop=e.scrollTop)}function ge(t,e,i,s,o){var r;let a=0,c=t.length-1,d=0,n=e.length-1,l=t[a],u=t[c],m=e[d],p=e[n],T,g;for(;a<=c&&d<=n;)if(l===void 0)l=t[++a];else if(u===void 0)u=t[--c];else if(s.mirror.getId(l)===o.getId(m))A(l,m,s,o),l=t[++a],m=e[++d];else if(s.mirror.getId(u)===o.getId(p))A(u,p,s,o),u=t[--c],p=e[--n];else if(s.mirror.getId(l)===o.getId(p))try{i.insertBefore(l,u.nextSibling),A(l,p,s,o),l=t[++a],p=e[--n]}catch(f){console.error(f,i,l,u)}else if(s.mirror.getId(u)===o.getId(m))try{i.insertBefore(u,l),A(u,m,s,o),u=t[--c],m=e[++d]}catch(f){console.error(f,i,u,l)}else{if(!T){T={};for(let f=a;f<=c;f++){const h=t[f];h&&s.mirror.hasNode(h)&&(T[s.mirror.getId(h)]=f)}}if(g=T[o.getId(m)],g){const f=t[g];try{i.insertBefore(f,l),A(f,m,s,o),t[g]=void 0}catch(h){console.error(h,i,f,l)}}else{const f=Z(m,s.mirror,o);i.nodeName==="#document"&&((r=s.mirror.getMeta(f))===null||r===void 0?void 0:r.type)===y.NodeType.Element&&i.documentElement&&(i.removeChild(i.documentElement),t[a]=void 0,l=void 0);try{i.insertBefore(f,l||null),A(f,m,s,o)}catch(h){console.error(h,i,f,l||null)}}m=e[++d]}if(a>c){const f=e[n+1];let h=null;for(f&&i.childNodes.forEach(v=>{s.mirror.getId(v)===o.getId(f)&&(h=v)});d<=n;++d){const v=Z(e[d],s.mirror,o);try{i.insertBefore(v,h),A(v,e[d],s,o)}catch(E){console.error(E,i,v,h)}}}else if(d>n)for(;a<=c;a++){const f=t[a];f&&(i.removeChild(f),s.mirror.removeNodeFromMap(f))}}function Z(t,e,i){let s=e.getNode(i.getId(t));const o=i.getMeta(t);if(s!==null)return s;switch(t.RRNodeType){case y.NodeType.Document:s=new Document;break;case y.NodeType.DocumentType:s=document.implementation.createDocumentType(t.name,t.publicId,t.systemId);break;case y.NodeType.Element:{t.tagName.toLowerCase(),o&&"isSVG"in o&&o?.isSVG?s=document.createElementNS(J.svg,t.tagName.toLowerCase()):s=document.createElement(t.tagName);break}case y.NodeType.Text:s=document.createTextNode(t.data);break;case y.NodeType.Comment:s=document.createComment(t.data);break;case y.NodeType.CDATA:s=document.createCDATASection(t.data);break}return o&&e.add(s,Object.assign({},o)),s}function U(t,e){const i=t[e[0]];return e.length===1?i:U(i.cssRules[e[1]].cssRules,e.slice(2))}var M;(function(t){t[t.Insert=0]="Insert",t[t.Remove=1]="Remove",t[t.Snapshot=2]="Snapshot",t[t.SetProperty=3]="SetProperty",t[t.RemoveProperty=4]="RemoveProperty"})(M||(M={}));function ve(t){const e=[...t],i=e.pop();return{positions:e,index:i}}function ct(t,e){const i=t.sheet;e.forEach(s=>{if(s.type===M.Insert)try{if(Array.isArray(s.index)){const{positions:o,index:r}=ve(s.index);U(i.cssRules,o).insertRule(s.cssText,r)}else i.insertRule(s.cssText,s.index)}catch{}else if(s.type===M.Remove)try{if(Array.isArray(s.index)){const{positions:o,index:r}=ve(s.index);U(i.cssRules,o).deleteRule(r||0)}else i.deleteRule(s.index)}catch{}else s.type===M.SetProperty?U(i.cssRules,s.index).style.setProperty(s.property,s.value,s.priority):s.type===M.RemoveProperty&&U(i.cssRules,s.index).style.removeProperty(s.property)})}class k extends ot(S){constructor(e){super(),this._unserializedId=-1,this.mirror=Tt(),this.scrollData=null,e&&(this.mirror=e)}get unserializedId(){return this._unserializedId--}createDocument(e,i,s){return new k}createDocumentType(e,i,s){const o=new lt(e,i,s);return o.ownerDocument=this,o}createElement(e){const i=e.toUpperCase();let s;switch(i){case"AUDIO":case"VIDEO":s=new dt(i);break;case"IFRAME":s=new mt(i,this.mirror);break;case"CANVAS":s=new ut(i);break;case"STYLE":s=new ht(i);break;default:s=new $(i);break}return s.ownerDocument=this,s}createComment(e){const i=new ft(e);return i.ownerDocument=this,i}createCDATASection(e){const i=new yt(e);return i.ownerDocument=this,i}createTextNode(e){const i=new pt(e);return i.ownerDocument=this,i}destroyTree(){this.childNodes=[],this.mirror.reset()}open(){super.open(),this._unserializedId=-1}}const lt=he(S);class $ extends me(S){constructor(){super(...arguments),this.inputData=null,this.scrollData=null}}class dt extends nt($){}class ut extends ${constructor(){super(...arguments),this.canvasMutations=[]}getContext(){return null}}class ht extends ${constructor(){super(...arguments),this.rules=[]}}class mt extends ${constructor(e,i){super(e),this.contentDocument=new k,this.contentDocument.mirror=i}}const pt=pe(S),ft=fe(S),yt=ye(S);function gt(t){return t instanceof HTMLFormElement?"FORM":t.tagName.toUpperCase()}function Te(t,e,i,s){let o;switch(t.nodeType){case b.DOCUMENT_NODE:s&&s.nodeName==="IFRAME"?o=s.contentDocument:(o=e,o.compatMode=t.compatMode);break;case b.DOCUMENT_TYPE_NODE:const a=t;o=e.createDocumentType(a.name,a.publicId,a.systemId);break;case b.ELEMENT_NODE:const c=t,d=gt(c);o=e.createElement(d);const n=o;for(const{name:l,value:u}of Array.from(c.attributes))n.attributes[l]=u;c.scrollLeft&&(n.scrollLeft=c.scrollLeft),c.scrollTop&&(n.scrollTop=c.scrollTop);break;case b.TEXT_NODE:o=e.createTextNode(t.textContent||"");break;case b.CDATA_SECTION_NODE:o=e.createCDATASection(t.data);break;case b.COMMENT_NODE:o=e.createComment(t.textContent||"");break;case b.DOCUMENT_FRAGMENT_NODE:o=s.attachShadow({mode:"open"});break;default:return null}let r=i.getMeta(t);return e instanceof k&&(r||(r=Ne(o,e.unserializedId),i.add(t,r)),e.mirror.add(o,Object.assign({},r))),o}function vt(t,e=y.createMirror(),i=new k){function s(o,r){const a=Te(o,i,e,r);a!==null&&(r?.nodeName!=="IFRAME"&&o.nodeType!==b.DOCUMENT_FRAGMENT_NODE&&(r?.appendChild(a),a.parentNode=r,a.parentElement=r),o.nodeName==="IFRAME"?s(o.contentDocument,a):(o.nodeType===b.DOCUMENT_NODE||o.nodeType===b.ELEMENT_NODE||o.nodeType===b.DOCUMENT_FRAGMENT_NODE)&&(o.nodeType===b.ELEMENT_NODE&&o.shadowRoot&&s(o.shadowRoot,a),o.childNodes.forEach(c=>s(c,a))))}return s(t,null),i}function Tt(){return new Nt}class Nt{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var i;if(!e)return-1;const s=(i=this.getMeta(e))===null||i===void 0?void 0:i.id;return s??-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 i=this.getId(e);this.idNodeMap.delete(i),e.childNodes&&e.childNodes.forEach(s=>this.removeNodeFromMap(s))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,i){const s=i.id;this.idNodeMap.set(s,e),this.nodeMetaMap.set(e,i)}replace(e,i){this.idNodeMap.set(e,i)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Ne(t,e){switch(t.RRNodeType){case y.NodeType.Document:return{id:e,type:t.RRNodeType,childNodes:[]};case y.NodeType.DocumentType:const i=t;return{id:e,type:t.RRNodeType,name:i.name,publicId:i.publicId,systemId:i.systemId};case y.NodeType.Element:return{id:e,type:t.RRNodeType,tagName:t.tagName.toLowerCase(),attributes:{},childNodes:[]};case y.NodeType.Text:return{id:e,type:t.RRNodeType,textContent:t.textContent||""};case y.NodeType.Comment:return{id:e,type:t.RRNodeType,textContent:t.textContent||""};case y.NodeType.CDATA:return{id:e,type:t.RRNodeType,textContent:""}}}function Ee(t){return t=t||Object.create(null),{on:function(i,s){(t[i]||(t[i]=[])).push(s)},off:function(i,s){t[i]&&t[i].splice(t[i].indexOf(s)>>>0,1)},emit:function(i,s){(t[i]||[]).slice().map(function(o){o(s)}),(t["*"]||[]).slice().map(function(o){o(i,s)})}}}var Et=Object.freeze({__proto__:null,default:Ee});function Dt(t=window,e=document){if("scrollBehavior"in e.documentElement.style&&t.__forceSmoothScrollPolyfill__!==!0)return;const i=t.HTMLElement||t.Element,s=468,o={scroll:t.scroll||t.scrollTo,scrollBy:t.scrollBy,elementScroll:i.prototype.scroll||d,scrollIntoView:i.prototype.scrollIntoView},r=t.performance&&t.performance.now?t.performance.now.bind(t.performance):Date.now;function a(h){const v=["MSIE ","Trident/","Edge/"];return new RegExp(v.join("|")).test(h)}const c=a(t.navigator.userAgent)?1:0;function d(h,v){this.scrollLeft=h,this.scrollTop=v}function n(h){return .5*(1-Math.cos(Math.PI*h))}function l(h){if(h===null||typeof h!="object"||h.behavior===void 0||h.behavior==="auto"||h.behavior==="instant")return!0;if(typeof h=="object"&&h.behavior==="smooth")return!1;throw new TypeError("behavior member of ScrollOptions "+h.behavior+" is not a valid value for enumeration ScrollBehavior.")}function u(h,v){if(v==="Y")return h.clientHeight+c<h.scrollHeight;if(v==="X")return h.clientWidth+c<h.scrollWidth}function m(h,v){const E=t.getComputedStyle(h,null)["overflow"+v];return E==="auto"||E==="scroll"}function p(h){const v=u(h,"Y")&&m(h,"Y"),E=u(h,"X")&&m(h,"X");return v||E}function T(h){for(;h!==e.body&&p(h)===!1;)h=h.parentNode||h.host;return h}function g(h){const v=r();let E,C,O,I=(v-h.startTime)/s;I=I>1?1:I,E=n(I),C=h.startX+(h.x-h.startX)*E,O=h.startY+(h.y-h.startY)*E,h.method.call(h.scrollable,C,O),(C!==h.x||O!==h.y)&&t.requestAnimationFrame(g.bind(t,h))}function f(h,v,E){let C,O,I,B;const ce=r();h===e.body?(C=t,O=t.scrollX||t.pageXOffset,I=t.scrollY||t.pageYOffset,B=o.scroll):(C=h,O=h.scrollLeft,I=h.scrollTop,B=d),g({scrollable:C,method:B,startTime:ce,startX:O,startY:I,x:v,y:E})}t.scroll=t.scrollTo=function(){if(arguments[0]!==void 0){if(l(arguments[0])===!0){o.scroll.call(t,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:t.scrollX||t.pageXOffset,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:t.scrollY||t.pageYOffset);return}f.call(t,e.body,arguments[0].left!==void 0?~~arguments[0].left:t.scrollX||t.pageXOffset,arguments[0].top!==void 0?~~arguments[0].top:t.scrollY||t.pageYOffset)}},t.scrollBy=function(){if(arguments[0]!==void 0){if(l(arguments[0])){o.scrollBy.call(t,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:0,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:0);return}f.call(t,e.body,~~arguments[0].left+(t.scrollX||t.pageXOffset),~~arguments[0].top+(t.scrollY||t.pageYOffset))}},i.prototype.scroll=i.prototype.scrollTo=function(){if(arguments[0]===void 0)return;if(l(arguments[0])===!0){if(typeof arguments[0]=="number"&&arguments[1]===void 0)throw new SyntaxError("Value could not be converted");o.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left:typeof arguments[0]!="object"?~~arguments[0]:this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top:arguments[1]!==void 0?~~arguments[1]:this.scrollTop);return}const h=arguments[0].left,v=arguments[0].top;f.call(this,this,typeof h>"u"?this.scrollLeft:~~h,typeof v>"u"?this.scrollTop:~~v)},i.prototype.scrollBy=function(){if(arguments[0]!==void 0){if(l(arguments[0])===!0){o.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop);return}this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior})}},i.prototype.scrollIntoView=function(){if(l(arguments[0])===!0){o.scrollIntoView.call(this,arguments[0]===void 0?!0:arguments[0]);return}const h=T(this),v=h.getBoundingClientRect(),E=this.getBoundingClientRect();h!==e.body?(f.call(this,h,h.scrollLeft+E.left-v.left,h.scrollTop+E.top-v.top),t.getComputedStyle(h).position!=="fixed"&&t.scrollBy({left:v.left,top:v.top,behavior:"smooth"})):t.scrollBy({left:E.left,top:E.top,behavior:"smooth"})}}var D=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(D||{}),R=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t))(R||{}),x=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(x||{}),Y=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(Y||{}),K=(t=>(t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t))(K||{}),N=(t=>(t.Start="start",t.Pause="pause",t.Resume="resume",t.Resize="resize",t.Finish="finish",t.FullsnapshotRebuilded="fullsnapshot-rebuilded",t.LoadStylesheetStart="load-stylesheet-start",t.LoadStylesheetEnd="load-stylesheet-end",t.SkipStart="skip-start",t.SkipEnd="skip-end",t.MouseInteraction="mouse-interaction",t.EventCast="event-cast",t.CustomEvent="custom-event",t.Flush="flush",t.StateChange="state-change",t.PlayBack="play-back",t))(N||{});class bt{constructor(e=[],i){this.timeOffset=0,this.raf=null,this.actions=e,this.speed=i}addAction(e){const i=this.findActionIndex(e);this.actions.splice(i,0,e)}addActions(e){this.actions=this.actions.concat(e)}replaceActions(e){this.actions.length=0,this.actions.splice(0,0,...e)}start(){this.timeOffset=0;let e=performance.now();const{actions:i}=this,s=this;function o(){const r=performance.now();for(s.timeOffset+=(r-e)*s.speed,e=r;i.length;){const a=i[0];if(s.timeOffset>=a.delay)i.shift(),a.doAction();else break}(i.length>0||s.liveMode)&&(s.raf=requestAnimationFrame(o))}this.raf=requestAnimationFrame(o)}clear(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(e){this.speed=e}toggleLiveMode(e){this.liveMode=e}isActive(){return this.raf!==null}findActionIndex(e){let i=0,s=this.actions.length-1;for(;i<=s;){const o=Math.floor((i+s)/2);if(this.actions[o].delay<e.delay)i=o+1;else if(this.actions[o].delay>e.delay)s=o-1;else return o+1}return i}}function ee(t,e){if(t.type===D.IncrementalSnapshot&&t.data.source===R.MouseMove){const i=t.data.positions[0].timeOffset,s=t.timestamp+i;return t.delay=s-e,s-e}return t.delay=t.timestamp-e,t.delay}/*! *****************************************************************************
3
2
  Copyright (c) Microsoft Corporation.
4
3
 
5
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -12,7 +11,7 @@ var rrwebReplay=function(ue){"use strict";var I;(function(e){e[e.Document=0]="Do
12
11
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
12
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
13
  PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */function Ge(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var i,n,s=r.call(e),a=[];try{for(;(t===void 0||t-- >0)&&!(i=s.next()).done;)a.push(i.value)}catch(l){n={error:l}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return a}var Y;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(Y||(Y={}));var Ye={type:"xstate.init"};function ye(e){return e===void 0?[]:[].concat(e)}function j(e){return{type:"xstate.assign",assignment:e}}function ze(e,t){return typeof(e=typeof e=="string"&&t&&t[e]?t[e]:e)=="string"?{type:e}:typeof e=="function"?{type:e.name,exec:e}:e}function ne(e){return function(t){return e===t}}function Xe(e){return typeof e=="string"?{type:e}:e}function Qe(e,t){return{value:e,context:t,actions:[],changed:!1,matches:ne(e)}}function qe(e,t,r){var i=t,n=!1;return[e.filter(function(s){if(s.type==="xstate.assign"){n=!0;var a=Object.assign({},i);return typeof s.assignment=="function"?a=s.assignment(i,r):Object.keys(s.assignment).forEach(function(l){a[l]=typeof s.assignment[l]=="function"?s.assignment[l](i,r):s.assignment[l]}),i=a,!1}return!0}),i,n]}function Je(e,t){t===void 0&&(t={});var r=Ge(qe(ye(e.states[e.initial].entry).map(function(a){return ze(a,t.actions)}),e.context,Ye),2),i=r[0],n=r[1],s={config:e,_options:t,initialState:{value:e.initial,actions:i,context:n,matches:ne(e.initial)},transition:function(a,l){var u,o,c=typeof a=="string"?{value:a,context:e.context}:a,d=c.value,m=c.context,f=Xe(l),T=e.states[d];if(T.on){var g=ye(T.on[f.type]);try{for(var E=function(O){var te=typeof Symbol=="function"&&Symbol.iterator,y=te&&O[te],p=0;if(y)return y.call(O);if(O&&typeof O.length=="number")return{next:function(){return O&&p>=O.length&&(O=void 0),{value:O&&O[p++],done:!O}}};throw new TypeError(te?"Object is not iterable.":"Symbol.iterator is not defined.")}(g),h=E.next();!h.done;h=E.next()){var v=h.value;if(v===void 0)return Qe(d,m);var w=typeof v=="string"?{target:v}:v,R=w.target,L=w.actions,k=L===void 0?[]:L,A=w.cond,H=A===void 0?function(){return!0}:A,W=R===void 0,De=R??d,Me=e.states[De];if(H(m,f)){var ee=Ge(qe((W?ye(k):[].concat(T.exit,k,Me.entry).filter(function(O){return O})).map(function(O){return ze(O,s._options.actions)}),m,f),3),ce=ee[0],Ce=ee[1],xe=ee[2],Q=R??d;return{value:Q,context:Ce,actions:ce,changed:R!==d||ce.length>0||xe,matches:ne(Q)}}}}catch(O){u={error:O}}finally{try{h&&!h.done&&(o=E.return)&&o.call(E)}finally{if(u)throw u.error}}}return Qe(d,m)}};return s}var Ze=function(e,t){return e.actions.forEach(function(r){var i=r.exec;return i&&i(e.context,t)})};function Ke(e){var t=e.initialState,r=Y.NotStarted,i=new Set,n={_machine:e,send:function(s){r===Y.Running&&(t=e.transition(t,s),Ze(t,Xe(s)),i.forEach(function(a){return a(t)}))},subscribe:function(s){return i.add(s),s(t),{unsubscribe:function(){return i.delete(s)}}},start:function(s){if(s){var a=typeof s=="object"?s:{context:e.config.context,value:s};t={value:a.value,actions:[],context:a.context,matches:ne(a.value)}}return r=Y.Running,Ze(t,Ye),n},stop:function(){return r=Y.Stopped,i.clear(),n},get state(){return t},get status(){return r}};return n}var tr=Object.defineProperty,rr=Object.defineProperties,ir=Object.getOwnPropertyDescriptors,et=Object.getOwnPropertySymbols,nr=Object.prototype.hasOwnProperty,or=Object.prototype.propertyIsEnumerable,tt=(e,t,r)=>t in e?tr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,oe=(e,t)=>{for(var r in t||(t={}))nr.call(t,r)&&tt(e,r,t[r]);if(et)for(var r of et(t))or.call(t,r)&&tt(e,r,t[r]);return e},se=(e,t)=>rr(e,ir(t));function sr(e,t){for(let r=e.length-1;r>=0;r--){const i=e[r];if(i.type===M.Meta&&i.timestamp<=t)return e.slice(r)}return e}function ar(e,{getCastFn:t,applyEventsSynchronously:r,emitter:i}){const n=Je({id:"player",context:e,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:j({lastPlayedEvent:(s,a)=>a.type==="CAST_EVENT"?a.payload.event:s.lastPlayedEvent}),recordTimeOffset:j((s,a)=>{let l=s.timeOffset;return"payload"in a&&"timeOffset"in a.payload&&(l=a.payload.timeOffset),se(oe({},s),{timeOffset:l,baselineTime:s.events[0].timestamp+l})}),play(s){var a;const{timer:l,events:u,baselineTime:o,lastPlayedEvent:c}=s;l.clear();for(const g of u)ge(g,o);const d=sr(u,o);let m=c?.timestamp;c?.type===M.IncrementalSnapshot&&c.data.source===x.MouseMove&&(m=c.timestamp+((a=c.data.positions[0])==null?void 0:a.timeOffset)),o<(m||0)&&i.emit(D.PlayBack);const f=new Array,T=new Array;for(const g of d)if(!(m&&m<o&&(g.timestamp<=m||g===c)))if(g.timestamp<o)f.push(g);else{const E=t(g,!1);T.push({doAction:()=>{E()},delay:g.delay})}r(f),i.emit(D.Flush),l.addActions(T),l.start()},pause(s){s.timer.clear()},resetLastPlayedEvent:j(s=>se(oe({},s),{lastPlayedEvent:null})),startLive:j({baselineTime:(s,a)=>(s.timer.toggleLiveMode(!0),s.timer.start(),a.type==="TO_LIVE"&&a.payload.baselineTime?a.payload.baselineTime:Date.now())}),replaceEvents:j((s,a)=>{const{events:l,timer:u,baselineTime:o}=s;if(a.type==="REPLACE_EVENTS"){const{events:c}=a.payload;l.length=0;const d=[];for(const m of c)if(ge(m,o),l.push(m),m.timestamp>=u.timeOffset+o){const f=t(m,!1);d.push({doAction:()=>{f()},delay:m.delay})}u.isActive()&&u.replaceActions(d)}return se(oe({},s),{events:l})}),addEvent:j((s,a)=>{const{baselineTime:l,timer:u,events:o}=s;if(a.type==="ADD_EVENT"){const{event:c}=a.payload;ge(c,l);let d=o.length-1;if(!o[d]||o[d].timestamp<=c.timestamp)o.push(c);else{let T=-1,g=0;for(;g<=d;){const E=Math.floor((g+d)/2);o[E].timestamp<=c.timestamp?g=E+1:d=E-1}T===-1&&(T=g),o.splice(T,0,c)}const m=c.timestamp<l,f=t(c,m);m?f():u.isActive()&&u.addAction({doAction:()=>{f()},delay:c.delay})}return se(oe({},s),{events:o})})}});return Ke(n)}function cr(e){const t=Je({id:"speed",context:e,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:(r,i)=>{"payload"in i&&r.timer.setSpeed(i.payload.speed)},recordSpeed:j({normalSpeed:r=>r.timer.speed}),restoreSpeed:r=>{r.timer.setSpeed(r.normalSpeed)}}});return Ke(t)}const z=`Please stop import mirror directly. Instead of that,\r
14
+ ***************************************************************************** */function De(t,e){var i=typeof Symbol=="function"&&t[Symbol.iterator];if(!i)return t;var s,o,r=i.call(t),a=[];try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)a.push(s.value)}catch(c){o={error:c}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}return a}var P;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(P||(P={}));var be={type:"xstate.init"};function te(t){return t===void 0?[]:[].concat(t)}function L(t){return{type:"xstate.assign",assignment:t}}function Re(t,e){return typeof(t=typeof t=="string"&&e&&e[t]?e[t]:t)=="string"?{type:t}:typeof t=="function"?{type:t.name,exec:t}:t}function G(t){return function(e){return t===e}}function we(t){return typeof t=="string"?{type:t}:t}function xe(t,e){return{value:t,context:e,actions:[],changed:!1,matches:G(t)}}function Ce(t,e,i){var s=e,o=!1;return[t.filter(function(r){if(r.type==="xstate.assign"){o=!0;var a=Object.assign({},s);return typeof r.assignment=="function"?a=r.assignment(s,i):Object.keys(r.assignment).forEach(function(c){a[c]=typeof r.assignment[c]=="function"?r.assignment[c](s,i):r.assignment[c]}),s=a,!1}return!0}),s,o]}function Se(t,e){e===void 0&&(e={});var i=De(Ce(te(t.states[t.initial].entry).map(function(a){return Re(a,e.actions)}),t.context,be),2),s=i[0],o=i[1],r={config:t,_options:e,initialState:{value:t.initial,actions:s,context:o,matches:G(t.initial)},transition:function(a,c){var d,n,l=typeof a=="string"?{value:a,context:t.context}:a,u=l.value,m=l.context,p=we(c),T=t.states[u];if(T.on){var g=te(T.on[p.type]);try{for(var f=function(w){var de=typeof Symbol=="function"&&Symbol.iterator,qe=de&&w[de],Je=0;if(qe)return qe.call(w);if(w&&typeof w.length=="number")return{next:function(){return w&&Je>=w.length&&(w=void 0),{value:w&&w[Je++],done:!w}}};throw new TypeError(de?"Object is not iterable.":"Symbol.iterator is not defined.")}(g),h=f.next();!h.done;h=f.next()){var v=h.value;if(v===void 0)return xe(u,m);var E=typeof v=="string"?{target:v}:v,C=E.target,O=E.actions,I=O===void 0?[]:O,B=E.cond,ce=B===void 0?function(){return!0}:B,Kt=C===void 0,ei=C??u,ti=t.states[ei];if(ce(m,p)){var le=De(Ce((Kt?te(I):[].concat(T.exit,I,ti.entry).filter(function(w){return w})).map(function(w){return Re(w,r._options.actions)}),m,p),3),Xe=le[0],ii=le[1],si=le[2],Qe=C??u;return{value:Qe,context:ii,actions:Xe,changed:C!==u||Xe.length>0||si,matches:G(Qe)}}}}catch(w){d={error:w}}finally{try{h&&!h.done&&(n=f.return)&&n.call(f)}finally{if(d)throw d.error}}}return xe(u,m)}};return r}var Me=function(t,e){return t.actions.forEach(function(i){var s=i.exec;return s&&s(t.context,e)})};function Ie(t){var e=t.initialState,i=P.NotStarted,s=new Set,o={_machine:t,send:function(r){i===P.Running&&(e=t.transition(e,r),Me(e,we(r)),s.forEach(function(a){return a(e)}))},subscribe:function(r){return s.add(r),r(e),{unsubscribe:function(){return s.delete(r)}}},start:function(r){if(r){var a=typeof r=="object"?r:{context:t.config.context,value:r};e={value:a.value,actions:[],context:a.context,matches:G(a.value)}}return i=P.Running,Me(e,be),o},stop:function(){return i=P.Stopped,s.clear(),o},get state(){return e},get status(){return i}};return o}var Rt=Object.defineProperty,wt=Object.defineProperties,xt=Object.getOwnPropertyDescriptors,Ae=Object.getOwnPropertySymbols,Ct=Object.prototype.hasOwnProperty,St=Object.prototype.propertyIsEnumerable,Oe=(t,e,i)=>e in t?Rt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,H=(t,e)=>{for(var i in e||(e={}))Ct.call(e,i)&&Oe(t,i,e[i]);if(Ae)for(var i of Ae(e))St.call(e,i)&&Oe(t,i,e[i]);return t},z=(t,e)=>wt(t,xt(e));function Mt(t,e){for(let i=t.length-1;i>=0;i--){const s=t[i];if(s.type===D.Meta&&s.timestamp<=e)return t.slice(i)}return t}function It(t,{getCastFn:e,applyEventsSynchronously:i,emitter:s}){const o=Se({id:"player",context:t,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:L({lastPlayedEvent:(r,a)=>a.type==="CAST_EVENT"?a.payload.event:r.lastPlayedEvent}),recordTimeOffset:L((r,a)=>{let c=r.timeOffset;return"payload"in a&&"timeOffset"in a.payload&&(c=a.payload.timeOffset),z(H({},r),{timeOffset:c,baselineTime:r.events[0].timestamp+c})}),play(r){var a;const{timer:c,events:d,baselineTime:n,lastPlayedEvent:l}=r;c.clear();for(const g of d)ee(g,n);const u=Mt(d,n);let m=l?.timestamp;l?.type===D.IncrementalSnapshot&&l.data.source===R.MouseMove&&(m=l.timestamp+((a=l.data.positions[0])==null?void 0:a.timeOffset)),n<(m||0)&&s.emit(N.PlayBack);const p=new Array,T=new Array;for(const g of u)if(!(m&&m<n&&(g.timestamp<=m||g===l)))if(g.timestamp<n)p.push(g);else{const f=e(g,!1);T.push({doAction:()=>{f()},delay:g.delay})}i(p),s.emit(N.Flush),c.addActions(T),c.start()},pause(r){r.timer.clear()},resetLastPlayedEvent:L(r=>z(H({},r),{lastPlayedEvent:null})),startLive:L({baselineTime:(r,a)=>(r.timer.toggleLiveMode(!0),r.timer.start(),a.type==="TO_LIVE"&&a.payload.baselineTime?a.payload.baselineTime:Date.now())}),replaceEvents:L((r,a)=>{const{events:c,timer:d,baselineTime:n}=r;if(a.type==="REPLACE_EVENTS"){const{events:l}=a.payload;c.length=0;const u=[];for(const m of l)if(ee(m,n),c.push(m),m.timestamp>=d.timeOffset+n){const p=e(m,!1);u.push({doAction:()=>{p()},delay:m.delay})}d.isActive()&&d.replaceActions(u)}return z(H({},r),{events:c})}),addEvent:L((r,a)=>{const{baselineTime:c,timer:d,events:n}=r;if(a.type==="ADD_EVENT"){const{event:l}=a.payload;ee(l,c);let u=n.length-1;if(!n[u]||n[u].timestamp<=l.timestamp)n.push(l);else{let T=-1,g=0;for(;g<=u;){const f=Math.floor((g+u)/2);n[f].timestamp<=l.timestamp?g=f+1:u=f-1}T===-1&&(T=g),n.splice(T,0,l)}const m=l.timestamp<c,p=e(l,m);m?p():d.isActive()&&d.addAction({doAction:()=>{p()},delay:l.delay})}return z(H({},r),{events:n})})}});return Ie(o)}function At(t){const e=Se({id:"speed",context:t,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:(i,s)=>{"payload"in s&&i.timer.setSpeed(s.payload.speed)},recordSpeed:L({normalSpeed:i=>i.timer.speed}),restoreSpeed:i=>{i.timer.setSpeed(i.normalSpeed)}}});return Ie(e)}const F=`Please stop import mirror directly. Instead of that,\r
16
15
  now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
17
- or you can use record.mirror to access the mirror instance during recording.`;let rt={map:{},getId(){return console.error(z),-1},getNode(){return console.error(z),null},removeNodeFromMap(){console.error(z)},has(){return console.error(z),!1},reset(){console.error(z)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(rt=new Proxy(rt,{get(e,t,r){return t==="map"&&console.error(z),Reflect.get(e,t,r)}}));function lr(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=function(t){if(!(0 in arguments))throw new TypeError("1 argument is required");do if(this===t)return!0;while(t=t&&t.parentNode);return!1})}function ur(e){const t={},r=(n,s)=>{const a={value:n,parent:s,children:[]};return t[n.node.id]=a,a},i=[];for(const n of e){const{nextId:s,parentId:a}=n;if(s&&s in t){const l=t[s];if(l.parent){const u=l.parent.children.indexOf(l);l.parent.children.splice(u,0,r(n,l.parent))}else{const u=i.indexOf(l);i.splice(u,0,r(n,null))}continue}if(a in t){const l=t[a];l.children.push(r(n,l));continue}i.push(r(n,null))}return i}function it(e,t){t(e.value);for(let r=e.children.length-1;r>=0;r--)it(e.children[r],t)}function ve(e,t){return Boolean(e.nodeName==="IFRAME"&&t.getMeta(e))}function nt(e,t){var r,i;const n=(i=(r=e.ownerDocument)==null?void 0:r.defaultView)==null?void 0:i.frameElement;if(!n||n===t)return{x:0,y:0,relativeScale:1,absoluteScale:1};const s=n.getBoundingClientRect(),a=nt(n,t),l=s.height/n.clientHeight;return{x:s.x*a.relativeScale+a.x,y:s.y*a.relativeScale+a.y,relativeScale:l,absoluteScale:a.absoluteScale*l}}function ot(e){return Boolean(e?.shadowRoot)}function Z(e,t){const r=e[t[0]];return t.length===1?r:Z(r.cssRules[t[1]].cssRules,t.slice(2))}function st(e){const t=[...e],r=t.pop();return{positions:t,index:r}}function dr(e){const t=new Set,r=[];for(let i=e.length;i--;){const n=e[i];t.has(n.id)||(r.push(n),t.add(n.id))}return r}const hr=e=>[`.${e} { background: currentColor }`,"noscript { display: none !important; }",`.${e} { background: currentColor; border-radius: 5px; }`,`.${e}:hover::after {content: 'Redacted'; color: white; background: black; text-align: center; width: 100%; display: block;}`];for(var at="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K=typeof Uint8Array>"u"?[]:new Uint8Array(256),ae=0;ae<at.length;ae++)K[at.charCodeAt(ae)]=ae;var mr=function(e){var t=e.length*.75,r=e.length,i,n=0,s,a,l,u;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var o=new ArrayBuffer(t),c=new Uint8Array(o);for(i=0;i<r;i+=4)s=K[e.charCodeAt(i)],a=K[e.charCodeAt(i+1)],l=K[e.charCodeAt(i+2)],u=K[e.charCodeAt(i+3)],c[n++]=s<<2|a>>4,c[n++]=(a&15)<<4|l>>2,c[n++]=(l&3)<<6|u&63;return o},pr=(e,t,r)=>new Promise((i,n)=>{var s=u=>{try{l(r.next(u))}catch(o){n(o)}},a=u=>{try{l(r.throw(u))}catch(o){n(o)}},l=u=>u.done?i(u.value):Promise.resolve(u.value).then(s,a);l((r=r.apply(e,t)).next())});const ct=new Map;function lt(e,t){let r=ct.get(e);return r||(r=new Map,ct.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}function V(e,t,r){return i=>pr(this,null,function*(){if(i&&typeof i=="object"&&"rr_type"in i)if(r&&(r.isUnchanged=!1),i.rr_type==="ImageBitmap"&&"args"in i){const n=yield V(e,t,r)(i.args);return yield createImageBitmap.apply(null,n)}else if("index"in i){if(r||t===null)return i;const{rr_type:n,index:s}=i;return lt(t,n)[s]}else if("args"in i){const{rr_type:n,args:s}=i,a=window[n];return new a(...yield Promise.all(s.map(V(e,t,r))))}else{if("base64"in i)return mr(i.base64);if("src"in i){const n=e.get(i.src);if(n)return n;{const s=new Image;return s.src=i.src,e.set(i.src,s),s}}else if("data"in i&&i.rr_type==="Blob"){const n=yield Promise.all(i.data.map(V(e,t,r)));return new Blob(n,{type:i.type})}}else if(Array.isArray(i))return yield Promise.all(i.map(V(e,t,r)));return i})}var fr=(e,t,r)=>new Promise((i,n)=>{var s=u=>{try{l(r.next(u))}catch(o){n(o)}},a=u=>{try{l(r.throw(u))}catch(o){n(o)}},l=u=>u.done?i(u.value):Promise.resolve(u.value).then(s,a);l((r=r.apply(e,t)).next())});function gr(e,t){try{return t===ie.WebGL?e.getContext("webgl")||e.getContext("experimental-webgl"):e.getContext("webgl2")}catch{return null}}const yr=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function vr(e,t){if(!(t!=null&&t.constructor))return;const{name:r}=t.constructor;if(!yr.includes(r))return;const i=lt(e,r);i.includes(t)||i.push(t)}function Tr(e){return fr(this,arguments,function*({mutation:t,target:r,type:i,imageMap:n,errorHandler:s}){try{const a=gr(r,i);if(!a)return;if(t.setter){a[t.property]=t.args[0];return}const l=a[t.property],u=yield Promise.all(t.args.map(V(n,a))),o=l.apply(a,u);vr(a,o)}catch(a){s(t,a)}})}var Nr=(e,t,r)=>new Promise((i,n)=>{var s=u=>{try{l(r.next(u))}catch(o){n(o)}},a=u=>{try{l(r.throw(u))}catch(o){n(o)}},l=u=>u.done?i(u.value):Promise.resolve(u.value).then(s,a);l((r=r.apply(e,t)).next())});function Er(e){return Nr(this,arguments,function*({event:t,mutation:r,target:i,imageMap:n,errorHandler:s}){try{const a=i.getContext("2d");if(r.setter){a[r.property]=r.args[0];return}const l=a[r.property];if(r.property==="drawImage"&&typeof r.args[0]=="string"){const u=n.get(t);l.apply(a,r.args)}else{const u=yield Promise.all(r.args.map(V(n,a)));l.apply(a,u)}}catch(a){s(r,a)}})}var wr=(e,t,r)=>new Promise((i,n)=>{var s=u=>{try{l(r.next(u))}catch(o){n(o)}},a=u=>{try{l(r.throw(u))}catch(o){n(o)}},l=u=>u.done?i(u.value):Promise.resolve(u.value).then(s,a);l((r=r.apply(e,t)).next())});function ut(e){return wr(this,arguments,function*({event:t,mutation:r,target:i,imageMap:n,canvasEventMap:s,errorHandler:a}){try{const l=s.get(t)||r,u="commands"in l?l.commands:[l];if([ie.WebGL,ie.WebGL2].includes(r.type)){for(let o=0;o<u.length;o++){const c=u[o];yield Tr({mutation:c,type:r.type,target:i,imageMap:n,errorHandler:a})}return}for(let o=0;o<u.length;o++){const c=u[o];yield Er({event:t,mutation:c,target:i,imageMap:n,errorHandler:a})}}catch(l){a(r,l)}})}var br=Object.defineProperty,Dr=Object.defineProperties,Mr=Object.getOwnPropertyDescriptors,dt=Object.getOwnPropertySymbols,Cr=Object.prototype.hasOwnProperty,xr=Object.prototype.propertyIsEnumerable,ht=(e,t,r)=>t in e?br(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,X=(e,t)=>{for(var r in t||(t={}))Cr.call(t,r)&&ht(e,r,t[r]);if(dt)for(var r of dt(t))xr.call(t,r)&&ht(e,r,t[r]);return e},Te=(e,t)=>Dr(e,Mr(t)),Ne=(e,t,r)=>new Promise((i,n)=>{var s=u=>{try{l(r.next(u))}catch(o){n(o)}},a=u=>{try{l(r.throw(u))}catch(o){n(o)}},l=u=>u.done?i(u.value):Promise.resolve(u.value).then(s,a);l((r=r.apply(e,t)).next())});const mt=10*1e3,pt=2*1e3,ft=1*1e3,gt=60*60*1e3,Sr=He||Zt,Ee="[replayer]",we={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function be(e){return e.type==M.IncrementalSnapshot&&(e.data.source==x.TouchMove||e.data.source==x.MouseInteraction&&e.data.type==_.TouchStart)}class Rr{constructor(t,r){if(this.usingVirtualDom=!1,this.virtualDom=new G,this.mouseTail=null,this.tailPositions=[],this.emitter=Sr(),this.activityIntervals=[],this.legacy_missingNodeRetryMap={},this.cache=ke(),this.imageMap=new Map,this.canvasEventMap=new Map,this.mirror=Tt(),this.firstFullSnapshot=null,this.newDocumentQueue=[],this.mousePos=null,this.touchActive=null,!(r!=null&&r.liveMode)&&t.length<2)throw new Error("Replayer need at least 2 events.");const i={speed:1,maxSpeed:360,root:document.body,loadTimeout:0,skipInactive:!1,showWarning:!0,showDebug:!1,blockClass:"highlight-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:we,useVirtualDom:!0,inactiveThreshold:.02,inactiveSkipTime:pt};this.config=Object.assign({},i,r),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on(D.Resize,this.handleResize),this.setupDom(),this.emitter.on(D.Flush,()=>{if(this.usingVirtualDom){const l={mirror:this.mirror,applyCanvas:(u,o,c)=>{ut({event:u,mutation:o,target:c,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this)};if(U(this.iframe.contentDocument,this.virtualDom,l,this.virtualDom.mirror),this.virtualDom.destroyTree(),this.usingVirtualDom=!1,Object.keys(this.legacy_missingNodeRetryMap).length)for(const u in this.legacy_missingNodeRetryMap)try{const o=this.legacy_missingNodeRetryMap[u],c=pe(o.node,this.mirror,this.virtualDom.mirror);U(c,o.node,l,this.virtualDom.mirror),o.node=c}catch(o){this.config.showWarning&&console.warn(o)}}this.mousePos&&this.moveAndHover(this.mousePos.x,this.mousePos.y,this.mousePos.id,!0,this.mousePos.debugData),this.mousePos=null}),this.emitter.on(D.PlayBack,()=>{this.firstFullSnapshot=null,this.mirror.reset()});const n=new er([],r?.speed||i.speed);this.service=ar({events:t.map(l=>r&&r.unpackFn?r.unpackFn(l):l).sort((l,u)=>l.timestamp-u.timestamp),timer:n,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(D.StateChange,{player:l})}),this.speedService=cr({normalSpeed:-1,timer:n}),this.speedService.start(),this.speedService.subscribe(l=>{this.emitter.emit(D.StateChange,{speed:l})});const s=this.service.state.context.events.find(l=>l.type===M.Meta),a=this.service.state.context.events.find(l=>l.type===M.FullSnapshot);if(s){const{width:l,height:u}=s.data;setTimeout(()=>{this.emitter.emit(D.Resize,{width:l,height:u})},0)}a&&setTimeout(()=>{this.firstFullSnapshot||(this.firstFullSnapshot=a,this.rebuildFullSnapshot(a),this.iframe.contentWindow.scrollTo(a.data.initialOffset))},1),this.service.state.context.events.find(be)&&this.mouse.classList.add("touch-device")}get timer(){return this.service.state.context.timer}on(t,r){return this.emitter.on(t,r),this}off(t,r){return this.emitter.off(t,r),this}setConfig(t){Object.keys(t).forEach(r=>{this.config[r]=t[r]}),this.config.skipInactive||this.backToNormal(),typeof t.speed<"u"&&this.speedService.send({type:"SET_SPEED",payload:{speed:t.speed}}),typeof t.mouseTail<"u"&&(t.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 t=[],r=this.getMetaData(),i=[{timestamp:r.startTime},...this.service.state.context.events.filter(a=>this.isUserInteraction(a)),{timestamp:r.endTime}];for(let a=1;a<i.length;a++){const l=i[a-1],u=i[a];u.timestamp-l.timestamp>mt?t.push({startTime:l.timestamp,endTime:u.timestamp,duration:u.timestamp-l.timestamp,active:!1}):t.push({startTime:l.timestamp,endTime:u.timestamp,duration:u.timestamp-l.timestamp,active:!0})}const n=[];let s=t[0];for(let a=1;a<t.length;a++)t[a].active!=t[a-1].active&&(n.push({startTime:s.startTime,endTime:t[a-1].endTime,duration:t[a-1].endTime-s.startTime,active:t[a-1].active}),s=t[a]);s&&t.length>0&&n.push({startTime:s.startTime,endTime:t[t.length-1].endTime,duration:t[t.length-1].endTime-s.startTime,active:t[t.length-1].active}),s=n[0];for(let a=1;a<n.length;a++)(!n[a].active&&n[a].duration>this.config.inactiveThreshold*r.totalTime||!n[a-1].active&&n[a-1].duration>this.config.inactiveThreshold*r.totalTime)&&(this.activityIntervals.push({startTime:s.startTime,endTime:n[a-1].endTime,duration:n[a-1].endTime-s.startTime,active:n[a-1].active}),s=n[a]);s&&n.length>0&&this.activityIntervals.push({startTime:s.startTime,endTime:n[n.length-1].endTime,duration:n[n.length-1].endTime-s.startTime,active:n[n.length-1].active})}return this.activityIntervals}getMetaData(){const t=this.service.state.context.events[0],r=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:t.timestamp,endTime:r.timestamp,totalTime:r.timestamp-t.timestamp}}getCurrentTime(){return this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){const{baselineTime:t,events:r}=this.service.state.context;return t-r[0].timestamp}getMirror(){return this.mirror}play(t=0){var r,i;this.service.state.matches("paused")?this.service.send({type:"PLAY",payload:{timeOffset:t}}):(this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:t}})),(i=(r=this.iframe.contentDocument)==null?void 0:r.getElementsByTagName("html")[0])==null||i.classList.remove("rrweb-paused"),this.emitter.emit(D.Start),this.handleInactivity(this.getMetaData().startTime+t,!0)}pause(t){var r,i;t===void 0&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),typeof t=="number"&&(this.play(t),this.service.send({type:"PAUSE"})),(i=(r=this.iframe.contentDocument)==null?void 0:r.getElementsByTagName("html")[0])==null||i.classList.add("rrweb-paused"),this.emitter.emit(D.Pause)}resume(t=0){console.warn("The 'resume' will be departed in 1.0. Please use 'play' method which has the same interface."),this.play(t),this.emitter.emit(D.Resume)}startLive(t){this.service.send({type:"TO_LIVE",payload:{baselineTime:t}})}addEvent(t){const r=this.config.unpackFn?this.config.unpackFn(t):t;be(r)&&this.mouse.classList.add("touch-device"),Promise.resolve().then(()=>this.service.send({type:"ADD_EVENT",payload:{event:r}}))}replaceEvents(t){for(const r of t)if(be(r)){this.mouse.classList.add("touch-device");break}this.service.send({type:"REPLACE_EVENTS",payload:{events:t}})}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=ke()}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 t=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&t.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",t.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe),this.iframe.contentWindow&&this.iframe.contentDocument&&(Kt(this.iframe.contentWindow,this.iframe.contentDocument),lr(this.iframe.contentWindow))}handleResize(t){this.iframe.style.display="inherit";for(const r of[this.mouseTail,this.iframe])!r||(r.setAttribute("width",String(t.width)),r.setAttribute("height",String(t.height)))}applyEventsSynchronously(t){for(const r of t){switch(r.type){case M.DomContentLoaded:case M.Load:case M.Custom:continue;case M.FullSnapshot:case M.Meta:case M.Plugin:case M.IncrementalSnapshot:break}this.getCastFn(r,!0)()}this.touchActive===!0?this.mouse.classList.add("touch-active"):this.touchActive===!1&&this.mouse.classList.remove("touch-active"),this.touchActive=null}getCastFn(t,r=!1){let i;switch(t.type){case M.DomContentLoaded:case M.Load:break;case M.Custom:i=()=>{this.emitter.emit(D.CustomEvent,t)};break;case M.Meta:i=()=>this.emitter.emit(D.Resize,{width:t.data.width,height:t.data.height});break;case M.FullSnapshot:i=()=>{if(this.firstFullSnapshot){if(this.firstFullSnapshot===t){this.firstFullSnapshot=!0;return}}else this.firstFullSnapshot=!0;this.rebuildFullSnapshot(t,r),this.iframe.contentWindow.scrollTo(t.data.initialOffset)};break;case M.IncrementalSnapshot:i=()=>{if(this.applyIncremental(t,r),!r&&(this.handleInactivity(t.timestamp),t===this.nextUserInteractionEvent&&(this.nextUserInteractionEvent=null,this.backToNormal()),this.config.skipInactive&&!this.nextUserInteractionEvent)){for(const n of this.service.state.context.events)if(!(n.timestamp<=t.timestamp)&&this.isUserInteraction(n)){n.delay-t.delay>mt*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=n);break}if(this.nextUserInteractionEvent){const n=this.nextUserInteractionEvent.delay-t.delay,s={speed:Math.min(Math.round(n/pt),this.config.maxSpeed)};this.speedService.send({type:"FAST_FORWARD",payload:s}),this.emitter.emit(D.SkipStart,s)}}};break}return()=>{i&&i();for(const s of this.config.plugins||[])s.handler(t,r,{replayer:this});this.service.send({type:"CAST_EVENT",payload:{event:t}});const n=this.service.state.context.events.length-1;if(t===this.service.state.context.events[n]){const s=()=>{n<this.service.state.context.events.length-1||(this.backToNormal(),this.service.send("END"),this.emitter.emit(D.Finish))};t.type===M.IncrementalSnapshot&&t.data.source===x.MouseMove&&t.data.positions.length?setTimeout(()=>{s()},Math.max(0,-t.data.positions[0].timeOffset+50)):s()}this.emitter.emit(D.EventCast,t)}}handleInactivity(t,r){if((t===this.inactiveEndTimestamp||r)&&(this.inactiveEndTimestamp=null,this.backToNormal()),this.config.skipInactive&&!this.inactiveEndTimestamp){for(const i of this.getActivityIntervals())if(t>=i.startTime&&t<i.endTime&&!i.active){this.inactiveEndTimestamp=i.endTime;break}if(this.inactiveEndTimestamp){const i=this.inactiveEndTimestamp-t,n={speed:i/gt*this.config.inactiveSkipTime<ft?i/ft:Math.round(Math.max(i,gt)/this.config.inactiveSkipTime)};this.speedService.send({type:"FAST_FORWARD",payload:n}),this.emitter.emit(D.SkipStart,n)}}}rebuildFullSnapshot(t,r=!1){if(!this.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&console.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={};const i=[];xt(t.data.node,{doc:this.iframe.contentDocument,afterAppend:a=>{this.collectIframeAndAttachDocument(i,a)},cache:this.cache,mirror:this.mirror});for(const{mutationInQueue:a,builtNode:l}of i)this.attachDocumentToIframe(a,l),this.newDocumentQueue=this.newDocumentQueue.filter(u=>u!==a);const{documentElement:n,head:s}=this.iframe.contentDocument;this.insertStyleRules(n,s),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(D.FullsnapshotRebuilded,t),r||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()}insertStyleRules(t,r){const i=hr(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; }"),this.usingVirtualDom){const n=this.virtualDom.createElement("style");this.virtualDom.mirror.add(n,je(n,this.virtualDom.unserializedId)),t.insertBefore(n,r);for(let s=0;s<i.length;s++)n.rules.push({cssText:i[s],type:$.Insert,index:s})}else{const n=document.createElement("style");t.insertBefore(n,r);for(let s=0;s<i.length;s++)n.sheet.insertRule(i[s],s)}}attachDocumentToIframe(t,r){const i=this.usingVirtualDom?this.virtualDom.mirror:this.mirror,n=[];re(t.node,{doc:r.contentDocument,mirror:i,hackCss:!0,skipChild:!1,afterAppend:s=>{this.collectIframeAndAttachDocument(n,s);const a=i.getMeta(s);if(a?.type===I.Element&&a?.tagName.toUpperCase()==="HTML"){const{documentElement:l,head:u}=r.contentDocument;this.insertStyleRules(l,u)}},cache:this.cache});for(const{mutationInQueue:s,builtNode:a}of n)this.attachDocumentToIframe(s,a),this.newDocumentQueue=this.newDocumentQueue.filter(l=>l!==s)}collectIframeAndAttachDocument(t,r){if(ve(r,this.mirror)){const i=this.newDocumentQueue.find(n=>n.parentId===this.mirror.getId(r));i&&t.push({mutationInQueue:i,builtNode:r})}}waitForStylesheetLoad(){var t;const r=(t=this.iframe.contentDocument)==null?void 0:t.head;if(r){const i=new Set;let n,s=this.service.state;const a=()=>{s=this.service.state};this.emitter.on(D.Start,a),this.emitter.on(D.Pause,a);const l=()=>{this.emitter.off(D.Start,a),this.emitter.off(D.Pause,a)};r.querySelectorAll('link[rel="stylesheet"]').forEach(u=>{u.sheet||(i.add(u),u.addEventListener("load",()=>{i.delete(u),i.size===0&&n!==-1&&(s.matches("playing")&&this.play(this.getCurrentTime()),this.emitter.emit(D.LoadStylesheetEnd),n&&clearTimeout(n),l())}))}),i.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(D.LoadStylesheetStart),n=setTimeout(()=>{s.matches("playing")&&this.play(this.getCurrentTime()),n=-1,l()},this.config.loadTimeout))}}hasImageArg(t){for(const r of t)if(!(!r||typeof r!="object")){if("rr_type"in r&&"args"in r){if(this.hasImageArg(r.args))return!0}else if("rr_type"in r&&r.rr_type==="HTMLImageElement"||r instanceof Array&&this.hasImageArg(r))return!0}return!1}getImageArgs(t){const r=[];for(const i of t)!i||typeof i!="object"||("rr_type"in i&&"args"in i?r.push(...this.getImageArgs(i.args)):"rr_type"in i&&i.rr_type==="HTMLImageElement"?r.push(i.src):i instanceof Array&&r.push(...this.getImageArgs(i)));return r}preloadAllImages(){return Ne(this,null,function*(){this.service.state;const t=()=>{this.service.state};this.emitter.on(D.Start,t),this.emitter.on(D.Pause,t);const r=[];for(const i of this.service.state.context.events)i.type===M.IncrementalSnapshot&&i.data.source===x.CanvasMutation&&(r.push(this.deserializeAndPreloadCanvasEvents(i.data,i)),("commands"in i.data?i.data.commands:[i.data]).forEach(n=>{this.preloadImages(n,i)}));return Promise.all(r)})}preloadImages(t,r){if(t.property==="drawImage"&&typeof t.args[0]=="string"&&!this.imageMap.has(r)){const i=document.createElement("canvas"),n=i.getContext("2d"),s=n?.createImageData(i.width,i.height);s?.data,JSON.parse(t.args[0]),n?.putImageData(s,0,0)}}deserializeAndPreloadCanvasEvents(t,r){return Ne(this,null,function*(){if(!this.canvasEventMap.has(r)){const i={isUnchanged:!0};if("commands"in t){const n=yield Promise.all(t.commands.map(s=>Ne(this,null,function*(){const a=yield Promise.all(s.args.map(V(this.imageMap,null,i)));return Te(X({},s),{args:a})})));i.isUnchanged===!1&&this.canvasEventMap.set(r,Te(X({},t),{commands:n}))}else{const n=yield Promise.all(t.args.map(V(this.imageMap,null,i)));i.isUnchanged===!1&&this.canvasEventMap.set(r,Te(X({},t),{args:n}))}}})}applyIncremental(t,r){var i,n,s,a,l,u;const{data:o}=t;switch(o.source){case x.Mutation:{try{this.applyMutation(o,r)}catch(c){this.warn(`Exception in mutation ${c.message||c}`,o)}break}case x.Drag:case x.TouchMove:case x.MouseMove:if(r){const c=o.positions[o.positions.length-1];this.mousePos={x:c.x,y:c.y,id:c.id,debugData:o}}else o.positions.forEach(c=>{const d={doAction:()=>{this.moveAndHover(c.x,c.y,c.id,r,o)},delay:c.timeOffset+t.timestamp-this.service.state.context.baselineTime};this.timer.addAction(d)}),this.timer.addAction({doAction(){},delay:t.delay-((i=o.positions[0])==null?void 0:i.timeOffset)});break;case x.MouseInteraction:{if(o.id===-1||r)break;const c=new Event(_[o.type].toLowerCase()),d=this.mirror.getNode(o.id);if(!d)return this.debugNodeNotFound(o,o.id);this.emitter.emit(D.MouseInteraction,{type:o.type,target:d});const{triggerFocus:m}=this.config;switch(o.type){case _.Blur:"blur"in d&&d.blur();break;case _.Focus:m&&d.focus&&d.focus({preventScroll:!0});break;case _.Click:case _.TouchStart:case _.TouchEnd:r?(o.type===_.TouchStart?this.touchActive=!0:o.type===_.TouchEnd&&(this.touchActive=!1),this.mousePos={x:o.x,y:o.y,id:o.id,debugData:o}):(o.type===_.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(o.x,o.y,o.id,r,o),o.type===_.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):o.type===_.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):o.type===_.TouchEnd&&this.mouse.classList.remove("touch-active"));break;case _.TouchCancel:r?this.touchActive=!1:this.mouse.classList.remove("touch-active");break;default:d.dispatchEvent(c)}break}case x.Scroll:{if(o.id===-1)break;if(this.usingVirtualDom){const c=this.virtualDom.mirror.getNode(o.id);if(!c)return this.debugNodeNotFound(o,o.id);c.scrollData=o;break}this.applyScroll(o,r);break}case x.ViewportResize:this.emitter.emit(D.Resize,{width:o.width,height:o.height});break;case x.Input:{if(o.id===-1)break;if(this.usingVirtualDom){const c=this.virtualDom.mirror.getNode(o.id);if(!c)return this.debugNodeNotFound(o,o.id);c.inputData=o;break}this.applyInput(o);break}case x.MediaInteraction:{const c=this.usingVirtualDom?this.virtualDom.mirror.getNode(o.id):this.mirror.getNode(o.id);if(!c)return this.debugNodeNotFound(o,o.id);const d=c;try{o.currentTime&&(d.currentTime=o.currentTime),o.volume&&(d.volume=o.volume),o.muted&&(d.muted=o.muted),o.type===fe.Pause&&d.pause(),o.type===fe.Play&&d.play()}catch(m){this.config.showWarning&&console.warn(`Failed to replay media interactions: ${m.message||m}`)}break}case x.StyleSheetRule:{if(this.usingVirtualDom){const c=this.virtualDom.mirror.getNode(o.id);if(!c)return this.debugNodeNotFound(o,o.id);const d=c.rules;(n=o.adds)==null||n.forEach(({rule:m,index:f})=>d?.push({cssText:m,index:f,type:$.Insert})),(s=o.removes)==null||s.forEach(({index:m})=>d?.push({index:m,type:$.Remove}))}else{const c=this.mirror.getNode(o.id);if(!c)return this.debugNodeNotFound(o,o.id);const d=c.sheet;(a=o.adds)==null||a.forEach(({rule:m,index:f})=>{try{if(Array.isArray(f)){const{positions:T,index:g}=st(f);Z(d.cssRules,T).insertRule(m,g)}else{const T=f===void 0?void 0:Math.min(f,d.cssRules.length);d.insertRule(m,T)}}catch{}}),(l=o.removes)==null||l.forEach(({index:m})=>{try{if(Array.isArray(m)){const{positions:f,index:T}=st(m);Z(d.cssRules,f).deleteRule(T||0)}else d?.deleteRule(m)}catch{}})}break}case x.StyleDeclaration:{if(this.usingVirtualDom){const c=this.virtualDom.mirror.getNode(o.id);if(!c)return this.debugNodeNotFound(o,o.id);const d=c.rules;o.set&&d.push(X({type:$.SetProperty,index:o.index},o.set)),o.remove&&d.push(X({type:$.RemoveProperty,index:o.index},o.remove))}else{const c=this.mirror.getNode(o.id);if(!c)return this.debugNodeNotFound(o,o.id);const d=c.sheet;o.set&&Z(d.rules,o.index).style.setProperty(o.set.property,o.set.value,o.set.priority),o.remove&&Z(d.rules,o.index).style.removeProperty(o.remove.property)}break}case x.CanvasMutation:{if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){const c=this.virtualDom.mirror.getNode(o.id);if(!c)return this.debugNodeNotFound(o,o.id);c.canvasMutations.push({event:t,mutation:o})}else{const c=this.mirror.getNode(o.id);if(!c)return this.debugNodeNotFound(o,o.id);ut({event:t,mutation:o,target:c,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})}break}case x.Font:{try{const c=new FontFace(o.family,o.buffer?new Uint8Array(JSON.parse(o.fontSource)):o.fontSource,o.descriptors);(u=this.iframe.contentDocument)==null||u.fonts.add(c)}catch(c){this.config.showWarning&&console.warn(c)}break}}}applyMutation(t,r){if(this.config.useVirtualDom&&!this.usingVirtualDom&&r&&(this.usingVirtualDom=!0,Qt(this.iframe.contentDocument,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length))for(const o in this.legacy_missingNodeRetryMap)try{const c=this.legacy_missingNodeRetryMap[o],d=We(c.node,this.virtualDom,this.mirror);d&&(c.node=d)}catch(c){this.config.showWarning&&console.warn(c)}const i=this.usingVirtualDom?this.virtualDom.mirror:this.mirror;t.removes.forEach(o=>{var c;const d=i.getNode(o.id);if(!d)return t.removes.find(f=>f.id===o.parentId)?void 0:this.warnNodeNotFound(t,o.id);let m=i.getNode(o.parentId);if(!m)return this.warnNodeNotFound(t,o.parentId);if(o.isShadow&&ot(m)&&(m=m.shadowRoot),i.removeNodeFromMap(d),m)try{m.removeChild(d),this.usingVirtualDom&&d.nodeName==="#text"&&m.nodeName==="STYLE"&&((c=m.rules)==null?void 0:c.length)>0&&(m.rules=[])}catch(f){if(f instanceof DOMException)this.warn("parent could not remove child in mutation",m,d,t);else throw f}});const n=X({},this.legacy_missingNodeRetryMap),s=[],a=o=>{let c=null;return o.nextId&&(c=i.getNode(o.nextId)),o.nextId!==null&&o.nextId!==void 0&&o.nextId!==-1&&!c},l=o=>{var c;if(!this.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");let d=i.getNode(o.parentId);if(!d)return o.node.type===I.Document?this.newDocumentQueue.push(o):s.push(o);o.node.isShadow&&(ot(d)||d.attachShadow({mode:"open"}),d=d.shadowRoot);let m=null,f=null;if(o.previousId&&(m=i.getNode(o.previousId)),o.nextId&&(f=i.getNode(o.nextId)),a(o))return s.push(o);if(o.node.rootId&&!i.getNode(o.node.rootId))return;const T=o.node.rootId?i.getNode(o.node.rootId):this.usingVirtualDom?this.virtualDom:this.iframe.contentDocument;if(ve(d,i)){this.attachDocumentToIframe(o,d);return}const g=re(o.node,{doc:T,mirror:i,skipChild:!0,hackCss:!0,cache:this.cache});if(o.previousId===-1||o.nextId===-1){n[o.node.id]={node:g,mutation:o};return}const E=i.getMeta(d);if(E&&E.type===I.Element&&E.tagName==="textarea"&&o.node.type===I.Text){const h=Array.isArray(d.childNodes)?d.childNodes:Array.from(d.childNodes);for(const v of h)v.nodeType===d.TEXT_NODE&&d.removeChild(v)}if(m&&m.nextSibling&&m.nextSibling.parentNode)d.insertBefore(g,m.nextSibling);else if(f&&f.parentNode)d.contains(f)?d.insertBefore(g,f):d.insertBefore(g,null);else{if(d===T)for(;T.firstChild;)T.removeChild(T.firstChild);d.appendChild(g)}if(this.usingVirtualDom&&g.nodeName==="#text"&&d.nodeName==="STYLE"&&((c=d.rules)==null?void 0:c.length)>0&&(d.rules=[]),ve(g,this.mirror)){const h=this.mirror.getId(g),v=this.newDocumentQueue.find(w=>w.parentId===h);v&&(this.attachDocumentToIframe(v,g),this.newDocumentQueue=this.newDocumentQueue.filter(w=>w!==v))}(o.previousId||o.nextId)&&this.legacy_resolveMissingNode(n,d,g,o)};t.adds.forEach(o=>{l(o)});const u=Date.now();for(;s.length;){const o=ur(s);if(s.length=0,Date.now()-u>500){this.warn("Timeout in the loop, please check the resolve tree data:",o);break}for(const c of o)i.getNode(c.value.parentId)?it(c,d=>{l(d)}):this.debug("Drop resolve tree since there is no parent for the root node.",c)}Object.keys(n).length&&Object.assign(this.legacy_missingNodeRetryMap,n),dr(t.texts).forEach(o=>{var c;const d=i.getNode(o.id);if(!d)return t.removes.find(m=>m.id===o.id)?void 0:this.warnNodeNotFound(t,o.id);if(d.textContent=o.value,this.usingVirtualDom){const m=d.parentNode;((c=m?.rules)==null?void 0:c.length)>0&&(m.rules=[])}}),t.attributes.forEach(o=>{const c=i.getNode(o.id);if(!c)return t.removes.find(d=>d.id===o.id)?void 0:this.warnNodeNotFound(t,o.id);for(const d in o.attributes)if(typeof d=="string"){const m=o.attributes[d];if(m===null)c.removeAttribute(d);else if(typeof m=="string")try{c.setAttribute(d,m)}catch(f){this.config.showWarning&&console.warn("An error occurred may due to the checkout feature.",f)}else if(d==="style"){const f=m,T=c;for(const g in f)if(f[g]===!1)T.style.removeProperty(g);else if(f[g]instanceof Array){const E=f[g];T.style.setProperty(g,E[0],E[1])}else{const E=f[g];T.style.setProperty(g,E)}}}})}applyScroll(t,r){const i=this.mirror.getNode(t.id);if(!i)return this.debugNodeNotFound(t,t.id);const n=this.mirror.getMeta(i);if(i===this.iframe.contentDocument)this.iframe.contentWindow.scrollTo({top:t.y,left:t.x,behavior:r?"auto":"smooth"});else if(n?.type===I.Document)i.defaultView.scrollTo({top:t.y,left:t.x,behavior:r?"auto":"smooth"});else try{i.scrollTop=t.y,i.scrollLeft=t.x}catch{}}applyInput(t){const r=this.mirror.getNode(t.id);if(!r)return this.debugNodeNotFound(t,t.id);try{r.checked=t.isChecked,r.value=t.text}catch{}}legacy_resolveMissingNode(t,r,i,n){const{previousId:s,nextId:a}=n,l=s&&t[s],u=a&&t[a];if(l){const{node:o,mutation:c}=l;r.insertBefore(o,i),delete t[c.node.id],delete this.legacy_missingNodeRetryMap[c.node.id],(c.previousId||c.nextId)&&this.legacy_resolveMissingNode(t,r,o,c)}if(u){const{node:o,mutation:c}=u;r.insertBefore(o,i.nextSibling),delete t[c.node.id],delete this.legacy_missingNodeRetryMap[c.node.id],(c.previousId||c.nextId)&&this.legacy_resolveMissingNode(t,r,o,c)}}moveAndHover(t,r,i,n,s){const a=this.mirror.getNode(i);if(!a)return this.debugNodeNotFound(s,i);const l=nt(a,this.iframe),u=t*l.absoluteScale+l.x,o=r*l.absoluteScale+l.y;this.mouse.style.left=`${u}px`,this.mouse.style.top=`${o}px`,n||this.drawMouseTail({x:u,y:o}),this.hoverElements(a)}drawMouseTail(t){if(!this.mouseTail)return;const{lineCap:r,lineWidth:i,strokeStyle:n,duration:s}=this.config.mouseTail===!0?we:Object.assign({},we,this.config.mouseTail),a=()=>{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=i,l.lineCap=r,l.strokeStyle=n,l.moveTo(this.tailPositions[0].x,this.tailPositions[0].y),this.tailPositions.forEach(u=>l.lineTo(u.x,u.y)),l.stroke())};this.tailPositions.push(t),a(),setTimeout(()=>{this.tailPositions=this.tailPositions.filter(l=>l!==t),a()},s/this.speedService.state.context.timer.speed)}hoverElements(t){var r;(r=this.iframe.contentDocument)==null||r.querySelectorAll(".\\:hover").forEach(n=>{n.classList.remove(":hover")});let i=t;for(;i;)i.classList&&i.classList.add(":hover"),i=i.parentElement}isUserInteraction(t){return t.type!==M.IncrementalSnapshot?!1:t.data.source>x.Mutation&&t.data.source<=x.Input}backToNormal(){this.nextUserInteractionEvent=null,!this.speedService.state.matches("normal")&&(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(D.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))}warnNodeNotFound(t,r){this.warn(`Node with id '${r}' not found. `,t)}warnCanvasMutationFailed(t,r){this.warn("Has error on canvas update",r,"canvas mutation:",t)}debugNodeNotFound(t,r){this.debug(Ee,`Node with id '${r}' not found. `,t)}warn(...t){!this.config.showWarning||console.warn(Ee,...t)}debug(...t){!this.config.showDebug||console.log(Ee,...t)}}return ue.Replayer=Rr,Object.defineProperty(ue,"__esModule",{value:!0}),ue}({});
16
+ or you can use record.mirror to access the mirror instance during recording.`;let _e={map:{},getId(){return console.error(F),-1},getNode(){return console.error(F),null},removeNodeFromMap(){console.error(F)},has(){return console.error(F),!1},reset(){console.error(F)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(_e=new Proxy(_e,{get(t,e,i){return e==="map"&&console.error(F),Reflect.get(t,e,i)}}));function Ot(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=function(e){if(!(0 in arguments))throw new TypeError("1 argument is required");do if(this===e)return!0;while(e=e&&e.parentNode);return!1})}function _t(t){const e={},i=(o,r)=>{const a={value:o,parent:r,children:[]};return e[o.node.id]=a,a},s=[];for(const o of t){const{nextId:r,parentId:a}=o;if(r&&r in e){const c=e[r];if(c.parent){const d=c.parent.children.indexOf(c);c.parent.children.splice(d,0,i(o,c.parent))}else{const d=s.indexOf(c);s.splice(d,0,i(o,null))}continue}if(a in e){const c=e[a];c.children.push(i(o,c));continue}s.push(i(o,null))}return s}function Le(t,e){e(t.value);for(let i=t.children.length-1;i>=0;i--)Le(t.children[i],e)}function ie(t,e){return Boolean(t.nodeName==="IFRAME"&&e.getMeta(t))}function ke(t,e){var i,s;const o=(s=(i=t.ownerDocument)==null?void 0:i.defaultView)==null?void 0:s.frameElement;if(!o||o===e)return{x:0,y:0,relativeScale:1,absoluteScale:1};const r=o.getBoundingClientRect(),a=ke(o,e),c=r.height/o.clientHeight;return{x:r.x*a.relativeScale+a.x,y:r.y*a.relativeScale+a.y,relativeScale:c,absoluteScale:a.absoluteScale*c}}function Pe(t){return Boolean(t?.shadowRoot)}function W(t,e){const i=t[e[0]];return e.length===1?i:W(i.cssRules[e[1]].cssRules,e.slice(2))}function Fe(t){const e=[...t],i=e.pop();return{positions:e,index:i}}function Lt(t){const e=new Set,i=[];for(let s=t.length;s--;){const o=t[s];e.has(o.id)||(i.push(o),e.add(o.id))}return i}const kt=t=>[`.${t} { background: currentColor }`,"noscript { display: none !important; }",`.${t} { background: currentColor; border-radius: 5px; }`,`.${t}:hover::after {content: 'Redacted'; color: white; background: black; text-align: center; width: 100%; display: block;}`];for(var Ve="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",j=typeof Uint8Array>"u"?[]:new Uint8Array(256),X=0;X<Ve.length;X++)j[Ve.charCodeAt(X)]=X;var Pt=function(t){var e=t.length*.75,i=t.length,s,o=0,r,a,c,d;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);var n=new ArrayBuffer(e),l=new Uint8Array(n);for(s=0;s<i;s+=4)r=j[t.charCodeAt(s)],a=j[t.charCodeAt(s+1)],c=j[t.charCodeAt(s+2)],d=j[t.charCodeAt(s+3)],l[o++]=r<<2|a>>4,l[o++]=(a&15)<<4|c>>2,l[o++]=(c&3)<<6|d&63;return n},Ft=(t,e,i)=>new Promise((s,o)=>{var r=d=>{try{c(i.next(d))}catch(n){o(n)}},a=d=>{try{c(i.throw(d))}catch(n){o(n)}},c=d=>d.done?s(d.value):Promise.resolve(d.value).then(r,a);c((i=i.apply(t,e)).next())});const Be=new Map;function Ue(t,e){let i=Be.get(t);return i||(i=new Map,Be.set(t,i)),i.has(e)||i.set(e,[]),i.get(e)}function _(t,e,i){return s=>Ft(this,null,function*(){if(s&&typeof s=="object"&&"rr_type"in s)if(i&&(i.isUnchanged=!1),s.rr_type==="ImageBitmap"&&"args"in s){const o=yield _(t,e,i)(s.args);return yield createImageBitmap.apply(null,o)}else if("index"in s){if(i||e===null)return s;const{rr_type:o,index:r}=s;return Ue(e,o)[r]}else if("args"in s){const{rr_type:o,args:r}=s,a=window[o];return new a(...yield Promise.all(r.map(_(t,e,i))))}else{if("base64"in s)return Pt(s.base64);if("src"in s){const o=t.get(s.src);if(o)return o;{const r=new Image;return r.src=s.src,t.set(s.src,r),r}}else if("data"in s&&s.rr_type==="Blob"){const o=yield Promise.all(s.data.map(_(t,e,i)));return new Blob(o,{type:s.type})}}else if(Array.isArray(s))return yield Promise.all(s.map(_(t,e,i)));return s})}var Vt=(t,e,i)=>new Promise((s,o)=>{var r=d=>{try{c(i.next(d))}catch(n){o(n)}},a=d=>{try{c(i.throw(d))}catch(n){o(n)}},c=d=>d.done?s(d.value):Promise.resolve(d.value).then(r,a);c((i=i.apply(t,e)).next())});function Bt(t,e){try{return e===Y.WebGL?t.getContext("webgl")||t.getContext("experimental-webgl"):t.getContext("webgl2")}catch{return null}}const Ut=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function $t(t,e){if(!(e!=null&&e.constructor))return;const{name:i}=e.constructor;if(!Ut.includes(i))return;const s=Ue(t,i);s.includes(e)||s.push(e)}function Wt(t){return Vt(this,arguments,function*({mutation:e,target:i,type:s,imageMap:o,errorHandler:r}){try{const a=Bt(i,s);if(!a)return;if(e.setter){a[e.property]=e.args[0];return}const c=a[e.property],d=yield Promise.all(e.args.map(_(o,a))),n=c.apply(a,d);$t(a,n)}catch(a){r(e,a)}})}var jt=(t,e,i)=>new Promise((s,o)=>{var r=d=>{try{c(i.next(d))}catch(n){o(n)}},a=d=>{try{c(i.throw(d))}catch(n){o(n)}},c=d=>d.done?s(d.value):Promise.resolve(d.value).then(r,a);c((i=i.apply(t,e)).next())});function Yt(t){return jt(this,arguments,function*({event:e,mutation:i,target:s,imageMap:o,errorHandler:r}){try{const a=s.getContext("2d");if(i.setter){a[i.property]=i.args[0];return}const c=a[i.property];if(i.property==="drawImage"&&typeof i.args[0]=="string"){const d=o.get(e);c.apply(a,i.args)}else{const d=yield Promise.all(i.args.map(_(o,a)));c.apply(a,d)}}catch(a){r(i,a)}})}var Gt=(t,e,i)=>new Promise((s,o)=>{var r=d=>{try{c(i.next(d))}catch(n){o(n)}},a=d=>{try{c(i.throw(d))}catch(n){o(n)}},c=d=>d.done?s(d.value):Promise.resolve(d.value).then(r,a);c((i=i.apply(t,e)).next())});function $e(t){return Gt(this,arguments,function*({event:e,mutation:i,target:s,imageMap:o,canvasEventMap:r,errorHandler:a}){try{const c=r.get(e)||i,d="commands"in c?c.commands:[c];if([Y.WebGL,Y.WebGL2].includes(i.type)){for(let n=0;n<d.length;n++){const l=d[n];yield Wt({mutation:l,type:i.type,target:s,imageMap:o,errorHandler:a})}return}for(let n=0;n<d.length;n++){const l=d[n];yield Yt({event:e,mutation:l,target:s,imageMap:o,errorHandler:a})}}catch(c){a(i,c)}})}var Ht=Object.defineProperty,zt=Object.defineProperties,Xt=Object.getOwnPropertyDescriptors,We=Object.getOwnPropertySymbols,Qt=Object.prototype.hasOwnProperty,qt=Object.prototype.propertyIsEnumerable,je=(t,e,i)=>e in t?Ht(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,V=(t,e)=>{for(var i in e||(e={}))Qt.call(e,i)&&je(t,i,e[i]);if(We)for(var i of We(e))qt.call(e,i)&&je(t,i,e[i]);return t},se=(t,e)=>zt(t,Xt(e)),oe=(t,e,i)=>new Promise((s,o)=>{var r=d=>{try{c(i.next(d))}catch(n){o(n)}},a=d=>{try{c(i.throw(d))}catch(n){o(n)}},c=d=>d.done?s(d.value):Promise.resolve(d.value).then(r,a);c((i=i.apply(t,e)).next())});const Ye=10*1e3,Ge=2*1e3,He=1*1e3,ze=60*60*1e3,Jt=Ee||Et,ne="[replayer]",re={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function ae(t){return t.type==D.IncrementalSnapshot&&(t.data.source==R.TouchMove||t.data.source==R.MouseInteraction&&t.data.type==x.TouchStart)}class Zt{constructor(e,i){if(this.usingVirtualDom=!1,this.virtualDom=new k,this.mouseTail=null,this.tailPositions=[],this.emitter=Jt(),this.activityIntervals=[],this.legacy_missingNodeRetryMap={},this.cache=y.createCache(),this.imageMap=new Map,this.canvasEventMap=new Map,this.mirror=y.createMirror(),this.firstFullSnapshot=null,this.newDocumentQueue=[],this.mousePos=null,this.touchActive=null,!(i!=null&&i.liveMode)&&e.length<2)throw new Error("Replayer need at least 2 events.");const s={speed:1,maxSpeed:360,root:document.body,loadTimeout:0,skipInactive:!1,showWarning:!0,showDebug:!1,blockClass:"highlight-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:re,useVirtualDom:!0,inactiveThreshold:.02,inactiveSkipTime:Ge};this.config=Object.assign({},s,i),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on(N.Resize,this.handleResize),this.setupDom(),this.emitter.on(N.Flush,()=>{if(this.usingVirtualDom){const c={mirror:this.mirror,applyCanvas:(d,n,l)=>{$e({event:d,mutation:n,target:l,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this)};if(A(this.iframe.contentDocument,this.virtualDom,c,this.virtualDom.mirror),this.virtualDom.destroyTree(),this.usingVirtualDom=!1,Object.keys(this.legacy_missingNodeRetryMap).length)for(const d in this.legacy_missingNodeRetryMap)try{const n=this.legacy_missingNodeRetryMap[d],l=Z(n.node,this.mirror,this.virtualDom.mirror);A(l,n.node,c,this.virtualDom.mirror),n.node=l}catch(n){this.config.showWarning&&console.warn(n)}}this.mousePos&&this.moveAndHover(this.mousePos.x,this.mousePos.y,this.mousePos.id,!0,this.mousePos.debugData),this.mousePos=null}),this.emitter.on(N.PlayBack,()=>{this.firstFullSnapshot=null,this.mirror.reset()});const o=new bt([],i?.speed||s.speed);this.service=It({events:e.map(c=>i&&i.unpackFn?i.unpackFn(c):c).sort((c,d)=>c.timestamp-d.timestamp),timer:o,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe(c=>{this.emitter.emit(N.StateChange,{player:c})}),this.speedService=At({normalSpeed:-1,timer:o}),this.speedService.start(),this.speedService.subscribe(c=>{this.emitter.emit(N.StateChange,{speed:c})});const r=this.service.state.context.events.find(c=>c.type===D.Meta),a=this.service.state.context.events.find(c=>c.type===D.FullSnapshot);if(r){const{width:c,height:d}=r.data;setTimeout(()=>{this.emitter.emit(N.Resize,{width:c,height:d})},0)}a&&setTimeout(()=>{this.firstFullSnapshot||(this.firstFullSnapshot=a,this.rebuildFullSnapshot(a),this.iframe.contentWindow.scrollTo(a.data.initialOffset))},1),this.service.state.context.events.find(ae)&&this.mouse.classList.add("touch-device")}get timer(){return this.service.state.context.timer}on(e,i){return this.emitter.on(e,i),this}off(e,i){return this.emitter.off(e,i),this}setConfig(e){Object.keys(e).forEach(i=>{this.config[i]=e[i]}),this.config.skipInactive||this.backToNormal(),typeof e.speed<"u"&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}}),typeof e.mouseTail<"u"&&(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=[],i=this.getMetaData(),s=[{timestamp:i.startTime},...this.service.state.context.events.filter(a=>this.isUserInteraction(a)),{timestamp:i.endTime}];for(let a=1;a<s.length;a++){const c=s[a-1],d=s[a];d.timestamp-c.timestamp>Ye?e.push({startTime:c.timestamp,endTime:d.timestamp,duration:d.timestamp-c.timestamp,active:!1}):e.push({startTime:c.timestamp,endTime:d.timestamp,duration:d.timestamp-c.timestamp,active:!0})}const o=[];let r=e[0];for(let a=1;a<e.length;a++)e[a].active!=e[a-1].active&&(o.push({startTime:r.startTime,endTime:e[a-1].endTime,duration:e[a-1].endTime-r.startTime,active:e[a-1].active}),r=e[a]);r&&e.length>0&&o.push({startTime:r.startTime,endTime:e[e.length-1].endTime,duration:e[e.length-1].endTime-r.startTime,active:e[e.length-1].active}),r=o[0];for(let a=1;a<o.length;a++)(!o[a].active&&o[a].duration>this.config.inactiveThreshold*i.totalTime||!o[a-1].active&&o[a-1].duration>this.config.inactiveThreshold*i.totalTime)&&(this.activityIntervals.push({startTime:r.startTime,endTime:o[a-1].endTime,duration:o[a-1].endTime-r.startTime,active:o[a-1].active}),r=o[a]);r&&o.length>0&&this.activityIntervals.push({startTime:r.startTime,endTime:o[o.length-1].endTime,duration:o[o.length-1].endTime-r.startTime,active:o[o.length-1].active})}return this.activityIntervals}getMetaData(){const e=this.service.state.context.events[0],i=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:e.timestamp,endTime:i.timestamp,totalTime:i.timestamp-e.timestamp}}getCurrentTime(){return this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){const{baselineTime:e,events:i}=this.service.state.context;return e-i[0].timestamp}getMirror(){return this.mirror}play(e=0){var i,s;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}})),(s=(i=this.iframe.contentDocument)==null?void 0:i.getElementsByTagName("html")[0])==null||s.classList.remove("rrweb-paused"),this.emitter.emit(N.Start),this.handleInactivity(this.getMetaData().startTime+e,!0)}pause(e){var i,s;e===void 0&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),typeof e=="number"&&(this.play(e),this.service.send({type:"PAUSE"})),(s=(i=this.iframe.contentDocument)==null?void 0:i.getElementsByTagName("html")[0])==null||s.classList.add("rrweb-paused"),this.emitter.emit(N.Pause)}resume(e=0){console.warn("The 'resume' will be departed in 1.0. Please use 'play' method which has the same interface."),this.play(e),this.emitter.emit(N.Resume)}startLive(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})}addEvent(e){const i=this.config.unpackFn?this.config.unpackFn(e):e;ae(i)&&this.mouse.classList.add("touch-device"),Promise.resolve().then(()=>this.service.send({type:"ADD_EVENT",payload:{event:i}}))}replaceEvents(e){for(const i of e)if(ae(i)){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=y.createCache()}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&&(Dt(this.iframe.contentWindow,this.iframe.contentDocument),Ot(this.iframe.contentWindow))}handleResize(e){this.iframe.style.display="inherit";for(const i of[this.mouseTail,this.iframe])!i||(i.setAttribute("width",String(e.width)),i.setAttribute("height",String(e.height)))}applyEventsSynchronously(e){for(const i of e){switch(i.type){case D.DomContentLoaded:case D.Load:case D.Custom:continue;case D.FullSnapshot:case D.Meta:case D.Plugin:case D.IncrementalSnapshot:break}this.getCastFn(i,!0)()}this.touchActive===!0?this.mouse.classList.add("touch-active"):this.touchActive===!1&&this.mouse.classList.remove("touch-active"),this.touchActive=null}getCastFn(e,i=!1){let s;switch(e.type){case D.DomContentLoaded:case D.Load:break;case D.Custom:s=()=>{this.emitter.emit(N.CustomEvent,e)};break;case D.Meta:s=()=>this.emitter.emit(N.Resize,{width:e.data.width,height:e.data.height});break;case D.FullSnapshot:s=()=>{if(this.firstFullSnapshot){if(this.firstFullSnapshot===e){this.firstFullSnapshot=!0;return}}else this.firstFullSnapshot=!0;this.rebuildFullSnapshot(e,i),this.iframe.contentWindow.scrollTo(e.data.initialOffset)};break;case D.IncrementalSnapshot:s=()=>{if(this.applyIncremental(e,i),!i&&(this.handleInactivity(e.timestamp),e===this.nextUserInteractionEvent&&(this.nextUserInteractionEvent=null,this.backToNormal()),this.config.skipInactive&&!this.nextUserInteractionEvent)){for(const o of this.service.state.context.events)if(!(o.timestamp<=e.timestamp)&&this.isUserInteraction(o)){o.delay-e.delay>Ye*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=o);break}if(this.nextUserInteractionEvent){const o=this.nextUserInteractionEvent.delay-e.delay,r={speed:Math.min(Math.round(o/Ge),this.config.maxSpeed)};this.speedService.send({type:"FAST_FORWARD",payload:r}),this.emitter.emit(N.SkipStart,r)}}};break}return()=>{s&&s();for(const r of this.config.plugins||[])r.handler(e,i,{replayer:this});this.service.send({type:"CAST_EVENT",payload:{event:e}});const o=this.service.state.context.events.length-1;if(e===this.service.state.context.events[o]){const r=()=>{o<this.service.state.context.events.length-1||(this.backToNormal(),this.service.send("END"),this.emitter.emit(N.Finish))};e.type===D.IncrementalSnapshot&&e.data.source===R.MouseMove&&e.data.positions.length?setTimeout(()=>{r()},Math.max(0,-e.data.positions[0].timeOffset+50)):r()}this.emitter.emit(N.EventCast,e)}}handleInactivity(e,i){if((e===this.inactiveEndTimestamp||i)&&(this.inactiveEndTimestamp=null,this.backToNormal()),this.config.skipInactive&&!this.inactiveEndTimestamp){for(const s of this.getActivityIntervals())if(e>=s.startTime&&e<s.endTime&&!s.active){this.inactiveEndTimestamp=s.endTime;break}if(this.inactiveEndTimestamp){const s=this.inactiveEndTimestamp-e,o={speed:s/ze*this.config.inactiveSkipTime<He?s/He:Math.round(Math.max(s,ze)/this.config.inactiveSkipTime)};this.speedService.send({type:"FAST_FORWARD",payload:o}),this.emitter.emit(N.SkipStart,o)}}}rebuildFullSnapshot(e,i=!1){if(!this.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&console.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={};const s=[];y.rebuild(e.data.node,{doc:this.iframe.contentDocument,afterAppend:a=>{this.collectIframeAndAttachDocument(s,a)},cache:this.cache,mirror:this.mirror});for(const{mutationInQueue:a,builtNode:c}of s)this.attachDocumentToIframe(a,c),this.newDocumentQueue=this.newDocumentQueue.filter(d=>d!==a);const{documentElement:o,head:r}=this.iframe.contentDocument;this.insertStyleRules(o,r),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(N.FullsnapshotRebuilded,e),i||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()}insertStyleRules(e,i){const s=kt(this.config.blockClass).concat(this.config.insertStyleRules);if(this.config.pauseAnimation&&s.push("html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }"),this.usingVirtualDom){const o=this.virtualDom.createElement("style");this.virtualDom.mirror.add(o,Ne(o,this.virtualDom.unserializedId)),e.insertBefore(o,i);for(let r=0;r<s.length;r++)o.rules.push({cssText:s[r],type:M.Insert,index:r})}else{const o=document.createElement("style");e.insertBefore(o,i);for(let r=0;r<s.length;r++)o.sheet.insertRule(s[r],r)}}attachDocumentToIframe(e,i){const s=this.usingVirtualDom?this.virtualDom.mirror:this.mirror,o=[];y.buildNodeWithSN(e.node,{doc:i.contentDocument,mirror:s,hackCss:!0,skipChild:!1,afterAppend:r=>{this.collectIframeAndAttachDocument(o,r);const a=s.getMeta(r);if(a?.type===y.NodeType.Element&&a?.tagName.toUpperCase()==="HTML"){const{documentElement:c,head:d}=i.contentDocument;this.insertStyleRules(c,d)}},cache:this.cache});for(const{mutationInQueue:r,builtNode:a}of o)this.attachDocumentToIframe(r,a),this.newDocumentQueue=this.newDocumentQueue.filter(c=>c!==r)}collectIframeAndAttachDocument(e,i){if(ie(i,this.mirror)){const s=this.newDocumentQueue.find(o=>o.parentId===this.mirror.getId(i));s&&e.push({mutationInQueue:s,builtNode:i})}}waitForStylesheetLoad(){var e;const i=(e=this.iframe.contentDocument)==null?void 0:e.head;if(i){const s=new Set;let o,r=this.service.state;const a=()=>{r=this.service.state};this.emitter.on(N.Start,a),this.emitter.on(N.Pause,a);const c=()=>{this.emitter.off(N.Start,a),this.emitter.off(N.Pause,a)};i.querySelectorAll('link[rel="stylesheet"]').forEach(d=>{d.sheet||(s.add(d),d.addEventListener("load",()=>{s.delete(d),s.size===0&&o!==-1&&(r.matches("playing")&&this.play(this.getCurrentTime()),this.emitter.emit(N.LoadStylesheetEnd),o&&clearTimeout(o),c())}))}),s.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(N.LoadStylesheetStart),o=setTimeout(()=>{r.matches("playing")&&this.play(this.getCurrentTime()),o=-1,c()},this.config.loadTimeout))}}hasImageArg(e){for(const i of e)if(!(!i||typeof i!="object")){if("rr_type"in i&&"args"in i){if(this.hasImageArg(i.args))return!0}else if("rr_type"in i&&i.rr_type==="HTMLImageElement"||i instanceof Array&&this.hasImageArg(i))return!0}return!1}getImageArgs(e){const i=[];for(const s of e)!s||typeof s!="object"||("rr_type"in s&&"args"in s?i.push(...this.getImageArgs(s.args)):"rr_type"in s&&s.rr_type==="HTMLImageElement"?i.push(s.src):s instanceof Array&&i.push(...this.getImageArgs(s)));return i}preloadAllImages(){return oe(this,null,function*(){this.service.state;const e=()=>{this.service.state};this.emitter.on(N.Start,e),this.emitter.on(N.Pause,e);const i=[];for(const s of this.service.state.context.events)s.type===D.IncrementalSnapshot&&s.data.source===R.CanvasMutation&&(i.push(this.deserializeAndPreloadCanvasEvents(s.data,s)),("commands"in s.data?s.data.commands:[s.data]).forEach(o=>{this.preloadImages(o,s)}));return Promise.all(i)})}preloadImages(e,i){if(e.property==="drawImage"&&typeof e.args[0]=="string"&&!this.imageMap.has(i)){const s=document.createElement("canvas"),o=s.getContext("2d"),r=o?.createImageData(s.width,s.height);r?.data,JSON.parse(e.args[0]),o?.putImageData(r,0,0)}}deserializeAndPreloadCanvasEvents(e,i){return oe(this,null,function*(){if(!this.canvasEventMap.has(i)){const s={isUnchanged:!0};if("commands"in e){const o=yield Promise.all(e.commands.map(r=>oe(this,null,function*(){const a=yield Promise.all(r.args.map(_(this.imageMap,null,s)));return se(V({},r),{args:a})})));s.isUnchanged===!1&&this.canvasEventMap.set(i,se(V({},e),{commands:o}))}else{const o=yield Promise.all(e.args.map(_(this.imageMap,null,s)));s.isUnchanged===!1&&this.canvasEventMap.set(i,se(V({},e),{args:o}))}}})}applyIncremental(e,i){var s,o,r,a,c,d;const{data:n}=e;switch(n.source){case R.Mutation:{try{this.applyMutation(n,i)}catch(l){this.warn(`Exception in mutation ${l.message||l}`,n)}break}case R.Drag:case R.TouchMove:case R.MouseMove:if(i){const l=n.positions[n.positions.length-1];this.mousePos={x:l.x,y:l.y,id:l.id,debugData:n}}else n.positions.forEach(l=>{const u={doAction:()=>{this.moveAndHover(l.x,l.y,l.id,i,n)},delay:l.timeOffset+e.timestamp-this.service.state.context.baselineTime};this.timer.addAction(u)}),this.timer.addAction({doAction(){},delay:e.delay-((s=n.positions[0])==null?void 0:s.timeOffset)});break;case R.MouseInteraction:{if(n.id===-1||i)break;const l=new Event(x[n.type].toLowerCase()),u=this.mirror.getNode(n.id);if(!u)return this.debugNodeNotFound(n,n.id);this.emitter.emit(N.MouseInteraction,{type:n.type,target:u});const{triggerFocus:m}=this.config;switch(n.type){case x.Blur:"blur"in u&&u.blur();break;case x.Focus:m&&u.focus&&u.focus({preventScroll:!0});break;case x.Click:case x.TouchStart:case x.TouchEnd:i?(n.type===x.TouchStart?this.touchActive=!0:n.type===x.TouchEnd&&(this.touchActive=!1),this.mousePos={x:n.x,y:n.y,id:n.id,debugData:n}):(n.type===x.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(n.x,n.y,n.id,i,n),n.type===x.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):n.type===x.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):n.type===x.TouchEnd&&this.mouse.classList.remove("touch-active"));break;case x.TouchCancel:i?this.touchActive=!1:this.mouse.classList.remove("touch-active");break;default:u.dispatchEvent(l)}break}case R.Scroll:{if(n.id===-1)break;if(this.usingVirtualDom){const l=this.virtualDom.mirror.getNode(n.id);if(!l)return this.debugNodeNotFound(n,n.id);l.scrollData=n;break}this.applyScroll(n,i);break}case R.ViewportResize:this.emitter.emit(N.Resize,{width:n.width,height:n.height});break;case R.Input:{if(n.id===-1)break;if(this.usingVirtualDom){const l=this.virtualDom.mirror.getNode(n.id);if(!l)return this.debugNodeNotFound(n,n.id);l.inputData=n;break}this.applyInput(n);break}case R.MediaInteraction:{const l=this.usingVirtualDom?this.virtualDom.mirror.getNode(n.id):this.mirror.getNode(n.id);if(!l)return this.debugNodeNotFound(n,n.id);const u=l;try{n.currentTime&&(u.currentTime=n.currentTime),n.volume&&(u.volume=n.volume),n.muted&&(u.muted=n.muted),n.type===K.Pause&&u.pause(),n.type===K.Play&&u.play()}catch(m){this.config.showWarning&&console.warn(`Failed to replay media interactions: ${m.message||m}`)}break}case R.StyleSheetRule:{if(this.usingVirtualDom){const l=this.virtualDom.mirror.getNode(n.id);if(!l)return this.debugNodeNotFound(n,n.id);const u=l.rules;(o=n.adds)==null||o.forEach(({rule:m,index:p})=>u?.push({cssText:m,index:p,type:M.Insert})),(r=n.removes)==null||r.forEach(({index:m})=>u?.push({index:m,type:M.Remove}))}else{const l=this.mirror.getNode(n.id);if(!l)return this.debugNodeNotFound(n,n.id);const u=l.sheet;(a=n.adds)==null||a.forEach(({rule:m,index:p})=>{try{if(Array.isArray(p)){const{positions:T,index:g}=Fe(p);W(u.cssRules,T).insertRule(m,g)}else{const T=p===void 0?void 0:Math.min(p,u.cssRules.length);u.insertRule(m,T)}}catch{}}),(c=n.removes)==null||c.forEach(({index:m})=>{try{if(Array.isArray(m)){const{positions:p,index:T}=Fe(m);W(u.cssRules,p).deleteRule(T||0)}else u?.deleteRule(m)}catch{}})}break}case R.StyleDeclaration:{if(this.usingVirtualDom){const l=this.virtualDom.mirror.getNode(n.id);if(!l)return this.debugNodeNotFound(n,n.id);const u=l.rules;n.set&&u.push(V({type:M.SetProperty,index:n.index},n.set)),n.remove&&u.push(V({type:M.RemoveProperty,index:n.index},n.remove))}else{const l=this.mirror.getNode(n.id);if(!l)return this.debugNodeNotFound(n,n.id);const u=l.sheet;n.set&&W(u.rules,n.index).style.setProperty(n.set.property,n.set.value,n.set.priority),n.remove&&W(u.rules,n.index).style.removeProperty(n.remove.property)}break}case R.CanvasMutation:{if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){const l=this.virtualDom.mirror.getNode(n.id);if(!l)return this.debugNodeNotFound(n,n.id);l.canvasMutations.push({event:e,mutation:n})}else{const l=this.mirror.getNode(n.id);if(!l)return this.debugNodeNotFound(n,n.id);$e({event:e,mutation:n,target:l,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})}break}case R.Font:{try{const l=new FontFace(n.family,n.buffer?new Uint8Array(JSON.parse(n.fontSource)):n.fontSource,n.descriptors);(d=this.iframe.contentDocument)==null||d.fonts.add(l)}catch(l){this.config.showWarning&&console.warn(l)}break}}}applyMutation(e,i){if(this.config.useVirtualDom&&!this.usingVirtualDom&&i&&(this.usingVirtualDom=!0,vt(this.iframe.contentDocument,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length))for(const n in this.legacy_missingNodeRetryMap)try{const l=this.legacy_missingNodeRetryMap[n],u=Te(l.node,this.virtualDom,this.mirror);u&&(l.node=u)}catch(l){this.config.showWarning&&console.warn(l)}const s=this.usingVirtualDom?this.virtualDom.mirror:this.mirror;e.removes.forEach(n=>{var l;const u=s.getNode(n.id);if(!u)return e.removes.find(p=>p.id===n.parentId)?void 0:this.warnNodeNotFound(e,n.id);let m=s.getNode(n.parentId);if(!m)return this.warnNodeNotFound(e,n.parentId);if(n.isShadow&&Pe(m)&&(m=m.shadowRoot),s.removeNodeFromMap(u),m)try{m.removeChild(u),this.usingVirtualDom&&u.nodeName==="#text"&&m.nodeName==="STYLE"&&((l=m.rules)==null?void 0:l.length)>0&&(m.rules=[])}catch(p){if(p instanceof DOMException)this.warn("parent could not remove child in mutation",m,u,e);else throw p}});const o=V({},this.legacy_missingNodeRetryMap),r=[],a=n=>{let l=null;return n.nextId&&(l=s.getNode(n.nextId)),n.nextId!==null&&n.nextId!==void 0&&n.nextId!==-1&&!l},c=n=>{var l;if(!this.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");let u=s.getNode(n.parentId);if(!u)return n.node.type===y.NodeType.Document?this.newDocumentQueue.push(n):r.push(n);n.node.isShadow&&(Pe(u)||u.attachShadow({mode:"open"}),u=u.shadowRoot);let m=null,p=null;if(n.previousId&&(m=s.getNode(n.previousId)),n.nextId&&(p=s.getNode(n.nextId)),a(n))return r.push(n);if(n.node.rootId&&!s.getNode(n.node.rootId))return;const T=n.node.rootId?s.getNode(n.node.rootId):this.usingVirtualDom?this.virtualDom:this.iframe.contentDocument;if(ie(u,s)){this.attachDocumentToIframe(n,u);return}const g=y.buildNodeWithSN(n.node,{doc:T,mirror:s,skipChild:!0,hackCss:!0,cache:this.cache});if(n.previousId===-1||n.nextId===-1){o[n.node.id]={node:g,mutation:n};return}const f=s.getMeta(u);if(f&&f.type===y.NodeType.Element&&f.tagName==="textarea"&&n.node.type===y.NodeType.Text){const h=Array.isArray(u.childNodes)?u.childNodes:Array.from(u.childNodes);for(const v of h)v.nodeType===u.TEXT_NODE&&u.removeChild(v)}if(m&&m.nextSibling&&m.nextSibling.parentNode)u.insertBefore(g,m.nextSibling);else if(p&&p.parentNode)u.contains(p)?u.insertBefore(g,p):u.insertBefore(g,null);else{if(u===T)for(;T.firstChild;)T.removeChild(T.firstChild);u.appendChild(g)}if(this.usingVirtualDom&&g.nodeName==="#text"&&u.nodeName==="STYLE"&&((l=u.rules)==null?void 0:l.length)>0&&(u.rules=[]),ie(g,this.mirror)){const h=this.mirror.getId(g),v=this.newDocumentQueue.find(E=>E.parentId===h);v&&(this.attachDocumentToIframe(v,g),this.newDocumentQueue=this.newDocumentQueue.filter(E=>E!==v))}(n.previousId||n.nextId)&&this.legacy_resolveMissingNode(o,u,g,n)};e.adds.forEach(n=>{c(n)});const d=Date.now();for(;r.length;){const n=_t(r);if(r.length=0,Date.now()-d>500){this.warn("Timeout in the loop, please check the resolve tree data:",n);break}for(const l of n)s.getNode(l.value.parentId)?Le(l,u=>{c(u)}):this.debug("Drop resolve tree since there is no parent for the root node.",l)}Object.keys(o).length&&Object.assign(this.legacy_missingNodeRetryMap,o),Lt(e.texts).forEach(n=>{var l;const u=s.getNode(n.id);if(!u)return e.removes.find(m=>m.id===n.id)?void 0:this.warnNodeNotFound(e,n.id);if(u.textContent=n.value,this.usingVirtualDom){const m=u.parentNode;((l=m?.rules)==null?void 0:l.length)>0&&(m.rules=[])}}),e.attributes.forEach(n=>{const l=s.getNode(n.id);if(!l)return e.removes.find(u=>u.id===n.id)?void 0:this.warnNodeNotFound(e,n.id);for(const u in n.attributes)if(typeof u=="string"){const m=n.attributes[u];if(m===null)l.removeAttribute(u);else if(typeof m=="string")try{l.setAttribute(u,m)}catch(p){this.config.showWarning&&console.warn("An error occurred may due to the checkout feature.",p)}else if(u==="style"){const p=m,T=l;for(const g in p)if(p[g]===!1)T.style.removeProperty(g);else if(p[g]instanceof Array){const f=p[g];T.style.setProperty(g,f[0],f[1])}else{const f=p[g];T.style.setProperty(g,f)}}}})}applyScroll(e,i){const s=this.mirror.getNode(e.id);if(!s)return this.debugNodeNotFound(e,e.id);const o=this.mirror.getMeta(s);if(s===this.iframe.contentDocument)this.iframe.contentWindow.scrollTo({top:e.y,left:e.x,behavior:i?"auto":"smooth"});else if(o?.type===y.NodeType.Document)s.defaultView.scrollTo({top:e.y,left:e.x,behavior:i?"auto":"smooth"});else try{s.scrollTop=e.y,s.scrollLeft=e.x}catch{}}applyInput(e){const i=this.mirror.getNode(e.id);if(!i)return this.debugNodeNotFound(e,e.id);try{i.checked=e.isChecked,i.value=e.text}catch{}}legacy_resolveMissingNode(e,i,s,o){const{previousId:r,nextId:a}=o,c=r&&e[r],d=a&&e[a];if(c){const{node:n,mutation:l}=c;i.insertBefore(n,s),delete e[l.node.id],delete this.legacy_missingNodeRetryMap[l.node.id],(l.previousId||l.nextId)&&this.legacy_resolveMissingNode(e,i,n,l)}if(d){const{node:n,mutation:l}=d;i.insertBefore(n,s.nextSibling),delete e[l.node.id],delete this.legacy_missingNodeRetryMap[l.node.id],(l.previousId||l.nextId)&&this.legacy_resolveMissingNode(e,i,n,l)}}moveAndHover(e,i,s,o,r){const a=this.mirror.getNode(s);if(!a)return this.debugNodeNotFound(r,s);const c=ke(a,this.iframe),d=e*c.absoluteScale+c.x,n=i*c.absoluteScale+c.y;this.mouse.style.left=`${d}px`,this.mouse.style.top=`${n}px`,o||this.drawMouseTail({x:d,y:n}),this.hoverElements(a)}drawMouseTail(e){if(!this.mouseTail)return;const{lineCap:i,lineWidth:s,strokeStyle:o,duration:r}=this.config.mouseTail===!0?re:Object.assign({},re,this.config.mouseTail),a=()=>{if(!this.mouseTail)return;const c=this.mouseTail.getContext("2d");!c||!this.tailPositions.length||(c.clearRect(0,0,this.mouseTail.width,this.mouseTail.height),c.beginPath(),c.lineWidth=s,c.lineCap=i,c.strokeStyle=o,c.moveTo(this.tailPositions[0].x,this.tailPositions[0].y),this.tailPositions.forEach(d=>c.lineTo(d.x,d.y)),c.stroke())};this.tailPositions.push(e),a(),setTimeout(()=>{this.tailPositions=this.tailPositions.filter(c=>c!==e),a()},r/this.speedService.state.context.timer.speed)}hoverElements(e){var i;(i=this.iframe.contentDocument)==null||i.querySelectorAll(".\\:hover").forEach(o=>{o.classList.remove(":hover")});let s=e;for(;s;)s.classList&&s.classList.add(":hover"),s=s.parentElement}isUserInteraction(e){return e.type!==D.IncrementalSnapshot?!1:e.data.source>R.Mutation&&e.data.source<=R.Input}backToNormal(){this.nextUserInteractionEvent=null,!this.speedService.state.matches("normal")&&(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(N.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))}warnNodeNotFound(e,i){this.warn(`Node with id '${i}' not found. `,e)}warnCanvasMutationFailed(e,i){this.warn("Has error on canvas update",i,"canvas mutation:",e)}debugNodeNotFound(e,i){this.debug(ne,`Node with id '${i}' not found. `,e)}warn(...e){!this.config.showWarning||console.warn(ne,...e)}debug(...e){!this.config.showDebug||console.log(ne,...e)}}return Q.Replayer=Zt,Object.defineProperty(Q,"__esModule",{value:!0}),Q}({},rrwebSnapshot);
18
17
  //# sourceMappingURL=rrweb-replay.min.js.map