Socket
Socket
Sign inDemoInstall

rrweb-snapshot

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rrweb-snapshot - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

7

dist/rrweb-snapshot.js

@@ -241,4 +241,7 @@ var rrwebSnapshot = (function (exports) {

var _d = n.getBoundingClientRect(), width = _d.width, height = _d.height;
attributes_1.rr_width = width + "px";
attributes_1.rr_height = height + "px";
attributes_1 = {
class: attributes_1.class,
rr_width: width + "px",
rr_height: height + "px",
};
}

@@ -245,0 +248,0 @@ return {

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

var rrwebSnapshot=function(e){"use strict";var t;(t=e.NodeType||(e.NodeType={}))[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment";var r=1,n=RegExp("[^a-z1-6-_]"),a=-2;function i(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).map(o).join(""):null}catch(e){return null}}function o(e){return function(e){return"styleSheet"in e}(e)?i(e.styleSheet)||"":e.cssText}var s=/url\((?:(')([^']*)'|(")([^"]*)"|([^)]*))\)/gm,c=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/,u=/^(data:)([^,]*),(.*)/i;function l(e,t){return(e||"").replace(s,function(e,r,n,a,i,o){var s,l=n||i||o,f=r||a||"";if(!l)return e;if(!c.test(l))return"url("+f+l+f+")";if(u.test(l))return"url("+f+l+f+")";if("/"===l[0])return"url("+f+(((s=t).indexOf("//")>-1?s.split("/").slice(0,3).join("/"):s.split("/")[0]).split("?")[0]+l)+f+")";var p=t.split("/"),m=l.split("/");p.pop();for(var d=0,h=m;d<h.length;d++){var v=h[d];"."!==v&&(".."===v?p.pop():p.push(v))}return"url("+f+p.join("/")+f+")"})}function f(e,t){if(!t||""===t.trim())return t;var r=e.createElement("a");return r.href=t,r.href}function p(e,t,r){return"src"===t||"href"===t&&r?f(e,r):"srcset"===t&&r?function(e,t){return""===t.trim()?t:t.split(",").map(function(t){var r=t.trimLeft().trimRight().split(" ");return 2===r.length?f(e,r[0])+" "+r[1]:1===r.length?""+f(e,r[0]):""}).join(", ")}(e,r):"style"===t&&r?l(r,location.href):r}function m(t,r){var a,o=r.doc,s=r.blockClass,c=r.blockSelector,u=r.inlineStylesheet,f=r.maskInputOptions,m=void 0===f?{}:f,d=r.recordCanvas;switch(t.nodeType){case t.DOCUMENT_NODE:return{type:e.NodeType.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:e.NodeType.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId};case t.ELEMENT_NODE:for(var h=function(e,t,r){if("string"==typeof t){if(e.classList.contains(t))return!0}else e.classList.forEach(function(e){if(t.test(e))return!0});return!!r&&e.matches(r)}(t,s,c),v=function(e){var t=e.toLowerCase().trim();return n.test(t)?"div":t}(t.tagName),y={},g=0,b=Array.from(t.attributes);g<b.length;g++){var T=b[g],N=T.name,C=T.value;y[N]=p(o,N,C)}if("link"===v&&u){var k,E=Array.from(o.styleSheets).find(function(e){return e.href===t.href});(k=i(E))&&(delete y.rel,delete y.href,y._cssText=l(k,E.href))}if("style"===v&&t.sheet&&!(t.innerText||t.textContent||"").trim().length)(k=i(t.sheet))&&(y._cssText=l(k,location.href));if("input"===v||"textarea"===v||"select"===v){C=t.value;"radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&C?y.value=m[y.type]||m[v]?"*".repeat(C.length):C:t.checked&&(y.checked=t.checked)}if("option"===v){var w=t.parentElement;y.value===w.value&&(y.selected=t.selected)}if("canvas"===v&&d&&(y.rr_dataURL=t.toDataURL()),"audio"!==v&&"video"!==v||(y.rr_mediaState=t.paused?"paused":"played"),t.scrollLeft&&(y.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(y.rr_scrollTop=t.scrollTop),h){var x=t.getBoundingClientRect(),D=x.width,_=x.height;y.rr_width=D+"px",y.rr_height=_+"px"}return{type:e.NodeType.Element,tagName:v,attributes:y,childNodes:[],isSVG:(a=t,"svg"===a.tagName||a instanceof SVGElement||void 0),needBlock:h};case t.TEXT_NODE:var S=t.parentNode&&t.parentNode.tagName,A=t.textContent,O="STYLE"===S||void 0;return O&&A&&(A=l(A,location.href)),"SCRIPT"===S&&(A="SCRIPT_PLACEHOLDER"),{type:e.NodeType.Text,textContent:A||"",isStyle:O};case t.CDATA_SECTION_NODE:return{type:e.NodeType.CDATA,textContent:""};case t.COMMENT_NODE:return{type:e.NodeType.Comment,textContent:t.textContent||""};default:return!1}}function d(e){return void 0===e?"":e.toLowerCase()}function h(t,n){var i,o=n.doc,s=n.map,c=n.blockClass,u=n.blockSelector,l=n.skipChild,f=void 0!==l&&l,p=n.inlineStylesheet,v=void 0===p||p,y=n.maskInputOptions,g=void 0===y?{}:y,b=n.slimDOMOptions,T=n.recordCanvas,N=void 0!==T&&T,C=n.preserveWhiteSpace,k=void 0===C||C,E=m(t,{doc:o,blockClass:c,blockSelector:u,inlineStylesheet:v,maskInputOptions:g,recordCanvas:N});if(!E)return console.warn(t,"not serialized"),null;i="__sn"in t?t.__sn.id:!function(t,r){if(r.comment&&t.type===e.NodeType.Comment)return!0;if(t.type===e.NodeType.Element){if(r.script&&("script"===t.tagName||"link"===t.tagName&&"preload"===t.attributes.rel&&"script"===t.attributes.as))return!0;if(r.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(d(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===d(t.attributes.name)||"icon"===d(t.attributes.rel)||"apple-touch-icon"===d(t.attributes.rel)||"shortcut icon"===d(t.attributes.rel))))return!0;if("meta"===t.tagName){if(r.headMetaDescKeywords&&d(t.attributes.name).match(/^description|keywords$/))return!0;if(r.headMetaSocial&&(d(t.attributes.property).match(/^(og|twitter|fb):/)||d(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===d(t.attributes.name)))return!0;if(r.headMetaRobots&&("robots"===d(t.attributes.name)||"googlebot"===d(t.attributes.name)||"bingbot"===d(t.attributes.name)))return!0;if(r.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(r.headMetaAuthorship&&("author"===d(t.attributes.name)||"generator"===d(t.attributes.name)||"framework"===d(t.attributes.name)||"publisher"===d(t.attributes.name)||"progid"===d(t.attributes.name)||d(t.attributes.property).match(/^article:/)||d(t.attributes.property).match(/^product:/)))return!0;if(r.headMetaVerification&&("google-site-verification"===d(t.attributes.name)||"yandex-verification"===d(t.attributes.name)||"csrf-token"===d(t.attributes.name)||"p:domain_verify"===d(t.attributes.name)||"verify-v1"===d(t.attributes.name)||"verification"===d(t.attributes.name)||"shopify-checkout-api-token"===d(t.attributes.name)))return!0}}return!1}(E,b)&&(k||E.type!==e.NodeType.Text||E.isStyle||E.textContent.replace(/^\s+|\s+$/gm,"").length)?r++:a;var w=Object.assign(E,{id:i});if(t.__sn=w,i===a)return null;s[i]=t;var x=!f;if(w.type===e.NodeType.Element&&(x=x&&!w.needBlock,delete w.needBlock),(w.type===e.NodeType.Document||w.type===e.NodeType.Element)&&x){b.headWhitespace&&E.type===e.NodeType.Element&&"head"===E.tagName&&(k=!1);for(var D=0,_=Array.from(t.childNodes);D<_.length;D++){var S=h(_[D],{doc:o,map:s,blockClass:c,blockSelector:u,skipChild:f,inlineStylesheet:v,maskInputOptions:g,slimDOMOptions:b,recordCanvas:N,preserveWhiteSpace:k});S&&w.childNodes.push(S)}}return w}var v=/\/\*[^*]*\*+([^\/*][^*]*\*+)*\//g;function y(e,t){void 0===t&&(t={});var r=1,n=1;function a(e){var t=e.match(/\n/g);t&&(r+=t.length);var a=e.lastIndexOf("\n");n=-1===a?n+e.length:e.length-a}function i(){var e={line:r,column:n};return function(t){return t.position=new o(e),m(),t}}var o=function(){return function(e){this.start=e,this.end={line:r,column:n},this.source=t.source}}();o.prototype.content=e;var s=[];function c(a){var i=new Error(t.source+":"+r+":"+n+": "+a);if(i.reason=a,i.filename=t.source,i.line=r,i.column=n,i.source=e,!t.silent)throw i;s.push(i)}function u(){return p(/^{\s*/)}function l(){return p(/^}/)}function f(){var t,r=[];for(m(),d(r);e.length&&"}"!==e.charAt(0)&&(t=D()||_());)!1!==t&&(r.push(t),d(r));return r}function p(t){var r=t.exec(e);if(r){var n=r[0];return a(n),e=e.slice(n.length),r}}function m(){p(/^\s*/)}function d(e){var t;for(void 0===e&&(e=[]);t=h();)!1!==t&&e.push(t),t=h();return e}function h(){var t=i();if("/"===e.charAt(0)&&"*"===e.charAt(1)){for(var r=2;""!==e.charAt(r)&&("*"!==e.charAt(r)||"/"!==e.charAt(r+1));)++r;if(r+=2,""===e.charAt(r-1))return c("End of comment missing");var o=e.slice(2,r-2);return n+=2,a(o),e=e.slice(r),n+=2,t({type:"comment",comment:o})}}function y(){var e=p(/^([^{]+)/);if(e)return g(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,function(e){return e.replace(/,/g,"‌")}).split(/\s*(?![^(]*\)),\s*/).map(function(e){return e.replace(/\u200C/g,",")})}function b(){var e=i(),t=p(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(t){var r=g(t[0]);if(!p(/^:\s*/))return c("property missing ':'");var n=p(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),a=e({type:"declaration",property:r.replace(v,""),value:n?g(n[0]).replace(v,""):""});return p(/^[;\s]*/),a}}function T(){var e,t=[];if(!u())return c("missing '{'");for(d(t);e=b();)!1!==e&&(t.push(e),d(t)),e=b();return l()?t:c("missing '}'")}function N(){for(var e,t=[],r=i();e=p(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),p(/^,\s*/);if(t.length)return r({type:"keyframe",values:t,declarations:T()})}var C,k=x("import"),E=x("charset"),w=x("namespace");function x(e){var t=new RegExp("^@"+e+"\\s*([^;]+);");return function(){var r=i(),n=p(t);if(n){var a={type:e};return a[e]=n[1].trim(),r(a)}}}function D(){if("@"===e[0])return function(){var e=i(),t=p(/^@([-\w]+)?keyframes\s*/);if(t){var r=t[1];if(!(t=p(/^([-\w]+)\s*/)))return c("@keyframes missing name");var n,a=t[1];if(!u())return c("@keyframes missing '{'");for(var o=d();n=N();)o.push(n),o=o.concat(d());return l()?e({type:"keyframes",name:a,vendor:r,keyframes:o}):c("@keyframes missing '}'")}}()||function(){var e=i(),t=p(/^@media *([^{]+)/);if(t){var r=g(t[1]);if(!u())return c("@media missing '{'");var n=d().concat(f());return l()?e({type:"media",media:r,rules:n}):c("@media missing '}'")}}()||function(){var e=i(),t=p(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:g(t[1]),media:g(t[2])})}()||function(){var e=i(),t=p(/^@supports *([^{]+)/);if(t){var r=g(t[1]);if(!u())return c("@supports missing '{'");var n=d().concat(f());return l()?e({type:"supports",supports:r,rules:n}):c("@supports missing '}'")}}()||k()||E()||w()||function(){var e=i(),t=p(/^@([-\w]+)?document *([^{]+)/);if(t){var r=g(t[1]),n=g(t[2]);if(!u())return c("@document missing '{'");var a=d().concat(f());return l()?e({type:"document",document:n,vendor:r,rules:a}):c("@document missing '}'")}}()||function(){var e=i();if(p(/^@page */)){var t=y()||[];if(!u())return c("@page missing '{'");for(var r,n=d();r=b();)n.push(r),n=n.concat(d());return l()?e({type:"page",selectors:t,declarations:n}):c("@page missing '}'")}}()||function(){var e=i();if(p(/^@host\s*/)){if(!u())return c("@host missing '{'");var t=d().concat(f());return l()?e({type:"host",rules:t}):c("@host missing '}'")}}()||function(){var e=i();if(p(/^@font-face\s*/)){if(!u())return c("@font-face missing '{'");for(var t,r=d();t=b();)r.push(t),r=r.concat(d());return l()?e({type:"font-face",declarations:r}):c("@font-face missing '}'")}}()}function _(){var e=i(),t=y();return t?(d(),e({type:"rule",selectors:t,declarations:T()})):c("selector missing")}return function e(t,r){var n=t&&"string"==typeof t.type;var a=n?t:r;for(var i=0,o=Object.keys(t);i<o.length;i++){var s=o[i],c=t[s];Array.isArray(c)?c.forEach(function(t){e(t,a)}):c&&"object"==typeof c&&e(c,a)}n&&Object.defineProperty(t,"parent",{configurable:!0,writable:!0,enumerable:!1,value:r||null});return t}((C=f(),{type:"stylesheet",stylesheet:{source:t.source,rules:C,parsingErrors:s}}))}function g(e){return e?e.replace(/^\s+|\s+$/g,""):""}var b={script:"noscript",altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};var T=/([^\\]):hover/g;function N(e){var t=y(e,{silent:!0});return t.stylesheet?(t.stylesheet.rules.forEach(function(t){"selectors"in t&&(t.selectors||[]).forEach(function(t){if(T.test(t)){var r=t.replace(T,"$1.\\:hover");e=e.replace(t,t+", "+r)}})}),e):e}function C(t,r){var n=r.doc,a=r.hackCss;switch(t.type){case e.NodeType.Document:return n.implementation.createDocument(null,"",null);case e.NodeType.DocumentType:return n.implementation.createDocumentType(t.name||"html",t.publicId,t.systemId);case e.NodeType.Element:var i,o=function(e){var t=b[e.tagName]?b[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(t);i=t.isSVG?n.createElementNS("http://www.w3.org/2000/svg",o):n.createElement(o);var s=function(e){if(!t.attributes.hasOwnProperty(e))return"continue";var r=t.attributes[e];if(r="boolean"==typeof r||"number"==typeof r?"":r,e.startsWith("rr_")){if("canvas"===o&&"rr_dataURL"===e){var s=document.createElement("img");s.src=r,s.onload=function(){var e=i.getContext("2d");e&&e.drawImage(s,0,0,s.width,s.height)}}if("rr_width"===e&&(i.style.width=r),"rr_height"===e&&(i.style.height=r),"rr_mediaState"===e)switch(r){case"played":i.play();case"paused":i.pause()}}else{var c="textarea"===o&&"value"===e,u="style"===o&&"_cssText"===e;if(u&&a&&(r=N(r)),c||u){for(var l=n.createTextNode(r),f=0,p=Array.from(i.childNodes);f<p.length;f++){var m=p[f];m.nodeType===i.TEXT_NODE&&i.removeChild(m)}return i.appendChild(l),"continue"}if("iframe"===o&&"src"===e)return"continue";try{t.isSVG&&"xlink:href"===e?i.setAttributeNS("http://www.w3.org/1999/xlink",e,r):"onload"===e||"onclick"===e||"onmouse"===e.substring(0,7)?i.setAttribute("_"+e,r):i.setAttribute(e,r)}catch(e){}}};for(var c in t.attributes)s(c);return i;case e.NodeType.Text:return n.createTextNode(t.isStyle&&a?N(t.textContent):t.textContent);case e.NodeType.CDATA:return n.createCDATASection(t.textContent);case e.NodeType.Comment:return n.createComment(t.textContent);default:return null}}function k(t,r){var n=r.doc,a=r.map,i=r.skipChild,o=void 0!==i&&i,s=r.hackCss,c=void 0===s||s,u=C(t,{doc:n,hackCss:c});if(!u)return null;if(t.type===e.NodeType.Document&&(n.close(),n.open(),u=n),u.__sn=t,a[t.id]=u,(t.type===e.NodeType.Document||t.type===e.NodeType.Element)&&!o)for(var l=0,f=t.childNodes;l<f.length;l++){var p=f[l],m=k(p,{doc:n,map:a,skipChild:!1,hackCss:c});m?u.appendChild(m):console.warn("Failed to rebuild",p)}return u}return e.snapshot=function(e,t){var r=t||{},n=r.blockClass,a=void 0===n?"rr-block":n,i=r.inlineStylesheet,o=void 0===i||i,s=r.recordCanvas,c=void 0!==s&&s,u=r.blockSelector,l=void 0===u?null:u,f=r.maskAllInputs,p=void 0!==f&&f,m=r.slimDOM,d=void 0!==m&&m,v={};return[h(e,{doc:e,map:v,blockClass:a,blockSelector:l,skipChild:!1,inlineStylesheet:o,maskInputOptions:!0===p?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0}:!1===p?{}:p,slimDOMOptions:!0===d||"all"===d?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===d,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===d?{}:d,recordCanvas:c}),v]},e.serializeNodeWithId=h,e.rebuild=function(t,r){var n=r.doc,a=r.onVisit,i=r.hackCss,o={},s=k(t,{doc:n,map:o,skipChild:!1,hackCss:void 0===i||i});return function(e,t){for(var r in e)e[r]&&(n=e[r],t(n));var n}(o,function(t){a&&a(t),function(t){var r=t.__sn;if(r.type===e.NodeType.Element){var n=t;for(var a in r.attributes)if(r.attributes.hasOwnProperty(a)&&a.startsWith("rr_")){var i=r.attributes[a];"rr_scrollLeft"===a&&(n.scrollLeft=i),"rr_scrollTop"===a&&(n.scrollTop=i)}}}(t)}),[s,o]},e.buildNodeWithSN=k,e.addHoverClass=N,e.transformAttribute=p,e.visitSnapshot=function(t,r){!function t(n){r(n),n.type!==e.NodeType.Document&&n.type!==e.NodeType.Element||n.childNodes.forEach(t)}(t)},e.cleanupSnapshot=function(){r=1},e.IGNORED_NODE=a,e}({});
var rrwebSnapshot=function(e){"use strict";var t;(t=e.NodeType||(e.NodeType={}))[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment";var r=1,n=RegExp("[^a-z1-6-_]"),a=-2;function i(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).map(o).join(""):null}catch(e){return null}}function o(e){return function(e){return"styleSheet"in e}(e)?i(e.styleSheet)||"":e.cssText}var s=/url\((?:(')([^']*)'|(")([^"]*)"|([^)]*))\)/gm,c=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/,u=/^(data:)([^,]*),(.*)/i;function l(e,t){return(e||"").replace(s,function(e,r,n,a,i,o){var s,l=n||i||o,f=r||a||"";if(!l)return e;if(!c.test(l))return"url("+f+l+f+")";if(u.test(l))return"url("+f+l+f+")";if("/"===l[0])return"url("+f+(((s=t).indexOf("//")>-1?s.split("/").slice(0,3).join("/"):s.split("/")[0]).split("?")[0]+l)+f+")";var p=t.split("/"),m=l.split("/");p.pop();for(var d=0,h=m;d<h.length;d++){var v=h[d];"."!==v&&(".."===v?p.pop():p.push(v))}return"url("+f+p.join("/")+f+")"})}function f(e,t){if(!t||""===t.trim())return t;var r=e.createElement("a");return r.href=t,r.href}function p(e,t,r){return"src"===t||"href"===t&&r?f(e,r):"srcset"===t&&r?function(e,t){return""===t.trim()?t:t.split(",").map(function(t){var r=t.trimLeft().trimRight().split(" ");return 2===r.length?f(e,r[0])+" "+r[1]:1===r.length?""+f(e,r[0]):""}).join(", ")}(e,r):"style"===t&&r?l(r,location.href):r}function m(t,r){var a,o=r.doc,s=r.blockClass,c=r.blockSelector,u=r.inlineStylesheet,f=r.maskInputOptions,m=void 0===f?{}:f,d=r.recordCanvas;switch(t.nodeType){case t.DOCUMENT_NODE:return{type:e.NodeType.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:e.NodeType.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId};case t.ELEMENT_NODE:for(var h=function(e,t,r){if("string"==typeof t){if(e.classList.contains(t))return!0}else e.classList.forEach(function(e){if(t.test(e))return!0});return!!r&&e.matches(r)}(t,s,c),v=function(e){var t=e.toLowerCase().trim();return n.test(t)?"div":t}(t.tagName),y={},g=0,b=Array.from(t.attributes);g<b.length;g++){var T=b[g],N=T.name,C=T.value;y[N]=p(o,N,C)}if("link"===v&&u){var k,E=Array.from(o.styleSheets).find(function(e){return e.href===t.href});(k=i(E))&&(delete y.rel,delete y.href,y._cssText=l(k,E.href))}if("style"===v&&t.sheet&&!(t.innerText||t.textContent||"").trim().length)(k=i(t.sheet))&&(y._cssText=l(k,location.href));if("input"===v||"textarea"===v||"select"===v){C=t.value;"radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&C?y.value=m[y.type]||m[v]?"*".repeat(C.length):C:t.checked&&(y.checked=t.checked)}if("option"===v){var w=t.parentElement;y.value===w.value&&(y.selected=t.selected)}if("canvas"===v&&d&&(y.rr_dataURL=t.toDataURL()),"audio"!==v&&"video"!==v||(y.rr_mediaState=t.paused?"paused":"played"),t.scrollLeft&&(y.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(y.rr_scrollTop=t.scrollTop),h){var x=t.getBoundingClientRect(),D=x.width,_=x.height;y={class:y.class,rr_width:D+"px",rr_height:_+"px"}}return{type:e.NodeType.Element,tagName:v,attributes:y,childNodes:[],isSVG:(a=t,"svg"===a.tagName||a instanceof SVGElement||void 0),needBlock:h};case t.TEXT_NODE:var S=t.parentNode&&t.parentNode.tagName,A=t.textContent,O="STYLE"===S||void 0;return O&&A&&(A=l(A,location.href)),"SCRIPT"===S&&(A="SCRIPT_PLACEHOLDER"),{type:e.NodeType.Text,textContent:A||"",isStyle:O};case t.CDATA_SECTION_NODE:return{type:e.NodeType.CDATA,textContent:""};case t.COMMENT_NODE:return{type:e.NodeType.Comment,textContent:t.textContent||""};default:return!1}}function d(e){return void 0===e?"":e.toLowerCase()}function h(t,n){var i,o=n.doc,s=n.map,c=n.blockClass,u=n.blockSelector,l=n.skipChild,f=void 0!==l&&l,p=n.inlineStylesheet,v=void 0===p||p,y=n.maskInputOptions,g=void 0===y?{}:y,b=n.slimDOMOptions,T=n.recordCanvas,N=void 0!==T&&T,C=n.preserveWhiteSpace,k=void 0===C||C,E=m(t,{doc:o,blockClass:c,blockSelector:u,inlineStylesheet:v,maskInputOptions:g,recordCanvas:N});if(!E)return console.warn(t,"not serialized"),null;i="__sn"in t?t.__sn.id:!function(t,r){if(r.comment&&t.type===e.NodeType.Comment)return!0;if(t.type===e.NodeType.Element){if(r.script&&("script"===t.tagName||"link"===t.tagName&&"preload"===t.attributes.rel&&"script"===t.attributes.as))return!0;if(r.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(d(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===d(t.attributes.name)||"icon"===d(t.attributes.rel)||"apple-touch-icon"===d(t.attributes.rel)||"shortcut icon"===d(t.attributes.rel))))return!0;if("meta"===t.tagName){if(r.headMetaDescKeywords&&d(t.attributes.name).match(/^description|keywords$/))return!0;if(r.headMetaSocial&&(d(t.attributes.property).match(/^(og|twitter|fb):/)||d(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===d(t.attributes.name)))return!0;if(r.headMetaRobots&&("robots"===d(t.attributes.name)||"googlebot"===d(t.attributes.name)||"bingbot"===d(t.attributes.name)))return!0;if(r.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(r.headMetaAuthorship&&("author"===d(t.attributes.name)||"generator"===d(t.attributes.name)||"framework"===d(t.attributes.name)||"publisher"===d(t.attributes.name)||"progid"===d(t.attributes.name)||d(t.attributes.property).match(/^article:/)||d(t.attributes.property).match(/^product:/)))return!0;if(r.headMetaVerification&&("google-site-verification"===d(t.attributes.name)||"yandex-verification"===d(t.attributes.name)||"csrf-token"===d(t.attributes.name)||"p:domain_verify"===d(t.attributes.name)||"verify-v1"===d(t.attributes.name)||"verification"===d(t.attributes.name)||"shopify-checkout-api-token"===d(t.attributes.name)))return!0}}return!1}(E,b)&&(k||E.type!==e.NodeType.Text||E.isStyle||E.textContent.replace(/^\s+|\s+$/gm,"").length)?r++:a;var w=Object.assign(E,{id:i});if(t.__sn=w,i===a)return null;s[i]=t;var x=!f;if(w.type===e.NodeType.Element&&(x=x&&!w.needBlock,delete w.needBlock),(w.type===e.NodeType.Document||w.type===e.NodeType.Element)&&x){b.headWhitespace&&E.type===e.NodeType.Element&&"head"===E.tagName&&(k=!1);for(var D=0,_=Array.from(t.childNodes);D<_.length;D++){var S=h(_[D],{doc:o,map:s,blockClass:c,blockSelector:u,skipChild:f,inlineStylesheet:v,maskInputOptions:g,slimDOMOptions:b,recordCanvas:N,preserveWhiteSpace:k});S&&w.childNodes.push(S)}}return w}var v=/\/\*[^*]*\*+([^\/*][^*]*\*+)*\//g;function y(e,t){void 0===t&&(t={});var r=1,n=1;function a(e){var t=e.match(/\n/g);t&&(r+=t.length);var a=e.lastIndexOf("\n");n=-1===a?n+e.length:e.length-a}function i(){var e={line:r,column:n};return function(t){return t.position=new o(e),m(),t}}var o=function(){return function(e){this.start=e,this.end={line:r,column:n},this.source=t.source}}();o.prototype.content=e;var s=[];function c(a){var i=new Error(t.source+":"+r+":"+n+": "+a);if(i.reason=a,i.filename=t.source,i.line=r,i.column=n,i.source=e,!t.silent)throw i;s.push(i)}function u(){return p(/^{\s*/)}function l(){return p(/^}/)}function f(){var t,r=[];for(m(),d(r);e.length&&"}"!==e.charAt(0)&&(t=D()||_());)!1!==t&&(r.push(t),d(r));return r}function p(t){var r=t.exec(e);if(r){var n=r[0];return a(n),e=e.slice(n.length),r}}function m(){p(/^\s*/)}function d(e){var t;for(void 0===e&&(e=[]);t=h();)!1!==t&&e.push(t),t=h();return e}function h(){var t=i();if("/"===e.charAt(0)&&"*"===e.charAt(1)){for(var r=2;""!==e.charAt(r)&&("*"!==e.charAt(r)||"/"!==e.charAt(r+1));)++r;if(r+=2,""===e.charAt(r-1))return c("End of comment missing");var o=e.slice(2,r-2);return n+=2,a(o),e=e.slice(r),n+=2,t({type:"comment",comment:o})}}function y(){var e=p(/^([^{]+)/);if(e)return g(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,function(e){return e.replace(/,/g,"‌")}).split(/\s*(?![^(]*\)),\s*/).map(function(e){return e.replace(/\u200C/g,",")})}function b(){var e=i(),t=p(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(t){var r=g(t[0]);if(!p(/^:\s*/))return c("property missing ':'");var n=p(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),a=e({type:"declaration",property:r.replace(v,""),value:n?g(n[0]).replace(v,""):""});return p(/^[;\s]*/),a}}function T(){var e,t=[];if(!u())return c("missing '{'");for(d(t);e=b();)!1!==e&&(t.push(e),d(t)),e=b();return l()?t:c("missing '}'")}function N(){for(var e,t=[],r=i();e=p(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),p(/^,\s*/);if(t.length)return r({type:"keyframe",values:t,declarations:T()})}var C,k=x("import"),E=x("charset"),w=x("namespace");function x(e){var t=new RegExp("^@"+e+"\\s*([^;]+);");return function(){var r=i(),n=p(t);if(n){var a={type:e};return a[e]=n[1].trim(),r(a)}}}function D(){if("@"===e[0])return function(){var e=i(),t=p(/^@([-\w]+)?keyframes\s*/);if(t){var r=t[1];if(!(t=p(/^([-\w]+)\s*/)))return c("@keyframes missing name");var n,a=t[1];if(!u())return c("@keyframes missing '{'");for(var o=d();n=N();)o.push(n),o=o.concat(d());return l()?e({type:"keyframes",name:a,vendor:r,keyframes:o}):c("@keyframes missing '}'")}}()||function(){var e=i(),t=p(/^@media *([^{]+)/);if(t){var r=g(t[1]);if(!u())return c("@media missing '{'");var n=d().concat(f());return l()?e({type:"media",media:r,rules:n}):c("@media missing '}'")}}()||function(){var e=i(),t=p(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:g(t[1]),media:g(t[2])})}()||function(){var e=i(),t=p(/^@supports *([^{]+)/);if(t){var r=g(t[1]);if(!u())return c("@supports missing '{'");var n=d().concat(f());return l()?e({type:"supports",supports:r,rules:n}):c("@supports missing '}'")}}()||k()||E()||w()||function(){var e=i(),t=p(/^@([-\w]+)?document *([^{]+)/);if(t){var r=g(t[1]),n=g(t[2]);if(!u())return c("@document missing '{'");var a=d().concat(f());return l()?e({type:"document",document:n,vendor:r,rules:a}):c("@document missing '}'")}}()||function(){var e=i();if(p(/^@page */)){var t=y()||[];if(!u())return c("@page missing '{'");for(var r,n=d();r=b();)n.push(r),n=n.concat(d());return l()?e({type:"page",selectors:t,declarations:n}):c("@page missing '}'")}}()||function(){var e=i();if(p(/^@host\s*/)){if(!u())return c("@host missing '{'");var t=d().concat(f());return l()?e({type:"host",rules:t}):c("@host missing '}'")}}()||function(){var e=i();if(p(/^@font-face\s*/)){if(!u())return c("@font-face missing '{'");for(var t,r=d();t=b();)r.push(t),r=r.concat(d());return l()?e({type:"font-face",declarations:r}):c("@font-face missing '}'")}}()}function _(){var e=i(),t=y();return t?(d(),e({type:"rule",selectors:t,declarations:T()})):c("selector missing")}return function e(t,r){var n=t&&"string"==typeof t.type;var a=n?t:r;for(var i=0,o=Object.keys(t);i<o.length;i++){var s=o[i],c=t[s];Array.isArray(c)?c.forEach(function(t){e(t,a)}):c&&"object"==typeof c&&e(c,a)}n&&Object.defineProperty(t,"parent",{configurable:!0,writable:!0,enumerable:!1,value:r||null});return t}((C=f(),{type:"stylesheet",stylesheet:{source:t.source,rules:C,parsingErrors:s}}))}function g(e){return e?e.replace(/^\s+|\s+$/g,""):""}var b={script:"noscript",altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};var T=/([^\\]):hover/g;function N(e){var t=y(e,{silent:!0});return t.stylesheet?(t.stylesheet.rules.forEach(function(t){"selectors"in t&&(t.selectors||[]).forEach(function(t){if(T.test(t)){var r=t.replace(T,"$1.\\:hover");e=e.replace(t,t+", "+r)}})}),e):e}function C(t,r){var n=r.doc,a=r.hackCss;switch(t.type){case e.NodeType.Document:return n.implementation.createDocument(null,"",null);case e.NodeType.DocumentType:return n.implementation.createDocumentType(t.name||"html",t.publicId,t.systemId);case e.NodeType.Element:var i,o=function(e){var t=b[e.tagName]?b[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(t);i=t.isSVG?n.createElementNS("http://www.w3.org/2000/svg",o):n.createElement(o);var s=function(e){if(!t.attributes.hasOwnProperty(e))return"continue";var r=t.attributes[e];if(r="boolean"==typeof r||"number"==typeof r?"":r,e.startsWith("rr_")){if("canvas"===o&&"rr_dataURL"===e){var s=document.createElement("img");s.src=r,s.onload=function(){var e=i.getContext("2d");e&&e.drawImage(s,0,0,s.width,s.height)}}if("rr_width"===e&&(i.style.width=r),"rr_height"===e&&(i.style.height=r),"rr_mediaState"===e)switch(r){case"played":i.play();case"paused":i.pause()}}else{var c="textarea"===o&&"value"===e,u="style"===o&&"_cssText"===e;if(u&&a&&(r=N(r)),c||u){for(var l=n.createTextNode(r),f=0,p=Array.from(i.childNodes);f<p.length;f++){var m=p[f];m.nodeType===i.TEXT_NODE&&i.removeChild(m)}return i.appendChild(l),"continue"}if("iframe"===o&&"src"===e)return"continue";try{t.isSVG&&"xlink:href"===e?i.setAttributeNS("http://www.w3.org/1999/xlink",e,r):"onload"===e||"onclick"===e||"onmouse"===e.substring(0,7)?i.setAttribute("_"+e,r):i.setAttribute(e,r)}catch(e){}}};for(var c in t.attributes)s(c);return i;case e.NodeType.Text:return n.createTextNode(t.isStyle&&a?N(t.textContent):t.textContent);case e.NodeType.CDATA:return n.createCDATASection(t.textContent);case e.NodeType.Comment:return n.createComment(t.textContent);default:return null}}function k(t,r){var n=r.doc,a=r.map,i=r.skipChild,o=void 0!==i&&i,s=r.hackCss,c=void 0===s||s,u=C(t,{doc:n,hackCss:c});if(!u)return null;if(t.type===e.NodeType.Document&&(n.close(),n.open(),u=n),u.__sn=t,a[t.id]=u,(t.type===e.NodeType.Document||t.type===e.NodeType.Element)&&!o)for(var l=0,f=t.childNodes;l<f.length;l++){var p=f[l],m=k(p,{doc:n,map:a,skipChild:!1,hackCss:c});m?u.appendChild(m):console.warn("Failed to rebuild",p)}return u}return e.snapshot=function(e,t){var r=t||{},n=r.blockClass,a=void 0===n?"rr-block":n,i=r.inlineStylesheet,o=void 0===i||i,s=r.recordCanvas,c=void 0!==s&&s,u=r.blockSelector,l=void 0===u?null:u,f=r.maskAllInputs,p=void 0!==f&&f,m=r.slimDOM,d=void 0!==m&&m,v={};return[h(e,{doc:e,map:v,blockClass:a,blockSelector:l,skipChild:!1,inlineStylesheet:o,maskInputOptions:!0===p?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0}:!1===p?{}:p,slimDOMOptions:!0===d||"all"===d?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===d,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===d?{}:d,recordCanvas:c}),v]},e.serializeNodeWithId=h,e.rebuild=function(t,r){var n=r.doc,a=r.onVisit,i=r.hackCss,o={},s=k(t,{doc:n,map:o,skipChild:!1,hackCss:void 0===i||i});return function(e,t){for(var r in e)e[r]&&(n=e[r],t(n));var n}(o,function(t){a&&a(t),function(t){var r=t.__sn;if(r.type===e.NodeType.Element){var n=t;for(var a in r.attributes)if(r.attributes.hasOwnProperty(a)&&a.startsWith("rr_")){var i=r.attributes[a];"rr_scrollLeft"===a&&(n.scrollLeft=i),"rr_scrollTop"===a&&(n.scrollTop=i)}}}(t)}),[s,o]},e.buildNodeWithSN=k,e.addHoverClass=N,e.transformAttribute=p,e.visitSnapshot=function(t,r){!function t(n){r(n),n.type!==e.NodeType.Document&&n.type!==e.NodeType.Element||n.childNodes.forEach(t)}(t)},e.cleanupSnapshot=function(){r=1},e.IGNORED_NODE=a,e}({});
//# sourceMappingURL=rrweb-snapshot.min.js.map

@@ -239,4 +239,7 @@ var NodeType;

var _d = n.getBoundingClientRect(), width = _d.width, height = _d.height;
attributes_1.rr_width = width + "px";
attributes_1.rr_height = height + "px";
attributes_1 = {
class: attributes_1.class,
rr_width: width + "px",
rr_height: height + "px",
};
}

@@ -243,0 +246,0 @@ return {

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

var NodeType;!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,tagNameRegex=RegExp("[^a-z1-6-_]"),IGNORED_NODE=-2;function genId(){return _id++}function getValidTagName(e){var t=e.toLowerCase().trim();return tagNameRegex.test(t)?"div":t}function getCssRulesString(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).map(getCssRuleString).join(""):null}catch(e){return null}}function getCssRuleString(e){return isCSSImportRule(e)?getCssRulesString(e.styleSheet)||"":e.cssText}function isCSSImportRule(e){return"styleSheet"in e}function extractOrigin(e){return(e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0]).split("?")[0]}var URL_IN_CSS_REF=/url\((?:(')([^']*)'|(")([^"]*)"|([^)]*))\)/gm,RELATIVE_PATH=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/,DATA_URI=/^(data:)([^,]*),(.*)/i;function absoluteToStylesheet(e,t){return(e||"").replace(URL_IN_CSS_REF,function(e,r,n,i,a,o){var s=n||a||o,l=r||i||"";if(!s)return e;if(!RELATIVE_PATH.test(s))return"url("+l+s+l+")";if(DATA_URI.test(s))return"url("+l+s+l+")";if("/"===s[0])return"url("+l+(extractOrigin(t)+s)+l+")";var c=t.split("/"),u=s.split("/");c.pop();for(var f=0,p=u;f<p.length;f++){var d=p[f];"."!==d&&(".."===d?c.pop():c.push(d))}return"url("+l+c.join("/")+l+")"})}function getAbsoluteSrcsetString(e,t){return""===t.trim()?t:t.split(",").map(function(t){var r=t.trimLeft().trimRight().split(" ");return 2===r.length?absoluteToDoc(e,r[0])+" "+r[1]:1===r.length?""+absoluteToDoc(e,r[0]):""}).join(", ")}function absoluteToDoc(e,t){if(!t||""===t.trim())return t;var r=e.createElement("a");return r.href=t,r.href}function isSVGElement(e){return"svg"===e.tagName||e instanceof SVGElement}function transformAttribute(e,t,r){return"src"===t||"href"===t&&r?absoluteToDoc(e,r):"srcset"===t&&r?getAbsoluteSrcsetString(e,r):"style"===t&&r?absoluteToStylesheet(r,location.href):r}function _isBlockedElement(e,t,r){if("string"==typeof t){if(e.classList.contains(t))return!0}else e.classList.forEach(function(e){if(t.test(e))return!0});return!!r&&e.matches(r)}function serializeNode(e,t){var r=t.doc,n=t.blockClass,i=t.blockSelector,a=t.inlineStylesheet,o=t.maskInputOptions,s=void 0===o?{}:o,l=t.recordCanvas;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 c=_isBlockedElement(e,n,i),u=getValidTagName(e.tagName),f={},p=0,d=Array.from(e.attributes);p<d.length;p++){var m=d[p],h=m.name,v=m.value;f[h]=transformAttribute(r,h,v)}if("link"===u&&a){var g,y=Array.from(r.styleSheets).find(function(t){return t.href===e.href});(g=getCssRulesString(y))&&(delete f.rel,delete f.href,f._cssText=absoluteToStylesheet(g,y.href))}if("style"===u&&e.sheet&&!(e.innerText||e.textContent||"").trim().length)(g=getCssRulesString(e.sheet))&&(f._cssText=absoluteToStylesheet(g,location.href));if("input"===u||"textarea"===u||"select"===u){v=e.value;"radio"!==f.type&&"checkbox"!==f.type&&"submit"!==f.type&&"button"!==f.type&&v?f.value=s[f.type]||s[u]?"*".repeat(v.length):v:e.checked&&(f.checked=e.checked)}if("option"===u){var b=e.parentElement;f.value===b.value&&(f.selected=e.selected)}if("canvas"===u&&l&&(f.rr_dataURL=e.toDataURL()),"audio"!==u&&"video"!==u||(f.rr_mediaState=e.paused?"paused":"played"),e.scrollLeft&&(f.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(f.rr_scrollTop=e.scrollTop),c){var E=e.getBoundingClientRect(),N=E.width,T=E.height;f.rr_width=N+"px",f.rr_height=T+"px"}return{type:NodeType.Element,tagName:u,attributes:f,childNodes:[],isSVG:isSVGElement(e)||void 0,needBlock:c};case e.TEXT_NODE:var C=e.parentNode&&e.parentNode.tagName,x=e.textContent,S="STYLE"===C||void 0;return S&&x&&(x=absoluteToStylesheet(x,location.href)),"SCRIPT"===C&&(x="SCRIPT_PLACEHOLDER"),{type:NodeType.Text,textContent:x||"",isStyle:S};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 lowerIfExists(e){return void 0===e?"":e.toLowerCase()}function slimDOMExcluded(e,t){if(t.comment&&e.type===NodeType.Comment)return!0;if(e.type===NodeType.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&"preload"===e.attributes.rel&&"script"===e.attributes.as))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(lowerIfExists(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===lowerIfExists(e.attributes.name)||"icon"===lowerIfExists(e.attributes.rel)||"apple-touch-icon"===lowerIfExists(e.attributes.rel)||"shortcut icon"===lowerIfExists(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&lowerIfExists(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(lowerIfExists(e.attributes.property).match(/^(og|twitter|fb):/)||lowerIfExists(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===lowerIfExists(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===lowerIfExists(e.attributes.name)||"googlebot"===lowerIfExists(e.attributes.name)||"bingbot"===lowerIfExists(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===lowerIfExists(e.attributes.name)||"generator"===lowerIfExists(e.attributes.name)||"framework"===lowerIfExists(e.attributes.name)||"publisher"===lowerIfExists(e.attributes.name)||"progid"===lowerIfExists(e.attributes.name)||lowerIfExists(e.attributes.property).match(/^article:/)||lowerIfExists(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===lowerIfExists(e.attributes.name)||"yandex-verification"===lowerIfExists(e.attributes.name)||"csrf-token"===lowerIfExists(e.attributes.name)||"p:domain_verify"===lowerIfExists(e.attributes.name)||"verify-v1"===lowerIfExists(e.attributes.name)||"verification"===lowerIfExists(e.attributes.name)||"shopify-checkout-api-token"===lowerIfExists(e.attributes.name)))return!0}}return!1}function serializeNodeWithId(e,t){var r,n=t.doc,i=t.map,a=t.blockClass,o=t.blockSelector,s=t.skipChild,l=void 0!==s&&s,c=t.inlineStylesheet,u=void 0===c||c,f=t.maskInputOptions,p=void 0===f?{}:f,d=t.slimDOMOptions,m=t.recordCanvas,h=void 0!==m&&m,v=t.preserveWhiteSpace,g=void 0===v||v,y=serializeNode(e,{doc:n,blockClass:a,blockSelector:o,inlineStylesheet:u,maskInputOptions:p,recordCanvas:h});if(!y)return console.warn(e,"not serialized"),null;r="__sn"in e?e.__sn.id:slimDOMExcluded(y,d)||!g&&y.type===NodeType.Text&&!y.isStyle&&!y.textContent.replace(/^\s+|\s+$/gm,"").length?IGNORED_NODE:genId();var b=Object.assign(y,{id:r});if(e.__sn=b,r===IGNORED_NODE)return null;i[r]=e;var E=!l;if(b.type===NodeType.Element&&(E=E&&!b.needBlock,delete b.needBlock),(b.type===NodeType.Document||b.type===NodeType.Element)&&E){d.headWhitespace&&y.type===NodeType.Element&&"head"===y.tagName&&(g=!1);for(var N=0,T=Array.from(e.childNodes);N<T.length;N++){var C=serializeNodeWithId(T[N],{doc:n,map:i,blockClass:a,blockSelector:o,skipChild:l,inlineStylesheet:u,maskInputOptions:p,slimDOMOptions:d,recordCanvas:h,preserveWhiteSpace:g});C&&b.childNodes.push(C)}}return b}function snapshot(e,t){var r=t||{},n=r.blockClass,i=void 0===n?"rr-block":n,a=r.inlineStylesheet,o=void 0===a||a,s=r.recordCanvas,l=void 0!==s&&s,c=r.blockSelector,u=void 0===c?null:c,f=r.maskAllInputs,p=void 0!==f&&f,d=r.slimDOM,m=void 0!==d&&d,h={};return[serializeNodeWithId(e,{doc:e,map:h,blockClass:i,blockSelector:u,skipChild:!1,inlineStylesheet:o,maskInputOptions:!0===p?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0}:!1===p?{}:p,slimDOMOptions:!0===m||"all"===m?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===m,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===m?{}:m,recordCanvas:l}),h]}function visitSnapshot(e,t){!function e(r){t(r),r.type!==NodeType.Document&&r.type!==NodeType.Element||r.childNodes.forEach(e)}(e)}function cleanupSnapshot(){_id=1}var commentre=/\/\*[^*]*\*+([^\/*][^*]*\*+)*\//g;function parse(e,t){void 0===t&&(t={});var r=1,n=1;function i(e){var t=e.match(/\n/g);t&&(r+=t.length);var i=e.lastIndexOf("\n");n=-1===i?n+e.length:e.length-i}function a(){var e={line:r,column:n};return function(t){return t.position=new o(e),d(),t}}var o=function(){return function(e){this.start=e,this.end={line:r,column:n},this.source=t.source}}();o.prototype.content=e;var s=[];function l(i){var a=new Error(t.source+":"+r+":"+n+": "+i);if(a.reason=i,a.filename=t.source,a.line=r,a.column=n,a.source=e,!t.silent)throw a;s.push(a)}function c(){return p(/^{\s*/)}function u(){return p(/^}/)}function f(){var t,r=[];for(d(),m(r);e.length&&"}"!==e.charAt(0)&&(t=S()||w());)!1!==t&&(r.push(t),m(r));return r}function p(t){var r=t.exec(e);if(r){var n=r[0];return i(n),e=e.slice(n.length),r}}function d(){p(/^\s*/)}function m(e){var t;for(void 0===e&&(e=[]);t=h();)!1!==t&&e.push(t),t=h();return e}function h(){var t=a();if("/"===e.charAt(0)&&"*"===e.charAt(1)){for(var r=2;""!==e.charAt(r)&&("*"!==e.charAt(r)||"/"!==e.charAt(r+1));)++r;if(r+=2,""===e.charAt(r-1))return l("End of comment missing");var o=e.slice(2,r-2);return n+=2,i(o),e=e.slice(r),n+=2,t({type:"comment",comment:o})}}function v(){var e=p(/^([^{]+)/);if(e)return trim(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,function(e){return e.replace(/,/g,"‌")}).split(/\s*(?![^(]*\)),\s*/).map(function(e){return e.replace(/\u200C/g,",")})}function g(){var e=a(),t=p(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(t){var r=trim(t[0]);if(!p(/^:\s*/))return l("property missing ':'");var n=p(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),i=e({type:"declaration",property:r.replace(commentre,""),value:n?trim(n[0]).replace(commentre,""):""});return p(/^[;\s]*/),i}}function y(){var e,t=[];if(!c())return l("missing '{'");for(m(t);e=g();)!1!==e&&(t.push(e),m(t)),e=g();return u()?t:l("missing '}'")}function b(){for(var e,t=[],r=a();e=p(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),p(/^,\s*/);if(t.length)return r({type:"keyframe",values:t,declarations:y()})}var E,N=x("import"),T=x("charset"),C=x("namespace");function x(e){var t=new RegExp("^@"+e+"\\s*([^;]+);");return function(){var r=a(),n=p(t);if(n){var i={type:e};return i[e]=n[1].trim(),r(i)}}}function S(){if("@"===e[0])return function(){var e=a(),t=p(/^@([-\w]+)?keyframes\s*/);if(t){var r=t[1];if(!(t=p(/^([-\w]+)\s*/)))return l("@keyframes missing name");var n,i=t[1];if(!c())return l("@keyframes missing '{'");for(var o=m();n=b();)o.push(n),o=o.concat(m());return u()?e({type:"keyframes",name:i,vendor:r,keyframes:o}):l("@keyframes missing '}'")}}()||function(){var e=a(),t=p(/^@media *([^{]+)/);if(t){var r=trim(t[1]);if(!c())return l("@media missing '{'");var n=m().concat(f());return u()?e({type:"media",media:r,rules:n}):l("@media missing '}'")}}()||function(){var e=a(),t=p(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:trim(t[1]),media:trim(t[2])})}()||function(){var e=a(),t=p(/^@supports *([^{]+)/);if(t){var r=trim(t[1]);if(!c())return l("@supports missing '{'");var n=m().concat(f());return u()?e({type:"supports",supports:r,rules:n}):l("@supports missing '}'")}}()||N()||T()||C()||function(){var e=a(),t=p(/^@([-\w]+)?document *([^{]+)/);if(t){var r=trim(t[1]),n=trim(t[2]);if(!c())return l("@document missing '{'");var i=m().concat(f());return u()?e({type:"document",document:n,vendor:r,rules:i}):l("@document missing '}'")}}()||function(){var e=a();if(p(/^@page */)){var t=v()||[];if(!c())return l("@page missing '{'");for(var r,n=m();r=g();)n.push(r),n=n.concat(m());return u()?e({type:"page",selectors:t,declarations:n}):l("@page missing '}'")}}()||function(){var e=a();if(p(/^@host\s*/)){if(!c())return l("@host missing '{'");var t=m().concat(f());return u()?e({type:"host",rules:t}):l("@host missing '}'")}}()||function(){var e=a();if(p(/^@font-face\s*/)){if(!c())return l("@font-face missing '{'");for(var t,r=m();t=g();)r.push(t),r=r.concat(m());return u()?e({type:"font-face",declarations:r}):l("@font-face missing '}'")}}()}function w(){var e=a(),t=v();return t?(m(),e({type:"rule",selectors:t,declarations:y()})):l("selector missing")}return addParent((E=f(),{type:"stylesheet",stylesheet:{source:t.source,rules:E,parsingErrors:s}}))}function trim(e){return e?e.replace(/^\s+|\s+$/g,""):""}function addParent(e,t){for(var r=e&&"string"==typeof e.type,n=r?e:t,i=0,a=Object.keys(e);i<a.length;i++){var o=e[a[i]];Array.isArray(o)?o.forEach(function(e){addParent(e,n)}):o&&"object"==typeof o&&addParent(o,n)}return r&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var tagMap={script:"noscript",altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};function getTagName(e){var t=tagMap[e.tagName]?tagMap[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}var HOVER_SELECTOR=/([^\\]):hover/g;function addHoverClass(e){var t=parse(e,{silent:!0});return t.stylesheet?(t.stylesheet.rules.forEach(function(t){"selectors"in t&&(t.selectors||[]).forEach(function(t){if(HOVER_SELECTOR.test(t)){var r=t.replace(HOVER_SELECTOR,"$1.\\:hover");e=e.replace(t,t+", "+r)}})}),e):e}function buildNode(e,t){var r=t.doc,n=t.hackCss;switch(e.type){case NodeType.Document:return r.implementation.createDocument(null,"",null);case NodeType.DocumentType:return r.implementation.createDocumentType(e.name||"html",e.publicId,e.systemId);case NodeType.Element:var i,a=getTagName(e);i=e.isSVG?r.createElementNS("http://www.w3.org/2000/svg",a):r.createElement(a);var o=function(t){if(!e.attributes.hasOwnProperty(t))return"continue";var o=e.attributes[t];if(o="boolean"==typeof o||"number"==typeof o?"":o,t.startsWith("rr_")){if("canvas"===a&&"rr_dataURL"===t){var s=document.createElement("img");s.src=o,s.onload=function(){var e=i.getContext("2d");e&&e.drawImage(s,0,0,s.width,s.height)}}if("rr_width"===t&&(i.style.width=o),"rr_height"===t&&(i.style.height=o),"rr_mediaState"===t)switch(o){case"played":i.play();case"paused":i.pause()}}else{var l="textarea"===a&&"value"===t,c="style"===a&&"_cssText"===t;if(c&&n&&(o=addHoverClass(o)),l||c){for(var u=r.createTextNode(o),f=0,p=Array.from(i.childNodes);f<p.length;f++){var d=p[f];d.nodeType===i.TEXT_NODE&&i.removeChild(d)}return i.appendChild(u),"continue"}if("iframe"===a&&"src"===t)return"continue";try{e.isSVG&&"xlink:href"===t?i.setAttributeNS("http://www.w3.org/1999/xlink",t,o):"onload"===t||"onclick"===t||"onmouse"===t.substring(0,7)?i.setAttribute("_"+t,o):i.setAttribute(t,o)}catch(e){}}};for(var s in e.attributes)o(s);return i;case NodeType.Text:return r.createTextNode(e.isStyle&&n?addHoverClass(e.textContent):e.textContent);case NodeType.CDATA:return r.createCDATASection(e.textContent);case NodeType.Comment:return r.createComment(e.textContent);default:return null}}function buildNodeWithSN(e,t){var r=t.doc,n=t.map,i=t.skipChild,a=void 0!==i&&i,o=t.hackCss,s=void 0===o||o,l=buildNode(e,{doc:r,hackCss:s});if(!l)return null;if(e.type===NodeType.Document&&(r.close(),r.open(),l=r),l.__sn=e,n[e.id]=l,(e.type===NodeType.Document||e.type===NodeType.Element)&&!a)for(var c=0,u=e.childNodes;c<u.length;c++){var f=u[c],p=buildNodeWithSN(f,{doc:r,map:n,skipChild:!1,hackCss:s});p?l.appendChild(p):console.warn("Failed to rebuild",f)}return l}function visit(e,t){for(var r in e)e[r]&&(n=e[r],t(n));var n}function handleScroll(e){var t=e.__sn;if(t.type===NodeType.Element){var r=e;for(var n in t.attributes)if(t.attributes.hasOwnProperty(n)&&n.startsWith("rr_")){var i=t.attributes[n];"rr_scrollLeft"===n&&(r.scrollLeft=i),"rr_scrollTop"===n&&(r.scrollTop=i)}}}function rebuild(e,t){var r=t.doc,n=t.onVisit,i=t.hackCss,a={},o=buildNodeWithSN(e,{doc:r,map:a,skipChild:!1,hackCss:void 0===i||i});return visit(a,function(e){n&&n(e),handleScroll(e)}),[o,a]}export{snapshot,serializeNodeWithId,rebuild,buildNodeWithSN,addHoverClass,transformAttribute,visitSnapshot,cleanupSnapshot,IGNORED_NODE,NodeType};
var NodeType;!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,tagNameRegex=RegExp("[^a-z1-6-_]"),IGNORED_NODE=-2;function genId(){return _id++}function getValidTagName(e){var t=e.toLowerCase().trim();return tagNameRegex.test(t)?"div":t}function getCssRulesString(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).map(getCssRuleString).join(""):null}catch(e){return null}}function getCssRuleString(e){return isCSSImportRule(e)?getCssRulesString(e.styleSheet)||"":e.cssText}function isCSSImportRule(e){return"styleSheet"in e}function extractOrigin(e){return(e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0]).split("?")[0]}var URL_IN_CSS_REF=/url\((?:(')([^']*)'|(")([^"]*)"|([^)]*))\)/gm,RELATIVE_PATH=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/,DATA_URI=/^(data:)([^,]*),(.*)/i;function absoluteToStylesheet(e,t){return(e||"").replace(URL_IN_CSS_REF,function(e,r,n,i,a,o){var s=n||a||o,l=r||i||"";if(!s)return e;if(!RELATIVE_PATH.test(s))return"url("+l+s+l+")";if(DATA_URI.test(s))return"url("+l+s+l+")";if("/"===s[0])return"url("+l+(extractOrigin(t)+s)+l+")";var c=t.split("/"),u=s.split("/");c.pop();for(var f=0,p=u;f<p.length;f++){var d=p[f];"."!==d&&(".."===d?c.pop():c.push(d))}return"url("+l+c.join("/")+l+")"})}function getAbsoluteSrcsetString(e,t){return""===t.trim()?t:t.split(",").map(function(t){var r=t.trimLeft().trimRight().split(" ");return 2===r.length?absoluteToDoc(e,r[0])+" "+r[1]:1===r.length?""+absoluteToDoc(e,r[0]):""}).join(", ")}function absoluteToDoc(e,t){if(!t||""===t.trim())return t;var r=e.createElement("a");return r.href=t,r.href}function isSVGElement(e){return"svg"===e.tagName||e instanceof SVGElement}function transformAttribute(e,t,r){return"src"===t||"href"===t&&r?absoluteToDoc(e,r):"srcset"===t&&r?getAbsoluteSrcsetString(e,r):"style"===t&&r?absoluteToStylesheet(r,location.href):r}function _isBlockedElement(e,t,r){if("string"==typeof t){if(e.classList.contains(t))return!0}else e.classList.forEach(function(e){if(t.test(e))return!0});return!!r&&e.matches(r)}function serializeNode(e,t){var r=t.doc,n=t.blockClass,i=t.blockSelector,a=t.inlineStylesheet,o=t.maskInputOptions,s=void 0===o?{}:o,l=t.recordCanvas;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 c=_isBlockedElement(e,n,i),u=getValidTagName(e.tagName),f={},p=0,d=Array.from(e.attributes);p<d.length;p++){var m=d[p],h=m.name,v=m.value;f[h]=transformAttribute(r,h,v)}if("link"===u&&a){var g,y=Array.from(r.styleSheets).find(function(t){return t.href===e.href});(g=getCssRulesString(y))&&(delete f.rel,delete f.href,f._cssText=absoluteToStylesheet(g,y.href))}if("style"===u&&e.sheet&&!(e.innerText||e.textContent||"").trim().length)(g=getCssRulesString(e.sheet))&&(f._cssText=absoluteToStylesheet(g,location.href));if("input"===u||"textarea"===u||"select"===u){v=e.value;"radio"!==f.type&&"checkbox"!==f.type&&"submit"!==f.type&&"button"!==f.type&&v?f.value=s[f.type]||s[u]?"*".repeat(v.length):v:e.checked&&(f.checked=e.checked)}if("option"===u){var b=e.parentElement;f.value===b.value&&(f.selected=e.selected)}if("canvas"===u&&l&&(f.rr_dataURL=e.toDataURL()),"audio"!==u&&"video"!==u||(f.rr_mediaState=e.paused?"paused":"played"),e.scrollLeft&&(f.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(f.rr_scrollTop=e.scrollTop),c){var E=e.getBoundingClientRect(),N=E.width,T=E.height;f={class:f.class,rr_width:N+"px",rr_height:T+"px"}}return{type:NodeType.Element,tagName:u,attributes:f,childNodes:[],isSVG:isSVGElement(e)||void 0,needBlock:c};case e.TEXT_NODE:var C=e.parentNode&&e.parentNode.tagName,x=e.textContent,S="STYLE"===C||void 0;return S&&x&&(x=absoluteToStylesheet(x,location.href)),"SCRIPT"===C&&(x="SCRIPT_PLACEHOLDER"),{type:NodeType.Text,textContent:x||"",isStyle:S};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 lowerIfExists(e){return void 0===e?"":e.toLowerCase()}function slimDOMExcluded(e,t){if(t.comment&&e.type===NodeType.Comment)return!0;if(e.type===NodeType.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&"preload"===e.attributes.rel&&"script"===e.attributes.as))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(lowerIfExists(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===lowerIfExists(e.attributes.name)||"icon"===lowerIfExists(e.attributes.rel)||"apple-touch-icon"===lowerIfExists(e.attributes.rel)||"shortcut icon"===lowerIfExists(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&lowerIfExists(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(lowerIfExists(e.attributes.property).match(/^(og|twitter|fb):/)||lowerIfExists(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===lowerIfExists(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===lowerIfExists(e.attributes.name)||"googlebot"===lowerIfExists(e.attributes.name)||"bingbot"===lowerIfExists(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===lowerIfExists(e.attributes.name)||"generator"===lowerIfExists(e.attributes.name)||"framework"===lowerIfExists(e.attributes.name)||"publisher"===lowerIfExists(e.attributes.name)||"progid"===lowerIfExists(e.attributes.name)||lowerIfExists(e.attributes.property).match(/^article:/)||lowerIfExists(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===lowerIfExists(e.attributes.name)||"yandex-verification"===lowerIfExists(e.attributes.name)||"csrf-token"===lowerIfExists(e.attributes.name)||"p:domain_verify"===lowerIfExists(e.attributes.name)||"verify-v1"===lowerIfExists(e.attributes.name)||"verification"===lowerIfExists(e.attributes.name)||"shopify-checkout-api-token"===lowerIfExists(e.attributes.name)))return!0}}return!1}function serializeNodeWithId(e,t){var r,n=t.doc,i=t.map,a=t.blockClass,o=t.blockSelector,s=t.skipChild,l=void 0!==s&&s,c=t.inlineStylesheet,u=void 0===c||c,f=t.maskInputOptions,p=void 0===f?{}:f,d=t.slimDOMOptions,m=t.recordCanvas,h=void 0!==m&&m,v=t.preserveWhiteSpace,g=void 0===v||v,y=serializeNode(e,{doc:n,blockClass:a,blockSelector:o,inlineStylesheet:u,maskInputOptions:p,recordCanvas:h});if(!y)return console.warn(e,"not serialized"),null;r="__sn"in e?e.__sn.id:slimDOMExcluded(y,d)||!g&&y.type===NodeType.Text&&!y.isStyle&&!y.textContent.replace(/^\s+|\s+$/gm,"").length?IGNORED_NODE:genId();var b=Object.assign(y,{id:r});if(e.__sn=b,r===IGNORED_NODE)return null;i[r]=e;var E=!l;if(b.type===NodeType.Element&&(E=E&&!b.needBlock,delete b.needBlock),(b.type===NodeType.Document||b.type===NodeType.Element)&&E){d.headWhitespace&&y.type===NodeType.Element&&"head"===y.tagName&&(g=!1);for(var N=0,T=Array.from(e.childNodes);N<T.length;N++){var C=serializeNodeWithId(T[N],{doc:n,map:i,blockClass:a,blockSelector:o,skipChild:l,inlineStylesheet:u,maskInputOptions:p,slimDOMOptions:d,recordCanvas:h,preserveWhiteSpace:g});C&&b.childNodes.push(C)}}return b}function snapshot(e,t){var r=t||{},n=r.blockClass,i=void 0===n?"rr-block":n,a=r.inlineStylesheet,o=void 0===a||a,s=r.recordCanvas,l=void 0!==s&&s,c=r.blockSelector,u=void 0===c?null:c,f=r.maskAllInputs,p=void 0!==f&&f,d=r.slimDOM,m=void 0!==d&&d,h={};return[serializeNodeWithId(e,{doc:e,map:h,blockClass:i,blockSelector:u,skipChild:!1,inlineStylesheet:o,maskInputOptions:!0===p?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0}:!1===p?{}:p,slimDOMOptions:!0===m||"all"===m?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===m,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===m?{}:m,recordCanvas:l}),h]}function visitSnapshot(e,t){!function e(r){t(r),r.type!==NodeType.Document&&r.type!==NodeType.Element||r.childNodes.forEach(e)}(e)}function cleanupSnapshot(){_id=1}var commentre=/\/\*[^*]*\*+([^\/*][^*]*\*+)*\//g;function parse(e,t){void 0===t&&(t={});var r=1,n=1;function i(e){var t=e.match(/\n/g);t&&(r+=t.length);var i=e.lastIndexOf("\n");n=-1===i?n+e.length:e.length-i}function a(){var e={line:r,column:n};return function(t){return t.position=new o(e),d(),t}}var o=function(){return function(e){this.start=e,this.end={line:r,column:n},this.source=t.source}}();o.prototype.content=e;var s=[];function l(i){var a=new Error(t.source+":"+r+":"+n+": "+i);if(a.reason=i,a.filename=t.source,a.line=r,a.column=n,a.source=e,!t.silent)throw a;s.push(a)}function c(){return p(/^{\s*/)}function u(){return p(/^}/)}function f(){var t,r=[];for(d(),m(r);e.length&&"}"!==e.charAt(0)&&(t=S()||w());)!1!==t&&(r.push(t),m(r));return r}function p(t){var r=t.exec(e);if(r){var n=r[0];return i(n),e=e.slice(n.length),r}}function d(){p(/^\s*/)}function m(e){var t;for(void 0===e&&(e=[]);t=h();)!1!==t&&e.push(t),t=h();return e}function h(){var t=a();if("/"===e.charAt(0)&&"*"===e.charAt(1)){for(var r=2;""!==e.charAt(r)&&("*"!==e.charAt(r)||"/"!==e.charAt(r+1));)++r;if(r+=2,""===e.charAt(r-1))return l("End of comment missing");var o=e.slice(2,r-2);return n+=2,i(o),e=e.slice(r),n+=2,t({type:"comment",comment:o})}}function v(){var e=p(/^([^{]+)/);if(e)return trim(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,function(e){return e.replace(/,/g,"‌")}).split(/\s*(?![^(]*\)),\s*/).map(function(e){return e.replace(/\u200C/g,",")})}function g(){var e=a(),t=p(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(t){var r=trim(t[0]);if(!p(/^:\s*/))return l("property missing ':'");var n=p(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),i=e({type:"declaration",property:r.replace(commentre,""),value:n?trim(n[0]).replace(commentre,""):""});return p(/^[;\s]*/),i}}function y(){var e,t=[];if(!c())return l("missing '{'");for(m(t);e=g();)!1!==e&&(t.push(e),m(t)),e=g();return u()?t:l("missing '}'")}function b(){for(var e,t=[],r=a();e=p(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),p(/^,\s*/);if(t.length)return r({type:"keyframe",values:t,declarations:y()})}var E,N=x("import"),T=x("charset"),C=x("namespace");function x(e){var t=new RegExp("^@"+e+"\\s*([^;]+);");return function(){var r=a(),n=p(t);if(n){var i={type:e};return i[e]=n[1].trim(),r(i)}}}function S(){if("@"===e[0])return function(){var e=a(),t=p(/^@([-\w]+)?keyframes\s*/);if(t){var r=t[1];if(!(t=p(/^([-\w]+)\s*/)))return l("@keyframes missing name");var n,i=t[1];if(!c())return l("@keyframes missing '{'");for(var o=m();n=b();)o.push(n),o=o.concat(m());return u()?e({type:"keyframes",name:i,vendor:r,keyframes:o}):l("@keyframes missing '}'")}}()||function(){var e=a(),t=p(/^@media *([^{]+)/);if(t){var r=trim(t[1]);if(!c())return l("@media missing '{'");var n=m().concat(f());return u()?e({type:"media",media:r,rules:n}):l("@media missing '}'")}}()||function(){var e=a(),t=p(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:trim(t[1]),media:trim(t[2])})}()||function(){var e=a(),t=p(/^@supports *([^{]+)/);if(t){var r=trim(t[1]);if(!c())return l("@supports missing '{'");var n=m().concat(f());return u()?e({type:"supports",supports:r,rules:n}):l("@supports missing '}'")}}()||N()||T()||C()||function(){var e=a(),t=p(/^@([-\w]+)?document *([^{]+)/);if(t){var r=trim(t[1]),n=trim(t[2]);if(!c())return l("@document missing '{'");var i=m().concat(f());return u()?e({type:"document",document:n,vendor:r,rules:i}):l("@document missing '}'")}}()||function(){var e=a();if(p(/^@page */)){var t=v()||[];if(!c())return l("@page missing '{'");for(var r,n=m();r=g();)n.push(r),n=n.concat(m());return u()?e({type:"page",selectors:t,declarations:n}):l("@page missing '}'")}}()||function(){var e=a();if(p(/^@host\s*/)){if(!c())return l("@host missing '{'");var t=m().concat(f());return u()?e({type:"host",rules:t}):l("@host missing '}'")}}()||function(){var e=a();if(p(/^@font-face\s*/)){if(!c())return l("@font-face missing '{'");for(var t,r=m();t=g();)r.push(t),r=r.concat(m());return u()?e({type:"font-face",declarations:r}):l("@font-face missing '}'")}}()}function w(){var e=a(),t=v();return t?(m(),e({type:"rule",selectors:t,declarations:y()})):l("selector missing")}return addParent((E=f(),{type:"stylesheet",stylesheet:{source:t.source,rules:E,parsingErrors:s}}))}function trim(e){return e?e.replace(/^\s+|\s+$/g,""):""}function addParent(e,t){for(var r=e&&"string"==typeof e.type,n=r?e:t,i=0,a=Object.keys(e);i<a.length;i++){var o=e[a[i]];Array.isArray(o)?o.forEach(function(e){addParent(e,n)}):o&&"object"==typeof o&&addParent(o,n)}return r&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var tagMap={script:"noscript",altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};function getTagName(e){var t=tagMap[e.tagName]?tagMap[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}var HOVER_SELECTOR=/([^\\]):hover/g;function addHoverClass(e){var t=parse(e,{silent:!0});return t.stylesheet?(t.stylesheet.rules.forEach(function(t){"selectors"in t&&(t.selectors||[]).forEach(function(t){if(HOVER_SELECTOR.test(t)){var r=t.replace(HOVER_SELECTOR,"$1.\\:hover");e=e.replace(t,t+", "+r)}})}),e):e}function buildNode(e,t){var r=t.doc,n=t.hackCss;switch(e.type){case NodeType.Document:return r.implementation.createDocument(null,"",null);case NodeType.DocumentType:return r.implementation.createDocumentType(e.name||"html",e.publicId,e.systemId);case NodeType.Element:var i,a=getTagName(e);i=e.isSVG?r.createElementNS("http://www.w3.org/2000/svg",a):r.createElement(a);var o=function(t){if(!e.attributes.hasOwnProperty(t))return"continue";var o=e.attributes[t];if(o="boolean"==typeof o||"number"==typeof o?"":o,t.startsWith("rr_")){if("canvas"===a&&"rr_dataURL"===t){var s=document.createElement("img");s.src=o,s.onload=function(){var e=i.getContext("2d");e&&e.drawImage(s,0,0,s.width,s.height)}}if("rr_width"===t&&(i.style.width=o),"rr_height"===t&&(i.style.height=o),"rr_mediaState"===t)switch(o){case"played":i.play();case"paused":i.pause()}}else{var l="textarea"===a&&"value"===t,c="style"===a&&"_cssText"===t;if(c&&n&&(o=addHoverClass(o)),l||c){for(var u=r.createTextNode(o),f=0,p=Array.from(i.childNodes);f<p.length;f++){var d=p[f];d.nodeType===i.TEXT_NODE&&i.removeChild(d)}return i.appendChild(u),"continue"}if("iframe"===a&&"src"===t)return"continue";try{e.isSVG&&"xlink:href"===t?i.setAttributeNS("http://www.w3.org/1999/xlink",t,o):"onload"===t||"onclick"===t||"onmouse"===t.substring(0,7)?i.setAttribute("_"+t,o):i.setAttribute(t,o)}catch(e){}}};for(var s in e.attributes)o(s);return i;case NodeType.Text:return r.createTextNode(e.isStyle&&n?addHoverClass(e.textContent):e.textContent);case NodeType.CDATA:return r.createCDATASection(e.textContent);case NodeType.Comment:return r.createComment(e.textContent);default:return null}}function buildNodeWithSN(e,t){var r=t.doc,n=t.map,i=t.skipChild,a=void 0!==i&&i,o=t.hackCss,s=void 0===o||o,l=buildNode(e,{doc:r,hackCss:s});if(!l)return null;if(e.type===NodeType.Document&&(r.close(),r.open(),l=r),l.__sn=e,n[e.id]=l,(e.type===NodeType.Document||e.type===NodeType.Element)&&!a)for(var c=0,u=e.childNodes;c<u.length;c++){var f=u[c],p=buildNodeWithSN(f,{doc:r,map:n,skipChild:!1,hackCss:s});p?l.appendChild(p):console.warn("Failed to rebuild",f)}return l}function visit(e,t){for(var r in e)e[r]&&(n=e[r],t(n));var n}function handleScroll(e){var t=e.__sn;if(t.type===NodeType.Element){var r=e;for(var n in t.attributes)if(t.attributes.hasOwnProperty(n)&&n.startsWith("rr_")){var i=t.attributes[n];"rr_scrollLeft"===n&&(r.scrollLeft=i),"rr_scrollTop"===n&&(r.scrollTop=i)}}}function rebuild(e,t){var r=t.doc,n=t.onVisit,i=t.hackCss,a={},o=buildNodeWithSN(e,{doc:r,map:a,skipChild:!1,hackCss:void 0===i||i});return visit(a,function(e){n&&n(e),handleScroll(e)}),[o,a]}export{snapshot,serializeNodeWithId,rebuild,buildNodeWithSN,addHoverClass,transformAttribute,visitSnapshot,cleanupSnapshot,IGNORED_NODE,NodeType};
//# sourceMappingURL=rrweb-snapshot.min.js.map

@@ -242,4 +242,7 @@ 'use strict';

var _d = n.getBoundingClientRect(), width = _d.width, height = _d.height;
attributes_1.rr_width = width + "px";
attributes_1.rr_height = height + "px";
attributes_1 = {
class: attributes_1.class,
rr_width: width + "px",
rr_height: height + "px",
};
}

@@ -246,0 +249,0 @@ return {

{
"name": "rrweb-snapshot",
"version": "1.0.0",
"version": "1.0.1",
"description": "rrweb's component to take a snapshot of DOM, aka DOM serializer",

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

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc