Socket
Socket
Sign inDemoInstall

rrweb

Package Overview
Dependencies
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rrweb - npm Package Compare versions

Comparing version 0.7.33 to 0.8.0

dist/record/rrweb-record-pack.js

333

dist/record/rrweb-record.js

@@ -75,3 +75,3 @@ var rrwebRecord = (function () {

var _id = 1;
var symbolAndNumberRegex = RegExp('[^a-z1-6]');
var symbolAndNumberRegex = RegExp('[^a-z1-6\-]');
function genId() {

@@ -432,5 +432,6 @@ return _id++;

}
function hookSetter(target, key, d, isRevoked) {
var original = Object.getOwnPropertyDescriptor(target, key);
Object.defineProperty(target, key, isRevoked
function hookSetter(target, key, d, isRevoked, win) {
if (win === void 0) { win = window; }
var original = win.Object.getOwnPropertyDescriptor(target, key);
win.Object.defineProperty(target, key, isRevoked
? d

@@ -557,30 +558,5 @@ : {

ReplayerEvents["EventCast"] = "event-cast";
ReplayerEvents["CustomEvent"] = "custom-event";
})(ReplayerEvents || (ReplayerEvents = {}));
function deepDelete(addsSet, n) {
addsSet.delete(n);
n.childNodes.forEach(function (childN) { return deepDelete(addsSet, childN); });
}
function isParentRemoved(removes, 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 isParentRemoved(removes, parentNode);
}
function isAncestorInSet(set, n) {
var parentNode = n.parentNode;
if (!parentNode) {
return false;
}
if (set.has(parentNode)) {
return true;
}
return isAncestorInSet(set, parentNode);
}
var moveKey = function (id, parentId) { return id + "@" + parentId; };

@@ -590,42 +566,80 @@ function isINode(n) {

}
function initMutationObserver(cb, blockClass, inlineStylesheet, maskAllInputs) {
var observer = new MutationObserver(function (mutations) {
var e_1, _a, e_2, _b;
var texts = [];
var attributes = [];
var removes = [];
var adds = [];
var addedSet = new Set();
var movedSet = new Set();
var droppedSet = new Set();
var movedMap = {};
var genAdds = function (n, target) {
if (isBlocked(n, blockClass)) {
return;
var MutationBuffer = (function () {
function MutationBuffer(cb, blockClass, inlineStylesheet, maskAllInputs) {
var _this = this;
this.texts = [];
this.attributes = [];
this.removes = [];
this.adds = [];
this.movedMap = {};
this.addedSet = new Set();
this.movedSet = new Set();
this.droppedSet = new Set();
this.processMutations = function (mutations) {
var e_1, _a, e_2, _b;
mutations.forEach(_this.processMutation);
var addQueue = [];
var pushAdd = function (n) {
var parentId = mirror.getId(n.parentNode);
var nextId = n.nextSibling && mirror.getId(n.nextSibling);
if (parentId === -1 || nextId === -1) {
return addQueue.push(n);
}
_this.adds.push({
parentId: parentId,
nextId: nextId,
node: serializeNodeWithId(n, document, mirror.map, _this.blockClass, true, _this.inlineStylesheet, _this.maskAllInputs),
});
};
try {
for (var _c = __values(_this.movedSet), _d = _c.next(); !_d.done; _d = _c.next()) {
var n = _d.value;
pushAdd(n);
}
}
if (isINode(n)) {
movedSet.add(n);
var targetId = null;
if (target && isINode(target)) {
targetId = target.__sn.id;
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
}
if (targetId) {
movedMap[moveKey(n.__sn.id, targetId)] = true;
finally { if (e_1) throw e_1.error; }
}
try {
for (var _e = __values(_this.addedSet), _f = _e.next(); !_f.done; _f = _e.next()) {
var n = _f.value;
if (!isAncestorInSet(_this.droppedSet, n) &&
!isParentRemoved(_this.removes, n)) {
pushAdd(n);
}
else if (isAncestorInSet(_this.movedSet, n)) {
pushAdd(n);
}
else {
_this.droppedSet.add(n);
}
}
}
else {
addedSet.add(n);
droppedSet.delete(n);
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
}
finally { if (e_2) throw e_2.error; }
}
n.childNodes.forEach(function (childN) { return genAdds(childN); });
while (addQueue.length) {
if (addQueue.every(function (n) { return mirror.getId(n.parentNode) === -1; })) {
break;
}
pushAdd(addQueue.shift());
}
_this.emit();
};
mutations.forEach(function (mutation) {
var type = mutation.type, target = mutation.target, oldValue = mutation.oldValue, addedNodes = mutation.addedNodes, removedNodes = mutation.removedNodes, attributeName = mutation.attributeName;
switch (type) {
this.processMutation = function (m) {
switch (m.type) {
case 'characterData': {
var value = target.textContent;
if (!isBlocked(target, blockClass) && value !== oldValue) {
texts.push({
var value = m.target.textContent;
if (!isBlocked(m.target, _this.blockClass) && value !== m.oldValue) {
_this.texts.push({
value: value,
node: target,
node: m.target,
});

@@ -636,36 +650,37 @@ }

case 'attributes': {
var value = target.getAttribute(attributeName);
if (isBlocked(target, blockClass) || value === oldValue) {
var value = m.target.getAttribute(m.attributeName);
if (isBlocked(m.target, _this.blockClass) || value === m.oldValue) {
return;
}
var item = attributes.find(function (a) { return a.node === target; });
var item = _this.attributes.find(function (a) { return a.node === m.target; });
if (!item) {
item = {
node: target,
node: m.target,
attributes: {},
};
attributes.push(item);
_this.attributes.push(item);
}
item.attributes[attributeName] = transformAttribute(document, attributeName, value);
item.attributes[m.attributeName] = transformAttribute(document, m.attributeName, value);
break;
}
case 'childList': {
addedNodes.forEach(function (n) { return genAdds(n, target); });
removedNodes.forEach(function (n) {
m.addedNodes.forEach(function (n) { return _this.genAdds(n, m.target); });
m.removedNodes.forEach(function (n) {
var nodeId = mirror.getId(n);
var parentId = mirror.getId(target);
if (isBlocked(n, blockClass)) {
var parentId = mirror.getId(m.target);
if (isBlocked(n, _this.blockClass)) {
return;
}
if (addedSet.has(n)) {
deepDelete(addedSet, n);
droppedSet.add(n);
if (_this.addedSet.has(n)) {
deepDelete(_this.addedSet, n);
_this.droppedSet.add(n);
}
else if (addedSet.has(target) && nodeId === -1) ;
else if (isAncestorRemoved(target)) ;
else if (movedSet.has(n) && movedMap[moveKey(nodeId, parentId)]) {
deepDelete(movedSet, n);
else if (_this.addedSet.has(m.target) && nodeId === -1) ;
else if (isAncestorRemoved(m.target)) ;
else if (_this.movedSet.has(n) &&
_this.movedMap[moveKey(nodeId, parentId)]) {
deepDelete(_this.movedSet, n);
}
else {
removes.push({
_this.removes.push({
parentId: parentId,

@@ -680,84 +695,92 @@ id: nodeId,

}
});
var addQueue = [];
var pushAdd = function (n) {
var parentId = mirror.getId(n.parentNode);
if (parentId === -1) {
return addQueue.push(n);
}
adds.push({
parentId: parentId,
previousId: !n.previousSibling
? n.previousSibling
: mirror.getId(n.previousSibling),
nextId: !n.nextSibling
? n.nextSibling
: mirror.getId(n.nextSibling),
node: serializeNodeWithId(n, document, mirror.map, blockClass, true, inlineStylesheet, maskAllInputs),
});
};
try {
for (var movedSet_1 = __values(movedSet), movedSet_1_1 = movedSet_1.next(); !movedSet_1_1.done; movedSet_1_1 = movedSet_1.next()) {
var n = movedSet_1_1.value;
pushAdd(n);
this.genAdds = function (n, target) {
if (isBlocked(n, _this.blockClass)) {
return;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (movedSet_1_1 && !movedSet_1_1.done && (_a = movedSet_1.return)) _a.call(movedSet_1);
}
finally { if (e_1) throw e_1.error; }
}
try {
for (var addedSet_1 = __values(addedSet), addedSet_1_1 = addedSet_1.next(); !addedSet_1_1.done; addedSet_1_1 = addedSet_1.next()) {
var n = addedSet_1_1.value;
if (!isAncestorInSet(droppedSet, n) && !isParentRemoved(removes, n)) {
pushAdd(n);
if (isINode(n)) {
_this.movedSet.add(n);
var targetId = null;
if (target && isINode(target)) {
targetId = target.__sn.id;
}
else if (isAncestorInSet(movedSet, n)) {
pushAdd(n);
if (targetId) {
_this.movedMap[moveKey(n.__sn.id, targetId)] = true;
}
else {
droppedSet.add(n);
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (addedSet_1_1 && !addedSet_1_1.done && (_b = addedSet_1.return)) _b.call(addedSet_1);
else {
_this.addedSet.add(n);
_this.droppedSet.delete(n);
}
finally { if (e_2) throw e_2.error; }
}
while (addQueue.length) {
if (addQueue.every(function (n) { return mirror.getId(n.parentNode) === -1; })) {
break;
n.childNodes.forEach(function (childN) { return _this.genAdds(childN); });
};
this.emit = function () {
var payload = {
texts: _this.texts
.map(function (text) { return ({
id: mirror.getId(text.node),
value: text.value,
}); })
.filter(function (text) { return mirror.has(text.id); }),
attributes: _this.attributes
.map(function (attribute) { return ({
id: mirror.getId(attribute.node),
attributes: attribute.attributes,
}); })
.filter(function (attribute) { return mirror.has(attribute.id); }),
removes: _this.removes,
adds: _this.adds,
};
if (!payload.texts.length &&
!payload.attributes.length &&
!payload.removes.length &&
!payload.adds.length) {
return;
}
pushAdd(addQueue.shift());
}
var payload = {
texts: texts
.map(function (text) { return ({
id: mirror.getId(text.node),
value: text.value,
}); })
.filter(function (text) { return mirror.has(text.id); }),
attributes: attributes
.map(function (attribute) { return ({
id: mirror.getId(attribute.node),
attributes: attribute.attributes,
}); })
.filter(function (attribute) { return mirror.has(attribute.id); }),
removes: removes,
adds: adds,
_this.emissionCallback(payload);
_this.texts = [];
_this.attributes = [];
_this.removes = [];
_this.adds = [];
_this.addedSet = new Set();
_this.movedSet = new Set();
_this.droppedSet = new Set();
_this.movedMap = {};
};
if (!payload.texts.length &&
!payload.attributes.length &&
!payload.removes.length &&
!payload.adds.length) {
return;
}
cb(payload);
});
this.blockClass = blockClass;
this.inlineStylesheet = inlineStylesheet;
this.maskAllInputs = maskAllInputs;
this.emissionCallback = cb;
}
return MutationBuffer;
}());
function deepDelete(addsSet, n) {
addsSet.delete(n);
n.childNodes.forEach(function (childN) { return deepDelete(addsSet, childN); });
}
function isParentRemoved(removes, 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 isParentRemoved(removes, parentNode);
}
function isAncestorInSet(set, n) {
var parentNode = n.parentNode;
if (!parentNode) {
return false;
}
if (set.has(parentNode)) {
return true;
}
return isAncestorInSet(set, parentNode);
}
function initMutationObserver(cb, blockClass, inlineStylesheet, maskAllInputs) {
var mutationBuffer = new MutationBuffer(cb, blockClass, inlineStylesheet, maskAllInputs);
var observer = new MutationObserver(mutationBuffer.processMutations);
observer.observe(document, {

@@ -1145,4 +1168,4 @@ attributes: true,

function takeFullSnapshot(isCheckout) {
var _a, _b, _c, _d;
if (isCheckout === void 0) { isCheckout = false; }
var _a, _b, _c, _d;
wrappedEmit(wrapEvent({

@@ -1149,0 +1172,0 @@ type: EventType.Meta,

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

var rrwebRecord=function(){"use strict";var e,t=function(){return(t=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function n(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function o(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i}function r(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(o(arguments[t]));return e}!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(e||(e={}));var a=1,i=RegExp("[^a-z1-6]");function u(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).reduce(function(e,t){return e+(function(e){return"styleSheet"in e}(n=t)?u(n.styleSheet)||"":n.cssText);var n},""):null}catch(e){return null}}var c=/url\((?:'([^']*)'|"([^"]*)"|([^)]*))\)/gm,l=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/,s=/^(data:)([\w\/\+\-]+);(charset=[\w-]+|base64).*,(.*)/i;function d(e,t){return(e||"").replace(c,function(e,n,o,r){var a,i=n||o||r;if(!i)return e;if(!l.test(i))return"url('"+i+"')";if(s.test(i))return"url("+i+")";if("/"===i[0])return"url('"+(((a=t).indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+i)+"')";var u=t.split("/"),c=i.split("/");u.pop();for(var d=0,p=c;d<p.length;d++){var f=p[d];"."!==f&&(".."===f?u.pop():u.push(f))}return"url('"+u.join("/")+"')"})}function p(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function f(e,t,n){return"src"===t||"href"===t&&n?p(e,n):"srcset"===t&&n?function(e,t){return""===t.trim()?t:t.split(",").map(function(t){var n=t.trimLeft().trimRight().split(" ");return 2===n.length?p(e,n[0])+" "+n[1]:1===n.length?""+p(e,n[0]):""}).join(",")}(e,n):"style"===t&&n?d(n,location.href):n}function m(t,n,o,r,a){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:var c=!1;"string"==typeof o?c=t.classList.contains(o):t.classList.forEach(function(e){o.test(e)&&(c=!0)});for(var l=function(e){var t=e.toLowerCase().trim();return i.test(t)?"div":t}(t.tagName),s={},p=0,m=Array.from(t.attributes);p<m.length;p++){var v=m[p],h=v.name,y=v.value;s[h]=f(n,h,y)}if("link"===l&&r){var g,b=Array.from(n.styleSheets).find(function(e){return e.href===t.href});(g=u(b))&&(delete s.rel,delete s.href,s._cssText=d(g,b.href))}if("style"===l&&t.sheet&&!(t.innerText||t.textContent||"").trim().length)(g=u(t.sheet))&&(s._cssText=d(g,location.href));if("input"===l||"textarea"===l||"select"===l){y=t.value;"radio"!==s.type&&"checkbox"!==s.type&&y?s.value=a?"*".repeat(y.length):y:t.checked&&(s.checked=t.checked)}if("option"===l){var S=t.parentElement;s.value===S.value&&(s.selected=t.selected)}if("canvas"===l&&(s.rr_dataURL=t.toDataURL()),"audio"!==l&&"video"!==l||(s.rr_mediaState=t.paused?"paused":"played"),c){var C=t.getBoundingClientRect(),E=C.width,w=C.height;s.rr_width=E+"px",s.rr_height=w+"px"}return{type:e.Element,tagName:l,attributes:s,childNodes:[],isSVG:(x=t,"svg"===x.tagName||x instanceof SVGElement||void 0),needBlock:c};case t.TEXT_NODE:var I=t.parentNode&&t.parentNode.tagName,N=t.textContent,T="STYLE"===I||void 0;return T&&N&&(N=d(N,location.href)),"SCRIPT"===I&&(N="SCRIPT_PLACEHOLDER"),{type:e.Text,textContent:N||"",isStyle:T};case t.CDATA_SECTION_NODE:return{type:e.CDATA,textContent:""};case t.COMMENT_NODE:return{type:e.Comment,textContent:t.textContent||""};default:return!1}var x}function v(t,n,o,r,i,u,c){void 0===i&&(i=!1),void 0===u&&(u=!0),void 0===c&&(c=!1);var l,s=m(t,n,r,u,c);if(!s)return console.warn(t,"not serialized"),null;l="__sn"in t?t.__sn.id:a++;var d=Object.assign(s,{id:l});t.__sn=d,o[l]=t;var p=!i;if(d.type===e.Element&&(p=p&&!d.needBlock,delete d.needBlock),(d.type===e.Document||d.type===e.Element)&&p)for(var f=0,h=Array.from(t.childNodes);f<h.length;f++){var y=v(h[f],n,o,r,i,u,c);y&&d.childNodes.push(y)}return d}function h(e,t,n){void 0===n&&(n=document);var o={capture:!0,passive:!0};return n.addEventListener(e,t,o),function(){return n.removeEventListener(e,t,o)}}var y,g,b,S,C,E={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return E.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete E.map[t],e.childNodes&&e.childNodes.forEach(function(e){return E.removeNodeFromMap(e)})},has:function(e){return E.map.hasOwnProperty(e)}};function w(e,t,n){void 0===n&&(n={});var o=null,r=0;return function(a){var i=Date.now();r||!1!==n.leading||(r=i);var u=t-(i-r),c=this,l=arguments;u<=0||u>t?(o&&(window.clearTimeout(o),o=null),r=i,e.apply(c,l)):o||!1===n.trailing||(o=window.setTimeout(function(){r=!1===n.leading?0:Date.now(),o=null,e.apply(c,l)},u))}}function I(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function N(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function T(e,t){if(!e)return!1;if(e.nodeType===e.ELEMENT_NODE){var n=!1;return"string"==typeof t?n=e.classList.contains(t):e.classList.forEach(function(e){t.test(e)&&(n=!0)}),n||T(e.parentNode,t)}return T(e.parentNode,t)}function x(e){return Boolean(e.changedTouches)}function M(e,t){e.delete(t),t.childNodes.forEach(function(t){return M(e,t)})}function D(e,t){var n=t.parentNode;if(!n)return!1;var o=E.getId(n);return!!e.some(function(e){return e.id===o})||D(e,n)}function k(e,t){var n=t.parentNode;return!!n&&(!!e.has(n)||k(e,n))}!function(e){e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom"}(y||(y={})),function(e){e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule"}(g||(g={})),function(e){e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd"}(b||(b={})),function(e){e[e.Play=0]="Play",e[e.Pause=1]="Pause"}(S||(S={})),function(e){e.Start="start",e.Pause="pause",e.Resume="resume",e.Resize="resize",e.Finish="finish",e.FullsnapshotRebuilded="fullsnapshot-rebuilded",e.LoadStylesheetStart="load-stylesheet-start",e.LoadStylesheetEnd="load-stylesheet-end",e.SkipStart="skip-start",e.SkipEnd="skip-end",e.MouseInteraction="mouse-interaction",e.EventCast="event-cast"}(C||(C={}));var L=function(e,t){return e+"@"+t};function _(e){return"__sn"in e}function R(e,t,o,r){var a=new MutationObserver(function(a){var i,u,c,l,s=[],d=[],p=[],m=[],h=new Set,y=new Set,g=new Set,b={},S=function(e,n){if(!T(e,t)){if(_(e)){y.add(e);var o=null;n&&_(n)&&(o=n.__sn.id),o&&(b[L(e.__sn.id,o)]=!0)}else h.add(e),g.delete(e);e.childNodes.forEach(function(e){return S(e)})}};a.forEach(function(e){var n=e.type,o=e.target,r=e.oldValue,a=e.addedNodes,i=e.removedNodes,u=e.attributeName;switch(n){case"characterData":var c=o.textContent;T(o,t)||c===r||s.push({value:c,node:o});break;case"attributes":c=o.getAttribute(u);if(T(o,t)||c===r)return;var l=d.find(function(e){return e.node===o});l||(l={node:o,attributes:{}},d.push(l)),l.attributes[u]=f(document,u,c);break;case"childList":a.forEach(function(e){return S(e,o)}),i.forEach(function(e){var n=E.getId(e),r=E.getId(o);T(e,t)||(h.has(e)?(M(h,e),g.add(e)):h.has(o)&&-1===n||function e(t){var n=E.getId(t);return!E.has(n)||(!t.parentNode||t.parentNode.nodeType!==t.DOCUMENT_NODE)&&(!t.parentNode||e(t.parentNode))}(o)||(y.has(e)&&b[L(n,r)]?M(y,e):p.push({parentId:r,id:n})),E.removeNodeFromMap(e))})}});var C=[],w=function(e){var n=E.getId(e.parentNode);if(-1===n)return C.push(e);m.push({parentId:n,previousId:e.previousSibling?E.getId(e.previousSibling):e.previousSibling,nextId:e.nextSibling?E.getId(e.nextSibling):e.nextSibling,node:v(e,document,E.map,t,!0,o,r)})};try{for(var I=n(y),N=I.next();!N.done;N=I.next()){w(O=N.value)}}catch(e){i={error:e}}finally{try{N&&!N.done&&(u=I.return)&&u.call(I)}finally{if(i)throw i.error}}try{for(var x=n(h),R=x.next();!R.done;R=x.next()){var O=R.value;k(g,O)||D(p,O)?k(y,O)?w(O):g.add(O):w(O)}}catch(e){c={error:e}}finally{try{R&&!R.done&&(l=x.return)&&l.call(x)}finally{if(c)throw c.error}}for(;C.length&&!C.every(function(e){return-1===E.getId(e.parentNode)});)w(C.shift());var A={texts:s.map(function(e){return{id:E.getId(e.node),value:e.value}}).filter(function(e){return E.has(e.id)}),attributes:d.map(function(e){return{id:E.getId(e.node),attributes:e.attributes}}).filter(function(e){return E.has(e.id)}),removes:p,adds:m};(A.texts.length||A.attributes.length||A.removes.length||A.adds.length)&&e(A)});return a.observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function O(e,t){var n=[];return Object.keys(b).filter(function(e){return Number.isNaN(Number(e))&&!e.endsWith("_Departed")}).forEach(function(o){var r=o.toLowerCase(),a=function(n){return function(o){if(!T(o.target,t)){var r=E.getId(o.target),a=x(o)?o.changedTouches[0]:o,i=a.clientX,u=a.clientY;e({type:b[n],id:r,x:i,y:u})}}}(o);n.push(h(r,a))}),function(){n.forEach(function(e){return e()})}}var A,P=["INPUT","TEXTAREA","SELECT"],z=["color","date","datetime-local","email","month","number","range","search","tel","text","time","url","week"],F=new WeakMap;function j(e,n,o,a){function i(e){var t=e.target;if(t&&t.tagName&&!(P.indexOf(t.tagName)<0)&&!T(t,n)){var r=t.type;if("password"!==r&&!t.classList.contains(o)){var i=t.value,c=!1,l=z.includes(r)||"TEXTAREA"===t.tagName;"radio"===r||"checkbox"===r?c=t.checked:l&&a&&(i="*".repeat(i.length)),u(t,{text:i,isChecked:c});var s=t.name;"radio"===r&&s&&c&&document.querySelectorAll('input[type="radio"][name="'+s+'"]').forEach(function(e){e!==t&&u(e,{text:e.value,isChecked:!c})})}}}function u(n,o){var r=F.get(n);if(!r||r.text!==o.text||r.isChecked!==o.isChecked){F.set(n,o);var a=E.getId(n);e(t(t({},o),{id:a}))}}var c=["input","change"].map(function(e){return h(e,i)}),l=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"),s=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"]];return l&&l.set&&c.push.apply(c,r(s.map(function(e){return function e(t,n,o,r){var a=Object.getOwnPropertyDescriptor(t,n);return Object.defineProperty(t,n,r?o:{set:function(e){var t=this;setTimeout(function(){o.set.call(t,e)},0),a&&a.set&&a.set.call(this,e)}}),function(){return e(t,n,a||{},!0)}}(e[0],e[1],{set:function(){i({target:this})}})}))),function(){c.forEach(function(e){return e()})}}function H(e,t){void 0===t&&(t={}),function(e,t){var n=e.mutationCb,o=e.mousemoveCb,a=e.mouseInteractionCb,i=e.scrollCb,u=e.viewportResizeCb,c=e.inputCb,l=e.mediaInteractionCb,s=e.styleSheetRuleCb;e.mutationCb=function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];t.mutation&&t.mutation.apply(t,r(e)),n.apply(void 0,r(e))},e.mousemoveCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mousemove&&t.mousemove.apply(t,r(e)),o.apply(void 0,r(e))},e.mouseInteractionCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mouseInteraction&&t.mouseInteraction.apply(t,r(e)),a.apply(void 0,r(e))},e.scrollCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.scroll&&t.scroll.apply(t,r(e)),i.apply(void 0,r(e))},e.viewportResizeCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.viewportResize&&t.viewportResize.apply(t,r(e)),u.apply(void 0,r(e))},e.inputCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.input&&t.input.apply(t,r(e)),c.apply(void 0,r(e))},e.mediaInteractionCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mediaInteaction&&t.mediaInteaction.apply(t,r(e)),l.apply(void 0,r(e))},e.styleSheetRuleCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.styleSheetRule&&t.styleSheetRule.apply(t,r(e)),s.apply(void 0,r(e))}}(e,t);var n,o,a,i,u,c,l,s=R(e.mutationCb,e.blockClass,e.inlineStylesheet,e.maskAllInputs),d=(n=e.mousemoveCb,o=e.mousemoveWait,i=[],u=w(function(e){var t=Date.now()-a;n(i.map(function(e){return e.timeOffset-=t,e}),e?g.TouchMove:g.MouseMove),i=[],a=null},500),c=w(function(e){var t=e.target,n=x(e)?e.changedTouches[0]:e,o=n.clientX,r=n.clientY;a||(a=Date.now()),i.push({x:o,y:r,id:E.getId(t),timeOffset:Date.now()-a}),u(x(e))},o,{trailing:!1}),l=[h("mousemove",c),h("touchmove",c)],function(){l.forEach(function(e){return e()})}),p=O(e.mouseInteractionCb,e.blockClass),f=function(e,t){return h("scroll",w(function(n){if(n.target&&!T(n.target,t)){var o=E.getId(n.target);if(n.target===document){var r=document.scrollingElement||document.documentElement;e({id:o,x:r.scrollLeft,y:r.scrollTop})}else e({id:o,x:n.target.scrollLeft,y:n.target.scrollTop})}},100))}(e.scrollCb,e.blockClass),m=function(e){return h("resize",w(function(){var t=I(),n=N();e({width:Number(n),height:Number(t)})},200),window)}(e.viewportResizeCb),v=j(e.inputCb,e.blockClass,e.ignoreClass,e.maskAllInputs),y=function(e,t){var n=function(n){return function(o){var r=o.target;r&&!T(r,t)&&e({type:"play"===n?S.Play:S.Pause,id:E.getId(r)})}},o=[h("play",n("play")),h("pause",n("pause"))];return function(){o.forEach(function(e){return e()})}}(e.mediaInteractionCb,e.blockClass),b=function(e){var t=CSSStyleSheet.prototype.insertRule;CSSStyleSheet.prototype.insertRule=function(n,o){var r=E.getId(this.ownerNode);return-1!==r&&e({id:r,adds:[{rule:n,index:o}]}),t.apply(this,arguments)};var n=CSSStyleSheet.prototype.deleteRule;return CSSStyleSheet.prototype.deleteRule=function(t){var o=E.getId(this.ownerNode);return-1!==o&&e({id:o,removes:[{index:t}]}),n.apply(this,arguments)},function(){CSSStyleSheet.prototype.insertRule=t,CSSStyleSheet.prototype.deleteRule=n}}(e.styleSheetRuleCb);return function(){s.disconnect(),d(),p(),f(),m(),v(),y(),b()}}function U(e){return t(t({},e),{timestamp:Date.now()})}function V(e){void 0===e&&(e={});var n,r=e.emit,a=e.checkoutEveryNms,i=e.checkoutEveryNth,u=e.blockClass,c=void 0===u?"rr-block":u,l=e.ignoreClass,s=void 0===l?"rr-ignore":l,d=e.inlineStylesheet,p=void 0===d||d,f=e.maskAllInputs,m=void 0!==f&&f,b=e.hooks,S=e.mousemoveWait,C=void 0===S?50:S,w=e.packFn;if(!r)throw new Error("emit function is required");"NodeList"in window&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach);var T=0;function x(e){var t,n,r,a;void 0===e&&(e=!1),A(U({type:y.Meta,data:{href:window.location.href,width:N(),height:I()}}),e);var i=o(function(e,t,n,o){void 0===t&&(t="rr-block"),void 0===n&&(n=!0),void 0===o&&(o=!1);var r={};return[v(e,e,r,t,!1,n,o),r]}(document,c,p,m),2),u=i[0],l=i[1];if(!u)return console.warn("Failed to snapshot the document");E.map=l,A(U({type:y.FullSnapshot,data:{node:u,initialOffset:{left:void 0!==window.pageXOffset?window.pageXOffset:(null===document||void 0===document?void 0:document.documentElement.scrollLeft)||(null===(n=null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===document||void 0===document?void 0:document.body.scrollLeft)||0,top:void 0!==window.pageYOffset?window.pageYOffset:(null===document||void 0===document?void 0:document.documentElement.scrollTop)||(null===(a=null===(r=null===document||void 0===document?void 0:document.body)||void 0===r?void 0:r.parentElement)||void 0===a?void 0:a.scrollTop)||(null===document||void 0===document?void 0:document.body.scrollTop)||0}}}))}A=function(e,t){if(r(w?w(e):e,t),e.type===y.FullSnapshot)n=e,T=0;else if(e.type===y.IncrementalSnapshot){T++;var o=i&&T>=i,u=a&&e.timestamp-n.timestamp>a;(o||u)&&x(!0)}};try{var M=[];M.push(h("DOMContentLoaded",function(){A(U({type:y.DomContentLoaded,data:{}}))}));var D=function(){x(),M.push(H({mutationCb:function(e){return A(U({type:y.IncrementalSnapshot,data:t({source:g.Mutation},e)}))},mousemoveCb:function(e,t){return A(U({type:y.IncrementalSnapshot,data:{source:t,positions:e}}))},mouseInteractionCb:function(e){return A(U({type:y.IncrementalSnapshot,data:t({source:g.MouseInteraction},e)}))},scrollCb:function(e){return A(U({type:y.IncrementalSnapshot,data:t({source:g.Scroll},e)}))},viewportResizeCb:function(e){return A(U({type:y.IncrementalSnapshot,data:t({source:g.ViewportResize},e)}))},inputCb:function(e){return A(U({type:y.IncrementalSnapshot,data:t({source:g.Input},e)}))},mediaInteractionCb:function(e){return A(U({type:y.IncrementalSnapshot,data:t({source:g.MediaInteraction},e)}))},styleSheetRuleCb:function(e){return A(U({type:y.IncrementalSnapshot,data:t({source:g.StyleSheetRule},e)}))},blockClass:c,ignoreClass:s,maskAllInputs:m,inlineStylesheet:p,mousemoveWait:C},b))};return"interactive"===document.readyState||"complete"===document.readyState?D():M.push(h("load",function(){A(U({type:y.Load,data:{}})),D()},window)),function(){M.forEach(function(e){return e()})}}catch(e){console.warn(e)}}return V.addCustomEvent=function(e,t){if(!A)throw new Error("please add custom event after start recording");A(U({type:y.Custom,data:{tag:e,payload:t}}))},V}();
var rrwebRecord=function(){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */var e,t=function(){return(t=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function n(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function o(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i}function r(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(o(arguments[t]));return e}!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(e||(e={}));var a=1,i=RegExp("[^a-z1-6-]");function u(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).reduce((function(e,t){return e+(function(e){return"styleSheet"in e}(n=t)?u(n.styleSheet)||"":n.cssText);var n}),""):null}catch(e){return null}}var s=/url\((?:'([^']*)'|"([^"]*)"|([^)]*))\)/gm,c=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/,l=/^(data:)([\w\/\+\-]+);(charset=[\w-]+|base64).*,(.*)/i;function d(e,t){return(e||"").replace(s,(function(e,n,o,r){var a,i=n||o||r;if(!i)return e;if(!c.test(i))return"url('"+i+"')";if(l.test(i))return"url("+i+")";if("/"===i[0])return"url('"+(((a=t).indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+i+"')");var u=t.split("/"),s=i.split("/");u.pop();for(var d=0,p=s;d<p.length;d++){var f=p[d];"."!==f&&(".."===f?u.pop():u.push(f))}return"url('"+u.join("/")+"')"}))}function p(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function f(e,t,n){return"src"===t||"href"===t&&n?p(e,n):"srcset"===t&&n?function(e,t){return""===t.trim()?t:t.split(",").map((function(t){var n=t.trimLeft().trimRight().split(" ");return 2===n.length?p(e,n[0])+" "+n[1]:1===n.length?""+p(e,n[0]):""})).join(",")}(e,n):"style"===t&&n?d(n,location.href):n}function m(t,n,o,r,a){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:var s=!1;"string"==typeof o?s=t.classList.contains(o):t.classList.forEach((function(e){o.test(e)&&(s=!0)}));for(var c=function(e){var t=e.toLowerCase().trim();return i.test(t)?"div":t}(t.tagName),l={},p=0,m=Array.from(t.attributes);p<m.length;p++){var v=m[p],h=v.name,y=v.value;l[h]=f(n,h,y)}if("link"===c&&r){var g,S=Array.from(n.styleSheets).find((function(e){return e.href===t.href}));(g=u(S))&&(delete l.rel,delete l.href,l._cssText=d(g,S.href))}if("style"===c&&t.sheet&&!(t.innerText||t.textContent||"").trim().length)(g=u(t.sheet))&&(l._cssText=d(g,location.href));if("input"===c||"textarea"===c||"select"===c){y=t.value;"radio"!==l.type&&"checkbox"!==l.type&&y?l.value=a?"*".repeat(y.length):y:t.checked&&(l.checked=t.checked)}if("option"===c){var b=t.parentElement;l.value===b.value&&(l.selected=t.selected)}if("canvas"===c&&(l.rr_dataURL=t.toDataURL()),"audio"!==c&&"video"!==c||(l.rr_mediaState=t.paused?"paused":"played"),s){var C=t.getBoundingClientRect(),E=C.width,w=C.height;l.rr_width=E+"px",l.rr_height=w+"px"}return{type:e.Element,tagName:c,attributes:l,childNodes:[],isSVG:(M=t,"svg"===M.tagName||M instanceof SVGElement||void 0),needBlock:s};case t.TEXT_NODE:var I=t.parentNode&&t.parentNode.tagName,N=t.textContent,T="STYLE"===I||void 0;return T&&N&&(N=d(N,location.href)),"SCRIPT"===I&&(N="SCRIPT_PLACEHOLDER"),{type:e.Text,textContent:N||"",isStyle:T};case t.CDATA_SECTION_NODE:return{type:e.CDATA,textContent:""};case t.COMMENT_NODE:return{type:e.Comment,textContent:t.textContent||""};default:return!1}var M}function v(t,n,o,r,i,u,s){void 0===i&&(i=!1),void 0===u&&(u=!0),void 0===s&&(s=!1);var c,l=m(t,n,r,u,s);if(!l)return console.warn(t,"not serialized"),null;c="__sn"in t?t.__sn.id:a++;var d=Object.assign(l,{id:c});t.__sn=d,o[c]=t;var p=!i;if(d.type===e.Element&&(p=p&&!d.needBlock,delete d.needBlock),(d.type===e.Document||d.type===e.Element)&&p)for(var f=0,h=Array.from(t.childNodes);f<h.length;f++){var y=v(h[f],n,o,r,i,u,s);y&&d.childNodes.push(y)}return d}function h(e,t,n){void 0===n&&(n=document);var o={capture:!0,passive:!0};return n.addEventListener(e,t,o),function(){return n.removeEventListener(e,t,o)}}var y,g,S,b,C,E={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return E.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete E.map[t],e.childNodes&&e.childNodes.forEach((function(e){return E.removeNodeFromMap(e)}))},has:function(e){return E.map.hasOwnProperty(e)}};function w(e,t,n){void 0===n&&(n={});var o=null,r=0;return function(a){var i=Date.now();r||!1!==n.leading||(r=i);var u=t-(i-r),s=this,c=arguments;u<=0||u>t?(o&&(window.clearTimeout(o),o=null),r=i,e.apply(s,c)):o||!1===n.trailing||(o=window.setTimeout((function(){r=!1===n.leading?0:Date.now(),o=null,e.apply(s,c)}),u))}}function I(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function N(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function T(e,t){if(!e)return!1;if(e.nodeType===e.ELEMENT_NODE){var n=!1;return"string"==typeof t?n=e.classList.contains(t):e.classList.forEach((function(e){t.test(e)&&(n=!0)})),n||T(e.parentNode,t)}return T(e.parentNode,t)}function M(e){return Boolean(e.changedTouches)}!function(e){e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom"}(y||(y={})),function(e){e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule"}(g||(g={})),function(e){e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd"}(S||(S={})),function(e){e[e.Play=0]="Play",e[e.Pause=1]="Pause"}(b||(b={})),function(e){e.Start="start",e.Pause="pause",e.Resume="resume",e.Resize="resize",e.Finish="finish",e.FullsnapshotRebuilded="fullsnapshot-rebuilded",e.LoadStylesheetStart="load-stylesheet-start",e.LoadStylesheetEnd="load-stylesheet-end",e.SkipStart="skip-start",e.SkipEnd="skip-end",e.MouseInteraction="mouse-interaction",e.EventCast="event-cast",e.CustomEvent="custom-event"}(C||(C={}));var k=function(e,t){return e+"@"+t};function x(e){return"__sn"in e}var D=function(e,t,o,r){var a=this;this.texts=[],this.attributes=[],this.removes=[],this.adds=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=function(e){var t,o,r,i;e.forEach(a.processMutation);var u=[],s=function(e){var t=E.getId(e.parentNode),n=e.nextSibling&&E.getId(e.nextSibling);if(-1===t||-1===n)return u.push(e);a.adds.push({parentId:t,nextId:n,node:v(e,document,E.map,a.blockClass,!0,a.inlineStylesheet,a.maskAllInputs)})};try{for(var c=n(a.movedSet),l=c.next();!l.done;l=c.next())s(f=l.value)}catch(e){t={error:e}}finally{try{l&&!l.done&&(o=c.return)&&o.call(c)}finally{if(t)throw t.error}}try{for(var d=n(a.addedSet),p=d.next();!p.done;p=d.next()){var f=p.value;R(a.droppedSet,f)||_(a.removes,f)?R(a.movedSet,f)?s(f):a.droppedSet.add(f):s(f)}}catch(e){r={error:e}}finally{try{p&&!p.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}for(;u.length&&!u.every((function(e){return-1===E.getId(e.parentNode)}));)s(u.shift());a.emit()},this.processMutation=function(e){switch(e.type){case"characterData":var t=e.target.textContent;T(e.target,a.blockClass)||t===e.oldValue||a.texts.push({value:t,node:e.target});break;case"attributes":if(t=e.target.getAttribute(e.attributeName),T(e.target,a.blockClass)||t===e.oldValue)return;var n=a.attributes.find((function(t){return t.node===e.target}));n||(n={node:e.target,attributes:{}},a.attributes.push(n)),n.attributes[e.attributeName]=f(document,e.attributeName,t);break;case"childList":e.addedNodes.forEach((function(t){return a.genAdds(t,e.target)})),e.removedNodes.forEach((function(t){var n=E.getId(t),o=E.getId(e.target);T(t,a.blockClass)||(a.addedSet.has(t)?(L(a.addedSet,t),a.droppedSet.add(t)):a.addedSet.has(e.target)&&-1===n||function e(t){var n=E.getId(t);return!E.has(n)||(!t.parentNode||t.parentNode.nodeType!==t.DOCUMENT_NODE)&&(!t.parentNode||e(t.parentNode))}(e.target)||(a.movedSet.has(t)&&a.movedMap[k(n,o)]?L(a.movedSet,t):a.removes.push({parentId:o,id:n})),E.removeNodeFromMap(t))}))}},this.genAdds=function(e,t){if(!T(e,a.blockClass)){if(x(e)){a.movedSet.add(e);var n=null;t&&x(t)&&(n=t.__sn.id),n&&(a.movedMap[k(e.__sn.id,n)]=!0)}else a.addedSet.add(e),a.droppedSet.delete(e);e.childNodes.forEach((function(e){return a.genAdds(e)}))}},this.emit=function(){var e={texts:a.texts.map((function(e){return{id:E.getId(e.node),value:e.value}})).filter((function(e){return E.has(e.id)})),attributes:a.attributes.map((function(e){return{id:E.getId(e.node),attributes:e.attributes}})).filter((function(e){return E.has(e.id)})),removes:a.removes,adds:a.adds};(e.texts.length||e.attributes.length||e.removes.length||e.adds.length)&&(a.emissionCallback(e),a.texts=[],a.attributes=[],a.removes=[],a.adds=[],a.addedSet=new Set,a.movedSet=new Set,a.droppedSet=new Set,a.movedMap={})},this.blockClass=t,this.inlineStylesheet=o,this.maskAllInputs=r,this.emissionCallback=e};function L(e,t){e.delete(t),t.childNodes.forEach((function(t){return L(e,t)}))}function _(e,t){var n=t.parentNode;if(!n)return!1;var o=E.getId(n);return!!e.some((function(e){return e.id===o}))||_(e,n)}function R(e,t){var n=t.parentNode;return!!n&&(!!e.has(n)||R(e,n))}function O(e,t){var n=[];return Object.keys(S).filter((function(e){return Number.isNaN(Number(e))&&!e.endsWith("_Departed")})).forEach((function(o){var r=o.toLowerCase(),a=function(n){return function(o){if(!T(o.target,t)){var r=E.getId(o.target),a=M(o)?o.changedTouches[0]:o,i=a.clientX,u=a.clientY;e({type:S[n],id:r,x:i,y:u})}}}(o);n.push(h(r,a))})),function(){n.forEach((function(e){return e()}))}}var A,P=["INPUT","TEXTAREA","SELECT"],z=["color","date","datetime-local","email","month","number","range","search","tel","text","time","url","week"],F=new WeakMap;function j(e,n,o,a){function i(e){var t=e.target;if(t&&t.tagName&&!(P.indexOf(t.tagName)<0)&&!T(t,n)){var r=t.type;if("password"!==r&&!t.classList.contains(o)){var i=t.value,s=!1,c=z.includes(r)||"TEXTAREA"===t.tagName;"radio"===r||"checkbox"===r?s=t.checked:c&&a&&(i="*".repeat(i.length)),u(t,{text:i,isChecked:s});var l=t.name;"radio"===r&&l&&s&&document.querySelectorAll('input[type="radio"][name="'+l+'"]').forEach((function(e){e!==t&&u(e,{text:e.value,isChecked:!s})}))}}}function u(n,o){var r=F.get(n);if(!r||r.text!==o.text||r.isChecked!==o.isChecked){F.set(n,o);var a=E.getId(n);e(t(t({},o),{id:a}))}}var s=["input","change"].map((function(e){return h(e,i)})),c=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"),l=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"]];return c&&c.set&&s.push.apply(s,r(l.map((function(e){return function e(t,n,o,r,a){void 0===a&&(a=window);var i=a.Object.getOwnPropertyDescriptor(t,n);return a.Object.defineProperty(t,n,r?o:{set:function(e){var t=this;setTimeout((function(){o.set.call(t,e)}),0),i&&i.set&&i.set.call(this,e)}}),function(){return e(t,n,i||{},!0)}}(e[0],e[1],{set:function(){i({target:this})}})})))),function(){s.forEach((function(e){return e()}))}}function H(e,t){void 0===t&&(t={}),function(e,t){var n=e.mutationCb,o=e.mousemoveCb,a=e.mouseInteractionCb,i=e.scrollCb,u=e.viewportResizeCb,s=e.inputCb,c=e.mediaInteractionCb,l=e.styleSheetRuleCb;e.mutationCb=function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];t.mutation&&t.mutation.apply(t,r(e)),n.apply(void 0,r(e))},e.mousemoveCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mousemove&&t.mousemove.apply(t,r(e)),o.apply(void 0,r(e))},e.mouseInteractionCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mouseInteraction&&t.mouseInteraction.apply(t,r(e)),a.apply(void 0,r(e))},e.scrollCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.scroll&&t.scroll.apply(t,r(e)),i.apply(void 0,r(e))},e.viewportResizeCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.viewportResize&&t.viewportResize.apply(t,r(e)),u.apply(void 0,r(e))},e.inputCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.input&&t.input.apply(t,r(e)),s.apply(void 0,r(e))},e.mediaInteractionCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mediaInteaction&&t.mediaInteaction.apply(t,r(e)),c.apply(void 0,r(e))},e.styleSheetRuleCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.styleSheetRule&&t.styleSheetRule.apply(t,r(e)),l.apply(void 0,r(e))}}(e,t);var n,o,a,i,u,s,c=(n=e.mutationCb,o=e.blockClass,a=e.inlineStylesheet,i=e.maskAllInputs,u=new D(n,o,a,i),(s=new MutationObserver(u.processMutations)).observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),s),l=function(e,t){var n,o=[],r=w((function(t){var r=Date.now()-n;e(o.map((function(e){return e.timeOffset-=r,e})),t?g.TouchMove:g.MouseMove),o=[],n=null}),500),a=w((function(e){var t=e.target,a=M(e)?e.changedTouches[0]:e,i=a.clientX,u=a.clientY;n||(n=Date.now()),o.push({x:i,y:u,id:E.getId(t),timeOffset:Date.now()-n}),r(M(e))}),t,{trailing:!1}),i=[h("mousemove",a),h("touchmove",a)];return function(){i.forEach((function(e){return e()}))}}(e.mousemoveCb,e.mousemoveWait),d=O(e.mouseInteractionCb,e.blockClass),p=function(e,t){return h("scroll",w((function(n){if(n.target&&!T(n.target,t)){var o=E.getId(n.target);if(n.target===document){var r=document.scrollingElement||document.documentElement;e({id:o,x:r.scrollLeft,y:r.scrollTop})}else e({id:o,x:n.target.scrollLeft,y:n.target.scrollTop})}}),100))}(e.scrollCb,e.blockClass),f=function(e){return h("resize",w((function(){var t=I(),n=N();e({width:Number(n),height:Number(t)})}),200),window)}(e.viewportResizeCb),m=j(e.inputCb,e.blockClass,e.ignoreClass,e.maskAllInputs),v=function(e,t){var n=function(n){return function(o){var r=o.target;r&&!T(r,t)&&e({type:"play"===n?b.Play:b.Pause,id:E.getId(r)})}},o=[h("play",n("play")),h("pause",n("pause"))];return function(){o.forEach((function(e){return e()}))}}(e.mediaInteractionCb,e.blockClass),y=function(e){var t=CSSStyleSheet.prototype.insertRule;CSSStyleSheet.prototype.insertRule=function(n,o){var r=E.getId(this.ownerNode);return-1!==r&&e({id:r,adds:[{rule:n,index:o}]}),t.apply(this,arguments)};var n=CSSStyleSheet.prototype.deleteRule;return CSSStyleSheet.prototype.deleteRule=function(t){var o=E.getId(this.ownerNode);return-1!==o&&e({id:o,removes:[{index:t}]}),n.apply(this,arguments)},function(){CSSStyleSheet.prototype.insertRule=t,CSSStyleSheet.prototype.deleteRule=n}}(e.styleSheetRuleCb);return function(){c.disconnect(),l(),d(),p(),f(),m(),v(),y()}}function V(e){return t(t({},e),{timestamp:Date.now()})}function U(e){void 0===e&&(e={});var n,r=e.emit,a=e.checkoutEveryNms,i=e.checkoutEveryNth,u=e.blockClass,s=void 0===u?"rr-block":u,c=e.ignoreClass,l=void 0===c?"rr-ignore":c,d=e.inlineStylesheet,p=void 0===d||d,f=e.maskAllInputs,m=void 0!==f&&f,S=e.hooks,b=e.mousemoveWait,C=void 0===b?50:b,w=e.packFn;if(!r)throw new Error("emit function is required");"NodeList"in window&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach);var T=0;function M(e){var t,n,r,a;void 0===e&&(e=!1),A(V({type:y.Meta,data:{href:window.location.href,width:N(),height:I()}}),e);var i=o(function(e,t,n,o){void 0===t&&(t="rr-block"),void 0===n&&(n=!0),void 0===o&&(o=!1);var r={};return[v(e,e,r,t,!1,n,o),r]}(document,s,p,m),2),u=i[0],c=i[1];if(!u)return console.warn("Failed to snapshot the document");E.map=c,A(V({type:y.FullSnapshot,data:{node:u,initialOffset:{left:void 0!==window.pageXOffset?window.pageXOffset:(null===document||void 0===document?void 0:document.documentElement.scrollLeft)||(null===(n=null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===document||void 0===document?void 0:document.body.scrollLeft)||0,top:void 0!==window.pageYOffset?window.pageYOffset:(null===document||void 0===document?void 0:document.documentElement.scrollTop)||(null===(a=null===(r=null===document||void 0===document?void 0:document.body)||void 0===r?void 0:r.parentElement)||void 0===a?void 0:a.scrollTop)||(null===document||void 0===document?void 0:document.body.scrollTop)||0}}}))}A=function(e,t){if(r(w?w(e):e,t),e.type===y.FullSnapshot)n=e,T=0;else if(e.type===y.IncrementalSnapshot){T++;var o=i&&T>=i,u=a&&e.timestamp-n.timestamp>a;(o||u)&&M(!0)}};try{var k=[];k.push(h("DOMContentLoaded",(function(){A(V({type:y.DomContentLoaded,data:{}}))})));var x=function(){M(),k.push(H({mutationCb:function(e){return A(V({type:y.IncrementalSnapshot,data:t({source:g.Mutation},e)}))},mousemoveCb:function(e,t){return A(V({type:y.IncrementalSnapshot,data:{source:t,positions:e}}))},mouseInteractionCb:function(e){return A(V({type:y.IncrementalSnapshot,data:t({source:g.MouseInteraction},e)}))},scrollCb:function(e){return A(V({type:y.IncrementalSnapshot,data:t({source:g.Scroll},e)}))},viewportResizeCb:function(e){return A(V({type:y.IncrementalSnapshot,data:t({source:g.ViewportResize},e)}))},inputCb:function(e){return A(V({type:y.IncrementalSnapshot,data:t({source:g.Input},e)}))},mediaInteractionCb:function(e){return A(V({type:y.IncrementalSnapshot,data:t({source:g.MediaInteraction},e)}))},styleSheetRuleCb:function(e){return A(V({type:y.IncrementalSnapshot,data:t({source:g.StyleSheetRule},e)}))},blockClass:s,ignoreClass:l,maskAllInputs:m,inlineStylesheet:p,mousemoveWait:C},S))};return"interactive"===document.readyState||"complete"===document.readyState?x():k.push(h("load",(function(){A(V({type:y.Load,data:{}})),x()}),window)),function(){k.forEach((function(e){return e()}))}}catch(e){console.warn(e)}}return U.addCustomEvent=function(e,t){if(!A)throw new Error("please add custom event after start recording");A(V({type:y.Custom,data:{tag:e,payload:t}}))},U}();
//# sourceMappingURL=rrweb-record.min.js.map

@@ -12,3 +12,3 @@ var NodeType;

var _id = 1;
var symbolAndNumberRegex = RegExp('[^a-z1-6]');
var symbolAndNumberRegex = RegExp('[^a-z1-6\-]');
function genId() {

@@ -859,2 +859,5 @@ return _id++;

}
else if (name == 'onload' || name == 'onclick' || name.substring(0, 7) == 'onmouse') {
node_1.setAttribute('_' + name, value);
}
else {

@@ -861,0 +864,0 @@ node_1.setAttribute(name, value);

@@ -0,1 +1,3 @@

import * as utils from './utils.js';
export { utils };
export { mirror } from './utils.js';

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

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

@@ -10,0 +10,0 @@ var addCustomEvent = record.addCustomEvent;

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

function takeFullSnapshot(isCheckout) {
var _a, _b, _c, _d;
if (isCheckout === void 0) { isCheckout = false; }
var _a, _b, _c, _d;
wrappedEmit(wrapEvent({

@@ -41,0 +41,0 @@ type: EventType.Meta,

@@ -1,181 +0,9 @@

import { __values, __spread, __assign } from '../../node_modules/tslib/tslib.es6.js';
import { transformAttribute, serializeNodeWithId } from '../../node_modules/rrweb-snapshot/es/rrweb-snapshot.js';
import { on, mirror, isBlocked, isAncestorRemoved, throttle, getWindowHeight, getWindowWidth, hookSetter, isTouchEvent } from '../utils.js';
import { MouseInteractions, MediaInteractions, IncrementalSource } from '../types.js';
import { deepDelete, isAncestorInSet, isParentRemoved } from './collection.js';
import { __spread, __assign } from '../../node_modules/tslib/tslib.es6.js';
import { on, throttle, isTouchEvent, mirror, isBlocked, getWindowHeight, getWindowWidth, hookSetter } from '../utils.js';
import { IncrementalSource, MouseInteractions, MediaInteractions } from '../types.js';
import MutationBuffer from './mutation.js';
var moveKey = function (id, parentId) { return id + "@" + parentId; };
function isINode(n) {
return '__sn' in n;
}
function initMutationObserver(cb, blockClass, inlineStylesheet, maskAllInputs) {
var observer = new MutationObserver(function (mutations) {
var e_1, _a, e_2, _b;
var texts = [];
var attributes = [];
var removes = [];
var adds = [];
var addedSet = new Set();
var movedSet = new Set();
var droppedSet = new Set();
var movedMap = {};
var genAdds = function (n, target) {
if (isBlocked(n, blockClass)) {
return;
}
if (isINode(n)) {
movedSet.add(n);
var targetId = null;
if (target && isINode(target)) {
targetId = target.__sn.id;
}
if (targetId) {
movedMap[moveKey(n.__sn.id, targetId)] = true;
}
}
else {
addedSet.add(n);
droppedSet.delete(n);
}
n.childNodes.forEach(function (childN) { return genAdds(childN); });
};
mutations.forEach(function (mutation) {
var type = mutation.type, target = mutation.target, oldValue = mutation.oldValue, addedNodes = mutation.addedNodes, removedNodes = mutation.removedNodes, attributeName = mutation.attributeName;
switch (type) {
case 'characterData': {
var value = target.textContent;
if (!isBlocked(target, blockClass) && value !== oldValue) {
texts.push({
value: value,
node: target,
});
}
break;
}
case 'attributes': {
var value = target.getAttribute(attributeName);
if (isBlocked(target, blockClass) || value === oldValue) {
return;
}
var item = attributes.find(function (a) { return a.node === target; });
if (!item) {
item = {
node: target,
attributes: {},
};
attributes.push(item);
}
item.attributes[attributeName] = transformAttribute(document, attributeName, value);
break;
}
case 'childList': {
addedNodes.forEach(function (n) { return genAdds(n, target); });
removedNodes.forEach(function (n) {
var nodeId = mirror.getId(n);
var parentId = mirror.getId(target);
if (isBlocked(n, blockClass)) {
return;
}
if (addedSet.has(n)) {
deepDelete(addedSet, n);
droppedSet.add(n);
}
else if (addedSet.has(target) && nodeId === -1) ;
else if (isAncestorRemoved(target)) ;
else if (movedSet.has(n) && movedMap[moveKey(nodeId, parentId)]) {
deepDelete(movedSet, n);
}
else {
removes.push({
parentId: parentId,
id: nodeId,
});
}
mirror.removeNodeFromMap(n);
});
break;
}
}
});
var addQueue = [];
var pushAdd = function (n) {
var parentId = mirror.getId(n.parentNode);
if (parentId === -1) {
return addQueue.push(n);
}
adds.push({
parentId: parentId,
previousId: !n.previousSibling
? n.previousSibling
: mirror.getId(n.previousSibling),
nextId: !n.nextSibling
? n.nextSibling
: mirror.getId(n.nextSibling),
node: serializeNodeWithId(n, document, mirror.map, blockClass, true, inlineStylesheet, maskAllInputs),
});
};
try {
for (var movedSet_1 = __values(movedSet), movedSet_1_1 = movedSet_1.next(); !movedSet_1_1.done; movedSet_1_1 = movedSet_1.next()) {
var n = movedSet_1_1.value;
pushAdd(n);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (movedSet_1_1 && !movedSet_1_1.done && (_a = movedSet_1.return)) _a.call(movedSet_1);
}
finally { if (e_1) throw e_1.error; }
}
try {
for (var addedSet_1 = __values(addedSet), addedSet_1_1 = addedSet_1.next(); !addedSet_1_1.done; addedSet_1_1 = addedSet_1.next()) {
var n = addedSet_1_1.value;
if (!isAncestorInSet(droppedSet, n) && !isParentRemoved(removes, n)) {
pushAdd(n);
}
else if (isAncestorInSet(movedSet, n)) {
pushAdd(n);
}
else {
droppedSet.add(n);
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (addedSet_1_1 && !addedSet_1_1.done && (_b = addedSet_1.return)) _b.call(addedSet_1);
}
finally { if (e_2) throw e_2.error; }
}
while (addQueue.length) {
if (addQueue.every(function (n) { return mirror.getId(n.parentNode) === -1; })) {
break;
}
pushAdd(addQueue.shift());
}
var payload = {
texts: texts
.map(function (text) { return ({
id: mirror.getId(text.node),
value: text.value,
}); })
.filter(function (text) { return mirror.has(text.id); }),
attributes: attributes
.map(function (attribute) { return ({
id: mirror.getId(attribute.node),
attributes: attribute.attributes,
}); })
.filter(function (attribute) { return mirror.has(attribute.id); }),
removes: removes,
adds: adds,
};
if (!payload.texts.length &&
!payload.attributes.length &&
!payload.removes.length &&
!payload.adds.length) {
return;
}
cb(payload);
});
var mutationBuffer = new MutationBuffer(cb, blockClass, inlineStylesheet, maskAllInputs);
var observer = new MutationObserver(mutationBuffer.processMutations);
observer.observe(document, {

@@ -534,1 +362,2 @@ attributes: true,

export default initObservers;
export { INPUT_TAGS, MASK_TYPES };

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

import { __values, __assign } from '../../node_modules/tslib/tslib.es6.js';
import { __assign, __values } from '../../node_modules/tslib/tslib.es6.js';
import { rebuild, buildNodeWithSN } from '../../node_modules/rrweb-snapshot/es/rrweb-snapshot.js';

@@ -8,3 +8,4 @@ import { mirror, polyfill } from '../utils.js';

import { polyfill as smoothscroll_1 } from '../../node_modules/smoothscroll-polyfill/dist/smoothscroll.js';
import Timer from './timer.js';
import { Timer } from './timer.js';
import { createPlayerService } from './machine.js';
import getInjectStyleRules from './styles/inject-style.js';

@@ -16,39 +17,72 @@

var REPLAY_CONSOLE_PREFIX = '[replayer]';
var defaultConfig = {
speed: 1,
root: document.body,
loadTimeout: 0,
skipInactive: false,
showWarning: true,
showDebug: false,
blockClass: 'rr-block',
liveMode: false,
insertStyleRules: [],
triggerFocus: true,
};
var Replayer = (function () {
function Replayer(events, config) {
this.events = [];
this.emitter = mitt();
this.baselineTime = 0;
this.noramlSpeed = -1;
this.missingNodeRetryMap = {};
this.playing = false;
if (events.length < 2) {
this.legacy_missingNodeRetryMap = {};
if (!(config === null || config === void 0 ? void 0 : config.liveMode) && events.length < 2) {
throw new Error('Replayer need at least 2 events.');
}
this.events = events.map(function (e) {
if (config && config.unpackFn) {
return config.unpackFn(e);
}
return e;
});
this.config = Object.assign({}, defaultConfig, config);
this.handleResize = this.handleResize.bind(this);
var defaultConfig = {
speed: 1,
root: document.body,
loadTimeout: 0,
skipInactive: false,
showWarning: true,
showDebug: false,
blockClass: 'rr-block',
liveMode: false,
insertStyleRules: [],
triggerFocus: true,
};
this.config = Object.assign({}, defaultConfig, config);
this.timer = new Timer(this.config);
this.getCastFn = this.getCastFn.bind(this);
this.emitter.on('resize', this.handleResize);
smoothscroll_1();
polyfill();
this.setupDom();
this.emitter.on('resize', this.handleResize);
this.service = createPlayerService({
events: events.map(function (e) {
if (config && config.unpackFn) {
return config.unpackFn(e);
}
return e;
}),
timer: new Timer(this.config),
speed: (config === null || config === void 0 ? void 0 : config.speed) || defaultConfig.speed,
timeOffset: 0,
baselineTime: 0,
lastPlayedEvent: null,
}, {
getCastFn: this.getCastFn,
emitter: this.emitter,
});
this.service.start();
this.service.subscribe(function (state) {
if (!state.changed) {
return;
}
});
var contextEvents = this.service.state.context.events;
var firstMeta = contextEvents.find(function (e) { return e.type === EventType.Meta; });
var firstFullsnapshot = contextEvents.find(function (e) { return e.type === EventType.FullSnapshot; });
if (firstMeta) {
var _a = firstMeta.data, width = _a.width, height = _a.height;
this.emitter.emit(ReplayerEvents.Resize, {
width: width,
height: height,
});
}
if (firstFullsnapshot) {
this.rebuildFullSnapshot(firstFullsnapshot);
}
}
Object.defineProperty(Replayer.prototype, "timer", {
get: function () {
return this.service.state.context.timer;
},
enumerable: false,
configurable: true
});
Replayer.prototype.on = function (event, handler) {

@@ -67,4 +101,5 @@ this.emitter.on(event, handler);

Replayer.prototype.getMetaData = function () {
var firstEvent = this.events[0];
var lastEvent = this.events[this.events.length - 1];
var events = this.service.state.context.events;
var firstEvent = events[0];
var lastEvent = events[events.length - 1];
return {

@@ -78,90 +113,39 @@ totalTime: lastEvent.timestamp - firstEvent.timestamp,

Replayer.prototype.getTimeOffset = function () {
return this.baselineTime - this.events[0].timestamp;
var _a = this.service.state.context, baselineTime = _a.baselineTime, events = _a.events;
return baselineTime - events[0].timestamp;
};
Replayer.prototype.play = function (timeOffset) {
var e_1, _a;
var _this = this;
if (timeOffset === void 0) { timeOffset = 0; }
this.timer.clear();
this.baselineTime = this.events[0].timestamp + timeOffset;
var actions = new Array();
var _loop_1 = function (event) {
var isSync = event.timestamp < this_1.baselineTime;
var castFn = this_1.getCastFn(event, isSync);
if (isSync) {
castFn();
}
else {
actions.push({
doAction: function () {
castFn();
_this.emitter.emit(ReplayerEvents.EventCast, event);
},
delay: this_1.getDelay(event),
});
}
};
var this_1 = this;
try {
for (var _b = __values(this.events), _c = _b.next(); !_c.done; _c = _b.next()) {
var event = _c.value;
_loop_1(event);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
this.timer.addActions(actions);
this.timer.start();
this.playing = true;
this.service.send({ type: 'PLAY', payload: { timeOffset: timeOffset } });
this.emitter.emit(ReplayerEvents.Start);
};
Replayer.prototype.pause = function () {
this.timer.clear();
this.playing = false;
this.service.send({ type: 'PAUSE' });
this.emitter.emit(ReplayerEvents.Pause);
};
Replayer.prototype.resume = function (timeOffset) {
var e_2, _a;
if (timeOffset === void 0) { timeOffset = 0; }
this.timer.clear();
this.baselineTime = this.events[0].timestamp + timeOffset;
var actions = new Array();
try {
for (var _b = __values(this.events), _c = _b.next(); !_c.done; _c = _b.next()) {
var event = _c.value;
if (event.timestamp <= this.lastPlayedEvent.timestamp ||
event === this.lastPlayedEvent) {
continue;
}
var castFn = this.getCastFn(event);
actions.push({
doAction: castFn,
delay: this.getDelay(event),
});
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
this.timer.addActions(actions);
this.timer.start();
this.playing = true;
this.service.send({ type: 'RESUME', payload: { timeOffset: timeOffset } });
this.emitter.emit(ReplayerEvents.Resume);
};
Replayer.prototype.startLive = function (baselineTime) {
this.service.send({ type: 'TO_LIVE', payload: { baselineTime: baselineTime } });
};
Replayer.prototype.addEvent = function (rawEvent) {
var _this = this;
var event = this.config.unpackFn
? this.config.unpackFn(rawEvent)
: rawEvent;
var castFn = this.getCastFn(event, true);
castFn();
Promise.resolve().then(function () {
return _this.service.send({ type: 'ADD_EVENT', payload: { event: event } });
});
};
Replayer.prototype.enableInteract = function () {
this.iframe.setAttribute('scrolling', 'auto');
this.iframe.style.pointerEvents = 'auto';
};
Replayer.prototype.disableInteract = function () {
this.iframe.setAttribute('scrolling', 'no');
this.iframe.style.pointerEvents = 'none';
};
Replayer.prototype.setupDom = function () {

@@ -176,24 +160,13 @@ this.wrapper = document.createElement('div');

this.iframe.setAttribute('sandbox', 'allow-same-origin');
this.iframe.setAttribute('scrolling', 'no');
this.iframe.setAttribute('style', 'pointer-events: none');
this.disableInteract();
this.wrapper.appendChild(this.iframe);
};
Replayer.prototype.handleResize = function (dimension) {
this.iframe.width = dimension.width + "px";
this.iframe.height = dimension.height + "px";
this.iframe.setAttribute('width', String(dimension.width));
this.iframe.setAttribute('height', String(dimension.height));
};
Replayer.prototype.getDelay = function (event) {
if (event.type === EventType.IncrementalSnapshot &&
event.data.source === IncrementalSource.MouseMove) {
var firstOffset = event.data.positions[0].timeOffset;
var firstTimestamp = event.timestamp + firstOffset;
event.delay = firstTimestamp - this.baselineTime;
return firstTimestamp - this.baselineTime;
}
event.delay = event.timestamp - this.baselineTime;
return event.timestamp - this.baselineTime;
};
Replayer.prototype.getCastFn = function (event, isSync) {
var _this = this;
if (isSync === void 0) { isSync = false; }
var events = this.service.state.context.events;
var castFn;

@@ -204,2 +177,7 @@ switch (event.type) {

break;
case EventType.Custom:
castFn = function () {
_this.emitter.emit(ReplayerEvents.CustomEvent, event);
};
break;
case EventType.Meta:

@@ -221,3 +199,3 @@ castFn = function () {

castFn = function () {
var e_3, _a;
var e_1, _a;
_this.applyIncremental(event, isSync);

@@ -230,4 +208,4 @@ if (event === _this.nextUserInteractionEvent) {

try {
for (var _b = __values(_this.events), _c = _b.next(); !_c.done; _c = _b.next()) {
var _event = _c.value;
for (var events_1 = __values(events), events_1_1 = events_1.next(); !events_1_1.done; events_1_1 = events_1.next()) {
var _event = events_1_1.value;
if (_event.timestamp <= event.timestamp) {

@@ -245,8 +223,8 @@ continue;

}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
if (events_1_1 && !events_1_1.done && (_a = events_1.return)) _a.call(events_1);
}
finally { if (e_3) throw e_3.error; }
finally { if (e_1) throw e_1.error; }
}

@@ -270,5 +248,6 @@ if (_this.nextUserInteractionEvent) {

}
_this.lastPlayedEvent = event;
if (event === _this.events[_this.events.length - 1]) {
_this.service.send({ type: 'CAST_EVENT', payload: { event: event } });
if (event === events[events.length - 1]) {
_this.restoreSpeed();
_this.service.send('END');
_this.emitter.emit(ReplayerEvents.Finish);

@@ -280,6 +259,6 @@ }

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

@@ -302,2 +281,3 @@ var styleEl = document.createElement('style');

var timer_1;
var beforeLoadState_1 = this.service.state;
head

@@ -307,12 +287,2 @@ .querySelectorAll('link[rel="stylesheet"]')

if (!css.sheet) {
if (unloadSheets_1.size === 0) {
_this.timer.clear();
_this.emitter.emit(ReplayerEvents.LoadStylesheetStart);
timer_1 = window.setTimeout(function () {
if (_this.playing) {
_this.resume(_this.getCurrentTime());
}
timer_1 = -1;
}, _this.config.loadTimeout);
}
unloadSheets_1.add(css);

@@ -322,3 +292,3 @@ css.addEventListener('load', function () {

if (unloadSheets_1.size === 0 && timer_1 !== -1) {
if (_this.playing) {
if (beforeLoadState_1.matches('playing')) {
_this.resume(_this.getCurrentTime());

@@ -334,2 +304,12 @@ }

});
if (unloadSheets_1.size > 0) {
this.service.send({ type: 'PAUSE' });
this.emitter.emit(ReplayerEvents.LoadStylesheetStart);
timer_1 = window.setTimeout(function () {
if (beforeLoadState_1.matches('playing')) {
_this.resume(_this.getCurrentTime());
}
timer_1 = -1;
}, this.config.loadTimeout);
}
}

@@ -339,2 +319,3 @@ };

var _this = this;
var baselineTime = this.service.state.context.baselineTime;
var d = e.data;

@@ -357,3 +338,3 @@ switch (d.source) {

});
var missingNodeMap_1 = __assign({}, this.missingNodeRetryMap);
var legacy_missingNodeMap_1 = __assign({}, this.legacy_missingNodeRetryMap);
var queue_1 = [];

@@ -365,3 +346,2 @@ var appendNode_1 = function (mutation) {

}
var target = buildNodeWithSN(mutation.node, _this.iframe.contentDocument, mirror.map, true);
var previous = null;

@@ -375,4 +355,8 @@ var next = null;

}
if (mutation.nextId !== null && mutation.nextId !== -1 && !next) {
return queue_1.push(mutation);
}
var target = buildNodeWithSN(mutation.node, _this.iframe.contentDocument, mirror.map, true);
if (mutation.previousId === -1 || mutation.nextId === -1) {
missingNodeMap_1[mutation.node.id] = {
legacy_missingNodeMap_1[mutation.node.id] = {
node: target,

@@ -397,3 +381,3 @@ mutation: mutation,

if (mutation.previousId || mutation.nextId) {
_this.resolveMissingNode(missingNodeMap_1, parent, target, mutation);
_this.legacy_resolveMissingNode(legacy_missingNodeMap_1, parent, target, mutation);
}

@@ -411,4 +395,4 @@ };

}
if (Object.keys(missingNodeMap_1).length) {
Object.assign(this.missingNodeRetryMap, missingNodeMap_1);
if (Object.keys(legacy_missingNodeMap_1).length) {
Object.assign(this.legacy_missingNodeRetryMap, legacy_missingNodeMap_1);
}

@@ -452,3 +436,3 @@ d.texts.forEach(function (mutation) {

},
delay: p.timeOffset + e.timestamp - _this.baselineTime,
delay: p.timeOffset + e.timestamp - baselineTime,
};

@@ -475,3 +459,3 @@ _this.timer.addAction(action);

case MouseInteractions.Blur:
if (target.blur) {
if ('blur' in target) {
target.blur();

@@ -600,3 +584,3 @@ }

};
Replayer.prototype.resolveMissingNode = function (map, parent, target, targetMutation) {
Replayer.prototype.legacy_resolveMissingNode = function (map, parent, target, targetMutation) {
var previousId = targetMutation.previousId, nextId = targetMutation.nextId;

@@ -609,5 +593,5 @@ var previousInMap = previousId && map[previousId];

delete map[mutation.node.id];
delete this.missingNodeRetryMap[mutation.node.id];
delete this.legacy_missingNodeRetryMap[mutation.node.id];
if (mutation.previousId || mutation.nextId) {
this.resolveMissingNode(map, parent, node, mutation);
this.legacy_resolveMissingNode(map, parent, node, mutation);
}

@@ -619,5 +603,5 @@ }

delete map[mutation.node.id];
delete this.missingNodeRetryMap[mutation.node.id];
delete this.legacy_missingNodeRetryMap[mutation.node.id];
if (mutation.previousId || mutation.nextId) {
this.resolveMissingNode(map, parent, node, mutation);
this.legacy_resolveMissingNode(map, parent, node, mutation);
}

@@ -624,0 +608,0 @@ }

import { __spread } from '../../node_modules/tslib/tslib.es6.js';
import { EventType, IncrementalSource } from '../types.js';

@@ -68,3 +69,14 @@ var Timer = (function () {

}());
function getDelay(event, baselineTime) {
if (event.type === EventType.IncrementalSnapshot &&
event.data.source === IncrementalSource.MouseMove) {
var firstOffset = event.data.positions[0].timeOffset;
var firstTimestamp = event.timestamp + firstOffset;
event.delay = firstTimestamp - baselineTime;
return firstTimestamp - baselineTime;
}
event.delay = event.timestamp - baselineTime;
return event.timestamp - baselineTime;
}
export default Timer;
export { Timer, getDelay };

@@ -54,4 +54,5 @@ var EventType;

ReplayerEvents["EventCast"] = "event-cast";
ReplayerEvents["CustomEvent"] = "custom-event";
})(ReplayerEvents || (ReplayerEvents = {}));
export { EventType, IncrementalSource, MediaInteractions, MouseInteractions, ReplayerEvents };

@@ -60,5 +60,6 @@ function on(type, fn, target) {

}
function hookSetter(target, key, d, isRevoked) {
var original = Object.getOwnPropertyDescriptor(target, key);
Object.defineProperty(target, key, isRevoked
function hookSetter(target, key, d, isRevoked, win) {
if (win === void 0) { win = window; }
var original = win.Object.getOwnPropertyDescriptor(target, key);
win.Object.defineProperty(target, key, isRevoked
? d

@@ -65,0 +66,0 @@ : {

@@ -74,3 +74,3 @@ 'use strict';

var _id = 1;
var symbolAndNumberRegex = RegExp('[^a-z1-6]');
var symbolAndNumberRegex = RegExp('[^a-z1-6\-]');
function genId() {

@@ -431,5 +431,6 @@ return _id++;

}
function hookSetter(target, key, d, isRevoked) {
var original = Object.getOwnPropertyDescriptor(target, key);
Object.defineProperty(target, key, isRevoked
function hookSetter(target, key, d, isRevoked, win) {
if (win === void 0) { win = window; }
var original = win.Object.getOwnPropertyDescriptor(target, key);
win.Object.defineProperty(target, key, isRevoked
? d

@@ -556,30 +557,5 @@ : {

ReplayerEvents["EventCast"] = "event-cast";
ReplayerEvents["CustomEvent"] = "custom-event";
})(ReplayerEvents || (ReplayerEvents = {}));
function deepDelete(addsSet, n) {
addsSet.delete(n);
n.childNodes.forEach(function (childN) { return deepDelete(addsSet, childN); });
}
function isParentRemoved(removes, 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 isParentRemoved(removes, parentNode);
}
function isAncestorInSet(set, n) {
var parentNode = n.parentNode;
if (!parentNode) {
return false;
}
if (set.has(parentNode)) {
return true;
}
return isAncestorInSet(set, parentNode);
}
var moveKey = function (id, parentId) { return id + "@" + parentId; };

@@ -589,42 +565,80 @@ function isINode(n) {

}
function initMutationObserver(cb, blockClass, inlineStylesheet, maskAllInputs) {
var observer = new MutationObserver(function (mutations) {
var e_1, _a, e_2, _b;
var texts = [];
var attributes = [];
var removes = [];
var adds = [];
var addedSet = new Set();
var movedSet = new Set();
var droppedSet = new Set();
var movedMap = {};
var genAdds = function (n, target) {
if (isBlocked(n, blockClass)) {
return;
var MutationBuffer = (function () {
function MutationBuffer(cb, blockClass, inlineStylesheet, maskAllInputs) {
var _this = this;
this.texts = [];
this.attributes = [];
this.removes = [];
this.adds = [];
this.movedMap = {};
this.addedSet = new Set();
this.movedSet = new Set();
this.droppedSet = new Set();
this.processMutations = function (mutations) {
var e_1, _a, e_2, _b;
mutations.forEach(_this.processMutation);
var addQueue = [];
var pushAdd = function (n) {
var parentId = mirror.getId(n.parentNode);
var nextId = n.nextSibling && mirror.getId(n.nextSibling);
if (parentId === -1 || nextId === -1) {
return addQueue.push(n);
}
_this.adds.push({
parentId: parentId,
nextId: nextId,
node: serializeNodeWithId(n, document, mirror.map, _this.blockClass, true, _this.inlineStylesheet, _this.maskAllInputs),
});
};
try {
for (var _c = __values(_this.movedSet), _d = _c.next(); !_d.done; _d = _c.next()) {
var n = _d.value;
pushAdd(n);
}
}
if (isINode(n)) {
movedSet.add(n);
var targetId = null;
if (target && isINode(target)) {
targetId = target.__sn.id;
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
}
if (targetId) {
movedMap[moveKey(n.__sn.id, targetId)] = true;
finally { if (e_1) throw e_1.error; }
}
try {
for (var _e = __values(_this.addedSet), _f = _e.next(); !_f.done; _f = _e.next()) {
var n = _f.value;
if (!isAncestorInSet(_this.droppedSet, n) &&
!isParentRemoved(_this.removes, n)) {
pushAdd(n);
}
else if (isAncestorInSet(_this.movedSet, n)) {
pushAdd(n);
}
else {
_this.droppedSet.add(n);
}
}
}
else {
addedSet.add(n);
droppedSet.delete(n);
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
}
finally { if (e_2) throw e_2.error; }
}
n.childNodes.forEach(function (childN) { return genAdds(childN); });
while (addQueue.length) {
if (addQueue.every(function (n) { return mirror.getId(n.parentNode) === -1; })) {
break;
}
pushAdd(addQueue.shift());
}
_this.emit();
};
mutations.forEach(function (mutation) {
var type = mutation.type, target = mutation.target, oldValue = mutation.oldValue, addedNodes = mutation.addedNodes, removedNodes = mutation.removedNodes, attributeName = mutation.attributeName;
switch (type) {
this.processMutation = function (m) {
switch (m.type) {
case 'characterData': {
var value = target.textContent;
if (!isBlocked(target, blockClass) && value !== oldValue) {
texts.push({
var value = m.target.textContent;
if (!isBlocked(m.target, _this.blockClass) && value !== m.oldValue) {
_this.texts.push({
value: value,
node: target,
node: m.target,
});

@@ -635,36 +649,37 @@ }

case 'attributes': {
var value = target.getAttribute(attributeName);
if (isBlocked(target, blockClass) || value === oldValue) {
var value = m.target.getAttribute(m.attributeName);
if (isBlocked(m.target, _this.blockClass) || value === m.oldValue) {
return;
}
var item = attributes.find(function (a) { return a.node === target; });
var item = _this.attributes.find(function (a) { return a.node === m.target; });
if (!item) {
item = {
node: target,
node: m.target,
attributes: {},
};
attributes.push(item);
_this.attributes.push(item);
}
item.attributes[attributeName] = transformAttribute(document, attributeName, value);
item.attributes[m.attributeName] = transformAttribute(document, m.attributeName, value);
break;
}
case 'childList': {
addedNodes.forEach(function (n) { return genAdds(n, target); });
removedNodes.forEach(function (n) {
m.addedNodes.forEach(function (n) { return _this.genAdds(n, m.target); });
m.removedNodes.forEach(function (n) {
var nodeId = mirror.getId(n);
var parentId = mirror.getId(target);
if (isBlocked(n, blockClass)) {
var parentId = mirror.getId(m.target);
if (isBlocked(n, _this.blockClass)) {
return;
}
if (addedSet.has(n)) {
deepDelete(addedSet, n);
droppedSet.add(n);
if (_this.addedSet.has(n)) {
deepDelete(_this.addedSet, n);
_this.droppedSet.add(n);
}
else if (addedSet.has(target) && nodeId === -1) ;
else if (isAncestorRemoved(target)) ;
else if (movedSet.has(n) && movedMap[moveKey(nodeId, parentId)]) {
deepDelete(movedSet, n);
else if (_this.addedSet.has(m.target) && nodeId === -1) ;
else if (isAncestorRemoved(m.target)) ;
else if (_this.movedSet.has(n) &&
_this.movedMap[moveKey(nodeId, parentId)]) {
deepDelete(_this.movedSet, n);
}
else {
removes.push({
_this.removes.push({
parentId: parentId,

@@ -679,84 +694,92 @@ id: nodeId,

}
});
var addQueue = [];
var pushAdd = function (n) {
var parentId = mirror.getId(n.parentNode);
if (parentId === -1) {
return addQueue.push(n);
}
adds.push({
parentId: parentId,
previousId: !n.previousSibling
? n.previousSibling
: mirror.getId(n.previousSibling),
nextId: !n.nextSibling
? n.nextSibling
: mirror.getId(n.nextSibling),
node: serializeNodeWithId(n, document, mirror.map, blockClass, true, inlineStylesheet, maskAllInputs),
});
};
try {
for (var movedSet_1 = __values(movedSet), movedSet_1_1 = movedSet_1.next(); !movedSet_1_1.done; movedSet_1_1 = movedSet_1.next()) {
var n = movedSet_1_1.value;
pushAdd(n);
this.genAdds = function (n, target) {
if (isBlocked(n, _this.blockClass)) {
return;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (movedSet_1_1 && !movedSet_1_1.done && (_a = movedSet_1.return)) _a.call(movedSet_1);
}
finally { if (e_1) throw e_1.error; }
}
try {
for (var addedSet_1 = __values(addedSet), addedSet_1_1 = addedSet_1.next(); !addedSet_1_1.done; addedSet_1_1 = addedSet_1.next()) {
var n = addedSet_1_1.value;
if (!isAncestorInSet(droppedSet, n) && !isParentRemoved(removes, n)) {
pushAdd(n);
if (isINode(n)) {
_this.movedSet.add(n);
var targetId = null;
if (target && isINode(target)) {
targetId = target.__sn.id;
}
else if (isAncestorInSet(movedSet, n)) {
pushAdd(n);
if (targetId) {
_this.movedMap[moveKey(n.__sn.id, targetId)] = true;
}
else {
droppedSet.add(n);
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (addedSet_1_1 && !addedSet_1_1.done && (_b = addedSet_1.return)) _b.call(addedSet_1);
else {
_this.addedSet.add(n);
_this.droppedSet.delete(n);
}
finally { if (e_2) throw e_2.error; }
}
while (addQueue.length) {
if (addQueue.every(function (n) { return mirror.getId(n.parentNode) === -1; })) {
break;
n.childNodes.forEach(function (childN) { return _this.genAdds(childN); });
};
this.emit = function () {
var payload = {
texts: _this.texts
.map(function (text) { return ({
id: mirror.getId(text.node),
value: text.value,
}); })
.filter(function (text) { return mirror.has(text.id); }),
attributes: _this.attributes
.map(function (attribute) { return ({
id: mirror.getId(attribute.node),
attributes: attribute.attributes,
}); })
.filter(function (attribute) { return mirror.has(attribute.id); }),
removes: _this.removes,
adds: _this.adds,
};
if (!payload.texts.length &&
!payload.attributes.length &&
!payload.removes.length &&
!payload.adds.length) {
return;
}
pushAdd(addQueue.shift());
}
var payload = {
texts: texts
.map(function (text) { return ({
id: mirror.getId(text.node),
value: text.value,
}); })
.filter(function (text) { return mirror.has(text.id); }),
attributes: attributes
.map(function (attribute) { return ({
id: mirror.getId(attribute.node),
attributes: attribute.attributes,
}); })
.filter(function (attribute) { return mirror.has(attribute.id); }),
removes: removes,
adds: adds,
_this.emissionCallback(payload);
_this.texts = [];
_this.attributes = [];
_this.removes = [];
_this.adds = [];
_this.addedSet = new Set();
_this.movedSet = new Set();
_this.droppedSet = new Set();
_this.movedMap = {};
};
if (!payload.texts.length &&
!payload.attributes.length &&
!payload.removes.length &&
!payload.adds.length) {
return;
}
cb(payload);
});
this.blockClass = blockClass;
this.inlineStylesheet = inlineStylesheet;
this.maskAllInputs = maskAllInputs;
this.emissionCallback = cb;
}
return MutationBuffer;
}());
function deepDelete(addsSet, n) {
addsSet.delete(n);
n.childNodes.forEach(function (childN) { return deepDelete(addsSet, childN); });
}
function isParentRemoved(removes, 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 isParentRemoved(removes, parentNode);
}
function isAncestorInSet(set, n) {
var parentNode = n.parentNode;
if (!parentNode) {
return false;
}
if (set.has(parentNode)) {
return true;
}
return isAncestorInSet(set, parentNode);
}
function initMutationObserver(cb, blockClass, inlineStylesheet, maskAllInputs) {
var mutationBuffer = new MutationBuffer(cb, blockClass, inlineStylesheet, maskAllInputs);
var observer = new MutationObserver(mutationBuffer.processMutations);
observer.observe(document, {

@@ -1144,4 +1167,4 @@ attributes: true,

function takeFullSnapshot(isCheckout) {
var _a, _b, _c, _d;
if (isCheckout === void 0) { isCheckout = false; }
var _a, _b, _c, _d;
wrappedEmit(wrapEvent({

@@ -1148,0 +1171,0 @@ type: EventType.Meta,

{
"name": "rrweb",
"version": "0.7.33",
"version": "0.8.0",
"description": "record and replay the web",

@@ -20,4 +20,4 @@ "scripts": {

],
"main": "lib/rrweb.js",
"module": "es/rrweb/src/index.js",
"main": "lib/rrweb-all.js",
"module": "es/rrweb/entries/all.js",
"unpkg": "dist/rrweb.js",

@@ -53,4 +53,4 @@ "sideEffects": false,

"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-postcss": "^1.6.2",
"rollup-plugin-terser": "^3.0.0",
"rollup-plugin-postcss": "^3.1.1",
"rollup-plugin-terser": "^5.3.0",
"rollup-plugin-typescript": "^1.0.0",

@@ -60,11 +60,12 @@ "ts-node": "^7.0.1",

"tslint": "^4.5.1",
"typescript": "^3.8.3"
"typescript": "^3.9.5"
},
"dependencies": {
"@types/smoothscroll-polyfill": "^0.3.0",
"@xstate/fsm": "^1.4.0",
"mitt": "^1.1.3",
"pako": "^1.0.11",
"rrweb-snapshot": "^0.7.26",
"rrweb-snapshot": "^0.7.27",
"smoothscroll-polyfill": "^0.4.3"
}
}

@@ -29,3 +29,3 @@ <p align="center">

- **[rrweb-snapshot](https://github.com/rrweb-io/rrweb-snapshot)**, including both snapshot and rebuilding features. The snapshot is used to convert the DOM and its state into a serializable data structure with an unique identifier; the rebuilding feature is to rebuild the snapshot into corresponding DOM.
- **[rrweb-snapshot](https://github.com/rrweb-io/rrweb-snapshot)**, including both snapshot and rebuilding features. The snapshot is used to convert the DOM and its state into a serializable data structure with a unique identifier; the rebuilding feature 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.

@@ -32,0 +32,0 @@ - **[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.

import record from './record';
import { Replayer } from './replay';
import { mirror } from './utils';
import * as utils from './utils';
export { EventType, IncrementalSource, MouseInteractions, ReplayerEvents, } from './types';
export { pack, unpack } from './packer';
declare const addCustomEvent: <T>(tag: string, payload: T) => void;
export { record, addCustomEvent, Replayer, mirror };
export { record, addCustomEvent, Replayer, mirror, utils };
import { observerParam, listenerHandler, hooksParam } from '../types';
export declare const INPUT_TAGS: string[];
export declare const MASK_TYPES: string[];
export default function initObservers(o: observerParam, hooks?: hooksParam): listenerHandler;

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

import Timer from './timer';
import { Timer } from './timer';
import { eventWithTime, playerConfig, playerMetaData, Handler } from '../types';

@@ -7,13 +7,10 @@ import './styles/style.css';

iframe: HTMLIFrameElement;
timer: Timer;
private events;
get timer(): Timer;
private config;
private mouse;
private emitter;
private baselineTime;
private lastPlayedEvent;
private nextUserInteractionEvent;
private noramlSpeed;
private missingNodeRetryMap;
private playing;
private legacy_missingNodeRetryMap;
private service;
constructor(events: Array<eventWithTime | string>, config?: Partial<playerConfig>);

@@ -28,6 +25,8 @@ on(event: string, handler: Handler): void;

resume(timeOffset?: number): void;
startLive(baselineTime?: number): void;
addEvent(rawEvent: eventWithTime | string): void;
enableInteract(): void;
disableInteract(): void;
private setupDom;
private handleResize;
private getDelay;
private getCastFn;

@@ -37,3 +36,3 @@ private rebuildFullSnapshot;

private applyIncremental;
private resolveMissingNode;
private legacy_resolveMissingNode;
private moveAndHover;

@@ -40,0 +39,0 @@ private hoverElements;

@@ -1,3 +0,3 @@

import { playerConfig, actionWithDelay } from '../types';
export default class Timer {
import { playerConfig, actionWithDelay, eventWithTime } from '../types';
export declare class Timer {
timeOffset: number;

@@ -14,1 +14,2 @@ private actions;

}
export declare function getDelay(event: eventWithTime, baselineTime: number): number;

@@ -130,2 +130,10 @@ import { serializedNodeWithId, idNodeMap, INode } from 'rrweb-snapshot';

};
export declare type mutationRecord = {
type: string;
target: Node;
oldValue: string | null;
addedNodes: NodeList;
removedNodes: NodeList;
attributeName: string | null;
};
export declare type textCursor = {

@@ -157,3 +165,3 @@ node: Node;

parentId: number;
previousId: number | null;
previousId?: number | null;
nextId: number | null;

@@ -293,4 +301,5 @@ node: serializedNodeWithId;

MouseInteraction = "mouse-interaction",
EventCast = "event-cast"
EventCast = "event-cast",
CustomEvent = "custom-event"
}
export {};

@@ -6,3 +6,3 @@ import { Mirror, throttleOptions, listenerHandler, hookResetter, blockClass } from './types';

export declare function throttle<T>(func: (arg: T) => void, wait: number, options?: throttleOptions): (arg: T) => void;
export declare function hookSetter<T>(target: T, key: string | number | symbol, d: PropertyDescriptor, isRevoked?: boolean): hookResetter;
export declare function hookSetter<T>(target: T, key: string | number | symbol, d: PropertyDescriptor, isRevoked?: boolean, win?: Window & typeof globalThis): hookResetter;
export declare function getWindowHeight(): number;

@@ -9,0 +9,0 @@ export declare function getWindowWidth(): number;

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc