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.1.6 to 1.1.7

24

dist/rrweb-snapshot.js

@@ -80,3 +80,3 @@ var rrwebSnapshot = (function (exports) {

}
var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")([^"]*)"|([^)]*))\)/gm;
var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm;
var RELATIVE_PATH = /^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/;

@@ -467,3 +467,7 @@ var DATA_URI = /^(data:)([^,]*),(.*)/i;

sn.attributes.rel === 'preload' &&
sn.attributes.as === 'script'))) {
sn.attributes.as === 'script') ||
(sn.tagName === 'link' &&
sn.attributes.rel === 'prefetch' &&
typeof sn.attributes.href === 'string' &&
sn.attributes.href.endsWith('.js')))) {
return true;

@@ -1225,4 +1229,4 @@ }

}
function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
function escapeRegExp(str) {
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}

@@ -1248,4 +1252,5 @@ var HOVER_SELECTOR = /([^\\]):hover/;

});
if (selectors.length === 0)
if (selectors.length === 0) {
return cssText;
}
var selectorMatcher = new RegExp(selectors

@@ -1314,6 +1319,13 @@ .filter(function (selector, index) { return selectors.indexOf(selector) === index; })

n.attributes['http-equiv'] === 'Content-Security-Policy' &&
name == 'content') {
name === 'content') {
node_1.setAttribute('csp-content', value);
return "continue";
}
else if (tagName === 'link' &&
n.attributes.rel === 'preload' &&
n.attributes.as === 'script') ;
else if (tagName === 'link' &&
n.attributes.rel === 'prefetch' &&
typeof n.attributes.href === 'string' &&
n.attributes.href.endsWith('.js')) ;
else {

@@ -1320,0 +1332,0 @@ node_1.setAttribute(name, value);

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

var rrwebSnapshot=function(e){"use strict";var t;function r(e){return e.nodeType===e.ELEMENT_NODE}function n(e){var t,r=null===(t=e)||void 0===t?void 0:t.host;return Boolean(r&&r.shadowRoot&&r.shadowRoot===e)}function a(e){var t=e.maskInputOptions,r=e.tagName,n=e.type,a=e.value,o=e.maskInputFn,i=a||"";return(t[r.toLowerCase()]||t[n])&&(i=o?o(i):"*".repeat(i.length)),i}(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 o=1,i=RegExp("[^a-z0-9-_:]"),s=-2;function c(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).map(u).join(""):null}catch(e){return null}}function u(e){return function(e){return"styleSheet"in e}(e)?c(e.styleSheet)||"":e.cssText}var l=/url\((?:(')([^']*)'|(")([^"]*)"|([^)]*))\)/gm,f=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,p=/^(data:)([^,]*),(.*)/i;function m(e,t){return(e||"").replace(l,function(e,r,n,a,o,i){var s,c=n||o||i,u=r||a||"";if(!c)return e;if(!f.test(c))return"url("+u+c+u+")";if(p.test(c))return"url("+u+c+u+")";if("/"===c[0])return"url("+u+(((s=t).indexOf("//")>-1?s.split("/").slice(0,3).join("/"):s.split("/")[0]).split("?")[0]+c)+u+")";var l=t.split("/"),m=c.split("/");l.pop();for(var d=0,h=m;d<h.length;d++){var v=h[d];"."!==v&&(".."===v?l.pop():l.push(v))}return"url("+u+l.join("/")+u+")"})}var d=/^[^ \t\n\r\u000c]+/,h=/^[, \t\n\r\u000c]+/;function v(e,t){if(!t||""===t.trim())return t;var r=e.createElement("a");return r.href=t,r.href}function y(){var e=document.createElement("a");return e.href="",e.href}function g(e,t,r,n){return"src"===r||("href"===r||"xlink:href"===r)&&n?v(e,n):"background"!==r||!n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===r&&n?function(e,t){if(""===t.trim())return t;var r=0;function n(e){var n,a=e.exec(t.substring(r));return a?(n=a[0],r+=n.length,n):""}for(var a=[];n(h),!(r>=t.length);){var o=n(d);if(","===o.slice(-1))o=v(e,o.substring(0,o.length-1)),a.push(o);else{var i="";o=v(e,o);for(var s=!1;;){var c=t.charAt(r);if(""===c){a.push((o+i).trim());break}if(s)")"===c&&(s=!1);else{if(","===c){r+=1,a.push((o+i).trim());break}"("===c&&(s=!0)}i+=c,r+=1}}}return a.join(", ")}(e,n):"style"===r&&n?m(n,y()):n:v(e,n)}function T(e,t,r){if(!e)return!1;if(e.nodeType===e.ELEMENT_NODE){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(e.parentNode,t,r)}return e.nodeType,e.TEXT_NODE,T(e.parentNode,t,r)}function k(t,r){var n,o,s=r.doc,u=r.blockClass,l=r.blockSelector,f=r.maskTextClass,p=r.maskTextSelector,d=r.inlineStylesheet,h=r.maskInputOptions,v=void 0===h?{}:h,k=r.maskTextFn,b=r.maskInputFn,C=r.recordCanvas,N=r.keepIframeSrcFn;if(s.__sn){var S=s.__sn.id;n=1===S?void 0:S}switch(t.nodeType){case t.DOCUMENT_NODE:return{type:e.NodeType.Document,childNodes:[],rootId:n};case t.DOCUMENT_TYPE_NODE:return{type:e.NodeType.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:n};case t.ELEMENT_NODE:for(var x=function(e,t,r){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var n=0;n<e.classList.length;n++){var a=e.classList[n];if(t.test(a))return!0}return!!r&&e.matches(r)}(t,u,l),w=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return i.test(t)?"div":t}(t),E={},I=0,_=Array.from(t.attributes);I<_.length;I++){var D=_[I],O=D.name,A=D.value;E[O]=g(s,w,O,A)}if("link"===w&&d){var L,M=Array.from(s.styleSheets).find(function(e){return e.href===t.href});(L=c(M))&&(delete E.rel,delete E.href,E._cssText=m(L,M.href))}if("style"===w&&t.sheet&&!(t.innerText||t.textContent||"").trim().length)(L=c(t.sheet))&&(E._cssText=m(L,y()));if("input"===w||"textarea"===w||"select"===w){A=t.value;"radio"!==E.type&&"checkbox"!==E.type&&"submit"!==E.type&&"button"!==E.type&&A?E.value=a({type:E.type,tagName:w,value:A,maskInputOptions:v,maskInputFn:b}):t.checked&&(E.checked=t.checked)}if("option"===w){var F=t.parentElement;E.value===F.value&&(E.selected=t.selected)}if("canvas"===w&&C&&(E.rr_dataURL=t.toDataURL()),"audio"!==w&&"video"!==w||(E.rr_mediaState=t.paused?"paused":"played",E.rr_mediaCurrentTime=t.currentTime),t.scrollLeft&&(E.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(E.rr_scrollTop=t.scrollTop),x){var R=t.getBoundingClientRect(),G=R.width,W=R.height;E={class:E.class,rr_width:G+"px",rr_height:W+"px"}}return"iframe"!==w||N(E.src)||delete E.src,{type:e.NodeType.Element,tagName:w,attributes:E,childNodes:[],isSVG:(o=t,"svg"===o.tagName||o instanceof SVGElement||void 0),needBlock:x,rootId:n};case t.TEXT_NODE:var j=t.parentNode&&t.parentNode.tagName,z=t.textContent,P="STYLE"===j||void 0,B="SCRIPT"===j||void 0;return P&&z&&(z=m(z,y())),B&&(z="SCRIPT_PLACEHOLDER"),!P&&!B&&T(t,f,p)&&z&&(z=k?k(z):z.replace(/[\S]/g,"*")),{type:e.NodeType.Text,textContent:z||"",isStyle:P,rootId:n};case t.CDATA_SECTION_NODE:return{type:e.NodeType.CDATA,textContent:"",rootId:n};case t.COMMENT_NODE:return{type:e.NodeType.Comment,textContent:t.textContent||"",rootId:n};default:return!1}}function b(e){return void 0===e?"":e.toLowerCase()}function C(t,a){var i,c=a.doc,u=a.map,l=a.blockClass,f=a.blockSelector,p=a.maskTextClass,m=a.maskTextSelector,d=a.skipChild,h=void 0!==d&&d,v=a.inlineStylesheet,y=void 0===v||v,g=a.maskInputOptions,T=void 0===g?{}:g,N=a.maskTextFn,S=a.maskInputFn,x=a.slimDOMOptions,w=a.recordCanvas,E=void 0!==w&&w,I=a.onSerialize,_=a.onIframeLoad,D=a.iframeLoadTimeout,O=void 0===D?5e3:D,A=a.keepIframeSrcFn,L=void 0===A?function(){return!1}:A,M=a.preserveWhiteSpace,F=void 0===M||M,R=k(t,{doc:c,blockClass:l,blockSelector:f,maskTextClass:p,maskTextSelector:m,inlineStylesheet:y,maskInputOptions:T,maskTextFn:N,maskInputFn:S,recordCanvas:E,keepIframeSrcFn:L});if(!R)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&&(b(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===b(t.attributes.name)||"icon"===b(t.attributes.rel)||"apple-touch-icon"===b(t.attributes.rel)||"shortcut icon"===b(t.attributes.rel))))return!0;if("meta"===t.tagName){if(r.headMetaDescKeywords&&b(t.attributes.name).match(/^description|keywords$/))return!0;if(r.headMetaSocial&&(b(t.attributes.property).match(/^(og|twitter|fb):/)||b(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===b(t.attributes.name)))return!0;if(r.headMetaRobots&&("robots"===b(t.attributes.name)||"googlebot"===b(t.attributes.name)||"bingbot"===b(t.attributes.name)))return!0;if(r.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(r.headMetaAuthorship&&("author"===b(t.attributes.name)||"generator"===b(t.attributes.name)||"framework"===b(t.attributes.name)||"publisher"===b(t.attributes.name)||"progid"===b(t.attributes.name)||b(t.attributes.property).match(/^article:/)||b(t.attributes.property).match(/^product:/)))return!0;if(r.headMetaVerification&&("google-site-verification"===b(t.attributes.name)||"yandex-verification"===b(t.attributes.name)||"csrf-token"===b(t.attributes.name)||"p:domain_verify"===b(t.attributes.name)||"verify-v1"===b(t.attributes.name)||"verification"===b(t.attributes.name)||"shopify-checkout-api-token"===b(t.attributes.name)))return!0}}return!1}(R,x)&&(F||R.type!==e.NodeType.Text||R.isStyle||R.textContent.replace(/^\s+|\s+$/gm,"").length)?o++:s;var G=Object.assign(R,{id:i});if(t.__sn=G,i===s)return null;u[i]=t,I&&I(t);var W=!h;if(G.type===e.NodeType.Element&&(W=W&&!G.needBlock,delete G.needBlock),(G.type===e.NodeType.Document||G.type===e.NodeType.Element)&&W){x.headWhitespace&&R.type===e.NodeType.Element&&"head"===R.tagName&&(F=!1);for(var j={doc:c,map:u,blockClass:l,blockSelector:f,maskTextClass:p,maskTextSelector:m,skipChild:h,inlineStylesheet:y,maskInputOptions:T,maskTextFn:N,maskInputFn:S,slimDOMOptions:x,recordCanvas:E,preserveWhiteSpace:F,onSerialize:I,onIframeLoad:_,iframeLoadTimeout:O,keepIframeSrcFn:L},z=0,P=Array.from(t.childNodes);z<P.length;z++){(H=C(P[z],j))&&G.childNodes.push(H)}if(r(t)&&t.shadowRoot){G.isShadowHost=!0;for(var B=0,V=Array.from(t.shadowRoot.childNodes);B<V.length;B++){var H;(H=C(V[B],j))&&(H.isShadow=!0,G.childNodes.push(H))}}}return t.parentNode&&n(t.parentNode)&&(G.isShadow=!0),G.type===e.NodeType.Element&&"iframe"===G.tagName&&function(e,t,r){var n=e.contentWindow;if(n){var a,o=!1;try{a=n.document.readyState}catch(e){return}if("complete"===a)"about:blank"===n.location.href&&"about:blank"!==e.src&&""!==e.src?e.addEventListener("load",t):setTimeout(t,0);else{var i=setTimeout(function(){o||(t(),o=!0)},r);e.addEventListener("load",function(){clearTimeout(i),o=!0,t()})}}}(t,function(){var e=t.contentDocument;if(e&&_){var r=C(e,{doc:e,map:u,blockClass:l,blockSelector:f,maskTextClass:p,maskTextSelector:m,skipChild:!1,inlineStylesheet:y,maskInputOptions:T,maskTextFn:N,maskInputFn:S,slimDOMOptions:x,recordCanvas:E,preserveWhiteSpace:F,onSerialize:I,onIframeLoad:_,iframeLoadTimeout:O,keepIframeSrcFn:L});r&&_(t,r)}},O),G}var N=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function S(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 o(){var e={line:r,column:n};return function(t){return t.position=new i(e),m(),t}}var i=function(){return function(e){this.start=e,this.end={line:r,column:n},this.source=t.source}}();i.prototype.content=e;var s=[];function c(a){var o=new Error(t.source+":"+r+":"+n+": "+a);if(o.reason=a,o.filename=t.source,o.line=r,o.column=n,o.source=e,!t.silent)throw o;s.push(o)}function u(){return p(/^{\s*/)}function l(){return p(/^}/)}function f(){var t,r=[];for(m(),d(r);e.length&&"}"!==e.charAt(0)&&(t=E()||I());)!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=o();if("/"===e.charAt(0)&&"*"===e.charAt(1)){for(var r=2;""!==e.charAt(r)&&("*"!==e.charAt(r)||"/"!==e.charAt(r+1));)++r;if(r+=2,""===e.charAt(r-1))return c("End of comment missing");var i=e.slice(2,r-2);return n+=2,a(i),e=e.slice(r),n+=2,t({type:"comment",comment:i})}}function v(){var e=p(/^([^{]+)/);if(e)return x(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 y(){var e=o(),t=p(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(t){var r=x(t[0]);if(!p(/^:\s*/))return c("property missing ':'");var n=p(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),a=e({type:"declaration",property:r.replace(N,""),value:n?x(n[0]).replace(N,""):""});return p(/^[;\s]*/),a}}function g(){var e,t=[];if(!u())return c("missing '{'");for(d(t);e=y();)!1!==e&&(t.push(e),d(t)),e=y();return l()?t:c("missing '}'")}function T(){for(var e,t=[],r=o();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:g()})}var k,b=w("import"),C=w("charset"),S=w("namespace");function w(e){var t=new RegExp("^@"+e+"\\s*([^;]+);");return function(){var r=o(),n=p(t);if(n){var a={type:e};return a[e]=n[1].trim(),r(a)}}}function E(){if("@"===e[0])return function(){var e=o(),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 i=d();n=T();)i.push(n),i=i.concat(d());return l()?e({type:"keyframes",name:a,vendor:r,keyframes:i}):c("@keyframes missing '}'")}}()||function(){var e=o(),t=p(/^@media *([^{]+)/);if(t){var r=x(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=o(),t=p(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:x(t[1]),media:x(t[2])})}()||function(){var e=o(),t=p(/^@supports *([^{]+)/);if(t){var r=x(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 '}'")}}()||b()||C()||S()||function(){var e=o(),t=p(/^@([-\w]+)?document *([^{]+)/);if(t){var r=x(t[1]),n=x(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=o();if(p(/^@page */)){var t=v()||[];if(!u())return c("@page missing '{'");for(var r,n=d();r=y();)n.push(r),n=n.concat(d());return l()?e({type:"page",selectors:t,declarations:n}):c("@page missing '}'")}}()||function(){var e=o();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=o();if(p(/^@font-face\s*/)){if(!u())return c("@font-face missing '{'");for(var t,r=d();t=y();)r.push(t),r=r.concat(d());return l()?e({type:"font-face",declarations:r}):c("@font-face missing '}'")}}()}function I(){var e=o(),t=v();return t?(d(),e({type:"rule",selectors:t,declarations:g()})):c("selector missing")}return function e(t,r){var n=t&&"string"==typeof t.type;var a=n?t:r;for(var o=0,i=Object.keys(t);o<i.length;o++){var s=i[o],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}((k=f(),{type:"stylesheet",stylesheet:{source:t.source,rules:k,parsingErrors:s}}))}function x(e){return e?e.replace(/^\s+|\s+$/g,""):""}var w={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 E=/([^\\]):hover/,I=new RegExp(E,"g");function _(e){var t=S(e,{silent:!0});if(!t.stylesheet)return e;var r=[];if(t.stylesheet.rules.forEach(function(e){"selectors"in e&&(e.selectors||[]).forEach(function(e){E.test(e)&&r.push(e)})}),0===r.length)return e;var n=new RegExp(r.filter(function(e,t){return r.indexOf(e)===t}).sort(function(e,t){return t.length-e.length}).map(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}).join("|"),"g");return e.replace(n,function(e){var t=e.replace(I,"$1.\\:hover");return e+", "+t})}function D(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 o,i=function(e){var t=w[e.tagName]?w[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(t);o=t.isSVG?n.createElementNS("http://www.w3.org/2000/svg",i):n.createElement(i);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"===i&&"rr_dataURL"===e){var s=document.createElement("img");s.src=r,s.onload=function(){var e=o.getContext("2d");e&&e.drawImage(s,0,0,s.width,s.height)}}if("rr_width"===e&&(o.style.width=r),"rr_height"===e&&(o.style.height=r),"rr_mediaCurrentTime"===e&&(o.currentTime=t.attributes.rr_mediaCurrentTime),"rr_mediaState"===e)switch(r){case"played":o.play().catch(function(e){return console.warn("media playback error",e)});break;case"paused":o.pause()}}else{var c="textarea"===i&&"value"===e,u="style"===i&&"_cssText"===e;if(u&&a&&(r=_(r)),c||u){for(var l=n.createTextNode(r),f=0,p=Array.from(o.childNodes);f<p.length;f++){var m=p[f];m.nodeType===o.TEXT_NODE&&o.removeChild(m)}return o.appendChild(l),"continue"}try{if(t.isSVG&&"xlink:href"===e)o.setAttributeNS("http://www.w3.org/1999/xlink",e,r);else if("onload"===e||"onclick"===e||"onmouse"===e.substring(0,7))o.setAttribute("_"+e,r);else{if("meta"===i&&"Content-Security-Policy"===t.attributes["http-equiv"]&&"content"==e)return o.setAttribute("csp-content",r),"continue";o.setAttribute(e,r)}}catch(e){}}};for(var c in t.attributes)s(c);if(t.isShadowHost)if(o.shadowRoot)for(;o.shadowRoot.firstChild;)o.shadowRoot.removeChild(o.shadowRoot.firstChild);else o.attachShadow({mode:"open"});return o;case e.NodeType.Text:return n.createTextNode(t.isStyle&&a?_(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 O(t,n){var a=n.doc,o=n.map,i=n.skipChild,s=void 0!==i&&i,c=n.hackCss,u=void 0===c||c,l=n.afterAppend,f=D(t,{doc:a,hackCss:u});if(!f)return null;if(t.rootId&&console.assert(o[t.rootId]===a,"Target document should has the same root id."),t.type===e.NodeType.Document&&(a.close(),a.open(),f=a),f.__sn=t,o[t.id]=f,(t.type===e.NodeType.Document||t.type===e.NodeType.Element)&&!s)for(var p=0,m=t.childNodes;p<m.length;p++){var d=m[p],h=O(d,{doc:a,map:o,skipChild:!1,hackCss:u,afterAppend:l});h?(d.isShadow&&r(f)&&f.shadowRoot?f.shadowRoot.appendChild(h):f.appendChild(h),l&&l(h)):console.warn("Failed to rebuild",d)}return f}return e.snapshot=function(e,t){var r=t||{},n=r.blockClass,a=void 0===n?"rr-block":n,o=r.blockSelector,i=void 0===o?null:o,s=r.maskTextClass,c=void 0===s?"rr-mask":s,u=r.maskTextSelector,l=void 0===u?null:u,f=r.inlineStylesheet,p=void 0===f||f,m=r.recordCanvas,d=void 0!==m&&m,h=r.maskAllInputs,v=void 0!==h&&h,y=r.maskTextFn,g=r.maskInputFn,T=r.slimDOM,k=void 0!==T&&T,b=r.preserveWhiteSpace,N=r.onSerialize,S=r.onIframeLoad,x=r.iframeLoadTimeout,w=r.keepIframeSrcFn,E={};return[C(e,{doc:e,map:E,blockClass:a,blockSelector:i,maskTextClass:c,maskTextSelector:l,skipChild:!1,inlineStylesheet:p,maskInputOptions:!0===v?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===v?{password:!0}:v,maskTextFn:y,maskInputFn:g,slimDOMOptions:!0===k||"all"===k?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===k,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===k?{}:k,recordCanvas:d,preserveWhiteSpace:b,onSerialize:N,onIframeLoad:S,iframeLoadTimeout:x,keepIframeSrcFn:void 0===w?function(){return!1}:w}),E]},e.serializeNodeWithId=C,e.rebuild=function(t,r){var n=r.doc,a=r.onVisit,o=r.hackCss,i={},s=O(t,{doc:n,map:i,skipChild:!1,hackCss:void 0===o||o,afterAppend:r.afterAppend});return function(e,t){for(var r in e)e[r]&&(n=e[r],t(n));var n}(i,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 o=r.attributes[a];"rr_scrollLeft"===a&&(n.scrollLeft=o),"rr_scrollTop"===a&&(n.scrollTop=o)}}}(t)}),[s,i]},e.buildNodeWithSN=O,e.addHoverClass=_,e.transformAttribute=g,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(){o=1},e.needMaskingText=T,e.IGNORED_NODE=s,e.isElement=r,e.isShadowRoot=n,e.maskInputValue=a,e}({});
var rrwebSnapshot=function(e){"use strict";var t;function r(e){return e.nodeType===e.ELEMENT_NODE}function n(e){var t,r=null===(t=e)||void 0===t?void 0:t.host;return Boolean(r&&r.shadowRoot&&r.shadowRoot===e)}function a(e){var t=e.maskInputOptions,r=e.tagName,n=e.type,a=e.value,i=e.maskInputFn,o=a||"";return(t[r.toLowerCase()]||t[n])&&(o=i?i(o):"*".repeat(o.length)),o}(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 i=1,o=RegExp("[^a-z0-9-_:]"),s=-2;function c(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).map(u).join(""):null}catch(e){return null}}function u(e){return function(e){return"styleSheet"in e}(e)?c(e.styleSheet)||"":e.cssText}var l=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,f=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,p=/^(data:)([^,]*),(.*)/i;function m(e,t){return(e||"").replace(l,function(e,r,n,a,i,o){var s,c=n||i||o,u=r||a||"";if(!c)return e;if(!f.test(c))return"url("+u+c+u+")";if(p.test(c))return"url("+u+c+u+")";if("/"===c[0])return"url("+u+(((s=t).indexOf("//")>-1?s.split("/").slice(0,3).join("/"):s.split("/")[0]).split("?")[0]+c)+u+")";var l=t.split("/"),m=c.split("/");l.pop();for(var d=0,h=m;d<h.length;d++){var v=h[d];"."!==v&&(".."===v?l.pop():l.push(v))}return"url("+u+l.join("/")+u+")"})}var d=/^[^ \t\n\r\u000c]+/,h=/^[, \t\n\r\u000c]+/;function v(e,t){if(!t||""===t.trim())return t;var r=e.createElement("a");return r.href=t,r.href}function y(){var e=document.createElement("a");return e.href="",e.href}function g(e,t,r,n){return"src"===r||("href"===r||"xlink:href"===r)&&n?v(e,n):"background"!==r||!n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===r&&n?function(e,t){if(""===t.trim())return t;var r=0;function n(e){var n,a=e.exec(t.substring(r));return a?(n=a[0],r+=n.length,n):""}for(var a=[];n(h),!(r>=t.length);){var i=n(d);if(","===i.slice(-1))i=v(e,i.substring(0,i.length-1)),a.push(i);else{var o="";i=v(e,i);for(var s=!1;;){var c=t.charAt(r);if(""===c){a.push((i+o).trim());break}if(s)")"===c&&(s=!1);else{if(","===c){r+=1,a.push((i+o).trim());break}"("===c&&(s=!0)}o+=c,r+=1}}}return a.join(", ")}(e,n):"style"===r&&n?m(n,y()):n:v(e,n)}function T(e,t,r){if(!e)return!1;if(e.nodeType===e.ELEMENT_NODE){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(e.parentNode,t,r)}return e.nodeType,e.TEXT_NODE,T(e.parentNode,t,r)}function b(t,r){var n,i,s=r.doc,u=r.blockClass,l=r.blockSelector,f=r.maskTextClass,p=r.maskTextSelector,d=r.inlineStylesheet,h=r.maskInputOptions,v=void 0===h?{}:h,b=r.maskTextFn,k=r.maskInputFn,C=r.recordCanvas,N=r.keepIframeSrcFn;if(s.__sn){var S=s.__sn.id;n=1===S?void 0:S}switch(t.nodeType){case t.DOCUMENT_NODE:return{type:e.NodeType.Document,childNodes:[],rootId:n};case t.DOCUMENT_TYPE_NODE:return{type:e.NodeType.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:n};case t.ELEMENT_NODE:for(var x=function(e,t,r){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var n=0;n<e.classList.length;n++){var a=e.classList[n];if(t.test(a))return!0}return!!r&&e.matches(r)}(t,u,l),w=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return o.test(t)?"div":t}(t),E={},I=0,_=Array.from(t.attributes);I<_.length;I++){var D=_[I],O=D.name,A=D.value;E[O]=g(s,w,O,A)}if("link"===w&&d){var L,M=Array.from(s.styleSheets).find(function(e){return e.href===t.href});(L=c(M))&&(delete E.rel,delete E.href,E._cssText=m(L,M.href))}if("style"===w&&t.sheet&&!(t.innerText||t.textContent||"").trim().length)(L=c(t.sheet))&&(E._cssText=m(L,y()));if("input"===w||"textarea"===w||"select"===w){A=t.value;"radio"!==E.type&&"checkbox"!==E.type&&"submit"!==E.type&&"button"!==E.type&&A?E.value=a({type:E.type,tagName:w,value:A,maskInputOptions:v,maskInputFn:k}):t.checked&&(E.checked=t.checked)}if("option"===w){var F=t.parentElement;E.value===F.value&&(E.selected=t.selected)}if("canvas"===w&&C&&(E.rr_dataURL=t.toDataURL()),"audio"!==w&&"video"!==w||(E.rr_mediaState=t.paused?"paused":"played",E.rr_mediaCurrentTime=t.currentTime),t.scrollLeft&&(E.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(E.rr_scrollTop=t.scrollTop),x){var R=t.getBoundingClientRect(),W=R.width,j=R.height;E={class:E.class,rr_width:W+"px",rr_height:j+"px"}}return"iframe"!==w||N(E.src)||delete E.src,{type:e.NodeType.Element,tagName:w,attributes:E,childNodes:[],isSVG:(i=t,"svg"===i.tagName||i instanceof SVGElement||void 0),needBlock:x,rootId:n};case t.TEXT_NODE:var G=t.parentNode&&t.parentNode.tagName,z=t.textContent,P="STYLE"===G||void 0,B="SCRIPT"===G||void 0;return P&&z&&(z=m(z,y())),B&&(z="SCRIPT_PLACEHOLDER"),!P&&!B&&T(t,f,p)&&z&&(z=b?b(z):z.replace(/[\S]/g,"*")),{type:e.NodeType.Text,textContent:z||"",isStyle:P,rootId:n};case t.CDATA_SECTION_NODE:return{type:e.NodeType.CDATA,textContent:"",rootId:n};case t.COMMENT_NODE:return{type:e.NodeType.Comment,textContent:t.textContent||"",rootId:n};default:return!1}}function k(e){return void 0===e?"":e.toLowerCase()}function C(t,a){var o,c=a.doc,u=a.map,l=a.blockClass,f=a.blockSelector,p=a.maskTextClass,m=a.maskTextSelector,d=a.skipChild,h=void 0!==d&&d,v=a.inlineStylesheet,y=void 0===v||v,g=a.maskInputOptions,T=void 0===g?{}:g,N=a.maskTextFn,S=a.maskInputFn,x=a.slimDOMOptions,w=a.recordCanvas,E=void 0!==w&&w,I=a.onSerialize,_=a.onIframeLoad,D=a.iframeLoadTimeout,O=void 0===D?5e3:D,A=a.keepIframeSrcFn,L=void 0===A?function(){return!1}:A,M=a.preserveWhiteSpace,F=void 0===M||M,R=b(t,{doc:c,blockClass:l,blockSelector:f,maskTextClass:p,maskTextSelector:m,inlineStylesheet:y,maskInputOptions:T,maskTextFn:N,maskInputFn:S,recordCanvas:E,keepIframeSrcFn:L});if(!R)return console.warn(t,"not serialized"),null;o="__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||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&t.attributes.href.endsWith(".js")))return!0;if(r.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(k(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===k(t.attributes.name)||"icon"===k(t.attributes.rel)||"apple-touch-icon"===k(t.attributes.rel)||"shortcut icon"===k(t.attributes.rel))))return!0;if("meta"===t.tagName){if(r.headMetaDescKeywords&&k(t.attributes.name).match(/^description|keywords$/))return!0;if(r.headMetaSocial&&(k(t.attributes.property).match(/^(og|twitter|fb):/)||k(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===k(t.attributes.name)))return!0;if(r.headMetaRobots&&("robots"===k(t.attributes.name)||"googlebot"===k(t.attributes.name)||"bingbot"===k(t.attributes.name)))return!0;if(r.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(r.headMetaAuthorship&&("author"===k(t.attributes.name)||"generator"===k(t.attributes.name)||"framework"===k(t.attributes.name)||"publisher"===k(t.attributes.name)||"progid"===k(t.attributes.name)||k(t.attributes.property).match(/^article:/)||k(t.attributes.property).match(/^product:/)))return!0;if(r.headMetaVerification&&("google-site-verification"===k(t.attributes.name)||"yandex-verification"===k(t.attributes.name)||"csrf-token"===k(t.attributes.name)||"p:domain_verify"===k(t.attributes.name)||"verify-v1"===k(t.attributes.name)||"verification"===k(t.attributes.name)||"shopify-checkout-api-token"===k(t.attributes.name)))return!0}}return!1}(R,x)&&(F||R.type!==e.NodeType.Text||R.isStyle||R.textContent.replace(/^\s+|\s+$/gm,"").length)?i++:s;var W=Object.assign(R,{id:o});if(t.__sn=W,o===s)return null;u[o]=t,I&&I(t);var j=!h;if(W.type===e.NodeType.Element&&(j=j&&!W.needBlock,delete W.needBlock),(W.type===e.NodeType.Document||W.type===e.NodeType.Element)&&j){x.headWhitespace&&R.type===e.NodeType.Element&&"head"===R.tagName&&(F=!1);for(var G={doc:c,map:u,blockClass:l,blockSelector:f,maskTextClass:p,maskTextSelector:m,skipChild:h,inlineStylesheet:y,maskInputOptions:T,maskTextFn:N,maskInputFn:S,slimDOMOptions:x,recordCanvas:E,preserveWhiteSpace:F,onSerialize:I,onIframeLoad:_,iframeLoadTimeout:O,keepIframeSrcFn:L},z=0,P=Array.from(t.childNodes);z<P.length;z++){(H=C(P[z],G))&&W.childNodes.push(H)}if(r(t)&&t.shadowRoot){W.isShadowHost=!0;for(var B=0,V=Array.from(t.shadowRoot.childNodes);B<V.length;B++){var H;(H=C(V[B],G))&&(H.isShadow=!0,W.childNodes.push(H))}}}return t.parentNode&&n(t.parentNode)&&(W.isShadow=!0),W.type===e.NodeType.Element&&"iframe"===W.tagName&&function(e,t,r){var n=e.contentWindow;if(n){var a,i=!1;try{a=n.document.readyState}catch(e){return}if("complete"===a)"about:blank"===n.location.href&&"about:blank"!==e.src&&""!==e.src?e.addEventListener("load",t):setTimeout(t,0);else{var o=setTimeout(function(){i||(t(),i=!0)},r);e.addEventListener("load",function(){clearTimeout(o),i=!0,t()})}}}(t,function(){var e=t.contentDocument;if(e&&_){var r=C(e,{doc:e,map:u,blockClass:l,blockSelector:f,maskTextClass:p,maskTextSelector:m,skipChild:!1,inlineStylesheet:y,maskInputOptions:T,maskTextFn:N,maskInputFn:S,slimDOMOptions:x,recordCanvas:E,preserveWhiteSpace:F,onSerialize:I,onIframeLoad:_,iframeLoadTimeout:O,keepIframeSrcFn:L});r&&_(t,r)}},O),W}var N=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function S(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=E()||I());)!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 v(){var e=p(/^([^{]+)/);if(e)return x(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 y(){var e=i(),t=p(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(t){var r=x(t[0]);if(!p(/^:\s*/))return c("property missing ':'");var n=p(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),a=e({type:"declaration",property:r.replace(N,""),value:n?x(n[0]).replace(N,""):""});return p(/^[;\s]*/),a}}function g(){var e,t=[];if(!u())return c("missing '{'");for(d(t);e=y();)!1!==e&&(t.push(e),d(t)),e=y();return l()?t:c("missing '}'")}function T(){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:g()})}var b,k=w("import"),C=w("charset"),S=w("namespace");function w(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 E(){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=T();)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=x(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:x(t[1]),media:x(t[2])})}()||function(){var e=i(),t=p(/^@supports *([^{]+)/);if(t){var r=x(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()||C()||S()||function(){var e=i(),t=p(/^@([-\w]+)?document *([^{]+)/);if(t){var r=x(t[1]),n=x(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=v()||[];if(!u())return c("@page missing '{'");for(var r,n=d();r=y();)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=y();)r.push(t),r=r.concat(d());return l()?e({type:"font-face",declarations:r}):c("@font-face missing '}'")}}()}function I(){var e=i(),t=v();return t?(d(),e({type:"rule",selectors:t,declarations:g()})):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}((b=f(),{type:"stylesheet",stylesheet:{source:t.source,rules:b,parsingErrors:s}}))}function x(e){return e?e.replace(/^\s+|\s+$/g,""):""}var w={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 E=/([^\\]):hover/,I=new RegExp(E,"g");function _(e){var t=S(e,{silent:!0});if(!t.stylesheet)return e;var r=[];if(t.stylesheet.rules.forEach(function(e){"selectors"in e&&(e.selectors||[]).forEach(function(e){E.test(e)&&r.push(e)})}),0===r.length)return e;var n=new RegExp(r.filter(function(e,t){return r.indexOf(e)===t}).sort(function(e,t){return t.length-e.length}).map(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}).join("|"),"g");return e.replace(n,function(e){var t=e.replace(I,"$1.\\:hover");return e+", "+t})}function D(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=w[e.tagName]?w[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_mediaCurrentTime"===e&&(i.currentTime=t.attributes.rr_mediaCurrentTime),"rr_mediaState"===e)switch(r){case"played":i.play().catch(function(e){return console.warn("media playback error",e)});break;case"paused":i.pause()}}else{var c="textarea"===o&&"value"===e,u="style"===o&&"_cssText"===e;if(u&&a&&(r=_(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"}try{if(t.isSVG&&"xlink:href"===e)i.setAttributeNS("http://www.w3.org/1999/xlink",e,r);else if("onload"===e||"onclick"===e||"onmouse"===e.substring(0,7))i.setAttribute("_"+e,r);else{if("meta"===o&&"Content-Security-Policy"===t.attributes["http-equiv"]&&"content"===e)return i.setAttribute("csp-content",r),"continue";"link"===o&&"preload"===t.attributes.rel&&"script"===t.attributes.as||"link"===o&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&t.attributes.href.endsWith(".js")||i.setAttribute(e,r)}}catch(e){}}};for(var c in t.attributes)s(c);if(t.isShadowHost)if(i.shadowRoot)for(;i.shadowRoot.firstChild;)i.shadowRoot.removeChild(i.shadowRoot.firstChild);else i.attachShadow({mode:"open"});return i;case e.NodeType.Text:return n.createTextNode(t.isStyle&&a?_(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 O(t,n){var a=n.doc,i=n.map,o=n.skipChild,s=void 0!==o&&o,c=n.hackCss,u=void 0===c||c,l=n.afterAppend,f=D(t,{doc:a,hackCss:u});if(!f)return null;if(t.rootId&&console.assert(i[t.rootId]===a,"Target document should has the same root id."),t.type===e.NodeType.Document&&(a.close(),a.open(),f=a),f.__sn=t,i[t.id]=f,(t.type===e.NodeType.Document||t.type===e.NodeType.Element)&&!s)for(var p=0,m=t.childNodes;p<m.length;p++){var d=m[p],h=O(d,{doc:a,map:i,skipChild:!1,hackCss:u,afterAppend:l});h?(d.isShadow&&r(f)&&f.shadowRoot?f.shadowRoot.appendChild(h):f.appendChild(h),l&&l(h)):console.warn("Failed to rebuild",d)}return f}return e.snapshot=function(e,t){var r=t||{},n=r.blockClass,a=void 0===n?"rr-block":n,i=r.blockSelector,o=void 0===i?null:i,s=r.maskTextClass,c=void 0===s?"rr-mask":s,u=r.maskTextSelector,l=void 0===u?null:u,f=r.inlineStylesheet,p=void 0===f||f,m=r.recordCanvas,d=void 0!==m&&m,h=r.maskAllInputs,v=void 0!==h&&h,y=r.maskTextFn,g=r.maskInputFn,T=r.slimDOM,b=void 0!==T&&T,k=r.preserveWhiteSpace,N=r.onSerialize,S=r.onIframeLoad,x=r.iframeLoadTimeout,w=r.keepIframeSrcFn,E={};return[C(e,{doc:e,map:E,blockClass:a,blockSelector:o,maskTextClass:c,maskTextSelector:l,skipChild:!1,inlineStylesheet:p,maskInputOptions:!0===v?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===v?{password:!0}:v,maskTextFn:y,maskInputFn:g,slimDOMOptions:!0===b||"all"===b?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===b,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===b?{}:b,recordCanvas:d,preserveWhiteSpace:k,onSerialize:N,onIframeLoad:S,iframeLoadTimeout:x,keepIframeSrcFn:void 0===w?function(){return!1}:w}),E]},e.serializeNodeWithId=C,e.rebuild=function(t,r){var n=r.doc,a=r.onVisit,i=r.hackCss,o={},s=O(t,{doc:n,map:o,skipChild:!1,hackCss:void 0===i||i,afterAppend:r.afterAppend});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=O,e.addHoverClass=_,e.transformAttribute=g,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(){i=1},e.needMaskingText=T,e.IGNORED_NODE=s,e.isElement=r,e.isShadowRoot=n,e.maskInputValue=a,e}({});
//# sourceMappingURL=rrweb-snapshot.min.js.map

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

}
var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")([^"]*)"|([^)]*))\)/gm;
var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm;
var RELATIVE_PATH = /^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/;

@@ -465,3 +465,7 @@ var DATA_URI = /^(data:)([^,]*),(.*)/i;

sn.attributes.rel === 'preload' &&
sn.attributes.as === 'script'))) {
sn.attributes.as === 'script') ||
(sn.tagName === 'link' &&
sn.attributes.rel === 'prefetch' &&
typeof sn.attributes.href === 'string' &&
sn.attributes.href.endsWith('.js')))) {
return true;

@@ -1223,4 +1227,4 @@ }

}
function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
function escapeRegExp(str) {
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}

@@ -1246,4 +1250,5 @@ var HOVER_SELECTOR = /([^\\]):hover/;

});
if (selectors.length === 0)
if (selectors.length === 0) {
return cssText;
}
var selectorMatcher = new RegExp(selectors

@@ -1312,6 +1317,13 @@ .filter(function (selector, index) { return selectors.indexOf(selector) === index; })

n.attributes['http-equiv'] === 'Content-Security-Policy' &&
name == 'content') {
name === 'content') {
node_1.setAttribute('csp-content', value);
return "continue";
}
else if (tagName === 'link' &&
n.attributes.rel === 'preload' &&
n.attributes.as === 'script') ;
else if (tagName === 'link' &&
n.attributes.rel === 'prefetch' &&
typeof n.attributes.href === 'string' &&
n.attributes.href.endsWith('.js')) ;
else {

@@ -1318,0 +1330,0 @@ node_1.setAttribute(name, value);

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

var NodeType;function isElement(e){return e.nodeType===e.ELEMENT_NODE}function isShadowRoot(e){var t,r=null===(t=e)||void 0===t?void 0:t.host;return Boolean(r&&r.shadowRoot&&r.shadowRoot===e)}function maskInputValue(e){var t=e.maskInputOptions,r=e.tagName,n=e.type,a=e.value,i=e.maskInputFn,o=a||"";return(t[r.toLowerCase()]||t[n])&&(o=i?i(o):"*".repeat(o.length)),o}!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-z0-9-_:]"),IGNORED_NODE=-2;function genId(){return _id++}function getValidTagName(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.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,a,i,o){var s=n||i||o,l=r||a||"";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 u=t.split("/"),c=s.split("/");u.pop();for(var f=0,d=c;f<d.length;f++){var m=d[f];"."!==m&&(".."===m?u.pop():u.push(m))}return"url("+l+u.join("/")+l+")"})}var SRCSET_NOT_SPACES=/^[^ \t\n\r\u000c]+/,SRCSET_COMMAS_OR_SPACES=/^[, \t\n\r\u000c]+/;function getAbsoluteSrcsetString(e,t){if(""===t.trim())return t;var r=0;function n(e){var n,a=e.exec(t.substring(r));return a?(n=a[0],r+=n.length,n):""}for(var a=[];n(SRCSET_COMMAS_OR_SPACES),!(r>=t.length);){var i=n(SRCSET_NOT_SPACES);if(","===i.slice(-1))i=absoluteToDoc(e,i.substring(0,i.length-1)),a.push(i);else{var o="";i=absoluteToDoc(e,i);for(var s=!1;;){var l=t.charAt(r);if(""===l){a.push((i+o).trim());break}if(s)")"===l&&(s=!1);else{if(","===l){r+=1,a.push((i+o).trim());break}"("===l&&(s=!0)}o+=l,r+=1}}}return a.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 getHref(){var e=document.createElement("a");return e.href="",e.href}function transformAttribute(e,t,r,n){return"src"===r||("href"===r||"xlink:href"===r)&&n?absoluteToDoc(e,n):"background"!==r||!n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===r&&n?getAbsoluteSrcsetString(e,n):"style"===r&&n?absoluteToStylesheet(n,getHref()):n:absoluteToDoc(e,n)}function _isBlockedElement(e,t,r){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var n=0;n<e.classList.length;n++){var a=e.classList[n];if(t.test(a))return!0}return!!r&&e.matches(r)}function needMaskingText(e,t,r){if(!e)return!1;if(e.nodeType===e.ELEMENT_NODE){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))||needMaskingText(e.parentNode,t,r)}return e.nodeType,e.TEXT_NODE,needMaskingText(e.parentNode,t,r)}function onceIframeLoaded(e,t,r){var n=e.contentWindow;if(n){var a,i=!1;try{a=n.document.readyState}catch(e){return}if("complete"===a){"about:blank"===n.location.href&&"about:blank"!==e.src&&""!==e.src?e.addEventListener("load",t):setTimeout(t,0)}else{var o=setTimeout(function(){i||(t(),i=!0)},r);e.addEventListener("load",function(){clearTimeout(o),i=!0,t()})}}}function serializeNode(e,t){var r,n=t.doc,a=t.blockClass,i=t.blockSelector,o=t.maskTextClass,s=t.maskTextSelector,l=t.inlineStylesheet,u=t.maskInputOptions,c=void 0===u?{}:u,f=t.maskTextFn,d=t.maskInputFn,m=t.recordCanvas,p=t.keepIframeSrcFn;if(n.__sn){var h=n.__sn.id;r=1===h?void 0:h}switch(e.nodeType){case e.DOCUMENT_NODE:return{type:NodeType.Document,childNodes:[],rootId:r};case e.DOCUMENT_TYPE_NODE:return{type:NodeType.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:r};case e.ELEMENT_NODE:for(var v=_isBlockedElement(e,a,i),g=getValidTagName(e),y={},T=0,E=Array.from(e.attributes);T<E.length;T++){var S=E[T],b=S.name,k=S.value;y[b]=transformAttribute(n,g,b,k)}if("link"===g&&l){var N,C=Array.from(n.styleSheets).find(function(t){return t.href===e.href});(N=getCssRulesString(C))&&(delete y.rel,delete y.href,y._cssText=absoluteToStylesheet(N,C.href))}if("style"===g&&e.sheet&&!(e.innerText||e.textContent||"").trim().length)(N=getCssRulesString(e.sheet))&&(y._cssText=absoluteToStylesheet(N,getHref()));if("input"===g||"textarea"===g||"select"===g){k=e.value;"radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&k?y.value=maskInputValue({type:y.type,tagName:g,value:k,maskInputOptions:c,maskInputFn:d}):e.checked&&(y.checked=e.checked)}if("option"===g){var x=e.parentElement;y.value===x.value&&(y.selected=e.selected)}if("canvas"===g&&m&&(y.rr_dataURL=e.toDataURL()),"audio"!==g&&"video"!==g||(y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime),e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop),v){var I=e.getBoundingClientRect(),w=I.width,_=I.height;y={class:y.class,rr_width:w+"px",rr_height:_+"px"}}return"iframe"!==g||p(y.src)||delete y.src,{type:NodeType.Element,tagName:g,attributes:y,childNodes:[],isSVG:isSVGElement(e)||void 0,needBlock:v,rootId:r};case e.TEXT_NODE:var O=e.parentNode&&e.parentNode.tagName,R=e.textContent,D="STYLE"===O||void 0,A="SCRIPT"===O||void 0;return D&&R&&(R=absoluteToStylesheet(R,getHref())),A&&(R="SCRIPT_PLACEHOLDER"),!D&&!A&&needMaskingText(e,o,s)&&R&&(R=f?f(R):R.replace(/[\S]/g,"*")),{type:NodeType.Text,textContent:R||"",isStyle:D,rootId:r};case e.CDATA_SECTION_NODE:return{type:NodeType.CDATA,textContent:"",rootId:r};case e.COMMENT_NODE:return{type:NodeType.Comment,textContent:e.textContent||"",rootId:r};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,a=t.map,i=t.blockClass,o=t.blockSelector,s=t.maskTextClass,l=t.maskTextSelector,u=t.skipChild,c=void 0!==u&&u,f=t.inlineStylesheet,d=void 0===f||f,m=t.maskInputOptions,p=void 0===m?{}:m,h=t.maskTextFn,v=t.maskInputFn,g=t.slimDOMOptions,y=t.recordCanvas,T=void 0!==y&&y,E=t.onSerialize,S=t.onIframeLoad,b=t.iframeLoadTimeout,k=void 0===b?5e3:b,N=t.keepIframeSrcFn,C=void 0===N?function(){return!1}:N,x=t.preserveWhiteSpace,I=void 0===x||x,w=serializeNode(e,{doc:n,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:l,inlineStylesheet:d,maskInputOptions:p,maskTextFn:h,maskInputFn:v,recordCanvas:T,keepIframeSrcFn:C});if(!w)return console.warn(e,"not serialized"),null;r="__sn"in e?e.__sn.id:slimDOMExcluded(w,g)||!I&&w.type===NodeType.Text&&!w.isStyle&&!w.textContent.replace(/^\s+|\s+$/gm,"").length?IGNORED_NODE:genId();var _=Object.assign(w,{id:r});if(e.__sn=_,r===IGNORED_NODE)return null;a[r]=e,E&&E(e);var O=!c;if(_.type===NodeType.Element&&(O=O&&!_.needBlock,delete _.needBlock),(_.type===NodeType.Document||_.type===NodeType.Element)&&O){g.headWhitespace&&w.type===NodeType.Element&&"head"===w.tagName&&(I=!1);for(var R={doc:n,map:a,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:l,skipChild:c,inlineStylesheet:d,maskInputOptions:p,maskTextFn:h,maskInputFn:v,slimDOMOptions:g,recordCanvas:T,preserveWhiteSpace:I,onSerialize:E,onIframeLoad:S,iframeLoadTimeout:k,keepIframeSrcFn:C},D=0,A=Array.from(e.childNodes);D<A.length;D++){(F=serializeNodeWithId(A[D],R))&&_.childNodes.push(F)}if(isElement(e)&&e.shadowRoot){_.isShadowHost=!0;for(var L=0,M=Array.from(e.shadowRoot.childNodes);L<M.length;L++){var F;(F=serializeNodeWithId(M[L],R))&&(F.isShadow=!0,_.childNodes.push(F))}}}return e.parentNode&&isShadowRoot(e.parentNode)&&(_.isShadow=!0),_.type===NodeType.Element&&"iframe"===_.tagName&&onceIframeLoaded(e,function(){var t=e.contentDocument;if(t&&S){var r=serializeNodeWithId(t,{doc:t,map:a,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:l,skipChild:!1,inlineStylesheet:d,maskInputOptions:p,maskTextFn:h,maskInputFn:v,slimDOMOptions:g,recordCanvas:T,preserveWhiteSpace:I,onSerialize:E,onIframeLoad:S,iframeLoadTimeout:k,keepIframeSrcFn:C});r&&S(e,r)}},k),_}function snapshot(e,t){var r=t||{},n=r.blockClass,a=void 0===n?"rr-block":n,i=r.blockSelector,o=void 0===i?null:i,s=r.maskTextClass,l=void 0===s?"rr-mask":s,u=r.maskTextSelector,c=void 0===u?null:u,f=r.inlineStylesheet,d=void 0===f||f,m=r.recordCanvas,p=void 0!==m&&m,h=r.maskAllInputs,v=void 0!==h&&h,g=r.maskTextFn,y=r.maskInputFn,T=r.slimDOM,E=void 0!==T&&T,S=r.preserveWhiteSpace,b=r.onSerialize,k=r.onIframeLoad,N=r.iframeLoadTimeout,C=r.keepIframeSrcFn,x={};return[serializeNodeWithId(e,{doc:e,map:x,blockClass:a,blockSelector:o,maskTextClass:l,maskTextSelector:c,skipChild:!1,inlineStylesheet:d,maskInputOptions:!0===v?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===v?{password:!0}:v,maskTextFn:g,maskInputFn:y,slimDOMOptions:!0===E||"all"===E?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===E,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===E?{}:E,recordCanvas:p,preserveWhiteSpace:S,onSerialize:b,onIframeLoad:k,iframeLoadTimeout:N,keepIframeSrcFn:void 0===C?function(){return!1}:C}),x]}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 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 l(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 d(/^{\s*/)}function c(){return d(/^}/)}function f(){var t,r=[];for(m(),p(r);e.length&&"}"!==e.charAt(0)&&(t=C()||x());)!1!==t&&(r.push(t),p(r));return r}function d(t){var r=t.exec(e);if(r){var n=r[0];return a(n),e=e.slice(n.length),r}}function m(){d(/^\s*/)}function p(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 l("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 v(){var e=d(/^([^{]+)/);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=i(),t=d(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(t){var r=trim(t[0]);if(!d(/^:\s*/))return l("property missing ':'");var n=d(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),a=e({type:"declaration",property:r.replace(commentre,""),value:n?trim(n[0]).replace(commentre,""):""});return d(/^[;\s]*/),a}}function y(){var e,t=[];if(!u())return l("missing '{'");for(p(t);e=g();)!1!==e&&(t.push(e),p(t)),e=g();return c()?t:l("missing '}'")}function T(){for(var e,t=[],r=i();e=d(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),d(/^,\s*/);if(t.length)return r({type:"keyframe",values:t,declarations:y()})}var E,S=N("import"),b=N("charset"),k=N("namespace");function N(e){var t=new RegExp("^@"+e+"\\s*([^;]+);");return function(){var r=i(),n=d(t);if(n){var a={type:e};return a[e]=n[1].trim(),r(a)}}}function C(){if("@"===e[0])return function(){var e=i(),t=d(/^@([-\w]+)?keyframes\s*/);if(t){var r=t[1];if(!(t=d(/^([-\w]+)\s*/)))return l("@keyframes missing name");var n,a=t[1];if(!u())return l("@keyframes missing '{'");for(var o=p();n=T();)o.push(n),o=o.concat(p());return c()?e({type:"keyframes",name:a,vendor:r,keyframes:o}):l("@keyframes missing '}'")}}()||function(){var e=i(),t=d(/^@media *([^{]+)/);if(t){var r=trim(t[1]);if(!u())return l("@media missing '{'");var n=p().concat(f());return c()?e({type:"media",media:r,rules:n}):l("@media missing '}'")}}()||function(){var e=i(),t=d(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:trim(t[1]),media:trim(t[2])})}()||function(){var e=i(),t=d(/^@supports *([^{]+)/);if(t){var r=trim(t[1]);if(!u())return l("@supports missing '{'");var n=p().concat(f());return c()?e({type:"supports",supports:r,rules:n}):l("@supports missing '}'")}}()||S()||b()||k()||function(){var e=i(),t=d(/^@([-\w]+)?document *([^{]+)/);if(t){var r=trim(t[1]),n=trim(t[2]);if(!u())return l("@document missing '{'");var a=p().concat(f());return c()?e({type:"document",document:n,vendor:r,rules:a}):l("@document missing '}'")}}()||function(){var e=i();if(d(/^@page */)){var t=v()||[];if(!u())return l("@page missing '{'");for(var r,n=p();r=g();)n.push(r),n=n.concat(p());return c()?e({type:"page",selectors:t,declarations:n}):l("@page missing '}'")}}()||function(){var e=i();if(d(/^@host\s*/)){if(!u())return l("@host missing '{'");var t=p().concat(f());return c()?e({type:"host",rules:t}):l("@host missing '}'")}}()||function(){var e=i();if(d(/^@font-face\s*/)){if(!u())return l("@font-face missing '{'");for(var t,r=p();t=g();)r.push(t),r=r.concat(p());return c()?e({type:"font-face",declarations:r}):l("@font-face missing '}'")}}()}function x(){var e=i(),t=v();return t?(p(),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,a=0,i=Object.keys(e);a<i.length;a++){var o=e[i[a]];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}function escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var HOVER_SELECTOR=/([^\\]):hover/,HOVER_SELECTOR_GLOBAL=new RegExp(HOVER_SELECTOR,"g");function addHoverClass(e){var t=parse(e,{silent:!0});if(!t.stylesheet)return e;var r=[];if(t.stylesheet.rules.forEach(function(e){"selectors"in e&&(e.selectors||[]).forEach(function(e){HOVER_SELECTOR.test(e)&&r.push(e)})}),0===r.length)return e;var n=new RegExp(r.filter(function(e,t){return r.indexOf(e)===t}).sort(function(e,t){return t.length-e.length}).map(function(e){return escapeRegExp(e)}).join("|"),"g");return e.replace(n,function(e){var t=e.replace(HOVER_SELECTOR_GLOBAL,"$1.\\:hover");return e+", "+t})}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 a,i=getTagName(e);a=e.isSVG?r.createElementNS("http://www.w3.org/2000/svg",i):r.createElement(i);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"===i&&"rr_dataURL"===t){var s=document.createElement("img");s.src=o,s.onload=function(){var e=a.getContext("2d");e&&e.drawImage(s,0,0,s.width,s.height)}}if("rr_width"===t&&(a.style.width=o),"rr_height"===t&&(a.style.height=o),"rr_mediaCurrentTime"===t&&(a.currentTime=e.attributes.rr_mediaCurrentTime),"rr_mediaState"===t)switch(o){case"played":a.play().catch(function(e){return console.warn("media playback error",e)});break;case"paused":a.pause()}}else{var l="textarea"===i&&"value"===t,u="style"===i&&"_cssText"===t;if(u&&n&&(o=addHoverClass(o)),l||u){for(var c=r.createTextNode(o),f=0,d=Array.from(a.childNodes);f<d.length;f++){var m=d[f];m.nodeType===a.TEXT_NODE&&a.removeChild(m)}return a.appendChild(c),"continue"}try{if(e.isSVG&&"xlink:href"===t)a.setAttributeNS("http://www.w3.org/1999/xlink",t,o);else if("onload"===t||"onclick"===t||"onmouse"===t.substring(0,7))a.setAttribute("_"+t,o);else{if("meta"===i&&"Content-Security-Policy"===e.attributes["http-equiv"]&&"content"==t)return a.setAttribute("csp-content",o),"continue";a.setAttribute(t,o)}}catch(e){}}};for(var s in e.attributes)o(s);if(e.isShadowHost)if(a.shadowRoot)for(;a.shadowRoot.firstChild;)a.shadowRoot.removeChild(a.shadowRoot.firstChild);else a.attachShadow({mode:"open"});return a;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,a=t.skipChild,i=void 0!==a&&a,o=t.hackCss,s=void 0===o||o,l=t.afterAppend,u=buildNode(e,{doc:r,hackCss:s});if(!u)return null;if(e.rootId&&console.assert(n[e.rootId]===r,"Target document should has the same root id."),e.type===NodeType.Document&&(r.close(),r.open(),u=r),u.__sn=e,n[e.id]=u,(e.type===NodeType.Document||e.type===NodeType.Element)&&!i)for(var c=0,f=e.childNodes;c<f.length;c++){var d=f[c],m=buildNodeWithSN(d,{doc:r,map:n,skipChild:!1,hackCss:s,afterAppend:l});m?(d.isShadow&&isElement(u)&&u.shadowRoot?u.shadowRoot.appendChild(m):u.appendChild(m),l&&l(m)):console.warn("Failed to rebuild",d)}return u}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 a=t.attributes[n];"rr_scrollLeft"===n&&(r.scrollLeft=a),"rr_scrollTop"===n&&(r.scrollTop=a)}}}function rebuild(e,t){var r=t.doc,n=t.onVisit,a=t.hackCss,i={},o=buildNodeWithSN(e,{doc:r,map:i,skipChild:!1,hackCss:void 0===a||a,afterAppend:t.afterAppend});return visit(i,function(e){n&&n(e),handleScroll(e)}),[o,i]}export{snapshot,serializeNodeWithId,rebuild,buildNodeWithSN,addHoverClass,transformAttribute,visitSnapshot,cleanupSnapshot,needMaskingText,IGNORED_NODE,NodeType,isElement,isShadowRoot,maskInputValue};
var NodeType;function isElement(e){return e.nodeType===e.ELEMENT_NODE}function isShadowRoot(e){var t,r=null===(t=e)||void 0===t?void 0:t.host;return Boolean(r&&r.shadowRoot&&r.shadowRoot===e)}function maskInputValue(e){var t=e.maskInputOptions,r=e.tagName,n=e.type,a=e.value,i=e.maskInputFn,o=a||"";return(t[r.toLowerCase()]||t[n])&&(o=i?i(o):"*".repeat(o.length)),o}!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-z0-9-_:]"),IGNORED_NODE=-2;function genId(){return _id++}function getValidTagName(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.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,a,i,o){var s=n||i||o,l=r||a||"";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 u=t.split("/"),c=s.split("/");u.pop();for(var f=0,d=c;f<d.length;f++){var m=d[f];"."!==m&&(".."===m?u.pop():u.push(m))}return"url("+l+u.join("/")+l+")"})}var SRCSET_NOT_SPACES=/^[^ \t\n\r\u000c]+/,SRCSET_COMMAS_OR_SPACES=/^[, \t\n\r\u000c]+/;function getAbsoluteSrcsetString(e,t){if(""===t.trim())return t;var r=0;function n(e){var n,a=e.exec(t.substring(r));return a?(n=a[0],r+=n.length,n):""}for(var a=[];n(SRCSET_COMMAS_OR_SPACES),!(r>=t.length);){var i=n(SRCSET_NOT_SPACES);if(","===i.slice(-1))i=absoluteToDoc(e,i.substring(0,i.length-1)),a.push(i);else{var o="";i=absoluteToDoc(e,i);for(var s=!1;;){var l=t.charAt(r);if(""===l){a.push((i+o).trim());break}if(s)")"===l&&(s=!1);else{if(","===l){r+=1,a.push((i+o).trim());break}"("===l&&(s=!0)}o+=l,r+=1}}}return a.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 getHref(){var e=document.createElement("a");return e.href="",e.href}function transformAttribute(e,t,r,n){return"src"===r||("href"===r||"xlink:href"===r)&&n?absoluteToDoc(e,n):"background"!==r||!n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===r&&n?getAbsoluteSrcsetString(e,n):"style"===r&&n?absoluteToStylesheet(n,getHref()):n:absoluteToDoc(e,n)}function _isBlockedElement(e,t,r){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var n=0;n<e.classList.length;n++){var a=e.classList[n];if(t.test(a))return!0}return!!r&&e.matches(r)}function needMaskingText(e,t,r){if(!e)return!1;if(e.nodeType===e.ELEMENT_NODE){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))||needMaskingText(e.parentNode,t,r)}return e.nodeType,e.TEXT_NODE,needMaskingText(e.parentNode,t,r)}function onceIframeLoaded(e,t,r){var n=e.contentWindow;if(n){var a,i=!1;try{a=n.document.readyState}catch(e){return}if("complete"===a){"about:blank"===n.location.href&&"about:blank"!==e.src&&""!==e.src?e.addEventListener("load",t):setTimeout(t,0)}else{var o=setTimeout(function(){i||(t(),i=!0)},r);e.addEventListener("load",function(){clearTimeout(o),i=!0,t()})}}}function serializeNode(e,t){var r,n=t.doc,a=t.blockClass,i=t.blockSelector,o=t.maskTextClass,s=t.maskTextSelector,l=t.inlineStylesheet,u=t.maskInputOptions,c=void 0===u?{}:u,f=t.maskTextFn,d=t.maskInputFn,m=t.recordCanvas,p=t.keepIframeSrcFn;if(n.__sn){var h=n.__sn.id;r=1===h?void 0:h}switch(e.nodeType){case e.DOCUMENT_NODE:return{type:NodeType.Document,childNodes:[],rootId:r};case e.DOCUMENT_TYPE_NODE:return{type:NodeType.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:r};case e.ELEMENT_NODE:for(var v=_isBlockedElement(e,a,i),g=getValidTagName(e),y={},T=0,E=Array.from(e.attributes);T<E.length;T++){var b=E[T],S=b.name,k=b.value;y[S]=transformAttribute(n,g,S,k)}if("link"===g&&l){var N,C=Array.from(n.styleSheets).find(function(t){return t.href===e.href});(N=getCssRulesString(C))&&(delete y.rel,delete y.href,y._cssText=absoluteToStylesheet(N,C.href))}if("style"===g&&e.sheet&&!(e.innerText||e.textContent||"").trim().length)(N=getCssRulesString(e.sheet))&&(y._cssText=absoluteToStylesheet(N,getHref()));if("input"===g||"textarea"===g||"select"===g){k=e.value;"radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&k?y.value=maskInputValue({type:y.type,tagName:g,value:k,maskInputOptions:c,maskInputFn:d}):e.checked&&(y.checked=e.checked)}if("option"===g){var x=e.parentElement;y.value===x.value&&(y.selected=e.selected)}if("canvas"===g&&m&&(y.rr_dataURL=e.toDataURL()),"audio"!==g&&"video"!==g||(y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime),e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop),v){var I=e.getBoundingClientRect(),w=I.width,_=I.height;y={class:y.class,rr_width:w+"px",rr_height:_+"px"}}return"iframe"!==g||p(y.src)||delete y.src,{type:NodeType.Element,tagName:g,attributes:y,childNodes:[],isSVG:isSVGElement(e)||void 0,needBlock:v,rootId:r};case e.TEXT_NODE:var O=e.parentNode&&e.parentNode.tagName,R=e.textContent,D="STYLE"===O||void 0,A="SCRIPT"===O||void 0;return D&&R&&(R=absoluteToStylesheet(R,getHref())),A&&(R="SCRIPT_PLACEHOLDER"),!D&&!A&&needMaskingText(e,o,s)&&R&&(R=f?f(R):R.replace(/[\S]/g,"*")),{type:NodeType.Text,textContent:R||"",isStyle:D,rootId:r};case e.CDATA_SECTION_NODE:return{type:NodeType.CDATA,textContent:"",rootId:r};case e.COMMENT_NODE:return{type:NodeType.Comment,textContent:e.textContent||"",rootId:r};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||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")))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,a=t.map,i=t.blockClass,o=t.blockSelector,s=t.maskTextClass,l=t.maskTextSelector,u=t.skipChild,c=void 0!==u&&u,f=t.inlineStylesheet,d=void 0===f||f,m=t.maskInputOptions,p=void 0===m?{}:m,h=t.maskTextFn,v=t.maskInputFn,g=t.slimDOMOptions,y=t.recordCanvas,T=void 0!==y&&y,E=t.onSerialize,b=t.onIframeLoad,S=t.iframeLoadTimeout,k=void 0===S?5e3:S,N=t.keepIframeSrcFn,C=void 0===N?function(){return!1}:N,x=t.preserveWhiteSpace,I=void 0===x||x,w=serializeNode(e,{doc:n,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:l,inlineStylesheet:d,maskInputOptions:p,maskTextFn:h,maskInputFn:v,recordCanvas:T,keepIframeSrcFn:C});if(!w)return console.warn(e,"not serialized"),null;r="__sn"in e?e.__sn.id:slimDOMExcluded(w,g)||!I&&w.type===NodeType.Text&&!w.isStyle&&!w.textContent.replace(/^\s+|\s+$/gm,"").length?IGNORED_NODE:genId();var _=Object.assign(w,{id:r});if(e.__sn=_,r===IGNORED_NODE)return null;a[r]=e,E&&E(e);var O=!c;if(_.type===NodeType.Element&&(O=O&&!_.needBlock,delete _.needBlock),(_.type===NodeType.Document||_.type===NodeType.Element)&&O){g.headWhitespace&&w.type===NodeType.Element&&"head"===w.tagName&&(I=!1);for(var R={doc:n,map:a,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:l,skipChild:c,inlineStylesheet:d,maskInputOptions:p,maskTextFn:h,maskInputFn:v,slimDOMOptions:g,recordCanvas:T,preserveWhiteSpace:I,onSerialize:E,onIframeLoad:b,iframeLoadTimeout:k,keepIframeSrcFn:C},D=0,A=Array.from(e.childNodes);D<A.length;D++){(F=serializeNodeWithId(A[D],R))&&_.childNodes.push(F)}if(isElement(e)&&e.shadowRoot){_.isShadowHost=!0;for(var L=0,M=Array.from(e.shadowRoot.childNodes);L<M.length;L++){var F;(F=serializeNodeWithId(M[L],R))&&(F.isShadow=!0,_.childNodes.push(F))}}}return e.parentNode&&isShadowRoot(e.parentNode)&&(_.isShadow=!0),_.type===NodeType.Element&&"iframe"===_.tagName&&onceIframeLoaded(e,function(){var t=e.contentDocument;if(t&&b){var r=serializeNodeWithId(t,{doc:t,map:a,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:l,skipChild:!1,inlineStylesheet:d,maskInputOptions:p,maskTextFn:h,maskInputFn:v,slimDOMOptions:g,recordCanvas:T,preserveWhiteSpace:I,onSerialize:E,onIframeLoad:b,iframeLoadTimeout:k,keepIframeSrcFn:C});r&&b(e,r)}},k),_}function snapshot(e,t){var r=t||{},n=r.blockClass,a=void 0===n?"rr-block":n,i=r.blockSelector,o=void 0===i?null:i,s=r.maskTextClass,l=void 0===s?"rr-mask":s,u=r.maskTextSelector,c=void 0===u?null:u,f=r.inlineStylesheet,d=void 0===f||f,m=r.recordCanvas,p=void 0!==m&&m,h=r.maskAllInputs,v=void 0!==h&&h,g=r.maskTextFn,y=r.maskInputFn,T=r.slimDOM,E=void 0!==T&&T,b=r.preserveWhiteSpace,S=r.onSerialize,k=r.onIframeLoad,N=r.iframeLoadTimeout,C=r.keepIframeSrcFn,x={};return[serializeNodeWithId(e,{doc:e,map:x,blockClass:a,blockSelector:o,maskTextClass:l,maskTextSelector:c,skipChild:!1,inlineStylesheet:d,maskInputOptions:!0===v?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===v?{password:!0}:v,maskTextFn:g,maskInputFn:y,slimDOMOptions:!0===E||"all"===E?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===E,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===E?{}:E,recordCanvas:p,preserveWhiteSpace:b,onSerialize:S,onIframeLoad:k,iframeLoadTimeout:N,keepIframeSrcFn:void 0===C?function(){return!1}:C}),x]}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 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 l(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 d(/^{\s*/)}function c(){return d(/^}/)}function f(){var t,r=[];for(m(),p(r);e.length&&"}"!==e.charAt(0)&&(t=C()||x());)!1!==t&&(r.push(t),p(r));return r}function d(t){var r=t.exec(e);if(r){var n=r[0];return a(n),e=e.slice(n.length),r}}function m(){d(/^\s*/)}function p(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 l("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 v(){var e=d(/^([^{]+)/);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=i(),t=d(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(t){var r=trim(t[0]);if(!d(/^:\s*/))return l("property missing ':'");var n=d(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),a=e({type:"declaration",property:r.replace(commentre,""),value:n?trim(n[0]).replace(commentre,""):""});return d(/^[;\s]*/),a}}function y(){var e,t=[];if(!u())return l("missing '{'");for(p(t);e=g();)!1!==e&&(t.push(e),p(t)),e=g();return c()?t:l("missing '}'")}function T(){for(var e,t=[],r=i();e=d(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),d(/^,\s*/);if(t.length)return r({type:"keyframe",values:t,declarations:y()})}var E,b=N("import"),S=N("charset"),k=N("namespace");function N(e){var t=new RegExp("^@"+e+"\\s*([^;]+);");return function(){var r=i(),n=d(t);if(n){var a={type:e};return a[e]=n[1].trim(),r(a)}}}function C(){if("@"===e[0])return function(){var e=i(),t=d(/^@([-\w]+)?keyframes\s*/);if(t){var r=t[1];if(!(t=d(/^([-\w]+)\s*/)))return l("@keyframes missing name");var n,a=t[1];if(!u())return l("@keyframes missing '{'");for(var o=p();n=T();)o.push(n),o=o.concat(p());return c()?e({type:"keyframes",name:a,vendor:r,keyframes:o}):l("@keyframes missing '}'")}}()||function(){var e=i(),t=d(/^@media *([^{]+)/);if(t){var r=trim(t[1]);if(!u())return l("@media missing '{'");var n=p().concat(f());return c()?e({type:"media",media:r,rules:n}):l("@media missing '}'")}}()||function(){var e=i(),t=d(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:trim(t[1]),media:trim(t[2])})}()||function(){var e=i(),t=d(/^@supports *([^{]+)/);if(t){var r=trim(t[1]);if(!u())return l("@supports missing '{'");var n=p().concat(f());return c()?e({type:"supports",supports:r,rules:n}):l("@supports missing '}'")}}()||b()||S()||k()||function(){var e=i(),t=d(/^@([-\w]+)?document *([^{]+)/);if(t){var r=trim(t[1]),n=trim(t[2]);if(!u())return l("@document missing '{'");var a=p().concat(f());return c()?e({type:"document",document:n,vendor:r,rules:a}):l("@document missing '}'")}}()||function(){var e=i();if(d(/^@page */)){var t=v()||[];if(!u())return l("@page missing '{'");for(var r,n=p();r=g();)n.push(r),n=n.concat(p());return c()?e({type:"page",selectors:t,declarations:n}):l("@page missing '}'")}}()||function(){var e=i();if(d(/^@host\s*/)){if(!u())return l("@host missing '{'");var t=p().concat(f());return c()?e({type:"host",rules:t}):l("@host missing '}'")}}()||function(){var e=i();if(d(/^@font-face\s*/)){if(!u())return l("@font-face missing '{'");for(var t,r=p();t=g();)r.push(t),r=r.concat(p());return c()?e({type:"font-face",declarations:r}):l("@font-face missing '}'")}}()}function x(){var e=i(),t=v();return t?(p(),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,a=0,i=Object.keys(e);a<i.length;a++){var o=e[i[a]];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}function escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var HOVER_SELECTOR=/([^\\]):hover/,HOVER_SELECTOR_GLOBAL=new RegExp(HOVER_SELECTOR,"g");function addHoverClass(e){var t=parse(e,{silent:!0});if(!t.stylesheet)return e;var r=[];if(t.stylesheet.rules.forEach(function(e){"selectors"in e&&(e.selectors||[]).forEach(function(e){HOVER_SELECTOR.test(e)&&r.push(e)})}),0===r.length)return e;var n=new RegExp(r.filter(function(e,t){return r.indexOf(e)===t}).sort(function(e,t){return t.length-e.length}).map(function(e){return escapeRegExp(e)}).join("|"),"g");return e.replace(n,function(e){var t=e.replace(HOVER_SELECTOR_GLOBAL,"$1.\\:hover");return e+", "+t})}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 a,i=getTagName(e);a=e.isSVG?r.createElementNS("http://www.w3.org/2000/svg",i):r.createElement(i);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"===i&&"rr_dataURL"===t){var s=document.createElement("img");s.src=o,s.onload=function(){var e=a.getContext("2d");e&&e.drawImage(s,0,0,s.width,s.height)}}if("rr_width"===t&&(a.style.width=o),"rr_height"===t&&(a.style.height=o),"rr_mediaCurrentTime"===t&&(a.currentTime=e.attributes.rr_mediaCurrentTime),"rr_mediaState"===t)switch(o){case"played":a.play().catch(function(e){return console.warn("media playback error",e)});break;case"paused":a.pause()}}else{var l="textarea"===i&&"value"===t,u="style"===i&&"_cssText"===t;if(u&&n&&(o=addHoverClass(o)),l||u){for(var c=r.createTextNode(o),f=0,d=Array.from(a.childNodes);f<d.length;f++){var m=d[f];m.nodeType===a.TEXT_NODE&&a.removeChild(m)}return a.appendChild(c),"continue"}try{if(e.isSVG&&"xlink:href"===t)a.setAttributeNS("http://www.w3.org/1999/xlink",t,o);else if("onload"===t||"onclick"===t||"onmouse"===t.substring(0,7))a.setAttribute("_"+t,o);else{if("meta"===i&&"Content-Security-Policy"===e.attributes["http-equiv"]&&"content"===t)return a.setAttribute("csp-content",o),"continue";"link"===i&&"preload"===e.attributes.rel&&"script"===e.attributes.as||"link"===i&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")||a.setAttribute(t,o)}}catch(e){}}};for(var s in e.attributes)o(s);if(e.isShadowHost)if(a.shadowRoot)for(;a.shadowRoot.firstChild;)a.shadowRoot.removeChild(a.shadowRoot.firstChild);else a.attachShadow({mode:"open"});return a;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,a=t.skipChild,i=void 0!==a&&a,o=t.hackCss,s=void 0===o||o,l=t.afterAppend,u=buildNode(e,{doc:r,hackCss:s});if(!u)return null;if(e.rootId&&console.assert(n[e.rootId]===r,"Target document should has the same root id."),e.type===NodeType.Document&&(r.close(),r.open(),u=r),u.__sn=e,n[e.id]=u,(e.type===NodeType.Document||e.type===NodeType.Element)&&!i)for(var c=0,f=e.childNodes;c<f.length;c++){var d=f[c],m=buildNodeWithSN(d,{doc:r,map:n,skipChild:!1,hackCss:s,afterAppend:l});m?(d.isShadow&&isElement(u)&&u.shadowRoot?u.shadowRoot.appendChild(m):u.appendChild(m),l&&l(m)):console.warn("Failed to rebuild",d)}return u}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 a=t.attributes[n];"rr_scrollLeft"===n&&(r.scrollLeft=a),"rr_scrollTop"===n&&(r.scrollTop=a)}}}function rebuild(e,t){var r=t.doc,n=t.onVisit,a=t.hackCss,i={},o=buildNodeWithSN(e,{doc:r,map:i,skipChild:!1,hackCss:void 0===a||a,afterAppend:t.afterAppend});return visit(i,function(e){n&&n(e),handleScroll(e)}),[o,i]}export{snapshot,serializeNodeWithId,rebuild,buildNodeWithSN,addHoverClass,transformAttribute,visitSnapshot,cleanupSnapshot,needMaskingText,IGNORED_NODE,NodeType,isElement,isShadowRoot,maskInputValue};
//# sourceMappingURL=rrweb-snapshot.min.js.map

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

}
var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")([^"]*)"|([^)]*))\)/gm;
var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm;
var RELATIVE_PATH = /^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/;

@@ -468,3 +468,7 @@ var DATA_URI = /^(data:)([^,]*),(.*)/i;

sn.attributes.rel === 'preload' &&
sn.attributes.as === 'script'))) {
sn.attributes.as === 'script') ||
(sn.tagName === 'link' &&
sn.attributes.rel === 'prefetch' &&
typeof sn.attributes.href === 'string' &&
sn.attributes.href.endsWith('.js')))) {
return true;

@@ -1226,4 +1230,4 @@ }

}
function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
function escapeRegExp(str) {
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}

@@ -1249,4 +1253,5 @@ var HOVER_SELECTOR = /([^\\]):hover/;

});
if (selectors.length === 0)
if (selectors.length === 0) {
return cssText;
}
var selectorMatcher = new RegExp(selectors

@@ -1315,6 +1320,13 @@ .filter(function (selector, index) { return selectors.indexOf(selector) === index; })

n.attributes['http-equiv'] === 'Content-Security-Policy' &&
name == 'content') {
name === 'content') {
node_1.setAttribute('csp-content', value);
return "continue";
}
else if (tagName === 'link' &&
n.attributes.rel === 'preload' &&
n.attributes.as === 'script') ;
else if (tagName === 'link' &&
n.attributes.rel === 'prefetch' &&
typeof n.attributes.href === 'string' &&
n.attributes.href.endsWith('.js')) ;
else {

@@ -1321,0 +1333,0 @@ node_1.setAttribute(name, value);

{
"name": "rrweb-snapshot",
"version": "1.1.6",
"version": "1.1.7",
"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