@highlight-run/rrweb 2.0.1 → 2.0.6

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 (118) hide show
  1. package/dist/plugins/console-record.js +12 -655
  2. package/dist/plugins/console-record.min.js +12 -15
  3. package/dist/plugins/console-record.min.js.map +1 -1
  4. package/dist/plugins/console-replay.js +4 -293
  5. package/dist/plugins/console-replay.min.js +4 -15
  6. package/dist/plugins/console-replay.min.js.map +1 -1
  7. package/dist/plugins/sequential-id-record.js +1 -33
  8. package/dist/plugins/sequential-id-record.min.js +1 -1
  9. package/dist/plugins/sequential-id-record.min.js.map +1 -1
  10. package/dist/plugins/sequential-id-replay.js +1 -37
  11. package/dist/plugins/sequential-id-replay.min.js +1 -1
  12. package/dist/plugins/sequential-id-replay.min.js.map +1 -1
  13. package/dist/record/rrweb-record-pack.js +3 -747
  14. package/dist/record/rrweb-record-pack.min.js +3 -15
  15. package/dist/record/rrweb-record-pack.min.js.map +1 -1
  16. package/dist/record/rrweb-record.js +4 -3318
  17. package/dist/record/rrweb-record.min.js +4 -15
  18. package/dist/record/rrweb-record.min.js.map +1 -1
  19. package/dist/replay/rrweb-replay-unpack.css +1 -0
  20. package/dist/replay/rrweb-replay-unpack.js +5 -4614
  21. package/dist/replay/rrweb-replay-unpack.min.js +5 -17
  22. package/dist/replay/rrweb-replay-unpack.min.js.map +1 -1
  23. package/dist/replay/rrweb-replay.css +1 -0
  24. package/dist/replay/rrweb-replay.js +5 -4204
  25. package/dist/replay/rrweb-replay.min.js +5 -17
  26. package/dist/replay/rrweb-replay.min.js.map +1 -1
  27. package/dist/rrweb-all.css +1 -0
  28. package/dist/rrweb-all.js +16 -8696
  29. package/dist/rrweb-all.min.js +16 -17
  30. package/dist/rrweb-all.min.js.map +1 -1
  31. package/dist/rrweb.css +1 -0
  32. package/dist/rrweb.js +6 -7282
  33. package/dist/rrweb.min.js +6 -17
  34. package/dist/rrweb.min.js.map +1 -1
  35. package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js +12 -0
  36. package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js +7 -0
  37. package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +31 -0
  38. package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js +11 -0
  39. package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js +18 -0
  40. package/es/rrweb/_virtual/image-bitmap-data-url-worker.js +6 -0
  41. package/es/rrweb/all.css +1 -0
  42. package/es/rrweb/ext/mitt/dist/mitt.es.js +1 -1
  43. package/es/rrweb/ext/tslib/tslib.es6.js +38 -0
  44. package/es/rrweb/packages/rrdom/es/virtual-dom.js +1099 -0
  45. package/es/rrweb/packages/rrweb/src/index.js +6 -4
  46. package/es/rrweb/packages/rrweb/src/packer/base.js +1 -1
  47. package/es/rrweb/packages/rrweb/src/packer/pack.js +4 -5
  48. package/es/rrweb/packages/rrweb/src/packer/unpack.js +24 -24
  49. package/es/rrweb/packages/rrweb/src/plugins/console/record/error-stack-parser.js +175 -176
  50. package/es/rrweb/packages/rrweb/src/plugins/console/record/index.js +109 -128
  51. package/es/rrweb/packages/rrweb/src/plugins/console/record/stringify.js +125 -138
  52. package/es/rrweb/packages/rrweb/src/plugins/console/replay/index.js +88 -105
  53. package/es/rrweb/packages/rrweb/src/plugins/sequential-id/record/index.js +19 -20
  54. package/es/rrweb/packages/rrweb/src/plugins/sequential-id/replay/index.js +25 -25
  55. package/es/rrweb/packages/rrweb/src/record/iframe-manager.js +29 -30
  56. package/es/rrweb/packages/rrweb/src/record/index.js +348 -373
  57. package/es/rrweb/packages/rrweb/src/record/mutation.js +487 -528
  58. package/es/rrweb/packages/rrweb/src/record/observer.js +584 -659
  59. package/es/rrweb/packages/rrweb/src/record/observers/canvas/2d.js +44 -73
  60. package/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js +166 -87
  61. package/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas.js +21 -26
  62. package/es/rrweb/packages/rrweb/src/record/observers/canvas/serialize-args.js +119 -112
  63. package/es/rrweb/packages/rrweb/src/record/observers/canvas/webgl.js +53 -72
  64. package/es/rrweb/packages/rrweb/src/record/shadow-dom-manager.js +38 -40
  65. package/es/rrweb/packages/rrweb/src/record/stylesheet-manager.js +31 -0
  66. package/es/rrweb/packages/rrweb/src/replay/canvas/2d.js +27 -23
  67. package/es/rrweb/packages/rrweb/src/replay/canvas/deserialize-args.js +67 -0
  68. package/es/rrweb/packages/rrweb/src/replay/canvas/index.js +37 -29
  69. package/es/rrweb/packages/rrweb/src/replay/canvas/webgl.js +58 -120
  70. package/es/rrweb/packages/rrweb/src/replay/index.js +1545 -1854
  71. package/es/rrweb/packages/rrweb/src/replay/machine.js +275 -315
  72. package/es/rrweb/packages/rrweb/src/replay/smoothscroll.js +216 -218
  73. package/es/rrweb/packages/rrweb/src/replay/styles/inject-style.js +7 -7
  74. package/es/rrweb/packages/rrweb/src/replay/timer.js +87 -91
  75. package/es/rrweb/packages/rrweb/src/types.js +72 -72
  76. package/es/rrweb/packages/rrweb/src/utils.js +312 -506
  77. package/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js +190 -72
  78. package/lib/plugins/console-record.js +469 -627
  79. package/lib/plugins/console-replay.js +198 -268
  80. package/lib/plugins/sequential-id-record.js +19 -20
  81. package/lib/plugins/sequential-id-replay.js +25 -25
  82. package/lib/record/rrweb-record-pack.js +184 -139
  83. package/lib/record/rrweb-record.js +2467 -2425
  84. package/lib/replay/rrweb-replay-unpack.css +1 -0
  85. package/lib/replay/rrweb-replay-unpack.js +3798 -3344
  86. package/lib/replay/rrweb-replay.css +1 -0
  87. package/lib/replay/rrweb-replay.js +3743 -3289
  88. package/lib/rrweb-all.css +1 -0
  89. package/lib/rrweb-all.js +6721 -6249
  90. package/lib/rrweb.css +1 -0
  91. package/lib/rrweb.js +6151 -5632
  92. package/package.json +14 -13
  93. package/typings/packer/base.d.ts +1 -1
  94. package/typings/plugins/console/record/index.d.ts +1 -1
  95. package/typings/plugins/console/record/stringify.d.ts +1 -1
  96. package/typings/plugins/sequential-id/record/index.d.ts +1 -1
  97. package/typings/plugins/sequential-id/replay/index.d.ts +1 -1
  98. package/typings/record/iframe-manager.d.ts +3 -3
  99. package/typings/record/index.d.ts +1 -1
  100. package/typings/record/mutation.d.ts +2 -1
  101. package/typings/record/observers/canvas/2d.d.ts +2 -1
  102. package/typings/record/observers/canvas/canvas-manager.d.ts +5 -2
  103. package/typings/record/observers/canvas/canvas.d.ts +1 -1
  104. package/typings/record/observers/canvas/serialize-args.d.ts +5 -5
  105. package/typings/record/observers/canvas/webgl.d.ts +2 -1
  106. package/typings/record/shadow-dom-manager.d.ts +2 -1
  107. package/typings/record/stylesheet-manager.d.ts +12 -0
  108. package/typings/record/workers/image-bitmap-data-url-worker.d.ts +5 -0
  109. package/typings/replay/canvas/2d.d.ts +3 -3
  110. package/typings/replay/canvas/deserialize-args.d.ts +7 -0
  111. package/typings/replay/canvas/index.d.ts +4 -3
  112. package/typings/replay/canvas/webgl.d.ts +3 -5
  113. package/typings/replay/index.d.ts +7 -10
  114. package/typings/types.d.ts +45 -17
  115. package/typings/utils.d.ts +17 -44
  116. package/es/rrweb/packages/rrweb/ext/tslib/tslib.es6.js +0 -78
  117. package/es/rrweb/packages/rrweb/src/replay/virtual-styles.js +0 -121
  118. package/typings/replay/virtual-styles.d.ts +0 -43
@@ -1,5 +1,5 @@
1
- var rrwebReplay=function(e){"use strict";
2
- /*! *****************************************************************************
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 $(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=$(p[0]);if(!f(/^:\s*/))return u("property missing ':'");var S=f(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),P=y({type:"declaration",property:b.replace(Re,""),value:S?$(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=$(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 G(){var y=s(),p=f(/^@media *([^{]+)/);if(p){var 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:$(p[1]),media:$(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=$(p[1]),S=$(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"),xe=Q("charset"),Ce=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()||G()||W()||k()||ce()||xe()||Ce()||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 $(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,G){if(G===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 xt(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 Ct(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),xt(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=x.ELEMENT_NODE,this.TEXT_NODE=x.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=x.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(Ue(F))(r);return i.ownerDocument=this,i}createCDATASection(r){const i=new(Be(F))(r);return i.ownerDocument=this,i}toString(){return"RRDocument"}}}function Le(e){return class extends e{constructor(t,r,i){super(),this.nodeType=x.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=x.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=x.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 Ue(e){return class extends e{constructor(t){super(),this.nodeType=x.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 Be(e){return class extends e{constructor(t){super(),this.nodeName="#cdata-section",this.nodeType=x.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 x;(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"})(x||(x={}));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 B(e,t,r,i){const n=e.childNodes,s=t.childNodes;i=i||t.mirror||t.ownerDocument.mirror,(n.length>0||s.length>0)&&$e(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(Ut(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":Bt(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)&&$e(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)),B(u,o.contentDocument,r,i)}}}function Ut(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 $e(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))B(d,f,i,n),d=e[++l],f=t[++o];else if(i.mirror.getId(m)===n.getId(T))B(m,T,i,n),m=e[--u],T=t[--c];else if(i.mirror.getId(d)===n.getId(T))r.insertBefore(d,m.nextSibling),B(d,T,i,n),d=e[++l],T=t[--c];else if(i.mirror.getId(m)===n.getId(f))r.insertBefore(m,d),B(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),B(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),B(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),B(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 U;(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"})(U||(U={}));function Ve(e){const t=[...e],r=t.pop();return{positions:t,index:r}}function Bt(e,t){const r=e.sheet;t.forEach(i=>{if(i.type===U.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===U.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===U.SetProperty?q(r.cssRules,i.index).style.setProperty(i.property,i.value,i.priority):i.type===U.RemoveProperty&&q(r.cssRules,i.index).style.removeProperty(i.property)})}class H 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 H}createDocumentType(t,r,i){const n=new $t(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 Gt(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 Ht(t);return r.ownerDocument=this,r}destroyTree(){this.childNodes=[],this.mirror.reset()}open(){super.open(),this._unserializedId=-1}}const $t=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 Gt extends J{constructor(t,r){super(t),this.contentDocument=new H,this.contentDocument.mirror=r}}const Ht=Fe(F),Yt=Ue(F),zt=Be(F);function Xt(e){return e instanceof HTMLFormElement?"FORM":e.tagName.toUpperCase()}function We(e,t,r,i){let n;switch(e.nodeType){case x.DOCUMENT_NODE:i&&i.nodeName==="IFRAME"?n=i.contentDocument:(n=t,n.compatMode=e.compatMode);break;case x.DOCUMENT_TYPE_NODE:const a=e;n=t.createDocumentType(a.name,a.publicId,a.systemId);break;case x.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 x.TEXT_NODE:n=t.createTextNode(e.textContent||"");break;case x.CDATA_SECTION_NODE:n=t.createCDATASection(e.data);break;case x.COMMENT_NODE:n=t.createComment(e.textContent||"");break;case x.DOCUMENT_FRAGMENT_NODE:n=i.attachShadow({mode:"open"});break;default:return null}let s=r.getMeta(e);return t instanceof H&&(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 H){function i(n,s){const a=We(n,r,t,s);a!==null&&(s?.nodeName!=="IFRAME"&&n.nodeType!==x.DOCUMENT_FRAGMENT_NODE&&(s?.appendChild(a),a.parentNode=s,a.parentElement=s),n.nodeName==="IFRAME"?i(n.contentDocument,a):(n.nodeType===x.DOCUMENT_NODE||n.nodeType===x.ELEMENT_NODE||n.nodeType===x.DOCUMENT_FRAGMENT_NODE)&&(n.nodeType===x.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 Ge(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:Ge});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 G=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:G,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||{}),C=(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))(C||{}),_=(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===C.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}/*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
5
5
  Permission to use, copy, modify, and/or distribute this software for any
@@ -12,19 +12,7 @@ var rrwebReplay=function(e){"use strict";
12
12
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */var t,r=function(){return(r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function n(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function o(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}function a(e){return e.nodeType===e.ELEMENT_NODE}!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"}(t||(t={}));var s=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function l(e,t){void 0===t&&(t={});var r=1,n=1;function i(e){var t=e.match(/\n/g);t&&(r+=t.length);var i=e.lastIndexOf("\n");n=-1===i?n+e.length:e.length-i}function o(){var e={line:r,column:n};return function(t){return t.position=new a(e),v(),t}}var a=function(e){this.start=e,this.end={line:r,column:n},this.source=t.source};a.prototype.content=e;var l=[];function d(i){var o=new Error(t.source+":"+r+":"+n+": "+i);if(o.reason=i,o.filename=t.source,o.line=r,o.column=n,o.source=e,!t.silent)throw o;l.push(o)}function f(){return m(/^{\s*/)}function p(){return m(/^}/)}function h(){var t,r=[];for(v(),y(r);e.length&&"}"!==e.charAt(0)&&(t=A()||C());)!1!==t&&(r.push(t),y(r));return r}function m(t){var r=t.exec(e);if(r){var n=r[0];return i(n),e=e.slice(n.length),r}}function v(){m(/^\s*/)}function y(e){var t;for(void 0===e&&(e=[]);t=g();)!1!==t&&e.push(t),t=g();return e}function g(){var t=o();if("/"===e.charAt(0)&&"*"===e.charAt(1)){for(var r=2;""!==e.charAt(r)&&("*"!==e.charAt(r)||"/"!==e.charAt(r+1));)++r;if(r+=2,""===e.charAt(r-1))return d("End of comment missing");var a=e.slice(2,r-2);return n+=2,i(a),e=e.slice(r),n+=2,t({type:"comment",comment:a})}}function b(){var e=m(/^([^{]+)/);if(e)return c(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,(function(e){return e.replace(/,/g,"‌")})).split(/\s*(?![^(]*\)),\s*/).map((function(e){return e.replace(/\u200C/g,",")}))}function x(){var e=o(),t=m(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(t){var r=c(t[0]);if(!m(/^:\s*/))return d("property missing ':'");var n=m(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),i=e({type:"declaration",property:r.replace(s,""),value:n?c(n[0]).replace(s,""):""});return m(/^[;\s]*/),i}}function S(){var e,t=[];if(!f())return d("missing '{'");for(y(t);e=x();)!1!==e&&(t.push(e),y(t)),e=x();return p()?t:d("missing '}'")}function T(){for(var e,t=[],r=o();e=m(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),m(/^,\s*/);if(t.length)return r({type:"keyframe",values:t,declarations:S()})}var w,E=N("import"),M=N("charset"),I=N("namespace");function N(e){var t=new RegExp("^@"+e+"\\s*([^;]+);");return function(){var r=o(),n=m(t);if(n){var i={type:e};return i[e]=n[1].trim(),r(i)}}}function A(){if("@"===e[0])return function(){var e=o(),t=m(/^@([-\w]+)?keyframes\s*/);if(t){var r=t[1];if(!(t=m(/^([-\w]+)\s*/)))return d("@keyframes missing name");var n,i=t[1];if(!f())return d("@keyframes missing '{'");for(var a=y();n=T();)a.push(n),a=a.concat(y());return p()?e({type:"keyframes",name:i,vendor:r,keyframes:a}):d("@keyframes missing '}'")}}()||function(){var e=o(),t=m(/^@media *([^{]+)/);if(t){var r=c(t[1]);if(!f())return d("@media missing '{'");var n=y().concat(h());return p()?e({type:"media",media:r,rules:n}):d("@media missing '}'")}}()||function(){var e=o(),t=m(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:c(t[1]),media:c(t[2])})}()||function(){var e=o(),t=m(/^@supports *([^{]+)/);if(t){var r=c(t[1]);if(!f())return d("@supports missing '{'");var n=y().concat(h());return p()?e({type:"supports",supports:r,rules:n}):d("@supports missing '}'")}}()||E()||M()||I()||function(){var e=o(),t=m(/^@([-\w]+)?document *([^{]+)/);if(t){var r=c(t[1]),n=c(t[2]);if(!f())return d("@document missing '{'");var i=y().concat(h());return p()?e({type:"document",document:n,vendor:r,rules:i}):d("@document missing '}'")}}()||function(){var e=o();if(m(/^@page */)){var t=b()||[];if(!f())return d("@page missing '{'");for(var r,n=y();r=x();)n.push(r),n=n.concat(y());return p()?e({type:"page",selectors:t,declarations:n}):d("@page missing '}'")}}()||function(){var e=o();if(m(/^@host\s*/)){if(!f())return d("@host missing '{'");var t=y().concat(h());return p()?e({type:"host",rules:t}):d("@host missing '}'")}}()||function(){var e=o();if(m(/^@font-face\s*/)){if(!f())return d("@font-face missing '{'");for(var t,r=y();t=x();)r.push(t),r=r.concat(y());return p()?e({type:"font-face",declarations:r}):d("@font-face missing '}'")}}()}function C(){var e=o(),t=b();return t?(y(),e({type:"rule",selectors:t,declarations:S()})):d("selector missing")}return u((w=h(),{type:"stylesheet",stylesheet:{source:t.source,rules:w,parsingErrors:l}}))}function c(e){return e?e.replace(/^\s+|\s+$/g,""):""}function u(e,t){for(var r=e&&"string"==typeof e.type,n=r?e:t,i=0,o=Object.keys(e);i<o.length;i++){var a=e[o[i]];Array.isArray(a)?a.forEach((function(e){u(e,n)})):a&&"object"==typeof a&&u(a,n)}return r&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var d={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"};var f=/([^\\]):hover/,p=new RegExp(f.source,"g");function h(e,t){var r;if(!(null===(r=window.HIG_CONFIGURATION)||void 0===r?void 0:r.enableOnHoverClass))return e;var n=null==t?void 0:t.stylesWithHoverClass.get(e);if(n)return n;var i=l(e,{silent:!0});if(!i.stylesheet)return e;var o=[];if(i.stylesheet.rules.forEach((function(e){"selectors"in e&&(e.selectors||[]).forEach((function(e){f.test(e)&&o.push(e)}))})),0===o.length)return e;var a=new RegExp(o.filter((function(e,t){return o.indexOf(e)===t})).sort((function(e,t){return t.length-e.length})).map((function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})).join("|"),"g"),s=e.replace(a,(function(e){var t=e.replace(p,"$1.\\:hover");return e+", "+t}));return null==t||t.stylesWithHoverClass.set(e,s),s}function m(){return{stylesWithHoverClass:new Map}}function v(e,r){var n=r.doc,i=r.hackCss,o=r.cache;switch(e.type){case t.Document:return n.implementation.createDocument(null,"",null);case t.DocumentType:return n.implementation.createDocumentType(e.name||"html",e.publicId,e.systemId);case t.Element:var a,s=function(e){var t=d[e.tagName]?d[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(e);a=e.isSVG?n.createElementNS("http://www.w3.org/2000/svg",s):n.createElement(s);var l=function(t){if(!e.attributes.hasOwnProperty(t))return"continue";var r=e.attributes[t];if("option"===s&&"selected"===t&&!1===r)return"continue";if(r="boolean"==typeof r||"number"==typeof r?"":r,t.startsWith("rr_")){if("canvas"===s&&"rr_dataURL"===t){var l=document.createElement("img");l.src=r,l.onload=function(){var e=a.getContext("2d");e&&e.drawImage(l,0,0,l.width,l.height)}}else if("img"===s&&"rr_dataURL"===t){var c=a;c.currentSrc.startsWith("data:")||(c.setAttribute("rrweb-original-src",e.attributes.src),c.src=r)}if("rr_width"===t)a.style.width=r;else if("rr_height"===t)a.style.height=r;else if("rr_mediaCurrentTime"===t)a.currentTime=e.attributes.rr_mediaCurrentTime;else if("rr_mediaState"===t)switch(r){case"played":a.play().catch((function(e){return console.warn("media playback error",e)}));break;case"paused":a.pause()}}else{var u="textarea"===s&&"value"===t,d="style"===s&&"_cssText"===t;if(d&&i&&"string"==typeof(r=h(r,o))){for(var f=/url\(\"https:\/\/\S*(.eot|.woff2|.ttf|.woff)\S*\"\)/gm,p=void 0,m=[];null!==(p=f.exec(r));)p.index===f.lastIndex&&f.lastIndex++,p.forEach((function(e,t){if(0===t){var r=e.slice(5,e.length-2);m.push({originalUrl:r,proxyUrl:r.replace(r,"https://replay-cors-proxy.highlightrun.workers.dev?url="+r)})}}));m.forEach((function(e){r=r.replace(e.originalUrl,e.proxyUrl)}))}if(u||d){for(var v=n.createTextNode(r),y=0,g=Array.from(a.childNodes);y<g.length;y++){var b=g[y];b.nodeType===a.TEXT_NODE&&a.removeChild(b)}return a.appendChild(v),"continue"}try{if(e.isSVG&&"xlink:href"===t)a.setAttributeNS("http://www.w3.org/1999/xlink",t,r);else if("onload"===t||"onclick"===t||"onmouse"===t.substring(0,7))a.setAttribute("_"+t,r);else{if("meta"===s&&"Content-Security-Policy"===e.attributes["http-equiv"]&&"content"===t)return a.setAttribute("csp-content",r),"continue";"link"===s&&"preload"===e.attributes.rel&&"script"===e.attributes.as||"link"===s&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")||("img"===s&&e.attributes.srcset&&e.attributes.rr_dataURL?a.setAttribute("rrweb-original-srcset",e.attributes.srcset):a.setAttribute(t,r))}}catch(e){}}};for(var c in e.attributes)l(c);if(e.isShadowHost)if(a.shadowRoot)for(;a.shadowRoot.firstChild;)a.shadowRoot.removeChild(a.shadowRoot.firstChild);else a.attachShadow({mode:"open"});return a;case t.Text:return n.createTextNode(e.isStyle&&i?h(e.textContent,o):e.textContent);case t.CDATA:return n.createCDATASection(e.textContent);case t.Comment:return n.createComment(e.textContent);default:return null}}function y(e,r){var n=r.doc,i=r.map,o=r.skipChild,s=void 0!==o&&o,l=r.hackCss,c=void 0===l||l,u=r.afterAppend,d=r.cache,f=v(e,{doc:n,hackCss:c,cache:d});if(!f)return null;if(e.rootId&&console.assert(i[e.rootId]===n,"Target document should has the same root id."),e.type===t.Document&&(n.close(),n.open(),"BackCompat"===e.compatMode&&e.childNodes&&e.childNodes[0].type!==t.DocumentType&&(e.childNodes[0].type===t.Element&&"xmlns"in e.childNodes[0].attributes&&"http://www.w3.org/1999/xhtml"===e.childNodes[0].attributes.xmlns?n.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):n.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),f=n),f.__sn=e,i[e.id]=f,(e.type===t.Document||e.type===t.Element)&&!s)for(var p=0,h=e.childNodes;p<h.length;p++){var m=h[p],g=y(m,{doc:n,map:i,skipChild:!1,hackCss:c,afterAppend:u,cache:d});g?(m.isShadow&&a(f)&&f.shadowRoot?f.shadowRoot.appendChild(g):f.appendChild(g),u&&u(g)):console.warn("Failed to rebuild",m)}return f}function g(e,r){var n=r.doc,i=r.onVisit,o=r.hackCss,a={},s=y(e,{doc:n,map:a,skipChild:!1,hackCss:void 0===o||o,afterAppend:r.afterAppend,cache:r.cache});return function(e,t){for(var r in e)e[r]&&(n=e[r],t(n));var n}(a,(function(e){i&&i(e),function(e){var r=e.__sn;if(r.type===t.Element){var n=e;for(var i in r.attributes)if(r.attributes.hasOwnProperty(i)&&i.startsWith("rr_")){var o=r.attributes[i];"rr_scrollLeft"===i&&(n.scrollLeft=o),"rr_scrollTop"===i&&(n.scrollTop=o)}}}(e)})),[s,a]}function b(e){return e=e||Object.create(null),{on:function(t,r){(e[t]||(e[t]=[])).push(r)},off:function(t,r){e[t]&&e[t].splice(e[t].indexOf(r)>>>0,1)},emit:function(t,r){(e[t]||[]).slice().map((function(e){e(r)})),(e["*"]||[]).slice().map((function(e){e(t,r)}))}}}var x,S,T,w,E,M,I=Object.freeze({__proto__:null,default:b});function N(e,t){if(void 0===e&&(e=window),void 0===t&&(t=document),!("scrollBehavior"in t.documentElement.style)||!0===e.__forceSmoothScrollPolyfill__){var r,n=e.HTMLElement||e.Element,i={scroll:e.scroll||e.scrollTo,scrollBy:e.scrollBy,elementScroll:n.prototype.scroll||s,scrollIntoView:n.prototype.scrollIntoView},o=e.performance&&e.performance.now?e.performance.now.bind(e.performance):Date.now,a=(r=e.navigator.userAgent,new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(r)?1:0);e.scroll=e.scrollTo=function(){void 0!==arguments[0]&&(!0!==l(arguments[0])?h.call(e,t.body,void 0!==arguments[0].left?~~arguments[0].left:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?~~arguments[0].top:e.scrollY||e.pageYOffset):i.scroll.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:e.scrollY||e.pageYOffset))},e.scrollBy=function(){void 0!==arguments[0]&&(l(arguments[0])?i.scrollBy.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:0,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:0):h.call(e,t.body,~~arguments[0].left+(e.scrollX||e.pageXOffset),~~arguments[0].top+(e.scrollY||e.pageYOffset)))},n.prototype.scroll=n.prototype.scrollTo=function(){if(void 0!==arguments[0])if(!0!==l(arguments[0])){var e=arguments[0].left,t=arguments[0].top;h.call(this,this,void 0===e?this.scrollLeft:~~e,void 0===t?this.scrollTop:~~t)}else{if("number"==typeof arguments[0]&&void 0===arguments[1])throw new SyntaxError("Value could not be converted");i.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left:"object"!=typeof arguments[0]?~~arguments[0]:this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top:void 0!==arguments[1]?~~arguments[1]:this.scrollTop)}},n.prototype.scrollBy=function(){void 0!==arguments[0]&&(!0!==l(arguments[0])?this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior}):i.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop))},n.prototype.scrollIntoView=function(){if(!0!==l(arguments[0])){var r=f(this),n=r.getBoundingClientRect(),o=this.getBoundingClientRect();r!==t.body?(h.call(this,r,r.scrollLeft+o.left-n.left,r.scrollTop+o.top-n.top),"fixed"!==e.getComputedStyle(r).position&&e.scrollBy({left:n.left,top:n.top,behavior:"smooth"})):e.scrollBy({left:o.left,top:o.top,behavior:"smooth"})}else i.scrollIntoView.call(this,void 0===arguments[0]||arguments[0])}}function s(e,t){this.scrollLeft=e,this.scrollTop=t}function l(e){if(null===e||"object"!=typeof e||void 0===e.behavior||"auto"===e.behavior||"instant"===e.behavior)return!0;if("object"==typeof e&&"smooth"===e.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+e.behavior+" is not a valid value for enumeration ScrollBehavior.")}function c(e,t){return"Y"===t?e.clientHeight+a<e.scrollHeight:"X"===t?e.clientWidth+a<e.scrollWidth:void 0}function u(t,r){var n=e.getComputedStyle(t,null)["overflow"+r];return"auto"===n||"scroll"===n}function d(e){var t=c(e,"Y")&&u(e,"Y"),r=c(e,"X")&&u(e,"X");return t||r}function f(e){for(;e!==t.body&&!1===d(e);)e=e.parentNode||e.host;return e}function p(t){var r,n,i,a,s=(o()-t.startTime)/468;a=s=s>1?1:s,r=.5*(1-Math.cos(Math.PI*a)),n=t.startX+(t.x-t.startX)*r,i=t.startY+(t.y-t.startY)*r,t.method.call(t.scrollable,n,i),n===t.x&&i===t.y||e.requestAnimationFrame(p.bind(e,t))}function h(r,n,a){var l,c,u,d,f=o();r===t.body?(l=e,c=e.scrollX||e.pageXOffset,u=e.scrollY||e.pageYOffset,d=i.scroll):(l=r,c=r.scrollLeft,u=r.scrollTop,d=s),p({scrollable:l,method:d,startTime:f,startX:c,startY:u,x:n,y:a})}}!function(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"}(x||(x={})),function(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"}(S||(S={})),function(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"}(T||(T={})),function(e){e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2"}(w||(w={})),function(e){e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange"}(E||(E={})),function(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"}(M||(M={}));var A,C=function(){function e(e,t){void 0===e&&(e=[]),this.timeOffset=0,this.raf=null,this.actions=e,this.speed=t}return e.prototype.addAction=function(e){var t=this.findActionIndex(e);this.actions.splice(t,0,e)},e.prototype.addActions=function(e){this.actions=this.actions.concat(e)},e.prototype.replaceActions=function(e){var t;this.actions.length=0,(t=this.actions).splice.apply(t,o([0,0],i(e),!1))},e.prototype.start=function(){this.timeOffset=0;var e=performance.now(),t=this.actions,r=this;this.raf=requestAnimationFrame((function n(){var i=performance.now();for(r.timeOffset+=(i-e)*r.speed,e=i;t.length;){var o=t[0];if(!(r.timeOffset>=o.delay))break;t.shift(),o.doAction()}(t.length>0||r.liveMode)&&(r.raf=requestAnimationFrame(n))}))},e.prototype.clear=function(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0},e.prototype.setSpeed=function(e){this.speed=e},e.prototype.toggleLiveMode=function(e){this.liveMode=e},e.prototype.isActive=function(){return null!==this.raf},e.prototype.findActionIndex=function(e){for(var t=0,r=this.actions.length-1;t<=r;){var n=Math.floor((t+r)/2);if(this.actions[n].delay<e.delay)t=n+1;else{if(!(this.actions[n].delay>e.delay))return n+1;r=n-1}}return t},e}();function _(e,t){if(e.type===x.IncrementalSnapshot&&e.data.source===S.MouseMove){var r=e.data.positions[0].timeOffset,n=e.timestamp+r;return e.delay=n-t,n-t}return e.delay=e.timestamp-t,e.delay}
16
- /*! *****************************************************************************
17
- Copyright (c) Microsoft Corporation.
18
-
19
- Permission to use, copy, modify, and/or distribute this software for any
20
- purpose with or without fee is hereby granted.
21
-
22
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
23
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
24
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
25
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
26
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
27
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28
- PERFORMANCE OF THIS SOFTWARE.
29
- ***************************************************************************** */function D(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}!function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(A||(A={}));var R={type:"xstate.init"};function k(e){return void 0===e?[]:[].concat(e)}function L(e){return{type:"xstate.assign",assignment:e}}function P(e,t){return"string"==typeof(e="string"==typeof e&&t&&t[e]?t[e]:e)?{type:e}:"function"==typeof e?{type:e.name,exec:e}:e}function F(e){return function(t){return e===t}}function O(e){return"string"==typeof e?{type:e}:e}function W(e,t){return{value:e,context:t,actions:[],changed:!1,matches:F(e)}}function j(e,t,r){var n=t,i=!1;return[e.filter((function(e){if("xstate.assign"===e.type){i=!0;var t=Object.assign({},n);return"function"==typeof e.assignment?t=e.assignment(n,r):Object.keys(e.assignment).forEach((function(i){t[i]="function"==typeof e.assignment[i]?e.assignment[i](n,r):e.assignment[i]})),n=t,!1}return!0})),n,i]}function B(e,t){void 0===t&&(t={});var r=D(j(k(e.states[e.initial].entry).map((function(e){return P(e,t.actions)})),e.context,R),2),n=r[0],i=r[1],o={config:e,_options:t,initialState:{value:e.initial,actions:n,context:i,matches:F(e.initial)},transition:function(t,r){var n,i,a="string"==typeof t?{value:t,context:e.context}:t,s=a.value,l=a.context,c=O(r),u=e.states[s];if(u.on){var d=k(u.on[c.type]);try{for(var f=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(d),p=f.next();!p.done;p=f.next()){var h=p.value;if(void 0===h)return W(s,l);var m="string"==typeof h?{target:h}:h,v=m.target,y=m.actions,g=void 0===y?[]:y,b=m.cond,x=void 0===b?function(){return!0}:b,S=void 0===v,T=null!=v?v:s,w=e.states[T];if(x(l,c)){var E=D(j((S?k(g):[].concat(u.exit,g,w.entry).filter((function(e){return e}))).map((function(e){return P(e,o._options.actions)})),l,c),3),M=E[0],I=E[1],N=E[2],A=null!=v?v:s;return{value:A,context:I,actions:M,changed:v!==s||M.length>0||N,matches:F(A)}}}}catch(e){n={error:e}}finally{try{p&&!p.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}}return W(s,l)}};return o}var U=function(e,t){return e.actions.forEach((function(r){var n=r.exec;return n&&n(e.context,t)}))};function V(e){var t=e.initialState,r=A.NotStarted,n=new Set,i={_machine:e,send:function(i){r===A.Running&&(t=e.transition(t,i),U(t,O(i)),n.forEach((function(e){return e(t)})))},subscribe:function(e){return n.add(e),e(t),{unsubscribe:function(){return n.delete(e)}}},start:function(n){if(n){var o="object"==typeof n?n:{context:e.config.context,value:n};t={value:o.value,actions:[],context:o.context,matches:F(o.value)}}return r=A.Running,U(t,R),i},stop:function(){return r=A.Stopped,n.clear(),i},get state(){return t},get status(){return r}};return i}function G(e,t){var i=t.getCastFn,o=t.applyEventsSynchronously,a=t.emitter;return V(B({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:L({lastPlayedEvent:function(e,t){return"CAST_EVENT"===t.type?t.payload.event:e.lastPlayedEvent}}),recordTimeOffset:L((function(e,t){var n=e.timeOffset;return"payload"in t&&"timeOffset"in t.payload&&(n=t.payload.timeOffset),r(r({},e),{timeOffset:n,baselineTime:e.events[0].timestamp+n})})),play:function(e){var t,r,s,l,c,u=e.timer,d=e.events,f=e.baselineTime,p=e.lastPlayedEvent;u.clear();try{for(var h=n(d),m=h.next();!m.done;m=h.next()){_(m.value,f)}}catch(e){t={error:e}}finally{try{m&&!m.done&&(r=h.return)&&r.call(h)}finally{if(t)throw t.error}}var v=function(e,t){for(var r=e.length-1;r>=0;r--){var n=e[r];if(n.type===x.Meta&&n.timestamp<=t)return e.slice(r)}return e}(d,f),y=null==p?void 0:p.timestamp;(null==p?void 0:p.type)===x.IncrementalSnapshot&&p.data.source===S.MouseMove&&(y=p.timestamp+(null===(c=p.data.positions[0])||void 0===c?void 0:c.timeOffset)),f<(y||0)&&a.emit(M.PlayBack);var g=new Array,b=new Array,T=function(e){if(y&&y<f&&(e.timestamp<=y||e===p))return"continue";if(e.timestamp<f)g.push(e);else{var t=i(e,!1);b.push({doAction:function(){t()},delay:e.delay})}};try{for(var w=n(v),E=w.next();!E.done;E=w.next()){T(E.value)}}catch(e){s={error:e}}finally{try{E&&!E.done&&(l=w.return)&&l.call(w)}finally{if(s)throw s.error}}o(g),a.emit(M.Flush),u.addActions(b),u.start()},pause:function(e){e.timer.clear()},resetLastPlayedEvent:L((function(e){return r(r({},e),{lastPlayedEvent:null})})),startLive:L({baselineTime:function(e,t){return e.timer.toggleLiveMode(!0),e.timer.start(),"TO_LIVE"===t.type&&t.payload.baselineTime?t.payload.baselineTime:Date.now()}}),replaceEvents:L((function(e,t){var o,a,s=e.events,l=e.timer,c=e.baselineTime;if("REPLACE_EVENTS"===t.type){var u=t.payload.events;s.length=0;var d=[],f=function(e){if(_(e,c),s.push(e),e.timestamp>=l.timeOffset+c){var t=i(e,!1);d.push({doAction:function(){t()},delay:e.delay})}};try{for(var p=n(u),h=p.next();!h.done;h=p.next()){f(h.value)}}catch(e){o={error:e}}finally{try{h&&!h.done&&(a=p.return)&&a.call(p)}finally{if(o)throw o.error}}l.isActive()&&l.replaceActions(d)}return r(r({},e),{events:s})})),addEvent:L((function(e,t){var n=e.baselineTime,o=e.timer,a=e.events;if("ADD_EVENT"===t.type){var s=t.payload.event;_(s,n);var l=a.length-1;if(!a[l]||a[l].timestamp<=s.timestamp)a.push(s);else{for(var c=-1,u=0;u<=l;){var d=Math.floor((u+l)/2);a[d].timestamp<=s.timestamp?u=d+1:l=d-1}-1===c&&(c=u),a.splice(c,0,s)}var f=s.timestamp<n,p=i(s,f);f?p():o.isActive()&&o.addAction({doAction:function(){p()},delay:s.delay})}return r(r({},e),{events:a})}))}}))}var H="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.",Y={map:{},getId:function(){return console.error(H),-1},getNode:function(){return console.error(H),null},removeNodeFromMap:function(){console.error(H)},has:function(){return console.error(H),!1},reset:function(){console.error(H)}};"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Y=new Proxy(Y,{get:function(e,t,r){return"map"===t&&console.error(H),Reflect.get(e,t,r)}}));var z=function(){function e(){this.reset()}return e.prototype.add=function(e){var t=this.indexes.get(e.parentId),r={id:e.node.id,mutation:e,children:[],texts:[],attributes:[]};t?(r.parent=t,t.children[r.id]=r):this.tree[r.id]=r,this.indexes.set(r.id,r)},e.prototype.remove=function(e,t){var r=this,n=this.indexes.get(e.parentId),i=this.indexes.get(e.id),o=function(e){r.removeIdSet.add(e);var n=t.getNode(e);null==n||n.childNodes.forEach((function(e){"__sn"in e&&o(e.__sn.id)}))},a=function(t){r.removeIdSet.add(t.id),Object.values(t.children).forEach((function(e){return a(e)}));var n=r.indexes.get(t.id);if(n){var i=n.parent;i&&(delete n.parent,delete i.children[n.id],r.indexes.delete(e.id))}};i?n?(delete i.parent,delete n.children[i.id],this.indexes.delete(e.id),a(i)):(delete this.tree[i.id],this.indexes.delete(i.id),a(i)):(this.removeNodeMutations.push(e),o(e.id))},e.prototype.text=function(e){var t=this.indexes.get(e.id);t?t.texts.push(e):this.textMutations.push(e)},e.prototype.attribute=function(e){var t=this.indexes.get(e.id);t?t.attributes.push(e):this.attributeMutations.push(e)},e.prototype.scroll=function(e){this.scrollMap.set(e.id,e)},e.prototype.input=function(e){this.inputMap.set(e.id,e)},e.prototype.flush=function(){var e,t,r,i,o=this,a=this,s=a.tree,l=a.removeNodeMutations,c=a.textMutations,u=a.attributeMutations,d={source:S.Mutation,removes:l,texts:c,attributes:u,adds:[]},f=function(e,t){t&&o.removeIdSet.add(e.id),d.texts=d.texts.concat(t?[]:e.texts).filter((function(e){return!o.removeIdSet.has(e.id)})),d.attributes=d.attributes.concat(t?[]:e.attributes).filter((function(e){return!o.removeIdSet.has(e.id)})),o.removeIdSet.has(e.id)||o.removeIdSet.has(e.mutation.parentId)||t?Object.values(e.children).forEach((function(e){return f(e,!0)})):(d.adds.push(e.mutation),e.children&&Object.values(e.children).forEach((function(e){return f(e,!1)})))};Object.values(s).forEach((function(e){return f(e,!1)}));try{for(var p=n(this.scrollMap.keys()),h=p.next();!h.done;h=p.next()){var m=h.value;this.removeIdSet.has(m)&&this.scrollMap.delete(m)}}catch(t){e={error:t}}finally{try{h&&!h.done&&(t=p.return)&&t.call(p)}finally{if(e)throw e.error}}try{for(var v=n(this.inputMap.keys()),y=v.next();!y.done;y=v.next()){m=y.value;this.removeIdSet.has(m)&&this.inputMap.delete(m)}}catch(e){r={error:e}}finally{try{y&&!y.done&&(i=v.return)&&i.call(v)}finally{if(r)throw r.error}}var g=new Map(this.scrollMap),b=new Map(this.inputMap);return this.reset(),{mutationData:d,scrollMap:g,inputMap:b}},e.prototype.reset=function(){this.tree=[],this.indexes=new Map,this.removeNodeMutations=[],this.textMutations=[],this.attributeMutations=[],this.removeIdSet=new Set,this.scrollMap=new Map,this.inputMap=new Map},e.prototype.idRemoved=function(e){return this.removeIdSet.has(e)},e}();function X(e){var t,r,i={},o=function(e,t){var r={value:e,parent:t,children:[]};return i[e.node.id]=r,r},a=[];try{for(var s=n(e),l=s.next();!l.done;l=s.next()){var c=l.value,u=c.nextId,d=c.parentId;if(u&&u in i){var f=i[u];if(f.parent){var p=f.parent.children.indexOf(f);f.parent.children.splice(p,0,o(c,f.parent))}else{p=a.indexOf(f);a.splice(p,0,o(c,null))}}else if(d in i){var h=i[d];h.children.push(o(c,h))}else a.push(o(c,null))}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return a}function Q(e,t){t(e.value);for(var r=e.children.length-1;r>=0;r--)Q(e.children[r],t)}function q(e){return"__sn"in e&&(e.__sn.type===t.Element&&"iframe"===e.__sn.tagName)}function $(e,t){var r,n,i=null===(n=null===(r=e.ownerDocument)||void 0===r?void 0:r.defaultView)||void 0===n?void 0:n.frameElement;if(!i||i===t)return{x:0,y:0,relativeScale:1,absoluteScale:1};var o=i.getBoundingClientRect(),a=$(i,t),s=o.height/i.clientHeight;return{x:o.x*a.relativeScale+a.x,y:o.y*a.relativeScale+a.y,relativeScale:s,absoluteScale:a.absoluteScale*s}}function J(e){return Boolean(null==e?void 0:e.shadowRoot)}var K;function Z(e,t){var r=e[t[0]];return 1===t.length?r:Z(r.cssRules[t[1]].cssRules,t.slice(2))}function ee(e){var t=o([],i(e),!1),r=t.pop();return{positions:t,index:r}}function te(e,t){var r=t.sheet;r&&e.forEach((function(e){if(e.type===K.Insert)try{if(Array.isArray(e.index)){var n=ee(e.index),o=n.positions,a=n.index;Z(r.cssRules,o).insertRule(e.cssText,a)}else r.insertRule(e.cssText,e.index)}catch(e){}else if(e.type===K.Remove)try{if(Array.isArray(e.index)){var s=ee(e.index);o=s.positions,a=s.index;Z(r.cssRules,o).deleteRule(a||0)}else r.deleteRule(e.index)}catch(e){}else if(e.type===K.Snapshot)!function(e,t){var r;try{var n=Array.from((null===(r=t.sheet)||void 0===r?void 0:r.cssRules)||[]).map((function(e){return e.cssText})),o=Object.entries(n).reverse(),a=n.length;o.forEach((function(r){var n,o=i(r,2),s=o[0],l=o[1],c=e.indexOf(l);if(-1===c||c>a)try{null===(n=t.sheet)||void 0===n||n.deleteRule(Number(s))}catch(e){}a=c})),e.forEach((function(e,r){var n,i,o;try{(null===(i=null===(n=t.sheet)||void 0===n?void 0:n.cssRules[r])||void 0===i?void 0:i.cssText)!==e&&(null===(o=t.sheet)||void 0===o||o.insertRule(e,r))}catch(e){}}))}catch(e){}}(e.cssTexts,t);else if(e.type===K.SetProperty){Z(r.cssRules,e.index).style.setProperty(e.property,e.value,e.priority)}else if(e.type===K.RemoveProperty){Z(r.cssRules,e.index).style.removeProperty(e.property)}}))}!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"}(K||(K={}));for(var re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ne="undefined"==typeof Uint8Array?[]:new Uint8Array(256),ie=0;ie<re.length;ie++)ne[re.charCodeAt(ie)]=ie;var oe=new Map;function ae(e,t){var r=oe.get(e);return r||(r=new Map,oe.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var se=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function le(e,t){return function(r){if(r&&"object"==typeof r&&"rr_type"in r){if("index"in r){var n=r.rr_type,a=r.index;return ae(t,n)[a]}if("args"in r){var s=r.rr_type,l=r.args,c=window[s];return new(c.bind.apply(c,o([void 0],i(l.map(le(e,t))),!1)))}if("base64"in r)return function(e){var t,r,n,i,o,a=.75*e.length,s=e.length,l=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var c=new ArrayBuffer(a),u=new Uint8Array(c);for(t=0;t<s;t+=4)r=ne[e.charCodeAt(t)],n=ne[e.charCodeAt(t+1)],i=ne[e.charCodeAt(t+2)],o=ne[e.charCodeAt(t+3)],u[l++]=r<<2|n>>4,u[l++]=(15&n)<<4|i>>2,u[l++]=(3&i)<<6|63&o;return c}(r.base64);if("src"in r){var u=e.get(r.src);if(u)return u;var d=new Image;return d.src=r.src,e.set(r.src,d),d}}else if(Array.isArray(r))return r.map(le(e,t));return r}}function ce(e){var t=e.mutation,r=e.target,n=e.type,i=e.imageMap,o=e.errorHandler;try{var a=function(e,t){try{return t===w.WebGL?e.getContext("webgl")||e.getContext("experimental-webgl"):e.getContext("webgl2")}catch(e){return null}}(r,n);if(!a)return;if(t.setter)return void(a[t.property]=t.args[0]);var s=a[t.property],l=t.args.map(le(i,a));!function(e,t){if(null==t?void 0:t.constructor){var r=t.constructor.name;if(se.includes(r)){var n=ae(e,r);n.includes(t)||n.push(t)}}}(a,s.apply(a,l))}catch(e){o(t,e)}}var ue=36e5,de=b||I,fe="[replayer]",pe={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function he(e){return e.type==x.IncrementalSnapshot&&(e.data.source==S.TouchMove||e.data.source==S.MouseInteraction&&e.data.type==T.TouchStart)}var me=function(){function e(e,t){var r=this;if(this.mouseTail=null,this.tailPositions=[],this.emitter=de(),this.activityIntervals=[],this.legacy_missingNodeRetryMap={},this.cache=m(),this.imageMap=new Map,this.mirror={map:{},getId:function(e){return e&&e.__sn?e.__sn.id:-1},getNode:function(e){return this.map[e]||null},removeNodeFromMap:function(e){var t=this,r=e.__sn&&e.__sn.id;delete this.map[r],e.childNodes&&e.childNodes.forEach((function(e){return t.removeNodeFromMap(e)}))},has:function(e){return this.map.hasOwnProperty(e)},reset:function(){this.map={}}},this.firstFullSnapshot=null,this.newDocumentQueue=[],this.mousePos=null,this.touchActive=null,!(null==t?void 0:t.liveMode)&&e.length<2)throw new Error("Replayer need at least 2 events.");var 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:pe,inactiveThreshold:.02,inactiveSkipTime:2e3};this.config=Object.assign({},i,t),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on(M.Resize,this.handleResize),this.setupDom(),this.treeIndex=new z,this.fragmentParentMap=new Map,this.elementStateMap=new Map,this.virtualStyleRulesMap=new Map,this.emitter.on(M.Flush,(function(){var e,t,i,o,a,s,l,c,u=r.treeIndex.flush(),d=u.scrollMap,f=u.inputMap,p=u.mutationData;r.fragmentParentMap.forEach((function(e,t){return r.restoreRealParent(t,e)}));try{for(var h=n(p.texts),m=h.next();!m.done;m=h.next()){var v=m.value;r.applyText(v,p)}}catch(t){e={error:t}}finally{try{m&&!m.done&&(t=h.return)&&t.call(h)}finally{if(e)throw e.error}}try{for(var y=n(r.virtualStyleRulesMap.keys()),g=y.next();!g.done;g=y.next()){var b=g.value;r.restoreNodeSheet(b)}}catch(e){i={error:e}}finally{try{g&&!g.done&&(o=y.return)&&o.call(y)}finally{if(i)throw i.error}}r.fragmentParentMap.clear(),r.elementStateMap.clear(),r.virtualStyleRulesMap.clear();try{for(var x=n(d.values()),S=x.next();!S.done;S=x.next()){v=S.value;r.applyScroll(v,!0)}}catch(e){a={error:e}}finally{try{S&&!S.done&&(s=x.return)&&s.call(x)}finally{if(a)throw a.error}}try{for(var T=n(f.values()),w=T.next();!w.done;w=T.next()){v=w.value;r.applyInput(v)}}catch(e){l={error:e}}finally{try{w&&!w.done&&(c=T.return)&&c.call(T)}finally{if(l)throw l.error}}})),this.emitter.on(M.PlayBack,(function(){r.firstFullSnapshot=null,r.mirror.reset()}));var o=new C([],(null==t?void 0:t.speed)||i.speed);this.service=G({events:e.map((function(e){return t&&t.unpackFn?t.unpackFn(e):e})).sort((function(e,t){return e.timestamp-t.timestamp})),timer:o,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe((function(e){r.emitter.emit(M.StateChange,{player:e})})),this.speedService=V(B({id:"speed",context:{normalSpeed:-1,timer:o},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:function(e,t){"payload"in t&&e.timer.setSpeed(t.payload.speed)},recordSpeed:L({normalSpeed:function(e){return e.timer.speed}}),restoreSpeed:function(e){e.timer.setSpeed(e.normalSpeed)}}})),this.speedService.start(),this.speedService.subscribe((function(e){r.emitter.emit(M.StateChange,{speed:e})}));var a=this.service.state.context.events.find((function(e){return e.type===x.Meta})),s=this.service.state.context.events.find((function(e){return e.type===x.FullSnapshot}));if(a){var l=a.data,c=l.width,u=l.height;setTimeout((function(){r.emitter.emit(M.Resize,{width:c,height:u})}),0)}s&&setTimeout((function(){r.firstFullSnapshot||(r.firstFullSnapshot=s,r.rebuildFullSnapshot(s),r.iframe.contentWindow.scrollTo(s.data.initialOffset))}),1),this.service.state.context.events.find(he)&&this.mouse.classList.add("touch-device")}return Object.defineProperty(e.prototype,"timer",{get:function(){return this.service.state.context.timer},enumerable:!1,configurable:!0}),e.prototype.on=function(e,t){return this.emitter.on(e,t),this},e.prototype.off=function(e,t){return this.emitter.off(e,t),this},e.prototype.setConfig=function(e){var t=this;Object.keys(e).forEach((function(r){t.config[r]=e[r]})),this.config.skipInactive||this.backToNormal(),void 0!==e.speed&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}}),void 0!==e.mouseTail&&(!1===e.mouseTail?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"))},e.prototype.getActivityIntervals=function(){var e=this;if(0==this.activityIntervals.length){for(var t=[],r=this.getMetaData(),n=o(o([{timestamp:r.startTime}],i(this.service.state.context.events.filter((function(t){return e.isUserInteraction(t)}))),!1),[{timestamp:r.endTime}],!1),a=1;a<n.length;a++){var s=n[a-1],l=n[a];l.timestamp-s.timestamp>1e4?t.push({startTime:s.timestamp,endTime:l.timestamp,duration:l.timestamp-s.timestamp,active:!1}):t.push({startTime:s.timestamp,endTime:l.timestamp,duration:l.timestamp-s.timestamp,active:!0})}var c=[],u=t[0];for(a=1;a<t.length;a++)t[a].active!=t[a-1].active&&(c.push({startTime:u.startTime,endTime:t[a-1].endTime,duration:t[a-1].endTime-u.startTime,active:t[a-1].active}),u=t[a]);u&&t.length>0&&c.push({startTime:u.startTime,endTime:t[t.length-1].endTime,duration:t[t.length-1].endTime-u.startTime,active:t[t.length-1].active}),u=c[0];for(a=1;a<c.length;a++)(!c[a].active&&c[a].duration>this.config.inactiveThreshold*r.totalTime||!c[a-1].active&&c[a-1].duration>this.config.inactiveThreshold*r.totalTime)&&(this.activityIntervals.push({startTime:u.startTime,endTime:c[a-1].endTime,duration:c[a-1].endTime-u.startTime,active:c[a-1].active}),u=c[a]);u&&c.length>0&&this.activityIntervals.push({startTime:u.startTime,endTime:c[c.length-1].endTime,duration:c[c.length-1].endTime-u.startTime,active:c[c.length-1].active})}return this.activityIntervals},e.prototype.getMetaData=function(){var e=this.service.state.context.events[0],t=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:e.timestamp,endTime:t.timestamp,totalTime:t.timestamp-e.timestamp}},e.prototype.getCurrentTime=function(){return this.timer.timeOffset+this.getTimeOffset()},e.prototype.getTimeOffset=function(){var e=this.service.state.context;return e.baselineTime-e.events[0].timestamp},e.prototype.getMirror=function(){return this.mirror},e.prototype.play=function(e){var t;void 0===e&&(e=0),this.service.state.matches("paused")||this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:e}}),null===(t=this.iframe.contentDocument)||void 0===t||t.getElementsByTagName("html")[0].classList.remove("rrweb-paused"),this.emitter.emit(M.Start),this.handleInactivity(this.getMetaData().startTime+e,!0)},e.prototype.pause=function(e){var t;void 0===e&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),"number"==typeof e&&(this.play(e),this.service.send({type:"PAUSE"})),null===(t=this.iframe.contentDocument)||void 0===t||t.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(M.Pause)},e.prototype.resume=function(e){void 0===e&&(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(M.Resume)},e.prototype.startLive=function(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})},e.prototype.addEvent=function(e){var t=this,r=this.config.unpackFn?this.config.unpackFn(e):e;he(r)&&this.mouse.classList.add("touch-device"),Promise.resolve().then((function(){return t.service.send({type:"ADD_EVENT",payload:{event:r}})}))},e.prototype.replaceEvents=function(e){var t,r;try{for(var i=n(e),o=i.next();!o.done;o=i.next()){if(he(o.value)){this.mouse.classList.add("touch-device");break}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}this.service.send({type:"REPLACE_EVENTS",payload:{events:e}})},e.prototype.enableInteract=function(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"},e.prototype.disableInteract=function(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"},e.prototype.resetCache=function(){this.cache=m()},e.prototype.setupDom=function(){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),!1!==this.config.mouseTail&&(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");var e,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&&(N(this.iframe.contentWindow,this.iframe.contentDocument),void 0===(e=this.iframe.contentWindow)&&(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(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}))},e.prototype.handleResize=function(e){var t,r;this.iframe.style.display="inherit";try{for(var i=n([this.mouseTail,this.iframe]),o=i.next();!o.done;o=i.next()){var a=o.value;a&&(a.setAttribute("width",String(e.width)),a.setAttribute("height",String(e.height)))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},e.prototype.applyEventsSynchronously=function(e){var t,r;try{for(var i=n(e),o=i.next();!o.done;o=i.next()){var a=o.value;switch(a.type){case x.DomContentLoaded:case x.Load:case x.Custom:continue;case x.FullSnapshot:case x.Meta:case x.Plugin:break;case x.IncrementalSnapshot:switch(a.data.source){case S.MediaInteraction:continue}}this.getCastFn(a,!0)()}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}this.mousePos&&this.moveAndHover(this.mousePos.x,this.mousePos.y,this.mousePos.id,!0,this.mousePos.debugData),this.mousePos=null,!0===this.touchActive?this.mouse.classList.add("touch-active"):!1===this.touchActive&&this.mouse.classList.remove("touch-active"),this.touchActive=null},e.prototype.getCastFn=function(e,t){var r,i=this;switch(void 0===t&&(t=!1),e.type){case x.DomContentLoaded:case x.Load:break;case x.Custom:r=function(){i.emitter.emit(M.CustomEvent,e)};break;case x.Meta:r=function(){return i.emitter.emit(M.Resize,{width:e.data.width,height:e.data.height})};break;case x.FullSnapshot:r=function(){if(i.firstFullSnapshot){if(i.firstFullSnapshot===e)return void(i.firstFullSnapshot=!0)}else i.firstFullSnapshot=!0;i.rebuildFullSnapshot(e,t),i.iframe.contentWindow.scrollTo(e.data.initialOffset)};break;case x.IncrementalSnapshot:r=function(){var r,o;if(i.applyIncremental(e,t),!t&&(i.handleInactivity(e.timestamp),e===i.nextUserInteractionEvent&&(i.nextUserInteractionEvent=null,i.backToNormal()),i.config.skipInactive&&!i.nextUserInteractionEvent)){try{for(var a=n(i.service.state.context.events),s=a.next();!s.done;s=a.next()){var l=s.value;if(!(l.timestamp<=e.timestamp)&&i.isUserInteraction(l)){l.delay-e.delay>1e4*i.speedService.state.context.timer.speed&&(i.nextUserInteractionEvent=l);break}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}if(i.nextUserInteractionEvent){var c=i.nextUserInteractionEvent.delay-e.delay,u={speed:Math.min(Math.round(c/2e3),i.config.maxSpeed)};i.speedService.send({type:"FAST_FORWARD",payload:u}),i.emitter.emit(M.SkipStart,u)}}}}return function(){var o,a;r&&r();try{for(var s=n(i.config.plugins||[]),l=s.next();!l.done;l=s.next()){l.value.handler(e,t,{replayer:i})}}catch(e){o={error:e}}finally{try{l&&!l.done&&(a=s.return)&&a.call(s)}finally{if(o)throw o.error}}i.service.send({type:"CAST_EVENT",payload:{event:e}});var c=i.service.state.context.events.length-1;if(e===i.service.state.context.events[c]){var u=function(){c<i.service.state.context.events.length-1||(i.backToNormal(),i.service.send("END"),i.emitter.emit(M.Finish))};e.type===x.IncrementalSnapshot&&e.data.source===S.MouseMove&&e.data.positions.length?setTimeout((function(){u()}),Math.max(0,50-e.data.positions[0].timeOffset)):u()}i.emitter.emit(M.EventCast,e)}},e.prototype.handleInactivity=function(e,t){var r,i;if((e===this.inactiveEndTimestamp||t)&&(this.inactiveEndTimestamp=null,this.backToNormal()),this.config.skipInactive&&!this.inactiveEndTimestamp){try{for(var o=n(this.getActivityIntervals()),a=o.next();!a.done;a=o.next()){var s=a.value;if(e>=s.startTime&&e<s.endTime&&!s.active){this.inactiveEndTimestamp=s.endTime;break}}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}if(this.inactiveEndTimestamp){var l=this.inactiveEndTimestamp-e,c={speed:l/ue*this.config.inactiveSkipTime<1e3?l/1e3:Math.round(Math.max(l,ue)/this.config.inactiveSkipTime)};this.speedService.send({type:"FAST_FORWARD",payload:c}),this.emitter.emit(M.SkipStart,c)}}},e.prototype.rebuildFullSnapshot=function(e,t){var r,i,o=this;if(void 0===t&&(t=!1),!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={};var a=[];this.mirror.map=g(e.data.node,{doc:this.iframe.contentDocument,afterAppend:function(e){o.collectIframeAndAttachDocument(a,e)},cache:this.cache})[1];var s=function(e,t){l.attachDocumentToIframe(e,t),l.newDocumentQueue=l.newDocumentQueue.filter((function(t){return t!==e}))},l=this;try{for(var c=n(a),u=c.next();!u.done;u=c.next()){var d=u.value;s(d.mutationInQueue,d.builtNode)}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}var f=this.iframe.contentDocument,p=f.documentElement,h=f.head;this.insertStyleRules(p,h),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(M.FullsnapshotRebuilded,e),t||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()},e.prototype.insertStyleRules=function(e,t){var r=document.createElement("style");e.insertBefore(r,t);var n,i=(n=this.config.blockClass,[".".concat(n," { background: currentColor }"),"noscript { display: none !important; }",".".concat(n," { background: currentColor; border-radius: 5px; }"),".".concat(n,":hover::after {content: 'Redacted'; color: white; background: black; text-align: center; width: 100%; display: block;}")]).concat(this.config.insertStyleRules);this.config.pauseAnimation&&i.push("html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }");for(var o=0;o<i.length;o++)r.sheet.insertRule(i[o],o)},e.prototype.attachDocumentToIframe=function(e,r){var i,o,a=this,s=[];if(!r.contentDocument)for(var l=r.parentNode;l;){if(this.fragmentParentMap.has(l)){var c=l,u=this.fragmentParentMap.get(c);this.restoreRealParent(c,u);break}l=l.parentNode}y(e.node,{doc:r.contentDocument,map:this.mirror.map,hackCss:!0,skipChild:!1,afterAppend:function(e){if(a.collectIframeAndAttachDocument(s,e),e.__sn.type===t.Element&&"HTML"===e.__sn.tagName.toUpperCase()){var n=r.contentDocument,i=n.documentElement,o=n.head;a.insertStyleRules(i,o)}},cache:this.cache});var d=function(e,t){f.attachDocumentToIframe(e,t),f.newDocumentQueue=f.newDocumentQueue.filter((function(t){return t!==e}))},f=this;try{for(var p=n(s),h=p.next();!h.done;h=p.next()){var m=h.value;d(m.mutationInQueue,m.builtNode)}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}},e.prototype.collectIframeAndAttachDocument=function(e,t){if(q(t)){var r=this.newDocumentQueue.find((function(e){return e.parentId===t.__sn.id}));r&&e.push({mutationInQueue:r,builtNode:t})}},e.prototype.waitForStylesheetLoad=function(){var e,t=this,r=null===(e=this.iframe.contentDocument)||void 0===e?void 0:e.head;if(r){var n,i=new Set,o=this.service.state,a=function(){o=t.service.state};this.emitter.on(M.Start,a),this.emitter.on(M.Pause,a);var s=function(){t.emitter.off(M.Start,a),t.emitter.off(M.Pause,a)};r.querySelectorAll('link[rel="stylesheet"]').forEach((function(e){e.sheet||(i.add(e),e.addEventListener("load",(function(){i.delete(e),0===i.size&&-1!==n&&(o.matches("playing")&&t.play(t.getCurrentTime()),t.emitter.emit(M.LoadStylesheetEnd),n&&clearTimeout(n),s())})))})),i.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(M.LoadStylesheetStart),n=setTimeout((function(){o.matches("playing")&&t.play(t.getCurrentTime()),n=-1,s()}),this.config.loadTimeout))}},e.prototype.hasImageArg=function(e){var t,r;try{for(var i=n(e),o=i.next();!o.done;o=i.next()){var a=o.value;if(a&&"object"==typeof a)if("rr_type"in a&&"args"in a){if(this.hasImageArg(a.args))return!0}else{if("rr_type"in a&&"HTMLImageElement"===a.rr_type)return!0;if(a instanceof Array&&this.hasImageArg(a))return!0}else;}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return!1},e.prototype.getImageArgs=function(e){var t,r,a=[];try{for(var s=n(e),l=s.next();!l.done;l=s.next()){var c=l.value;c&&"object"==typeof c&&("rr_type"in c&&"args"in c?a.push.apply(a,o([],i(this.getImageArgs(c.args)),!1)):"rr_type"in c&&"HTMLImageElement"===c.rr_type?a.push(c.src):c instanceof Array&&a.push.apply(a,o([],i(this.getImageArgs(c)),!1)))}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return a},e.prototype.preloadAllImages=function(){var e,t,r=this;this.service.state;var i=function(){r.service.state};this.emitter.on(M.Start,i),this.emitter.on(M.Pause,i);var o=function(e){e.type===x.IncrementalSnapshot&&e.data.source===S.CanvasMutation&&("commands"in e.data?e.data.commands.forEach((function(t){return r.preloadImages(t,e)})):a.preloadImages(e.data,e))},a=this;try{for(var s=n(this.service.state.context.events),l=s.next();!l.done;l=s.next()){o(l.value)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}},e.prototype.preloadImages=function(e,t){var r=this;if("drawImage"!==e.property||"string"!=typeof e.args[0]||this.imageMap.has(t))this.hasImageArg(e.args)&&this.getImageArgs(e.args).forEach((function(e){var t=new Image;t.src=e,r.imageMap.set(e,t)}));else{var n=document.createElement("canvas"),i=n.getContext("2d"),o=null==i?void 0:i.createImageData(n.width,n.height);null==o||o.data,JSON.parse(e.args[0]),null==i||i.putImageData(o,0,0)}},e.prototype.applyIncremental=function(e,t){var n,i,o=this,a=e.data;switch(a.source){case S.Mutation:t&&(a.adds.forEach((function(e){return o.treeIndex.add(e)})),a.texts.forEach((function(e){var t=o.mirror.getNode(e.id),r=null==t?void 0:t.parentNode;r&&o.virtualStyleRulesMap.has(r)&&o.virtualStyleRulesMap.delete(r),o.treeIndex.text(e)})),a.attributes.forEach((function(e){return o.treeIndex.attribute(e)})),a.removes.forEach((function(e){return o.treeIndex.remove(e,o.mirror)})));try{this.applyMutation(a,t)}catch(e){this.warn("Exception in mutation ".concat(e.message||e),a)}break;case S.Drag:case S.TouchMove:case S.MouseMove:if(t){var s=a.positions[a.positions.length-1];this.mousePos={x:s.x,y:s.y,id:s.id,debugData:a}}else a.positions.forEach((function(r){var n={doAction:function(){o.moveAndHover(r.x,r.y,r.id,t,a)},delay:r.timeOffset+e.timestamp-o.service.state.context.baselineTime};o.timer.addAction(n)})),this.timer.addAction({doAction:function(){},delay:e.delay-(null===(n=a.positions[0])||void 0===n?void 0:n.timeOffset)});break;case S.MouseInteraction:if(-1===a.id)break;var l=new Event(T[a.type].toLowerCase());if(!(b=this.mirror.getNode(a.id)))return this.debugNodeNotFound(a,a.id);this.emitter.emit(M.MouseInteraction,{type:a.type,target:b});var c=this.config.triggerFocus;switch(a.type){case T.Blur:"blur"in b&&b.blur();break;case T.Focus:c&&b.focus&&b.focus({preventScroll:!0});break;case T.Click:case T.TouchStart:case T.TouchEnd:t?(a.type===T.TouchStart?this.touchActive=!0:a.type===T.TouchEnd&&(this.touchActive=!1),this.mousePos={x:a.x,y:a.y,id:a.id,debugData:a}):(a.type===T.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(a.x,a.y,a.id,t,a),a.type===T.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):a.type===T.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):a.type===T.TouchEnd&&this.mouse.classList.remove("touch-active"));break;case T.TouchCancel:t?this.touchActive=!1:this.mouse.classList.remove("touch-active");break;default:b.dispatchEvent(l)}break;case S.Scroll:if(-1===a.id)break;if(t){this.treeIndex.scroll(a);break}this.applyScroll(a,!1);break;case S.ViewportResize:this.emitter.emit(M.Resize,{width:a.width,height:a.height});break;case S.Input:if(-1===a.id)break;if(t){this.treeIndex.input(a);break}this.applyInput(a);break;case S.MediaInteraction:if(!(b=this.mirror.getNode(a.id)))return this.debugNodeNotFound(a,a.id);var u=b;try{a.currentTime&&(u.currentTime=a.currentTime),a.volume&&(u.volume=a.volume),a.muted&&(u.muted=a.muted),1===a.type&&u.pause(),0===a.type&&u.play()}catch(e){this.config.showWarning&&console.warn("Failed to replay media interactions: ".concat(e.message||e))}break;case S.StyleSheetRule:if(!(b=this.mirror.getNode(a.id)))return this.debugNodeNotFound(a,a.id);var d,f=b,p=b.parentNode,h=this.fragmentParentMap.has(p),m=h?null:f.sheet;m||(this.virtualStyleRulesMap.has(b)?d=this.virtualStyleRulesMap.get(b):(d=[],this.virtualStyleRulesMap.set(b,d))),a.adds&&a.adds.forEach((function(e){var t=e.rule,r=e.index;if(m)try{if(Array.isArray(r)){var n=ee(r),i=n.positions,o=n.index;Z(m.cssRules,i).insertRule(t,o)}else{o=void 0===r?void 0:Math.min(r,m.cssRules.length);m.insertRule(t,o)}}catch(e){}else null==d||d.push({cssText:t,index:r,type:K.Insert})})),a.removes&&a.removes.forEach((function(e){var t=e.index;if(h)null==d||d.push({index:t,type:K.Remove});else try{if(Array.isArray(t)){var r=ee(t),n=r.positions,i=r.index;Z(m.cssRules,n).deleteRule(i||0)}else null==m||m.deleteRule(t)}catch(e){}}));break;case S.StyleDeclaration:if(!(b=this.mirror.getNode(a.id)))return this.debugNodeNotFound(a,a.id);f=b;var v=b.parentNode,y=this.fragmentParentMap.has(v)?null:f.sheet,g=[];if(y||(this.virtualStyleRulesMap.has(b)?g=this.virtualStyleRulesMap.get(b):(g=[],this.virtualStyleRulesMap.set(b,g))),a.set)if(y)Z(y.rules,a.index).style.setProperty(a.set.property,a.set.value,a.set.priority);else g.push(r({type:K.SetProperty,index:a.index},a.set));if(a.remove)if(y)Z(y.rules,a.index).style.removeProperty(a.remove.property);else g.push(r({type:K.RemoveProperty,index:a.index},a.remove));break;case S.CanvasMutation:if(!this.config.UNSAFE_replayCanvas)return;var b;if(!(b=this.mirror.getNode(a.id)))return this.debugNodeNotFound(a,a.id);!function(e){var t=e.event,r=e.mutation,n=e.target,i=e.imageMap,o=e.errorHandler;try{var a="commands"in r?r.commands:[r];[w.WebGL,w.WebGL2].includes(r.type)?a.forEach((function(e){ce({mutation:e,type:r.type,target:n,imageMap:i,errorHandler:o})})):a.forEach((function(e){!function(e){var t=e.event,r=e.mutation,n=e.target,i=e.imageMap,o=e.errorHandler;try{var a=n.getContext("2d");if(r.setter)return void(a[r.property]=r.args[0]);var s=a[r.property];if("drawImage"===r.property&&"string"==typeof r.args[0]){var l=i.get(t);r.args[0]=l,s.apply(a,r.args)}else s.apply(a,r.args)}catch(e){o(r,e)}}({event:t,mutation:e,target:n,imageMap:i,errorHandler:o})}))}catch(e){o(r,e)}}({event:e,mutation:a,target:b,imageMap:this.imageMap,errorHandler:this.warnCanvasMutationFailed.bind(this)});break;case S.Font:try{var x=new FontFace(a.family,a.buffer?new Uint8Array(JSON.parse(a.fontSource)):a.fontSource,a.descriptors);null===(i=this.iframe.contentDocument)||void 0===i||i.fonts.add(x)}catch(e){this.config.showWarning&&console.warn(e)}}},e.prototype.applyMutation=function(e,i){var o,a,s=this;e.removes.forEach((function(t){var r=s.mirror.getNode(t.id);if(!r){if(e.removes.find((function(e){return e.id===t.parentId})))return;return s.warnNodeNotFound(e,t.id)}s.virtualStyleRulesMap.has(r)&&s.virtualStyleRulesMap.delete(r);var n=s.mirror.getNode(t.parentId);if(!n)return s.warnNodeNotFound(e,t.parentId);if(t.isShadow&&J(n)&&(n=n.shadowRoot),s.mirror.removeNodeFromMap(r),n){var i=null,o="__sn"in n?s.fragmentParentMap.get(n):void 0;o&&o.contains(r)?n=o:s.fragmentParentMap.has(r)&&(i=s.fragmentParentMap.get(r),s.fragmentParentMap.delete(r),r=i);try{n.removeChild(r)}catch(t){if(!(t instanceof DOMException))throw t;s.warn("parent could not remove child in mutation",n,o,r,i,e)}}}));var l=r({},this.legacy_missingNodeRetryMap),c=[],u=function(e){var r,o,a,u;if(!s.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");var d=s.mirror.getNode(e.parentId);if(!d)return e.node.type===t.Document?s.newDocumentQueue.push(e):c.push(e);var f=null;s.iframe.contentDocument.contains?f=s.iframe.contentDocument.contains(d):s.iframe.contentDocument.body.contains&&(f=s.iframe.contentDocument.body.contains(d));var p=(null===(u=(a=d).getElementsByTagName)||void 0===u?void 0:u.call(a,"iframe").length)>0;if(i&&f&&!q(d)&&!p){var h=document.createDocumentFragment();for(s.mirror.map[e.parentId]=h,s.fragmentParentMap.set(h,d),s.storeState(d);d.firstChild;)h.appendChild(d.firstChild);d=h}e.node.isShadow&&(J(d)||d.attachShadow({mode:"open"}),d=d.shadowRoot);var m=null,v=null;if(e.previousId&&(m=s.mirror.getNode(e.previousId)),e.nextId&&(v=s.mirror.getNode(e.nextId)),function(e){var t=null;return e.nextId&&(t=s.mirror.getNode(e.nextId)),null!==e.nextId&&void 0!==e.nextId&&-1!==e.nextId&&!t}(e))return c.push(e);if(!e.node.rootId||s.mirror.getNode(e.node.rootId)){var g=e.node.rootId?s.mirror.getNode(e.node.rootId):s.iframe.contentDocument;if(q(d))s.attachDocumentToIframe(e,d);else{var b=y(e.node,{doc:g,map:s.mirror.map,skipChild:!0,hackCss:!0,cache:s.cache});if(-1!==e.previousId&&-1!==e.nextId){if("__sn"in d&&d.__sn.type===t.Element&&"textarea"===d.__sn.tagName&&e.node.type===t.Text)try{for(var x=n(Array.from(d.childNodes)),S=x.next();!S.done;S=x.next()){var T=S.value;T.nodeType===d.TEXT_NODE&&d.removeChild(T)}}catch(e){r={error:e}}finally{try{S&&!S.done&&(o=x.return)&&o.call(x)}finally{if(r)throw r.error}}if(m&&m.nextSibling&&m.nextSibling.parentNode)d.insertBefore(b,m.nextSibling);else if(v&&v.parentNode)d.contains(v)?d.insertBefore(b,v):d.insertBefore(b,null);else{if(d===g)for(;g.firstChild;)g.removeChild(g.firstChild);d.appendChild(b)}if(q(b)){var w=s.newDocumentQueue.find((function(e){return e.parentId===b.__sn.id}));w&&(s.attachDocumentToIframe(w,b),s.newDocumentQueue=s.newDocumentQueue.filter((function(e){return e!==w})))}(e.previousId||e.nextId)&&s.legacy_resolveMissingNode(l,d,b,e)}else l[e.node.id]={node:b,mutation:e}}}};e.adds.forEach((function(e){u(e)}));for(var d=Date.now();c.length;){var f=X(c);if(c.length=0,Date.now()-d>500){this.warn("Timeout in the loop, please check the resolve tree data:",f);break}try{for(var p=(o=void 0,n(f)),h=p.next();!h.done;h=p.next()){var m=h.value;this.mirror.getNode(m.value.parentId)?Q(m,(function(e){u(e)})):this.debug("Drop resolve tree since there is no parent for the root node.",m)}}catch(e){o={error:e}}finally{try{h&&!h.done&&(a=p.return)&&a.call(p)}finally{if(o)throw o.error}}}Object.keys(l).length&&Object.assign(this.legacy_missingNodeRetryMap,l),e.texts.forEach((function(t){var r=s.mirror.getNode(t.id);if(!r){if(e.removes.find((function(e){return e.id===t.id})))return;return s.warnNodeNotFound(e,t.id)}s.fragmentParentMap.has(r)&&(r=s.fragmentParentMap.get(r)),r.textContent=t.value})),e.attributes.forEach((function(t){var r=s.mirror.getNode(t.id);if(!r){if(e.removes.find((function(e){return e.id===t.id})))return;return s.warnNodeNotFound(e,t.id)}for(var n in s.fragmentParentMap.has(r)&&(r=s.fragmentParentMap.get(r)),t.attributes)if("string"==typeof n){var i=t.attributes[n];if(null===i)r.removeAttribute(n);else if("string"==typeof i)try{r.setAttribute(n,i)}catch(e){s.config.showWarning&&console.warn("An error occurred may due to the checkout feature.",e)}else if("style"===n){var o=i,a=r;for(var l in o)if(!1===o[l])a.style.removeProperty(l);else if(o[l]instanceof Array){var c=o[l];a.style.setProperty(l,c[0],c[1])}else{var u=o[l];a.style.setProperty(l,u)}}}}))},e.prototype.applyScroll=function(e,r){var n=this.mirror.getNode(e.id);if(!n)return this.debugNodeNotFound(e,e.id);if(n===this.iframe.contentDocument)this.iframe.contentWindow.scrollTo({top:e.y,left:e.x,behavior:r?"auto":"smooth"});else if(n.__sn.type===t.Document)n.defaultView.scrollTo({top:e.y,left:e.x,behavior:r?"auto":"smooth"});else try{n.scrollTop=e.y,n.scrollLeft=e.x}catch(e){}},e.prototype.applyInput=function(e){var t=this.mirror.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);try{t.checked=e.isChecked,t.value=e.text}catch(e){}},e.prototype.applyText=function(e,t){var r=this.mirror.getNode(e.id);if(!r)return this.debugNodeNotFound(t,e.id);try{r.textContent=e.value}catch(e){}},e.prototype.legacy_resolveMissingNode=function(e,t,r,n){var i=n.previousId,o=n.nextId,a=i&&e[i],s=o&&e[o];if(a){var l=a,c=l.node,u=l.mutation;t.insertBefore(c,r),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,c,u)}if(s){var d=s;c=d.node,u=d.mutation;t.insertBefore(c,r.nextSibling),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,c,u)}},e.prototype.moveAndHover=function(e,t,r,n,i){var o=this.mirror.getNode(r);if(!o)return this.debugNodeNotFound(i,r);var a=$(o,this.iframe),s=e*a.absoluteScale+a.x,l=t*a.absoluteScale+a.y;this.mouse.style.left="".concat(s,"px"),this.mouse.style.top="".concat(l,"px"),n||this.drawMouseTail({x:s,y:l}),this.hoverElements(o)},e.prototype.drawMouseTail=function(e){var t=this;if(this.mouseTail){var r=!0===this.config.mouseTail?pe:Object.assign({},pe,this.config.mouseTail),n=r.lineCap,i=r.lineWidth,o=r.strokeStyle,a=r.duration,s=function(){if(t.mouseTail){var e=t.mouseTail.getContext("2d");e&&t.tailPositions.length&&(e.clearRect(0,0,t.mouseTail.width,t.mouseTail.height),e.beginPath(),e.lineWidth=i,e.lineCap=n,e.strokeStyle=o,e.moveTo(t.tailPositions[0].x,t.tailPositions[0].y),t.tailPositions.forEach((function(t){return e.lineTo(t.x,t.y)})),e.stroke())}};this.tailPositions.push(e),s(),setTimeout((function(){t.tailPositions=t.tailPositions.filter((function(t){return t!==e})),s()}),a/this.speedService.state.context.timer.speed)}},e.prototype.hoverElements=function(e){var t;null===(t=this.iframe.contentDocument)||void 0===t||t.querySelectorAll(".\\:hover").forEach((function(e){e.classList.remove(":hover")}));for(var r=e;r;)r.classList&&r.classList.add(":hover"),r=r.parentElement},e.prototype.isUserInteraction=function(e){return e.type===x.IncrementalSnapshot&&(e.data.source>S.Mutation&&e.data.source<=S.Input)},e.prototype.backToNormal=function(){this.nextUserInteractionEvent=null,this.speedService.state.matches("normal")||(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(M.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))},e.prototype.restoreRealParent=function(e,r){this.mirror.map[r.__sn.id]=r,r.__sn.type===t.Element&&"textarea"===r.__sn.tagName&&e.textContent&&(r.value=e.textContent),r.appendChild(e),this.restoreState(r)},e.prototype.storeState=function(e){var t,r;if(e&&e.nodeType===e.ELEMENT_NODE){var i=e;(i.scrollLeft||i.scrollTop)&&this.elementStateMap.set(e,{scroll:[i.scrollLeft,i.scrollTop]}),"STYLE"===i.tagName&&function(e,t){var r;try{var n=Array.from((null===(r=e.sheet)||void 0===r?void 0:r.cssRules)||[]).map((function(e){return e.cssText}));t.set(e,[{type:K.Snapshot,cssTexts:n}])}catch(e){}}(i,this.virtualStyleRulesMap);var o=i.children;try{for(var a=n(Array.from(o)),s=a.next();!s.done;s=a.next()){var l=s.value;this.storeState(l)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}},e.prototype.restoreState=function(e){var t,r;if(e.nodeType===e.ELEMENT_NODE){var i=e;if(this.elementStateMap.has(e)){var o=this.elementStateMap.get(e);o.scroll&&(i.scrollLeft=o.scroll[0],i.scrollTop=o.scroll[1]),this.elementStateMap.delete(e)}var a=i.children;try{for(var s=n(Array.from(a)),l=s.next();!l.done;l=s.next()){var c=l.value;this.restoreState(c)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}}},e.prototype.restoreNodeSheet=function(e){var t=this.virtualStyleRulesMap.get(e);"STYLE"===e.nodeName&&(t&&te(t,e))},e.prototype.warnNodeNotFound=function(e,t){this.treeIndex.idRemoved(t)?this.warn("Node with id '".concat(t,"' was previously removed. "),e):this.warn("Node with id '".concat(t,"' not found. "),e)},e.prototype.warnCanvasMutationFailed=function(e,t){this.warn("Has error on canvas update",t,"canvas mutation:",e)},e.prototype.debugNodeNotFound=function(e,t){this.treeIndex.idRemoved(t)?this.debug(fe,"Node with id '".concat(t,"' was previously removed. "),e):this.debug(fe,"Node with id '".concat(t,"' not found. "),e)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.config.showWarning&&console.warn.apply(console,o([fe],i(e),!1))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.config.showDebug&&console.log.apply(console,o([fe],i(e),!1))},e}();return e.Replayer=me,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
15
+ ***************************************************************************** */function He(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=He(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,G=A===void 0?function(){return!0}:A,W=R===void 0,De=R??d,Me=e.states[De];if(G(m,f)){var ee=He(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],xe=ee[1],Ce=ee[2],Q=R??d;return{value:Q,context:xe,actions:ce,changed:R!==d||ce.length>0||Ce,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===C.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
16
+ 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,xr=Object.prototype.hasOwnProperty,Cr=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={}))xr.call(t,r)&&ht(e,r,t[r]);if(dt)for(var r of dt(t))Cr.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=Ge||Zt,Ee="[replayer]",we={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function be(e){return e.type==M.IncrementalSnapshot&&(e.data.source==C.TouchMove||e.data.source==C.MouseInteraction&&e.data.type==_.TouchStart)}class Rr{constructor(t,r){if(this.usingVirtualDom=!1,this.virtualDom=new H,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(B(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);B(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===C.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=[];Ct(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:U.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===C.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 C.Mutation:{try{this.applyMutation(o,r)}catch(c){this.warn(`Exception in mutation ${c.message||c}`,o)}break}case C.Drag:case C.TouchMove:case C.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 C.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 C.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 C.ViewportResize:this.emitter.emit(D.Resize,{width:o.width,height:o.height});break;case C.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 C.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 C.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:U.Insert})),(s=o.removes)==null||s.forEach(({index:m})=>d?.push({index:m,type:U.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 C.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:U.SetProperty,index:o.index},o.set)),o.remove&&d.push(X({type:U.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 C.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 C.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>C.Mutation&&t.data.source<=C.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}({});
30
18
  //# sourceMappingURL=rrweb-replay.min.js.map