Socket
Socket
Sign inDemoInstall

rrweb

Package Overview
Dependencies
5
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.9.7 to 0.9.8

2

dist/record/rrweb-record.min.js

@@ -15,3 +15,3 @@ var rrwebRecord=function(){"use strict";

and limitations under the License.
***************************************************************************** */var e,t=function(){return(t=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function n(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function o(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i}function r(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(o(arguments[t]));return e}!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"}(e||(e={}));var a=1,i=RegExp("[^a-z1-6-_]");function u(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).reduce((function(e,t){return e+(function(e){return"styleSheet"in e}(n=t)?u(n.styleSheet)||"":n.cssText);var n}),""):null}catch(e){return null}}var s,l,c,d,p,f=/url\((?:'([^']*)'|"([^"]*)"|([^)]*))\)/gm,v=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/,h=/^(data:)([\w\/\+\-]+);(charset=[\w-]+|base64).*,(.*)/i;function m(e,t){return(e||"").replace(f,(function(e,n,o,r){var a,i=n||o||r;if(!i)return e;if(!v.test(i))return"url('"+i+"')";if(h.test(i))return"url("+i+")";if("/"===i[0])return"url('"+(((a=t).indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+i+"')");var u=t.split("/"),s=i.split("/");u.pop();for(var l=0,c=s;l<c.length;l++){var d=c[l];"."!==d&&(".."===d?u.pop():u.push(d))}return"url('"+u.join("/")+"')"}))}function y(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function g(e,t,n){return"src"===t||"href"===t&&n?y(e,n):"srcset"===t&&n?function(e,t){return""===t.trim()?t:t.split(",").map((function(t){var n=t.trimLeft().trimRight().split(" ");return 2===n.length?y(e,n[0])+" "+n[1]:1===n.length?""+y(e,n[0]):""})).join(", ")}(e,n):"style"===t&&n?m(n,location.href):n}function b(t,n,o,r,a,s){switch(void 0===a&&(a={}),t.nodeType){case t.DOCUMENT_NODE:return{type:e.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:e.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId};case t.ELEMENT_NODE:var l=!1;"string"==typeof o?l=t.classList.contains(o):t.classList.forEach((function(e){o.test(e)&&(l=!0)}));for(var c=function(e){var t=e.toLowerCase().trim();return i.test(t)?"div":t}(t.tagName),d={},p=0,f=Array.from(t.attributes);p<f.length;p++){var v=f[p],h=v.name,y=v.value;d[h]=g(n,h,y)}if("link"===c&&r){var b,C=Array.from(n.styleSheets).find((function(e){return e.href===t.href}));(b=u(C))&&(delete d.rel,delete d.href,d._cssText=m(b,C.href))}if("style"===c&&t.sheet&&!(t.innerText||t.textContent||"").trim().length)(b=u(t.sheet))&&(d._cssText=m(b,location.href));if("input"===c||"textarea"===c||"select"===c){y=t.value;"radio"!==d.type&&"checkbox"!==d.type&&"submit"!==d.type&&"button"!==d.type&&y?d.value=a[d.type]||a[c]?"*".repeat(y.length):y:t.checked&&(d.checked=t.checked)}if("option"===c){var S=t.parentElement;d.value===S.value&&(d.selected=t.selected)}if("canvas"===c&&s&&(d.rr_dataURL=t.toDataURL()),"audio"!==c&&"video"!==c||(d.rr_mediaState=t.paused?"paused":"played"),t.scrollLeft&&(d.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(d.rr_scrollTop=t.scrollTop),l){var w=t.getBoundingClientRect(),E=w.width,I=w.height;d.rr_width=E+"px",d.rr_height=I+"px"}return{type:e.Element,tagName:c,attributes:d,childNodes:[],isSVG:(M=t,"svg"===M.tagName||M instanceof SVGElement||void 0),needBlock:l};case t.TEXT_NODE:var x=t.parentNode&&t.parentNode.tagName,N=t.textContent,T="STYLE"===x||void 0;return T&&N&&(N=m(N,location.href)),"SCRIPT"===x&&(N="SCRIPT_PLACEHOLDER"),{type:e.Text,textContent:N||"",isStyle:T};case t.CDATA_SECTION_NODE:return{type:e.CDATA,textContent:""};case t.COMMENT_NODE:return{type:e.Comment,textContent:t.textContent||""};default:return!1}var M}function C(t,n,o,r,i,u,s,l){void 0===i&&(i=!1),void 0===u&&(u=!0);var c,d=b(t,n,r,u,s,l||!1);if(!d)return console.warn(t,"not serialized"),null;c="__sn"in t?t.__sn.id:a++;var p=Object.assign(d,{id:c});t.__sn=p,o[c]=t;var f=!i;if(p.type===e.Element&&(f=f&&!p.needBlock,delete p.needBlock),(p.type===e.Document||p.type===e.Element)&&f)for(var v=0,h=Array.from(t.childNodes);v<h.length;v++){var m=C(h[v],n,o,r,i,u,s,l);m&&p.childNodes.push(m)}return p}function S(e,t,n){void 0===n&&(n=document);var o={capture:!0,passive:!0};return n.addEventListener(e,t,o),function(){return n.removeEventListener(e,t,o)}}!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"}(s||(s={})),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"}(l||(l={})),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"}(c||(c={})),function(e){e[e.Play=0]="Play",e[e.Pause=1]="Pause"}(d||(d={})),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"}(p||(p={}));var w={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return w.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete w.map[t],e.childNodes&&e.childNodes.forEach((function(e){return w.removeNodeFromMap(e)}))},has:function(e){return w.map.hasOwnProperty(e)}};function E(e,t,n){void 0===n&&(n={});var o=null,r=0;return function(a){var i=Date.now();r||!1!==n.leading||(r=i);var u=t-(i-r),s=this,l=arguments;u<=0||u>t?(o&&(window.clearTimeout(o),o=null),r=i,e.apply(s,l)):o||!1===n.trailing||(o=window.setTimeout((function(){r=!1===n.leading?0:Date.now(),o=null,e.apply(s,l)}),u))}}function I(e,t,n,o,r){void 0===r&&(r=window);var a=r.Object.getOwnPropertyDescriptor(e,t);return r.Object.defineProperty(e,t,o?n:{set:function(e){var t=this;setTimeout((function(){n.set.call(t,e)}),0),a&&a.set&&a.set.call(this,e)}}),function(){return I(e,t,a||{},!0)}}function x(e,t,n){try{if(!(t in e))return function(){};var o=e[t],r=n(o);return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:o}})),e[t]=r,function(){e[t]=o}}catch(e){return function(){}}}function N(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function T(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function M(e,t){if(!e)return!1;if(e.nodeType===e.ELEMENT_NODE){var n=!1;return"string"==typeof t?n=e.classList.contains(t):e.classList.forEach((function(e){t.test(e)&&(n=!0)})),n||M(e.parentNode,t)}return e.nodeType,e.TEXT_NODE,M(e.parentNode,t)}function _(e){return Boolean(e.changedTouches)}function k(e){return"__ln"in e}var D=function(){function e(){this.length=0,this.head=null}return e.prototype.get=function(e){if(e>=this.length)throw new Error("Position outside of list range");for(var t=this.head,n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t},e.prototype.addNode=function(e){var t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&k(e.previousSibling)){var n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&k(e.nextSibling)){n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;this.length++},e.prototype.removeNode=function(e){var t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next&&(t.next.previous=t.previous)):(this.head=t.next,this.head&&(this.head.previous=null)),e.__ln&&delete e.__ln,this.length--)},e}(),L=function(e,t){return e+"@"+t};function O(e){return"__sn"in e}var R=function(e,t,o,r,a){var i=this;this.texts=[],this.attributes=[],this.removes=[],this.adds=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=function(e){var t,o,r,a;e.forEach(i.processMutation);var u=new D,s=function(e){var t=e.nextSibling&&w.getId(e.nextSibling);return-1===t&&M(e.nextSibling,i.blockClass)&&(t=null),t},l=function(e){if(e.parentNode){var t=w.getId(e.parentNode),n=s(e);if(-1===t||-1===n)return u.addNode(e);i.adds.push({parentId:t,nextId:n,node:C(e,document,w.map,i.blockClass,!0,i.inlineStylesheet,i.maskInputOptions,i.recordCanvas)})}};try{for(var c=n(i.movedSet),d=c.next();!d.done;d=c.next())l(v=d.value)}catch(e){t={error:e}}finally{try{d&&!d.done&&(o=c.return)&&o.call(c)}finally{if(t)throw t.error}}try{for(var p=n(i.addedSet),f=p.next();!f.done;f=p.next()){var v=f.value;P(i.droppedSet,v)||F(i.removes,v)?P(i.movedSet,v)?l(v):i.droppedSet.add(v):l(v)}}catch(e){r={error:e}}finally{try{f&&!f.done&&(a=p.return)&&a.call(p)}finally{if(r)throw r.error}}for(var h=null;u.length;){var m=null;if(h){var y=w.getId(h.value.parentNode),g=s(h.value);-1!==y&&-1!==g&&(m=h)}if(!m)for(var b=u.length-1;b>=0;b--){var S=u.get(b);if(y=w.getId(S.value.parentNode),g=s(S.value),-1!==y&&-1!==g){m=S;break}}if(!m)break;h=m.previous,u.removeNode(m.value),l(m.value)}i.emit()},this.emit=function(){var e={texts:i.texts.map((function(e){return{id:w.getId(e.node),value:e.value}})).filter((function(e){return w.has(e.id)})),attributes:i.attributes.map((function(e){return{id:w.getId(e.node),attributes:e.attributes}})).filter((function(e){return w.has(e.id)})),removes:i.removes,adds:i.adds};(e.texts.length||e.attributes.length||e.removes.length||e.adds.length)&&(i.emissionCallback(e),i.texts=[],i.attributes=[],i.removes=[],i.adds=[],i.addedSet=new Set,i.movedSet=new Set,i.droppedSet=new Set,i.movedMap={})},this.processMutation=function(e){switch(e.type){case"characterData":var t=e.target.textContent;M(e.target,i.blockClass)||t===e.oldValue||i.texts.push({value:t,node:e.target});break;case"attributes":if(t=e.target.getAttribute(e.attributeName),M(e.target,i.blockClass)||t===e.oldValue)return;var n=i.attributes.find((function(t){return t.node===e.target}));n||(n={node:e.target,attributes:{}},i.attributes.push(n)),n.attributes[e.attributeName]=g(document,e.attributeName,t);break;case"childList":e.addedNodes.forEach((function(t){return i.genAdds(t,e.target)})),e.removedNodes.forEach((function(t){var n=w.getId(t),o=w.getId(e.target);M(t,i.blockClass)||M(e.target,i.blockClass)||(i.addedSet.has(t)?(A(i.addedSet,t),i.droppedSet.add(t)):i.addedSet.has(e.target)&&-1===n||function e(t){var n=w.getId(t);return!w.has(n)||(!t.parentNode||t.parentNode.nodeType!==t.DOCUMENT_NODE)&&(!t.parentNode||e(t.parentNode))}(e.target)||(i.movedSet.has(t)&&i.movedMap[L(n,o)]?A(i.movedSet,t):i.removes.push({parentId:o,id:n})),w.removeNodeFromMap(t))}))}},this.genAdds=function(e,t){if(!M(e,i.blockClass)){if(O(e)){i.movedSet.add(e);var n=null;t&&O(t)&&(n=t.__sn.id),n&&(i.movedMap[L(e.__sn.id,n)]=!0)}else i.addedSet.add(e),i.droppedSet.delete(e);e.childNodes.forEach((function(e){return i.genAdds(e)}))}},this.blockClass=t,this.inlineStylesheet=o,this.maskInputOptions=r,this.recordCanvas=a,this.emissionCallback=e};function A(e,t){e.delete(t),t.childNodes.forEach((function(t){return A(e,t)}))}function F(e,t){var n=t.parentNode;if(!n)return!1;var o=w.getId(n);return!!e.some((function(e){return e.id===o}))||F(e,n)}function P(e,t){var n=t.parentNode;return!!n&&(!!e.has(n)||P(e,n))}function z(e,t,n){if(!1===n.mouseInteraction)return function(){};var o=!0===n.mouseInteraction||void 0===n.mouseInteraction?{}:n.mouseInteraction,r=[];return Object.keys(c).filter((function(e){return Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==o[e]})).forEach((function(n){var o=n.toLowerCase(),a=function(n){return function(o){if(!M(o.target,t)){var r=w.getId(o.target),a=_(o)?o.changedTouches[0]:o,i=a.clientX,u=a.clientY;e({type:c[n],id:r,x:i,y:u})}}}(n);r.push(S(o,a))})),function(){r.forEach((function(e){return e()}))}}var j,H=["INPUT","TEXTAREA","SELECT"],U=new WeakMap;function V(e,o){void 0===o&&(o={}),function(e,t){var n=e.mutationCb,o=e.mousemoveCb,a=e.mouseInteractionCb,i=e.scrollCb,u=e.viewportResizeCb,s=e.inputCb,l=e.mediaInteractionCb,c=e.styleSheetRuleCb,d=e.canvasMutationCb,p=e.fontCb;e.mutationCb=function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];t.mutation&&t.mutation.apply(t,r(e)),n.apply(void 0,r(e))},e.mousemoveCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mousemove&&t.mousemove.apply(t,r(e)),o.apply(void 0,r(e))},e.mouseInteractionCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mouseInteraction&&t.mouseInteraction.apply(t,r(e)),a.apply(void 0,r(e))},e.scrollCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.scroll&&t.scroll.apply(t,r(e)),i.apply(void 0,r(e))},e.viewportResizeCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.viewportResize&&t.viewportResize.apply(t,r(e)),u.apply(void 0,r(e))},e.inputCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.input&&t.input.apply(t,r(e)),s.apply(void 0,r(e))},e.mediaInteractionCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mediaInteaction&&t.mediaInteaction.apply(t,r(e)),l.apply(void 0,r(e))},e.styleSheetRuleCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.styleSheetRule&&t.styleSheetRule.apply(t,r(e)),c.apply(void 0,r(e))},e.canvasMutationCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.canvasMutation&&t.canvasMutation.apply(t,r(e)),d.apply(void 0,r(e))},e.fontCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.font&&t.font.apply(t,r(e)),p.apply(void 0,r(e))}}(e,o);var a,i,u,s,c,p,f,v=(a=e.mutationCb,i=e.blockClass,u=e.inlineStylesheet,s=e.maskInputOptions,c=e.recordCanvas,p=new R(a,i,u,s,c),(f=new MutationObserver(p.processMutations)).observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),f),h=function(e,t){if(!1===t.mousemove)return function(){};var n,o="number"==typeof t.mousemove?t.mousemove:50,r=[],a=E((function(t){var o=Date.now()-n;e(r.map((function(e){return e.timeOffset-=o,e})),t?l.TouchMove:l.MouseMove),r=[],n=null}),500),i=E((function(e){var t=e.target,o=_(e)?e.changedTouches[0]:e,i=o.clientX,u=o.clientY;n||(n=Date.now()),r.push({x:i,y:u,id:w.getId(t),timeOffset:Date.now()-n}),a(_(e))}),o,{trailing:!1}),u=[S("mousemove",i),S("touchmove",i)];return function(){u.forEach((function(e){return e()}))}}(e.mousemoveCb,e.sampling),m=z(e.mouseInteractionCb,e.blockClass,e.sampling),y=function(e,t,n){return S("scroll",E((function(n){if(n.target&&!M(n.target,t)){var o=w.getId(n.target);if(n.target===document){var r=document.scrollingElement||document.documentElement;e({id:o,x:r.scrollLeft,y:r.scrollTop})}else e({id:o,x:n.target.scrollLeft,y:n.target.scrollTop})}}),n.scroll||100))}(e.scrollCb,e.blockClass,e.sampling),g=function(e){return S("resize",E((function(){var t=N(),n=T();e({width:Number(n),height:Number(t)})}),200),window)}(e.viewportResizeCb),b=function(e,n,o,a,i){function u(e){var t=e.target;if(t&&t.tagName&&!(H.indexOf(t.tagName)<0)&&!M(t,n)){var r=t.type;if("password"!==r&&!t.classList.contains(o)){var i=t.value,u=!1;"radio"===r||"checkbox"===r?u=t.checked:(a[t.tagName.toLowerCase()]||a[r])&&(i="*".repeat(i.length)),s(t,{text:i,isChecked:u});var l=t.name;"radio"===r&&l&&u&&document.querySelectorAll('input[type="radio"][name="'+l+'"]').forEach((function(e){e!==t&&s(e,{text:e.value,isChecked:!u})}))}}}function s(n,o){var r=U.get(n);if(!r||r.text!==o.text||r.isChecked!==o.isChecked){U.set(n,o);var a=w.getId(n);e(t(t({},o),{id:a}))}}var l=("last"===i.input?["change"]:["input","change"]).map((function(e){return S(e,u)})),c=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"),d=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"],[HTMLSelectElement.prototype,"selectedIndex"]];return c&&c.set&&l.push.apply(l,r(d.map((function(e){return I(e[0],e[1],{set:function(){u({target:this})}})})))),function(){l.forEach((function(e){return e()}))}}(e.inputCb,e.blockClass,e.ignoreClass,e.maskInputOptions,e.sampling),C=function(e,t){var n=function(n){return function(o){var r=o.target;r&&!M(r,t)&&e({type:"play"===n?d.Play:d.Pause,id:w.getId(r)})}},o=[S("play",n("play")),S("pause",n("pause"))];return function(){o.forEach((function(e){return e()}))}}(e.mediaInteractionCb,e.blockClass),k=function(e){var t=CSSStyleSheet.prototype.insertRule;CSSStyleSheet.prototype.insertRule=function(n,o){var r=w.getId(this.ownerNode);return-1!==r&&e({id:r,adds:[{rule:n,index:o}]}),t.apply(this,arguments)};var n=CSSStyleSheet.prototype.deleteRule;return CSSStyleSheet.prototype.deleteRule=function(t){var o=w.getId(this.ownerNode);return-1!==o&&e({id:o,removes:[{index:t}]}),n.apply(this,arguments)},function(){CSSStyleSheet.prototype.insertRule=t,CSSStyleSheet.prototype.deleteRule=n}}(e.styleSheetRuleCb),D=e.recordCanvas?function(e,t){var o,a,i=Object.getOwnPropertyNames(CanvasRenderingContext2D.prototype),u=[],s=function(n){try{if("function"!=typeof CanvasRenderingContext2D.prototype[n])return"continue";var o=x(CanvasRenderingContext2D.prototype,n,(function(o){return function(){for(var a=this,i=[],u=0;u<arguments.length;u++)i[u]=arguments[u];return M(this.canvas,t)||setTimeout((function(){var t=r(i);"drawImage"===n&&t[0]&&t[0]instanceof HTMLCanvasElement&&(t[0]=t[0].toDataURL()),e({id:w.getId(a.canvas),property:n,args:t})}),0),o.apply(this,i)}}));u.push(o)}catch(t){var a=I(CanvasRenderingContext2D.prototype,n,{set:function(t){e({id:w.getId(this.canvas),property:n,args:[t],setter:!0})}});u.push(a)}};try{for(var l=n(i),c=l.next();!c.done;c=l.next()){s(c.value)}}catch(e){o={error:e}}finally{try{c&&!c.done&&(a=l.return)&&a.call(l)}finally{if(o)throw o.error}}return function(){u.forEach((function(e){return e()}))}}(e.canvasMutationCb,e.blockClass):function(){},L=e.collectFonts?function(e){var t=[],n=new WeakMap,o=FontFace;window.FontFace=function(e,t,r){var a=new o(e,t,r);return n.set(a,{family:e,buffer:"string"!=typeof t,descriptors:r,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),a};var r=x(document.fonts,"add",(function(t){return function(o){return setTimeout((function(){var t=n.get(o);t&&(e(t),n.delete(o))}),0),t.apply(this,[o])}}));return t.push((function(){window.FonFace=o})),t.push(r),function(){t.forEach((function(e){return e()}))}}(e.fontCb):function(){};return function(){v.disconnect(),h(),m(),y(),g(),b(),C(),k(),D(),L()}}function B(e){return t(t({},e),{timestamp:Date.now()})}function W(e){void 0===e&&(e={});var n=e.emit,r=e.checkoutEveryNms,a=e.checkoutEveryNth,i=e.blockClass,u=void 0===i?"rr-block":i,c=e.ignoreClass,d=void 0===c?"rr-ignore":c,p=e.inlineStylesheet,f=void 0===p||p,v=e.maskAllInputs,h=e.maskInputOptions,m=e.hooks,y=e.packFn,g=e.sampling,b=void 0===g?{}:g,E=e.mousemoveWait,I=e.recordCanvas,x=void 0!==I&&I,M=e.collectFonts,_=void 0!==M&&M;if(!n)throw new Error("emit function is required");void 0!==E&&void 0===b.mousemove&&(b.mousemove=E);var k,D,L=!0===v?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0}:void 0!==h?h:{};void 0===k&&(k=window),"NodeList"in k&&!k.NodeList.prototype.forEach&&(k.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in k&&!k.DOMTokenList.prototype.forEach&&(k.DOMTokenList.prototype.forEach=Array.prototype.forEach);var O=0;function R(e){var t,n,r,a;void 0===e&&(e=!1),j(B({type:s.Meta,data:{href:window.location.href,width:T(),height:N()}}),e);var i=o(function(e,t,n,o,r){void 0===t&&(t="rr-block"),void 0===n&&(n=!0);var a={};return[C(e,e,a,t,!1,n,!0===o?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0}:!1===o?{}:o,r),a]}(document,u,f,L,x),2),l=i[0],c=i[1];if(!l)return console.warn("Failed to snapshot the document");w.map=c,j(B({type:s.FullSnapshot,data:{node:l,initialOffset:{left:void 0!==window.pageXOffset?window.pageXOffset:(null===document||void 0===document?void 0:document.documentElement.scrollLeft)||(null===(n=null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===document||void 0===document?void 0:document.body.scrollLeft)||0,top:void 0!==window.pageYOffset?window.pageYOffset:(null===document||void 0===document?void 0:document.documentElement.scrollTop)||(null===(a=null===(r=null===document||void 0===document?void 0:document.body)||void 0===r?void 0:r.parentElement)||void 0===a?void 0:a.scrollTop)||(null===document||void 0===document?void 0:document.body.scrollTop)||0}}}))}j=function(e,t){if(n(y?y(e):e,t),e.type===s.FullSnapshot)D=e,O=0;else if(e.type===s.IncrementalSnapshot){O++;var o=a&&O>=a,i=r&&e.timestamp-D.timestamp>r;(o||i)&&R(!0)}};try{var A=[];A.push(S("DOMContentLoaded",(function(){j(B({type:s.DomContentLoaded,data:{}}))})));var F=function(){R(),A.push(V({mutationCb:function(e){return j(B({type:s.IncrementalSnapshot,data:t({source:l.Mutation},e)}))},mousemoveCb:function(e,t){return j(B({type:s.IncrementalSnapshot,data:{source:t,positions:e}}))},mouseInteractionCb:function(e){return j(B({type:s.IncrementalSnapshot,data:t({source:l.MouseInteraction},e)}))},scrollCb:function(e){return j(B({type:s.IncrementalSnapshot,data:t({source:l.Scroll},e)}))},viewportResizeCb:function(e){return j(B({type:s.IncrementalSnapshot,data:t({source:l.ViewportResize},e)}))},inputCb:function(e){return j(B({type:s.IncrementalSnapshot,data:t({source:l.Input},e)}))},mediaInteractionCb:function(e){return j(B({type:s.IncrementalSnapshot,data:t({source:l.MediaInteraction},e)}))},styleSheetRuleCb:function(e){return j(B({type:s.IncrementalSnapshot,data:t({source:l.StyleSheetRule},e)}))},canvasMutationCb:function(e){return j(B({type:s.IncrementalSnapshot,data:t({source:l.CanvasMutation},e)}))},fontCb:function(e){return j(B({type:s.IncrementalSnapshot,data:t({source:l.Font},e)}))},blockClass:u,ignoreClass:d,maskInputOptions:L,inlineStylesheet:f,sampling:b,recordCanvas:x,collectFonts:_},m))};return"interactive"===document.readyState||"complete"===document.readyState?F():A.push(S("load",(function(){j(B({type:s.Load,data:{}})),F()}),window)),function(){A.forEach((function(e){return e()}))}}catch(e){console.warn(e)}}return W.addCustomEvent=function(e,t){if(!j)throw new Error("please add custom event after start recording");j(B({type:s.Custom,data:{tag:e,payload:t}}))},W}();
***************************************************************************** */var e,t=function(){return(t=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function n(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function o(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i}function r(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(o(arguments[t]));return e}!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"}(e||(e={}));var a=1,i=RegExp("[^a-z1-6-_]");function u(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).reduce((function(e,t){return e+(function(e){return"styleSheet"in e}(n=t)?u(n.styleSheet)||"":n.cssText);var n}),""):null}catch(e){return null}}var s,c,l,d,p,f=/url\((?:'([^']*)'|"([^"]*)"|([^)]*))\)/gm,v=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/,h=/^(data:)([\w\/\+\-]+);(charset=[\w-]+|base64).*,(.*)/i;function m(e,t){return(e||"").replace(f,(function(e,n,o,r){var a,i=n||o||r;if(!i)return e;if(!v.test(i))return"url('"+i+"')";if(h.test(i))return"url("+i+")";if("/"===i[0])return"url('"+(((a=t).indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+i+"')");var u=t.split("/"),s=i.split("/");u.pop();for(var c=0,l=s;c<l.length;c++){var d=l[c];"."!==d&&(".."===d?u.pop():u.push(d))}return"url('"+u.join("/")+"')"}))}function y(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function g(e,t,n){return"src"===t||"href"===t&&n?y(e,n):"srcset"===t&&n?function(e,t){return""===t.trim()?t:t.split(",").map((function(t){var n=t.trimLeft().trimRight().split(" ");return 2===n.length?y(e,n[0])+" "+n[1]:1===n.length?""+y(e,n[0]):""})).join(", ")}(e,n):"style"===t&&n?m(n,location.href):n}function b(t,n,o,r,a,s){switch(void 0===a&&(a={}),t.nodeType){case t.DOCUMENT_NODE:return{type:e.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:e.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId};case t.ELEMENT_NODE:var c=!1;"string"==typeof o?c=t.classList.contains(o):t.classList.forEach((function(e){o.test(e)&&(c=!0)}));for(var l=function(e){var t=e.toLowerCase().trim();return i.test(t)?"div":t}(t.tagName),d={},p=0,f=Array.from(t.attributes);p<f.length;p++){var v=f[p],h=v.name,y=v.value;d[h]=g(n,h,y)}if("link"===l&&r){var b,S=Array.from(n.styleSheets).find((function(e){return e.href===t.href}));(b=u(S))&&(delete d.rel,delete d.href,d._cssText=m(b,S.href))}if("style"===l&&t.sheet&&!(t.innerText||t.textContent||"").trim().length)(b=u(t.sheet))&&(d._cssText=m(b,location.href));if("input"===l||"textarea"===l||"select"===l){y=t.value;"radio"!==d.type&&"checkbox"!==d.type&&"submit"!==d.type&&"button"!==d.type&&y?d.value=a[d.type]||a[l]?"*".repeat(y.length):y:t.checked&&(d.checked=t.checked)}if("option"===l){var C=t.parentElement;d.value===C.value&&(d.selected=t.selected)}if("canvas"===l&&s&&(d.rr_dataURL=t.toDataURL()),"audio"!==l&&"video"!==l||(d.rr_mediaState=t.paused?"paused":"played"),t.scrollLeft&&(d.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(d.rr_scrollTop=t.scrollTop),c){var w=t.getBoundingClientRect(),E=w.width,I=w.height;d.rr_width=E+"px",d.rr_height=I+"px"}return{type:e.Element,tagName:l,attributes:d,childNodes:[],isSVG:(M=t,"svg"===M.tagName||M instanceof SVGElement||void 0),needBlock:c};case t.TEXT_NODE:var x=t.parentNode&&t.parentNode.tagName,N=t.textContent,T="STYLE"===x||void 0;return T&&N&&(N=m(N,location.href)),"SCRIPT"===x&&(N="SCRIPT_PLACEHOLDER"),{type:e.Text,textContent:N||"",isStyle:T};case t.CDATA_SECTION_NODE:return{type:e.CDATA,textContent:""};case t.COMMENT_NODE:return{type:e.Comment,textContent:t.textContent||""};default:return!1}var M}function S(t,n,o,r,i,u,s,c){void 0===i&&(i=!1),void 0===u&&(u=!0);var l,d=b(t,n,r,u,s,c||!1);if(!d)return console.warn(t,"not serialized"),null;l="__sn"in t?t.__sn.id:a++;var p=Object.assign(d,{id:l});t.__sn=p,o[l]=t;var f=!i;if(p.type===e.Element&&(f=f&&!p.needBlock,delete p.needBlock),(p.type===e.Document||p.type===e.Element)&&f)for(var v=0,h=Array.from(t.childNodes);v<h.length;v++){var m=S(h[v],n,o,r,i,u,s,c);m&&p.childNodes.push(m)}return p}function C(e,t,n){void 0===n&&(n=document);var o={capture:!0,passive:!0};return n.addEventListener(e,t,o),function(){return n.removeEventListener(e,t,o)}}!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"}(s||(s={})),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"}(c||(c={})),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"}(l||(l={})),function(e){e[e.Play=0]="Play",e[e.Pause=1]="Pause"}(d||(d={})),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"}(p||(p={}));var w={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return w.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete w.map[t],e.childNodes&&e.childNodes.forEach((function(e){return w.removeNodeFromMap(e)}))},has:function(e){return w.map.hasOwnProperty(e)}};function E(e,t,n){void 0===n&&(n={});var o=null,r=0;return function(a){var i=Date.now();r||!1!==n.leading||(r=i);var u=t-(i-r),s=this,c=arguments;u<=0||u>t?(o&&(window.clearTimeout(o),o=null),r=i,e.apply(s,c)):o||!1===n.trailing||(o=window.setTimeout((function(){r=!1===n.leading?0:Date.now(),o=null,e.apply(s,c)}),u))}}function I(e,t,n,o,r){void 0===r&&(r=window);var a=r.Object.getOwnPropertyDescriptor(e,t);return r.Object.defineProperty(e,t,o?n:{set:function(e){var t=this;setTimeout((function(){n.set.call(t,e)}),0),a&&a.set&&a.set.call(this,e)}}),function(){return I(e,t,a||{},!0)}}function x(e,t,n){try{if(!(t in e))return function(){};var o=e[t],r=n(o);return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:o}})),e[t]=r,function(){e[t]=o}}catch(e){return function(){}}}function N(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function T(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function M(e,t){if(!e)return!1;if(e.nodeType===e.ELEMENT_NODE){var n=!1;return"string"==typeof t?n=e.classList.contains(t):e.classList.forEach((function(e){t.test(e)&&(n=!0)})),n||M(e.parentNode,t)}return e.nodeType,e.TEXT_NODE,M(e.parentNode,t)}function _(e){return Boolean(e.changedTouches)}function k(e){return"__ln"in e}var D=function(){function e(){this.length=0,this.head=null}return e.prototype.get=function(e){if(e>=this.length)throw new Error("Position outside of list range");for(var t=this.head,n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t},e.prototype.addNode=function(e){var t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&k(e.previousSibling)){var n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&k(e.nextSibling)){n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;this.length++},e.prototype.removeNode=function(e){var t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next&&(t.next.previous=t.previous)):(this.head=t.next,this.head&&(this.head.previous=null)),e.__ln&&delete e.__ln,this.length--)},e}(),L=function(e,t){return e+"@"+t};function O(e){return"__sn"in e}function R(e,t){e.delete(t),t.childNodes.forEach((function(t){return R(e,t)}))}function z(e,t){var n=t.parentNode;if(!n)return!1;var o=w.getId(n);return!!e.some((function(e){return e.id===o}))||z(e,n)}function F(e,t){var n=t.parentNode;return!!n&&(!!e.has(n)||F(e,n))}var A=new(function(){function e(){var e=this;this.frozen=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=function(t){t.forEach(e.processMutation),e.frozen||e.emit()},this.emit=function(){for(var t,o,r,a,i=[],u=new D,s=function(t){var n=t.nextSibling&&w.getId(t.nextSibling);return-1===n&&M(t.nextSibling,e.blockClass)&&(n=null),n},c=function(t){if(t.parentNode){var n=w.getId(t.parentNode),o=s(t);if(-1===n||-1===o)return u.addNode(t);i.push({parentId:n,nextId:o,node:S(t,document,w.map,e.blockClass,!0,e.inlineStylesheet,e.maskInputOptions,e.recordCanvas)})}};e.mapRemoves.length;)w.removeNodeFromMap(e.mapRemoves.shift());try{for(var l=n(e.movedSet),d=l.next();!d.done;d=l.next()){var p=d.value;z(e.removes,p)&&!e.movedSet.has(p.parentNode)||c(p)}}catch(e){t={error:e}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(t)throw t.error}}try{for(var f=n(e.addedSet),v=f.next();!v.done;v=f.next()){p=v.value;F(e.droppedSet,p)||z(e.removes,p)?F(e.movedSet,p)?c(p):e.droppedSet.add(p):c(p)}}catch(e){r={error:e}}finally{try{v&&!v.done&&(a=f.return)&&a.call(f)}finally{if(r)throw r.error}}for(var h=null;u.length;){var m=null;if(h){var y=w.getId(h.value.parentNode),g=s(h.value);-1!==y&&-1!==g&&(m=h)}if(!m)for(var b=u.length-1;b>=0;b--){var C=u.get(b);y=w.getId(C.value.parentNode),g=s(C.value);if(-1!==y&&-1!==g){m=C;break}}if(!m)break;h=m.previous,u.removeNode(m.value),c(m.value)}var E={texts:e.texts.map((function(e){return{id:w.getId(e.node),value:e.value}})).filter((function(e){return w.has(e.id)})),attributes:e.attributes.map((function(e){return{id:w.getId(e.node),attributes:e.attributes}})).filter((function(e){return w.has(e.id)})),removes:e.removes,adds:i};(E.texts.length||E.attributes.length||E.removes.length||E.adds.length)&&(e.texts=[],e.attributes=[],e.removes=[],e.addedSet=new Set,e.movedSet=new Set,e.droppedSet=new Set,e.movedMap={},e.emissionCallback(E))},this.processMutation=function(t){switch(t.type){case"characterData":var n=t.target.textContent;M(t.target,e.blockClass)||n===t.oldValue||e.texts.push({value:n,node:t.target});break;case"attributes":n=t.target.getAttribute(t.attributeName);if(M(t.target,e.blockClass)||n===t.oldValue)return;var o=e.attributes.find((function(e){return e.node===t.target}));o||(o={node:t.target,attributes:{}},e.attributes.push(o)),o.attributes[t.attributeName]=g(document,t.attributeName,n);break;case"childList":t.addedNodes.forEach((function(n){return e.genAdds(n,t.target)})),t.removedNodes.forEach((function(n){var o=w.getId(n),r=w.getId(t.target);M(n,e.blockClass)||M(t.target,e.blockClass)||(e.addedSet.has(n)?(R(e.addedSet,n),e.droppedSet.add(n)):e.addedSet.has(t.target)&&-1===o||function e(t){var n=w.getId(t);return!w.has(n)||(!t.parentNode||t.parentNode.nodeType!==t.DOCUMENT_NODE)&&(!t.parentNode||e(t.parentNode))}(t.target)||(e.movedSet.has(n)&&e.movedMap[L(o,r)]?R(e.movedSet,n):e.removes.push({parentId:r,id:o})),e.mapRemoves.push(n))}))}},this.genAdds=function(t,n){if(!M(t,e.blockClass)){if(O(t)){e.movedSet.add(t);var o=null;n&&O(n)&&(o=n.__sn.id),o&&(e.movedMap[L(t.__sn.id,o)]=!0)}else e.addedSet.add(t),e.droppedSet.delete(t);t.childNodes.forEach((function(t){return e.genAdds(t)}))}}}return e.prototype.init=function(e,t,n,o,r){this.blockClass=t,this.inlineStylesheet=n,this.maskInputOptions=o,this.recordCanvas=r,this.emissionCallback=e},e.prototype.freeze=function(){this.frozen=!0},e.prototype.unfreeze=function(){this.frozen=!1},e.prototype.isFrozen=function(){return this.frozen},e}());function P(e,t,n){if(!1===n.mouseInteraction)return function(){};var o=!0===n.mouseInteraction||void 0===n.mouseInteraction?{}:n.mouseInteraction,r=[];return Object.keys(l).filter((function(e){return Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==o[e]})).forEach((function(n){var o=n.toLowerCase(),a=function(n){return function(o){if(!M(o.target,t)){var r=w.getId(o.target),a=_(o)?o.changedTouches[0]:o,i=a.clientX,u=a.clientY;e({type:l[n],id:r,x:i,y:u})}}}(n);r.push(C(o,a))})),function(){r.forEach((function(e){return e()}))}}var j,H=["INPUT","TEXTAREA","SELECT"],U=new WeakMap;function V(e,o){void 0===o&&(o={}),function(e,t){var n=e.mutationCb,o=e.mousemoveCb,a=e.mouseInteractionCb,i=e.scrollCb,u=e.viewportResizeCb,s=e.inputCb,c=e.mediaInteractionCb,l=e.styleSheetRuleCb,d=e.canvasMutationCb,p=e.fontCb;e.mutationCb=function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];t.mutation&&t.mutation.apply(t,r(e)),n.apply(void 0,r(e))},e.mousemoveCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mousemove&&t.mousemove.apply(t,r(e)),o.apply(void 0,r(e))},e.mouseInteractionCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mouseInteraction&&t.mouseInteraction.apply(t,r(e)),a.apply(void 0,r(e))},e.scrollCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.scroll&&t.scroll.apply(t,r(e)),i.apply(void 0,r(e))},e.viewportResizeCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.viewportResize&&t.viewportResize.apply(t,r(e)),u.apply(void 0,r(e))},e.inputCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.input&&t.input.apply(t,r(e)),s.apply(void 0,r(e))},e.mediaInteractionCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mediaInteaction&&t.mediaInteaction.apply(t,r(e)),c.apply(void 0,r(e))},e.styleSheetRuleCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.styleSheetRule&&t.styleSheetRule.apply(t,r(e)),l.apply(void 0,r(e))},e.canvasMutationCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.canvasMutation&&t.canvasMutation.apply(t,r(e)),d.apply(void 0,r(e))},e.fontCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.font&&t.font.apply(t,r(e)),p.apply(void 0,r(e))}}(e,o);var a,i,u=function(e,t,n,o,r){A.init(e,t,n,o,r);var a=new MutationObserver(A.processMutations.bind(A));return a.observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}(e.mutationCb,e.blockClass,e.inlineStylesheet,e.maskInputOptions,e.recordCanvas),s=function(e,t){if(!1===t.mousemove)return function(){};var n,o="number"==typeof t.mousemove?t.mousemove:50,r=[],a=E((function(t){var o=Date.now()-n;e(r.map((function(e){return e.timeOffset-=o,e})),t?c.TouchMove:c.MouseMove),r=[],n=null}),500),i=E((function(e){var t=e.target,o=_(e)?e.changedTouches[0]:e,i=o.clientX,u=o.clientY;n||(n=Date.now()),r.push({x:i,y:u,id:w.getId(t),timeOffset:Date.now()-n}),a(_(e))}),o,{trailing:!1}),u=[C("mousemove",i),C("touchmove",i)];return function(){u.forEach((function(e){return e()}))}}(e.mousemoveCb,e.sampling),l=P(e.mouseInteractionCb,e.blockClass,e.sampling),p=(a=e.scrollCb,i=e.blockClass,C("scroll",E((function(e){if(e.target&&!M(e.target,i)){var t=w.getId(e.target);if(e.target===document){var n=document.scrollingElement||document.documentElement;a({id:t,x:n.scrollLeft,y:n.scrollTop})}else a({id:t,x:e.target.scrollLeft,y:e.target.scrollTop})}}),e.sampling.scroll||100))),f=function(e){return C("resize",E((function(){var t=N(),n=T();e({width:Number(n),height:Number(t)})}),200),window)}(e.viewportResizeCb),v=function(e,n,o,a,i){function u(e){var t=e.target;if(t&&t.tagName&&!(H.indexOf(t.tagName)<0)&&!M(t,n)){var r=t.type;if("password"!==r&&!t.classList.contains(o)){var i=t.value,u=!1;"radio"===r||"checkbox"===r?u=t.checked:(a[t.tagName.toLowerCase()]||a[r])&&(i="*".repeat(i.length)),s(t,{text:i,isChecked:u});var c=t.name;"radio"===r&&c&&u&&document.querySelectorAll('input[type="radio"][name="'+c+'"]').forEach((function(e){e!==t&&s(e,{text:e.value,isChecked:!u})}))}}}function s(n,o){var r=U.get(n);if(!r||r.text!==o.text||r.isChecked!==o.isChecked){U.set(n,o);var a=w.getId(n);e(t(t({},o),{id:a}))}}var c=("last"===i.input?["change"]:["input","change"]).map((function(e){return C(e,u)})),l=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"),d=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"],[HTMLSelectElement.prototype,"selectedIndex"]];return l&&l.set&&c.push.apply(c,r(d.map((function(e){return I(e[0],e[1],{set:function(){u({target:this})}})})))),function(){c.forEach((function(e){return e()}))}}(e.inputCb,e.blockClass,e.ignoreClass,e.maskInputOptions,e.sampling),h=function(e,t){var n=function(n){return function(o){var r=o.target;r&&!M(r,t)&&e({type:"play"===n?d.Play:d.Pause,id:w.getId(r)})}},o=[C("play",n("play")),C("pause",n("pause"))];return function(){o.forEach((function(e){return e()}))}}(e.mediaInteractionCb,e.blockClass),m=function(e){var t=CSSStyleSheet.prototype.insertRule;CSSStyleSheet.prototype.insertRule=function(n,o){var r=w.getId(this.ownerNode);return-1!==r&&e({id:r,adds:[{rule:n,index:o}]}),t.apply(this,arguments)};var n=CSSStyleSheet.prototype.deleteRule;return CSSStyleSheet.prototype.deleteRule=function(t){var o=w.getId(this.ownerNode);return-1!==o&&e({id:o,removes:[{index:t}]}),n.apply(this,arguments)},function(){CSSStyleSheet.prototype.insertRule=t,CSSStyleSheet.prototype.deleteRule=n}}(e.styleSheetRuleCb),y=e.recordCanvas?function(e,t){var o,a,i=Object.getOwnPropertyNames(CanvasRenderingContext2D.prototype),u=[],s=function(n){try{if("function"!=typeof CanvasRenderingContext2D.prototype[n])return"continue";var o=x(CanvasRenderingContext2D.prototype,n,(function(o){return function(){for(var a=this,i=[],u=0;u<arguments.length;u++)i[u]=arguments[u];return M(this.canvas,t)||setTimeout((function(){var t=r(i);"drawImage"===n&&t[0]&&t[0]instanceof HTMLCanvasElement&&(t[0]=t[0].toDataURL()),e({id:w.getId(a.canvas),property:n,args:t})}),0),o.apply(this,i)}}));u.push(o)}catch(t){var a=I(CanvasRenderingContext2D.prototype,n,{set:function(t){e({id:w.getId(this.canvas),property:n,args:[t],setter:!0})}});u.push(a)}};try{for(var c=n(i),l=c.next();!l.done;l=c.next()){s(l.value)}}catch(e){o={error:e}}finally{try{l&&!l.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}return function(){u.forEach((function(e){return e()}))}}(e.canvasMutationCb,e.blockClass):function(){},g=e.collectFonts?function(e){var t=[],n=new WeakMap,o=FontFace;window.FontFace=function(e,t,r){var a=new o(e,t,r);return n.set(a,{family:e,buffer:"string"!=typeof t,descriptors:r,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),a};var r=x(document.fonts,"add",(function(t){return function(o){return setTimeout((function(){var t=n.get(o);t&&(e(t),n.delete(o))}),0),t.apply(this,[o])}}));return t.push((function(){window.FonFace=o})),t.push(r),function(){t.forEach((function(e){return e()}))}}(e.fontCb):function(){};return function(){u.disconnect(),s(),l(),p(),f(),v(),h(),m(),y(),g()}}function B(e){return t(t({},e),{timestamp:Date.now()})}function W(e){void 0===e&&(e={});var n=e.emit,r=e.checkoutEveryNms,a=e.checkoutEveryNth,i=e.blockClass,u=void 0===i?"rr-block":i,l=e.ignoreClass,d=void 0===l?"rr-ignore":l,p=e.inlineStylesheet,f=void 0===p||p,v=e.maskAllInputs,h=e.maskInputOptions,m=e.hooks,y=e.packFn,g=e.sampling,b=void 0===g?{}:g,E=e.mousemoveWait,I=e.recordCanvas,x=void 0!==I&&I,M=e.collectFonts,_=void 0!==M&&M;if(!n)throw new Error("emit function is required");void 0!==E&&void 0===b.mousemove&&(b.mousemove=E);var k,D,L=!0===v?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0}:void 0!==h?h:{};void 0===k&&(k=window),"NodeList"in k&&!k.NodeList.prototype.forEach&&(k.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in k&&!k.DOMTokenList.prototype.forEach&&(k.DOMTokenList.prototype.forEach=Array.prototype.forEach);var O=0;function R(e){var t,n,r,a;void 0===e&&(e=!1),j(B({type:s.Meta,data:{href:window.location.href,width:T(),height:N()}}),e);var i=A.isFrozen();A.freeze();var c=o(function(e,t,n,o,r){void 0===t&&(t="rr-block"),void 0===n&&(n=!0);var a={};return[S(e,e,a,t,!1,n,!0===o?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0}:!1===o?{}:o,r),a]}(document,u,f,L,x),2),l=c[0],d=c[1];if(!l)return console.warn("Failed to snapshot the document");w.map=d,j(B({type:s.FullSnapshot,data:{node:l,initialOffset:{left:void 0!==window.pageXOffset?window.pageXOffset:(null===document||void 0===document?void 0:document.documentElement.scrollLeft)||(null===(n=null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===document||void 0===document?void 0:document.body.scrollLeft)||0,top:void 0!==window.pageYOffset?window.pageYOffset:(null===document||void 0===document?void 0:document.documentElement.scrollTop)||(null===(a=null===(r=null===document||void 0===document?void 0:document.body)||void 0===r?void 0:r.parentElement)||void 0===a?void 0:a.scrollTop)||(null===document||void 0===document?void 0:document.body.scrollTop)||0}}})),i||(A.emit(),A.unfreeze())}j=function(e,t){if(!A.isFrozen()||e.type===s.FullSnapshot||e.type==s.IncrementalSnapshot&&e.data.source==c.Mutation||(A.emit(),A.unfreeze()),n(y?y(e):e,t),e.type===s.FullSnapshot)D=e,O=0;else if(e.type===s.IncrementalSnapshot){O++;var o=a&&O>=a,i=r&&e.timestamp-D.timestamp>r;(o||i)&&R(!0)}};try{var z=[];z.push(C("DOMContentLoaded",(function(){j(B({type:s.DomContentLoaded,data:{}}))})));var F=function(){R(),z.push(V({mutationCb:function(e){return j(B({type:s.IncrementalSnapshot,data:t({source:c.Mutation},e)}))},mousemoveCb:function(e,t){return j(B({type:s.IncrementalSnapshot,data:{source:t,positions:e}}))},mouseInteractionCb:function(e){return j(B({type:s.IncrementalSnapshot,data:t({source:c.MouseInteraction},e)}))},scrollCb:function(e){return j(B({type:s.IncrementalSnapshot,data:t({source:c.Scroll},e)}))},viewportResizeCb:function(e){return j(B({type:s.IncrementalSnapshot,data:t({source:c.ViewportResize},e)}))},inputCb:function(e){return j(B({type:s.IncrementalSnapshot,data:t({source:c.Input},e)}))},mediaInteractionCb:function(e){return j(B({type:s.IncrementalSnapshot,data:t({source:c.MediaInteraction},e)}))},styleSheetRuleCb:function(e){return j(B({type:s.IncrementalSnapshot,data:t({source:c.StyleSheetRule},e)}))},canvasMutationCb:function(e){return j(B({type:s.IncrementalSnapshot,data:t({source:c.CanvasMutation},e)}))},fontCb:function(e){return j(B({type:s.IncrementalSnapshot,data:t({source:c.Font},e)}))},blockClass:u,ignoreClass:d,maskInputOptions:L,inlineStylesheet:f,sampling:b,recordCanvas:x,collectFonts:_},m))};return"interactive"===document.readyState||"complete"===document.readyState?F():z.push(C("load",(function(){j(B({type:s.Load,data:{}})),F()}),window)),function(){z.forEach((function(e){return e()}))}}catch(e){console.warn(e)}}return W.addCustomEvent=function(e,t){if(!j)throw new Error("please add custom event after start recording");j(B({type:s.Custom,data:{tag:e,payload:t}}))},W.freezePage=function(){A.freeze()},W}();
//# sourceMappingURL=rrweb-record.min.js.map

@@ -29,3 +29,3 @@ var rrwebReplay=function(e){"use strict";

and limitations under the License.
***************************************************************************** */!function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(E||(E={}));var T={type:"xstate.init"};function N(e){return void 0===e?[]:[].concat(e)}function I(e){return{type:"xstate.assign",assignment:e}}function C(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 A(e){return function(t){return e===t}}function _(e){return"string"==typeof e?{type:e}:e}function k(e,t){return{value:e,context:t,actions:[],changed:!1,matches:A(e)}}function D(e,t){void 0===t&&(t={});var n={config:e,_options:t,initialState:{value:e.initial,actions:N(e.states[e.initial].entry).map((function(e){return C(e,t.actions)})),context:e.context,matches:A(e.initial)},transition:function(t,r){var i,o,a="string"==typeof t?{value:t,context:e.context}:t,s=a.value,c=a.context,l=_(r),u=e.states[s];if(u.on){var d=N(u.on[l.type]),f=function(t){if(void 0===t)return{value:k(s,c)};var r="string"==typeof t?{target:t}:t,i=r.target,o=void 0===i?s:i,a=r.actions,d=void 0===a?[]:a,f=r.cond,p=c;if((void 0===f?function(){return!0}:f)(c,l)){var h=e.states[o],m=!1,v=[].concat(u.exit,d,h.entry).filter((function(e){return e})).map((function(e){return C(e,n._options.actions)})).filter((function(e){if("xstate.assign"===e.type){m=!0;var t=Object.assign({},p);return"function"==typeof e.assignment?t=e.assignment(p,l):Object.keys(e.assignment).forEach((function(n){t[n]="function"==typeof e.assignment[n]?e.assignment[n](p,l):e.assignment[n]})),p=t,!1}return!0}));return{value:{value:o,context:p,actions:v,changed:o!==s||v.length>0||m,matches:A(o)}}}};try{for(var p=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}(d),h=p.next();!h.done;h=p.next()){var m=f(h.value);if("object"==typeof m)return m.value}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}}return k(s,c)}};return n}var F=function(e,t){return e.actions.forEach((function(n){var r=n.exec;return r&&r(e.context,t)}))};function O(e){var t=e.initialState,n=E.NotStarted,r=new Set,i={_machine:e,send:function(i){n===E.Running&&(t=e.transition(t,i),F(t,_(i)),r.forEach((function(e){return e(t)})))},subscribe:function(e){return r.add(e),e(t),{unsubscribe:function(){return r.delete(e)}}},start:function(){return n=E.Running,F(t,T),i},stop:function(){return n=E.Stopped,r.clear(),i},get state(){return t},get status(){return n}};return i}var L={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return L.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete L.map[t],e.childNodes&&e.childNodes.forEach((function(e){return L.removeNodeFromMap(e)}))},has:function(e){return L.map.hasOwnProperty(e)}};var P=function(){function e(){this.reset()}return e.prototype.add=function(e){var t=this.indexes.get(e.parentId),n={id:e.node.id,mutation:e,children:[],texts:[],attributes:[]};t?(n.parent=t,t.children[n.id]=n):this.tree[n.id]=n,this.indexes.set(n.id,n)},e.prototype.remove=function(e){var t=this,n=this.indexes.get(e.parentId),r=this.indexes.get(e.id),i=function(e){t.removeIdSet.add(e);var n=L.getNode(e);null==n||n.childNodes.forEach((function(e){"__sn"in e&&i(e.__sn.id)}))},o=function(n){t.removeIdSet.add(n.id),Object.values(n.children).forEach((function(e){return o(e)}));var r=t.indexes.get(n.id);if(r){var i=r.parent;i&&(delete r.parent,delete i.children[r.id],t.indexes.delete(e.id))}};r?n?(delete r.parent,delete n.children[r.id],this.indexes.delete(e.id),o(r)):(delete this.tree[r.id],this.indexes.delete(r.id),o(r)):(this.removeNodeMutations.push(e),i(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,n,i,o=this,a=this.tree,s=this.removeNodeMutations,c=this.textMutations,l=this.attributeMutations,u={source:v.Mutation,removes:s,texts:c,attributes:l,adds:[]},d=function(e,t){t&&o.removeIdSet.add(e.id),u.texts=u.texts.concat(t?[]:e.texts).filter((function(e){return!o.removeIdSet.has(e.id)})),u.attributes=u.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 d(e,!0)})):(u.adds.push(e.mutation),e.children&&Object.values(e.children).forEach((function(e){return d(e,!1)})))};Object.values(a).forEach((function(e){return d(e,!1)}));try{for(var f=r(this.scrollMap.keys()),p=f.next();!p.done;p=f.next()){var h=p.value;this.removeIdSet.has(h)&&this.scrollMap.delete(h)}}catch(t){e={error:t}}finally{try{p&&!p.done&&(t=f.return)&&t.call(f)}finally{if(e)throw e.error}}try{for(var m=r(this.inputMap.keys()),y=m.next();!y.done;y=m.next()){h=y.value;this.removeIdSet.has(h)&&this.inputMap.delete(h)}}catch(e){n={error:e}}finally{try{y&&!y.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}var g=new Map(this.scrollMap),b=new Map(this.inputMap);return this.reset(),{mutationData:u,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}();function R(e,t){var i=t.getCastFn,o=t.emitter;return O(D({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"]}}},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"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]},CAST_EVENT:{target:"live",actions:["castEvent"]}}}}},{actions:{castEvent:I({lastPlayedEvent:function(e,t){return"CAST_EVENT"===t.type?t.payload.event:e.lastPlayedEvent}}),recordTimeOffset:I((function(e,t){var r=e.timeOffset;return"payload"in t&&"timeOffset"in t.payload&&(r=t.payload.timeOffset),n(n({},e),{timeOffset:r,baselineTime:e.events[0].timestamp+r})})),play:function(e){var t,n,a,s,c,l=e.timer,u=e.events,d=e.baselineTime,f=e.lastPlayedEvent;l.clear();try{for(var p=r(u),h=p.next();!h.done;h=p.next()){M(h.value,d)}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(t)throw t.error}}var y=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e[n];if(r.type===m.Meta&&r.timestamp<=t)return e.slice(n)}return e}(u,d),g=new Array,S=function(e){var t=null==f?void 0:f.timestamp;if((null==f?void 0:f.type)===m.IncrementalSnapshot&&f.data.source===v.MouseMove&&(t=f.timestamp+(null===(c=f.data.positions[0])||void 0===c?void 0:c.timeOffset)),t&&t<d&&(e.timestamp<=t||e===f))return"continue";var n=e.timestamp<d;if(n&&!function(e){switch(e.type){case m.DomContentLoaded:case m.Load:case m.Custom:return!1;case m.FullSnapshot:case m.Meta:return!0}switch(e.data.source){case v.MouseMove:case v.MouseInteraction:case v.TouchMove:case v.MediaInteraction:return!1;case v.ViewportResize:case v.StyleSheetRule:case v.Scroll:case v.Input:return!0}return!0}(e))return"continue";var r=i(e,n);n?r():g.push({doAction:function(){r(),o.emit(b.EventCast,e)},delay:e.delay})};try{for(var x=r(y),E=x.next();!E.done;E=x.next()){S(E.value)}}catch(e){a={error:e}}finally{try{E&&!E.done&&(s=x.return)&&s.call(x)}finally{if(a)throw a.error}}o.emit(b.Flush),l.addActions(g),l.start()},pause:function(e){e.timer.clear()},resetLastPlayedEvent:I((function(e){return n(n({},e),{lastPlayedEvent:null})})),startLive:I({baselineTime:function(e,t){return e.timer.toggleLiveMode(!0),e.timer.start(),"TO_LIVE"===t.type&&t.payload.baselineTime?t.payload.baselineTime:Date.now()}}),addEvent:I((function(e,t){var r=e.baselineTime,a=e.timer,s=e.events;if("ADD_EVENT"===t.type){var c=t.payload.event;M(c,r),s.push(c);var l=c.timestamp<r,u=i(c,l);l?u():(a.addAction({doAction:function(){u(),o.emit(b.EventCast,c)},delay:c.delay}),a.isActive()||a.start())}return n(n({},e),{events:s})}))}}))}var j=h||S,B={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"},V=function(){function e(e,n){var o=this;if(this.mouseTail=null,this.tailPositions=[],this.emitter=j(),this.legacy_missingNodeRetryMap={},this.imageMap=new Map,!(null==n?void 0:n.liveMode)&&e.length<2)throw new Error("Replayer need at least 2 events.");var a={speed:1,root:document.body,loadTimeout:0,skipInactive:!1,showWarning:!0,showDebug:!1,blockClass:"rr-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,mouseTail:B};this.config=Object.assign({},a,n),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.emitter.on(b.Resize,this.handleResize),this.setupDom(),this.treeIndex=new P,this.fragmentParentMap=new Map,this.emitter.on(b.Flush,(function(){var e,n,a,s,c,l,u=o.treeIndex.flush(),d=u.scrollMap,f=u.inputMap;try{for(var p=r(d.values()),h=p.next();!h.done;h=p.next()){var m=h.value;o.applyScroll(m)}}catch(t){e={error:t}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(e)throw e.error}}try{for(var v=r(f.values()),y=v.next();!y.done;y=v.next()){m=y.value;o.applyInput(m)}}catch(e){a={error:e}}finally{try{y&&!y.done&&(s=v.return)&&s.call(v)}finally{if(a)throw a.error}}try{for(var g=r(o.fragmentParentMap.entries()),b=g.next();!b.done;b=g.next()){var S=i(b.value,2),x=S[0],E=S[1];L.map[E.__sn.id]=E,E.__sn.type===t.Element&&"textarea"===E.__sn.tagName&&x.textContent&&(E.value=x.textContent),E.appendChild(x)}}catch(e){c={error:e}}finally{try{b&&!b.done&&(l=g.return)&&l.call(g)}finally{if(c)throw c.error}}o.fragmentParentMap.clear()}));var s=new w([],(null==n?void 0:n.speed)||a.speed);this.service=R({events:e.map((function(e){return n&&n.unpackFn?n.unpackFn(e):e})),timer:s,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,emitter:this.emitter}),this.service.start(),this.service.subscribe((function(e){o.emitter.emit(b.StateChange,{player:e})})),this.speedService=O(D({id:"speed",context:{normalSpeed:-1,timer:s},initial:"normal",states:{normal:{on:{FAST_FORWARD:{target:"skipping",actions:["recordSpeed","setSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}},skipping:{on:{BACK_TO_NORMAL:{target:"normal",actions:["restoreSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}}}},{actions:{setSpeed:function(e,t){"payload"in t&&e.timer.setSpeed(t.payload.speed)},recordSpeed:I({normalSpeed:function(e){return e.timer.speed}}),restoreSpeed:function(e){e.timer.setSpeed(e.normalSpeed)}}})),this.speedService.start(),this.speedService.subscribe((function(e){o.emitter.emit(b.StateChange,{speed:e})}));var c=this.service.state.context.events.find((function(e){return e.type===m.Meta})),l=this.service.state.context.events.find((function(e){return e.type===m.FullSnapshot}));if(c){var u=c.data,d=u.width,f=u.height;setTimeout((function(){o.emitter.emit(b.Resize,{width:d,height:f})}),0)}l&&this.rebuildFullSnapshot(l)}return Object.defineProperty(e.prototype,"timer",{get:function(){return this.service.state.context.timer},enumerable:!1,configurable:!0}),e.prototype.on=function(e,t){this.emitter.on(e,t)},e.prototype.setConfig=function(e){var t=this;Object.keys(e).forEach((function(n){t.config[n]=e[n]})),this.config.skipInactive||this.backToNormal(),void 0!==e.speed&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}})},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.play=function(e){void 0===e&&(e=0),this.service.state.matches("paused")||this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:e}}),this.emitter.emit(b.Start)},e.prototype.pause=function(e){void 0===e&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),"number"==typeof e&&(this.play(e),this.service.send({type:"PAUSE"})),this.emitter.emit(b.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(b.Resume)},e.prototype.startLive=function(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})},e.prototype.addEvent=function(e){var t=this,n=this.config.unpackFn?this.config.unpackFn(e):e;Promise.resolve().then((function(){return t.service.send({type:"ADD_EVENT",payload:{event:n}})}))},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.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="none",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&&(x(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))},e.prototype.handleResize=function(e){var t,n;try{for(var i=r([this.mouseTail,this.iframe]),o=i.next();!o.done;o=i.next()){var a=o.value;a&&(a.style.display="inherit",a.setAttribute("width",String(e.width)),a.setAttribute("height",String(e.height)))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},e.prototype.getCastFn=function(e,t){var n,i=this;switch(void 0===t&&(t=!1),e.type){case m.DomContentLoaded:case m.Load:break;case m.Custom:n=function(){i.emitter.emit(b.CustomEvent,e)};break;case m.Meta:n=function(){return i.emitter.emit(b.Resize,{width:e.data.width,height:e.data.height})};break;case m.FullSnapshot:n=function(){i.rebuildFullSnapshot(e,t),i.iframe.contentWindow.scrollTo(e.data.initialOffset)};break;case m.IncrementalSnapshot:n=function(){var n,o;if(i.applyIncremental(e,t),!t&&(e===i.nextUserInteractionEvent&&(i.nextUserInteractionEvent=null,i.backToNormal()),i.config.skipInactive&&!i.nextUserInteractionEvent)){try{for(var a=r(i.service.state.context.events),s=a.next();!s.done;s=a.next()){var c=s.value;if(!(c.timestamp<=e.timestamp)&&i.isUserInteraction(c)){c.delay-e.delay>1e4*i.speedService.state.context.timer.speed&&(i.nextUserInteractionEvent=c);break}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}if(i.nextUserInteractionEvent){var l=i.nextUserInteractionEvent.delay-e.delay,u={speed:Math.min(Math.round(l/5e3),360)};i.speedService.send({type:"FAST_FORWARD",payload:u}),i.emitter.emit(b.SkipStart,u)}}}}return function(){if(n&&n(),i.service.send({type:"CAST_EVENT",payload:{event:e}}),e===i.service.state.context.events[i.service.state.context.events.length-1]){var t=function(){i.backToNormal(),i.service.send("END"),i.emitter.emit(b.Finish)};e.type===m.IncrementalSnapshot&&e.data.source===v.MouseMove&&e.data.positions.length?setTimeout((function(){t()}),Math.max(0,-e.data.positions[0].timeOffset)):t()}}},e.prototype.rebuildFullSnapshot=function(e,t){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={},L.map=p(e.data.node,this.iframe.contentDocument)[1];var n=document.createElement("style"),r=this.iframe.contentDocument,i=r.documentElement,o=r.head;i.insertBefore(n,o);for(var a,s=(a=this.config.blockClass,["iframe, ."+a+" { background: #ccc }","noscript { display: none !important; }"]).concat(this.config.insertStyleRules),c=0;c<s.length;c++)n.sheet.insertRule(s[c],c);this.emitter.emit(b.FullsnapshotRebuilded,e),t||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()},e.prototype.waitForStylesheetLoad=function(){var e,t=this,n=null===(e=this.iframe.contentDocument)||void 0===e?void 0:e.head;if(n){var r,i=new Set,o=this.service.state,a=function(){o=t.service.state};this.emitter.on(b.Start,a),this.emitter.on(b.Pause,a);var s=function(){t.emitter.off(b.Start,a),t.emitter.off(b.Pause,a)};n.querySelectorAll('link[rel="stylesheet"]').forEach((function(e){e.sheet||(i.add(e),e.addEventListener("load",(function(){i.delete(e),0===i.size&&-1!==r&&(o.matches("playing")&&t.play(t.getCurrentTime()),t.emitter.emit(b.LoadStylesheetEnd),r&&window.clearTimeout(r),s())})))})),i.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(b.LoadStylesheetStart),r=window.setTimeout((function(){o.matches("playing")&&t.play(t.getCurrentTime()),r=-1,s()}),this.config.loadTimeout))}},e.prototype.preloadAllImages=function(){var e,t,n=this,i=this.service.state,o=function(){i=n.service.state};this.emitter.on(b.Start,o),this.emitter.on(b.Pause,o);var a=0,s=0;try{for(var c=r(this.service.state.context.events),l=c.next();!l.done;l=c.next()){var u=l.value;if(u.type===m.IncrementalSnapshot&&u.data.source===v.CanvasMutation&&"drawImage"===u.data.property&&"string"==typeof u.data.args[0]&&!this.imageMap.has(u)){a++;var d=document.createElement("img");d.src=u.data.args[0],this.imageMap.set(u,d),d.onload=function(){++s===a&&(i.matches("playing")&&n.play(n.getCurrentTime()),n.emitter.off(b.Start,o),n.emitter.off(b.Pause,o))}}}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}a!==s&&this.service.send({type:"PAUSE"})},e.prototype.applyIncremental=function(e,t){var n,r,i=this,o=e.data;switch(o.source){case v.Mutation:t&&(o.adds.forEach((function(e){return i.treeIndex.add(e)})),o.texts.forEach((function(e){return i.treeIndex.text(e)})),o.attributes.forEach((function(e){return i.treeIndex.attribute(e)})),o.removes.forEach((function(e){return i.treeIndex.remove(e)}))),this.applyMutation(o,t);break;case v.MouseMove:if(t){var a=o.positions[o.positions.length-1];this.moveAndHover(o,a.x,a.y,a.id)}else o.positions.forEach((function(t){var n={doAction:function(){i.moveAndHover(o,t.x,t.y,t.id)},delay:t.timeOffset+e.timestamp-i.service.state.context.baselineTime};i.timer.addAction(n)})),this.timer.addAction({doAction:function(){},delay:e.delay-(null===(n=o.positions[0])||void 0===n?void 0:n.timeOffset)});break;case v.MouseInteraction:if(-1===o.id)break;var s=new Event(y[o.type].toLowerCase());if(!(d=L.getNode(o.id)))return this.debugNodeNotFound(o,o.id);this.emitter.emit(b.MouseInteraction,{type:o.type,target:d});var c=this.config.triggerFocus;switch(o.type){case y.Blur:"blur"in d&&d.blur();break;case y.Focus:c&&d.focus&&d.focus({preventScroll:!0});break;case y.Click:case y.TouchStart:case y.TouchEnd:t||(this.moveAndHover(o,o.x,o.y,o.id),this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active"));break;default:d.dispatchEvent(s)}break;case v.Scroll:if(-1===o.id)break;if(t){this.treeIndex.scroll(o);break}this.applyScroll(o);break;case v.ViewportResize:this.emitter.emit(b.Resize,{width:o.width,height:o.height});break;case v.Input:if(-1===o.id)break;if(t){this.treeIndex.input(o);break}this.applyInput(o);break;case v.MediaInteraction:if(!(d=L.getNode(o.id)))return this.debugNodeNotFound(o,o.id);var l=d;try{o.type===g.Pause&&l.pause(),o.type===g.Play&&(l.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?l.play():l.addEventListener("canplay",(function(){l.play()})))}catch(e){this.config.showWarning&&console.warn("Failed to replay media interactions: "+(e.message||e))}break;case v.StyleSheetRule:if(!(d=L.getNode(o.id)))return this.debugNodeNotFound(o,o.id);var u=d.sheet;o.adds&&o.adds.forEach((function(e){var t=e.rule,n=e.index,r=void 0===n?void 0:Math.min(n,u.rules.length);try{u.insertRule(t,r)}catch(e){}})),o.removes&&o.removes.forEach((function(e){var t=e.index;try{u.deleteRule(t)}catch(e){}}));break;case v.CanvasMutation:if(!this.config.UNSAFE_replayCanvas)return;var d;if(!(d=L.getNode(o.id)))return this.debugNodeNotFound(o,o.id);try{var f=d.getContext("2d");if(o.setter)return void(f[o.property]=o.args[0]);var p=f[o.property];if("drawImage"===o.property&&"string"==typeof o.args[0]){var h=this.imageMap.get(e);o.args[0]=h,p.apply(f,o.args)}else p.apply(f,o.args)}catch(e){this.warnCanvasMutationFailed(o,o.id,e)}break;case v.Font:try{var m=new FontFace(o.family,o.buffer?new Uint8Array(JSON.parse(o.fontSource)):o.fontSource,o.descriptors);null===(r=this.iframe.contentDocument)||void 0===r||r.fonts.add(m)}catch(e){this.config.showWarning&&console.warn(e)}}},e.prototype.applyMutation=function(e,t){var r=this;e.removes.forEach((function(t){var n=L.getNode(t.id);if(!n)return r.warnNodeNotFound(e,t.id);var i=L.getNode(t.parentId);if(!i)return r.warnNodeNotFound(e,t.parentId);if(L.removeNodeFromMap(n),i){var o=r.fragmentParentMap.get(i);o&&o.contains(n)?o.removeChild(n):i.removeChild(n)}}));var i=n({},this.legacy_missingNodeRetryMap),o=[];var a=function(e){if(!r.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");var n=L.getNode(e.parentId);if(!n)return o.push(e);var a=null;if(r.iframe.contentDocument.contains?a=r.iframe.contentDocument.contains(n):r.iframe.contentDocument.body.contains&&(a=r.iframe.contentDocument.body.contains(n)),t&&a){var s=document.createDocumentFragment();for(L.map[e.parentId]=s,r.fragmentParentMap.set(s,n);n.firstChild;)s.appendChild(n.firstChild);n=s}var c=null,l=null;if(e.previousId&&(c=L.getNode(e.previousId)),e.nextId&&(l=L.getNode(e.nextId)),function(e){var t=null;return e.nextId&&(t=L.getNode(e.nextId)),null!==e.nextId&&void 0!==e.nextId&&-1!==e.nextId&&!t}(e))return o.push(e);var u=f(e.node,r.iframe.contentDocument,L.map,!0);-1!==e.previousId&&-1!==e.nextId?(c&&c.nextSibling&&c.nextSibling.parentNode?n.insertBefore(u,c.nextSibling):l&&l.parentNode?n.contains(l)?n.insertBefore(u,l):n.insertBefore(u,null):n.appendChild(u),(e.previousId||e.nextId)&&r.legacy_resolveMissingNode(i,n,u,e)):i[e.node.id]={node:u,mutation:e}};e.adds.forEach((function(e){a(e)}));for(var s=Date.now();o.length;){if(Date.now()-s>5e3)return o.forEach((function(t){return r.warnNodeNotFound(e,t.node.id)}));var c=o.shift();a(c)}Object.keys(i).length&&Object.assign(this.legacy_missingNodeRetryMap,i),e.texts.forEach((function(t){var n=L.getNode(t.id);if(!n)return r.warnNodeNotFound(e,t.id);r.fragmentParentMap.has(n)&&(n=r.fragmentParentMap.get(n)),n.textContent=t.value})),e.attributes.forEach((function(t){var n=L.getNode(t.id);if(!n)return r.warnNodeNotFound(e,t.id);for(var i in r.fragmentParentMap.has(n)&&(n=r.fragmentParentMap.get(n)),t.attributes)if("string"==typeof i){var o=t.attributes[i];try{null!==o?n.setAttribute(i,o):n.removeAttribute(i)}catch(e){r.config.showWarning&&console.warn("An error occurred may due to the checkout feature.",e)}}}))},e.prototype.applyScroll=function(e){var t=L.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);if(t===this.iframe.contentDocument)this.iframe.contentWindow.scrollTo({top:e.y,left:e.x,behavior:"smooth"});else try{t.scrollTop=e.y,t.scrollLeft=e.x}catch(e){}},e.prototype.applyInput=function(e){var t=L.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);try{t.checked=e.isChecked,t.value=e.text}catch(e){}},e.prototype.legacy_resolveMissingNode=function(e,t,n,r){var i=r.previousId,o=r.nextId,a=i&&e[i],s=o&&e[o];if(a){var c=a,l=c.node,u=c.mutation;t.insertBefore(l,n),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,l,u)}if(s){var d=s;l=d.node,u=d.mutation;t.insertBefore(l,n.nextSibling),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,l,u)}},e.prototype.moveAndHover=function(e,t,n,r){this.mouse.style.left=t+"px",this.mouse.style.top=n+"px",this.drawMouseTail({x:t,y:n});var i=L.getNode(r);if(!i)return this.debugNodeNotFound(e,r);this.hoverElements(i)},e.prototype.drawMouseTail=function(e){var t=this;if(this.mouseTail){var n=!0===this.config.mouseTail?B:Object.assign({},B,this.config.mouseTail),r=n.lineCap,i=n.lineWidth,o=n.strokeStyle,a=n.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=r,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)}},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 n=e;n;)n.classList&&n.classList.add(":hover"),n=n.parentElement},e.prototype.isUserInteraction=function(e){return e.type===m.IncrementalSnapshot&&(e.data.source>v.Mutation&&e.data.source<=v.Input)},e.prototype.backToNormal=function(){this.nextUserInteractionEvent=null,this.speedService.state.matches("normal")||(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(b.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))},e.prototype.warnNodeNotFound=function(e,t){this.config.showWarning&&console.warn("[replayer]","Node with id '"+t+"' not found in",e)},e.prototype.warnCanvasMutationFailed=function(e,t,n){console.warn("[replayer]","Has error on update canvas '"+t+"'",e,n)},e.prototype.debugNodeNotFound=function(e,t){this.config.showDebug&&console.log("[replayer]","Node with id '"+t+"' not found in",e)},e}();return e.Replayer=V,e}({});
***************************************************************************** */!function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(E||(E={}));var T={type:"xstate.init"};function N(e){return void 0===e?[]:[].concat(e)}function I(e){return{type:"xstate.assign",assignment:e}}function C(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 A(e){return function(t){return e===t}}function _(e){return"string"==typeof e?{type:e}:e}function k(e,t){return{value:e,context:t,actions:[],changed:!1,matches:A(e)}}function D(e,t){void 0===t&&(t={});var n={config:e,_options:t,initialState:{value:e.initial,actions:N(e.states[e.initial].entry).map((function(e){return C(e,t.actions)})),context:e.context,matches:A(e.initial)},transition:function(t,r){var i,o,a="string"==typeof t?{value:t,context:e.context}:t,s=a.value,c=a.context,l=_(r),u=e.states[s];if(u.on){var d=N(u.on[l.type]),f=function(t){if(void 0===t)return{value:k(s,c)};var r="string"==typeof t?{target:t}:t,i=r.target,o=void 0===i?s:i,a=r.actions,d=void 0===a?[]:a,f=r.cond,p=c;if((void 0===f?function(){return!0}:f)(c,l)){var h=e.states[o],m=!1,v=[].concat(u.exit,d,h.entry).filter((function(e){return e})).map((function(e){return C(e,n._options.actions)})).filter((function(e){if("xstate.assign"===e.type){m=!0;var t=Object.assign({},p);return"function"==typeof e.assignment?t=e.assignment(p,l):Object.keys(e.assignment).forEach((function(n){t[n]="function"==typeof e.assignment[n]?e.assignment[n](p,l):e.assignment[n]})),p=t,!1}return!0}));return{value:{value:o,context:p,actions:v,changed:o!==s||v.length>0||m,matches:A(o)}}}};try{for(var p=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}(d),h=p.next();!h.done;h=p.next()){var m=f(h.value);if("object"==typeof m)return m.value}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}}return k(s,c)}};return n}var F=function(e,t){return e.actions.forEach((function(n){var r=n.exec;return r&&r(e.context,t)}))};function O(e){var t=e.initialState,n=E.NotStarted,r=new Set,i={_machine:e,send:function(i){n===E.Running&&(t=e.transition(t,i),F(t,_(i)),r.forEach((function(e){return e(t)})))},subscribe:function(e){return r.add(e),e(t),{unsubscribe:function(){return r.delete(e)}}},start:function(){return n=E.Running,F(t,T),i},stop:function(){return n=E.Stopped,r.clear(),i},get state(){return t},get status(){return n}};return i}var L={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return L.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete L.map[t],e.childNodes&&e.childNodes.forEach((function(e){return L.removeNodeFromMap(e)}))},has:function(e){return L.map.hasOwnProperty(e)}};var P=function(){function e(){this.reset()}return e.prototype.add=function(e){var t=this.indexes.get(e.parentId),n={id:e.node.id,mutation:e,children:[],texts:[],attributes:[]};t?(n.parent=t,t.children[n.id]=n):this.tree[n.id]=n,this.indexes.set(n.id,n)},e.prototype.remove=function(e){var t=this,n=this.indexes.get(e.parentId),r=this.indexes.get(e.id),i=function(e){t.removeIdSet.add(e);var n=L.getNode(e);null==n||n.childNodes.forEach((function(e){"__sn"in e&&i(e.__sn.id)}))},o=function(n){t.removeIdSet.add(n.id),Object.values(n.children).forEach((function(e){return o(e)}));var r=t.indexes.get(n.id);if(r){var i=r.parent;i&&(delete r.parent,delete i.children[r.id],t.indexes.delete(e.id))}};r?n?(delete r.parent,delete n.children[r.id],this.indexes.delete(e.id),o(r)):(delete this.tree[r.id],this.indexes.delete(r.id),o(r)):(this.removeNodeMutations.push(e),i(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,n,i,o=this,a=this.tree,s=this.removeNodeMutations,c=this.textMutations,l=this.attributeMutations,u={source:v.Mutation,removes:s,texts:c,attributes:l,adds:[]},d=function(e,t){t&&o.removeIdSet.add(e.id),u.texts=u.texts.concat(t?[]:e.texts).filter((function(e){return!o.removeIdSet.has(e.id)})),u.attributes=u.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 d(e,!0)})):(u.adds.push(e.mutation),e.children&&Object.values(e.children).forEach((function(e){return d(e,!1)})))};Object.values(a).forEach((function(e){return d(e,!1)}));try{for(var f=r(this.scrollMap.keys()),p=f.next();!p.done;p=f.next()){var h=p.value;this.removeIdSet.has(h)&&this.scrollMap.delete(h)}}catch(t){e={error:t}}finally{try{p&&!p.done&&(t=f.return)&&t.call(f)}finally{if(e)throw e.error}}try{for(var m=r(this.inputMap.keys()),y=m.next();!y.done;y=m.next()){h=y.value;this.removeIdSet.has(h)&&this.inputMap.delete(h)}}catch(e){n={error:e}}finally{try{y&&!y.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}var g=new Map(this.scrollMap),b=new Map(this.inputMap);return this.reset(),{mutationData:u,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}();function R(e,t){var i=t.getCastFn,o=t.emitter;return O(D({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"]}}},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"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]},CAST_EVENT:{target:"live",actions:["castEvent"]}}}}},{actions:{castEvent:I({lastPlayedEvent:function(e,t){return"CAST_EVENT"===t.type?t.payload.event:e.lastPlayedEvent}}),recordTimeOffset:I((function(e,t){var r=e.timeOffset;return"payload"in t&&"timeOffset"in t.payload&&(r=t.payload.timeOffset),n(n({},e),{timeOffset:r,baselineTime:e.events[0].timestamp+r})})),play:function(e){var t,n,a,s,c,l=e.timer,u=e.events,d=e.baselineTime,f=e.lastPlayedEvent;l.clear();try{for(var p=r(u),h=p.next();!h.done;h=p.next()){M(h.value,d)}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(t)throw t.error}}var y=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e[n];if(r.type===m.Meta&&r.timestamp<=t)return e.slice(n)}return e}(u,d),g=new Array,S=function(e){var t=null==f?void 0:f.timestamp;if((null==f?void 0:f.type)===m.IncrementalSnapshot&&f.data.source===v.MouseMove&&(t=f.timestamp+(null===(c=f.data.positions[0])||void 0===c?void 0:c.timeOffset)),t&&t<d&&(e.timestamp<=t||e===f))return"continue";var n=e.timestamp<d;if(n&&!function(e){switch(e.type){case m.DomContentLoaded:case m.Load:case m.Custom:return!1;case m.FullSnapshot:case m.Meta:return!0}switch(e.data.source){case v.MouseMove:case v.MouseInteraction:case v.TouchMove:case v.MediaInteraction:return!1;case v.ViewportResize:case v.StyleSheetRule:case v.Scroll:case v.Input:return!0}return!0}(e))return"continue";var r=i(e,n);n?r():g.push({doAction:function(){r(),o.emit(b.EventCast,e)},delay:e.delay})};try{for(var x=r(y),E=x.next();!E.done;E=x.next()){S(E.value)}}catch(e){a={error:e}}finally{try{E&&!E.done&&(s=x.return)&&s.call(x)}finally{if(a)throw a.error}}o.emit(b.Flush),l.addActions(g),l.start()},pause:function(e){e.timer.clear()},resetLastPlayedEvent:I((function(e){return n(n({},e),{lastPlayedEvent:null})})),startLive:I({baselineTime:function(e,t){return e.timer.toggleLiveMode(!0),e.timer.start(),"TO_LIVE"===t.type&&t.payload.baselineTime?t.payload.baselineTime:Date.now()}}),addEvent:I((function(e,t){var r=e.baselineTime,a=e.timer,s=e.events;if("ADD_EVENT"===t.type){var c=t.payload.event;M(c,r),s.push(c);var l=c.timestamp<r,u=i(c,l);l?u():(a.addAction({doAction:function(){u(),o.emit(b.EventCast,c)},delay:c.delay}),a.isActive()||a.start())}return n(n({},e),{events:s})}))}}))}var j=h||S,B={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"},V=function(){function e(e,n){var o=this;if(this.mouseTail=null,this.tailPositions=[],this.emitter=j(),this.legacy_missingNodeRetryMap={},this.imageMap=new Map,!(null==n?void 0:n.liveMode)&&e.length<2)throw new Error("Replayer need at least 2 events.");var a={speed:1,root:document.body,loadTimeout:0,skipInactive:!1,showWarning:!0,showDebug:!1,blockClass:"rr-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,mouseTail:B};this.config=Object.assign({},a,n),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.emitter.on(b.Resize,this.handleResize),this.setupDom(),this.treeIndex=new P,this.fragmentParentMap=new Map,this.emitter.on(b.Flush,(function(){var e,n,a,s,c,l,u=o.treeIndex.flush(),d=u.scrollMap,f=u.inputMap;try{for(var p=r(d.values()),h=p.next();!h.done;h=p.next()){var m=h.value;o.applyScroll(m)}}catch(t){e={error:t}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(e)throw e.error}}try{for(var v=r(f.values()),y=v.next();!y.done;y=v.next()){m=y.value;o.applyInput(m)}}catch(e){a={error:e}}finally{try{y&&!y.done&&(s=v.return)&&s.call(v)}finally{if(a)throw a.error}}try{for(var g=r(o.fragmentParentMap.entries()),b=g.next();!b.done;b=g.next()){var S=i(b.value,2),x=S[0],E=S[1];L.map[E.__sn.id]=E,E.__sn.type===t.Element&&"textarea"===E.__sn.tagName&&x.textContent&&(E.value=x.textContent),E.appendChild(x)}}catch(e){c={error:e}}finally{try{b&&!b.done&&(l=g.return)&&l.call(g)}finally{if(c)throw c.error}}o.fragmentParentMap.clear()}));var s=new w([],(null==n?void 0:n.speed)||a.speed);this.service=R({events:e.map((function(e){return n&&n.unpackFn?n.unpackFn(e):e})),timer:s,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,emitter:this.emitter}),this.service.start(),this.service.subscribe((function(e){o.emitter.emit(b.StateChange,{player:e})})),this.speedService=O(D({id:"speed",context:{normalSpeed:-1,timer:s},initial:"normal",states:{normal:{on:{FAST_FORWARD:{target:"skipping",actions:["recordSpeed","setSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}},skipping:{on:{BACK_TO_NORMAL:{target:"normal",actions:["restoreSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}}}},{actions:{setSpeed:function(e,t){"payload"in t&&e.timer.setSpeed(t.payload.speed)},recordSpeed:I({normalSpeed:function(e){return e.timer.speed}}),restoreSpeed:function(e){e.timer.setSpeed(e.normalSpeed)}}})),this.speedService.start(),this.speedService.subscribe((function(e){o.emitter.emit(b.StateChange,{speed:e})}));var c=this.service.state.context.events.find((function(e){return e.type===m.Meta})),l=this.service.state.context.events.find((function(e){return e.type===m.FullSnapshot}));if(c){var u=c.data,d=u.width,f=u.height;setTimeout((function(){o.emitter.emit(b.Resize,{width:d,height:f})}),0)}l&&this.rebuildFullSnapshot(l)}return Object.defineProperty(e.prototype,"timer",{get:function(){return this.service.state.context.timer},enumerable:!1,configurable:!0}),e.prototype.on=function(e,t){this.emitter.on(e,t)},e.prototype.setConfig=function(e){var t=this;Object.keys(e).forEach((function(n){t.config[n]=e[n]})),this.config.skipInactive||this.backToNormal(),void 0!==e.speed&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}})},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.play=function(e){void 0===e&&(e=0),this.service.state.matches("paused")||this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:e}}),this.emitter.emit(b.Start)},e.prototype.pause=function(e){void 0===e&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),"number"==typeof e&&(this.play(e),this.service.send({type:"PAUSE"})),this.emitter.emit(b.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(b.Resume)},e.prototype.startLive=function(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})},e.prototype.addEvent=function(e){var t=this,n=this.config.unpackFn?this.config.unpackFn(e):e;Promise.resolve().then((function(){return t.service.send({type:"ADD_EVENT",payload:{event:n}})}))},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.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="none",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&&(x(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))},e.prototype.handleResize=function(e){var t,n;try{for(var i=r([this.mouseTail,this.iframe]),o=i.next();!o.done;o=i.next()){var a=o.value;a&&(a.style.display="inherit",a.setAttribute("width",String(e.width)),a.setAttribute("height",String(e.height)))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},e.prototype.getCastFn=function(e,t){var n,i=this;switch(void 0===t&&(t=!1),e.type){case m.DomContentLoaded:case m.Load:break;case m.Custom:n=function(){i.emitter.emit(b.CustomEvent,e)};break;case m.Meta:n=function(){return i.emitter.emit(b.Resize,{width:e.data.width,height:e.data.height})};break;case m.FullSnapshot:n=function(){i.rebuildFullSnapshot(e,t),i.iframe.contentWindow.scrollTo(e.data.initialOffset)};break;case m.IncrementalSnapshot:n=function(){var n,o;if(i.applyIncremental(e,t),!t&&(e===i.nextUserInteractionEvent&&(i.nextUserInteractionEvent=null,i.backToNormal()),i.config.skipInactive&&!i.nextUserInteractionEvent)){try{for(var a=r(i.service.state.context.events),s=a.next();!s.done;s=a.next()){var c=s.value;if(!(c.timestamp<=e.timestamp)&&i.isUserInteraction(c)){c.delay-e.delay>1e4*i.speedService.state.context.timer.speed&&(i.nextUserInteractionEvent=c);break}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}if(i.nextUserInteractionEvent){var l=i.nextUserInteractionEvent.delay-e.delay,u={speed:Math.min(Math.round(l/5e3),360)};i.speedService.send({type:"FAST_FORWARD",payload:u}),i.emitter.emit(b.SkipStart,u)}}}}return function(){if(n&&n(),i.service.send({type:"CAST_EVENT",payload:{event:e}}),e===i.service.state.context.events[i.service.state.context.events.length-1]){var t=function(){i.backToNormal(),i.service.send("END"),i.emitter.emit(b.Finish)};e.type===m.IncrementalSnapshot&&e.data.source===v.MouseMove&&e.data.positions.length?setTimeout((function(){t()}),Math.max(0,-e.data.positions[0].timeOffset)):t()}}},e.prototype.rebuildFullSnapshot=function(e,t){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={},L.map=p(e.data.node,this.iframe.contentDocument)[1];var n=document.createElement("style"),r=this.iframe.contentDocument,i=r.documentElement,o=r.head;i.insertBefore(n,o);for(var a,s=(a=this.config.blockClass,["iframe, ."+a+" { background: #ccc }","noscript { display: none !important; }"]).concat(this.config.insertStyleRules),c=0;c<s.length;c++)n.sheet.insertRule(s[c],c);this.emitter.emit(b.FullsnapshotRebuilded,e),t||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()},e.prototype.waitForStylesheetLoad=function(){var e,t=this,n=null===(e=this.iframe.contentDocument)||void 0===e?void 0:e.head;if(n){var r,i=new Set,o=this.service.state,a=function(){o=t.service.state};this.emitter.on(b.Start,a),this.emitter.on(b.Pause,a);var s=function(){t.emitter.off(b.Start,a),t.emitter.off(b.Pause,a)};n.querySelectorAll('link[rel="stylesheet"]').forEach((function(e){e.sheet||(i.add(e),e.addEventListener("load",(function(){i.delete(e),0===i.size&&-1!==r&&(o.matches("playing")&&t.play(t.getCurrentTime()),t.emitter.emit(b.LoadStylesheetEnd),r&&window.clearTimeout(r),s())})))})),i.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(b.LoadStylesheetStart),r=window.setTimeout((function(){o.matches("playing")&&t.play(t.getCurrentTime()),r=-1,s()}),this.config.loadTimeout))}},e.prototype.preloadAllImages=function(){var e,t,n=this,i=this.service.state,o=function(){i=n.service.state};this.emitter.on(b.Start,o),this.emitter.on(b.Pause,o);var a=0,s=0;try{for(var c=r(this.service.state.context.events),l=c.next();!l.done;l=c.next()){var u=l.value;if(u.type===m.IncrementalSnapshot&&u.data.source===v.CanvasMutation&&"drawImage"===u.data.property&&"string"==typeof u.data.args[0]&&!this.imageMap.has(u)){a++;var d=document.createElement("img");d.src=u.data.args[0],this.imageMap.set(u,d),d.onload=function(){++s===a&&(i.matches("playing")&&n.play(n.getCurrentTime()),n.emitter.off(b.Start,o),n.emitter.off(b.Pause,o))}}}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}a!==s&&this.service.send({type:"PAUSE"})},e.prototype.applyIncremental=function(e,t){var n,r,i=this,o=e.data;switch(o.source){case v.Mutation:t&&(o.adds.forEach((function(e){return i.treeIndex.add(e)})),o.texts.forEach((function(e){return i.treeIndex.text(e)})),o.attributes.forEach((function(e){return i.treeIndex.attribute(e)})),o.removes.forEach((function(e){return i.treeIndex.remove(e)}))),this.applyMutation(o,t);break;case v.MouseMove:if(t){var a=o.positions[o.positions.length-1];this.moveAndHover(o,a.x,a.y,a.id)}else o.positions.forEach((function(t){var n={doAction:function(){i.moveAndHover(o,t.x,t.y,t.id)},delay:t.timeOffset+e.timestamp-i.service.state.context.baselineTime};i.timer.addAction(n)})),this.timer.addAction({doAction:function(){},delay:e.delay-(null===(n=o.positions[0])||void 0===n?void 0:n.timeOffset)});break;case v.MouseInteraction:if(-1===o.id)break;var s=new Event(y[o.type].toLowerCase());if(!(S=L.getNode(o.id)))return this.debugNodeNotFound(o,o.id);this.emitter.emit(b.MouseInteraction,{type:o.type,target:S});var c=this.config.triggerFocus;switch(o.type){case y.Blur:"blur"in S&&S.blur();break;case y.Focus:c&&S.focus&&S.focus({preventScroll:!0});break;case y.Click:case y.TouchStart:case y.TouchEnd:t||(this.moveAndHover(o,o.x,o.y,o.id),this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active"));break;default:S.dispatchEvent(s)}break;case v.Scroll:if(-1===o.id)break;if(t){this.treeIndex.scroll(o);break}this.applyScroll(o);break;case v.ViewportResize:this.emitter.emit(b.Resize,{width:o.width,height:o.height});break;case v.Input:if(-1===o.id)break;if(t){this.treeIndex.input(o);break}this.applyInput(o);break;case v.MediaInteraction:if(!(S=L.getNode(o.id)))return this.debugNodeNotFound(o,o.id);var l=S;try{o.type===g.Pause&&l.pause(),o.type===g.Play&&(l.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?l.play():l.addEventListener("canplay",(function(){l.play()})))}catch(e){this.config.showWarning&&console.warn("Failed to replay media interactions: "+(e.message||e))}break;case v.StyleSheetRule:if(!(S=L.getNode(o.id)))return this.debugNodeNotFound(o,o.id);var u=S,d=S.parentNode,f=this.fragmentParentMap.has(d),p=void 0;if(f){var h=this.fragmentParentMap.get(S.parentNode);p=document.createTextNode(""),d.replaceChild(p,S),h.appendChild(S)}var m=u.sheet;o.adds&&o.adds.forEach((function(e){var t=e.rule,n=e.index,r=void 0===n?void 0:Math.min(n,m.rules.length);try{m.insertRule(t,r)}catch(e){}})),o.removes&&o.removes.forEach((function(e){var t=e.index;try{m.deleteRule(t)}catch(e){}})),f&&p&&d.replaceChild(S,p);break;case v.CanvasMutation:if(!this.config.UNSAFE_replayCanvas)return;var S;if(!(S=L.getNode(o.id)))return this.debugNodeNotFound(o,o.id);try{var x=S.getContext("2d");if(o.setter)return void(x[o.property]=o.args[0]);var E=x[o.property];if("drawImage"===o.property&&"string"==typeof o.args[0]){var w=this.imageMap.get(e);o.args[0]=w,E.apply(x,o.args)}else E.apply(x,o.args)}catch(e){this.warnCanvasMutationFailed(o,o.id,e)}break;case v.Font:try{var M=new FontFace(o.family,o.buffer?new Uint8Array(JSON.parse(o.fontSource)):o.fontSource,o.descriptors);null===(r=this.iframe.contentDocument)||void 0===r||r.fonts.add(M)}catch(e){this.config.showWarning&&console.warn(e)}}},e.prototype.applyMutation=function(e,t){var r=this;e.removes.forEach((function(t){var n=L.getNode(t.id);if(!n)return r.warnNodeNotFound(e,t.id);var i=L.getNode(t.parentId);if(!i)return r.warnNodeNotFound(e,t.parentId);if(L.removeNodeFromMap(n),i){var o=r.fragmentParentMap.get(i);o&&o.contains(n)?o.removeChild(n):i.removeChild(n)}}));var i=n({},this.legacy_missingNodeRetryMap),o=[];var a=function(e){if(!r.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");var n=L.getNode(e.parentId);if(!n)return o.push(e);var a=null;if(r.iframe.contentDocument.contains?a=r.iframe.contentDocument.contains(n):r.iframe.contentDocument.body.contains&&(a=r.iframe.contentDocument.body.contains(n)),t&&a){var s=document.createDocumentFragment();for(L.map[e.parentId]=s,r.fragmentParentMap.set(s,n);n.firstChild;)s.appendChild(n.firstChild);n=s}var c=null,l=null;if(e.previousId&&(c=L.getNode(e.previousId)),e.nextId&&(l=L.getNode(e.nextId)),function(e){var t=null;return e.nextId&&(t=L.getNode(e.nextId)),null!==e.nextId&&void 0!==e.nextId&&-1!==e.nextId&&!t}(e))return o.push(e);var u=f(e.node,r.iframe.contentDocument,L.map,!0);-1!==e.previousId&&-1!==e.nextId?(c&&c.nextSibling&&c.nextSibling.parentNode?n.insertBefore(u,c.nextSibling):l&&l.parentNode?n.contains(l)?n.insertBefore(u,l):n.insertBefore(u,null):n.appendChild(u),(e.previousId||e.nextId)&&r.legacy_resolveMissingNode(i,n,u,e)):i[e.node.id]={node:u,mutation:e}};e.adds.forEach((function(e){a(e)}));for(var s=Date.now();o.length;){if(Date.now()-s>5e3)return o.forEach((function(t){return r.warnNodeNotFound(e,t.node.id)}));var c=o.shift();a(c)}Object.keys(i).length&&Object.assign(this.legacy_missingNodeRetryMap,i),e.texts.forEach((function(t){var n=L.getNode(t.id);if(!n)return r.warnNodeNotFound(e,t.id);r.fragmentParentMap.has(n)&&(n=r.fragmentParentMap.get(n)),n.textContent=t.value})),e.attributes.forEach((function(t){var n=L.getNode(t.id);if(!n)return r.warnNodeNotFound(e,t.id);for(var i in r.fragmentParentMap.has(n)&&(n=r.fragmentParentMap.get(n)),t.attributes)if("string"==typeof i){var o=t.attributes[i];try{null!==o?n.setAttribute(i,o):n.removeAttribute(i)}catch(e){r.config.showWarning&&console.warn("An error occurred may due to the checkout feature.",e)}}}))},e.prototype.applyScroll=function(e){var t=L.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);if(t===this.iframe.contentDocument)this.iframe.contentWindow.scrollTo({top:e.y,left:e.x,behavior:"smooth"});else try{t.scrollTop=e.y,t.scrollLeft=e.x}catch(e){}},e.prototype.applyInput=function(e){var t=L.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);try{t.checked=e.isChecked,t.value=e.text}catch(e){}},e.prototype.legacy_resolveMissingNode=function(e,t,n,r){var i=r.previousId,o=r.nextId,a=i&&e[i],s=o&&e[o];if(a){var c=a,l=c.node,u=c.mutation;t.insertBefore(l,n),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,l,u)}if(s){var d=s;l=d.node,u=d.mutation;t.insertBefore(l,n.nextSibling),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,l,u)}},e.prototype.moveAndHover=function(e,t,n,r){this.mouse.style.left=t+"px",this.mouse.style.top=n+"px",this.drawMouseTail({x:t,y:n});var i=L.getNode(r);if(!i)return this.debugNodeNotFound(e,r);this.hoverElements(i)},e.prototype.drawMouseTail=function(e){var t=this;if(this.mouseTail){var n=!0===this.config.mouseTail?B:Object.assign({},B,this.config.mouseTail),r=n.lineCap,i=n.lineWidth,o=n.strokeStyle,a=n.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=r,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)}},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 n=e;n;)n.classList&&n.classList.add(":hover"),n=n.parentElement},e.prototype.isUserInteraction=function(e){return e.type===m.IncrementalSnapshot&&(e.data.source>v.Mutation&&e.data.source<=v.Input)},e.prototype.backToNormal=function(){this.nextUserInteractionEvent=null,this.speedService.state.matches("normal")||(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(b.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))},e.prototype.warnNodeNotFound=function(e,t){this.config.showWarning&&console.warn("[replayer]","Node with id '"+t+"' not found in",e)},e.prototype.warnCanvasMutationFailed=function(e,t,n){console.warn("[replayer]","Has error on update canvas '"+t+"'",e,n)},e.prototype.debugNodeNotFound=function(e,t){this.config.showDebug&&console.log("[replayer]","Node with id '"+t+"' not found in",e)},e}();return e.Replayer=V,e}({});
//# sourceMappingURL=rrweb-replay.min.js.map

@@ -7,4 +7,4 @@ export { EventType, IncrementalSource, MouseInteractions, ReplayerEvents } from '../types.js';

export { Replayer } from '../replay/index.js';
export { addCustomEvent } from '../index.js';
export { addCustomEvent, freezePage } from '../index.js';
export { pack } from '../packer/pack.js';
export { unpack } from '../packer/unpack.js';

@@ -10,3 +10,4 @@ export { EventType, IncrementalSource, MouseInteractions, ReplayerEvents } from './types.js';

var addCustomEvent = record.addCustomEvent;
var freezePage = record.freezePage;
export { addCustomEvent };
export { addCustomEvent, freezePage };

@@ -5,3 +5,3 @@ import { __assign, __read } from '../../node_modules/tslib/tslib.es6.js';

import { polyfill, on, getWindowWidth, getWindowHeight, mirror } from '../utils.js';
import initObservers from './observer.js';
import { initObservers, mutationBuffer } from './observer.js';

@@ -46,2 +46,9 @@ function wrapEvent(e) {

wrappedEmit = function (e, isCheckout) {
if (mutationBuffer.isFrozen() &&
e.type !== EventType.FullSnapshot &&
!(e.type == EventType.IncrementalSnapshot &&
e.data.source == IncrementalSource.Mutation)) {
mutationBuffer.emit();
mutationBuffer.unfreeze();
}
emit((packFn ? packFn(e) : e), isCheckout);

@@ -73,2 +80,4 @@ if (e.type === EventType.FullSnapshot) {

}), isCheckout);
var wasFrozen = mutationBuffer.isFrozen();
mutationBuffer.freeze();
var _e = __read(snapshot(document, blockClass, inlineStylesheet, maskInputOptions, recordCanvas), 2), node = _e[0], idNodeMap = _e[1];

@@ -95,2 +104,6 @@ if (!node) {

}));
if (!wasFrozen) {
mutationBuffer.emit();
mutationBuffer.unfreeze();
}
}

@@ -213,3 +226,6 @@ try {

};
record.freezePage = function () {
mutationBuffer.freeze();
};
export default record;

@@ -86,8 +86,9 @@ import { __values } from '../../node_modules/tslib/tslib.es6.js';

var MutationBuffer = (function () {
function MutationBuffer(cb, blockClass, inlineStylesheet, maskInputOptions, recordCanvas) {
function MutationBuffer() {
var _this = this;
this.frozen = false;
this.texts = [];
this.attributes = [];
this.removes = [];
this.adds = [];
this.mapRemoves = [];
this.movedMap = {};

@@ -98,4 +99,10 @@ this.addedSet = new Set();

this.processMutations = function (mutations) {
mutations.forEach(_this.processMutation);
if (!_this.frozen) {
_this.emit();
}
};
this.emit = function () {
var e_1, _a, e_2, _b;
mutations.forEach(_this.processMutation);
var adds = [];
var addList = new DoubleLinkedList();

@@ -118,3 +125,3 @@ var getNextId = function (n) {

}
_this.adds.push({
adds.push({
parentId: parentId,

@@ -125,5 +132,12 @@ nextId: nextId,

};
while (_this.mapRemoves.length) {
mirror.removeNodeFromMap(_this.mapRemoves.shift());
}
try {
for (var _c = __values(_this.movedSet), _d = _c.next(); !_d.done; _d = _c.next()) {
var n = _d.value;
if (isParentRemoved(_this.removes, n) &&
!_this.movedSet.has(n.parentNode)) {
continue;
}
pushAdd(n);

@@ -189,5 +203,2 @@ }

}
_this.emit();
};
this.emit = function () {
var payload = {

@@ -207,3 +218,3 @@ texts: _this.texts

removes: _this.removes,
adds: _this.adds,
adds: adds,
};

@@ -216,7 +227,5 @@ if (!payload.texts.length &&

}
_this.emissionCallback(payload);
_this.texts = [];
_this.attributes = [];
_this.removes = [];
_this.adds = [];
_this.addedSet = new Set();

@@ -226,2 +235,3 @@ _this.movedSet = new Set();

_this.movedMap = {};
_this.emissionCallback(payload);
};

@@ -281,3 +291,3 @@ this.processMutation = function (m) {

}
mirror.removeNodeFromMap(n);
_this.mapRemoves.push(n);
});

@@ -308,2 +318,4 @@ break;

};
}
MutationBuffer.prototype.init = function (cb, blockClass, inlineStylesheet, maskInputOptions, recordCanvas) {
this.blockClass = blockClass;

@@ -314,3 +326,12 @@ this.inlineStylesheet = inlineStylesheet;

this.emissionCallback = cb;
}
};
MutationBuffer.prototype.freeze = function () {
this.frozen = true;
};
MutationBuffer.prototype.unfreeze = function () {
this.frozen = false;
};
MutationBuffer.prototype.isFrozen = function () {
return this.frozen;
};
return MutationBuffer;

@@ -317,0 +338,0 @@ }());

@@ -6,5 +6,6 @@ import { __spread, __values, __assign } from '../../node_modules/tslib/tslib.es6.js';

var mutationBuffer = new MutationBuffer();
function initMutationObserver(cb, blockClass, inlineStylesheet, maskInputOptions, recordCanvas) {
var mutationBuffer = new MutationBuffer(cb, blockClass, inlineStylesheet, maskInputOptions, recordCanvas);
var observer = new MutationObserver(mutationBuffer.processMutations);
mutationBuffer.init(cb, blockClass, inlineStylesheet, maskInputOptions, recordCanvas);
var observer = new MutationObserver(mutationBuffer.processMutations.bind(mutationBuffer));
observer.observe(document, {

@@ -492,3 +493,2 @@ attributes: true,

export default initObservers;
export { INPUT_TAGS };
export { INPUT_TAGS, initObservers, mutationBuffer };

@@ -656,2 +656,11 @@ import { __values, __assign, __read } from '../../node_modules/tslib/tslib.es6.js';

var styleEl = target;
var parent = target.parentNode;
var usingVirtualParent = this.fragmentParentMap.has(parent);
var placeholderNode = void 0;
if (usingVirtualParent) {
var domParent = this.fragmentParentMap.get(target.parentNode);
placeholderNode = document.createTextNode('');
parent.replaceChild(placeholderNode, target);
domParent.appendChild(target);
}
var styleSheet_1 = styleEl.sheet;

@@ -681,2 +690,5 @@ if (d.adds) {

}
if (usingVirtualParent && placeholderNode) {
parent.replaceChild(target, placeholderNode);
}
break;

@@ -683,0 +695,0 @@ }

@@ -705,8 +705,9 @@ 'use strict';

var MutationBuffer = (function () {
function MutationBuffer(cb, blockClass, inlineStylesheet, maskInputOptions, recordCanvas) {
function MutationBuffer() {
var _this = this;
this.frozen = false;
this.texts = [];
this.attributes = [];
this.removes = [];
this.adds = [];
this.mapRemoves = [];
this.movedMap = {};

@@ -717,4 +718,10 @@ this.addedSet = new Set();

this.processMutations = function (mutations) {
mutations.forEach(_this.processMutation);
if (!_this.frozen) {
_this.emit();
}
};
this.emit = function () {
var e_1, _a, e_2, _b;
mutations.forEach(_this.processMutation);
var adds = [];
var addList = new DoubleLinkedList();

@@ -737,3 +744,3 @@ var getNextId = function (n) {

}
_this.adds.push({
adds.push({
parentId: parentId,

@@ -744,5 +751,12 @@ nextId: nextId,

};
while (_this.mapRemoves.length) {
mirror.removeNodeFromMap(_this.mapRemoves.shift());
}
try {
for (var _c = __values(_this.movedSet), _d = _c.next(); !_d.done; _d = _c.next()) {
var n = _d.value;
if (isParentRemoved(_this.removes, n) &&
!_this.movedSet.has(n.parentNode)) {
continue;
}
pushAdd(n);

@@ -808,5 +822,2 @@ }

}
_this.emit();
};
this.emit = function () {
var payload = {

@@ -826,3 +837,3 @@ texts: _this.texts

removes: _this.removes,
adds: _this.adds,
adds: adds,
};

@@ -835,7 +846,5 @@ if (!payload.texts.length &&

}
_this.emissionCallback(payload);
_this.texts = [];
_this.attributes = [];
_this.removes = [];
_this.adds = [];
_this.addedSet = new Set();

@@ -845,2 +854,3 @@ _this.movedSet = new Set();

_this.movedMap = {};
_this.emissionCallback(payload);
};

@@ -900,3 +910,3 @@ this.processMutation = function (m) {

}
mirror.removeNodeFromMap(n);
_this.mapRemoves.push(n);
});

@@ -927,2 +937,4 @@ break;

};
}
MutationBuffer.prototype.init = function (cb, blockClass, inlineStylesheet, maskInputOptions, recordCanvas) {
this.blockClass = blockClass;

@@ -933,3 +945,12 @@ this.inlineStylesheet = inlineStylesheet;

this.emissionCallback = cb;
}
};
MutationBuffer.prototype.freeze = function () {
this.frozen = true;
};
MutationBuffer.prototype.unfreeze = function () {
this.frozen = false;
};
MutationBuffer.prototype.isFrozen = function () {
return this.frozen;
};
return MutationBuffer;

@@ -963,5 +984,6 @@ }());

var mutationBuffer = new MutationBuffer();
function initMutationObserver(cb, blockClass, inlineStylesheet, maskInputOptions, recordCanvas) {
var mutationBuffer = new MutationBuffer(cb, blockClass, inlineStylesheet, maskInputOptions, recordCanvas);
var observer = new MutationObserver(mutationBuffer.processMutations);
mutationBuffer.init(cb, blockClass, inlineStylesheet, maskInputOptions, recordCanvas);
var observer = new MutationObserver(mutationBuffer.processMutations.bind(mutationBuffer));
observer.observe(document, {

@@ -1487,2 +1509,9 @@ attributes: true,

wrappedEmit = function (e, isCheckout) {
if (mutationBuffer.isFrozen() &&
e.type !== EventType.FullSnapshot &&
!(e.type == EventType.IncrementalSnapshot &&
e.data.source == IncrementalSource.Mutation)) {
mutationBuffer.emit();
mutationBuffer.unfreeze();
}
emit((packFn ? packFn(e) : e), isCheckout);

@@ -1514,2 +1543,4 @@ if (e.type === EventType.FullSnapshot) {

}), isCheckout);
var wasFrozen = mutationBuffer.isFrozen();
mutationBuffer.freeze();
var _e = __read(snapshot(document, blockClass, inlineStylesheet, maskInputOptions, recordCanvas), 2), node = _e[0], idNodeMap = _e[1];

@@ -1536,2 +1567,6 @@ if (!node) {

}));
if (!wasFrozen) {
mutationBuffer.emit();
mutationBuffer.unfreeze();
}
}

@@ -1654,3 +1689,6 @@ try {

};
record.freezePage = function () {
mutationBuffer.freeze();
};
module.exports = record;
{
"name": "rrweb",
"version": "0.9.7",
"version": "0.9.8",
"description": "record and replay the web",

@@ -5,0 +5,0 @@ "scripts": {

@@ -25,2 +25,4 @@ <p align="center">

[**场景示例**](./docs/recipes/index.zh_CN.md)
## 项目结构

@@ -27,0 +29,0 @@

@@ -7,2 +7,3 @@ import record from './record';

declare const addCustomEvent: <T>(tag: string, payload: T) => void;
export { record, addCustomEvent, Replayer, mirror, utils };
declare const freezePage: () => void;
export { record, addCustomEvent, freezePage, Replayer, mirror, utils };

@@ -5,3 +5,4 @@ import { eventWithTime, recordOptions, listenerHandler } from '../types';

var addCustomEvent: <T>(tag: string, payload: T) => void;
var freezePage: () => void;
}
export default record;
import { MaskInputOptions } from 'rrweb-snapshot';
import { mutationRecord, blockClass, mutationCallBack } from '../types';
export default class MutationBuffer {
private frozen;
private texts;
private attributes;
private removes;
private adds;
private mapRemoves;
private movedMap;

@@ -17,3 +18,6 @@ private addedSet;

private recordCanvas;
constructor(cb: mutationCallBack, blockClass: blockClass, inlineStylesheet: boolean, maskInputOptions: MaskInputOptions, recordCanvas: boolean);
init(cb: mutationCallBack, blockClass: blockClass, inlineStylesheet: boolean, maskInputOptions: MaskInputOptions, recordCanvas: boolean): void;
freeze(): void;
unfreeze(): void;
isFrozen(): boolean;
processMutations: (mutations: mutationRecord[]) => void;

@@ -20,0 +24,0 @@ emit: () => void;

import { observerParam, listenerHandler, hooksParam } from '../types';
import MutationBuffer from './mutation';
export declare const mutationBuffer: MutationBuffer;
export declare const INPUT_TAGS: string[];
export default function initObservers(o: observerParam, hooks?: hooksParam): listenerHandler;
export declare function initObservers(o: observerParam, hooks?: hooksParam): listenerHandler;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc