Socket
Socket
Sign inDemoInstall

rrweb

Package Overview
Dependencies
2
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.6.7 to 0.6.8

README.zh_CN.md

28

dist/record/rrweb-record.js

@@ -1,2 +0,2 @@

var record = (function () {
var rrwebRecord = (function () {
'use strict';

@@ -429,7 +429,25 @@

});
var isDropped = function (n) {
var parentNode = n.parentNode;
if (!parentNode) {
return false;
}
if (dropped.some(function (d) { return d === parentNode; })) {
return true;
}
return isDropped(parentNode);
};
var isRemoved = function (n) {
var parentNode = n.parentNode;
if (!parentNode) {
return false;
}
var parentId = mirror.getId(parentNode);
if (removes.some(function (r) { return r.id === parentId; })) {
return true;
}
return isRemoved(parentNode);
};
Array.from(addsSet).forEach(function (n) {
var parentId = mirror.getId(n.parentNode);
if (parentId &&
!dropped.some(function (d) { return d === n.parentNode; }) &&
!removes.some(function (r) { return r.id === parentId; })) {
if (!isDropped(n) && !isRemoved(n)) {
adds.push({

@@ -436,0 +454,0 @@ parentId: mirror.getId(n.parentNode),

2

dist/record/rrweb-record.min.js

@@ -1,2 +0,2 @@

var record=function(){"use strict";var e,t=function(){return(t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};!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 n=1;var r=/url\((['"]|)([^'"]*)\1\)/gm,o=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/;function u(e,t){return e.replace(r,function(e,n,r){if(!o.test(r))return"url('"+r+"')";if("/"===r[0])return"url('"+(((u=t).indexOf("//")>-1?u.split("/").slice(0,3).join("/"):u.split("/")[0]).split("?")[0]+r)+"')";var u,a=t.split("/"),i=r.split("/");a.pop();for(var c=0,d=i;c<d.length;c++){var s=d[c];"."!==s&&(".."===s?a.pop():a.push(s))}return"url('"+a.join("/")+"')"})}function a(e,t){var n=e.createElement("a");return n.href=t,n.href}var i="rr-block";function c(t,n){switch(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:for(var r=t.classList.contains(i),o=t.tagName.toLowerCase(),c={},d=0,s=Array.from(t.attributes);d<s.length;d++){var l=s[d],p=l.name,f=l.value;c[p]="src"===p||"href"===p?a(n,f):f}if("link"===o){var m=Array.from(n.styleSheets).find(function(e){return e.href===t.href}),h=function(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).reduce(function(e,t){return e+t.cssText},""):null}catch(e){return null}}(m);h&&(c={_cssText:u(h,m.href)})}if("input"===o||"textarea"===o||"select"===o){f=t.value;"radio"!==c.type&&"checkbox"!==c.type&&f?c.value=f:t.checked&&(c.checked=t.checked)}if("option"===o){var v=t.parentElement;c.value===v.value&&(c.selected=t.selected)}if(r){var y=t.getBoundingClientRect(),g=y.width,E=y.height;c.rr_width=g+"px",c.rr_height=E+"px"}return{type:e.Element,tagName:o,attributes:c,childNodes:[],isSVG:(I=t,"svg"===I.tagName||I instanceof SVGElement||void 0),needBlock:r};case t.TEXT_NODE:var b=t.parentNode&&t.parentNode.tagName,w=t.textContent,C="STYLE"===b||void 0;return C&&w&&(w=u(w,location.href)),"SCRIPT"===b&&(w="SCRIPT_PLACEHOLDER"),{type:e.Text,textContent:w||"",isStyle:C};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 I}function d(t,r,o,u){void 0===u&&(u=!1);var a=c(t,r);if(!a)return console.warn(t,"not serialized"),null;var i=Object.assign(a,{id:n++});t.__sn=i,o[i.id]=t;var s=!u;if(i.type===e.Element&&(s=s&&!i.needBlock,delete i.needBlock),(i.type===e.Document||i.type===e.Element)&&s)for(var l=0,p=Array.from(t.childNodes);l<p.length;l++){var f=d(p[l],r,o);f&&i.childNodes.push(f)}return i}function s(e){n=1;var t={};return[d(e,e,t),t]}function l(e,t,n){void 0===n&&(n=document);var r={capture:!0,passive:!0};return n.addEventListener(e,t,r),function(){return n.removeEventListener(e,t,r)}}var p,f,m,h={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return h.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete h.map[t],e.childNodes&&e.childNodes.forEach(function(e){return h.removeNodeFromMap(e)})},has:function(e){return h.map.hasOwnProperty(e)}};function v(e,t,n){void 0===n&&(n={});var r=null,o=0;return function(){var u=Date.now();o||!1!==n.leading||(o=u);var a=t-(u-o),i=this,c=arguments;a<=0||a>t?(r&&(window.clearTimeout(r),r=null),o=u,e.apply(i,c)):r||!1===n.trailing||(r=window.setTimeout(function(){o=!1===n.leading?0:Date.now(),r=null,e.apply(i,c)},a))}}function y(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function g(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function E(e){var t=[];return Object.keys(m).filter(function(e){return Number.isNaN(Number(e))}).forEach(function(n){var r=n.toLowerCase(),o=function(t){return function(n){var r=h.getId(n.target),o=n.clientX,u=n.clientY;e({type:m[t],id:r,x:o,y:u})}}(n);t.push(l(r,o))}),function(){t.forEach(function(e){return e()})}}!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"}(p||(p={})),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"}(f||(f={})),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=8]="TouchMove",e[e.TouchEnd=9]="TouchEnd"}(m||(m={}));var b=["INPUT","TEXTAREA","SELECT"],w=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"]],C="rr-ignore",I=new WeakMap;function N(e){function n(e){var t=e.target;if(t&&t.tagName&&!(b.indexOf(t.tagName)<0)){var n=t.type;if("password"!==n&&!t.classList.contains(C)){var o=t.value,u=!1;"radio"!==n&&"checkbox"!==n||(u=t.checked),r(t,{text:o,isChecked:u});var a=t.name;"radio"===n&&a&&u&&document.querySelectorAll('input[type="radio"][name="'+a+'"]').forEach(function(e){e!==t&&r(e,{text:e.value,isChecked:!u})})}}}function r(n,r){var o=I.get(n);if(!o||o.text!==r.text||o.isChecked!==r.isChecked){I.set(n,r);var u=h.getId(n);e(t({},r,{id:u}))}}var o=["input","change"].map(function(e){return l(e,n)}),u=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");return u&&u.set&&o.push.apply(o,w.map(function(e){return function e(t,n,r){var o=Object.getOwnPropertyDescriptor(t,n);return Object.defineProperty(t,n,{set:function(e){var t=this;setTimeout(function(){r.set.call(t,e)},0),o&&o.set&&o.set.call(this,e)}}),function(){return e(t,n,o||{})}}(e[0],e[1],{set:function(){n({target:this})}})})),function(){o.forEach(function(e){return e()})}}function T(e){var t,n,r=(t=e.mutationCb,(n=new MutationObserver(function(e){var n=[],r=[],o=[],u=[],a=[],i=new Set,c=function(e){i.add(e),e.childNodes.forEach(function(e){return c(e)})};e.forEach(function(e){var t=e.type,u=e.target,d=e.oldValue,s=e.addedNodes,l=e.removedNodes,p=e.attributeName;switch(t){case"characterData":(f=u.textContent)!==d&&n.push({value:f,node:u});break;case"attributes":var f;if((f=u.getAttribute(p))===d)return;var m=r.find(function(e){return e.node===u});m||(m={node:u,attributes:{}},r.push(m)),m.attributes[p]=f;case"childList":s.forEach(function(e){return c(e)}),l.forEach(function(e){i.has(e)?(i.delete(e),a.push(e)):i.has(u)&&!h.getId(e)||o.push({parentId:h.getId(u),id:h.getId(e)}),h.removeNodeFromMap(e)})}}),o=o.map(function(e){return e.parentNode&&(e.parentId=h.getId(e.parentNode),delete e.parentNode),e}),Array.from(i).forEach(function(e){var t=h.getId(e.parentNode);!t||a.some(function(t){return t===e.parentNode})||o.some(function(e){return e.id===t})?a.push(e):u.push({parentId:h.getId(e.parentNode),previousId:e.previousSibling?h.getId(e.previousSibling):e.previousSibling,nextId:e.nextSibling?h.getId(e.nextSibling):e.nextSibling,node:d(e,document,h.map,!0)})}),t({texts:n.map(function(e){return{id:h.getId(e.node),value:e.value}}).filter(function(e){return h.has(e.id)}),attributes:r.map(function(e){return{id:h.getId(e.node),attributes:e.attributes}}).filter(function(e){return h.has(e.id)}),removes:o,adds:u})})).observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),n),o=function(e){var t,n=[],r=v(function(){var r=Date.now()-t;e(n.map(function(e){return e.timeOffset-=r,e})),n=[],t=null},500);return l("mousemove",v(function(e){var o=e.clientX,u=e.clientY,a=e.target;t||(t=Date.now()),n.push({x:o,y:u,id:h.getId(a),timeOffset:Date.now()-t}),r()},20,{trailing:!1}))}(e.mousemoveCb),u=E(e.mouseInteractionCb),a=function(e){return l("scroll",v(function(t){if(t.target){var n=h.getId(t.target);t.target===document?e({id:n,x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop}):e({id:n,x:t.target.scrollLeft,y:t.target.scrollTop})}},100))}(e.scrollCb),i=function(e){return l("resize",v(function(){var t=y(),n=g();e({width:Number(n),height:Number(t)})},200),window)}(e.viewportResizeCb),c=N(e.inputCb);return function(){r.disconnect(),o(),u(),a(),i(),c()}}function D(e){return t({},e,{timestamp:Date.now()})}return function(e){void 0===e&&(e={});var n=e.emit;if(!n)throw new Error("emit function is required");try{var r=[];r.push(l("DOMContentLoaded",function(){n(D({type:p.DomContentLoaded,data:{}}))}));var o=function(){n(D({type:p.Meta,data:{href:window.location.href,width:g(),height:y()}}));var e=s(document),o=e[0],u=e[1];if(!o)return console.warn("Failed to snapshot the document");h.map=u,n(D({type:p.FullSnapshot,data:{node:o,initialOffset:{left:document.documentElement.scrollLeft,top:document.documentElement.scrollTop}}})),r.push(T({mutationCb:function(e){return n(D({type:p.IncrementalSnapshot,data:t({source:f.Mutation},e)}))},mousemoveCb:function(e){return n(D({type:p.IncrementalSnapshot,data:{source:f.MouseMove,positions:e}}))},mouseInteractionCb:function(e){return n(D({type:p.IncrementalSnapshot,data:t({source:f.MouseInteraction},e)}))},scrollCb:function(e){return n(D({type:p.IncrementalSnapshot,data:t({source:f.Scroll},e)}))},viewportResizeCb:function(e){return n(D({type:p.IncrementalSnapshot,data:t({source:f.ViewportResize},e)}))},inputCb:function(e){return n(D({type:p.IncrementalSnapshot,data:t({source:f.Input},e)}))}}))};return"interactive"===document.readyState||"complete"===document.readyState?o():r.push(l("load",function(){n(D({type:p.Load,data:{}})),o()},window)),function(){r.forEach(function(e){return e()})}}catch(e){console.warn(e)}}}();
var rrwebRecord=function(){"use strict";var e,t=function(){return(t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};!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 n=1;var r=/url\((['"]|)([^'"]*)\1\)/gm,o=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/;function u(e,t){return e.replace(r,function(e,n,r){if(!o.test(r))return"url('"+r+"')";if("/"===r[0])return"url('"+(((u=t).indexOf("//")>-1?u.split("/").slice(0,3).join("/"):u.split("/")[0]).split("?")[0]+r)+"')";var u,a=t.split("/"),i=r.split("/");a.pop();for(var c=0,d=i;c<d.length;c++){var s=d[c];"."!==s&&(".."===s?a.pop():a.push(s))}return"url('"+a.join("/")+"')"})}function a(e,t){var n=e.createElement("a");return n.href=t,n.href}var i="rr-block";function c(t,n){switch(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:for(var r=t.classList.contains(i),o=t.tagName.toLowerCase(),c={},d=0,s=Array.from(t.attributes);d<s.length;d++){var l=s[d],p=l.name,f=l.value;c[p]="src"===p||"href"===p?a(n,f):f}if("link"===o){var m=Array.from(n.styleSheets).find(function(e){return e.href===t.href}),h=function(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).reduce(function(e,t){return e+t.cssText},""):null}catch(e){return null}}(m);h&&(c={_cssText:u(h,m.href)})}if("input"===o||"textarea"===o||"select"===o){f=t.value;"radio"!==c.type&&"checkbox"!==c.type&&f?c.value=f:t.checked&&(c.checked=t.checked)}if("option"===o){var v=t.parentElement;c.value===v.value&&(c.selected=t.selected)}if(r){var y=t.getBoundingClientRect(),g=y.width,E=y.height;c.rr_width=g+"px",c.rr_height=E+"px"}return{type:e.Element,tagName:o,attributes:c,childNodes:[],isSVG:(I=t,"svg"===I.tagName||I instanceof SVGElement||void 0),needBlock:r};case t.TEXT_NODE:var b=t.parentNode&&t.parentNode.tagName,w=t.textContent,C="STYLE"===b||void 0;return C&&w&&(w=u(w,location.href)),"SCRIPT"===b&&(w="SCRIPT_PLACEHOLDER"),{type:e.Text,textContent:w||"",isStyle:C};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 I}function d(t,r,o,u){void 0===u&&(u=!1);var a=c(t,r);if(!a)return console.warn(t,"not serialized"),null;var i=Object.assign(a,{id:n++});t.__sn=i,o[i.id]=t;var s=!u;if(i.type===e.Element&&(s=s&&!i.needBlock,delete i.needBlock),(i.type===e.Document||i.type===e.Element)&&s)for(var l=0,p=Array.from(t.childNodes);l<p.length;l++){var f=d(p[l],r,o);f&&i.childNodes.push(f)}return i}function s(e){n=1;var t={};return[d(e,e,t),t]}function l(e,t,n){void 0===n&&(n=document);var r={capture:!0,passive:!0};return n.addEventListener(e,t,r),function(){return n.removeEventListener(e,t,r)}}var p,f,m,h={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return h.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete h.map[t],e.childNodes&&e.childNodes.forEach(function(e){return h.removeNodeFromMap(e)})},has:function(e){return h.map.hasOwnProperty(e)}};function v(e,t,n){void 0===n&&(n={});var r=null,o=0;return function(){var u=Date.now();o||!1!==n.leading||(o=u);var a=t-(u-o),i=this,c=arguments;a<=0||a>t?(r&&(window.clearTimeout(r),r=null),o=u,e.apply(i,c)):r||!1===n.trailing||(r=window.setTimeout(function(){o=!1===n.leading?0:Date.now(),r=null,e.apply(i,c)},a))}}function y(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function g(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function E(e){var t=[];return Object.keys(m).filter(function(e){return Number.isNaN(Number(e))}).forEach(function(n){var r=n.toLowerCase(),o=function(t){return function(n){var r=h.getId(n.target),o=n.clientX,u=n.clientY;e({type:m[t],id:r,x:o,y:u})}}(n);t.push(l(r,o))}),function(){t.forEach(function(e){return e()})}}!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"}(p||(p={})),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"}(f||(f={})),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=8]="TouchMove",e[e.TouchEnd=9]="TouchEnd"}(m||(m={}));var b=["INPUT","TEXTAREA","SELECT"],w=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"]],C="rr-ignore",I=new WeakMap;function N(e){function n(e){var t=e.target;if(t&&t.tagName&&!(b.indexOf(t.tagName)<0)){var n=t.type;if("password"!==n&&!t.classList.contains(C)){var o=t.value,u=!1;"radio"!==n&&"checkbox"!==n||(u=t.checked),r(t,{text:o,isChecked:u});var a=t.name;"radio"===n&&a&&u&&document.querySelectorAll('input[type="radio"][name="'+a+'"]').forEach(function(e){e!==t&&r(e,{text:e.value,isChecked:!u})})}}}function r(n,r){var o=I.get(n);if(!o||o.text!==r.text||o.isChecked!==r.isChecked){I.set(n,r);var u=h.getId(n);e(t({},r,{id:u}))}}var o=["input","change"].map(function(e){return l(e,n)}),u=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");return u&&u.set&&o.push.apply(o,w.map(function(e){return function e(t,n,r){var o=Object.getOwnPropertyDescriptor(t,n);return Object.defineProperty(t,n,{set:function(e){var t=this;setTimeout(function(){r.set.call(t,e)},0),o&&o.set&&o.set.call(this,e)}}),function(){return e(t,n,o||{})}}(e[0],e[1],{set:function(){n({target:this})}})})),function(){o.forEach(function(e){return e()})}}function T(e){var t,n,r=(t=e.mutationCb,(n=new MutationObserver(function(e){var n=[],r=[],o=[],u=[],a=[],i=new Set,c=function(e){i.add(e),e.childNodes.forEach(function(e){return c(e)})};e.forEach(function(e){var t=e.type,u=e.target,d=e.oldValue,s=e.addedNodes,l=e.removedNodes,p=e.attributeName;switch(t){case"characterData":(f=u.textContent)!==d&&n.push({value:f,node:u});break;case"attributes":var f;if((f=u.getAttribute(p))===d)return;var m=r.find(function(e){return e.node===u});m||(m={node:u,attributes:{}},r.push(m)),m.attributes[p]=f;case"childList":s.forEach(function(e){return c(e)}),l.forEach(function(e){i.has(e)?(i.delete(e),a.push(e)):i.has(u)&&!h.getId(e)||o.push({parentId:h.getId(u),id:h.getId(e)}),h.removeNodeFromMap(e)})}}),o=o.map(function(e){return e.parentNode&&(e.parentId=h.getId(e.parentNode),delete e.parentNode),e});var s=function(e){var t=e.parentNode;return!!t&&(!!a.some(function(e){return e===t})||s(t))},l=function(e){var t=e.parentNode;if(!t)return!1;var n=h.getId(t);return!!o.some(function(e){return e.id===n})||l(t)};Array.from(i).forEach(function(e){s(e)||l(e)?a.push(e):u.push({parentId:h.getId(e.parentNode),previousId:e.previousSibling?h.getId(e.previousSibling):e.previousSibling,nextId:e.nextSibling?h.getId(e.nextSibling):e.nextSibling,node:d(e,document,h.map,!0)})}),t({texts:n.map(function(e){return{id:h.getId(e.node),value:e.value}}).filter(function(e){return h.has(e.id)}),attributes:r.map(function(e){return{id:h.getId(e.node),attributes:e.attributes}}).filter(function(e){return h.has(e.id)}),removes:o,adds:u})})).observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),n),o=function(e){var t,n=[],r=v(function(){var r=Date.now()-t;e(n.map(function(e){return e.timeOffset-=r,e})),n=[],t=null},500);return l("mousemove",v(function(e){var o=e.clientX,u=e.clientY,a=e.target;t||(t=Date.now()),n.push({x:o,y:u,id:h.getId(a),timeOffset:Date.now()-t}),r()},20,{trailing:!1}))}(e.mousemoveCb),u=E(e.mouseInteractionCb),a=function(e){return l("scroll",v(function(t){if(t.target){var n=h.getId(t.target);t.target===document?e({id:n,x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop}):e({id:n,x:t.target.scrollLeft,y:t.target.scrollTop})}},100))}(e.scrollCb),i=function(e){return l("resize",v(function(){var t=y(),n=g();e({width:Number(n),height:Number(t)})},200),window)}(e.viewportResizeCb),c=N(e.inputCb);return function(){r.disconnect(),o(),u(),a(),i(),c()}}function D(e){return t({},e,{timestamp:Date.now()})}return function(e){void 0===e&&(e={});var n=e.emit;if(!n)throw new Error("emit function is required");try{var r=[];r.push(l("DOMContentLoaded",function(){n(D({type:p.DomContentLoaded,data:{}}))}));var o=function(){n(D({type:p.Meta,data:{href:window.location.href,width:g(),height:y()}}));var e=s(document),o=e[0],u=e[1];if(!o)return console.warn("Failed to snapshot the document");h.map=u,n(D({type:p.FullSnapshot,data:{node:o,initialOffset:{left:document.documentElement.scrollLeft,top:document.documentElement.scrollTop}}})),r.push(T({mutationCb:function(e){return n(D({type:p.IncrementalSnapshot,data:t({source:f.Mutation},e)}))},mousemoveCb:function(e){return n(D({type:p.IncrementalSnapshot,data:{source:f.MouseMove,positions:e}}))},mouseInteractionCb:function(e){return n(D({type:p.IncrementalSnapshot,data:t({source:f.MouseInteraction},e)}))},scrollCb:function(e){return n(D({type:p.IncrementalSnapshot,data:t({source:f.Scroll},e)}))},viewportResizeCb:function(e){return n(D({type:p.IncrementalSnapshot,data:t({source:f.ViewportResize},e)}))},inputCb:function(e){return n(D({type:p.IncrementalSnapshot,data:t({source:f.Input},e)}))}}))};return"interactive"===document.readyState||"complete"===document.readyState?o():r.push(l("load",function(){n(D({type:p.Load,data:{}})),o()},window)),function(){r.forEach(function(e){return e()})}}catch(e){console.warn(e)}}}();
//# sourceMappingURL=rrweb-record.min.js.map

@@ -543,7 +543,25 @@ var rrweb = (function (exports) {

});
var isDropped = function (n) {
var parentNode = n.parentNode;
if (!parentNode) {
return false;
}
if (dropped.some(function (d) { return d === parentNode; })) {
return true;
}
return isDropped(parentNode);
};
var isRemoved = function (n) {
var parentNode = n.parentNode;
if (!parentNode) {
return false;
}
var parentId = mirror.getId(parentNode);
if (removes.some(function (r) { return r.id === parentId; })) {
return true;
}
return isRemoved(parentNode);
};
Array.from(addsSet).forEach(function (n) {
var parentId = mirror.getId(n.parentNode);
if (parentId &&
!dropped.some(function (d) { return d === n.parentNode; }) &&
!removes.some(function (r) { return r.id === parentId; })) {
if (!isDropped(n) && !isRemoved(n)) {
adds.push({

@@ -1019,2 +1037,3 @@ parentId: mirror.getId(n.parentNode),

this.baselineTime = 0;
this.missingNodeRetryMap = {};
if (events.length < 2) {

@@ -1148,2 +1167,5 @@ throw new Error('Replayer need at least 2 events.');

_this.lastPlayedEvent = event;
if (event === _this.events[_this.events.length - 1]) {
_this.emitter.emit('finish');
}
};

@@ -1153,2 +1175,6 @@ return wrappedCastFn;

Replayer.prototype.rebuildFullSnapshot = function (event) {
if (Object.keys(this.missingNodeRetryMap).length) {
console.warn('Found unresolved missing node map', this.missingNodeRetryMap);
}
this.missingNodeRetryMap = {};
mirror.map = rebuild(event.data.node, this.iframe.contentDocument)[1];

@@ -1212,3 +1238,3 @@ var styleEl = document.createElement('style');

});
var missingNodeMap_1 = {};
var missingNodeMap_1 = __assign({}, this.missingNodeRetryMap);
d.adds.forEach(function (mutation) {

@@ -1248,3 +1274,3 @@ var target = buildNodeWithSN(mutation.node, _this.iframe.contentDocument, mirror.map, true);

if (Object.keys(missingNodeMap_1).length) {
console.warn('Found unresolved missing node map', missingNodeMap_1);
Object.assign(this.missingNodeRetryMap, missingNodeMap_1);
}

@@ -1329,4 +1355,8 @@ d.texts.forEach(function (mutation) {

else {
target.scrollTop = d.y;
target.scrollLeft = d.x;
try {
target.scrollTop = d.y;
target.scrollLeft = d.x;
}
catch (error) {
}
}

@@ -1357,11 +1387,16 @@ break;

var nextInMap = nextId && map[nextId];
if (previousInMap || nextInMap) {
var _a = (previousInMap || nextInMap), node = _a.node, mutation = _a.mutation;
if (previousInMap) {
parent.insertBefore(node, target);
if (previousInMap) {
var _a = previousInMap, node = _a.node, mutation = _a.mutation;
parent.insertBefore(node, target);
delete map[mutation.node.id];
delete this.missingNodeRetryMap[mutation.node.id];
if (mutation.previousId || mutation.nextId) {
this.resolveMissingNode(map, parent, node, mutation);
}
else {
parent.insertBefore(node, target.nextSibling);
}
}
if (nextInMap) {
var _b = nextInMap, node = _b.node, mutation = _b.mutation;
parent.insertBefore(node, target.nextSibling);
delete map[mutation.node.id];
delete this.missingNodeRetryMap[mutation.node.id];
if (mutation.previousId || mutation.nextId) {

@@ -1368,0 +1403,0 @@ this.resolveMissingNode(map, parent, node, mutation);

@@ -1,2 +0,2 @@

var rrweb=function(e){"use strict";var t,n=function(){return(n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(t||(t={}));var r=1;var i=/url\((['"]|)([^'"]*)\1\)/gm,o=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/;function a(e,t){return e.replace(i,function(e,n,r){if(!o.test(r))return"url('"+r+"')";if("/"===r[0])return"url('"+(((i=t).indexOf("//")>-1?i.split("/").slice(0,3).join("/"):i.split("/")[0]).split("?")[0]+r)+"')";var i,a=t.split("/"),s=r.split("/");a.pop();for(var c=0,u=s;c<u.length;c++){var d=u[c];"."!==d&&(".."===d?a.pop():a.push(d))}return"url('"+a.join("/")+"')"})}function s(e,t){var n=e.createElement("a");return n.href=t,n.href}var c="rr-block";function u(e,n){switch(e.nodeType){case e.DOCUMENT_NODE:return{type:t.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:t.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId};case e.ELEMENT_NODE:for(var r=e.classList.contains(c),i=e.tagName.toLowerCase(),o={},u=0,d=Array.from(e.attributes);u<d.length;u++){var l=d[u],p=l.name,h=l.value;o[p]="src"===p||"href"===p?s(n,h):h}if("link"===i){var m=Array.from(n.styleSheets).find(function(t){return t.href===e.href}),f=function(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).reduce(function(e,t){return e+t.cssText},""):null}catch(e){return null}}(m);f&&(o={_cssText:a(f,m.href)})}if("input"===i||"textarea"===i||"select"===i){h=e.value;"radio"!==o.type&&"checkbox"!==o.type&&h?o.value=h:e.checked&&(o.checked=e.checked)}if("option"===i){var v=e.parentElement;o.value===v.value&&(o.selected=e.selected)}if(r){var y=e.getBoundingClientRect(),g=y.width,b=y.height;o.rr_width=g+"px",o.rr_height=b+"px"}return{type:t.Element,tagName:i,attributes:o,childNodes:[],isSVG:(I=e,"svg"===I.tagName||I instanceof SVGElement||void 0),needBlock:r};case e.TEXT_NODE:var w=e.parentNode&&e.parentNode.tagName,E=e.textContent,C="STYLE"===w||void 0;return C&&E&&(E=a(E,location.href)),"SCRIPT"===w&&(E="SCRIPT_PLACEHOLDER"),{type:t.Text,textContent:E||"",isStyle:C};case e.CDATA_SECTION_NODE:return{type:t.CDATA,textContent:""};case e.COMMENT_NODE:return{type:t.Comment,textContent:e.textContent||""};default:return!1}var I}function d(e,n,i,o){void 0===o&&(o=!1);var a=u(e,n);if(!a)return console.warn(e,"not serialized"),null;var s=Object.assign(a,{id:r++});e.__sn=s,i[s.id]=e;var c=!o;if(s.type===t.Element&&(c=c&&!s.needBlock,delete s.needBlock),(s.type===t.Document||s.type===t.Element)&&c)for(var l=0,p=Array.from(e.childNodes);l<p.length;l++){var h=d(p[l],n,i);h&&s.childNodes.push(h)}return s}function l(e){r=1;var t={};return[d(e,e,t),t]}var p={script:"noscript"};var h=/([^\r\n,{}]+)(,(?=[^}]*{)|\s*{)/g,m=/([^\\]):hover/g;function f(e){return e.replace(h,function(e,t,n){if(m.test(t)){var r=t.replace(m,"$1.\\:hover");return t.replace(/\s*$/,"")+", "+r.replace(/^\s*/,"")+n}return e})}function v(e,n){switch(e.type){case t.Document:return n.implementation.createDocument(null,"",null);case t.DocumentType:return n.implementation.createDocumentType(e.name,e.publicId,e.systemId);case t.Element:var r=function(e){var t=p[e.tagName]?p[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(e),i=void 0;for(var o in i=e.isSVG?n.createElementNS("http://www.w3.org/2000/svg",r):n.createElement(r),e.attributes)if(e.attributes.hasOwnProperty(o)&&!o.startsWith("rr_")){var a=e.attributes[o];a="boolean"==typeof a?"":a;var s="textarea"===r&&"value"===o,c="style"===r&&"_cssText"===o;if(c&&(a=f(a)),s||c){var u=n.createTextNode(a);i.appendChild(u);continue}if("iframe"===r&&"src"===o)continue;try{i.setAttribute(o,a)}catch(e){}}else e.attributes.rr_width&&(i.style.width=e.attributes.rr_width),e.attributes.rr_height&&(i.style.height=e.attributes.rr_height);return i;case t.Text:return n.createTextNode(e.isStyle?f(e.textContent):e.textContent);case t.CDATA:return n.createCDATASection(e.textContent);case t.Comment:return n.createComment(e.textContent);default:return null}}function y(e,n,r,i){void 0===i&&(i=!1);var o=v(e,n);if(!o)return null;if(e.type===t.Document&&(n.open(),o=n),o.__sn=e,r[e.id]=o,(e.type===t.Document||e.type===t.Element)&&!i)for(var a=0,s=e.childNodes;a<s.length;a++){var c=s[a],u=y(c,n,r);u?o.appendChild(u):console.warn("Failed to rebuild",c)}return o}function g(e,t,n){void 0===n&&(n=document);var r={capture:!0,passive:!0};return n.addEventListener(e,t,r),function(){return n.removeEventListener(e,t,r)}}var b,w,E,C={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return C.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete C.map[t],e.childNodes&&e.childNodes.forEach(function(e){return C.removeNodeFromMap(e)})},has:function(e){return C.map.hasOwnProperty(e)}};function I(e,t,n){void 0===n&&(n={});var r=null,i=0;return function(){var o=Date.now();i||!1!==n.leading||(i=o);var a=t-(o-i),s=this,c=arguments;a<=0||a>t?(r&&(window.clearTimeout(r),r=null),i=o,e.apply(s,c)):r||!1===n.trailing||(r=window.setTimeout(function(){i=!1===n.leading?0:Date.now(),r=null,e.apply(s,c)},a))}}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 x(e){var t=[];return Object.keys(E).filter(function(e){return Number.isNaN(Number(e))}).forEach(function(n){var r=n.toLowerCase(),i=function(t){return function(n){var r=C.getId(n.target),i=n.clientX,o=n.clientY;e({type:E[t],id:r,x:i,y:o})}}(n);t.push(g(r,i))}),function(){t.forEach(function(e){return e()})}}!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"}(b||(b={})),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"}(w||(w={})),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=8]="TouchMove",e[e.TouchEnd=9]="TouchEnd"}(E||(E={}));var D=["INPUT","TEXTAREA","SELECT"],S=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"]],M="rr-ignore",k=new WeakMap;function A(e){function t(e){var t=e.target;if(t&&t.tagName&&!(D.indexOf(t.tagName)<0)){var n=t.type;if("password"!==n&&!t.classList.contains(M)){var i=t.value,o=!1;"radio"!==n&&"checkbox"!==n||(o=t.checked),r(t,{text:i,isChecked:o});var a=t.name;"radio"===n&&a&&o&&document.querySelectorAll('input[type="radio"][name="'+a+'"]').forEach(function(e){e!==t&&r(e,{text:e.value,isChecked:!o})})}}}function r(t,r){var i=k.get(t);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){k.set(t,r);var o=C.getId(t);e(n({},r,{id:o}))}}var i=["input","change"].map(function(e){return g(e,t)}),o=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");return o&&o.set&&i.push.apply(i,S.map(function(e){return function e(t,n,r){var i=Object.getOwnPropertyDescriptor(t,n);return Object.defineProperty(t,n,{set:function(e){var t=this;setTimeout(function(){r.set.call(t,e)},0),i&&i.set&&i.set.call(this,e)}}),function(){return e(t,n,i||{})}}(e[0],e[1],{set:function(){t({target:this})}})})),function(){i.forEach(function(e){return e()})}}function L(e){var t,n,r=(t=e.mutationCb,(n=new MutationObserver(function(e){var n=[],r=[],i=[],o=[],a=[],s=new Set,c=function(e){s.add(e),e.childNodes.forEach(function(e){return c(e)})};e.forEach(function(e){var t=e.type,o=e.target,u=e.oldValue,d=e.addedNodes,l=e.removedNodes,p=e.attributeName;switch(t){case"characterData":(h=o.textContent)!==u&&n.push({value:h,node:o});break;case"attributes":var h;if((h=o.getAttribute(p))===u)return;var m=r.find(function(e){return e.node===o});m||(m={node:o,attributes:{}},r.push(m)),m.attributes[p]=h;case"childList":d.forEach(function(e){return c(e)}),l.forEach(function(e){s.has(e)?(s.delete(e),a.push(e)):s.has(o)&&!C.getId(e)||i.push({parentId:C.getId(o),id:C.getId(e)}),C.removeNodeFromMap(e)})}}),i=i.map(function(e){return e.parentNode&&(e.parentId=C.getId(e.parentNode),delete e.parentNode),e}),Array.from(s).forEach(function(e){var t=C.getId(e.parentNode);!t||a.some(function(t){return t===e.parentNode})||i.some(function(e){return e.id===t})?a.push(e):o.push({parentId:C.getId(e.parentNode),previousId:e.previousSibling?C.getId(e.previousSibling):e.previousSibling,nextId:e.nextSibling?C.getId(e.nextSibling):e.nextSibling,node:d(e,document,C.map,!0)})}),t({texts:n.map(function(e){return{id:C.getId(e.node),value:e.value}}).filter(function(e){return C.has(e.id)}),attributes:r.map(function(e){return{id:C.getId(e.node),attributes:e.attributes}}).filter(function(e){return C.has(e.id)}),removes:i,adds:o})})).observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),n),i=function(e){var t,n=[],r=I(function(){var r=Date.now()-t;e(n.map(function(e){return e.timeOffset-=r,e})),n=[],t=null},500);return g("mousemove",I(function(e){var i=e.clientX,o=e.clientY,a=e.target;t||(t=Date.now()),n.push({x:i,y:o,id:C.getId(a),timeOffset:Date.now()-t}),r()},20,{trailing:!1}))}(e.mousemoveCb),o=x(e.mouseInteractionCb),a=function(e){return g("scroll",I(function(t){if(t.target){var n=C.getId(t.target);t.target===document?e({id:n,x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop}):e({id:n,x:t.target.scrollLeft,y:t.target.scrollTop})}},100))}(e.scrollCb),s=function(e){return g("resize",I(function(){var t=N(),n=T();e({width:Number(n),height:Number(t)})},200),window)}(e.viewportResizeCb),c=A(e.inputCb);return function(){r.disconnect(),i(),o(),a(),s(),c()}}function O(e){return n({},e,{timestamp:Date.now()})}function _(e){return e=e||Object.create(null),{on:function(t,n){(e[t]||(e[t]=[])).push(n)},off:function(t,n){e[t]&&e[t].splice(e[t].indexOf(n)>>>0,1)},emit:function(t,n){(e[t]||[]).slice().map(function(e){e(n)}),(e["*"]||[]).slice().map(function(e){e(t,n)})}}}var F=Object.freeze({default:_}),z=function(){function e(e,t){void 0===t&&(t=[]),this.actions=t,this.config=e}return e.prototype.addAction=function(e){var t=this.findActionIndex(e);this.actions.splice(t,0,e)},e.prototype.addActions=function(e){var t;(t=this.actions).push.apply(t,e)},e.prototype.start=function(){this.actions.sort(function(e,t){return e.delay-t.delay});var e=0,t=performance.now(),n=this.actions,r=this.config,i=this;this.raf=requestAnimationFrame(function o(a){for(e=a-t;n.length;){var s=n[0],c=s.delay/r.speed;if(!(e>=c))break;n.shift(),s.doAction()}n.length>0&&(i.raf=requestAnimationFrame(o))})},e.prototype.clear=function(){this.raf&&cancelAnimationFrame(this.raf),this.actions.length=0},e.prototype.findActionIndex=function(e){for(var t=0,n=this.actions.length-1;t<=n;){var r=Math.floor((t+n)/2);if(this.actions[r].delay<e.delay)t=r+1;else{if(!(this.actions[r].delay>e.delay))return r;n=r-1}}return t},e}(),R=["iframe, .rr-block { background: #ccc }","noscript { display: none !important; }"],j=_||F,P={speed:1,root:document.body,loadTimeout:0},B=function(){function e(e,t){if(this.events=[],this.config=P,this.emitter=j(),this.baselineTime=0,e.length<2)throw new Error("Replayer need at least 2 events.");this.events=e,this.handleResize=this.handleResize.bind(this),this.timer=new z(this.config),this.setConfig(Object.assign({},t)),this.setupDom(),this.emitter.on("resize",this.handleResize)}return 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]})},e.prototype.getMetaData=function(){var e=this.events[0];return{totalTime:this.events[this.events.length-1].timestamp-e.timestamp}},e.prototype.play=function(e){void 0===e&&(e=0),this.timer.clear(),this.baselineTime=this.events[0].timestamp+e;for(var t=new Array,n=0,r=this.events;n<r.length;n++){var i=r[n],o=i.timestamp<this.baselineTime,a=this.getCastFn(i,o);o?a():t.push({doAction:a,delay:this.getDelay(i)})}this.timer.addActions(t),this.timer.start()},e.prototype.pause=function(){this.timer.clear(),this.emitter.emit("pause")},e.prototype.resume=function(e){void 0===e&&(e=0),this.timer.clear(),this.baselineTime=this.events[0].timestamp+e;for(var t=new Array,n=0,r=this.events;n<r.length;n++){var i=r[n];if(!(i.timestamp<=this.lastPlayedEvent.timestamp||i===this.lastPlayedEvent)){var o=this.getCastFn(i);t.push({doAction:o,delay:this.getDelay(i)})}}this.timer.addActions(t),this.timer.start(),this.emitter.emit("resume")},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),this.iframe=document.createElement("iframe"),this.iframe.setAttribute("sandbox","allow-same-origin"),this.wrapper.appendChild(this.iframe)},e.prototype.handleResize=function(e){this.iframe.width=e.width+"px",this.iframe.height=e.height+"px"},e.prototype.getDelay=function(e){if(e.type===b.IncrementalSnapshot&&e.data.source===w.MouseMove){var t=e.data.positions[0].timeOffset;return e.timestamp+t-this.baselineTime}return e.timestamp-this.baselineTime},e.prototype.getCastFn=function(e,t){var n,r=this;switch(void 0===t&&(t=!1),e.type){case b.DomContentLoaded:case b.Load:break;case b.Meta:n=function(){return r.emitter.emit("resize",{width:e.data.width,height:e.data.height})};break;case b.FullSnapshot:n=function(){r.rebuildFullSnapshot(e),r.iframe.contentWindow.scrollTo(e.data.initialOffset)};break;case b.IncrementalSnapshot:n=function(){r.applyIncremental(e,t)}}return function(){n&&n(),r.lastPlayedEvent=e}},e.prototype.rebuildFullSnapshot=function(e){var t,n,r;C.map=(t=e.data.node,n=this.iframe.contentDocument,r={},[y(t,n,r),r])[1];var i=document.createElement("style"),o=this.iframe.contentDocument,a=o.documentElement,s=o.head;a.insertBefore(i,s);for(var c=0;c<R.length;c++)i.sheet.insertRule(R[c],c);this.waitForStylesheetLoad()},e.prototype.waitForStylesheetLoad=function(){var e=this,t=this.iframe.contentDocument.head;if(t){var n,r=new Set;t.querySelectorAll('link[rel="stylesheet"]').forEach(function(t){t.sheet||(0===r.size&&(e.pause(),e.emitter.emit("wait-stylesheet"),n=window.setTimeout(function(){e.resume(),n=-1},e.config.loadTimeout)),r.add(t),t.addEventListener("load",function(){r.delete(t),0===r.size&&-1!==n&&(e.resume(),e.emitter.emit("stylesheet-loaded"),n&&window.clearTimeout(n))}))})}},e.prototype.applyIncremental=function(e,t){var n=this,r=e.data;switch(r.source){case w.Mutation:r.removes.forEach(function(e){var t=C.getNode(e.id);if(t){var n=C.getNode(e.parentId);C.removeNodeFromMap(t),n&&n.removeChild(t)}});var i={};r.adds.forEach(function(e){var t=y(e.node,n.iframe.contentDocument,C.map,!0),r=C.getNode(e.parentId),o=null,a=null;e.previousId&&(o=C.getNode(e.previousId)),e.nextId&&(a=C.getNode(e.nextId)),-1!==e.previousId&&-1!==e.nextId?(o&&o.nextSibling&&o.nextSibling.parentNode?r.insertBefore(t,o.nextSibling):a&&a.parentNode?r.insertBefore(t,a):r.appendChild(t),(e.previousId||e.nextId)&&n.resolveMissingNode(i,r,t,e)):i[e.node.id]={node:t,mutation:e}}),Object.keys(i).length&&console.warn("Found unresolved missing node map",i),r.texts.forEach(function(e){C.getNode(e.id).textContent=e.value}),r.attributes.forEach(function(e){var t=C.getNode(e.id);for(var n in e.attributes)if("string"==typeof n){var r=e.attributes[n];r?t.setAttribute(n,r):t.removeAttribute(n)}});break;case w.MouseMove:t||r.positions.forEach(function(t){var r={doAction:function(){n.mouse.style.left=t.x+"px",n.mouse.style.top=t.y+"px";var e=C.getNode(t.id);e&&n.hoverElements(e)},delay:t.timeOffset+e.timestamp-n.baselineTime};n.timer.addAction(r)});break;case w.MouseInteraction:if(-1===r.id)break;var o=new Event(E[r.type].toLowerCase()),a=C.getNode(r.id);switch(r.type){case E.Blur:a.blur();break;case E.Focus:a.focus({preventScroll:!0});break;case E.Click:t||(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active"));break;default:a.dispatchEvent(o)}break;case w.Scroll:if(-1===r.id)break;(a=C.getNode(r.id))===this.iframe.contentDocument?this.iframe.contentWindow.scrollTo({top:r.y,left:r.x,behavior:t?"instant":"smooth"}):(a.scrollTop=r.y,a.scrollLeft=r.x);break;case w.ViewportResize:this.emitter.emit("resize",{width:r.width,height:r.height});break;case w.Input:if(-1===r.id)break;(a=C.getNode(r.id)).checked=r.isChecked,a.value=r.text}},e.prototype.resolveMissingNode=function(e,t,n,r){var i=r.previousId,o=r.nextId,a=i&&e[i],s=o&&e[o];if(a||s){var c=a||s,u=c.node,d=c.mutation;a?t.insertBefore(u,n):t.insertBefore(u,n.nextSibling),delete e[d.node.id],(d.previousId||d.nextId)&&this.resolveMissingNode(e,t,u,d)}},e.prototype.hoverElements=function(e){this.iframe.contentDocument.querySelectorAll(".\\:hover").forEach(function(e){e.classList.remove(":hover")});for(var t=e;t;)t.classList.add(":hover"),t=t.parentElement},e}();return e.record=function(e){void 0===e&&(e={});var t=e.emit;if(!t)throw new Error("emit function is required");try{var r=[];r.push(g("DOMContentLoaded",function(){t(O({type:b.DomContentLoaded,data:{}}))}));var i=function(){t(O({type:b.Meta,data:{href:window.location.href,width:T(),height:N()}}));var e=l(document),i=e[0],o=e[1];if(!i)return console.warn("Failed to snapshot the document");C.map=o,t(O({type:b.FullSnapshot,data:{node:i,initialOffset:{left:document.documentElement.scrollLeft,top:document.documentElement.scrollTop}}})),r.push(L({mutationCb:function(e){return t(O({type:b.IncrementalSnapshot,data:n({source:w.Mutation},e)}))},mousemoveCb:function(e){return t(O({type:b.IncrementalSnapshot,data:{source:w.MouseMove,positions:e}}))},mouseInteractionCb:function(e){return t(O({type:b.IncrementalSnapshot,data:n({source:w.MouseInteraction},e)}))},scrollCb:function(e){return t(O({type:b.IncrementalSnapshot,data:n({source:w.Scroll},e)}))},viewportResizeCb:function(e){return t(O({type:b.IncrementalSnapshot,data:n({source:w.ViewportResize},e)}))},inputCb:function(e){return t(O({type:b.IncrementalSnapshot,data:n({source:w.Input},e)}))}}))};return"interactive"===document.readyState||"complete"===document.readyState?i():r.push(g("load",function(){t(O({type:b.Load,data:{}})),i()},window)),function(){r.forEach(function(e){return e()})}}catch(e){console.warn(e)}},e.Replayer=B,e.mirror=C,e}({});
var rrweb=function(e){"use strict";var t,n=function(){return(n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(t||(t={}));var r=1;var i=/url\((['"]|)([^'"]*)\1\)/gm,o=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/;function a(e,t){return e.replace(i,function(e,n,r){if(!o.test(r))return"url('"+r+"')";if("/"===r[0])return"url('"+(((i=t).indexOf("//")>-1?i.split("/").slice(0,3).join("/"):i.split("/")[0]).split("?")[0]+r)+"')";var i,a=t.split("/"),s=r.split("/");a.pop();for(var u=0,c=s;u<c.length;u++){var d=c[u];"."!==d&&(".."===d?a.pop():a.push(d))}return"url('"+a.join("/")+"')"})}function s(e,t){var n=e.createElement("a");return n.href=t,n.href}var u="rr-block";function c(e,n){switch(e.nodeType){case e.DOCUMENT_NODE:return{type:t.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:t.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId};case e.ELEMENT_NODE:for(var r=e.classList.contains(u),i=e.tagName.toLowerCase(),o={},c=0,d=Array.from(e.attributes);c<d.length;c++){var l=d[c],p=l.name,h=l.value;o[p]="src"===p||"href"===p?s(n,h):h}if("link"===i){var m=Array.from(n.styleSheets).find(function(t){return t.href===e.href}),f=function(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).reduce(function(e,t){return e+t.cssText},""):null}catch(e){return null}}(m);f&&(o={_cssText:a(f,m.href)})}if("input"===i||"textarea"===i||"select"===i){h=e.value;"radio"!==o.type&&"checkbox"!==o.type&&h?o.value=h:e.checked&&(o.checked=e.checked)}if("option"===i){var v=e.parentElement;o.value===v.value&&(o.selected=e.selected)}if(r){var y=e.getBoundingClientRect(),g=y.width,b=y.height;o.rr_width=g+"px",o.rr_height=b+"px"}return{type:t.Element,tagName:i,attributes:o,childNodes:[],isSVG:(C=e,"svg"===C.tagName||C instanceof SVGElement||void 0),needBlock:r};case e.TEXT_NODE:var w=e.parentNode&&e.parentNode.tagName,E=e.textContent,N="STYLE"===w||void 0;return N&&E&&(E=a(E,location.href)),"SCRIPT"===w&&(E="SCRIPT_PLACEHOLDER"),{type:t.Text,textContent:E||"",isStyle:N};case e.CDATA_SECTION_NODE:return{type:t.CDATA,textContent:""};case e.COMMENT_NODE:return{type:t.Comment,textContent:e.textContent||""};default:return!1}var C}function d(e,n,i,o){void 0===o&&(o=!1);var a=c(e,n);if(!a)return console.warn(e,"not serialized"),null;var s=Object.assign(a,{id:r++});e.__sn=s,i[s.id]=e;var u=!o;if(s.type===t.Element&&(u=u&&!s.needBlock,delete s.needBlock),(s.type===t.Document||s.type===t.Element)&&u)for(var l=0,p=Array.from(e.childNodes);l<p.length;l++){var h=d(p[l],n,i);h&&s.childNodes.push(h)}return s}function l(e){r=1;var t={};return[d(e,e,t),t]}var p={script:"noscript"};var h=/([^\r\n,{}]+)(,(?=[^}]*{)|\s*{)/g,m=/([^\\]):hover/g;function f(e){return e.replace(h,function(e,t,n){if(m.test(t)){var r=t.replace(m,"$1.\\:hover");return t.replace(/\s*$/,"")+", "+r.replace(/^\s*/,"")+n}return e})}function v(e,n){switch(e.type){case t.Document:return n.implementation.createDocument(null,"",null);case t.DocumentType:return n.implementation.createDocumentType(e.name,e.publicId,e.systemId);case t.Element:var r=function(e){var t=p[e.tagName]?p[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(e),i=void 0;for(var o in i=e.isSVG?n.createElementNS("http://www.w3.org/2000/svg",r):n.createElement(r),e.attributes)if(e.attributes.hasOwnProperty(o)&&!o.startsWith("rr_")){var a=e.attributes[o];a="boolean"==typeof a?"":a;var s="textarea"===r&&"value"===o,u="style"===r&&"_cssText"===o;if(u&&(a=f(a)),s||u){var c=n.createTextNode(a);i.appendChild(c);continue}if("iframe"===r&&"src"===o)continue;try{i.setAttribute(o,a)}catch(e){}}else e.attributes.rr_width&&(i.style.width=e.attributes.rr_width),e.attributes.rr_height&&(i.style.height=e.attributes.rr_height);return i;case t.Text:return n.createTextNode(e.isStyle?f(e.textContent):e.textContent);case t.CDATA:return n.createCDATASection(e.textContent);case t.Comment:return n.createComment(e.textContent);default:return null}}function y(e,n,r,i){void 0===i&&(i=!1);var o=v(e,n);if(!o)return null;if(e.type===t.Document&&(n.open(),o=n),o.__sn=e,r[e.id]=o,(e.type===t.Document||e.type===t.Element)&&!i)for(var a=0,s=e.childNodes;a<s.length;a++){var u=s[a],c=y(u,n,r);c?o.appendChild(c):console.warn("Failed to rebuild",u)}return o}function g(e,t,n){void 0===n&&(n=document);var r={capture:!0,passive:!0};return n.addEventListener(e,t,r),function(){return n.removeEventListener(e,t,r)}}var b,w,E,N={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return N.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete N.map[t],e.childNodes&&e.childNodes.forEach(function(e){return N.removeNodeFromMap(e)})},has:function(e){return N.map.hasOwnProperty(e)}};function C(e,t,n){void 0===n&&(n={});var r=null,i=0;return function(){var o=Date.now();i||!1!==n.leading||(i=o);var a=t-(o-i),s=this,u=arguments;a<=0||a>t?(r&&(window.clearTimeout(r),r=null),i=o,e.apply(s,u)):r||!1===n.trailing||(r=window.setTimeout(function(){i=!1===n.leading?0:Date.now(),r=null,e.apply(s,u)},a))}}function I(){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 x(e){var t=[];return Object.keys(E).filter(function(e){return Number.isNaN(Number(e))}).forEach(function(n){var r=n.toLowerCase(),i=function(t){return function(n){var r=N.getId(n.target),i=n.clientX,o=n.clientY;e({type:E[t],id:r,x:i,y:o})}}(n);t.push(g(r,i))}),function(){t.forEach(function(e){return e()})}}!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"}(b||(b={})),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"}(w||(w={})),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=8]="TouchMove",e[e.TouchEnd=9]="TouchEnd"}(E||(E={}));var M=["INPUT","TEXTAREA","SELECT"],D=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"]],S="rr-ignore",k=new WeakMap;function A(e){function t(e){var t=e.target;if(t&&t.tagName&&!(M.indexOf(t.tagName)<0)){var n=t.type;if("password"!==n&&!t.classList.contains(S)){var i=t.value,o=!1;"radio"!==n&&"checkbox"!==n||(o=t.checked),r(t,{text:i,isChecked:o});var a=t.name;"radio"===n&&a&&o&&document.querySelectorAll('input[type="radio"][name="'+a+'"]').forEach(function(e){e!==t&&r(e,{text:e.value,isChecked:!o})})}}}function r(t,r){var i=k.get(t);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){k.set(t,r);var o=N.getId(t);e(n({},r,{id:o}))}}var i=["input","change"].map(function(e){return g(e,t)}),o=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");return o&&o.set&&i.push.apply(i,D.map(function(e){return function e(t,n,r){var i=Object.getOwnPropertyDescriptor(t,n);return Object.defineProperty(t,n,{set:function(e){var t=this;setTimeout(function(){r.set.call(t,e)},0),i&&i.set&&i.set.call(this,e)}}),function(){return e(t,n,i||{})}}(e[0],e[1],{set:function(){t({target:this})}})})),function(){i.forEach(function(e){return e()})}}function O(e){var t,n,r=(t=e.mutationCb,(n=new MutationObserver(function(e){var n=[],r=[],i=[],o=[],a=[],s=new Set,u=function(e){s.add(e),e.childNodes.forEach(function(e){return u(e)})};e.forEach(function(e){var t=e.type,o=e.target,c=e.oldValue,d=e.addedNodes,l=e.removedNodes,p=e.attributeName;switch(t){case"characterData":(h=o.textContent)!==c&&n.push({value:h,node:o});break;case"attributes":var h;if((h=o.getAttribute(p))===c)return;var m=r.find(function(e){return e.node===o});m||(m={node:o,attributes:{}},r.push(m)),m.attributes[p]=h;case"childList":d.forEach(function(e){return u(e)}),l.forEach(function(e){s.has(e)?(s.delete(e),a.push(e)):s.has(o)&&!N.getId(e)||i.push({parentId:N.getId(o),id:N.getId(e)}),N.removeNodeFromMap(e)})}}),i=i.map(function(e){return e.parentNode&&(e.parentId=N.getId(e.parentNode),delete e.parentNode),e});var c=function(e){var t=e.parentNode;return!!t&&(!!a.some(function(e){return e===t})||c(t))},l=function(e){var t=e.parentNode;if(!t)return!1;var n=N.getId(t);return!!i.some(function(e){return e.id===n})||l(t)};Array.from(s).forEach(function(e){c(e)||l(e)?a.push(e):o.push({parentId:N.getId(e.parentNode),previousId:e.previousSibling?N.getId(e.previousSibling):e.previousSibling,nextId:e.nextSibling?N.getId(e.nextSibling):e.nextSibling,node:d(e,document,N.map,!0)})}),t({texts:n.map(function(e){return{id:N.getId(e.node),value:e.value}}).filter(function(e){return N.has(e.id)}),attributes:r.map(function(e){return{id:N.getId(e.node),attributes:e.attributes}}).filter(function(e){return N.has(e.id)}),removes:i,adds:o})})).observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),n),i=function(e){var t,n=[],r=C(function(){var r=Date.now()-t;e(n.map(function(e){return e.timeOffset-=r,e})),n=[],t=null},500);return g("mousemove",C(function(e){var i=e.clientX,o=e.clientY,a=e.target;t||(t=Date.now()),n.push({x:i,y:o,id:N.getId(a),timeOffset:Date.now()-t}),r()},20,{trailing:!1}))}(e.mousemoveCb),o=x(e.mouseInteractionCb),a=function(e){return g("scroll",C(function(t){if(t.target){var n=N.getId(t.target);t.target===document?e({id:n,x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop}):e({id:n,x:t.target.scrollLeft,y:t.target.scrollTop})}},100))}(e.scrollCb),s=function(e){return g("resize",C(function(){var t=I(),n=T();e({width:Number(n),height:Number(t)})},200),window)}(e.viewportResizeCb),u=A(e.inputCb);return function(){r.disconnect(),i(),o(),a(),s(),u()}}function L(e){return n({},e,{timestamp:Date.now()})}function _(e){return e=e||Object.create(null),{on:function(t,n){(e[t]||(e[t]=[])).push(n)},off:function(t,n){e[t]&&e[t].splice(e[t].indexOf(n)>>>0,1)},emit:function(t,n){(e[t]||[]).slice().map(function(e){e(n)}),(e["*"]||[]).slice().map(function(e){e(t,n)})}}}var R=Object.freeze({default:_}),F=function(){function e(e,t){void 0===t&&(t=[]),this.actions=t,this.config=e}return e.prototype.addAction=function(e){var t=this.findActionIndex(e);this.actions.splice(t,0,e)},e.prototype.addActions=function(e){var t;(t=this.actions).push.apply(t,e)},e.prototype.start=function(){this.actions.sort(function(e,t){return e.delay-t.delay});var e=0,t=performance.now(),n=this.actions,r=this.config,i=this;this.raf=requestAnimationFrame(function o(a){for(e=a-t;n.length;){var s=n[0],u=s.delay/r.speed;if(!(e>=u))break;n.shift(),s.doAction()}n.length>0&&(i.raf=requestAnimationFrame(o))})},e.prototype.clear=function(){this.raf&&cancelAnimationFrame(this.raf),this.actions.length=0},e.prototype.findActionIndex=function(e){for(var t=0,n=this.actions.length-1;t<=n;){var r=Math.floor((t+n)/2);if(this.actions[r].delay<e.delay)t=r+1;else{if(!(this.actions[r].delay>e.delay))return r;n=r-1}}return t},e}(),z=["iframe, .rr-block { background: #ccc }","noscript { display: none !important; }"],j=_||R,P={speed:1,root:document.body,loadTimeout:0},B=function(){function e(e,t){if(this.events=[],this.config=P,this.emitter=j(),this.baselineTime=0,this.missingNodeRetryMap={},e.length<2)throw new Error("Replayer need at least 2 events.");this.events=e,this.handleResize=this.handleResize.bind(this),this.timer=new F(this.config),this.setConfig(Object.assign({},t)),this.setupDom(),this.emitter.on("resize",this.handleResize)}return 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]})},e.prototype.getMetaData=function(){var e=this.events[0];return{totalTime:this.events[this.events.length-1].timestamp-e.timestamp}},e.prototype.play=function(e){void 0===e&&(e=0),this.timer.clear(),this.baselineTime=this.events[0].timestamp+e;for(var t=new Array,n=0,r=this.events;n<r.length;n++){var i=r[n],o=i.timestamp<this.baselineTime,a=this.getCastFn(i,o);o?a():t.push({doAction:a,delay:this.getDelay(i)})}this.timer.addActions(t),this.timer.start()},e.prototype.pause=function(){this.timer.clear(),this.emitter.emit("pause")},e.prototype.resume=function(e){void 0===e&&(e=0),this.timer.clear(),this.baselineTime=this.events[0].timestamp+e;for(var t=new Array,n=0,r=this.events;n<r.length;n++){var i=r[n];if(!(i.timestamp<=this.lastPlayedEvent.timestamp||i===this.lastPlayedEvent)){var o=this.getCastFn(i);t.push({doAction:o,delay:this.getDelay(i)})}}this.timer.addActions(t),this.timer.start(),this.emitter.emit("resume")},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),this.iframe=document.createElement("iframe"),this.iframe.setAttribute("sandbox","allow-same-origin"),this.wrapper.appendChild(this.iframe)},e.prototype.handleResize=function(e){this.iframe.width=e.width+"px",this.iframe.height=e.height+"px"},e.prototype.getDelay=function(e){if(e.type===b.IncrementalSnapshot&&e.data.source===w.MouseMove){var t=e.data.positions[0].timeOffset;return e.timestamp+t-this.baselineTime}return e.timestamp-this.baselineTime},e.prototype.getCastFn=function(e,t){var n,r=this;switch(void 0===t&&(t=!1),e.type){case b.DomContentLoaded:case b.Load:break;case b.Meta:n=function(){return r.emitter.emit("resize",{width:e.data.width,height:e.data.height})};break;case b.FullSnapshot:n=function(){r.rebuildFullSnapshot(e),r.iframe.contentWindow.scrollTo(e.data.initialOffset)};break;case b.IncrementalSnapshot:n=function(){r.applyIncremental(e,t)}}return function(){n&&n(),r.lastPlayedEvent=e,e===r.events[r.events.length-1]&&r.emitter.emit("finish")}},e.prototype.rebuildFullSnapshot=function(e){var t,n,r;Object.keys(this.missingNodeRetryMap).length&&console.warn("Found unresolved missing node map",this.missingNodeRetryMap),this.missingNodeRetryMap={},N.map=(t=e.data.node,n=this.iframe.contentDocument,r={},[y(t,n,r),r])[1];var i=document.createElement("style"),o=this.iframe.contentDocument,a=o.documentElement,s=o.head;a.insertBefore(i,s);for(var u=0;u<z.length;u++)i.sheet.insertRule(z[u],u);this.waitForStylesheetLoad()},e.prototype.waitForStylesheetLoad=function(){var e=this,t=this.iframe.contentDocument.head;if(t){var n,r=new Set;t.querySelectorAll('link[rel="stylesheet"]').forEach(function(t){t.sheet||(0===r.size&&(e.pause(),e.emitter.emit("wait-stylesheet"),n=window.setTimeout(function(){e.resume(),n=-1},e.config.loadTimeout)),r.add(t),t.addEventListener("load",function(){r.delete(t),0===r.size&&-1!==n&&(e.resume(),e.emitter.emit("stylesheet-loaded"),n&&window.clearTimeout(n))}))})}},e.prototype.applyIncremental=function(e,t){var r=this,i=e.data;switch(i.source){case w.Mutation:i.removes.forEach(function(e){var t=N.getNode(e.id);if(t){var n=N.getNode(e.parentId);N.removeNodeFromMap(t),n&&n.removeChild(t)}});var o=n({},this.missingNodeRetryMap);i.adds.forEach(function(e){var t=y(e.node,r.iframe.contentDocument,N.map,!0),n=N.getNode(e.parentId),i=null,a=null;e.previousId&&(i=N.getNode(e.previousId)),e.nextId&&(a=N.getNode(e.nextId)),-1!==e.previousId&&-1!==e.nextId?(i&&i.nextSibling&&i.nextSibling.parentNode?n.insertBefore(t,i.nextSibling):a&&a.parentNode?n.insertBefore(t,a):n.appendChild(t),(e.previousId||e.nextId)&&r.resolveMissingNode(o,n,t,e)):o[e.node.id]={node:t,mutation:e}}),Object.keys(o).length&&Object.assign(this.missingNodeRetryMap,o),i.texts.forEach(function(e){N.getNode(e.id).textContent=e.value}),i.attributes.forEach(function(e){var t=N.getNode(e.id);for(var n in e.attributes)if("string"==typeof n){var r=e.attributes[n];r?t.setAttribute(n,r):t.removeAttribute(n)}});break;case w.MouseMove:t||i.positions.forEach(function(t){var n={doAction:function(){r.mouse.style.left=t.x+"px",r.mouse.style.top=t.y+"px";var e=N.getNode(t.id);e&&r.hoverElements(e)},delay:t.timeOffset+e.timestamp-r.baselineTime};r.timer.addAction(n)});break;case w.MouseInteraction:if(-1===i.id)break;var a=new Event(E[i.type].toLowerCase()),s=N.getNode(i.id);switch(i.type){case E.Blur:s.blur();break;case E.Focus:s.focus({preventScroll:!0});break;case E.Click:t||(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active"));break;default:s.dispatchEvent(a)}break;case w.Scroll:if(-1===i.id)break;if((s=N.getNode(i.id))===this.iframe.contentDocument)this.iframe.contentWindow.scrollTo({top:i.y,left:i.x,behavior:t?"instant":"smooth"});else try{s.scrollTop=i.y,s.scrollLeft=i.x}catch(e){}break;case w.ViewportResize:this.emitter.emit("resize",{width:i.width,height:i.height});break;case w.Input:if(-1===i.id)break;(s=N.getNode(i.id)).checked=i.isChecked,s.value=i.text}},e.prototype.resolveMissingNode=function(e,t,n,r){var i=r.previousId,o=r.nextId,a=i&&e[i],s=o&&e[o];if(a){var u=a,c=u.node,d=u.mutation;t.insertBefore(c,n),delete e[d.node.id],delete this.missingNodeRetryMap[d.node.id],(d.previousId||d.nextId)&&this.resolveMissingNode(e,t,c,d)}if(s){var l=s;c=l.node,d=l.mutation;t.insertBefore(c,n.nextSibling),delete e[d.node.id],delete this.missingNodeRetryMap[d.node.id],(d.previousId||d.nextId)&&this.resolveMissingNode(e,t,c,d)}},e.prototype.hoverElements=function(e){this.iframe.contentDocument.querySelectorAll(".\\:hover").forEach(function(e){e.classList.remove(":hover")});for(var t=e;t;)t.classList.add(":hover"),t=t.parentElement},e}();return e.record=function(e){void 0===e&&(e={});var t=e.emit;if(!t)throw new Error("emit function is required");try{var r=[];r.push(g("DOMContentLoaded",function(){t(L({type:b.DomContentLoaded,data:{}}))}));var i=function(){t(L({type:b.Meta,data:{href:window.location.href,width:T(),height:I()}}));var e=l(document),i=e[0],o=e[1];if(!i)return console.warn("Failed to snapshot the document");N.map=o,t(L({type:b.FullSnapshot,data:{node:i,initialOffset:{left:document.documentElement.scrollLeft,top:document.documentElement.scrollTop}}})),r.push(O({mutationCb:function(e){return t(L({type:b.IncrementalSnapshot,data:n({source:w.Mutation},e)}))},mousemoveCb:function(e){return t(L({type:b.IncrementalSnapshot,data:{source:w.MouseMove,positions:e}}))},mouseInteractionCb:function(e){return t(L({type:b.IncrementalSnapshot,data:n({source:w.MouseInteraction},e)}))},scrollCb:function(e){return t(L({type:b.IncrementalSnapshot,data:n({source:w.Scroll},e)}))},viewportResizeCb:function(e){return t(L({type:b.IncrementalSnapshot,data:n({source:w.ViewportResize},e)}))},inputCb:function(e){return t(L({type:b.IncrementalSnapshot,data:n({source:w.Input},e)}))}}))};return"interactive"===document.readyState||"complete"===document.readyState?i():r.push(g("load",function(){t(L({type:b.Load,data:{}})),i()},window)),function(){r.forEach(function(e){return e()})}}catch(e){console.warn(e)}},e.Replayer=B,e.mirror=N,e}({});
//# sourceMappingURL=rrweb.min.js.map

@@ -426,7 +426,25 @@ /*! *****************************************************************************

});
var isDropped = function (n) {
var parentNode = n.parentNode;
if (!parentNode) {
return false;
}
if (dropped.some(function (d) { return d === parentNode; })) {
return true;
}
return isDropped(parentNode);
};
var isRemoved = function (n) {
var parentNode = n.parentNode;
if (!parentNode) {
return false;
}
var parentId = mirror.getId(parentNode);
if (removes.some(function (r) { return r.id === parentId; })) {
return true;
}
return isRemoved(parentNode);
};
Array.from(addsSet).forEach(function (n) {
var parentId = mirror.getId(n.parentNode);
if (parentId &&
!dropped.some(function (d) { return d === n.parentNode; }) &&
!removes.some(function (r) { return r.id === parentId; })) {
if (!isDropped(n) && !isRemoved(n)) {
adds.push({

@@ -433,0 +451,0 @@ parentId: mirror.getId(n.parentNode),

@@ -1,2 +0,2 @@

var NodeType,__assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};!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"}(NodeType||(NodeType={}));var _id=1;function genId(){return _id++}function resetId(){_id=1}function getCssRulesString(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).reduce(function(e,t){return e+t.cssText},""):null}catch(e){return null}}function extractOrigin(e){return(e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0]).split("?")[0]}var URL_IN_CSS_REF=/url\((['"]|)([^'"]*)\1\)/gm,RELATIVE_PATH=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/;function absoluteToStylesheet(e,t){return e.replace(URL_IN_CSS_REF,function(e,n,r){if(!RELATIVE_PATH.test(r))return"url('"+r+"')";if("/"===r[0])return"url('"+(extractOrigin(t)+r)+"')";var o=t.split("/"),i=r.split("/");o.pop();for(var a=0,u=i;a<u.length;a++){var c=u[a];"."!==c&&(".."===c?o.pop():o.push(c))}return"url('"+o.join("/")+"')"})}function absoluteToDoc(e,t){var n=e.createElement("a");return n.href=t,n.href}function isSVGElement(e){return"svg"===e.tagName||e instanceof SVGElement}var BLOCK_CLASS="rr-block";function serializeNode(e,t){switch(e.nodeType){case e.DOCUMENT_NODE:return{type:NodeType.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:NodeType.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId};case e.ELEMENT_NODE:for(var n=e.classList.contains(BLOCK_CLASS),r=e.tagName.toLowerCase(),o={},i=0,a=Array.from(e.attributes);i<a.length;i++){var u=a[i],c=u.name,s=u.value;o[c]="src"===c||"href"===c?absoluteToDoc(t,s):s}if("link"===r){var d=Array.from(t.styleSheets).find(function(t){return t.href===e.href}),l=getCssRulesString(d);l&&(o={_cssText:absoluteToStylesheet(l,d.href)})}if("input"===r||"textarea"===r||"select"===r){s=e.value;"radio"!==o.type&&"checkbox"!==o.type&&s?o.value=s:e.checked&&(o.checked=e.checked)}if("option"===r){var p=e.parentElement;o.value===p.value&&(o.selected=e.selected)}if(n){var m=e.getBoundingClientRect(),f=m.width,v=m.height;o.rr_width=f+"px",o.rr_height=v+"px"}return{type:NodeType.Element,tagName:r,attributes:o,childNodes:[],isSVG:isSVGElement(e)||void 0,needBlock:n};case e.TEXT_NODE:var h=e.parentNode&&e.parentNode.tagName,E=e.textContent,y="STYLE"===h||void 0;return y&&E&&(E=absoluteToStylesheet(E,location.href)),"SCRIPT"===h&&(E="SCRIPT_PLACEHOLDER"),{type:NodeType.Text,textContent:E||"",isStyle:y};case e.CDATA_SECTION_NODE:return{type:NodeType.CDATA,textContent:""};case e.COMMENT_NODE:return{type:NodeType.Comment,textContent:e.textContent||""};default:return!1}}function serializeNodeWithId(e,t,n,r){void 0===r&&(r=!1);var o=serializeNode(e,t);if(!o)return console.warn(e,"not serialized"),null;var i=Object.assign(o,{id:genId()});e.__sn=i,n[i.id]=e;var a=!r;if(i.type===NodeType.Element&&(a=a&&!i.needBlock,delete i.needBlock),(i.type===NodeType.Document||i.type===NodeType.Element)&&a)for(var u=0,c=Array.from(e.childNodes);u<c.length;u++){var s=serializeNodeWithId(c[u],t,n);s&&i.childNodes.push(s)}return i}function snapshot(e){resetId();var t={};return[serializeNodeWithId(e,e,t),t]}function on(e,t,n){void 0===n&&(n=document);var r={capture:!0,passive:!0};return n.addEventListener(e,t,r),function(){return n.removeEventListener(e,t,r)}}var EventType,IncrementalSource,MouseInteractions,mirror={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return mirror.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete mirror.map[t],e.childNodes&&e.childNodes.forEach(function(e){return mirror.removeNodeFromMap(e)})},has:function(e){return mirror.map.hasOwnProperty(e)}};function throttle(e,t,n){void 0===n&&(n={});var r=null,o=0;return function(){var i=Date.now();o||!1!==n.leading||(o=i);var a=t-(i-o),u=this,c=arguments;a<=0||a>t?(r&&(window.clearTimeout(r),r=null),o=i,e.apply(u,c)):r||!1===n.trailing||(r=window.setTimeout(function(){o=!1===n.leading?0:Date.now(),r=null,e.apply(u,c)},a))}}function hookSetter(e,t,n){var r=Object.getOwnPropertyDescriptor(e,t);return Object.defineProperty(e,t,{set:function(e){var t=this;setTimeout(function(){n.set.call(t,e)},0),r&&r.set&&r.set.call(this,e)}}),function(){return hookSetter(e,t,r||{})}}function getWindowHeight(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function getWindowWidth(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function initMutationObserver(e){var t=new MutationObserver(function(t){var n=[],r=[],o=[],i=[],a=[],u=new Set,c=function(e){u.add(e),e.childNodes.forEach(function(e){return c(e)})};t.forEach(function(e){var t=e.type,i=e.target,s=e.oldValue,d=e.addedNodes,l=e.removedNodes,p=e.attributeName;switch(t){case"characterData":(m=i.textContent)!==s&&n.push({value:m,node:i});break;case"attributes":var m;if((m=i.getAttribute(p))===s)return;var f=r.find(function(e){return e.node===i});f||(f={node:i,attributes:{}},r.push(f)),f.attributes[p]=m;case"childList":d.forEach(function(e){return c(e)}),l.forEach(function(e){u.has(e)?(u.delete(e),a.push(e)):u.has(i)&&!mirror.getId(e)||o.push({parentId:mirror.getId(i),id:mirror.getId(e)}),mirror.removeNodeFromMap(e)})}}),o=o.map(function(e){return e.parentNode&&(e.parentId=mirror.getId(e.parentNode),delete e.parentNode),e}),Array.from(u).forEach(function(e){var t=mirror.getId(e.parentNode);!t||a.some(function(t){return t===e.parentNode})||o.some(function(e){return e.id===t})?a.push(e):i.push({parentId:mirror.getId(e.parentNode),previousId:e.previousSibling?mirror.getId(e.previousSibling):e.previousSibling,nextId:e.nextSibling?mirror.getId(e.nextSibling):e.nextSibling,node:serializeNodeWithId(e,document,mirror.map,!0)})}),e({texts:n.map(function(e){return{id:mirror.getId(e.node),value:e.value}}).filter(function(e){return mirror.has(e.id)}),attributes:r.map(function(e){return{id:mirror.getId(e.node),attributes:e.attributes}}).filter(function(e){return mirror.has(e.id)}),removes:o,adds:i})});return t.observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),t}function initMousemoveObserver(e){var t,n=[],r=throttle(function(){var r=Date.now()-t;e(n.map(function(e){return e.timeOffset-=r,e})),n=[],t=null},500);return on("mousemove",throttle(function(e){var o=e.clientX,i=e.clientY,a=e.target;t||(t=Date.now()),n.push({x:o,y:i,id:mirror.getId(a),timeOffset:Date.now()-t}),r()},20,{trailing:!1}))}function initMouseInteractionObserver(e){var t=[];return Object.keys(MouseInteractions).filter(function(e){return Number.isNaN(Number(e))}).forEach(function(n){var r=n.toLowerCase(),o=function(t){return function(n){var r=mirror.getId(n.target),o=n.clientX,i=n.clientY;e({type:MouseInteractions[t],id:r,x:o,y:i})}}(n);t.push(on(r,o))}),function(){t.forEach(function(e){return e()})}}function initScrollObserver(e){return on("scroll",throttle(function(t){if(t.target){var n=mirror.getId(t.target);t.target===document?e({id:n,x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop}):e({id:n,x:t.target.scrollLeft,y:t.target.scrollTop})}},100))}function initViewportResizeObserver(e){return on("resize",throttle(function(){var t=getWindowHeight(),n=getWindowWidth();e({width:Number(n),height:Number(t)})},200),window)}!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"}(EventType||(EventType={})),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"}(IncrementalSource||(IncrementalSource={})),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=8]="TouchMove",e[e.TouchEnd=9]="TouchEnd"}(MouseInteractions||(MouseInteractions={}));var INPUT_TAGS=["INPUT","TEXTAREA","SELECT"],HOOK_PROPERTIES=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"]],IGNORE_CLASS="rr-ignore",lastInputValueMap=new WeakMap;function initInputObserver(e){function t(e){var t=e.target;if(t&&t.tagName&&!(INPUT_TAGS.indexOf(t.tagName)<0)){var r=t.type;if("password"!==r&&!t.classList.contains(IGNORE_CLASS)){var o=t.value,i=!1;"radio"!==r&&"checkbox"!==r||(i=t.checked),n(t,{text:o,isChecked:i});var a=t.name;"radio"===r&&a&&i&&document.querySelectorAll('input[type="radio"][name="'+a+'"]').forEach(function(e){e!==t&&n(e,{text:e.value,isChecked:!i})})}}}function n(t,n){var r=lastInputValueMap.get(t);if(!r||r.text!==n.text||r.isChecked!==n.isChecked){lastInputValueMap.set(t,n);var o=mirror.getId(t);e(__assign({},n,{id:o}))}}var r=["input","change"].map(function(e){return on(e,t)}),o=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");return o&&o.set&&r.push.apply(r,HOOK_PROPERTIES.map(function(e){return hookSetter(e[0],e[1],{set:function(){t({target:this})}})})),function(){r.forEach(function(e){return e()})}}function initObservers(e){var t=initMutationObserver(e.mutationCb),n=initMousemoveObserver(e.mousemoveCb),r=initMouseInteractionObserver(e.mouseInteractionCb),o=initScrollObserver(e.scrollCb),i=initViewportResizeObserver(e.viewportResizeCb),a=initInputObserver(e.inputCb);return function(){t.disconnect(),n(),r(),o(),i(),a()}}function wrapEvent(e){return __assign({},e,{timestamp:Date.now()})}function record(e){void 0===e&&(e={});var t=e.emit;if(!t)throw new Error("emit function is required");try{var n=[];n.push(on("DOMContentLoaded",function(){t(wrapEvent({type:EventType.DomContentLoaded,data:{}}))}));var r=function(){t(wrapEvent({type:EventType.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}));var e=snapshot(document),r=e[0],o=e[1];if(!r)return console.warn("Failed to snapshot the document");mirror.map=o,t(wrapEvent({type:EventType.FullSnapshot,data:{node:r,initialOffset:{left:document.documentElement.scrollLeft,top:document.documentElement.scrollTop}}})),n.push(initObservers({mutationCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Mutation},e)}))},mousemoveCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:{source:IncrementalSource.MouseMove,positions:e}}))},mouseInteractionCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.MouseInteraction},e)}))},scrollCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Scroll},e)}))},viewportResizeCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.ViewportResize},e)}))},inputCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Input},e)}))}}))};return"interactive"===document.readyState||"complete"===document.readyState?r():n.push(on("load",function(){t(wrapEvent({type:EventType.Load,data:{}})),r()},window)),function(){n.forEach(function(e){return e()})}}catch(e){console.warn(e)}}export default record;
var NodeType,__assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};!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"}(NodeType||(NodeType={}));var _id=1;function genId(){return _id++}function resetId(){_id=1}function getCssRulesString(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).reduce(function(e,t){return e+t.cssText},""):null}catch(e){return null}}function extractOrigin(e){return(e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0]).split("?")[0]}var URL_IN_CSS_REF=/url\((['"]|)([^'"]*)\1\)/gm,RELATIVE_PATH=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/;function absoluteToStylesheet(e,t){return e.replace(URL_IN_CSS_REF,function(e,n,r){if(!RELATIVE_PATH.test(r))return"url('"+r+"')";if("/"===r[0])return"url('"+(extractOrigin(t)+r)+"')";var o=t.split("/"),i=r.split("/");o.pop();for(var a=0,u=i;a<u.length;a++){var c=u[a];"."!==c&&(".."===c?o.pop():o.push(c))}return"url('"+o.join("/")+"')"})}function absoluteToDoc(e,t){var n=e.createElement("a");return n.href=t,n.href}function isSVGElement(e){return"svg"===e.tagName||e instanceof SVGElement}var BLOCK_CLASS="rr-block";function serializeNode(e,t){switch(e.nodeType){case e.DOCUMENT_NODE:return{type:NodeType.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:NodeType.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId};case e.ELEMENT_NODE:for(var n=e.classList.contains(BLOCK_CLASS),r=e.tagName.toLowerCase(),o={},i=0,a=Array.from(e.attributes);i<a.length;i++){var u=a[i],c=u.name,s=u.value;o[c]="src"===c||"href"===c?absoluteToDoc(t,s):s}if("link"===r){var d=Array.from(t.styleSheets).find(function(t){return t.href===e.href}),l=getCssRulesString(d);l&&(o={_cssText:absoluteToStylesheet(l,d.href)})}if("input"===r||"textarea"===r||"select"===r){s=e.value;"radio"!==o.type&&"checkbox"!==o.type&&s?o.value=s:e.checked&&(o.checked=e.checked)}if("option"===r){var p=e.parentElement;o.value===p.value&&(o.selected=e.selected)}if(n){var m=e.getBoundingClientRect(),f=m.width,v=m.height;o.rr_width=f+"px",o.rr_height=v+"px"}return{type:NodeType.Element,tagName:r,attributes:o,childNodes:[],isSVG:isSVGElement(e)||void 0,needBlock:n};case e.TEXT_NODE:var h=e.parentNode&&e.parentNode.tagName,E=e.textContent,y="STYLE"===h||void 0;return y&&E&&(E=absoluteToStylesheet(E,location.href)),"SCRIPT"===h&&(E="SCRIPT_PLACEHOLDER"),{type:NodeType.Text,textContent:E||"",isStyle:y};case e.CDATA_SECTION_NODE:return{type:NodeType.CDATA,textContent:""};case e.COMMENT_NODE:return{type:NodeType.Comment,textContent:e.textContent||""};default:return!1}}function serializeNodeWithId(e,t,n,r){void 0===r&&(r=!1);var o=serializeNode(e,t);if(!o)return console.warn(e,"not serialized"),null;var i=Object.assign(o,{id:genId()});e.__sn=i,n[i.id]=e;var a=!r;if(i.type===NodeType.Element&&(a=a&&!i.needBlock,delete i.needBlock),(i.type===NodeType.Document||i.type===NodeType.Element)&&a)for(var u=0,c=Array.from(e.childNodes);u<c.length;u++){var s=serializeNodeWithId(c[u],t,n);s&&i.childNodes.push(s)}return i}function snapshot(e){resetId();var t={};return[serializeNodeWithId(e,e,t),t]}function on(e,t,n){void 0===n&&(n=document);var r={capture:!0,passive:!0};return n.addEventListener(e,t,r),function(){return n.removeEventListener(e,t,r)}}var EventType,IncrementalSource,MouseInteractions,mirror={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return mirror.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete mirror.map[t],e.childNodes&&e.childNodes.forEach(function(e){return mirror.removeNodeFromMap(e)})},has:function(e){return mirror.map.hasOwnProperty(e)}};function throttle(e,t,n){void 0===n&&(n={});var r=null,o=0;return function(){var i=Date.now();o||!1!==n.leading||(o=i);var a=t-(i-o),u=this,c=arguments;a<=0||a>t?(r&&(window.clearTimeout(r),r=null),o=i,e.apply(u,c)):r||!1===n.trailing||(r=window.setTimeout(function(){o=!1===n.leading?0:Date.now(),r=null,e.apply(u,c)},a))}}function hookSetter(e,t,n){var r=Object.getOwnPropertyDescriptor(e,t);return Object.defineProperty(e,t,{set:function(e){var t=this;setTimeout(function(){n.set.call(t,e)},0),r&&r.set&&r.set.call(this,e)}}),function(){return hookSetter(e,t,r||{})}}function getWindowHeight(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function getWindowWidth(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function initMutationObserver(e){var t=new MutationObserver(function(t){var n=[],r=[],o=[],i=[],a=[],u=new Set,c=function(e){u.add(e),e.childNodes.forEach(function(e){return c(e)})};t.forEach(function(e){var t=e.type,i=e.target,s=e.oldValue,d=e.addedNodes,l=e.removedNodes,p=e.attributeName;switch(t){case"characterData":(m=i.textContent)!==s&&n.push({value:m,node:i});break;case"attributes":var m;if((m=i.getAttribute(p))===s)return;var f=r.find(function(e){return e.node===i});f||(f={node:i,attributes:{}},r.push(f)),f.attributes[p]=m;case"childList":d.forEach(function(e){return c(e)}),l.forEach(function(e){u.has(e)?(u.delete(e),a.push(e)):u.has(i)&&!mirror.getId(e)||o.push({parentId:mirror.getId(i),id:mirror.getId(e)}),mirror.removeNodeFromMap(e)})}}),o=o.map(function(e){return e.parentNode&&(e.parentId=mirror.getId(e.parentNode),delete e.parentNode),e});var s=function(e){var t=e.parentNode;return!!t&&(!!a.some(function(e){return e===t})||s(t))},d=function(e){var t=e.parentNode;if(!t)return!1;var n=mirror.getId(t);return!!o.some(function(e){return e.id===n})||d(t)};Array.from(u).forEach(function(e){s(e)||d(e)?a.push(e):i.push({parentId:mirror.getId(e.parentNode),previousId:e.previousSibling?mirror.getId(e.previousSibling):e.previousSibling,nextId:e.nextSibling?mirror.getId(e.nextSibling):e.nextSibling,node:serializeNodeWithId(e,document,mirror.map,!0)})}),e({texts:n.map(function(e){return{id:mirror.getId(e.node),value:e.value}}).filter(function(e){return mirror.has(e.id)}),attributes:r.map(function(e){return{id:mirror.getId(e.node),attributes:e.attributes}}).filter(function(e){return mirror.has(e.id)}),removes:o,adds:i})});return t.observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),t}function initMousemoveObserver(e){var t,n=[],r=throttle(function(){var r=Date.now()-t;e(n.map(function(e){return e.timeOffset-=r,e})),n=[],t=null},500);return on("mousemove",throttle(function(e){var o=e.clientX,i=e.clientY,a=e.target;t||(t=Date.now()),n.push({x:o,y:i,id:mirror.getId(a),timeOffset:Date.now()-t}),r()},20,{trailing:!1}))}function initMouseInteractionObserver(e){var t=[];return Object.keys(MouseInteractions).filter(function(e){return Number.isNaN(Number(e))}).forEach(function(n){var r=n.toLowerCase(),o=function(t){return function(n){var r=mirror.getId(n.target),o=n.clientX,i=n.clientY;e({type:MouseInteractions[t],id:r,x:o,y:i})}}(n);t.push(on(r,o))}),function(){t.forEach(function(e){return e()})}}function initScrollObserver(e){return on("scroll",throttle(function(t){if(t.target){var n=mirror.getId(t.target);t.target===document?e({id:n,x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop}):e({id:n,x:t.target.scrollLeft,y:t.target.scrollTop})}},100))}function initViewportResizeObserver(e){return on("resize",throttle(function(){var t=getWindowHeight(),n=getWindowWidth();e({width:Number(n),height:Number(t)})},200),window)}!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"}(EventType||(EventType={})),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"}(IncrementalSource||(IncrementalSource={})),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=8]="TouchMove",e[e.TouchEnd=9]="TouchEnd"}(MouseInteractions||(MouseInteractions={}));var INPUT_TAGS=["INPUT","TEXTAREA","SELECT"],HOOK_PROPERTIES=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"]],IGNORE_CLASS="rr-ignore",lastInputValueMap=new WeakMap;function initInputObserver(e){function t(e){var t=e.target;if(t&&t.tagName&&!(INPUT_TAGS.indexOf(t.tagName)<0)){var r=t.type;if("password"!==r&&!t.classList.contains(IGNORE_CLASS)){var o=t.value,i=!1;"radio"!==r&&"checkbox"!==r||(i=t.checked),n(t,{text:o,isChecked:i});var a=t.name;"radio"===r&&a&&i&&document.querySelectorAll('input[type="radio"][name="'+a+'"]').forEach(function(e){e!==t&&n(e,{text:e.value,isChecked:!i})})}}}function n(t,n){var r=lastInputValueMap.get(t);if(!r||r.text!==n.text||r.isChecked!==n.isChecked){lastInputValueMap.set(t,n);var o=mirror.getId(t);e(__assign({},n,{id:o}))}}var r=["input","change"].map(function(e){return on(e,t)}),o=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");return o&&o.set&&r.push.apply(r,HOOK_PROPERTIES.map(function(e){return hookSetter(e[0],e[1],{set:function(){t({target:this})}})})),function(){r.forEach(function(e){return e()})}}function initObservers(e){var t=initMutationObserver(e.mutationCb),n=initMousemoveObserver(e.mousemoveCb),r=initMouseInteractionObserver(e.mouseInteractionCb),o=initScrollObserver(e.scrollCb),i=initViewportResizeObserver(e.viewportResizeCb),a=initInputObserver(e.inputCb);return function(){t.disconnect(),n(),r(),o(),i(),a()}}function wrapEvent(e){return __assign({},e,{timestamp:Date.now()})}function record(e){void 0===e&&(e={});var t=e.emit;if(!t)throw new Error("emit function is required");try{var n=[];n.push(on("DOMContentLoaded",function(){t(wrapEvent({type:EventType.DomContentLoaded,data:{}}))}));var r=function(){t(wrapEvent({type:EventType.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}));var e=snapshot(document),r=e[0],o=e[1];if(!r)return console.warn("Failed to snapshot the document");mirror.map=o,t(wrapEvent({type:EventType.FullSnapshot,data:{node:r,initialOffset:{left:document.documentElement.scrollLeft,top:document.documentElement.scrollTop}}})),n.push(initObservers({mutationCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Mutation},e)}))},mousemoveCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:{source:IncrementalSource.MouseMove,positions:e}}))},mouseInteractionCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.MouseInteraction},e)}))},scrollCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Scroll},e)}))},viewportResizeCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.ViewportResize},e)}))},inputCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Input},e)}))}}))};return"interactive"===document.readyState||"complete"===document.readyState?r():n.push(on("load",function(){t(wrapEvent({type:EventType.Load,data:{}})),r()},window)),function(){n.forEach(function(e){return e()})}}catch(e){console.warn(e)}}export default record;
//# sourceMappingURL=rrweb-record.min.js.map

@@ -540,7 +540,25 @@ /*! *****************************************************************************

});
var isDropped = function (n) {
var parentNode = n.parentNode;
if (!parentNode) {
return false;
}
if (dropped.some(function (d) { return d === parentNode; })) {
return true;
}
return isDropped(parentNode);
};
var isRemoved = function (n) {
var parentNode = n.parentNode;
if (!parentNode) {
return false;
}
var parentId = mirror.getId(parentNode);
if (removes.some(function (r) { return r.id === parentId; })) {
return true;
}
return isRemoved(parentNode);
};
Array.from(addsSet).forEach(function (n) {
var parentId = mirror.getId(n.parentNode);
if (parentId &&
!dropped.some(function (d) { return d === n.parentNode; }) &&
!removes.some(function (r) { return r.id === parentId; })) {
if (!isDropped(n) && !isRemoved(n)) {
adds.push({

@@ -1016,2 +1034,3 @@ parentId: mirror.getId(n.parentNode),

this.baselineTime = 0;
this.missingNodeRetryMap = {};
if (events.length < 2) {

@@ -1145,2 +1164,5 @@ throw new Error('Replayer need at least 2 events.');

_this.lastPlayedEvent = event;
if (event === _this.events[_this.events.length - 1]) {
_this.emitter.emit('finish');
}
};

@@ -1150,2 +1172,6 @@ return wrappedCastFn;

Replayer.prototype.rebuildFullSnapshot = function (event) {
if (Object.keys(this.missingNodeRetryMap).length) {
console.warn('Found unresolved missing node map', this.missingNodeRetryMap);
}
this.missingNodeRetryMap = {};
mirror.map = rebuild(event.data.node, this.iframe.contentDocument)[1];

@@ -1209,3 +1235,3 @@ var styleEl = document.createElement('style');

});
var missingNodeMap_1 = {};
var missingNodeMap_1 = __assign({}, this.missingNodeRetryMap);
d.adds.forEach(function (mutation) {

@@ -1245,3 +1271,3 @@ var target = buildNodeWithSN(mutation.node, _this.iframe.contentDocument, mirror.map, true);

if (Object.keys(missingNodeMap_1).length) {
console.warn('Found unresolved missing node map', missingNodeMap_1);
Object.assign(this.missingNodeRetryMap, missingNodeMap_1);
}

@@ -1326,4 +1352,8 @@ d.texts.forEach(function (mutation) {

else {
target.scrollTop = d.y;
target.scrollLeft = d.x;
try {
target.scrollTop = d.y;
target.scrollLeft = d.x;
}
catch (error) {
}
}

@@ -1354,11 +1384,16 @@ break;

var nextInMap = nextId && map[nextId];
if (previousInMap || nextInMap) {
var _a = (previousInMap || nextInMap), node = _a.node, mutation = _a.mutation;
if (previousInMap) {
parent.insertBefore(node, target);
if (previousInMap) {
var _a = previousInMap, node = _a.node, mutation = _a.mutation;
parent.insertBefore(node, target);
delete map[mutation.node.id];
delete this.missingNodeRetryMap[mutation.node.id];
if (mutation.previousId || mutation.nextId) {
this.resolveMissingNode(map, parent, node, mutation);
}
else {
parent.insertBefore(node, target.nextSibling);
}
}
if (nextInMap) {
var _b = nextInMap, node = _b.node, mutation = _b.mutation;
parent.insertBefore(node, target.nextSibling);
delete map[mutation.node.id];
delete this.missingNodeRetryMap[mutation.node.id];
if (mutation.previousId || mutation.nextId) {

@@ -1365,0 +1400,0 @@ this.resolveMissingNode(map, parent, node, mutation);

@@ -1,2 +0,2 @@

var NodeType,__assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};!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"}(NodeType||(NodeType={}));var _id=1;function genId(){return _id++}function resetId(){_id=1}function getCssRulesString(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).reduce(function(e,t){return e+t.cssText},""):null}catch(e){return null}}function extractOrigin(e){return(e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0]).split("?")[0]}var URL_IN_CSS_REF=/url\((['"]|)([^'"]*)\1\)/gm,RELATIVE_PATH=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/;function absoluteToStylesheet(e,t){return e.replace(URL_IN_CSS_REF,function(e,n,r){if(!RELATIVE_PATH.test(r))return"url('"+r+"')";if("/"===r[0])return"url('"+(extractOrigin(t)+r)+"')";var o=t.split("/"),i=r.split("/");o.pop();for(var a=0,s=i;a<s.length;a++){var u=s[a];"."!==u&&(".."===u?o.pop():o.push(u))}return"url('"+o.join("/")+"')"})}function absoluteToDoc(e,t){var n=e.createElement("a");return n.href=t,n.href}function isSVGElement(e){return"svg"===e.tagName||e instanceof SVGElement}var BLOCK_CLASS="rr-block";function serializeNode(e,t){switch(e.nodeType){case e.DOCUMENT_NODE:return{type:NodeType.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:NodeType.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId};case e.ELEMENT_NODE:for(var n=e.classList.contains(BLOCK_CLASS),r=e.tagName.toLowerCase(),o={},i=0,a=Array.from(e.attributes);i<a.length;i++){var s=a[i],u=s.name,c=s.value;o[u]="src"===u||"href"===u?absoluteToDoc(t,c):c}if("link"===r){var d=Array.from(t.styleSheets).find(function(t){return t.href===e.href}),l=getCssRulesString(d);l&&(o={_cssText:absoluteToStylesheet(l,d.href)})}if("input"===r||"textarea"===r||"select"===r){c=e.value;"radio"!==o.type&&"checkbox"!==o.type&&c?o.value=c:e.checked&&(o.checked=e.checked)}if("option"===r){var p=e.parentElement;o.value===p.value&&(o.selected=e.selected)}if(n){var m=e.getBoundingClientRect(),h=m.width,f=m.height;o.rr_width=h+"px",o.rr_height=f+"px"}return{type:NodeType.Element,tagName:r,attributes:o,childNodes:[],isSVG:isSVGElement(e)||void 0,needBlock:n};case e.TEXT_NODE:var v=e.parentNode&&e.parentNode.tagName,y=e.textContent,g="STYLE"===v||void 0;return g&&y&&(y=absoluteToStylesheet(y,location.href)),"SCRIPT"===v&&(y="SCRIPT_PLACEHOLDER"),{type:NodeType.Text,textContent:y||"",isStyle:g};case e.CDATA_SECTION_NODE:return{type:NodeType.CDATA,textContent:""};case e.COMMENT_NODE:return{type:NodeType.Comment,textContent:e.textContent||""};default:return!1}}function serializeNodeWithId(e,t,n,r){void 0===r&&(r=!1);var o=serializeNode(e,t);if(!o)return console.warn(e,"not serialized"),null;var i=Object.assign(o,{id:genId()});e.__sn=i,n[i.id]=e;var a=!r;if(i.type===NodeType.Element&&(a=a&&!i.needBlock,delete i.needBlock),(i.type===NodeType.Document||i.type===NodeType.Element)&&a)for(var s=0,u=Array.from(e.childNodes);s<u.length;s++){var c=serializeNodeWithId(u[s],t,n);c&&i.childNodes.push(c)}return i}function snapshot(e){resetId();var t={};return[serializeNodeWithId(e,e,t),t]}var tagMap={script:"noscript"};function getTagName(e){var t=tagMap[e.tagName]?tagMap[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}var CSS_SELECTOR=/([^\r\n,{}]+)(,(?=[^}]*{)|\s*{)/g,HOVER_SELECTOR=/([^\\]):hover/g;function addHoverClass(e){return e.replace(CSS_SELECTOR,function(e,t,n){if(HOVER_SELECTOR.test(t)){var r=t.replace(HOVER_SELECTOR,"$1.\\:hover");return t.replace(/\s*$/,"")+", "+r.replace(/^\s*/,"")+n}return e})}function buildNode(e,t){switch(e.type){case NodeType.Document:return t.implementation.createDocument(null,"",null);case NodeType.DocumentType:return t.implementation.createDocumentType(e.name,e.publicId,e.systemId);case NodeType.Element:var n=getTagName(e),r=void 0;for(var o in r=e.isSVG?t.createElementNS("http://www.w3.org/2000/svg",n):t.createElement(n),e.attributes)if(e.attributes.hasOwnProperty(o)&&!o.startsWith("rr_")){var i=e.attributes[o];i="boolean"==typeof i?"":i;var a="textarea"===n&&"value"===o,s="style"===n&&"_cssText"===o;if(s&&(i=addHoverClass(i)),a||s){var u=t.createTextNode(i);r.appendChild(u);continue}if("iframe"===n&&"src"===o)continue;try{r.setAttribute(o,i)}catch(e){}}else e.attributes.rr_width&&(r.style.width=e.attributes.rr_width),e.attributes.rr_height&&(r.style.height=e.attributes.rr_height);return r;case NodeType.Text:return t.createTextNode(e.isStyle?addHoverClass(e.textContent):e.textContent);case NodeType.CDATA:return t.createCDATASection(e.textContent);case NodeType.Comment:return t.createComment(e.textContent);default:return null}}function buildNodeWithSN(e,t,n,r){void 0===r&&(r=!1);var o=buildNode(e,t);if(!o)return null;if(e.type===NodeType.Document&&(t.open(),o=t),o.__sn=e,n[e.id]=o,(e.type===NodeType.Document||e.type===NodeType.Element)&&!r)for(var i=0,a=e.childNodes;i<a.length;i++){var s=a[i],u=buildNodeWithSN(s,t,n);u?o.appendChild(u):console.warn("Failed to rebuild",s)}return o}function rebuild(e,t){var n={};return[buildNodeWithSN(e,t,n),n]}function on(e,t,n){void 0===n&&(n=document);var r={capture:!0,passive:!0};return n.addEventListener(e,t,r),function(){return n.removeEventListener(e,t,r)}}var EventType,IncrementalSource,MouseInteractions,mirror={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return mirror.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete mirror.map[t],e.childNodes&&e.childNodes.forEach(function(e){return mirror.removeNodeFromMap(e)})},has:function(e){return mirror.map.hasOwnProperty(e)}};function throttle(e,t,n){void 0===n&&(n={});var r=null,o=0;return function(){var i=Date.now();o||!1!==n.leading||(o=i);var a=t-(i-o),s=this,u=arguments;a<=0||a>t?(r&&(window.clearTimeout(r),r=null),o=i,e.apply(s,u)):r||!1===n.trailing||(r=window.setTimeout(function(){o=!1===n.leading?0:Date.now(),r=null,e.apply(s,u)},a))}}function hookSetter(e,t,n){var r=Object.getOwnPropertyDescriptor(e,t);return Object.defineProperty(e,t,{set:function(e){var t=this;setTimeout(function(){n.set.call(t,e)},0),r&&r.set&&r.set.call(this,e)}}),function(){return hookSetter(e,t,r||{})}}function getWindowHeight(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function getWindowWidth(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function initMutationObserver(e){var t=new MutationObserver(function(t){var n=[],r=[],o=[],i=[],a=[],s=new Set,u=function(e){s.add(e),e.childNodes.forEach(function(e){return u(e)})};t.forEach(function(e){var t=e.type,i=e.target,c=e.oldValue,d=e.addedNodes,l=e.removedNodes,p=e.attributeName;switch(t){case"characterData":(m=i.textContent)!==c&&n.push({value:m,node:i});break;case"attributes":var m;if((m=i.getAttribute(p))===c)return;var h=r.find(function(e){return e.node===i});h||(h={node:i,attributes:{}},r.push(h)),h.attributes[p]=m;case"childList":d.forEach(function(e){return u(e)}),l.forEach(function(e){s.has(e)?(s.delete(e),a.push(e)):s.has(i)&&!mirror.getId(e)||o.push({parentId:mirror.getId(i),id:mirror.getId(e)}),mirror.removeNodeFromMap(e)})}}),o=o.map(function(e){return e.parentNode&&(e.parentId=mirror.getId(e.parentNode),delete e.parentNode),e}),Array.from(s).forEach(function(e){var t=mirror.getId(e.parentNode);!t||a.some(function(t){return t===e.parentNode})||o.some(function(e){return e.id===t})?a.push(e):i.push({parentId:mirror.getId(e.parentNode),previousId:e.previousSibling?mirror.getId(e.previousSibling):e.previousSibling,nextId:e.nextSibling?mirror.getId(e.nextSibling):e.nextSibling,node:serializeNodeWithId(e,document,mirror.map,!0)})}),e({texts:n.map(function(e){return{id:mirror.getId(e.node),value:e.value}}).filter(function(e){return mirror.has(e.id)}),attributes:r.map(function(e){return{id:mirror.getId(e.node),attributes:e.attributes}}).filter(function(e){return mirror.has(e.id)}),removes:o,adds:i})});return t.observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),t}function initMousemoveObserver(e){var t,n=[],r=throttle(function(){var r=Date.now()-t;e(n.map(function(e){return e.timeOffset-=r,e})),n=[],t=null},500);return on("mousemove",throttle(function(e){var o=e.clientX,i=e.clientY,a=e.target;t||(t=Date.now()),n.push({x:o,y:i,id:mirror.getId(a),timeOffset:Date.now()-t}),r()},20,{trailing:!1}))}function initMouseInteractionObserver(e){var t=[];return Object.keys(MouseInteractions).filter(function(e){return Number.isNaN(Number(e))}).forEach(function(n){var r=n.toLowerCase(),o=function(t){return function(n){var r=mirror.getId(n.target),o=n.clientX,i=n.clientY;e({type:MouseInteractions[t],id:r,x:o,y:i})}}(n);t.push(on(r,o))}),function(){t.forEach(function(e){return e()})}}function initScrollObserver(e){return on("scroll",throttle(function(t){if(t.target){var n=mirror.getId(t.target);t.target===document?e({id:n,x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop}):e({id:n,x:t.target.scrollLeft,y:t.target.scrollTop})}},100))}function initViewportResizeObserver(e){return on("resize",throttle(function(){var t=getWindowHeight(),n=getWindowWidth();e({width:Number(n),height:Number(t)})},200),window)}!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"}(EventType||(EventType={})),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"}(IncrementalSource||(IncrementalSource={})),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=8]="TouchMove",e[e.TouchEnd=9]="TouchEnd"}(MouseInteractions||(MouseInteractions={}));var INPUT_TAGS=["INPUT","TEXTAREA","SELECT"],HOOK_PROPERTIES=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"]],IGNORE_CLASS="rr-ignore",lastInputValueMap=new WeakMap;function initInputObserver(e){function t(e){var t=e.target;if(t&&t.tagName&&!(INPUT_TAGS.indexOf(t.tagName)<0)){var r=t.type;if("password"!==r&&!t.classList.contains(IGNORE_CLASS)){var o=t.value,i=!1;"radio"!==r&&"checkbox"!==r||(i=t.checked),n(t,{text:o,isChecked:i});var a=t.name;"radio"===r&&a&&i&&document.querySelectorAll('input[type="radio"][name="'+a+'"]').forEach(function(e){e!==t&&n(e,{text:e.value,isChecked:!i})})}}}function n(t,n){var r=lastInputValueMap.get(t);if(!r||r.text!==n.text||r.isChecked!==n.isChecked){lastInputValueMap.set(t,n);var o=mirror.getId(t);e(__assign({},n,{id:o}))}}var r=["input","change"].map(function(e){return on(e,t)}),o=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");return o&&o.set&&r.push.apply(r,HOOK_PROPERTIES.map(function(e){return hookSetter(e[0],e[1],{set:function(){t({target:this})}})})),function(){r.forEach(function(e){return e()})}}function initObservers(e){var t=initMutationObserver(e.mutationCb),n=initMousemoveObserver(e.mousemoveCb),r=initMouseInteractionObserver(e.mouseInteractionCb),o=initScrollObserver(e.scrollCb),i=initViewportResizeObserver(e.viewportResizeCb),a=initInputObserver(e.inputCb);return function(){t.disconnect(),n(),r(),o(),i(),a()}}function wrapEvent(e){return __assign({},e,{timestamp:Date.now()})}function record(e){void 0===e&&(e={});var t=e.emit;if(!t)throw new Error("emit function is required");try{var n=[];n.push(on("DOMContentLoaded",function(){t(wrapEvent({type:EventType.DomContentLoaded,data:{}}))}));var r=function(){t(wrapEvent({type:EventType.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}));var e=snapshot(document),r=e[0],o=e[1];if(!r)return console.warn("Failed to snapshot the document");mirror.map=o,t(wrapEvent({type:EventType.FullSnapshot,data:{node:r,initialOffset:{left:document.documentElement.scrollLeft,top:document.documentElement.scrollTop}}})),n.push(initObservers({mutationCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Mutation},e)}))},mousemoveCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:{source:IncrementalSource.MouseMove,positions:e}}))},mouseInteractionCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.MouseInteraction},e)}))},scrollCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Scroll},e)}))},viewportResizeCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.ViewportResize},e)}))},inputCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Input},e)}))}}))};return"interactive"===document.readyState||"complete"===document.readyState?r():n.push(on("load",function(){t(wrapEvent({type:EventType.Load,data:{}})),r()},window)),function(){n.forEach(function(e){return e()})}}catch(e){console.warn(e)}}function mitt(e){return e=e||Object.create(null),{on:function(t,n){(e[t]||(e[t]=[])).push(n)},off:function(t,n){e[t]&&e[t].splice(e[t].indexOf(n)>>>0,1)},emit:function(t,n){(e[t]||[]).slice().map(function(e){e(n)}),(e["*"]||[]).slice().map(function(e){e(t,n)})}}}var mittProxy=Object.freeze({default:mitt}),Timer=function(){function e(e,t){void 0===t&&(t=[]),this.actions=t,this.config=e}return e.prototype.addAction=function(e){var t=this.findActionIndex(e);this.actions.splice(t,0,e)},e.prototype.addActions=function(e){var t;(t=this.actions).push.apply(t,e)},e.prototype.start=function(){this.actions.sort(function(e,t){return e.delay-t.delay});var e=0,t=performance.now(),n=this.actions,r=this.config,o=this;this.raf=requestAnimationFrame(function i(a){for(e=a-t;n.length;){var s=n[0],u=s.delay/r.speed;if(!(e>=u))break;n.shift(),s.doAction()}n.length>0&&(o.raf=requestAnimationFrame(i))})},e.prototype.clear=function(){this.raf&&cancelAnimationFrame(this.raf),this.actions.length=0},e.prototype.findActionIndex=function(e){for(var t=0,n=this.actions.length-1;t<=n;){var r=Math.floor((t+n)/2);if(this.actions[r].delay<e.delay)t=r+1;else{if(!(this.actions[r].delay>e.delay))return r;n=r-1}}return t},e}(),rules=["iframe, .rr-block { background: #ccc }","noscript { display: none !important; }"],mitt$1=mitt||mittProxy,defaultConfig={speed:1,root:document.body,loadTimeout:0},Replayer=function(){function e(e,t){if(this.events=[],this.config=defaultConfig,this.emitter=mitt$1(),this.baselineTime=0,e.length<2)throw new Error("Replayer need at least 2 events.");this.events=e,this.handleResize=this.handleResize.bind(this),this.timer=new Timer(this.config),this.setConfig(Object.assign({},t)),this.setupDom(),this.emitter.on("resize",this.handleResize)}return 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]})},e.prototype.getMetaData=function(){var e=this.events[0];return{totalTime:this.events[this.events.length-1].timestamp-e.timestamp}},e.prototype.play=function(e){void 0===e&&(e=0),this.timer.clear(),this.baselineTime=this.events[0].timestamp+e;for(var t=new Array,n=0,r=this.events;n<r.length;n++){var o=r[n],i=o.timestamp<this.baselineTime,a=this.getCastFn(o,i);i?a():t.push({doAction:a,delay:this.getDelay(o)})}this.timer.addActions(t),this.timer.start()},e.prototype.pause=function(){this.timer.clear(),this.emitter.emit("pause")},e.prototype.resume=function(e){void 0===e&&(e=0),this.timer.clear(),this.baselineTime=this.events[0].timestamp+e;for(var t=new Array,n=0,r=this.events;n<r.length;n++){var o=r[n];if(!(o.timestamp<=this.lastPlayedEvent.timestamp||o===this.lastPlayedEvent)){var i=this.getCastFn(o);t.push({doAction:i,delay:this.getDelay(o)})}}this.timer.addActions(t),this.timer.start(),this.emitter.emit("resume")},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),this.iframe=document.createElement("iframe"),this.iframe.setAttribute("sandbox","allow-same-origin"),this.wrapper.appendChild(this.iframe)},e.prototype.handleResize=function(e){this.iframe.width=e.width+"px",this.iframe.height=e.height+"px"},e.prototype.getDelay=function(e){if(e.type===EventType.IncrementalSnapshot&&e.data.source===IncrementalSource.MouseMove){var t=e.data.positions[0].timeOffset;return e.timestamp+t-this.baselineTime}return e.timestamp-this.baselineTime},e.prototype.getCastFn=function(e,t){var n,r=this;switch(void 0===t&&(t=!1),e.type){case EventType.DomContentLoaded:case EventType.Load:break;case EventType.Meta:n=function(){return r.emitter.emit("resize",{width:e.data.width,height:e.data.height})};break;case EventType.FullSnapshot:n=function(){r.rebuildFullSnapshot(e),r.iframe.contentWindow.scrollTo(e.data.initialOffset)};break;case EventType.IncrementalSnapshot:n=function(){r.applyIncremental(e,t)}}return function(){n&&n(),r.lastPlayedEvent=e}},e.prototype.rebuildFullSnapshot=function(e){mirror.map=rebuild(e.data.node,this.iframe.contentDocument)[1];var t=document.createElement("style"),n=this.iframe.contentDocument,r=n.documentElement,o=n.head;r.insertBefore(t,o);for(var i=0;i<rules.length;i++)t.sheet.insertRule(rules[i],i);this.waitForStylesheetLoad()},e.prototype.waitForStylesheetLoad=function(){var e=this,t=this.iframe.contentDocument.head;if(t){var n,r=new Set;t.querySelectorAll('link[rel="stylesheet"]').forEach(function(t){t.sheet||(0===r.size&&(e.pause(),e.emitter.emit("wait-stylesheet"),n=window.setTimeout(function(){e.resume(),n=-1},e.config.loadTimeout)),r.add(t),t.addEventListener("load",function(){r.delete(t),0===r.size&&-1!==n&&(e.resume(),e.emitter.emit("stylesheet-loaded"),n&&window.clearTimeout(n))}))})}},e.prototype.applyIncremental=function(e,t){var n=this,r=e.data;switch(r.source){case IncrementalSource.Mutation:r.removes.forEach(function(e){var t=mirror.getNode(e.id);if(t){var n=mirror.getNode(e.parentId);mirror.removeNodeFromMap(t),n&&n.removeChild(t)}});var o={};r.adds.forEach(function(e){var t=buildNodeWithSN(e.node,n.iframe.contentDocument,mirror.map,!0),r=mirror.getNode(e.parentId),i=null,a=null;e.previousId&&(i=mirror.getNode(e.previousId)),e.nextId&&(a=mirror.getNode(e.nextId)),-1!==e.previousId&&-1!==e.nextId?(i&&i.nextSibling&&i.nextSibling.parentNode?r.insertBefore(t,i.nextSibling):a&&a.parentNode?r.insertBefore(t,a):r.appendChild(t),(e.previousId||e.nextId)&&n.resolveMissingNode(o,r,t,e)):o[e.node.id]={node:t,mutation:e}}),Object.keys(o).length&&console.warn("Found unresolved missing node map",o),r.texts.forEach(function(e){mirror.getNode(e.id).textContent=e.value}),r.attributes.forEach(function(e){var t=mirror.getNode(e.id);for(var n in e.attributes)if("string"==typeof n){var r=e.attributes[n];r?t.setAttribute(n,r):t.removeAttribute(n)}});break;case IncrementalSource.MouseMove:t||r.positions.forEach(function(t){var r={doAction:function(){n.mouse.style.left=t.x+"px",n.mouse.style.top=t.y+"px";var e=mirror.getNode(t.id);e&&n.hoverElements(e)},delay:t.timeOffset+e.timestamp-n.baselineTime};n.timer.addAction(r)});break;case IncrementalSource.MouseInteraction:if(-1===r.id)break;var i=new Event(MouseInteractions[r.type].toLowerCase()),a=mirror.getNode(r.id);switch(r.type){case MouseInteractions.Blur:a.blur();break;case MouseInteractions.Focus:a.focus({preventScroll:!0});break;case MouseInteractions.Click:t||(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active"));break;default:a.dispatchEvent(i)}break;case IncrementalSource.Scroll:if(-1===r.id)break;(a=mirror.getNode(r.id))===this.iframe.contentDocument?this.iframe.contentWindow.scrollTo({top:r.y,left:r.x,behavior:t?"instant":"smooth"}):(a.scrollTop=r.y,a.scrollLeft=r.x);break;case IncrementalSource.ViewportResize:this.emitter.emit("resize",{width:r.width,height:r.height});break;case IncrementalSource.Input:if(-1===r.id)break;(a=mirror.getNode(r.id)).checked=r.isChecked,a.value=r.text}},e.prototype.resolveMissingNode=function(e,t,n,r){var o=r.previousId,i=r.nextId,a=o&&e[o],s=i&&e[i];if(a||s){var u=a||s,c=u.node,d=u.mutation;a?t.insertBefore(c,n):t.insertBefore(c,n.nextSibling),delete e[d.node.id],(d.previousId||d.nextId)&&this.resolveMissingNode(e,t,c,d)}},e.prototype.hoverElements=function(e){this.iframe.contentDocument.querySelectorAll(".\\:hover").forEach(function(e){e.classList.remove(":hover")});for(var t=e;t;)t.classList.add(":hover"),t=t.parentElement},e}();export{record,Replayer,mirror};
var NodeType,__assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};!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"}(NodeType||(NodeType={}));var _id=1;function genId(){return _id++}function resetId(){_id=1}function getCssRulesString(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).reduce(function(e,t){return e+t.cssText},""):null}catch(e){return null}}function extractOrigin(e){return(e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0]).split("?")[0]}var URL_IN_CSS_REF=/url\((['"]|)([^'"]*)\1\)/gm,RELATIVE_PATH=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/;function absoluteToStylesheet(e,t){return e.replace(URL_IN_CSS_REF,function(e,n,r){if(!RELATIVE_PATH.test(r))return"url('"+r+"')";if("/"===r[0])return"url('"+(extractOrigin(t)+r)+"')";var i=t.split("/"),o=r.split("/");i.pop();for(var a=0,s=o;a<s.length;a++){var u=s[a];"."!==u&&(".."===u?i.pop():i.push(u))}return"url('"+i.join("/")+"')"})}function absoluteToDoc(e,t){var n=e.createElement("a");return n.href=t,n.href}function isSVGElement(e){return"svg"===e.tagName||e instanceof SVGElement}var BLOCK_CLASS="rr-block";function serializeNode(e,t){switch(e.nodeType){case e.DOCUMENT_NODE:return{type:NodeType.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:NodeType.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId};case e.ELEMENT_NODE:for(var n=e.classList.contains(BLOCK_CLASS),r=e.tagName.toLowerCase(),i={},o=0,a=Array.from(e.attributes);o<a.length;o++){var s=a[o],u=s.name,c=s.value;i[u]="src"===u||"href"===u?absoluteToDoc(t,c):c}if("link"===r){var d=Array.from(t.styleSheets).find(function(t){return t.href===e.href}),l=getCssRulesString(d);l&&(i={_cssText:absoluteToStylesheet(l,d.href)})}if("input"===r||"textarea"===r||"select"===r){c=e.value;"radio"!==i.type&&"checkbox"!==i.type&&c?i.value=c:e.checked&&(i.checked=e.checked)}if("option"===r){var p=e.parentElement;i.value===p.value&&(i.selected=e.selected)}if(n){var m=e.getBoundingClientRect(),h=m.width,f=m.height;i.rr_width=h+"px",i.rr_height=f+"px"}return{type:NodeType.Element,tagName:r,attributes:i,childNodes:[],isSVG:isSVGElement(e)||void 0,needBlock:n};case e.TEXT_NODE:var v=e.parentNode&&e.parentNode.tagName,y=e.textContent,g="STYLE"===v||void 0;return g&&y&&(y=absoluteToStylesheet(y,location.href)),"SCRIPT"===v&&(y="SCRIPT_PLACEHOLDER"),{type:NodeType.Text,textContent:y||"",isStyle:g};case e.CDATA_SECTION_NODE:return{type:NodeType.CDATA,textContent:""};case e.COMMENT_NODE:return{type:NodeType.Comment,textContent:e.textContent||""};default:return!1}}function serializeNodeWithId(e,t,n,r){void 0===r&&(r=!1);var i=serializeNode(e,t);if(!i)return console.warn(e,"not serialized"),null;var o=Object.assign(i,{id:genId()});e.__sn=o,n[o.id]=e;var a=!r;if(o.type===NodeType.Element&&(a=a&&!o.needBlock,delete o.needBlock),(o.type===NodeType.Document||o.type===NodeType.Element)&&a)for(var s=0,u=Array.from(e.childNodes);s<u.length;s++){var c=serializeNodeWithId(u[s],t,n);c&&o.childNodes.push(c)}return o}function snapshot(e){resetId();var t={};return[serializeNodeWithId(e,e,t),t]}var tagMap={script:"noscript"};function getTagName(e){var t=tagMap[e.tagName]?tagMap[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}var CSS_SELECTOR=/([^\r\n,{}]+)(,(?=[^}]*{)|\s*{)/g,HOVER_SELECTOR=/([^\\]):hover/g;function addHoverClass(e){return e.replace(CSS_SELECTOR,function(e,t,n){if(HOVER_SELECTOR.test(t)){var r=t.replace(HOVER_SELECTOR,"$1.\\:hover");return t.replace(/\s*$/,"")+", "+r.replace(/^\s*/,"")+n}return e})}function buildNode(e,t){switch(e.type){case NodeType.Document:return t.implementation.createDocument(null,"",null);case NodeType.DocumentType:return t.implementation.createDocumentType(e.name,e.publicId,e.systemId);case NodeType.Element:var n=getTagName(e),r=void 0;for(var i in r=e.isSVG?t.createElementNS("http://www.w3.org/2000/svg",n):t.createElement(n),e.attributes)if(e.attributes.hasOwnProperty(i)&&!i.startsWith("rr_")){var o=e.attributes[i];o="boolean"==typeof o?"":o;var a="textarea"===n&&"value"===i,s="style"===n&&"_cssText"===i;if(s&&(o=addHoverClass(o)),a||s){var u=t.createTextNode(o);r.appendChild(u);continue}if("iframe"===n&&"src"===i)continue;try{r.setAttribute(i,o)}catch(e){}}else e.attributes.rr_width&&(r.style.width=e.attributes.rr_width),e.attributes.rr_height&&(r.style.height=e.attributes.rr_height);return r;case NodeType.Text:return t.createTextNode(e.isStyle?addHoverClass(e.textContent):e.textContent);case NodeType.CDATA:return t.createCDATASection(e.textContent);case NodeType.Comment:return t.createComment(e.textContent);default:return null}}function buildNodeWithSN(e,t,n,r){void 0===r&&(r=!1);var i=buildNode(e,t);if(!i)return null;if(e.type===NodeType.Document&&(t.open(),i=t),i.__sn=e,n[e.id]=i,(e.type===NodeType.Document||e.type===NodeType.Element)&&!r)for(var o=0,a=e.childNodes;o<a.length;o++){var s=a[o],u=buildNodeWithSN(s,t,n);u?i.appendChild(u):console.warn("Failed to rebuild",s)}return i}function rebuild(e,t){var n={};return[buildNodeWithSN(e,t,n),n]}function on(e,t,n){void 0===n&&(n=document);var r={capture:!0,passive:!0};return n.addEventListener(e,t,r),function(){return n.removeEventListener(e,t,r)}}var EventType,IncrementalSource,MouseInteractions,mirror={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return mirror.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete mirror.map[t],e.childNodes&&e.childNodes.forEach(function(e){return mirror.removeNodeFromMap(e)})},has:function(e){return mirror.map.hasOwnProperty(e)}};function throttle(e,t,n){void 0===n&&(n={});var r=null,i=0;return function(){var o=Date.now();i||!1!==n.leading||(i=o);var a=t-(o-i),s=this,u=arguments;a<=0||a>t?(r&&(window.clearTimeout(r),r=null),i=o,e.apply(s,u)):r||!1===n.trailing||(r=window.setTimeout(function(){i=!1===n.leading?0:Date.now(),r=null,e.apply(s,u)},a))}}function hookSetter(e,t,n){var r=Object.getOwnPropertyDescriptor(e,t);return Object.defineProperty(e,t,{set:function(e){var t=this;setTimeout(function(){n.set.call(t,e)},0),r&&r.set&&r.set.call(this,e)}}),function(){return hookSetter(e,t,r||{})}}function getWindowHeight(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function getWindowWidth(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function initMutationObserver(e){var t=new MutationObserver(function(t){var n=[],r=[],i=[],o=[],a=[],s=new Set,u=function(e){s.add(e),e.childNodes.forEach(function(e){return u(e)})};t.forEach(function(e){var t=e.type,o=e.target,c=e.oldValue,d=e.addedNodes,l=e.removedNodes,p=e.attributeName;switch(t){case"characterData":(m=o.textContent)!==c&&n.push({value:m,node:o});break;case"attributes":var m;if((m=o.getAttribute(p))===c)return;var h=r.find(function(e){return e.node===o});h||(h={node:o,attributes:{}},r.push(h)),h.attributes[p]=m;case"childList":d.forEach(function(e){return u(e)}),l.forEach(function(e){s.has(e)?(s.delete(e),a.push(e)):s.has(o)&&!mirror.getId(e)||i.push({parentId:mirror.getId(o),id:mirror.getId(e)}),mirror.removeNodeFromMap(e)})}}),i=i.map(function(e){return e.parentNode&&(e.parentId=mirror.getId(e.parentNode),delete e.parentNode),e});var c=function(e){var t=e.parentNode;return!!t&&(!!a.some(function(e){return e===t})||c(t))},d=function(e){var t=e.parentNode;if(!t)return!1;var n=mirror.getId(t);return!!i.some(function(e){return e.id===n})||d(t)};Array.from(s).forEach(function(e){c(e)||d(e)?a.push(e):o.push({parentId:mirror.getId(e.parentNode),previousId:e.previousSibling?mirror.getId(e.previousSibling):e.previousSibling,nextId:e.nextSibling?mirror.getId(e.nextSibling):e.nextSibling,node:serializeNodeWithId(e,document,mirror.map,!0)})}),e({texts:n.map(function(e){return{id:mirror.getId(e.node),value:e.value}}).filter(function(e){return mirror.has(e.id)}),attributes:r.map(function(e){return{id:mirror.getId(e.node),attributes:e.attributes}}).filter(function(e){return mirror.has(e.id)}),removes:i,adds:o})});return t.observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),t}function initMousemoveObserver(e){var t,n=[],r=throttle(function(){var r=Date.now()-t;e(n.map(function(e){return e.timeOffset-=r,e})),n=[],t=null},500);return on("mousemove",throttle(function(e){var i=e.clientX,o=e.clientY,a=e.target;t||(t=Date.now()),n.push({x:i,y:o,id:mirror.getId(a),timeOffset:Date.now()-t}),r()},20,{trailing:!1}))}function initMouseInteractionObserver(e){var t=[];return Object.keys(MouseInteractions).filter(function(e){return Number.isNaN(Number(e))}).forEach(function(n){var r=n.toLowerCase(),i=function(t){return function(n){var r=mirror.getId(n.target),i=n.clientX,o=n.clientY;e({type:MouseInteractions[t],id:r,x:i,y:o})}}(n);t.push(on(r,i))}),function(){t.forEach(function(e){return e()})}}function initScrollObserver(e){return on("scroll",throttle(function(t){if(t.target){var n=mirror.getId(t.target);t.target===document?e({id:n,x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop}):e({id:n,x:t.target.scrollLeft,y:t.target.scrollTop})}},100))}function initViewportResizeObserver(e){return on("resize",throttle(function(){var t=getWindowHeight(),n=getWindowWidth();e({width:Number(n),height:Number(t)})},200),window)}!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"}(EventType||(EventType={})),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"}(IncrementalSource||(IncrementalSource={})),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=8]="TouchMove",e[e.TouchEnd=9]="TouchEnd"}(MouseInteractions||(MouseInteractions={}));var INPUT_TAGS=["INPUT","TEXTAREA","SELECT"],HOOK_PROPERTIES=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"]],IGNORE_CLASS="rr-ignore",lastInputValueMap=new WeakMap;function initInputObserver(e){function t(e){var t=e.target;if(t&&t.tagName&&!(INPUT_TAGS.indexOf(t.tagName)<0)){var r=t.type;if("password"!==r&&!t.classList.contains(IGNORE_CLASS)){var i=t.value,o=!1;"radio"!==r&&"checkbox"!==r||(o=t.checked),n(t,{text:i,isChecked:o});var a=t.name;"radio"===r&&a&&o&&document.querySelectorAll('input[type="radio"][name="'+a+'"]').forEach(function(e){e!==t&&n(e,{text:e.value,isChecked:!o})})}}}function n(t,n){var r=lastInputValueMap.get(t);if(!r||r.text!==n.text||r.isChecked!==n.isChecked){lastInputValueMap.set(t,n);var i=mirror.getId(t);e(__assign({},n,{id:i}))}}var r=["input","change"].map(function(e){return on(e,t)}),i=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");return i&&i.set&&r.push.apply(r,HOOK_PROPERTIES.map(function(e){return hookSetter(e[0],e[1],{set:function(){t({target:this})}})})),function(){r.forEach(function(e){return e()})}}function initObservers(e){var t=initMutationObserver(e.mutationCb),n=initMousemoveObserver(e.mousemoveCb),r=initMouseInteractionObserver(e.mouseInteractionCb),i=initScrollObserver(e.scrollCb),o=initViewportResizeObserver(e.viewportResizeCb),a=initInputObserver(e.inputCb);return function(){t.disconnect(),n(),r(),i(),o(),a()}}function wrapEvent(e){return __assign({},e,{timestamp:Date.now()})}function record(e){void 0===e&&(e={});var t=e.emit;if(!t)throw new Error("emit function is required");try{var n=[];n.push(on("DOMContentLoaded",function(){t(wrapEvent({type:EventType.DomContentLoaded,data:{}}))}));var r=function(){t(wrapEvent({type:EventType.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}));var e=snapshot(document),r=e[0],i=e[1];if(!r)return console.warn("Failed to snapshot the document");mirror.map=i,t(wrapEvent({type:EventType.FullSnapshot,data:{node:r,initialOffset:{left:document.documentElement.scrollLeft,top:document.documentElement.scrollTop}}})),n.push(initObservers({mutationCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Mutation},e)}))},mousemoveCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:{source:IncrementalSource.MouseMove,positions:e}}))},mouseInteractionCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.MouseInteraction},e)}))},scrollCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Scroll},e)}))},viewportResizeCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.ViewportResize},e)}))},inputCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Input},e)}))}}))};return"interactive"===document.readyState||"complete"===document.readyState?r():n.push(on("load",function(){t(wrapEvent({type:EventType.Load,data:{}})),r()},window)),function(){n.forEach(function(e){return e()})}}catch(e){console.warn(e)}}function mitt(e){return e=e||Object.create(null),{on:function(t,n){(e[t]||(e[t]=[])).push(n)},off:function(t,n){e[t]&&e[t].splice(e[t].indexOf(n)>>>0,1)},emit:function(t,n){(e[t]||[]).slice().map(function(e){e(n)}),(e["*"]||[]).slice().map(function(e){e(t,n)})}}}var mittProxy=Object.freeze({default:mitt}),Timer=function(){function e(e,t){void 0===t&&(t=[]),this.actions=t,this.config=e}return e.prototype.addAction=function(e){var t=this.findActionIndex(e);this.actions.splice(t,0,e)},e.prototype.addActions=function(e){var t;(t=this.actions).push.apply(t,e)},e.prototype.start=function(){this.actions.sort(function(e,t){return e.delay-t.delay});var e=0,t=performance.now(),n=this.actions,r=this.config,i=this;this.raf=requestAnimationFrame(function o(a){for(e=a-t;n.length;){var s=n[0],u=s.delay/r.speed;if(!(e>=u))break;n.shift(),s.doAction()}n.length>0&&(i.raf=requestAnimationFrame(o))})},e.prototype.clear=function(){this.raf&&cancelAnimationFrame(this.raf),this.actions.length=0},e.prototype.findActionIndex=function(e){for(var t=0,n=this.actions.length-1;t<=n;){var r=Math.floor((t+n)/2);if(this.actions[r].delay<e.delay)t=r+1;else{if(!(this.actions[r].delay>e.delay))return r;n=r-1}}return t},e}(),rules=["iframe, .rr-block { background: #ccc }","noscript { display: none !important; }"],mitt$1=mitt||mittProxy,defaultConfig={speed:1,root:document.body,loadTimeout:0},Replayer=function(){function e(e,t){if(this.events=[],this.config=defaultConfig,this.emitter=mitt$1(),this.baselineTime=0,this.missingNodeRetryMap={},e.length<2)throw new Error("Replayer need at least 2 events.");this.events=e,this.handleResize=this.handleResize.bind(this),this.timer=new Timer(this.config),this.setConfig(Object.assign({},t)),this.setupDom(),this.emitter.on("resize",this.handleResize)}return 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]})},e.prototype.getMetaData=function(){var e=this.events[0];return{totalTime:this.events[this.events.length-1].timestamp-e.timestamp}},e.prototype.play=function(e){void 0===e&&(e=0),this.timer.clear(),this.baselineTime=this.events[0].timestamp+e;for(var t=new Array,n=0,r=this.events;n<r.length;n++){var i=r[n],o=i.timestamp<this.baselineTime,a=this.getCastFn(i,o);o?a():t.push({doAction:a,delay:this.getDelay(i)})}this.timer.addActions(t),this.timer.start()},e.prototype.pause=function(){this.timer.clear(),this.emitter.emit("pause")},e.prototype.resume=function(e){void 0===e&&(e=0),this.timer.clear(),this.baselineTime=this.events[0].timestamp+e;for(var t=new Array,n=0,r=this.events;n<r.length;n++){var i=r[n];if(!(i.timestamp<=this.lastPlayedEvent.timestamp||i===this.lastPlayedEvent)){var o=this.getCastFn(i);t.push({doAction:o,delay:this.getDelay(i)})}}this.timer.addActions(t),this.timer.start(),this.emitter.emit("resume")},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),this.iframe=document.createElement("iframe"),this.iframe.setAttribute("sandbox","allow-same-origin"),this.wrapper.appendChild(this.iframe)},e.prototype.handleResize=function(e){this.iframe.width=e.width+"px",this.iframe.height=e.height+"px"},e.prototype.getDelay=function(e){if(e.type===EventType.IncrementalSnapshot&&e.data.source===IncrementalSource.MouseMove){var t=e.data.positions[0].timeOffset;return e.timestamp+t-this.baselineTime}return e.timestamp-this.baselineTime},e.prototype.getCastFn=function(e,t){var n,r=this;switch(void 0===t&&(t=!1),e.type){case EventType.DomContentLoaded:case EventType.Load:break;case EventType.Meta:n=function(){return r.emitter.emit("resize",{width:e.data.width,height:e.data.height})};break;case EventType.FullSnapshot:n=function(){r.rebuildFullSnapshot(e),r.iframe.contentWindow.scrollTo(e.data.initialOffset)};break;case EventType.IncrementalSnapshot:n=function(){r.applyIncremental(e,t)}}return function(){n&&n(),r.lastPlayedEvent=e,e===r.events[r.events.length-1]&&r.emitter.emit("finish")}},e.prototype.rebuildFullSnapshot=function(e){Object.keys(this.missingNodeRetryMap).length&&console.warn("Found unresolved missing node map",this.missingNodeRetryMap),this.missingNodeRetryMap={},mirror.map=rebuild(e.data.node,this.iframe.contentDocument)[1];var t=document.createElement("style"),n=this.iframe.contentDocument,r=n.documentElement,i=n.head;r.insertBefore(t,i);for(var o=0;o<rules.length;o++)t.sheet.insertRule(rules[o],o);this.waitForStylesheetLoad()},e.prototype.waitForStylesheetLoad=function(){var e=this,t=this.iframe.contentDocument.head;if(t){var n,r=new Set;t.querySelectorAll('link[rel="stylesheet"]').forEach(function(t){t.sheet||(0===r.size&&(e.pause(),e.emitter.emit("wait-stylesheet"),n=window.setTimeout(function(){e.resume(),n=-1},e.config.loadTimeout)),r.add(t),t.addEventListener("load",function(){r.delete(t),0===r.size&&-1!==n&&(e.resume(),e.emitter.emit("stylesheet-loaded"),n&&window.clearTimeout(n))}))})}},e.prototype.applyIncremental=function(e,t){var n=this,r=e.data;switch(r.source){case IncrementalSource.Mutation:r.removes.forEach(function(e){var t=mirror.getNode(e.id);if(t){var n=mirror.getNode(e.parentId);mirror.removeNodeFromMap(t),n&&n.removeChild(t)}});var i=__assign({},this.missingNodeRetryMap);r.adds.forEach(function(e){var t=buildNodeWithSN(e.node,n.iframe.contentDocument,mirror.map,!0),r=mirror.getNode(e.parentId),o=null,a=null;e.previousId&&(o=mirror.getNode(e.previousId)),e.nextId&&(a=mirror.getNode(e.nextId)),-1!==e.previousId&&-1!==e.nextId?(o&&o.nextSibling&&o.nextSibling.parentNode?r.insertBefore(t,o.nextSibling):a&&a.parentNode?r.insertBefore(t,a):r.appendChild(t),(e.previousId||e.nextId)&&n.resolveMissingNode(i,r,t,e)):i[e.node.id]={node:t,mutation:e}}),Object.keys(i).length&&Object.assign(this.missingNodeRetryMap,i),r.texts.forEach(function(e){mirror.getNode(e.id).textContent=e.value}),r.attributes.forEach(function(e){var t=mirror.getNode(e.id);for(var n in e.attributes)if("string"==typeof n){var r=e.attributes[n];r?t.setAttribute(n,r):t.removeAttribute(n)}});break;case IncrementalSource.MouseMove:t||r.positions.forEach(function(t){var r={doAction:function(){n.mouse.style.left=t.x+"px",n.mouse.style.top=t.y+"px";var e=mirror.getNode(t.id);e&&n.hoverElements(e)},delay:t.timeOffset+e.timestamp-n.baselineTime};n.timer.addAction(r)});break;case IncrementalSource.MouseInteraction:if(-1===r.id)break;var o=new Event(MouseInteractions[r.type].toLowerCase()),a=mirror.getNode(r.id);switch(r.type){case MouseInteractions.Blur:a.blur();break;case MouseInteractions.Focus:a.focus({preventScroll:!0});break;case MouseInteractions.Click:t||(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active"));break;default:a.dispatchEvent(o)}break;case IncrementalSource.Scroll:if(-1===r.id)break;if((a=mirror.getNode(r.id))===this.iframe.contentDocument)this.iframe.contentWindow.scrollTo({top:r.y,left:r.x,behavior:t?"instant":"smooth"});else try{a.scrollTop=r.y,a.scrollLeft=r.x}catch(e){}break;case IncrementalSource.ViewportResize:this.emitter.emit("resize",{width:r.width,height:r.height});break;case IncrementalSource.Input:if(-1===r.id)break;(a=mirror.getNode(r.id)).checked=r.isChecked,a.value=r.text}},e.prototype.resolveMissingNode=function(e,t,n,r){var i=r.previousId,o=r.nextId,a=i&&e[i],s=o&&e[o];if(a){var u=a,c=u.node,d=u.mutation;t.insertBefore(c,n),delete e[d.node.id],delete this.missingNodeRetryMap[d.node.id],(d.previousId||d.nextId)&&this.resolveMissingNode(e,t,c,d)}if(s){var l=s;c=l.node,d=l.mutation;t.insertBefore(c,n.nextSibling),delete e[d.node.id],delete this.missingNodeRetryMap[d.node.id],(d.previousId||d.nextId)&&this.resolveMissingNode(e,t,c,d)}},e.prototype.hoverElements=function(e){this.iframe.contentDocument.querySelectorAll(".\\:hover").forEach(function(e){e.classList.remove(":hover")});for(var t=e;t;)t.classList.add(":hover"),t=t.parentElement},e}();export{record,Replayer,mirror};
//# sourceMappingURL=rrweb.min.js.map

@@ -428,7 +428,25 @@ 'use strict';

});
var isDropped = function (n) {
var parentNode = n.parentNode;
if (!parentNode) {
return false;
}
if (dropped.some(function (d) { return d === parentNode; })) {
return true;
}
return isDropped(parentNode);
};
var isRemoved = function (n) {
var parentNode = n.parentNode;
if (!parentNode) {
return false;
}
var parentId = mirror.getId(parentNode);
if (removes.some(function (r) { return r.id === parentId; })) {
return true;
}
return isRemoved(parentNode);
};
Array.from(addsSet).forEach(function (n) {
var parentId = mirror.getId(n.parentNode);
if (parentId &&
!dropped.some(function (d) { return d === n.parentNode; }) &&
!removes.some(function (r) { return r.id === parentId; })) {
if (!isDropped(n) && !isRemoved(n)) {
adds.push({

@@ -435,0 +453,0 @@ parentId: mirror.getId(n.parentNode),

@@ -544,7 +544,25 @@ 'use strict';

});
var isDropped = function (n) {
var parentNode = n.parentNode;
if (!parentNode) {
return false;
}
if (dropped.some(function (d) { return d === parentNode; })) {
return true;
}
return isDropped(parentNode);
};
var isRemoved = function (n) {
var parentNode = n.parentNode;
if (!parentNode) {
return false;
}
var parentId = mirror.getId(parentNode);
if (removes.some(function (r) { return r.id === parentId; })) {
return true;
}
return isRemoved(parentNode);
};
Array.from(addsSet).forEach(function (n) {
var parentId = mirror.getId(n.parentNode);
if (parentId &&
!dropped.some(function (d) { return d === n.parentNode; }) &&
!removes.some(function (r) { return r.id === parentId; })) {
if (!isDropped(n) && !isRemoved(n)) {
adds.push({

@@ -1020,2 +1038,3 @@ parentId: mirror.getId(n.parentNode),

this.baselineTime = 0;
this.missingNodeRetryMap = {};
if (events.length < 2) {

@@ -1149,2 +1168,5 @@ throw new Error('Replayer need at least 2 events.');

_this.lastPlayedEvent = event;
if (event === _this.events[_this.events.length - 1]) {
_this.emitter.emit('finish');
}
};

@@ -1154,2 +1176,6 @@ return wrappedCastFn;

Replayer.prototype.rebuildFullSnapshot = function (event) {
if (Object.keys(this.missingNodeRetryMap).length) {
console.warn('Found unresolved missing node map', this.missingNodeRetryMap);
}
this.missingNodeRetryMap = {};
mirror.map = rebuild(event.data.node, this.iframe.contentDocument)[1];

@@ -1213,3 +1239,3 @@ var styleEl = document.createElement('style');

});
var missingNodeMap_1 = {};
var missingNodeMap_1 = __assign({}, this.missingNodeRetryMap);
d.adds.forEach(function (mutation) {

@@ -1249,3 +1275,3 @@ var target = buildNodeWithSN(mutation.node, _this.iframe.contentDocument, mirror.map, true);

if (Object.keys(missingNodeMap_1).length) {
console.warn('Found unresolved missing node map', missingNodeMap_1);
Object.assign(this.missingNodeRetryMap, missingNodeMap_1);
}

@@ -1330,4 +1356,8 @@ d.texts.forEach(function (mutation) {

else {
target.scrollTop = d.y;
target.scrollLeft = d.x;
try {
target.scrollTop = d.y;
target.scrollLeft = d.x;
}
catch (error) {
}
}

@@ -1358,11 +1388,16 @@ break;

var nextInMap = nextId && map[nextId];
if (previousInMap || nextInMap) {
var _a = (previousInMap || nextInMap), node = _a.node, mutation = _a.mutation;
if (previousInMap) {
parent.insertBefore(node, target);
if (previousInMap) {
var _a = previousInMap, node = _a.node, mutation = _a.mutation;
parent.insertBefore(node, target);
delete map[mutation.node.id];
delete this.missingNodeRetryMap[mutation.node.id];
if (mutation.previousId || mutation.nextId) {
this.resolveMissingNode(map, parent, node, mutation);
}
else {
parent.insertBefore(node, target.nextSibling);
}
}
if (nextInMap) {
var _b = nextInMap, node = _b.node, mutation = _b.mutation;
parent.insertBefore(node, target.nextSibling);
delete map[mutation.node.id];
delete this.missingNodeRetryMap[mutation.node.id];
if (mutation.previousId || mutation.nextId) {

@@ -1369,0 +1404,0 @@ this.resolveMissingNode(map, parent, node, mutation);

{
"name": "rrweb",
"version": "0.6.7",
"version": "0.6.8",
"description": "record and replay the web",

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

# rrweb
rrweb 是 'record and replay the web' 的简写,旨在利用现代浏览器所提供的强大 API 录制并回放任意 web 界面中的用户操作。
[![Build Status](https://travis-ci.org/rrweb-io/rrweb.svg?branch=master)](https://travis-ci.org/rrweb-io/rrweb)
**目前 rrweb 已经解决了许多录制与回放中的难点问题,但在 1.0 版本 release 之前数据结构仍有可能发生变化,请谨慎用于生产环境中。**
[中文文档](./README.zh_CN.md)
## 项目结构
rrweb means 'record and replay the web', which is a tool for recording and replaying users' interactions on the web.
rrweb 主要由 3 部分组成:
**Currently, rrweb has already solved many difficult problems in recording and replaying, but the data structure may still be changed before the release of version 1.0. So please be cautious to use rrweb in the production environment.**
- **[rrweb-snapshot](https://github.com/rrweb-io/rrweb-snapshot)**,包含 snapshot 和 rebuild 两个功能。snapshot 用于将 DOM 及其状态转化为可序列化的数据结构并添加唯一标识;rebuild 则是将 snapshot 记录的数据结构重建为对应的 DOM。
- **[rrweb](https://github.com/rrweb-io/rrweb)**,包含 record 和 replay 两个功能。record 用于记录 DOM 中的所有变更(mutation);replay 则是将记录的变更按照对应的时间一一重放。
- **[rrweb-player](https://github.com/rrweb-io/rrweb-player)**,为 rrweb player 提供一套 UI 控件,提供基于 GUI 的暂停、快进、拖拽至任意时间点播放等功能。
## Project structure
rrweb is mainly composed of 3 parts:
- **[rrweb-snapshot](https://github.com/rrweb-io/rrweb-snapshot)**, including both snapshot and rebuild features. The snapshot is used to convert the DOM and its state into a serializable data structure with a unique identifier; the rebuild is to rebuild the snapshot into corresponding DOM.
- **[rrweb](https://github.com/rrweb-io/rrweb)**, including two functions, record and replay. The record function is used to record all the mutations in the DOM; the replay is to replay the recorded mutations one by one according to the corresponding timestamp.
- **[rrweb-player](https://github.com/rrweb-io/rrweb-player)**, is a player UI for rrweb, providing GUI-based functions like pause, fast-forward, drag and drop to play at any time.
## Roadmap
- rrweb
- 处理跨域请求错误
- 转移至 web worker 中执行
- 实现传输数据压缩
- 验证移动端录制效果
- handling cross-domain request errors
- record in web worker
- implement transmission data compression
- verify recording in mobile browser
- rrweb-player
- 改进播放器 UI 样式
- 实现高效的进度条拖拽功能
- 增加全屏模式
- implement efficient progress bar drag and drop control
- add full screen mode
- extensions
- 劫持 console API,记录对应的事件
- 劫持 Ajax/fetch API,记录请求事件
- 封装 TraceKit,记录异常事件
- 测试
- 补充更多单元测试
- 随机在更多网站上运行集成测试
- hijack the console API and record corresponding events
- hijack Ajax/fetch API and record request events
- use TraceKit to log exception events
## Internal Design
- [序列化](./docs/serialization.md)
- [增量快照](./docs/observer.md)
- [回放](./docs/replay.md)
- [沙盒](./docs/sandbox.md)
- [serialization](./docs/serialization.md)
- [incremental snapshot](./docs/observer.md)
- [replay](./docs/replay.md)
- [sandbox](./docs/sandbox.md)
## Contribute Guide
为了保证录制和回放时可以对应到一致的数据结构,rrweb 采用 typescript 开发以提供更强的类型支持。
Since we want the record and replay sides can share a strongly typed data structure, rrweb is developed with typescript which provide stronger type support.
[Typescript 手册](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html)
[Typescript handbook](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html)
1. Fork 需要修改的 rrweb 组件仓库
2. `npm install` 安装所需依赖
3. 修改代码并通过测试
4. 提交代码,创建 pull request
1. Fork the rrweb component repository you want to patch.
2. Run `npm install` to install required dependencies.
3. Patch the code and pass all the tests.
4. Push the code and create a pull request.
除了添加集成测试和单元测试之外,rrweb 还提供了交互式的测试工具。
In addition to adding integration tests and unit tests, rrweb also provides a REPL testing tool.
运行 `npm run repl`,将会启动浏览器并在命令行要求输入一个测试的 url:
Run `npm run repl` will launch a browser and ask for a URL you want to test on the CLI:

@@ -60,3 +60,3 @@ ```

输入后等待浏览器打开指定页面,并在命令行中出现以下提示信息:
Waiting for the browser to open the specified page and print following messages on the CLI:

@@ -70,5 +70,5 @@ ```

此时可以在页面中进行交互,待所需录制操作完成后,在命令行输入 y,测试工具就会将刚刚的操作进行回放,用于验证录制是否成功。
At this point, you can interact in the web page. After the desired operations has been recorded, enter 'y' on the CLI, and the test tool will replay the operations to verify whether the recording was successful.
回放时命令行中将出现以下提示信息:
The following messages will be printed on the CLI during replay:

@@ -79,3 +79,3 @@ ```

此时可以再次在命令行中输入 y,测试工具将把已录制的内容存入一个静态 HTML 文件中,并提示存放位置:
At this point, you can enter 'y' again on the CLI. The test tool will save the recorded session into a static HTML file and prompt for the location:

@@ -86,2 +86,2 @@ ```

该文件默认使用最新 bundle 的 rrweb 代码,所以我们可以在修改代码后运行 `npm run bundle:browser`,之后刷新静态文件就可以查看最新代码对回放的影响并进行调试。
This file use the latest rrweb bundle code, so we can run `npm run bundle:browser` after patching the code, then refresh the static file to see and debug the impact of the latest code on replay.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc