@sentry-internal/rrweb-snapshot
Advanced tools
Comparing version 1.100.2 to 1.101.0
@@ -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.input,r=e.maskInputSelector,n=e.unmaskInputSelector,a=e.maskInputOptions,o=e.tagName,i=e.type,s=e.value,c=e.maskInputFn,l=s||"";return n&&t.matches(n)||(a[o.toLowerCase()]||a[i]||r&&t.matches(r))&&(l=c?c(l):"*".repeat(l.length)),l}e.NodeType=void 0,(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="__rrweb_original__";function i(e){var t=e.getContext("2d");if(!t)return!0;for(var r=0;r<e.width;r+=50)for(var n=0;n<e.height;n+=50){var a=t.getImageData,i=o in a?a.__rrweb_original__:a;if(new Uint32Array(i.call(t,r,n,Math.min(50,e.width-r),Math.min(50,e.height-n)).data.buffer).some((function(e){return 0!==e})))return!1}return!0}var s,c,l=1,u=new RegExp("[^a-z0-9-_:]");function p(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).map(f).join(""):null}catch(e){return null}}function f(e){var t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=p(e.styleSheet)||t}catch(e){}return t}var m=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,d=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,h=/^(data:)([^,]*),(.*)/i;function v(e,t){return(e||"").replace(m,(function(e,r,n,a,o,i){var s,c=n||o||i,l=r||a||"";if(!c)return e;if(!d.test(c))return"url("+l+c+l+")";if(h.test(c))return"url("+l+c+l+")";if("/"===c[0])return"url("+l+(((s=t).indexOf("//")>-1?s.split("/").slice(0,3).join("/"):s.split("/")[0]).split("?")[0]+c)+l+")";var u=t.split("/"),p=c.split("/");u.pop();for(var f=0,m=p;f<m.length;f++){var v=m[f];"."!==v&&(".."===v?u.pop():u.push(v))}return"url("+l+u.join("/")+l+")"}))}var y=/^[^ \t\n\r\u000c]+/,g=/^[, \t\n\r\u000c]+/;function k(e,t){if(!t||""===t.trim())return t;var r=e.createElement("a");return r.href=t,r.href}function T(){var e=document.createElement("a");return e.href="",e.href}function b(e,t,r,n){return"src"===r||"href"===r&&n||"xlink:href"===r&&n&&"#"!==n[0]?k(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(g),!(r>=t.length);){var o=n(y);if(","===o.slice(-1))o=k(e,o.substring(0,o.length-1)),a.push(o);else{var i="";o=k(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?v(n,T()):"object"===t&&"data"===r&&n?k(e,n):n:k(e,n)}function S(e,t,r,n){if(!e)return!1;if(e.nodeType===e.ELEMENT_NODE){if(n&&(e.matches(n)||e.closest(n)))return!1;if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var a=0;a<e.classList.length;a++){var o=e.classList[a];if(t.test(o))return!0}return!(!r||!e.matches(r))||S(e.parentNode,t,r,n)}return e.nodeType,e.TEXT_NODE,S(e.parentNode,t,r,n)}function C(t,r){var n,o,l,f,m=r.doc,d=r.blockClass,h=r.blockSelector,y=r.unblockSelector,g=r.maskTextClass,k=r.maskTextSelector,C=r.unmaskTextSelector,N=r.inlineStylesheet,w=r.maskInputSelector,x=r.unmaskInputSelector,I=r.maskInputOptions,E=void 0===I?{}:I,_=r.maskTextFn,D=r.maskInputFn,L=r.dataURLOptions,O=void 0===L?{}:L,A=r.inlineImages,R=r.recordCanvas,M=r.keepIframeSrcFn;if(m.__sn){var F=m.__sn.id;o=1===F?void 0:F}switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:e.NodeType.Document,childNodes:[],compatMode:t.compatMode,rootId:o}:{type:e.NodeType.Document,childNodes:[],rootId:o};case t.DOCUMENT_TYPE_NODE:return{type:e.NodeType.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:o};case t.ELEMENT_NODE:for(var U=function(e,t,r,n){if(n&&e.matches(n))return!1;if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var a=0;a<e.classList.length;a++){var o=e.classList[a];if(t.test(o))return!0}return!!r&&e.matches(r)}(t,d,h,y),W=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return u.test(t)?"div":t}(t),j={},P=0,B=Array.from(t.attributes);P<B.length;P++){var H=B[P],G=H.name,z=H.value;j[G]=b(m,W,G,z)}if("link"===W&&N){var q=Array.from(m.styleSheets).find((function(e){return e.href===t.href})),V=null;q&&(V=p(q)),V&&(delete j.rel,delete j.href,j._cssText=v(V,q.href))}if("style"===W&&t.sheet&&!(t.innerText||t.textContent||"").trim().length)(V=p(t.sheet))&&(j._cssText=v(V,T()));if("input"===W||"textarea"===W||"select"===W){z=t.value;"radio"!==j.type&&"checkbox"!==j.type&&"submit"!==j.type&&"button"!==j.type&&z?j.value=a({input:t,type:j.type,tagName:W,value:z,maskInputSelector:w,unmaskInputSelector:x,maskInputOptions:E,maskInputFn:D}):t.checked&&(j.checked=t.checked)}if("option"===W&&(t.selected&&!E.select?j.selected=!0:delete j.selected),"canvas"===W&&R)if("2d"===t.__context)i(t)||(j.rr_dataURL=t.toDataURL(O.type,O.quality));else if(!("__context"in t)){var $=t.toDataURL(O.type,O.quality),X=document.createElement("canvas");X.width=t.width,X.height=t.height,$!==X.toDataURL(O.type,O.quality)&&(j.rr_dataURL=$)}if("img"===W&&A){s||(s=m.createElement("canvas"),c=s.getContext("2d"));var Y=t,K=Y.crossOrigin;Y.crossOrigin="anonymous";var Z=function(){try{s.width=Y.naturalWidth,s.height=Y.naturalHeight,c.drawImage(Y,0,0),j.rr_dataURL=s.toDataURL(O.type,O.quality)}catch(e){console.warn("Cannot inline img src="+Y.currentSrc+"! Error: "+e)}K?j.crossOrigin=K:delete j.crossOrigin};Y.complete&&0!==Y.naturalWidth?Z():Y.onload=Z}if("audio"!==W&&"video"!==W||(j.rr_mediaState=t.paused?"paused":"played",j.rr_mediaCurrentTime=t.currentTime),t.scrollLeft&&(j.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(j.rr_scrollTop=t.scrollTop),U){var J=t.getBoundingClientRect(),Q=J.width,ee=J.height;j={class:j.class,rr_width:Q+"px",rr_height:ee+"px"}}return"iframe"!==W||M(j.src)||(t.contentDocument||(j.rr_src=j.src),delete j.src),{type:e.NodeType.Element,tagName:W,attributes:j,childNodes:[],isSVG:(f=t,Boolean("svg"===f.tagName||f.ownerSVGElement)||void 0),needBlock:U,rootId:o};case t.TEXT_NODE:var te=t.parentNode&&t.parentNode.tagName,re=t.textContent,ne="STYLE"===te||void 0,ae="SCRIPT"===te||void 0;if(ne&&re){try{t.nextSibling||t.previousSibling||(null===(n=t.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(re=(l=t.parentNode.sheet).cssRules?Array.from(l.cssRules).map((function(e){return e.cssText||""})).join(""):"")}catch(e){console.warn("Cannot get CSS styles from text's parentNode. Error: "+e,t)}re=v(re,T())}return ae&&(re="SCRIPT_PLACEHOLDER"),!ne&&!ae&&S(t,g,k,C)&&re&&(re=_?_(re):re.replace(/[\S]/g,"*")),{type:e.NodeType.Text,textContent:re||"",isStyle:ne,rootId:o};case t.CDATA_SECTION_NODE:return{type:e.NodeType.CDATA,textContent:"",rootId:o};case t.COMMENT_NODE:return{type:e.NodeType.Comment,textContent:t.textContent||"",rootId:o};default:return!1}}function N(e){return void 0===e?"":e.toLowerCase()}function w(t,a){var o,i=a.doc,s=a.map,c=a.blockClass,u=a.blockSelector,p=a.unblockSelector,f=a.maskTextClass,m=a.maskTextSelector,d=a.unmaskTextSelector,h=a.skipChild,v=void 0!==h&&h,y=a.inlineStylesheet,g=void 0===y||y,k=a.maskInputSelector,T=a.unmaskInputSelector,b=a.maskInputOptions,S=void 0===b?{}:b,x=a.maskTextFn,I=a.maskInputFn,E=a.slimDOMOptions,_=a.dataURLOptions,D=void 0===_?{}:_,L=a.inlineImages,O=void 0!==L&&L,A=a.recordCanvas,R=void 0!==A&&A,M=a.onSerialize,F=a.onIframeLoad,U=a.iframeLoadTimeout,W=void 0===U?5e3:U,j=a.keepIframeSrcFn,P=void 0===j?function(){return!1}:j,B=a.preserveWhiteSpace,H=void 0===B||B,G=C(t,{doc:i,blockClass:c,blockSelector:u,unblockSelector:p,maskTextClass:f,maskTextSelector:m,unmaskTextSelector:d,inlineStylesheet:g,maskInputSelector:k,unmaskInputSelector:T,maskInputOptions:S,maskTextFn:x,maskInputFn:I,dataURLOptions:D,inlineImages:O,recordCanvas:R,keepIframeSrcFn:P});if(!G)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&&(N(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===N(t.attributes.name)||"icon"===N(t.attributes.rel)||"apple-touch-icon"===N(t.attributes.rel)||"shortcut icon"===N(t.attributes.rel))))return!0;if("meta"===t.tagName){if(r.headMetaDescKeywords&&N(t.attributes.name).match(/^description|keywords$/))return!0;if(r.headMetaSocial&&(N(t.attributes.property).match(/^(og|twitter|fb):/)||N(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===N(t.attributes.name)))return!0;if(r.headMetaRobots&&("robots"===N(t.attributes.name)||"googlebot"===N(t.attributes.name)||"bingbot"===N(t.attributes.name)))return!0;if(r.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(r.headMetaAuthorship&&("author"===N(t.attributes.name)||"generator"===N(t.attributes.name)||"framework"===N(t.attributes.name)||"publisher"===N(t.attributes.name)||"progid"===N(t.attributes.name)||N(t.attributes.property).match(/^article:/)||N(t.attributes.property).match(/^product:/)))return!0;if(r.headMetaVerification&&("google-site-verification"===N(t.attributes.name)||"yandex-verification"===N(t.attributes.name)||"csrf-token"===N(t.attributes.name)||"p:domain_verify"===N(t.attributes.name)||"verify-v1"===N(t.attributes.name)||"verification"===N(t.attributes.name)||"shopify-checkout-api-token"===N(t.attributes.name)))return!0}}return!1}(G,E)&&(H||G.type!==e.NodeType.Text||G.isStyle||G.textContent.replace(/^\s+|\s+$/gm,"").length)?l++:-2;var z=Object.assign(G,{id:o});if(t.__sn=z,-2===o)return null;s[o]=t,M&&M(t);var q=!v;if(z.type===e.NodeType.Element&&(q=q&&!z.needBlock,delete z.needBlock,t.shadowRoot&&(z.isShadowHost=!0)),(z.type===e.NodeType.Document||z.type===e.NodeType.Element)&&q){E.headWhitespace&&G.type===e.NodeType.Element&&"head"===G.tagName&&(H=!1);for(var V={doc:i,map:s,blockClass:c,blockSelector:u,unblockSelector:p,maskTextClass:f,maskTextSelector:m,unmaskTextSelector:d,skipChild:v,inlineStylesheet:g,maskInputSelector:k,unmaskInputSelector:T,maskInputOptions:S,maskTextFn:x,maskInputFn:I,slimDOMOptions:E,dataURLOptions:D,inlineImages:O,recordCanvas:R,preserveWhiteSpace:H,onSerialize:M,onIframeLoad:F,iframeLoadTimeout:W,keepIframeSrcFn:P},$=0,X=Array.from(t.childNodes);$<X.length;$++){(Z=w(X[$],V))&&z.childNodes.push(Z)}if(r(t)&&t.shadowRoot)for(var Y=0,K=Array.from(t.shadowRoot.childNodes);Y<K.length;Y++){var Z;(Z=w(K[Y],V))&&(Z.isShadow=!0,z.childNodes.push(Z))}}return t.parentNode&&n(t.parentNode)&&(z.isShadow=!0),z.type===e.NodeType.Element&&"iframe"===z.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){var i="about:blank";n.location.href===i&&e.src!==i&&""!==e.src?e.addEventListener("load",t):setTimeout(t,0)}else{var s=setTimeout((function(){o||(t(),o=!0)}),r);e.addEventListener("load",(function(){clearTimeout(s),o=!0,t()}))}}}(t,(function(){var e=t.contentDocument;if(e&&F){var r=w(e,{doc:e,map:s,blockClass:c,blockSelector:u,unblockSelector:p,maskTextClass:f,maskTextSelector:m,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:g,maskInputSelector:k,unmaskInputSelector:T,maskInputOptions:S,maskTextFn:x,maskInputFn:I,slimDOMOptions:E,dataURLOptions:D,inlineImages:O,recordCanvas:R,preserveWhiteSpace:H,onSerialize:M,onIframeLoad:F,iframeLoadTimeout:W,keepIframeSrcFn:P});r&&F(t,r)}}),W),z}var x=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function I(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(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 l(){return f(/^{\s*/)}function u(){return f(/^}/)}function p(){var t,r=[];for(m(),d(r);e.length&&"}"!==e.charAt(0)&&(t=w()||I());)!1!==t&&(r.push(t),d(r));return r}function f(t){var r=t.exec(e);if(r){var n=r[0];return a(n),e=e.slice(n.length),r}}function m(){f(/^\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=f(/^([^{]+)/);if(e)return E(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=f(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(t){var r=E(t[0]);if(!f(/^:\s*/))return c("property missing ':'");var n=f(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),a=e({type:"declaration",property:r.replace(x,""),value:n?E(n[0]).replace(x,""):""});return f(/^[;\s]*/),a}}function g(){var e,t=[];if(!l())return c("missing '{'");for(d(t);e=y();)!1!==e&&(t.push(e),d(t)),e=y();return u()?t:c("missing '}'")}function k(){for(var e,t=[],r=o();e=f(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),f(/^,\s*/);if(t.length)return r({type:"keyframe",values:t,declarations:g()})}var T,b=N("import"),S=N("charset"),C=N("namespace");function N(e){var t=new RegExp("^@"+e+"\\s*([^;]+);");return function(){var r=o(),n=f(t);if(n){var a={type:e};return a[e]=n[1].trim(),r(a)}}}function w(){if("@"===e[0])return function(){var e=o(),t=f(/^@([-\w]+)?keyframes\s*/);if(t){var r=t[1];if(!(t=f(/^([-\w]+)\s*/)))return c("@keyframes missing name");var n,a=t[1];if(!l())return c("@keyframes missing '{'");for(var i=d();n=k();)i.push(n),i=i.concat(d());return u()?e({type:"keyframes",name:a,vendor:r,keyframes:i}):c("@keyframes missing '}'")}}()||function(){var e=o(),t=f(/^@media *([^{]+)/);if(t){var r=E(t[1]);if(!l())return c("@media missing '{'");var n=d().concat(p());return u()?e({type:"media",media:r,rules:n}):c("@media missing '}'")}}()||function(){var e=o(),t=f(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:E(t[1]),media:E(t[2])})}()||function(){var e=o(),t=f(/^@supports *([^{]+)/);if(t){var r=E(t[1]);if(!l())return c("@supports missing '{'");var n=d().concat(p());return u()?e({type:"supports",supports:r,rules:n}):c("@supports missing '}'")}}()||b()||S()||C()||function(){var e=o(),t=f(/^@([-\w]+)?document *([^{]+)/);if(t){var r=E(t[1]),n=E(t[2]);if(!l())return c("@document missing '{'");var a=d().concat(p());return u()?e({type:"document",document:n,vendor:r,rules:a}):c("@document missing '}'")}}()||function(){var e=o();if(f(/^@page */)){var t=v()||[];if(!l())return c("@page missing '{'");for(var r,n=d();r=y();)n.push(r),n=n.concat(d());return u()?e({type:"page",selectors:t,declarations:n}):c("@page missing '}'")}}()||function(){var e=o();if(f(/^@host\s*/)){if(!l())return c("@host missing '{'");var t=d().concat(p());return u()?e({type:"host",rules:t}):c("@host missing '}'")}}()||function(){var e=o();if(f(/^@font-face\s*/)){if(!l())return c("@font-face missing '{'");for(var t,r=d();t=y();)r.push(t),r=r.concat(d());return u()?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 _((T=p(),{type:"stylesheet",stylesheet:{source:t.source,rules:T,parsingErrors:s}}))}function E(e){return e?e.replace(/^\s+|\s+$/g,""):""}function _(e,t){for(var r=e&&"string"==typeof e.type,n=r?e:t,a=0,o=Object.keys(e);a<o.length;a++){var i=e[o[a]];Array.isArray(i)?i.forEach((function(e){_(e,n)})):i&&"object"==typeof i&&_(i,n)}return r&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var D={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 L=/([^\\]):hover/,O=new RegExp(L.source,"g");function A(e,t){var r=null==t?void 0:t.stylesWithHoverClass.get(e);if(r)return r;var n=I(e,{silent:!0});if(!n.stylesheet)return e;var a=[];if(n.stylesheet.rules.forEach((function(e){"selectors"in e&&(e.selectors||[]).forEach((function(e){L.test(e)&&a.push(e)}))})),0===a.length)return e;var o=new RegExp(a.filter((function(e,t){return a.indexOf(e)===t})).sort((function(e,t){return t.length-e.length})).map((function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})).join("|"),"g"),i=e.replace(o,(function(e){var t=e.replace(O,"$1.\\:hover");return e+", "+t}));return null==t||t.stylesWithHoverClass.set(e,i),i}function R(t,r){var n=r.doc,a=r.hackCss,o=r.cache;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,s=function(e){var t=D[e.tagName]?D[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",s):n.createElement(s);var c=function(e){if(!t.attributes.hasOwnProperty(e))return"continue";var r=t.attributes[e];if("option"===s&&"selected"===e&&!1===r)return"continue";if(r="boolean"==typeof r||"number"==typeof r?"":r,e.startsWith("rr_")){if("canvas"===s&&"rr_dataURL"===e){var c=document.createElement("img");c.src=r,c.onload=function(){var e=i.getContext("2d");e&&e.drawImage(c,0,0,c.width,c.height)}}else if("img"===s&&"rr_dataURL"===e){var l=i;l.currentSrc.startsWith("data:")||(l.setAttribute("rrweb-original-src",t.attributes.src),l.src=r)}if("rr_width"===e)i.style.width=r;else if("rr_height"===e)i.style.height=r;else if("rr_mediaCurrentTime"===e)i.currentTime=t.attributes.rr_mediaCurrentTime;else if("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 u="textarea"===s&&"value"===e,p="style"===s&&"_cssText"===e;if(p&&a&&(r=A(r,o)),u||p){for(var f=n.createTextNode(r),m=0,d=Array.from(i.childNodes);m<d.length;m++){var h=d[m];h.nodeType===i.TEXT_NODE&&i.removeChild(h)}return i.appendChild(f),"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"===s&&"Content-Security-Policy"===t.attributes["http-equiv"]&&"content"===e)return i.setAttribute("csp-content",r),"continue";"link"===s&&"preload"===t.attributes.rel&&"script"===t.attributes.as||"link"===s&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&t.attributes.href.endsWith(".js")||("img"===s&&t.attributes.srcset&&t.attributes.rr_dataURL?i.setAttribute("rrweb-original-srcset",t.attributes.srcset):i.setAttribute(e,r))}}catch(e){}}};for(var l in t.attributes)c(l);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?A(t.textContent,o):t.textContent);case e.NodeType.CDATA:return n.createCDATASection(t.textContent);case e.NodeType.Comment:return n.createComment(t.textContent);default:return null}}function M(t,n){var a=n.doc,o=n.map,i=n.skipChild,s=void 0!==i&&i,c=n.hackCss,l=void 0===c||c,u=n.afterAppend,p=n.cache,f=R(t,{doc:a,hackCss:l,cache:p});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(),"BackCompat"===t.compatMode&&t.childNodes&&t.childNodes[0].type!==e.NodeType.DocumentType&&(t.childNodes[0].type===e.NodeType.Element&&"xmlns"in t.childNodes[0].attributes&&"http://www.w3.org/1999/xhtml"===t.childNodes[0].attributes.xmlns?a.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):a.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),f=a),f.__sn=t,o[t.id]=f,(t.type===e.NodeType.Document||t.type===e.NodeType.Element)&&!s)for(var m=0,d=t.childNodes;m<d.length;m++){var h=d[m],v=M(h,{doc:a,map:o,skipChild:!1,hackCss:l,afterAppend:u,cache:p});v?(h.isShadow&&r(f)&&f.shadowRoot?f.shadowRoot.appendChild(v):f.appendChild(v),u&&u(v)):console.warn("Failed to rebuild",h)}return f}return e.IGNORED_NODE=-2,e.addHoverClass=A,e.buildNodeWithSN=M,e.cleanupSnapshot=function(){l=1},e.createCache=function(){return{stylesWithHoverClass:new Map}},e.is2DCanvasBlank=i,e.isElement=r,e.isShadowRoot=n,e.maskInputValue=a,e.needMaskingText=S,e.rebuild=function(t,r){var n=r.doc,a=r.onVisit,o=r.hackCss,i={},s=M(t,{doc:n,map:i,skipChild:!1,hackCss:void 0===o||o,afterAppend:r.afterAppend,cache:r.cache});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.serializeNodeWithId=w,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.unblockSelector,c=void 0===s?null:s,l=r.maskTextClass,u=void 0===l?"rr-mask":l,p=r.maskTextSelector,f=void 0===p?null:p,m=r.unmaskTextSelector,d=void 0===m?null:m,h=r.inlineStylesheet,v=void 0===h||h,y=r.inlineImages,g=void 0!==y&&y,k=r.recordCanvas,T=void 0!==k&&k,b=r.maskInputSelector,S=void 0===b?null:b,C=r.unmaskInputSelector,N=void 0===C?null:C,x=r.maskAllInputs,I=void 0!==x&&x,E=r.maskTextFn,_=r.maskInputFn,D=r.slimDOM,L=void 0!==D&&D,O=r.dataURLOptions,A=r.preserveWhiteSpace,R=r.onSerialize,M=r.onIframeLoad,F=r.iframeLoadTimeout,U=r.keepIframeSrcFn,W={};return[w(e,{doc:e,map:W,blockClass:a,blockSelector:i,unblockSelector:c,maskTextClass:u,maskTextSelector:f,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:v,maskInputSelector:S,unmaskInputSelector:N,maskInputOptions:!0===I?{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===I?{password:!0}:I,maskTextFn:E,maskInputFn:_,slimDOMOptions:!0===L||"all"===L?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===L,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===L?{}:L,dataURLOptions:O,inlineImages:g,recordCanvas:T,preserveWhiteSpace:A,onSerialize:R,onIframeLoad:M,iframeLoadTimeout:F,keepIframeSrcFn:void 0===U?function(){return!1}:U}),W]},e.transformAttribute=b,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)},Object.defineProperty(e,"__esModule",{value:!0}),e}({}); | ||
var rrwebSnapshot=function(e){"use strict";var t;function n(e){return e.nodeType===e.ELEMENT_NODE}function r(e){const t=null==e?void 0:e.host;return Boolean(t&&t.shadowRoot&&t.shadowRoot===e)}function o({input:e,maskInputSelector:t,unmaskInputSelector:n,maskInputOptions:r,tagName:o,type:s,value:a,maskInputFn:i}){let c=a||"";return n&&e.matches(n)||(r[o.toLowerCase()]||r[s]||t&&e.matches(t))&&(c=i?i(c):"*".repeat(c.length)),c}e.NodeType=void 0,(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";const s="__rrweb_original__";function a(e){const t=e.getContext("2d");if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let r=0;r<e.height;r+=50){const o=t.getImageData,a=s in o?o[s]:o;if(new Uint32Array(a.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some((e=>0!==e)))return!1}return!0}let i=1;const c=new RegExp("[^a-z0-9-_:]");function l(e){try{const t=e.rules||e.cssRules;return t?Array.from(t).map(u).join(""):null}catch(e){return null}}function u(e){let t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=l(e.styleSheet)||t}catch(e){}return t}let p,m;const f=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,d=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,h=/^(data:)([^,]*),(.*)/i;function y(e,t){return(e||"").replace(f,((e,n,r,o,s,a)=>{const i=r||s||a,c=n||o||"";if(!i)return e;if(!d.test(i))return`url(${c}${i}${c})`;if(h.test(i))return`url(${c}${i}${c})`;if("/"===i[0])return`url(${c}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+i}${c})`;const l=t.split("/"),u=i.split("/");l.pop();for(const e of u)"."!==e&&(".."===e?l.pop():l.push(e));return`url(${c}${l.join("/")}${c})`}))}const g=/^[^ \t\n\r\u000c]+/,k=/^[, \t\n\r\u000c]+/;function T(e,t){if(!t||""===t.trim())return t;const n=e.createElement("a");return n.href=t,n.href}function b(){const e=document.createElement("a");return e.href="",e.href}function S(e,t,n,r){return"src"===n||"href"===n&&r||"xlink:href"===n&&r&&"#"!==r[0]?T(e,r):"background"!==n||!r||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n&&r?function(e,t){if(""===t.trim())return t;let n=0;function r(e){let r,o=e.exec(t.substring(n));return o?(r=o[0],n+=r.length,r):""}let o=[];for(;r(k),!(n>=t.length);){let s=r(g);if(","===s.slice(-1))s=T(e,s.substring(0,s.length-1)),o.push(s);else{let r="";s=T(e,s);let a=!1;for(;;){let e=t.charAt(n);if(""===e){o.push((s+r).trim());break}if(a)")"===e&&(a=!1);else{if(","===e){n+=1,o.push((s+r).trim());break}"("===e&&(a=!0)}r+=e,n+=1}}}return o.join(", ")}(e,r):"style"===n&&r?y(r,b()):"object"===t&&"data"===n&&r?T(e,r):r:T(e,r)}function C(e,t,n,r){if(!e)return!1;if(e.nodeType===e.ELEMENT_NODE){if(r&&(e.matches(r)||e.closest(r)))return!1;if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=0;n<e.classList.length;n++){const r=e.classList[n];if(t.test(r))return!0}return!(!n||!e.matches(n))||C(e.parentNode,t,n,r)}return e.nodeType,e.TEXT_NODE,C(e.parentNode,t,n,r)}function N(t,n){var r;const{doc:s,blockClass:i,blockSelector:u,unblockSelector:f,maskTextClass:d,maskTextSelector:h,unmaskTextSelector:g,inlineStylesheet:k,maskInputSelector:T,unmaskInputSelector:N,maskInputOptions:w={},maskTextFn:x,maskInputFn:I,dataURLOptions:v={},inlineImages:E,recordCanvas:_,keepIframeSrcFn:D}=n;let L;if(s.__sn){const e=s.__sn.id;L=1===e?void 0:e}switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:e.NodeType.Document,childNodes:[],compatMode:t.compatMode,rootId:L}:{type:e.NodeType.Document,childNodes:[],rootId:L};case t.DOCUMENT_TYPE_NODE:return{type:e.NodeType.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:L};case t.ELEMENT_NODE:const n=function(e,t,n,r){if(r&&e.matches(r))return!1;if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=0;n<e.classList.length;n++){const r=e.classList[n];if(t.test(r))return!0}return!!n&&e.matches(n)}(t,i,u,f),R=function(e){if(e instanceof HTMLFormElement)return"form";const t=e.tagName.toLowerCase().trim();return c.test(t)?"div":t}(t);let M={};for(const{name:e,value:n}of Array.from(t.attributes))M[e]=S(s,R,e,n);if("link"===R&&k){const e=Array.from(s.styleSheets).find((e=>e.href===t.href));let n=null;e&&(n=l(e)),n&&(delete M.rel,delete M.href,M._cssText=y(n,e.href))}if("style"===R&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){const e=l(t.sheet);e&&(M._cssText=y(e,b()))}if("input"===R||"textarea"===R||"select"===R){const e=t.value;"radio"!==M.type&&"checkbox"!==M.type&&"submit"!==M.type&&"button"!==M.type&&e?M.value=o({input:t,type:M.type,tagName:R,value:e,maskInputSelector:T,unmaskInputSelector:N,maskInputOptions:w,maskInputFn:I}):t.checked&&(M.checked=t.checked)}if("option"===R&&(t.selected&&!w.select?M.selected=!0:delete M.selected),"canvas"===R&&_)if("2d"===t.__context)a(t)||(M.rr_dataURL=t.toDataURL(v.type,v.quality));else if(!("__context"in t)){const e=t.toDataURL(v.type,v.quality),n=document.createElement("canvas");n.width=t.width,n.height=t.height;e!==n.toDataURL(v.type,v.quality)&&(M.rr_dataURL=e)}if("img"===R&&E){p||(p=s.createElement("canvas"),m=p.getContext("2d"));const e=t,n=e.crossOrigin;e.crossOrigin="anonymous";const r=()=>{try{p.width=e.naturalWidth,p.height=e.naturalHeight,m.drawImage(e,0,0),M.rr_dataURL=p.toDataURL(v.type,v.quality)}catch(t){console.warn(`Cannot inline img src=${e.currentSrc}! Error: ${t}`)}n?M.crossOrigin=n:delete M.crossOrigin};e.complete&&0!==e.naturalWidth?r():e.onload=r}if("audio"!==R&&"video"!==R||(M.rr_mediaState=t.paused?"paused":"played",M.rr_mediaCurrentTime=t.currentTime),t.scrollLeft&&(M.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(M.rr_scrollTop=t.scrollTop),n){const{width:e,height:n}=t.getBoundingClientRect();M={class:M.class,rr_width:`${e}px`,rr_height:`${n}px`}}return"iframe"!==R||D(M.src)||(t.contentDocument||(M.rr_src=M.src),delete M.src),{type:e.NodeType.Element,tagName:R,attributes:M,childNodes:[],isSVG:(A=t,Boolean("svg"===A.tagName||A.ownerSVGElement)||void 0),needBlock:n,rootId:L};case t.TEXT_NODE:const F=t.parentNode&&t.parentNode.tagName;let $=t.textContent;const U="STYLE"===F||void 0,W="SCRIPT"===F||void 0;if(U&&$){try{t.nextSibling||t.previousSibling||(null===(r=t.parentNode.sheet)||void 0===r?void 0:r.cssRules)&&($=(O=t.parentNode.sheet).cssRules?Array.from(O.cssRules).map((e=>e.cssText||"")).join(""):"")}catch(e){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${e}`,t)}$=y($,b())}return W&&($="SCRIPT_PLACEHOLDER"),!U&&!W&&C(t,d,h,g)&&$&&($=x?x($):$.replace(/[\S]/g,"*")),{type:e.NodeType.Text,textContent:$||"",isStyle:U,rootId:L};case t.CDATA_SECTION_NODE:return{type:e.NodeType.CDATA,textContent:"",rootId:L};case t.COMMENT_NODE:return{type:e.NodeType.Comment,textContent:t.textContent||"",rootId:L};default:return!1}var O,A}function w(e){return void 0===e?"":e.toLowerCase()}function x(t,o){const{doc:s,map:a,blockClass:c,blockSelector:l,unblockSelector:u,maskTextClass:p,maskTextSelector:m,unmaskTextSelector:f,skipChild:d=!1,inlineStylesheet:h=!0,maskInputSelector:y,unmaskInputSelector:g,maskInputOptions:k={},maskTextFn:T,maskInputFn:b,slimDOMOptions:S,dataURLOptions:C={},inlineImages:I=!1,recordCanvas:v=!1,onSerialize:E,onIframeLoad:_,iframeLoadTimeout:D=5e3,keepIframeSrcFn:L=(()=>!1)}=o;let{preserveWhiteSpace:O=!0}=o;const A=N(t,{doc:s,blockClass:c,blockSelector:l,unblockSelector:u,maskTextClass:p,maskTextSelector:m,unmaskTextSelector:f,inlineStylesheet:h,maskInputSelector:y,unmaskInputSelector:g,maskInputOptions:k,maskTextFn:T,maskInputFn:b,dataURLOptions:C,inlineImages:I,recordCanvas:v,keepIframeSrcFn:L});if(!A)return console.warn(t,"not serialized"),null;let R;R="__sn"in t?t.__sn.id:!function(t,n){if(n.comment&&t.type===e.NodeType.Comment)return!0;if(t.type===e.NodeType.Element){if(n.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(n.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(w(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===w(t.attributes.name)||"icon"===w(t.attributes.rel)||"apple-touch-icon"===w(t.attributes.rel)||"shortcut icon"===w(t.attributes.rel))))return!0;if("meta"===t.tagName){if(n.headMetaDescKeywords&&w(t.attributes.name).match(/^description|keywords$/))return!0;if(n.headMetaSocial&&(w(t.attributes.property).match(/^(og|twitter|fb):/)||w(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===w(t.attributes.name)))return!0;if(n.headMetaRobots&&("robots"===w(t.attributes.name)||"googlebot"===w(t.attributes.name)||"bingbot"===w(t.attributes.name)))return!0;if(n.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(n.headMetaAuthorship&&("author"===w(t.attributes.name)||"generator"===w(t.attributes.name)||"framework"===w(t.attributes.name)||"publisher"===w(t.attributes.name)||"progid"===w(t.attributes.name)||w(t.attributes.property).match(/^article:/)||w(t.attributes.property).match(/^product:/)))return!0;if(n.headMetaVerification&&("google-site-verification"===w(t.attributes.name)||"yandex-verification"===w(t.attributes.name)||"csrf-token"===w(t.attributes.name)||"p:domain_verify"===w(t.attributes.name)||"verify-v1"===w(t.attributes.name)||"verification"===w(t.attributes.name)||"shopify-checkout-api-token"===w(t.attributes.name)))return!0}}return!1}(A,S)&&(O||A.type!==e.NodeType.Text||A.isStyle||A.textContent.replace(/^\s+|\s+$/gm,"").length)?i++:-2;const M=Object.assign(A,{id:R});if(t.__sn=M,-2===R)return null;a[R]=t,E&&E(t);let F=!d;if(M.type===e.NodeType.Element&&(F=F&&!M.needBlock,delete M.needBlock,t.shadowRoot&&(M.isShadowHost=!0)),(M.type===e.NodeType.Document||M.type===e.NodeType.Element)&&F){S.headWhitespace&&A.type===e.NodeType.Element&&"head"===A.tagName&&(O=!1);const r={doc:s,map:a,blockClass:c,blockSelector:l,unblockSelector:u,maskTextClass:p,maskTextSelector:m,unmaskTextSelector:f,skipChild:d,inlineStylesheet:h,maskInputSelector:y,unmaskInputSelector:g,maskInputOptions:k,maskTextFn:T,maskInputFn:b,slimDOMOptions:S,dataURLOptions:C,inlineImages:I,recordCanvas:v,preserveWhiteSpace:O,onSerialize:E,onIframeLoad:_,iframeLoadTimeout:D,keepIframeSrcFn:L};for(const e of Array.from(t.childNodes)){const t=x(e,r);t&&M.childNodes.push(t)}if(n(t)&&t.shadowRoot)for(const e of Array.from(t.shadowRoot.childNodes)){const t=x(e,r);t&&(t.isShadow=!0,M.childNodes.push(t))}}return t.parentNode&&r(t.parentNode)&&(M.isShadow=!0),M.type===e.NodeType.Element&&"iframe"===M.tagName&&function(e,t,n){const r=e.contentWindow;if(!r)return;let o,s=!1;try{o=r.document.readyState}catch(e){return}if("complete"!==o){const r=setTimeout((()=>{s||(t(),s=!0)}),n);return void e.addEventListener("load",(()=>{clearTimeout(r),s=!0,t()}))}const a="about:blank";r.location.href===a&&e.src!==a&&""!==e.src?e.addEventListener("load",t):setTimeout(t,0)}(t,(()=>{const e=t.contentDocument;if(e&&_){const n=x(e,{doc:e,map:a,blockClass:c,blockSelector:l,unblockSelector:u,maskTextClass:p,maskTextSelector:m,unmaskTextSelector:f,skipChild:!1,inlineStylesheet:h,maskInputSelector:y,unmaskInputSelector:g,maskInputOptions:k,maskTextFn:T,maskInputFn:b,slimDOMOptions:S,dataURLOptions:C,inlineImages:I,recordCanvas:v,preserveWhiteSpace:O,onSerialize:E,onIframeLoad:_,iframeLoadTimeout:D,keepIframeSrcFn:L});n&&_(t,n)}}),D),M}const I=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function v(e,t={}){let n=1,r=1;function o(e){const t=e.match(/\n/g);t&&(n+=t.length);let o=e.lastIndexOf("\n");r=-1===o?r+e.length:e.length-o}function s(){const e={line:n,column:r};return t=>(t.position=new a(e),f(),t)}class a{constructor(e){this.start=e,this.end={line:n,column:r},this.source=t.source}}a.prototype.content=e;const i=[];function c(o){const s=new Error(t.source+":"+n+":"+r+": "+o);if(s.reason=o,s.filename=t.source,s.line=n,s.column=r,s.source=e,!t.silent)throw s;i.push(s)}function l(){return m(/^{\s*/)}function u(){return m(/^}/)}function p(){let t;const n=[];for(f(),d(n);e.length&&"}"!==e.charAt(0)&&(t=w()||x());)!1!==t&&(n.push(t),d(n));return n}function m(t){const n=t.exec(e);if(!n)return;const r=n[0];return o(r),e=e.slice(r.length),n}function f(){m(/^\s*/)}function d(e=[]){let t;for(;t=h();)!1!==t&&e.push(t),t=h();return e}function h(){const t=s();if("/"!==e.charAt(0)||"*"!==e.charAt(1))return;let n=2;for(;""!==e.charAt(n)&&("*"!==e.charAt(n)||"/"!==e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return c("End of comment missing");const a=e.slice(2,n-2);return r+=2,o(a),e=e.slice(n),r+=2,t({type:"comment",comment:a})}function y(){const e=m(/^([^{]+)/);if(e)return E(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,(e=>e.replace(/,/g,""))).split(/\s*(?![^(]*\)),\s*/).map((e=>e.replace(/\u200C/g,",")))}function g(){const e=s();let t=m(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(!t)return;const n=E(t[0]);if(!m(/^:\s*/))return c("property missing ':'");const r=m(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),o=e({type:"declaration",property:n.replace(I,""),value:r?E(r[0]).replace(I,""):""});return m(/^[;\s]*/),o}function k(){const e=[];if(!l())return c("missing '{'");let t;for(d(e);t=g();)!1!==t&&(e.push(t),d(e)),t=g();return u()?e:c("missing '}'")}function T(){let e;const t=[],n=s();for(;e=m(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),m(/^,\s*/);if(t.length)return n({type:"keyframe",values:t,declarations:k()})}const b=N("import"),S=N("charset"),C=N("namespace");function N(e){const t=new RegExp("^@"+e+"\\s*([^;]+);");return()=>{const n=s(),r=m(t);if(!r)return;const o={type:e};return o[e]=r[1].trim(),n(o)}}function w(){if("@"===e[0])return function(){const e=s();let t=m(/^@([-\w]+)?keyframes\s*/);if(!t)return;const n=t[1];if(t=m(/^([-\w]+)\s*/),!t)return c("@keyframes missing name");const r=t[1];if(!l())return c("@keyframes missing '{'");let o,a=d();for(;o=T();)a.push(o),a=a.concat(d());return u()?e({type:"keyframes",name:r,vendor:n,keyframes:a}):c("@keyframes missing '}'")}()||function(){const e=s(),t=m(/^@media *([^{]+)/);if(!t)return;const n=E(t[1]);if(!l())return c("@media missing '{'");const r=d().concat(p());return u()?e({type:"media",media:n,rules:r}):c("@media missing '}'")}()||function(){const e=s(),t=m(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:E(t[1]),media:E(t[2])})}()||function(){const e=s(),t=m(/^@supports *([^{]+)/);if(!t)return;const n=E(t[1]);if(!l())return c("@supports missing '{'");const r=d().concat(p());return u()?e({type:"supports",supports:n,rules:r}):c("@supports missing '}'")}()||b()||S()||C()||function(){const e=s(),t=m(/^@([-\w]+)?document *([^{]+)/);if(!t)return;const n=E(t[1]),r=E(t[2]);if(!l())return c("@document missing '{'");const o=d().concat(p());return u()?e({type:"document",document:r,vendor:n,rules:o}):c("@document missing '}'")}()||function(){const e=s();if(!m(/^@page */))return;const t=y()||[];if(!l())return c("@page missing '{'");let n,r=d();for(;n=g();)r.push(n),r=r.concat(d());return u()?e({type:"page",selectors:t,declarations:r}):c("@page missing '}'")}()||function(){const e=s();if(!m(/^@host\s*/))return;if(!l())return c("@host missing '{'");const t=d().concat(p());return u()?e({type:"host",rules:t}):c("@host missing '}'")}()||function(){const e=s();if(!m(/^@font-face\s*/))return;if(!l())return c("@font-face missing '{'");let t,n=d();for(;t=g();)n.push(t),n=n.concat(d());return u()?e({type:"font-face",declarations:n}):c("@font-face missing '}'")}()}function x(){const e=s(),t=y();return t?(d(),e({type:"rule",selectors:t,declarations:k()})):c("selector missing")}return _(function(){const e=p();return{type:"stylesheet",stylesheet:{source:t.source,rules:e,parsingErrors:i}}}())}function E(e){return e?e.replace(/^\s+|\s+$/g,""):""}function _(e,t){const n=e&&"string"==typeof e.type,r=n?e:t;for(const t of Object.keys(e)){const n=e[t];Array.isArray(n)?n.forEach((e=>{_(e,r)})):n&&"object"==typeof n&&_(n,r)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}const D={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"};const L=/([^\\]):hover/,O=new RegExp(L.source,"g");function A(e,t){const n=null==t?void 0:t.stylesWithHoverClass.get(e);if(n)return n;const r=v(e,{silent:!0});if(!r.stylesheet)return e;const o=[];if(r.stylesheet.rules.forEach((e=>{"selectors"in e&&(e.selectors||[]).forEach((e=>{L.test(e)&&o.push(e)}))})),0===o.length)return e;const s=new RegExp(o.filter(((e,t)=>o.indexOf(e)===t)).sort(((e,t)=>t.length-e.length)).map((e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))).join("|"),"g"),a=e.replace(s,(e=>{const t=e.replace(O,"$1.\\:hover");return`${e}, ${t}`}));return null==t||t.stylesWithHoverClass.set(e,a),a}function R(t,n){const{doc:r,hackCss:o,cache:s}=n;switch(t.type){case e.NodeType.Document:return r.implementation.createDocument(null,"",null);case e.NodeType.DocumentType:return r.implementation.createDocumentType(t.name||"html",t.publicId,t.systemId);case e.NodeType.Element:const n=function(e){let t=D[e.tagName]?D[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(t);let a;a=t.isSVG?r.createElementNS("http://www.w3.org/2000/svg",n):r.createElement(n);for(const e in t.attributes){if(!t.attributes.hasOwnProperty(e))continue;let i=t.attributes[e];if("option"!==n||"selected"!==e||!1!==i)if(i="boolean"==typeof i||"number"==typeof i?"":i,e.startsWith("rr_")){if("canvas"===n&&"rr_dataURL"===e){const e=document.createElement("img");e.src=i,e.onload=()=>{const t=a.getContext("2d");t&&t.drawImage(e,0,0,e.width,e.height)}}else if("img"===n&&"rr_dataURL"===e){const e=a;e.currentSrc.startsWith("data:")||(e.setAttribute("rrweb-original-src",t.attributes.src),e.src=i)}if("rr_width"===e)a.style.width=i;else if("rr_height"===e)a.style.height=i;else if("rr_mediaCurrentTime"===e)a.currentTime=t.attributes.rr_mediaCurrentTime;else if("rr_mediaState"===e)switch(i){case"played":a.play().catch((e=>console.warn("media playback error",e)));break;case"paused":a.pause()}}else{const c="textarea"===n&&"value"===e,l="style"===n&&"_cssText"===e;if(l&&o&&(i=A(i,s)),c||l){const e=r.createTextNode(i);for(const e of Array.from(a.childNodes))e.nodeType===a.TEXT_NODE&&a.removeChild(e);a.appendChild(e);continue}try{if(t.isSVG&&"xlink:href"===e)a.setAttributeNS("http://www.w3.org/1999/xlink",e,i);else if("onload"===e||"onclick"===e||"onmouse"===e.substring(0,7))a.setAttribute("_"+e,i);else{if("meta"===n&&"Content-Security-Policy"===t.attributes["http-equiv"]&&"content"===e){a.setAttribute("csp-content",i);continue}"link"===n&&"preload"===t.attributes.rel&&"script"===t.attributes.as||"link"===n&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&t.attributes.href.endsWith(".js")||("img"===n&&t.attributes.srcset&&t.attributes.rr_dataURL?a.setAttribute("rrweb-original-srcset",t.attributes.srcset):a.setAttribute(e,i))}}catch(e){}}}if(t.isShadowHost)if(a.shadowRoot)for(;a.shadowRoot.firstChild;)a.shadowRoot.removeChild(a.shadowRoot.firstChild);else a.attachShadow({mode:"open"});return a;case e.NodeType.Text:return r.createTextNode(t.isStyle&&o?A(t.textContent,s):t.textContent);case e.NodeType.CDATA:return r.createCDATASection(t.textContent);case e.NodeType.Comment:return r.createComment(t.textContent);default:return null}}function M(t,r){const{doc:o,map:s,skipChild:a=!1,hackCss:i=!0,afterAppend:c,cache:l}=r;let u=R(t,{doc:o,hackCss:i,cache:l});if(!u)return null;if(t.rootId&&console.assert(s[t.rootId]===o,"Target document should has the same root id."),t.type===e.NodeType.Document&&(o.close(),o.open(),"BackCompat"===t.compatMode&&t.childNodes&&t.childNodes[0].type!==e.NodeType.DocumentType&&(t.childNodes[0].type===e.NodeType.Element&&"xmlns"in t.childNodes[0].attributes&&"http://www.w3.org/1999/xhtml"===t.childNodes[0].attributes.xmlns?o.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):o.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),u=o),u.__sn=t,s[t.id]=u,(t.type===e.NodeType.Document||t.type===e.NodeType.Element)&&!a)for(const e of t.childNodes){const t=M(e,{doc:o,map:s,skipChild:!1,hackCss:i,afterAppend:c,cache:l});t?(e.isShadow&&n(u)&&u.shadowRoot?u.shadowRoot.appendChild(t):u.appendChild(t),c&&c(t)):console.warn("Failed to rebuild",e)}return u}return e.IGNORED_NODE=-2,e.addHoverClass=A,e.buildNodeWithSN=M,e.cleanupSnapshot=function(){i=1},e.createCache=function(){return{stylesWithHoverClass:new Map}},e.is2DCanvasBlank=a,e.isElement=n,e.isShadowRoot=r,e.maskInputValue=o,e.needMaskingText=C,e.rebuild=function(t,n){const{doc:r,onVisit:o,hackCss:s=!0,afterAppend:a,cache:i}=n,c={},l=M(t,{doc:r,map:c,skipChild:!1,hackCss:s,afterAppend:a,cache:i});return function(e,t){for(const r in e)e[r]&&(n=e[r],t(n));var n}(c,(t=>{o&&o(t),function(t){const n=t.__sn;if(n.type!==e.NodeType.Element)return;const r=t;for(const e in n.attributes){if(!n.attributes.hasOwnProperty(e)||!e.startsWith("rr_"))continue;const t=n.attributes[e];"rr_scrollLeft"===e&&(r.scrollLeft=t),"rr_scrollTop"===e&&(r.scrollTop=t)}}(t)})),[l,c]},e.serializeNodeWithId=x,e.snapshot=function(e,t){const{blockClass:n="rr-block",blockSelector:r=null,unblockSelector:o=null,maskTextClass:s="rr-mask",maskTextSelector:a=null,unmaskTextSelector:i=null,inlineStylesheet:c=!0,inlineImages:l=!1,recordCanvas:u=!1,maskInputSelector:p=null,unmaskInputSelector:m=null,maskAllInputs:f=!1,maskTextFn:d,maskInputFn:h,slimDOM:y=!1,dataURLOptions:g,preserveWhiteSpace:k,onSerialize:T,onIframeLoad:b,iframeLoadTimeout:S,keepIframeSrcFn:C=(()=>!1)}=t||{},N={};return[x(e,{doc:e,map:N,blockClass:n,blockSelector:r,unblockSelector:o,maskTextClass:s,maskTextSelector:a,unmaskTextSelector:i,skipChild:!1,inlineStylesheet:c,maskInputSelector:p,unmaskInputSelector:m,maskInputOptions:!0===f?{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===f?{password:!0}:f,maskTextFn:d,maskInputFn:h,slimDOMOptions:!0===y||"all"===y?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===y,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===y?{}:y,dataURLOptions:g,inlineImages:l,recordCanvas:u,preserveWhiteSpace:k,onSerialize:T,onIframeLoad:b,iframeLoadTimeout:S,keepIframeSrcFn:C}),N]},e.transformAttribute=S,e.visitSnapshot=function(t,n){!function t(r){n(r),r.type!==e.NodeType.Document&&r.type!==e.NodeType.Element||r.childNodes.forEach(t)}(t)},Object.defineProperty(e,"__esModule",{value:!0}),e}({}); | ||
//# sourceMappingURL=rrweb-snapshot.min.js.map |
@@ -15,9 +15,7 @@ var NodeType; | ||
function isShadowRoot(n) { | ||
var _a; | ||
var host = (_a = n) === null || _a === void 0 ? void 0 : _a.host; | ||
const host = n === null || n === void 0 ? void 0 : n.host; | ||
return Boolean(host && host.shadowRoot && host.shadowRoot === n); | ||
} | ||
function maskInputValue(_a) { | ||
var input = _a.input, maskInputSelector = _a.maskInputSelector, unmaskInputSelector = _a.unmaskInputSelector, maskInputOptions = _a.maskInputOptions, tagName = _a.tagName, type = _a.type, value = _a.value, maskInputFn = _a.maskInputFn; | ||
var text = value || ''; | ||
function maskInputValue({ input, maskInputSelector, unmaskInputSelector, maskInputOptions, tagName, type, value, maskInputFn, }) { | ||
let text = value || ''; | ||
if (unmaskInputSelector && input.matches(unmaskInputSelector)) { | ||
@@ -38,16 +36,16 @@ return text; | ||
} | ||
var ORIGINAL_ATTRIBUTE_NAME = '__rrweb_original__'; | ||
const ORIGINAL_ATTRIBUTE_NAME = '__rrweb_original__'; | ||
function is2DCanvasBlank(canvas) { | ||
var ctx = canvas.getContext('2d'); | ||
const ctx = canvas.getContext('2d'); | ||
if (!ctx) | ||
return true; | ||
var chunkSize = 50; | ||
for (var x = 0; x < canvas.width; x += chunkSize) { | ||
for (var y = 0; y < canvas.height; y += chunkSize) { | ||
var getImageData = ctx.getImageData; | ||
var originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData | ||
const chunkSize = 50; | ||
for (let x = 0; x < canvas.width; x += chunkSize) { | ||
for (let y = 0; y < canvas.height; y += chunkSize) { | ||
const getImageData = ctx.getImageData; | ||
const originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData | ||
? getImageData[ORIGINAL_ATTRIBUTE_NAME] | ||
: getImageData; | ||
var pixelBuffer = new Uint32Array(originalGetImageData.call(ctx, x, y, Math.min(chunkSize, canvas.width - x), Math.min(chunkSize, canvas.height - y)).data.buffer); | ||
if (pixelBuffer.some(function (pixel) { return pixel !== 0; })) | ||
const pixelBuffer = new Uint32Array(originalGetImageData.call(ctx, x, y, Math.min(chunkSize, canvas.width - x), Math.min(chunkSize, canvas.height - y)).data.buffer); | ||
if (pixelBuffer.some((pixel) => pixel !== 0)) | ||
return false; | ||
@@ -59,5 +57,5 @@ } | ||
var _id = 1; | ||
var tagNameRegex = new RegExp('[^a-z0-9-_:]'); | ||
var IGNORED_NODE = -2; | ||
let _id = 1; | ||
const tagNameRegex = new RegExp('[^a-z0-9-_:]'); | ||
const IGNORED_NODE = -2; | ||
function genId() { | ||
@@ -70,3 +68,3 @@ return _id++; | ||
} | ||
var processedTagName = element.tagName.toLowerCase().trim(); | ||
const processedTagName = element.tagName.toLowerCase().trim(); | ||
if (tagNameRegex.test(processedTagName)) { | ||
@@ -79,3 +77,3 @@ return 'div'; | ||
try { | ||
var rules = s.rules || s.cssRules; | ||
const rules = s.rules || s.cssRules; | ||
return rules ? Array.from(rules).map(getCssRuleString).join('') : null; | ||
@@ -88,3 +86,3 @@ } | ||
function getCssRuleString(rule) { | ||
var cssStringified = rule.cssText; | ||
let cssStringified = rule.cssText; | ||
if (isCSSImportRule(rule)) { | ||
@@ -105,3 +103,3 @@ try { | ||
? Array.from(sheet.cssRules) | ||
.map(function (rule) { return rule.cssText || ''; }) | ||
.map((rule) => rule.cssText || '') | ||
.join('') | ||
@@ -111,3 +109,3 @@ : ''; | ||
function extractOrigin(url) { | ||
var origin = ''; | ||
let origin = ''; | ||
if (url.indexOf('//') > -1) { | ||
@@ -122,11 +120,11 @@ origin = url.split('/').slice(0, 3).join('/'); | ||
} | ||
var canvasService; | ||
var canvasCtx; | ||
var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm; | ||
var RELATIVE_PATH = /^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/; | ||
var DATA_URI = /^(data:)([^,]*),(.*)/i; | ||
let canvasService; | ||
let canvasCtx; | ||
const URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm; | ||
const RELATIVE_PATH = /^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/; | ||
const DATA_URI = /^(data:)([^,]*),(.*)/i; | ||
function absoluteToStylesheet(cssText, href) { | ||
return (cssText || '').replace(URL_IN_CSS_REF, function (origin, quote1, path1, quote2, path2, path3) { | ||
var filePath = path1 || path2 || path3; | ||
var maybeQuote = quote1 || quote2 || ''; | ||
return (cssText || '').replace(URL_IN_CSS_REF, (origin, quote1, path1, quote2, path2, path3) => { | ||
const filePath = path1 || path2 || path3; | ||
const maybeQuote = quote1 || quote2 || ''; | ||
if (!filePath) { | ||
@@ -136,15 +134,14 @@ return origin; | ||
if (!RELATIVE_PATH.test(filePath)) { | ||
return "url(" + maybeQuote + filePath + maybeQuote + ")"; | ||
return `url(${maybeQuote}${filePath}${maybeQuote})`; | ||
} | ||
if (DATA_URI.test(filePath)) { | ||
return "url(" + maybeQuote + filePath + maybeQuote + ")"; | ||
return `url(${maybeQuote}${filePath}${maybeQuote})`; | ||
} | ||
if (filePath[0] === '/') { | ||
return "url(" + maybeQuote + (extractOrigin(href) + filePath) + maybeQuote + ")"; | ||
return `url(${maybeQuote}${extractOrigin(href) + filePath}${maybeQuote})`; | ||
} | ||
var stack = href.split('/'); | ||
var parts = filePath.split('/'); | ||
const stack = href.split('/'); | ||
const parts = filePath.split('/'); | ||
stack.pop(); | ||
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) { | ||
var part = parts_1[_i]; | ||
for (const part of parts) { | ||
if (part === '.') { | ||
@@ -160,7 +157,7 @@ continue; | ||
} | ||
return "url(" + maybeQuote + stack.join('/') + maybeQuote + ")"; | ||
return `url(${maybeQuote}${stack.join('/')}${maybeQuote})`; | ||
}); | ||
} | ||
var SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/; | ||
var SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/; | ||
const SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/; | ||
const SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/; | ||
function getAbsoluteSrcsetString(doc, attributeValue) { | ||
@@ -170,6 +167,6 @@ if (attributeValue.trim() === '') { | ||
} | ||
var pos = 0; | ||
let pos = 0; | ||
function collectCharacters(regEx) { | ||
var chars; | ||
var match = regEx.exec(attributeValue.substring(pos)); | ||
let chars; | ||
let match = regEx.exec(attributeValue.substring(pos)); | ||
if (match) { | ||
@@ -182,3 +179,3 @@ chars = match[0]; | ||
} | ||
var output = []; | ||
let output = []; | ||
while (true) { | ||
@@ -189,3 +186,3 @@ collectCharacters(SRCSET_COMMAS_OR_SPACES); | ||
} | ||
var url = collectCharacters(SRCSET_NOT_SPACES); | ||
let url = collectCharacters(SRCSET_NOT_SPACES); | ||
if (url.slice(-1) === ',') { | ||
@@ -196,7 +193,7 @@ url = absoluteToDoc(doc, url.substring(0, url.length - 1)); | ||
else { | ||
var descriptorsStr = ''; | ||
let descriptorsStr = ''; | ||
url = absoluteToDoc(doc, url); | ||
var inParens = false; | ||
let inParens = false; | ||
while (true) { | ||
var c = attributeValue.charAt(pos); | ||
let c = attributeValue.charAt(pos); | ||
if (c === '') { | ||
@@ -232,3 +229,3 @@ output.push((url + descriptorsStr).trim()); | ||
} | ||
var a = doc.createElement('a'); | ||
const a = doc.createElement('a'); | ||
a.href = attributeValue; | ||
@@ -241,3 +238,3 @@ return a.href; | ||
function getHref() { | ||
var a = document.createElement('a'); | ||
const a = document.createElement('a'); | ||
a.href = ''; | ||
@@ -281,4 +278,4 @@ return a.href; | ||
else { | ||
for (var eIndex = 0; eIndex < element.classList.length; eIndex++) { | ||
var className = element.classList[eIndex]; | ||
for (let eIndex = 0; eIndex < element.classList.length; eIndex++) { | ||
const className = element.classList[eIndex]; | ||
if (blockClass.test(className)) { | ||
@@ -311,4 +308,4 @@ return true; | ||
else { | ||
for (var eIndex = 0; eIndex < node.classList.length; eIndex++) { | ||
var className = node.classList[eIndex]; | ||
for (let eIndex = 0; eIndex < node.classList.length; eIndex++) { | ||
const className = node.classList[eIndex]; | ||
if (maskTextClass.test(className)) { | ||
@@ -332,8 +329,8 @@ return true; | ||
function onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) { | ||
var win = iframeEl.contentWindow; | ||
const win = iframeEl.contentWindow; | ||
if (!win) { | ||
return; | ||
} | ||
var fired = false; | ||
var readyState; | ||
let fired = false; | ||
let readyState; | ||
try { | ||
@@ -346,3 +343,3 @@ readyState = win.document.readyState; | ||
if (readyState !== 'complete') { | ||
var timer_1 = setTimeout(function () { | ||
const timer = setTimeout(() => { | ||
if (!fired) { | ||
@@ -353,4 +350,4 @@ listener(); | ||
}, iframeLoadTimeout); | ||
iframeEl.addEventListener('load', function () { | ||
clearTimeout(timer_1); | ||
iframeEl.addEventListener('load', () => { | ||
clearTimeout(timer); | ||
fired = true; | ||
@@ -361,3 +358,3 @@ listener(); | ||
} | ||
var blankUrl = 'about:blank'; | ||
const blankUrl = 'about:blank'; | ||
if (win.location.href !== blankUrl || | ||
@@ -373,6 +370,6 @@ iframeEl.src === blankUrl || | ||
var _a; | ||
var doc = options.doc, blockClass = options.blockClass, blockSelector = options.blockSelector, unblockSelector = options.unblockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, unmaskTextSelector = options.unmaskTextSelector, inlineStylesheet = options.inlineStylesheet, maskInputSelector = options.maskInputSelector, unmaskInputSelector = options.unmaskInputSelector, _b = options.maskInputOptions, maskInputOptions = _b === void 0 ? {} : _b, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, _c = options.dataURLOptions, dataURLOptions = _c === void 0 ? {} : _c, inlineImages = options.inlineImages, recordCanvas = options.recordCanvas, keepIframeSrcFn = options.keepIframeSrcFn; | ||
var rootId; | ||
const { doc, blockClass, blockSelector, unblockSelector, maskTextClass, maskTextSelector, unmaskTextSelector, inlineStylesheet, maskInputSelector, unmaskInputSelector, maskInputOptions = {}, maskTextFn, maskInputFn, dataURLOptions = {}, inlineImages, recordCanvas, keepIframeSrcFn, } = options; | ||
let rootId; | ||
if (doc.__sn) { | ||
var docId = doc.__sn.id; | ||
const docId = doc.__sn.id; | ||
rootId = docId === 1 ? undefined : docId; | ||
@@ -387,3 +384,3 @@ } | ||
compatMode: n.compatMode, | ||
rootId: rootId | ||
rootId, | ||
}; | ||
@@ -395,3 +392,3 @@ } | ||
childNodes: [], | ||
rootId: rootId | ||
rootId, | ||
}; | ||
@@ -405,17 +402,16 @@ } | ||
systemId: n.systemId, | ||
rootId: rootId | ||
rootId, | ||
}; | ||
case n.ELEMENT_NODE: | ||
var needBlock = _isBlockedElement(n, blockClass, blockSelector, unblockSelector); | ||
var tagName = getValidTagName(n); | ||
var attributes_1 = {}; | ||
for (var _i = 0, _d = Array.from(n.attributes); _i < _d.length; _i++) { | ||
var _e = _d[_i], name_1 = _e.name, value = _e.value; | ||
attributes_1[name_1] = transformAttribute(doc, tagName, name_1, value); | ||
const needBlock = _isBlockedElement(n, blockClass, blockSelector, unblockSelector); | ||
const tagName = getValidTagName(n); | ||
let attributes = {}; | ||
for (const { name, value } of Array.from(n.attributes)) { | ||
attributes[name] = transformAttribute(doc, tagName, name, value); | ||
} | ||
if (tagName === 'link' && inlineStylesheet) { | ||
var stylesheet = Array.from(doc.styleSheets).find(function (s) { | ||
const stylesheet = Array.from(doc.styleSheets).find((s) => { | ||
return s.href === n.href; | ||
}); | ||
var cssText = null; | ||
let cssText = null; | ||
if (stylesheet) { | ||
@@ -425,5 +421,5 @@ cssText = getCssRulesString(stylesheet); | ||
if (cssText) { | ||
delete attributes_1.rel; | ||
delete attributes_1.href; | ||
attributes_1._cssText = absoluteToStylesheet(cssText, stylesheet.href); | ||
delete attributes.rel; | ||
delete attributes.href; | ||
attributes._cssText = absoluteToStylesheet(cssText, stylesheet.href); | ||
} | ||
@@ -436,5 +432,5 @@ } | ||
'').trim().length) { | ||
var cssText = getCssRulesString(n.sheet); | ||
const cssText = getCssRulesString(n.sheet); | ||
if (cssText) { | ||
attributes_1._cssText = absoluteToStylesheet(cssText, getHref()); | ||
attributes._cssText = absoluteToStylesheet(cssText, getHref()); | ||
} | ||
@@ -445,21 +441,21 @@ } | ||
tagName === 'select') { | ||
var value = n.value; | ||
if (attributes_1.type !== 'radio' && | ||
attributes_1.type !== 'checkbox' && | ||
attributes_1.type !== 'submit' && | ||
attributes_1.type !== 'button' && | ||
const value = n.value; | ||
if (attributes.type !== 'radio' && | ||
attributes.type !== 'checkbox' && | ||
attributes.type !== 'submit' && | ||
attributes.type !== 'button' && | ||
value) { | ||
attributes_1.value = maskInputValue({ | ||
attributes.value = maskInputValue({ | ||
input: n, | ||
type: attributes_1.type, | ||
tagName: tagName, | ||
value: value, | ||
maskInputSelector: maskInputSelector, | ||
unmaskInputSelector: unmaskInputSelector, | ||
maskInputOptions: maskInputOptions, | ||
maskInputFn: maskInputFn | ||
type: attributes.type, | ||
tagName, | ||
value, | ||
maskInputSelector, | ||
unmaskInputSelector, | ||
maskInputOptions, | ||
maskInputFn, | ||
}); | ||
} | ||
else if (n.checked) { | ||
attributes_1.checked = n.checked; | ||
attributes.checked = n.checked; | ||
} | ||
@@ -469,6 +465,6 @@ } | ||
if (n.selected && !maskInputOptions['select']) { | ||
attributes_1.selected = true; | ||
attributes.selected = true; | ||
} | ||
else { | ||
delete attributes_1.selected; | ||
delete attributes.selected; | ||
} | ||
@@ -479,13 +475,13 @@ } | ||
if (!is2DCanvasBlank(n)) { | ||
attributes_1.rr_dataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality); | ||
attributes.rr_dataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality); | ||
} | ||
} | ||
else if (!('__context' in n)) { | ||
var canvasDataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality); | ||
var blankCanvas = document.createElement('canvas'); | ||
const canvasDataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality); | ||
const blankCanvas = document.createElement('canvas'); | ||
blankCanvas.width = n.width; | ||
blankCanvas.height = n.height; | ||
var blankCanvasDataURL = blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality); | ||
const blankCanvasDataURL = blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality); | ||
if (canvasDataURL !== blankCanvasDataURL) { | ||
attributes_1.rr_dataURL = canvasDataURL; | ||
attributes.rr_dataURL = canvasDataURL; | ||
} | ||
@@ -499,64 +495,64 @@ } | ||
} | ||
var image_1 = n; | ||
var oldValue_1 = image_1.crossOrigin; | ||
image_1.crossOrigin = 'anonymous'; | ||
var recordInlineImage = function () { | ||
const image = n; | ||
const oldValue = image.crossOrigin; | ||
image.crossOrigin = 'anonymous'; | ||
const recordInlineImage = () => { | ||
try { | ||
canvasService.width = image_1.naturalWidth; | ||
canvasService.height = image_1.naturalHeight; | ||
canvasCtx.drawImage(image_1, 0, 0); | ||
attributes_1.rr_dataURL = canvasService.toDataURL(dataURLOptions.type, dataURLOptions.quality); | ||
canvasService.width = image.naturalWidth; | ||
canvasService.height = image.naturalHeight; | ||
canvasCtx.drawImage(image, 0, 0); | ||
attributes.rr_dataURL = canvasService.toDataURL(dataURLOptions.type, dataURLOptions.quality); | ||
} | ||
catch (err) { | ||
console.warn("Cannot inline img src=" + image_1.currentSrc + "! Error: " + err); | ||
console.warn(`Cannot inline img src=${image.currentSrc}! Error: ${err}`); | ||
} | ||
oldValue_1 | ||
? (attributes_1.crossOrigin = oldValue_1) | ||
: delete attributes_1.crossOrigin; | ||
oldValue | ||
? (attributes.crossOrigin = oldValue) | ||
: delete attributes.crossOrigin; | ||
}; | ||
if (image_1.complete && image_1.naturalWidth !== 0) | ||
if (image.complete && image.naturalWidth !== 0) | ||
recordInlineImage(); | ||
else | ||
image_1.onload = recordInlineImage; | ||
image.onload = recordInlineImage; | ||
} | ||
if (tagName === 'audio' || tagName === 'video') { | ||
attributes_1.rr_mediaState = n.paused | ||
attributes.rr_mediaState = n.paused | ||
? 'paused' | ||
: 'played'; | ||
attributes_1.rr_mediaCurrentTime = n.currentTime; | ||
attributes.rr_mediaCurrentTime = n.currentTime; | ||
} | ||
if (n.scrollLeft) { | ||
attributes_1.rr_scrollLeft = n.scrollLeft; | ||
attributes.rr_scrollLeft = n.scrollLeft; | ||
} | ||
if (n.scrollTop) { | ||
attributes_1.rr_scrollTop = n.scrollTop; | ||
attributes.rr_scrollTop = n.scrollTop; | ||
} | ||
if (needBlock) { | ||
var _f = n.getBoundingClientRect(), width = _f.width, height = _f.height; | ||
attributes_1 = { | ||
"class": attributes_1["class"], | ||
rr_width: width + "px", | ||
rr_height: height + "px" | ||
const { width, height } = n.getBoundingClientRect(); | ||
attributes = { | ||
class: attributes.class, | ||
rr_width: `${width}px`, | ||
rr_height: `${height}px`, | ||
}; | ||
} | ||
if (tagName === 'iframe' && !keepIframeSrcFn(attributes_1.src)) { | ||
if (tagName === 'iframe' && !keepIframeSrcFn(attributes.src)) { | ||
if (!n.contentDocument) { | ||
attributes_1.rr_src = attributes_1.src; | ||
attributes.rr_src = attributes.src; | ||
} | ||
delete attributes_1.src; | ||
delete attributes.src; | ||
} | ||
return { | ||
type: NodeType.Element, | ||
tagName: tagName, | ||
attributes: attributes_1, | ||
tagName, | ||
attributes, | ||
childNodes: [], | ||
isSVG: isSVGElement(n) || undefined, | ||
needBlock: needBlock, | ||
rootId: rootId | ||
needBlock, | ||
rootId, | ||
}; | ||
case n.TEXT_NODE: | ||
var parentTagName = n.parentNode && n.parentNode.tagName; | ||
var textContent = n.textContent; | ||
var isStyle = parentTagName === 'STYLE' ? true : undefined; | ||
var isScript = parentTagName === 'SCRIPT' ? true : undefined; | ||
const parentTagName = n.parentNode && n.parentNode.tagName; | ||
let textContent = n.textContent; | ||
const isStyle = parentTagName === 'STYLE' ? true : undefined; | ||
const isScript = parentTagName === 'SCRIPT' ? true : undefined; | ||
if (isStyle && textContent) { | ||
@@ -571,3 +567,3 @@ try { | ||
catch (err) { | ||
console.warn("Cannot get CSS styles from text's parentNode. Error: " + err, n); | ||
console.warn(`Cannot get CSS styles from text's parentNode. Error: ${err}`, n); | ||
} | ||
@@ -590,4 +586,4 @@ textContent = absoluteToStylesheet(textContent, getHref()); | ||
textContent: textContent || '', | ||
isStyle: isStyle, | ||
rootId: rootId | ||
isStyle, | ||
rootId, | ||
}; | ||
@@ -598,3 +594,3 @@ case n.CDATA_SECTION_NODE: | ||
textContent: '', | ||
rootId: rootId | ||
rootId, | ||
}; | ||
@@ -605,3 +601,3 @@ case n.COMMENT_NODE: | ||
textContent: n.textContent || '', | ||
rootId: rootId | ||
rootId, | ||
}; | ||
@@ -692,22 +688,22 @@ default: | ||
function serializeNodeWithId(n, options) { | ||
var doc = options.doc, map = options.map, blockClass = options.blockClass, blockSelector = options.blockSelector, unblockSelector = options.unblockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, unmaskTextSelector = options.unmaskTextSelector, _a = options.skipChild, skipChild = _a === void 0 ? false : _a, _b = options.inlineStylesheet, inlineStylesheet = _b === void 0 ? true : _b, maskInputSelector = options.maskInputSelector, unmaskInputSelector = options.unmaskInputSelector, _c = options.maskInputOptions, maskInputOptions = _c === void 0 ? {} : _c, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, slimDOMOptions = options.slimDOMOptions, _d = options.dataURLOptions, dataURLOptions = _d === void 0 ? {} : _d, _e = options.inlineImages, inlineImages = _e === void 0 ? false : _e, _f = options.recordCanvas, recordCanvas = _f === void 0 ? false : _f, onSerialize = options.onSerialize, onIframeLoad = options.onIframeLoad, _g = options.iframeLoadTimeout, iframeLoadTimeout = _g === void 0 ? 5000 : _g, _h = options.keepIframeSrcFn, keepIframeSrcFn = _h === void 0 ? function () { return false; } : _h; | ||
var _j = options.preserveWhiteSpace, preserveWhiteSpace = _j === void 0 ? true : _j; | ||
var _serializedNode = serializeNode(n, { | ||
doc: doc, | ||
blockClass: blockClass, | ||
blockSelector: blockSelector, | ||
unblockSelector: unblockSelector, | ||
maskTextClass: maskTextClass, | ||
maskTextSelector: maskTextSelector, | ||
unmaskTextSelector: unmaskTextSelector, | ||
inlineStylesheet: inlineStylesheet, | ||
maskInputSelector: maskInputSelector, | ||
unmaskInputSelector: unmaskInputSelector, | ||
maskInputOptions: maskInputOptions, | ||
maskTextFn: maskTextFn, | ||
maskInputFn: maskInputFn, | ||
dataURLOptions: dataURLOptions, | ||
inlineImages: inlineImages, | ||
recordCanvas: recordCanvas, | ||
keepIframeSrcFn: keepIframeSrcFn | ||
const { doc, map, blockClass, blockSelector, unblockSelector, maskTextClass, maskTextSelector, unmaskTextSelector, skipChild = false, inlineStylesheet = true, maskInputSelector, unmaskInputSelector, maskInputOptions = {}, maskTextFn, maskInputFn, slimDOMOptions, dataURLOptions = {}, inlineImages = false, recordCanvas = false, onSerialize, onIframeLoad, iframeLoadTimeout = 5000, keepIframeSrcFn = () => false, } = options; | ||
let { preserveWhiteSpace = true } = options; | ||
const _serializedNode = serializeNode(n, { | ||
doc, | ||
blockClass, | ||
blockSelector, | ||
unblockSelector, | ||
maskTextClass, | ||
maskTextSelector, | ||
unmaskTextSelector, | ||
inlineStylesheet, | ||
maskInputSelector, | ||
unmaskInputSelector, | ||
maskInputOptions, | ||
maskTextFn, | ||
maskInputFn, | ||
dataURLOptions, | ||
inlineImages, | ||
recordCanvas, | ||
keepIframeSrcFn, | ||
}); | ||
@@ -718,3 +714,3 @@ if (!_serializedNode) { | ||
} | ||
var id; | ||
let id; | ||
if ('__sn' in n) { | ||
@@ -733,3 +729,3 @@ id = n.__sn.id; | ||
} | ||
var serializedNode = Object.assign(_serializedNode, { id: id }); | ||
const serializedNode = Object.assign(_serializedNode, { id }); | ||
n.__sn = serializedNode; | ||
@@ -743,3 +739,3 @@ if (id === IGNORED_NODE) { | ||
} | ||
var recordChild = !skipChild; | ||
let recordChild = !skipChild; | ||
if (serializedNode.type === NodeType.Element) { | ||
@@ -759,31 +755,30 @@ recordChild = recordChild && !serializedNode.needBlock; | ||
} | ||
var bypassOptions = { | ||
doc: doc, | ||
map: map, | ||
blockClass: blockClass, | ||
blockSelector: blockSelector, | ||
unblockSelector: unblockSelector, | ||
maskTextClass: maskTextClass, | ||
maskTextSelector: maskTextSelector, | ||
unmaskTextSelector: unmaskTextSelector, | ||
skipChild: skipChild, | ||
inlineStylesheet: inlineStylesheet, | ||
maskInputSelector: maskInputSelector, | ||
unmaskInputSelector: unmaskInputSelector, | ||
maskInputOptions: maskInputOptions, | ||
maskTextFn: maskTextFn, | ||
maskInputFn: maskInputFn, | ||
slimDOMOptions: slimDOMOptions, | ||
dataURLOptions: dataURLOptions, | ||
inlineImages: inlineImages, | ||
recordCanvas: recordCanvas, | ||
preserveWhiteSpace: preserveWhiteSpace, | ||
onSerialize: onSerialize, | ||
onIframeLoad: onIframeLoad, | ||
iframeLoadTimeout: iframeLoadTimeout, | ||
keepIframeSrcFn: keepIframeSrcFn | ||
const bypassOptions = { | ||
doc, | ||
map, | ||
blockClass, | ||
blockSelector, | ||
unblockSelector, | ||
maskTextClass, | ||
maskTextSelector, | ||
unmaskTextSelector, | ||
skipChild, | ||
inlineStylesheet, | ||
maskInputSelector, | ||
unmaskInputSelector, | ||
maskInputOptions, | ||
maskTextFn, | ||
maskInputFn, | ||
slimDOMOptions, | ||
dataURLOptions, | ||
inlineImages, | ||
recordCanvas, | ||
preserveWhiteSpace, | ||
onSerialize, | ||
onIframeLoad, | ||
iframeLoadTimeout, | ||
keepIframeSrcFn, | ||
}; | ||
for (var _i = 0, _k = Array.from(n.childNodes); _i < _k.length; _i++) { | ||
var childN = _k[_i]; | ||
var serializedChildNode = serializeNodeWithId(childN, bypassOptions); | ||
for (const childN of Array.from(n.childNodes)) { | ||
const serializedChildNode = serializeNodeWithId(childN, bypassOptions); | ||
if (serializedChildNode) { | ||
@@ -794,5 +789,4 @@ serializedNode.childNodes.push(serializedChildNode); | ||
if (isElement(n) && n.shadowRoot) { | ||
for (var _l = 0, _m = Array.from(n.shadowRoot.childNodes); _l < _m.length; _l++) { | ||
var childN = _m[_l]; | ||
var serializedChildNode = serializeNodeWithId(childN, bypassOptions); | ||
for (const childN of Array.from(n.shadowRoot.childNodes)) { | ||
const serializedChildNode = serializeNodeWithId(childN, bypassOptions); | ||
if (serializedChildNode) { | ||
@@ -810,30 +804,30 @@ serializedChildNode.isShadow = true; | ||
serializedNode.tagName === 'iframe') { | ||
onceIframeLoaded(n, function () { | ||
var iframeDoc = n.contentDocument; | ||
onceIframeLoaded(n, () => { | ||
const iframeDoc = n.contentDocument; | ||
if (iframeDoc && onIframeLoad) { | ||
var serializedIframeNode = serializeNodeWithId(iframeDoc, { | ||
const serializedIframeNode = serializeNodeWithId(iframeDoc, { | ||
doc: iframeDoc, | ||
map: map, | ||
blockClass: blockClass, | ||
blockSelector: blockSelector, | ||
unblockSelector: unblockSelector, | ||
maskTextClass: maskTextClass, | ||
maskTextSelector: maskTextSelector, | ||
unmaskTextSelector: unmaskTextSelector, | ||
map, | ||
blockClass, | ||
blockSelector, | ||
unblockSelector, | ||
maskTextClass, | ||
maskTextSelector, | ||
unmaskTextSelector, | ||
skipChild: false, | ||
inlineStylesheet: inlineStylesheet, | ||
maskInputSelector: maskInputSelector, | ||
unmaskInputSelector: unmaskInputSelector, | ||
maskInputOptions: maskInputOptions, | ||
maskTextFn: maskTextFn, | ||
maskInputFn: maskInputFn, | ||
slimDOMOptions: slimDOMOptions, | ||
dataURLOptions: dataURLOptions, | ||
inlineImages: inlineImages, | ||
recordCanvas: recordCanvas, | ||
preserveWhiteSpace: preserveWhiteSpace, | ||
onSerialize: onSerialize, | ||
onIframeLoad: onIframeLoad, | ||
iframeLoadTimeout: iframeLoadTimeout, | ||
keepIframeSrcFn: keepIframeSrcFn | ||
inlineStylesheet, | ||
maskInputSelector, | ||
unmaskInputSelector, | ||
maskInputOptions, | ||
maskTextFn, | ||
maskInputFn, | ||
slimDOMOptions, | ||
dataURLOptions, | ||
inlineImages, | ||
recordCanvas, | ||
preserveWhiteSpace, | ||
onSerialize, | ||
onIframeLoad, | ||
iframeLoadTimeout, | ||
keepIframeSrcFn, | ||
}); | ||
@@ -849,5 +843,5 @@ if (serializedIframeNode) { | ||
function snapshot(n, options) { | ||
var _a = options || {}, _b = _a.blockClass, blockClass = _b === void 0 ? 'rr-block' : _b, _c = _a.blockSelector, blockSelector = _c === void 0 ? null : _c, _d = _a.unblockSelector, unblockSelector = _d === void 0 ? null : _d, _e = _a.maskTextClass, maskTextClass = _e === void 0 ? 'rr-mask' : _e, _f = _a.maskTextSelector, maskTextSelector = _f === void 0 ? null : _f, _g = _a.unmaskTextSelector, unmaskTextSelector = _g === void 0 ? null : _g, _h = _a.inlineStylesheet, inlineStylesheet = _h === void 0 ? true : _h, _j = _a.inlineImages, inlineImages = _j === void 0 ? false : _j, _k = _a.recordCanvas, recordCanvas = _k === void 0 ? false : _k, _l = _a.maskInputSelector, maskInputSelector = _l === void 0 ? null : _l, _m = _a.unmaskInputSelector, unmaskInputSelector = _m === void 0 ? null : _m, _o = _a.maskAllInputs, maskAllInputs = _o === void 0 ? false : _o, maskTextFn = _a.maskTextFn, maskInputFn = _a.maskInputFn, _p = _a.slimDOM, slimDOM = _p === void 0 ? false : _p, dataURLOptions = _a.dataURLOptions, preserveWhiteSpace = _a.preserveWhiteSpace, onSerialize = _a.onSerialize, onIframeLoad = _a.onIframeLoad, iframeLoadTimeout = _a.iframeLoadTimeout, _q = _a.keepIframeSrcFn, keepIframeSrcFn = _q === void 0 ? function () { return false; } : _q; | ||
var idNodeMap = {}; | ||
var maskInputOptions = maskAllInputs === true | ||
const { blockClass = 'rr-block', blockSelector = null, unblockSelector = null, maskTextClass = 'rr-mask', maskTextSelector = null, unmaskTextSelector = null, inlineStylesheet = true, inlineImages = false, recordCanvas = false, maskInputSelector = null, unmaskInputSelector = null, maskAllInputs = false, maskTextFn, maskInputFn, slimDOM = false, dataURLOptions, preserveWhiteSpace, onSerialize, onIframeLoad, iframeLoadTimeout, keepIframeSrcFn = () => false, } = options || {}; | ||
const idNodeMap = {}; | ||
const maskInputOptions = maskAllInputs === true | ||
? { | ||
@@ -869,10 +863,10 @@ color: true, | ||
select: true, | ||
password: true | ||
password: true, | ||
} | ||
: maskAllInputs === false | ||
? { | ||
password: true | ||
password: true, | ||
} | ||
: maskAllInputs; | ||
var slimDOMOptions = slimDOM === true || slimDOM === 'all' | ||
const slimDOMOptions = slimDOM === true || slimDOM === 'all' | ||
? | ||
@@ -889,3 +883,3 @@ { | ||
headMetaAuthorship: true, | ||
headMetaVerification: true | ||
headMetaVerification: true, | ||
} | ||
@@ -899,24 +893,24 @@ : slimDOM === false | ||
map: idNodeMap, | ||
blockClass: blockClass, | ||
blockSelector: blockSelector, | ||
unblockSelector: unblockSelector, | ||
maskTextClass: maskTextClass, | ||
maskTextSelector: maskTextSelector, | ||
unmaskTextSelector: unmaskTextSelector, | ||
blockClass, | ||
blockSelector, | ||
unblockSelector, | ||
maskTextClass, | ||
maskTextSelector, | ||
unmaskTextSelector, | ||
skipChild: false, | ||
inlineStylesheet: inlineStylesheet, | ||
maskInputSelector: maskInputSelector, | ||
unmaskInputSelector: unmaskInputSelector, | ||
maskInputOptions: maskInputOptions, | ||
maskTextFn: maskTextFn, | ||
maskInputFn: maskInputFn, | ||
slimDOMOptions: slimDOMOptions, | ||
dataURLOptions: dataURLOptions, | ||
inlineImages: inlineImages, | ||
recordCanvas: recordCanvas, | ||
preserveWhiteSpace: preserveWhiteSpace, | ||
onSerialize: onSerialize, | ||
onIframeLoad: onIframeLoad, | ||
iframeLoadTimeout: iframeLoadTimeout, | ||
keepIframeSrcFn: keepIframeSrcFn | ||
inlineStylesheet, | ||
maskInputSelector, | ||
unmaskInputSelector, | ||
maskInputOptions, | ||
maskTextFn, | ||
maskInputFn, | ||
slimDOMOptions, | ||
dataURLOptions, | ||
inlineImages, | ||
recordCanvas, | ||
preserveWhiteSpace, | ||
onSerialize, | ||
onIframeLoad, | ||
iframeLoadTimeout, | ||
keepIframeSrcFn, | ||
}), | ||
@@ -940,18 +934,17 @@ idNodeMap, | ||
var commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g; | ||
function parse(css, options) { | ||
if (options === void 0) { options = {}; } | ||
var lineno = 1; | ||
var column = 1; | ||
const commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g; | ||
function parse(css, options = {}) { | ||
let lineno = 1; | ||
let column = 1; | ||
function updatePosition(str) { | ||
var lines = str.match(/\n/g); | ||
const lines = str.match(/\n/g); | ||
if (lines) { | ||
lineno += lines.length; | ||
} | ||
var i = str.lastIndexOf('\n'); | ||
let i = str.lastIndexOf('\n'); | ||
column = i === -1 ? column + str.length : str.length - i; | ||
} | ||
function position() { | ||
var start = { line: lineno, column: column }; | ||
return function (node) { | ||
const start = { line: lineno, column }; | ||
return (node) => { | ||
node.position = new Position(start); | ||
@@ -962,14 +955,13 @@ whitespace(); | ||
} | ||
var Position = (function () { | ||
function Position(start) { | ||
class Position { | ||
constructor(start) { | ||
this.start = start; | ||
this.end = { line: lineno, column: column }; | ||
this.end = { line: lineno, column }; | ||
this.source = options.source; | ||
} | ||
return Position; | ||
}()); | ||
} | ||
Position.prototype.content = css; | ||
var errorsList = []; | ||
const errorsList = []; | ||
function error(msg) { | ||
var err = new Error(options.source + ':' + lineno + ':' + column + ': ' + msg); | ||
const err = new Error(options.source + ':' + lineno + ':' + column + ': ' + msg); | ||
err.reason = msg; | ||
@@ -988,3 +980,3 @@ err.filename = options.source; | ||
function stylesheet() { | ||
var rulesList = rules(); | ||
const rulesList = rules(); | ||
return { | ||
@@ -995,4 +987,4 @@ type: 'stylesheet', | ||
rules: rulesList, | ||
parsingErrors: errorsList | ||
} | ||
parsingErrors: errorsList, | ||
}, | ||
}; | ||
@@ -1007,4 +999,4 @@ } | ||
function rules() { | ||
var node; | ||
var rules = []; | ||
let node; | ||
const rules = []; | ||
whitespace(); | ||
@@ -1021,7 +1013,7 @@ comments(rules); | ||
function match(re) { | ||
var m = re.exec(css); | ||
const m = re.exec(css); | ||
if (!m) { | ||
return; | ||
} | ||
var str = m[0]; | ||
const str = m[0]; | ||
updatePosition(str); | ||
@@ -1034,5 +1026,4 @@ css = css.slice(str.length); | ||
} | ||
function comments(rules) { | ||
if (rules === void 0) { rules = []; } | ||
var c; | ||
function comments(rules = []) { | ||
let c; | ||
while ((c = comment())) { | ||
@@ -1047,7 +1038,7 @@ if (c !== false) { | ||
function comment() { | ||
var pos = position(); | ||
const pos = position(); | ||
if ('/' !== css.charAt(0) || '*' !== css.charAt(1)) { | ||
return; | ||
} | ||
var i = 2; | ||
let i = 2; | ||
while ('' !== css.charAt(i) && | ||
@@ -1061,3 +1052,3 @@ ('*' !== css.charAt(i) || '/' !== css.charAt(i + 1))) { | ||
} | ||
var str = css.slice(2, i - 2); | ||
const str = css.slice(2, i - 2); | ||
column += 2; | ||
@@ -1069,7 +1060,7 @@ updatePosition(str); | ||
type: 'comment', | ||
comment: str | ||
comment: str, | ||
}); | ||
} | ||
function selector() { | ||
var m = match(/^([^{]+)/); | ||
const m = match(/^([^{]+)/); | ||
if (!m) { | ||
@@ -1080,7 +1071,7 @@ return; | ||
.replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, '') | ||
.replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, function (m) { | ||
.replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, (m) => { | ||
return m.replace(/,/g, '\u200C'); | ||
}) | ||
.split(/\s*(?![^(]*\)),\s*/) | ||
.map(function (s) { | ||
.map((s) => { | ||
return s.replace(/\u200C/g, ','); | ||
@@ -1090,16 +1081,16 @@ }); | ||
function declaration() { | ||
var pos = position(); | ||
var propMatch = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/); | ||
const pos = position(); | ||
let propMatch = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/); | ||
if (!propMatch) { | ||
return; | ||
} | ||
var prop = trim(propMatch[0]); | ||
const prop = trim(propMatch[0]); | ||
if (!match(/^:\s*/)) { | ||
return error("property missing ':'"); | ||
return error(`property missing ':'`); | ||
} | ||
var val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/); | ||
var ret = pos({ | ||
const val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/); | ||
const ret = pos({ | ||
type: 'declaration', | ||
property: prop.replace(commentre, ''), | ||
value: val ? trim(val[0]).replace(commentre, '') : '' | ||
value: val ? trim(val[0]).replace(commentre, '') : '', | ||
}); | ||
@@ -1110,8 +1101,8 @@ match(/^[;\s]*/); | ||
function declarations() { | ||
var decls = []; | ||
const decls = []; | ||
if (!open()) { | ||
return error("missing '{'"); | ||
return error(`missing '{'`); | ||
} | ||
comments(decls); | ||
var decl; | ||
let decl; | ||
while ((decl = declaration())) { | ||
@@ -1125,3 +1116,3 @@ if (decl !== false) { | ||
if (!close()) { | ||
return error("missing '}'"); | ||
return error(`missing '}'`); | ||
} | ||
@@ -1131,5 +1122,5 @@ return decls; | ||
function keyframe() { | ||
var m; | ||
var vals = []; | ||
var pos = position(); | ||
let m; | ||
const vals = []; | ||
const pos = position(); | ||
while ((m = match(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/))) { | ||
@@ -1145,12 +1136,12 @@ vals.push(m[1]); | ||
values: vals, | ||
declarations: declarations() | ||
declarations: declarations(), | ||
}); | ||
} | ||
function atkeyframes() { | ||
var pos = position(); | ||
var m = match(/^@([-\w]+)?keyframes\s*/); | ||
const pos = position(); | ||
let m = match(/^@([-\w]+)?keyframes\s*/); | ||
if (!m) { | ||
return; | ||
} | ||
var vendor = m[1]; | ||
const vendor = m[1]; | ||
m = match(/^([-\w]+)\s*/); | ||
@@ -1160,8 +1151,8 @@ if (!m) { | ||
} | ||
var name = m[1]; | ||
const name = m[1]; | ||
if (!open()) { | ||
return error("@keyframes missing '{'"); | ||
return error(`@keyframes missing '{'`); | ||
} | ||
var frame; | ||
var frames = comments(); | ||
let frame; | ||
let frames = comments(); | ||
while ((frame = keyframe())) { | ||
@@ -1172,34 +1163,34 @@ frames.push(frame); | ||
if (!close()) { | ||
return error("@keyframes missing '}'"); | ||
return error(`@keyframes missing '}'`); | ||
} | ||
return pos({ | ||
type: 'keyframes', | ||
name: name, | ||
vendor: vendor, | ||
keyframes: frames | ||
name, | ||
vendor, | ||
keyframes: frames, | ||
}); | ||
} | ||
function atsupports() { | ||
var pos = position(); | ||
var m = match(/^@supports *([^{]+)/); | ||
const pos = position(); | ||
const m = match(/^@supports *([^{]+)/); | ||
if (!m) { | ||
return; | ||
} | ||
var supports = trim(m[1]); | ||
const supports = trim(m[1]); | ||
if (!open()) { | ||
return error("@supports missing '{'"); | ||
return error(`@supports missing '{'`); | ||
} | ||
var style = comments().concat(rules()); | ||
const style = comments().concat(rules()); | ||
if (!close()) { | ||
return error("@supports missing '}'"); | ||
return error(`@supports missing '}'`); | ||
} | ||
return pos({ | ||
type: 'supports', | ||
supports: supports, | ||
rules: style | ||
supports, | ||
rules: style, | ||
}); | ||
} | ||
function athost() { | ||
var pos = position(); | ||
var m = match(/^@host\s*/); | ||
const pos = position(); | ||
const m = match(/^@host\s*/); | ||
if (!m) { | ||
@@ -1209,36 +1200,36 @@ return; | ||
if (!open()) { | ||
return error("@host missing '{'"); | ||
return error(`@host missing '{'`); | ||
} | ||
var style = comments().concat(rules()); | ||
const style = comments().concat(rules()); | ||
if (!close()) { | ||
return error("@host missing '}'"); | ||
return error(`@host missing '}'`); | ||
} | ||
return pos({ | ||
type: 'host', | ||
rules: style | ||
rules: style, | ||
}); | ||
} | ||
function atmedia() { | ||
var pos = position(); | ||
var m = match(/^@media *([^{]+)/); | ||
const pos = position(); | ||
const m = match(/^@media *([^{]+)/); | ||
if (!m) { | ||
return; | ||
} | ||
var media = trim(m[1]); | ||
const media = trim(m[1]); | ||
if (!open()) { | ||
return error("@media missing '{'"); | ||
return error(`@media missing '{'`); | ||
} | ||
var style = comments().concat(rules()); | ||
const style = comments().concat(rules()); | ||
if (!close()) { | ||
return error("@media missing '}'"); | ||
return error(`@media missing '}'`); | ||
} | ||
return pos({ | ||
type: 'media', | ||
media: media, | ||
rules: style | ||
media, | ||
rules: style, | ||
}); | ||
} | ||
function atcustommedia() { | ||
var pos = position(); | ||
var m = match(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/); | ||
const pos = position(); | ||
const m = match(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/); | ||
if (!m) { | ||
@@ -1250,17 +1241,17 @@ return; | ||
name: trim(m[1]), | ||
media: trim(m[2]) | ||
media: trim(m[2]), | ||
}); | ||
} | ||
function atpage() { | ||
var pos = position(); | ||
var m = match(/^@page */); | ||
const pos = position(); | ||
const m = match(/^@page */); | ||
if (!m) { | ||
return; | ||
} | ||
var sel = selector() || []; | ||
const sel = selector() || []; | ||
if (!open()) { | ||
return error("@page missing '{'"); | ||
return error(`@page missing '{'`); | ||
} | ||
var decls = comments(); | ||
var decl; | ||
let decls = comments(); | ||
let decl; | ||
while ((decl = declaration())) { | ||
@@ -1271,3 +1262,3 @@ decls.push(decl); | ||
if (!close()) { | ||
return error("@page missing '}'"); | ||
return error(`@page missing '}'`); | ||
} | ||
@@ -1277,19 +1268,19 @@ return pos({ | ||
selectors: sel, | ||
declarations: decls | ||
declarations: decls, | ||
}); | ||
} | ||
function atdocument() { | ||
var pos = position(); | ||
var m = match(/^@([-\w]+)?document *([^{]+)/); | ||
const pos = position(); | ||
const m = match(/^@([-\w]+)?document *([^{]+)/); | ||
if (!m) { | ||
return; | ||
} | ||
var vendor = trim(m[1]); | ||
var doc = trim(m[2]); | ||
const vendor = trim(m[1]); | ||
const doc = trim(m[2]); | ||
if (!open()) { | ||
return error("@document missing '{'"); | ||
return error(`@document missing '{'`); | ||
} | ||
var style = comments().concat(rules()); | ||
const style = comments().concat(rules()); | ||
if (!close()) { | ||
return error("@document missing '}'"); | ||
return error(`@document missing '}'`); | ||
} | ||
@@ -1299,9 +1290,9 @@ return pos({ | ||
document: doc, | ||
vendor: vendor, | ||
rules: style | ||
vendor, | ||
rules: style, | ||
}); | ||
} | ||
function atfontface() { | ||
var pos = position(); | ||
var m = match(/^@font-face\s*/); | ||
const pos = position(); | ||
const m = match(/^@font-face\s*/); | ||
if (!m) { | ||
@@ -1311,6 +1302,6 @@ return; | ||
if (!open()) { | ||
return error("@font-face missing '{'"); | ||
return error(`@font-face missing '{'`); | ||
} | ||
var decls = comments(); | ||
var decl; | ||
let decls = comments(); | ||
let decl; | ||
while ((decl = declaration())) { | ||
@@ -1321,21 +1312,21 @@ decls.push(decl); | ||
if (!close()) { | ||
return error("@font-face missing '}'"); | ||
return error(`@font-face missing '}'`); | ||
} | ||
return pos({ | ||
type: 'font-face', | ||
declarations: decls | ||
declarations: decls, | ||
}); | ||
} | ||
var atimport = _compileAtrule('import'); | ||
var atcharset = _compileAtrule('charset'); | ||
var atnamespace = _compileAtrule('namespace'); | ||
const atimport = _compileAtrule('import'); | ||
const atcharset = _compileAtrule('charset'); | ||
const atnamespace = _compileAtrule('namespace'); | ||
function _compileAtrule(name) { | ||
var re = new RegExp('^@' + name + '\\s*([^;]+);'); | ||
return function () { | ||
var pos = position(); | ||
var m = match(re); | ||
const re = new RegExp('^@' + name + '\\s*([^;]+);'); | ||
return () => { | ||
const pos = position(); | ||
const m = match(re); | ||
if (!m) { | ||
return; | ||
} | ||
var ret = { type: name }; | ||
const ret = { type: name }; | ||
ret[name] = m[1].trim(); | ||
@@ -1362,4 +1353,4 @@ return pos(ret); | ||
function rule() { | ||
var pos = position(); | ||
var sel = selector(); | ||
const pos = position(); | ||
const sel = selector(); | ||
if (!sel) { | ||
@@ -1372,3 +1363,3 @@ return error('selector missing'); | ||
selectors: sel, | ||
declarations: declarations() | ||
declarations: declarations(), | ||
}); | ||
@@ -1382,9 +1373,8 @@ } | ||
function addParent(obj, parent) { | ||
var isNode = obj && typeof obj.type === 'string'; | ||
var childParent = isNode ? obj : parent; | ||
for (var _i = 0, _a = Object.keys(obj); _i < _a.length; _i++) { | ||
var k = _a[_i]; | ||
var value = obj[k]; | ||
const isNode = obj && typeof obj.type === 'string'; | ||
const childParent = isNode ? obj : parent; | ||
for (const k of Object.keys(obj)) { | ||
const value = obj[k]; | ||
if (Array.isArray(value)) { | ||
value.forEach(function (v) { | ||
value.forEach((v) => { | ||
addParent(v, childParent); | ||
@@ -1402,3 +1392,3 @@ }); | ||
enumerable: false, | ||
value: parent || null | ||
value: parent || null, | ||
}); | ||
@@ -1409,3 +1399,3 @@ } | ||
var tagMap = { | ||
const tagMap = { | ||
script: 'noscript', | ||
@@ -1447,6 +1437,6 @@ altglyph: 'altGlyph', | ||
lineargradient: 'linearGradient', | ||
radialgradient: 'radialGradient' | ||
radialgradient: 'radialGradient', | ||
}; | ||
function getTagName(n) { | ||
var tagName = tagMap[n.tagName] ? tagMap[n.tagName] : n.tagName; | ||
let tagName = tagMap[n.tagName] ? tagMap[n.tagName] : n.tagName; | ||
if (tagName === 'link' && n.attributes._cssText) { | ||
@@ -1460,10 +1450,10 @@ tagName = 'style'; | ||
} | ||
var HOVER_SELECTOR = /([^\\]):hover/; | ||
var HOVER_SELECTOR_GLOBAL = new RegExp(HOVER_SELECTOR.source, 'g'); | ||
const HOVER_SELECTOR = /([^\\]):hover/; | ||
const HOVER_SELECTOR_GLOBAL = new RegExp(HOVER_SELECTOR.source, 'g'); | ||
function addHoverClass(cssText, cache) { | ||
var cachedStyle = cache === null || cache === void 0 ? void 0 : cache.stylesWithHoverClass.get(cssText); | ||
const cachedStyle = cache === null || cache === void 0 ? void 0 : cache.stylesWithHoverClass.get(cssText); | ||
if (cachedStyle) | ||
return cachedStyle; | ||
var ast = parse(cssText, { | ||
silent: true | ||
const ast = parse(cssText, { | ||
silent: true, | ||
}); | ||
@@ -1473,6 +1463,6 @@ if (!ast.stylesheet) { | ||
} | ||
var selectors = []; | ||
ast.stylesheet.rules.forEach(function (rule) { | ||
const selectors = []; | ||
ast.stylesheet.rules.forEach((rule) => { | ||
if ('selectors' in rule) { | ||
(rule.selectors || []).forEach(function (selector) { | ||
(rule.selectors || []).forEach((selector) => { | ||
if (HOVER_SELECTOR.test(selector)) { | ||
@@ -1487,12 +1477,12 @@ selectors.push(selector); | ||
} | ||
var selectorMatcher = new RegExp(selectors | ||
.filter(function (selector, index) { return selectors.indexOf(selector) === index; }) | ||
.sort(function (a, b) { return b.length - a.length; }) | ||
.map(function (selector) { | ||
const selectorMatcher = new RegExp(selectors | ||
.filter((selector, index) => selectors.indexOf(selector) === index) | ||
.sort((a, b) => b.length - a.length) | ||
.map((selector) => { | ||
return escapeRegExp(selector); | ||
}) | ||
.join('|'), 'g'); | ||
var result = cssText.replace(selectorMatcher, function (selector) { | ||
var newSelector = selector.replace(HOVER_SELECTOR_GLOBAL, '$1.\\:hover'); | ||
return selector + ", " + newSelector; | ||
const result = cssText.replace(selectorMatcher, (selector) => { | ||
const newSelector = selector.replace(HOVER_SELECTOR_GLOBAL, '$1.\\:hover'); | ||
return `${selector}, ${newSelector}`; | ||
}); | ||
@@ -1503,9 +1493,9 @@ cache === null || cache === void 0 ? void 0 : cache.stylesWithHoverClass.set(cssText, result); | ||
function createCache() { | ||
var stylesWithHoverClass = new Map(); | ||
const stylesWithHoverClass = new Map(); | ||
return { | ||
stylesWithHoverClass: stylesWithHoverClass | ||
stylesWithHoverClass, | ||
}; | ||
} | ||
function buildNode(n, options) { | ||
var doc = options.doc, hackCss = options.hackCss, cache = options.cache; | ||
const { doc, hackCss, cache } = options; | ||
switch (n.type) { | ||
@@ -1517,23 +1507,23 @@ case NodeType.Document: | ||
case NodeType.Element: | ||
var tagName = getTagName(n); | ||
var node_1; | ||
const tagName = getTagName(n); | ||
let node; | ||
if (n.isSVG) { | ||
node_1 = doc.createElementNS('http://www.w3.org/2000/svg', tagName); | ||
node = doc.createElementNS('http://www.w3.org/2000/svg', tagName); | ||
} | ||
else { | ||
node_1 = doc.createElement(tagName); | ||
node = doc.createElement(tagName); | ||
} | ||
var _loop_1 = function (name_1) { | ||
if (!n.attributes.hasOwnProperty(name_1)) { | ||
return "continue"; | ||
for (const name in n.attributes) { | ||
if (!n.attributes.hasOwnProperty(name)) { | ||
continue; | ||
} | ||
var value = n.attributes[name_1]; | ||
if (tagName === 'option' && name_1 === 'selected' && value === false) { | ||
return "continue"; | ||
let value = n.attributes[name]; | ||
if (tagName === 'option' && name === 'selected' && value === false) { | ||
continue; | ||
} | ||
value = | ||
typeof value === 'boolean' || typeof value === 'number' ? '' : value; | ||
if (!name_1.startsWith('rr_')) { | ||
var isTextarea = tagName === 'textarea' && name_1 === 'value'; | ||
var isRemoteOrDynamicCss = tagName === 'style' && name_1 === '_cssText'; | ||
if (!name.startsWith('rr_')) { | ||
const isTextarea = tagName === 'textarea' && name === 'value'; | ||
const isRemoteOrDynamicCss = tagName === 'style' && name === '_cssText'; | ||
if (isRemoteOrDynamicCss && hackCss) { | ||
@@ -1543,26 +1533,25 @@ value = addHoverClass(value, cache); | ||
if (isTextarea || isRemoteOrDynamicCss) { | ||
var child = doc.createTextNode(value); | ||
for (var _i = 0, _a = Array.from(node_1.childNodes); _i < _a.length; _i++) { | ||
var c = _a[_i]; | ||
if (c.nodeType === node_1.TEXT_NODE) { | ||
node_1.removeChild(c); | ||
const child = doc.createTextNode(value); | ||
for (const c of Array.from(node.childNodes)) { | ||
if (c.nodeType === node.TEXT_NODE) { | ||
node.removeChild(c); | ||
} | ||
} | ||
node_1.appendChild(child); | ||
return "continue"; | ||
node.appendChild(child); | ||
continue; | ||
} | ||
try { | ||
if (n.isSVG && name_1 === 'xlink:href') { | ||
node_1.setAttributeNS('http://www.w3.org/1999/xlink', name_1, value); | ||
if (n.isSVG && name === 'xlink:href') { | ||
node.setAttributeNS('http://www.w3.org/1999/xlink', name, value); | ||
} | ||
else if (name_1 === 'onload' || | ||
name_1 === 'onclick' || | ||
name_1.substring(0, 7) === 'onmouse') { | ||
node_1.setAttribute('_' + name_1, value); | ||
else if (name === 'onload' || | ||
name === 'onclick' || | ||
name.substring(0, 7) === 'onmouse') { | ||
node.setAttribute('_' + name, value); | ||
} | ||
else if (tagName === 'meta' && | ||
n.attributes['http-equiv'] === 'Content-Security-Policy' && | ||
name_1 === 'content') { | ||
node_1.setAttribute('csp-content', value); | ||
return "continue"; | ||
name === 'content') { | ||
node.setAttribute('csp-content', value); | ||
continue; | ||
} | ||
@@ -1581,6 +1570,6 @@ else if (tagName === 'link' && | ||
n.attributes.rr_dataURL) { | ||
node_1.setAttribute('rrweb-original-srcset', n.attributes.srcset); | ||
node.setAttribute('rrweb-original-srcset', n.attributes.srcset); | ||
} | ||
else { | ||
node_1.setAttribute(name_1, value); | ||
node.setAttribute(name, value); | ||
} | ||
@@ -1592,14 +1581,14 @@ } | ||
else { | ||
if (tagName === 'canvas' && name_1 === 'rr_dataURL') { | ||
var image_1 = document.createElement('img'); | ||
image_1.src = value; | ||
image_1.onload = function () { | ||
var ctx = node_1.getContext('2d'); | ||
if (tagName === 'canvas' && name === 'rr_dataURL') { | ||
const image = document.createElement('img'); | ||
image.src = value; | ||
image.onload = () => { | ||
const ctx = node.getContext('2d'); | ||
if (ctx) { | ||
ctx.drawImage(image_1, 0, 0, image_1.width, image_1.height); | ||
ctx.drawImage(image, 0, 0, image.width, image.height); | ||
} | ||
}; | ||
} | ||
else if (tagName === 'img' && name_1 === 'rr_dataURL') { | ||
var image = node_1; | ||
else if (tagName === 'img' && name === 'rr_dataURL') { | ||
const image = node; | ||
if (!image.currentSrc.startsWith('data:')) { | ||
@@ -1610,20 +1599,21 @@ image.setAttribute('rrweb-original-src', n.attributes.src); | ||
} | ||
if (name_1 === 'rr_width') { | ||
node_1.style.width = value; | ||
if (name === 'rr_width') { | ||
node.style.width = value; | ||
} | ||
else if (name_1 === 'rr_height') { | ||
node_1.style.height = value; | ||
else if (name === 'rr_height') { | ||
node.style.height = value; | ||
} | ||
else if (name_1 === 'rr_mediaCurrentTime') { | ||
node_1.currentTime = n.attributes | ||
else if (name === 'rr_mediaCurrentTime') { | ||
node.currentTime = n.attributes | ||
.rr_mediaCurrentTime; | ||
} | ||
else if (name_1 === 'rr_mediaState') { | ||
else if (name === 'rr_mediaState') { | ||
switch (value) { | ||
case 'played': | ||
node_1 | ||
.play()["catch"](function (e) { return console.warn('media playback error', e); }); | ||
node | ||
.play() | ||
.catch((e) => console.warn('media playback error', e)); | ||
break; | ||
case 'paused': | ||
node_1.pause(); | ||
node.pause(); | ||
break; | ||
@@ -1633,17 +1623,14 @@ } | ||
} | ||
}; | ||
for (var name_1 in n.attributes) { | ||
_loop_1(name_1); | ||
} | ||
if (n.isShadowHost) { | ||
if (!node_1.shadowRoot) { | ||
node_1.attachShadow({ mode: 'open' }); | ||
if (!node.shadowRoot) { | ||
node.attachShadow({ mode: 'open' }); | ||
} | ||
else { | ||
while (node_1.shadowRoot.firstChild) { | ||
node_1.shadowRoot.removeChild(node_1.shadowRoot.firstChild); | ||
while (node.shadowRoot.firstChild) { | ||
node.shadowRoot.removeChild(node.shadowRoot.firstChild); | ||
} | ||
} | ||
} | ||
return node_1; | ||
return node; | ||
case NodeType.Text: | ||
@@ -1662,4 +1649,4 @@ return doc.createTextNode(n.isStyle && hackCss | ||
function buildNodeWithSN(n, options) { | ||
var doc = options.doc, map = options.map, _a = options.skipChild, skipChild = _a === void 0 ? false : _a, _b = options.hackCss, hackCss = _b === void 0 ? true : _b, afterAppend = options.afterAppend, cache = options.cache; | ||
var node = buildNode(n, { doc: doc, hackCss: hackCss, cache: cache }); | ||
const { doc, map, skipChild = false, hackCss = true, afterAppend, cache, } = options; | ||
let node = buildNode(n, { doc, hackCss, cache }); | ||
if (!node) { | ||
@@ -1692,11 +1679,10 @@ return null; | ||
!skipChild) { | ||
for (var _i = 0, _c = n.childNodes; _i < _c.length; _i++) { | ||
var childN = _c[_i]; | ||
var childNode = buildNodeWithSN(childN, { | ||
doc: doc, | ||
map: map, | ||
for (const childN of n.childNodes) { | ||
const childNode = buildNodeWithSN(childN, { | ||
doc, | ||
map, | ||
skipChild: false, | ||
hackCss: hackCss, | ||
afterAppend: afterAppend, | ||
cache: cache | ||
hackCss, | ||
afterAppend, | ||
cache, | ||
}); | ||
@@ -1724,3 +1710,3 @@ if (!childNode) { | ||
} | ||
for (var key in idNodeMap) { | ||
for (const key in idNodeMap) { | ||
if (idNodeMap[key]) { | ||
@@ -1732,16 +1718,16 @@ walk(idNodeMap[key]); | ||
function handleScroll(node) { | ||
var n = node.__sn; | ||
const n = node.__sn; | ||
if (n.type !== NodeType.Element) { | ||
return; | ||
} | ||
var el = node; | ||
for (var name_2 in n.attributes) { | ||
if (!(n.attributes.hasOwnProperty(name_2) && name_2.startsWith('rr_'))) { | ||
const el = node; | ||
for (const name in n.attributes) { | ||
if (!(n.attributes.hasOwnProperty(name) && name.startsWith('rr_'))) { | ||
continue; | ||
} | ||
var value = n.attributes[name_2]; | ||
if (name_2 === 'rr_scrollLeft') { | ||
const value = n.attributes[name]; | ||
if (name === 'rr_scrollLeft') { | ||
el.scrollLeft = value; | ||
} | ||
if (name_2 === 'rr_scrollTop') { | ||
if (name === 'rr_scrollTop') { | ||
el.scrollTop = value; | ||
@@ -1752,13 +1738,13 @@ } | ||
function rebuild(n, options) { | ||
var doc = options.doc, onVisit = options.onVisit, _a = options.hackCss, hackCss = _a === void 0 ? true : _a, afterAppend = options.afterAppend, cache = options.cache; | ||
var idNodeMap = {}; | ||
var node = buildNodeWithSN(n, { | ||
doc: doc, | ||
const { doc, onVisit, hackCss = true, afterAppend, cache } = options; | ||
const idNodeMap = {}; | ||
const node = buildNodeWithSN(n, { | ||
doc, | ||
map: idNodeMap, | ||
skipChild: false, | ||
hackCss: hackCss, | ||
afterAppend: afterAppend, | ||
cache: cache | ||
hackCss, | ||
afterAppend, | ||
cache, | ||
}); | ||
visit(idNodeMap, function (visitedNode) { | ||
visit(idNodeMap, (visitedNode) => { | ||
if (onVisit) { | ||
@@ -1765,0 +1751,0 @@ onVisit(visitedNode); |
@@ -1,2 +0,2 @@ | ||
var e;function t(e){return e.nodeType===e.ELEMENT_NODE}function r(e){var t,r=null===(t=e)||void 0===t?void 0:t.host;return Boolean(r&&r.shadowRoot&&r.shadowRoot===e)}function n(e){var t=e.input,r=e.maskInputSelector,n=e.unmaskInputSelector,a=e.maskInputOptions,i=e.tagName,o=e.type,s=e.value,c=e.maskInputFn,l=s||"";return n&&t.matches(n)||(a[i.toLowerCase()]||a[o]||r&&t.matches(r))&&(l=c?c(l):"*".repeat(l.length)),l}!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(e||(e={}));function a(e){var t=e.getContext("2d");if(!t)return!0;for(var r=0;r<e.width;r+=50)for(var n=0;n<e.height;n+=50){var a=t.getImageData,i="__rrweb_original__"in a?a.__rrweb_original__:a;if(new Uint32Array(i.call(t,r,n,Math.min(50,e.width-r),Math.min(50,e.height-n)).data.buffer).some((function(e){return 0!==e})))return!1}return!0}var i,o,s=1,c=new RegExp("[^a-z0-9-_:]"),l=-2;function u(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).map(f).join(""):null}catch(e){return null}}function f(e){var t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=u(e.styleSheet)||t}catch(e){}return t}var m=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,p=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,d=/^(data:)([^,]*),(.*)/i;function h(e,t){return(e||"").replace(m,(function(e,r,n,a,i,o){var s,c=n||i||o,l=r||a||"";if(!c)return e;if(!p.test(c))return"url("+l+c+l+")";if(d.test(c))return"url("+l+c+l+")";if("/"===c[0])return"url("+l+(((s=t).indexOf("//")>-1?s.split("/").slice(0,3).join("/"):s.split("/")[0]).split("?")[0]+c)+l+")";var u=t.split("/"),f=c.split("/");u.pop();for(var m=0,h=f;m<h.length;m++){var v=h[m];"."!==v&&(".."===v?u.pop():u.push(v))}return"url("+l+u.join("/")+l+")"}))}var v=/^[^ \t\n\r\u000c]+/,g=/^[, \t\n\r\u000c]+/;function y(e,t){if(!t||""===t.trim())return t;var r=e.createElement("a");return r.href=t,r.href}function k(){var e=document.createElement("a");return e.href="",e.href}function b(e,t,r,n){return"src"===r||"href"===r&&n||"xlink:href"===r&&n&&"#"!==n[0]?y(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(g),!(r>=t.length);){var i=n(v);if(","===i.slice(-1))i=y(e,i.substring(0,i.length-1)),a.push(i);else{var o="";i=y(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?h(n,k()):"object"===t&&"data"===r&&n?y(e,n):n:y(e,n)}function S(e,t,r,n){if(!e)return!1;if(e.nodeType===e.ELEMENT_NODE){if(n&&(e.matches(n)||e.closest(n)))return!1;if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var a=0;a<e.classList.length;a++){var i=e.classList[a];if(t.test(i))return!0}return!(!r||!e.matches(r))||S(e.parentNode,t,r,n)}return e.nodeType,e.TEXT_NODE,S(e.parentNode,t,r,n)}function T(t,r){var s,l,f,m,p=r.doc,d=r.blockClass,v=r.blockSelector,g=r.unblockSelector,y=r.maskTextClass,T=r.maskTextSelector,C=r.unmaskTextSelector,w=r.inlineStylesheet,x=r.maskInputSelector,I=r.unmaskInputSelector,E=r.maskInputOptions,_=void 0===E?{}:E,N=r.maskTextFn,D=r.maskInputFn,L=r.dataURLOptions,O=void 0===L?{}:L,A=r.inlineImages,R=r.recordCanvas,M=r.keepIframeSrcFn;if(p.__sn){var F=p.__sn.id;l=1===F?void 0:F}switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:e.Document,childNodes:[],compatMode:t.compatMode,rootId:l}:{type:e.Document,childNodes:[],rootId:l};case t.DOCUMENT_TYPE_NODE:return{type:e.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:l};case t.ELEMENT_NODE:for(var U=function(e,t,r,n){if(n&&e.matches(n))return!1;if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var a=0;a<e.classList.length;a++){var i=e.classList[a];if(t.test(i))return!0}return!!r&&e.matches(r)}(t,d,v,g),W=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return c.test(t)?"div":t}(t),j={},P=0,B=Array.from(t.attributes);P<B.length;P++){var H=B[P],G=H.name,z=H.value;j[G]=b(p,W,G,z)}if("link"===W&&w){var q=Array.from(p.styleSheets).find((function(e){return e.href===t.href})),V=null;q&&(V=u(q)),V&&(delete j.rel,delete j.href,j._cssText=h(V,q.href))}if("style"===W&&t.sheet&&!(t.innerText||t.textContent||"").trim().length)(V=u(t.sheet))&&(j._cssText=h(V,k()));if("input"===W||"textarea"===W||"select"===W){z=t.value;"radio"!==j.type&&"checkbox"!==j.type&&"submit"!==j.type&&"button"!==j.type&&z?j.value=n({input:t,type:j.type,tagName:W,value:z,maskInputSelector:x,unmaskInputSelector:I,maskInputOptions:_,maskInputFn:D}):t.checked&&(j.checked=t.checked)}if("option"===W&&(t.selected&&!_.select?j.selected=!0:delete j.selected),"canvas"===W&&R)if("2d"===t.__context)a(t)||(j.rr_dataURL=t.toDataURL(O.type,O.quality));else if(!("__context"in t)){var $=t.toDataURL(O.type,O.quality),X=document.createElement("canvas");X.width=t.width,X.height=t.height,$!==X.toDataURL(O.type,O.quality)&&(j.rr_dataURL=$)}if("img"===W&&A){i||(i=p.createElement("canvas"),o=i.getContext("2d"));var Y=t,K=Y.crossOrigin;Y.crossOrigin="anonymous";var Z=function(){try{i.width=Y.naturalWidth,i.height=Y.naturalHeight,o.drawImage(Y,0,0),j.rr_dataURL=i.toDataURL(O.type,O.quality)}catch(e){console.warn("Cannot inline img src="+Y.currentSrc+"! Error: "+e)}K?j.crossOrigin=K:delete j.crossOrigin};Y.complete&&0!==Y.naturalWidth?Z():Y.onload=Z}if("audio"!==W&&"video"!==W||(j.rr_mediaState=t.paused?"paused":"played",j.rr_mediaCurrentTime=t.currentTime),t.scrollLeft&&(j.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(j.rr_scrollTop=t.scrollTop),U){var J=t.getBoundingClientRect(),Q=J.width,ee=J.height;j={class:j.class,rr_width:Q+"px",rr_height:ee+"px"}}return"iframe"!==W||M(j.src)||(t.contentDocument||(j.rr_src=j.src),delete j.src),{type:e.Element,tagName:W,attributes:j,childNodes:[],isSVG:(m=t,Boolean("svg"===m.tagName||m.ownerSVGElement)||void 0),needBlock:U,rootId:l};case t.TEXT_NODE:var te=t.parentNode&&t.parentNode.tagName,re=t.textContent,ne="STYLE"===te||void 0,ae="SCRIPT"===te||void 0;if(ne&&re){try{t.nextSibling||t.previousSibling||(null===(s=t.parentNode.sheet)||void 0===s?void 0:s.cssRules)&&(re=(f=t.parentNode.sheet).cssRules?Array.from(f.cssRules).map((function(e){return e.cssText||""})).join(""):"")}catch(e){console.warn("Cannot get CSS styles from text's parentNode. Error: "+e,t)}re=h(re,k())}return ae&&(re="SCRIPT_PLACEHOLDER"),!ne&&!ae&&S(t,y,T,C)&&re&&(re=N?N(re):re.replace(/[\S]/g,"*")),{type:e.Text,textContent:re||"",isStyle:ne,rootId:l};case t.CDATA_SECTION_NODE:return{type:e.CDATA,textContent:"",rootId:l};case t.COMMENT_NODE:return{type:e.Comment,textContent:t.textContent||"",rootId:l};default:return!1}}function C(e){return void 0===e?"":e.toLowerCase()}function w(n,a){var i,o=a.doc,c=a.map,l=a.blockClass,u=a.blockSelector,f=a.unblockSelector,m=a.maskTextClass,p=a.maskTextSelector,d=a.unmaskTextSelector,h=a.skipChild,v=void 0!==h&&h,g=a.inlineStylesheet,y=void 0===g||g,k=a.maskInputSelector,b=a.unmaskInputSelector,S=a.maskInputOptions,x=void 0===S?{}:S,I=a.maskTextFn,E=a.maskInputFn,_=a.slimDOMOptions,N=a.dataURLOptions,D=void 0===N?{}:N,L=a.inlineImages,O=void 0!==L&&L,A=a.recordCanvas,R=void 0!==A&&A,M=a.onSerialize,F=a.onIframeLoad,U=a.iframeLoadTimeout,W=void 0===U?5e3:U,j=a.keepIframeSrcFn,P=void 0===j?function(){return!1}:j,B=a.preserveWhiteSpace,H=void 0===B||B,G=T(n,{doc:o,blockClass:l,blockSelector:u,unblockSelector:f,maskTextClass:m,maskTextSelector:p,unmaskTextSelector:d,inlineStylesheet:y,maskInputSelector:k,unmaskInputSelector:b,maskInputOptions:x,maskTextFn:I,maskInputFn:E,dataURLOptions:D,inlineImages:O,recordCanvas:R,keepIframeSrcFn:P});if(!G)return console.warn(n,"not serialized"),null;i="__sn"in n?n.__sn.id:!function(t,r){if(r.comment&&t.type===e.Comment)return!0;if(t.type===e.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&&(C(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===C(t.attributes.name)||"icon"===C(t.attributes.rel)||"apple-touch-icon"===C(t.attributes.rel)||"shortcut icon"===C(t.attributes.rel))))return!0;if("meta"===t.tagName){if(r.headMetaDescKeywords&&C(t.attributes.name).match(/^description|keywords$/))return!0;if(r.headMetaSocial&&(C(t.attributes.property).match(/^(og|twitter|fb):/)||C(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===C(t.attributes.name)))return!0;if(r.headMetaRobots&&("robots"===C(t.attributes.name)||"googlebot"===C(t.attributes.name)||"bingbot"===C(t.attributes.name)))return!0;if(r.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(r.headMetaAuthorship&&("author"===C(t.attributes.name)||"generator"===C(t.attributes.name)||"framework"===C(t.attributes.name)||"publisher"===C(t.attributes.name)||"progid"===C(t.attributes.name)||C(t.attributes.property).match(/^article:/)||C(t.attributes.property).match(/^product:/)))return!0;if(r.headMetaVerification&&("google-site-verification"===C(t.attributes.name)||"yandex-verification"===C(t.attributes.name)||"csrf-token"===C(t.attributes.name)||"p:domain_verify"===C(t.attributes.name)||"verify-v1"===C(t.attributes.name)||"verification"===C(t.attributes.name)||"shopify-checkout-api-token"===C(t.attributes.name)))return!0}}return!1}(G,_)&&(H||G.type!==e.Text||G.isStyle||G.textContent.replace(/^\s+|\s+$/gm,"").length)?s++:-2;var z=Object.assign(G,{id:i});if(n.__sn=z,-2===i)return null;c[i]=n,M&&M(n);var q=!v;if(z.type===e.Element&&(q=q&&!z.needBlock,delete z.needBlock,n.shadowRoot&&(z.isShadowHost=!0)),(z.type===e.Document||z.type===e.Element)&&q){_.headWhitespace&&G.type===e.Element&&"head"===G.tagName&&(H=!1);for(var V={doc:o,map:c,blockClass:l,blockSelector:u,unblockSelector:f,maskTextClass:m,maskTextSelector:p,unmaskTextSelector:d,skipChild:v,inlineStylesheet:y,maskInputSelector:k,unmaskInputSelector:b,maskInputOptions:x,maskTextFn:I,maskInputFn:E,slimDOMOptions:_,dataURLOptions:D,inlineImages:O,recordCanvas:R,preserveWhiteSpace:H,onSerialize:M,onIframeLoad:F,iframeLoadTimeout:W,keepIframeSrcFn:P},$=0,X=Array.from(n.childNodes);$<X.length;$++){(Z=w(X[$],V))&&z.childNodes.push(Z)}if(t(n)&&n.shadowRoot)for(var Y=0,K=Array.from(n.shadowRoot.childNodes);Y<K.length;Y++){var Z;(Z=w(K[Y],V))&&(Z.isShadow=!0,z.childNodes.push(Z))}}return n.parentNode&&r(n.parentNode)&&(z.isShadow=!0),z.type===e.Element&&"iframe"===z.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){var o="about:blank";n.location.href===o&&e.src!==o&&""!==e.src?e.addEventListener("load",t):setTimeout(t,0)}else{var s=setTimeout((function(){i||(t(),i=!0)}),r);e.addEventListener("load",(function(){clearTimeout(s),i=!0,t()}))}}}(n,(function(){var e=n.contentDocument;if(e&&F){var t=w(e,{doc:e,map:c,blockClass:l,blockSelector:u,unblockSelector:f,maskTextClass:m,maskTextSelector:p,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:y,maskInputSelector:k,unmaskInputSelector:b,maskInputOptions:x,maskTextFn:I,maskInputFn:E,slimDOMOptions:_,dataURLOptions:D,inlineImages:O,recordCanvas:R,preserveWhiteSpace:H,onSerialize:M,onIframeLoad:F,iframeLoadTimeout:W,keepIframeSrcFn:P});t&&F(n,t)}}),W),z}function x(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.unblockSelector,c=void 0===s?null:s,l=r.maskTextClass,u=void 0===l?"rr-mask":l,f=r.maskTextSelector,m=void 0===f?null:f,p=r.unmaskTextSelector,d=void 0===p?null:p,h=r.inlineStylesheet,v=void 0===h||h,g=r.inlineImages,y=void 0!==g&&g,k=r.recordCanvas,b=void 0!==k&&k,S=r.maskInputSelector,T=void 0===S?null:S,C=r.unmaskInputSelector,x=void 0===C?null:C,I=r.maskAllInputs,E=void 0!==I&&I,_=r.maskTextFn,N=r.maskInputFn,D=r.slimDOM,L=void 0!==D&&D,O=r.dataURLOptions,A=r.preserveWhiteSpace,R=r.onSerialize,M=r.onIframeLoad,F=r.iframeLoadTimeout,U=r.keepIframeSrcFn,W={};return[w(e,{doc:e,map:W,blockClass:a,blockSelector:o,unblockSelector:c,maskTextClass:u,maskTextSelector:m,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:v,maskInputSelector:T,unmaskInputSelector:x,maskInputOptions:!0===E?{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===E?{password:!0}:E,maskTextFn:_,maskInputFn:N,slimDOMOptions:!0===L||"all"===L?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===L,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===L?{}:L,dataURLOptions:O,inlineImages:y,recordCanvas:b,preserveWhiteSpace:A,onSerialize:R,onIframeLoad:M,iframeLoadTimeout:F,keepIframeSrcFn:void 0===U?function(){return!1}:U}),W]}function I(t,r){!function t(n){r(n),n.type!==e.Document&&n.type!==e.Element||n.childNodes.forEach(t)}(t)}function E(){s=1}var _=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function N(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),p(),t}}var o=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 l(){return m(/^{\s*/)}function u(){return m(/^}/)}function f(){var t,r=[];for(p(),d(r);e.length&&"}"!==e.charAt(0)&&(t=x()||I());)!1!==t&&(r.push(t),d(r));return r}function m(t){var r=t.exec(e);if(r){var n=r[0];return a(n),e=e.slice(n.length),r}}function p(){m(/^\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=m(/^([^{]+)/);if(e)return D(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=m(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(t){var r=D(t[0]);if(!m(/^:\s*/))return c("property missing ':'");var n=m(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),a=e({type:"declaration",property:r.replace(_,""),value:n?D(n[0]).replace(_,""):""});return m(/^[;\s]*/),a}}function y(){var e,t=[];if(!l())return c("missing '{'");for(d(t);e=g();)!1!==e&&(t.push(e),d(t)),e=g();return u()?t:c("missing '}'")}function k(){for(var e,t=[],r=i();e=m(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),m(/^,\s*/);if(t.length)return r({type:"keyframe",values:t,declarations:y()})}var b,S=w("import"),T=w("charset"),C=w("namespace");function w(e){var t=new RegExp("^@"+e+"\\s*([^;]+);");return function(){var r=i(),n=m(t);if(n){var a={type:e};return a[e]=n[1].trim(),r(a)}}}function x(){if("@"===e[0])return function(){var e=i(),t=m(/^@([-\w]+)?keyframes\s*/);if(t){var r=t[1];if(!(t=m(/^([-\w]+)\s*/)))return c("@keyframes missing name");var n,a=t[1];if(!l())return c("@keyframes missing '{'");for(var o=d();n=k();)o.push(n),o=o.concat(d());return u()?e({type:"keyframes",name:a,vendor:r,keyframes:o}):c("@keyframes missing '}'")}}()||function(){var e=i(),t=m(/^@media *([^{]+)/);if(t){var r=D(t[1]);if(!l())return c("@media missing '{'");var n=d().concat(f());return u()?e({type:"media",media:r,rules:n}):c("@media missing '}'")}}()||function(){var e=i(),t=m(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:D(t[1]),media:D(t[2])})}()||function(){var e=i(),t=m(/^@supports *([^{]+)/);if(t){var r=D(t[1]);if(!l())return c("@supports missing '{'");var n=d().concat(f());return u()?e({type:"supports",supports:r,rules:n}):c("@supports missing '}'")}}()||S()||T()||C()||function(){var e=i(),t=m(/^@([-\w]+)?document *([^{]+)/);if(t){var r=D(t[1]),n=D(t[2]);if(!l())return c("@document missing '{'");var a=d().concat(f());return u()?e({type:"document",document:n,vendor:r,rules:a}):c("@document missing '}'")}}()||function(){var e=i();if(m(/^@page */)){var t=v()||[];if(!l())return c("@page missing '{'");for(var r,n=d();r=g();)n.push(r),n=n.concat(d());return u()?e({type:"page",selectors:t,declarations:n}):c("@page missing '}'")}}()||function(){var e=i();if(m(/^@host\s*/)){if(!l())return c("@host missing '{'");var t=d().concat(f());return u()?e({type:"host",rules:t}):c("@host missing '}'")}}()||function(){var e=i();if(m(/^@font-face\s*/)){if(!l())return c("@font-face missing '{'");for(var t,r=d();t=g();)r.push(t),r=r.concat(d());return u()?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:y()})):c("selector missing")}return L((b=f(),{type:"stylesheet",stylesheet:{source:t.source,rules:b,parsingErrors:s}}))}function D(e){return e?e.replace(/^\s+|\s+$/g,""):""}function L(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){L(e,n)})):o&&"object"==typeof o&&L(o,n)}return r&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var O={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 A=/([^\\]):hover/,R=new RegExp(A.source,"g");function M(e,t){var r=null==t?void 0:t.stylesWithHoverClass.get(e);if(r)return r;var n=N(e,{silent:!0});if(!n.stylesheet)return e;var a=[];if(n.stylesheet.rules.forEach((function(e){"selectors"in e&&(e.selectors||[]).forEach((function(e){A.test(e)&&a.push(e)}))})),0===a.length)return e;var i=new RegExp(a.filter((function(e,t){return a.indexOf(e)===t})).sort((function(e,t){return t.length-e.length})).map((function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})).join("|"),"g"),o=e.replace(i,(function(e){var t=e.replace(R,"$1.\\:hover");return e+", "+t}));return null==t||t.stylesWithHoverClass.set(e,o),o}function F(){return{stylesWithHoverClass:new Map}}function U(t,r){var n=r.doc,a=r.hackCss,i=r.cache;switch(t.type){case e.Document:return n.implementation.createDocument(null,"",null);case e.DocumentType:return n.implementation.createDocumentType(t.name||"html",t.publicId,t.systemId);case e.Element:var o,s=function(e){var t=O[e.tagName]?O[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",s):n.createElement(s);var c=function(e){if(!t.attributes.hasOwnProperty(e))return"continue";var r=t.attributes[e];if("option"===s&&"selected"===e&&!1===r)return"continue";if(r="boolean"==typeof r||"number"==typeof r?"":r,e.startsWith("rr_")){if("canvas"===s&&"rr_dataURL"===e){var c=document.createElement("img");c.src=r,c.onload=function(){var e=o.getContext("2d");e&&e.drawImage(c,0,0,c.width,c.height)}}else if("img"===s&&"rr_dataURL"===e){var l=o;l.currentSrc.startsWith("data:")||(l.setAttribute("rrweb-original-src",t.attributes.src),l.src=r)}if("rr_width"===e)o.style.width=r;else if("rr_height"===e)o.style.height=r;else if("rr_mediaCurrentTime"===e)o.currentTime=t.attributes.rr_mediaCurrentTime;else if("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 u="textarea"===s&&"value"===e,f="style"===s&&"_cssText"===e;if(f&&a&&(r=M(r,i)),u||f){for(var m=n.createTextNode(r),p=0,d=Array.from(o.childNodes);p<d.length;p++){var h=d[p];h.nodeType===o.TEXT_NODE&&o.removeChild(h)}return o.appendChild(m),"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"===s&&"Content-Security-Policy"===t.attributes["http-equiv"]&&"content"===e)return o.setAttribute("csp-content",r),"continue";"link"===s&&"preload"===t.attributes.rel&&"script"===t.attributes.as||"link"===s&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&t.attributes.href.endsWith(".js")||("img"===s&&t.attributes.srcset&&t.attributes.rr_dataURL?o.setAttribute("rrweb-original-srcset",t.attributes.srcset):o.setAttribute(e,r))}}catch(e){}}};for(var l in t.attributes)c(l);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.Text:return n.createTextNode(t.isStyle&&a?M(t.textContent,i):t.textContent);case e.CDATA:return n.createCDATASection(t.textContent);case e.Comment:return n.createComment(t.textContent);default:return null}}function W(r,n){var a=n.doc,i=n.map,o=n.skipChild,s=void 0!==o&&o,c=n.hackCss,l=void 0===c||c,u=n.afterAppend,f=n.cache,m=U(r,{doc:a,hackCss:l,cache:f});if(!m)return null;if(r.rootId&&console.assert(i[r.rootId]===a,"Target document should has the same root id."),r.type===e.Document&&(a.close(),a.open(),"BackCompat"===r.compatMode&&r.childNodes&&r.childNodes[0].type!==e.DocumentType&&(r.childNodes[0].type===e.Element&&"xmlns"in r.childNodes[0].attributes&&"http://www.w3.org/1999/xhtml"===r.childNodes[0].attributes.xmlns?a.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):a.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),m=a),m.__sn=r,i[r.id]=m,(r.type===e.Document||r.type===e.Element)&&!s)for(var p=0,d=r.childNodes;p<d.length;p++){var h=d[p],v=W(h,{doc:a,map:i,skipChild:!1,hackCss:l,afterAppend:u,cache:f});v?(h.isShadow&&t(m)&&m.shadowRoot?m.shadowRoot.appendChild(v):m.appendChild(v),u&&u(v)):console.warn("Failed to rebuild",h)}return m}function j(t,r){var n=r.doc,a=r.onVisit,i=r.hackCss,o={},s=W(t,{doc:n,map:o,skipChild:!1,hackCss:void 0===i||i,afterAppend:r.afterAppend,cache:r.cache});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.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]}export{l as IGNORED_NODE,e as NodeType,M as addHoverClass,W as buildNodeWithSN,E as cleanupSnapshot,F as createCache,a as is2DCanvasBlank,t as isElement,r as isShadowRoot,n as maskInputValue,S as needMaskingText,j as rebuild,w as serializeNodeWithId,x as snapshot,b as transformAttribute,I as visitSnapshot}; | ||
var e;function t(e){return e.nodeType===e.ELEMENT_NODE}function n(e){const t=null==e?void 0:e.host;return Boolean(t&&t.shadowRoot&&t.shadowRoot===e)}function r({input:e,maskInputSelector:t,unmaskInputSelector:n,maskInputOptions:r,tagName:o,type:s,value:a,maskInputFn:i}){let c=a||"";return n&&e.matches(n)||(r[o.toLowerCase()]||r[s]||t&&e.matches(t))&&(c=i?i(c):"*".repeat(c.length)),c}!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(e||(e={}));const o="__rrweb_original__";function s(e){const t=e.getContext("2d");if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let r=0;r<e.height;r+=50){const s=t.getImageData,a=o in s?s[o]:s;if(new Uint32Array(a.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some((e=>0!==e)))return!1}return!0}let a=1;const i=new RegExp("[^a-z0-9-_:]"),c=-2;function l(e){try{const t=e.rules||e.cssRules;return t?Array.from(t).map(u).join(""):null}catch(e){return null}}function u(e){let t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=l(e.styleSheet)||t}catch(e){}return t}let m,f;const p=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,d=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,h=/^(data:)([^,]*),(.*)/i;function g(e,t){return(e||"").replace(p,((e,n,r,o,s,a)=>{const i=r||s||a,c=n||o||"";if(!i)return e;if(!d.test(i))return`url(${c}${i}${c})`;if(h.test(i))return`url(${c}${i}${c})`;if("/"===i[0])return`url(${c}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+i}${c})`;const l=t.split("/"),u=i.split("/");l.pop();for(const e of u)"."!==e&&(".."===e?l.pop():l.push(e));return`url(${c}${l.join("/")}${c})`}))}const y=/^[^ \t\n\r\u000c]+/,k=/^[, \t\n\r\u000c]+/;function b(e,t){if(!t||""===t.trim())return t;const n=e.createElement("a");return n.href=t,n.href}function S(){const e=document.createElement("a");return e.href="",e.href}function T(e,t,n,r){return"src"===n||"href"===n&&r||"xlink:href"===n&&r&&"#"!==r[0]?b(e,r):"background"!==n||!r||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n&&r?function(e,t){if(""===t.trim())return t;let n=0;function r(e){let r,o=e.exec(t.substring(n));return o?(r=o[0],n+=r.length,r):""}let o=[];for(;r(k),!(n>=t.length);){let s=r(y);if(","===s.slice(-1))s=b(e,s.substring(0,s.length-1)),o.push(s);else{let r="";s=b(e,s);let a=!1;for(;;){let e=t.charAt(n);if(""===e){o.push((s+r).trim());break}if(a)")"===e&&(a=!1);else{if(","===e){n+=1,o.push((s+r).trim());break}"("===e&&(a=!0)}r+=e,n+=1}}}return o.join(", ")}(e,r):"style"===n&&r?g(r,S()):"object"===t&&"data"===n&&r?b(e,r):r:b(e,r)}function C(e,t,n,r){if(!e)return!1;if(e.nodeType===e.ELEMENT_NODE){if(r&&(e.matches(r)||e.closest(r)))return!1;if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=0;n<e.classList.length;n++){const r=e.classList[n];if(t.test(r))return!0}return!(!n||!e.matches(n))||C(e.parentNode,t,n,r)}return e.nodeType,e.TEXT_NODE,C(e.parentNode,t,n,r)}function w(t,n){var o;const{doc:a,blockClass:c,blockSelector:u,unblockSelector:p,maskTextClass:d,maskTextSelector:h,unmaskTextSelector:y,inlineStylesheet:k,maskInputSelector:b,unmaskInputSelector:w,maskInputOptions:x={},maskTextFn:I,maskInputFn:E,dataURLOptions:v={},inlineImages:_,recordCanvas:N,keepIframeSrcFn:D}=n;let L;if(a.__sn){const e=a.__sn.id;L=1===e?void 0:e}switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:e.Document,childNodes:[],compatMode:t.compatMode,rootId:L}:{type:e.Document,childNodes:[],rootId:L};case t.DOCUMENT_TYPE_NODE:return{type:e.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:L};case t.ELEMENT_NODE:const n=function(e,t,n,r){if(r&&e.matches(r))return!1;if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=0;n<e.classList.length;n++){const r=e.classList[n];if(t.test(r))return!0}return!!n&&e.matches(n)}(t,c,u,p),R=function(e){if(e instanceof HTMLFormElement)return"form";const t=e.tagName.toLowerCase().trim();return i.test(t)?"div":t}(t);let M={};for(const{name:e,value:n}of Array.from(t.attributes))M[e]=T(a,R,e,n);if("link"===R&&k){const e=Array.from(a.styleSheets).find((e=>e.href===t.href));let n=null;e&&(n=l(e)),n&&(delete M.rel,delete M.href,M._cssText=g(n,e.href))}if("style"===R&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){const e=l(t.sheet);e&&(M._cssText=g(e,S()))}if("input"===R||"textarea"===R||"select"===R){const e=t.value;"radio"!==M.type&&"checkbox"!==M.type&&"submit"!==M.type&&"button"!==M.type&&e?M.value=r({input:t,type:M.type,tagName:R,value:e,maskInputSelector:b,unmaskInputSelector:w,maskInputOptions:x,maskInputFn:E}):t.checked&&(M.checked=t.checked)}if("option"===R&&(t.selected&&!x.select?M.selected=!0:delete M.selected),"canvas"===R&&N)if("2d"===t.__context)s(t)||(M.rr_dataURL=t.toDataURL(v.type,v.quality));else if(!("__context"in t)){const e=t.toDataURL(v.type,v.quality),n=document.createElement("canvas");n.width=t.width,n.height=t.height;e!==n.toDataURL(v.type,v.quality)&&(M.rr_dataURL=e)}if("img"===R&&_){m||(m=a.createElement("canvas"),f=m.getContext("2d"));const e=t,n=e.crossOrigin;e.crossOrigin="anonymous";const r=()=>{try{m.width=e.naturalWidth,m.height=e.naturalHeight,f.drawImage(e,0,0),M.rr_dataURL=m.toDataURL(v.type,v.quality)}catch(t){console.warn(`Cannot inline img src=${e.currentSrc}! Error: ${t}`)}n?M.crossOrigin=n:delete M.crossOrigin};e.complete&&0!==e.naturalWidth?r():e.onload=r}if("audio"!==R&&"video"!==R||(M.rr_mediaState=t.paused?"paused":"played",M.rr_mediaCurrentTime=t.currentTime),t.scrollLeft&&(M.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(M.rr_scrollTop=t.scrollTop),n){const{width:e,height:n}=t.getBoundingClientRect();M={class:M.class,rr_width:`${e}px`,rr_height:`${n}px`}}return"iframe"!==R||D(M.src)||(t.contentDocument||(M.rr_src=M.src),delete M.src),{type:e.Element,tagName:R,attributes:M,childNodes:[],isSVG:(A=t,Boolean("svg"===A.tagName||A.ownerSVGElement)||void 0),needBlock:n,rootId:L};case t.TEXT_NODE:const F=t.parentNode&&t.parentNode.tagName;let $=t.textContent;const U="STYLE"===F||void 0,W="SCRIPT"===F||void 0;if(U&&$){try{t.nextSibling||t.previousSibling||(null===(o=t.parentNode.sheet)||void 0===o?void 0:o.cssRules)&&($=(O=t.parentNode.sheet).cssRules?Array.from(O.cssRules).map((e=>e.cssText||"")).join(""):"")}catch(e){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${e}`,t)}$=g($,S())}return W&&($="SCRIPT_PLACEHOLDER"),!U&&!W&&C(t,d,h,y)&&$&&($=I?I($):$.replace(/[\S]/g,"*")),{type:e.Text,textContent:$||"",isStyle:U,rootId:L};case t.CDATA_SECTION_NODE:return{type:e.CDATA,textContent:"",rootId:L};case t.COMMENT_NODE:return{type:e.Comment,textContent:t.textContent||"",rootId:L};default:return!1}var O,A}function x(e){return void 0===e?"":e.toLowerCase()}function I(r,o){const{doc:s,map:i,blockClass:c,blockSelector:l,unblockSelector:u,maskTextClass:m,maskTextSelector:f,unmaskTextSelector:p,skipChild:d=!1,inlineStylesheet:h=!0,maskInputSelector:g,unmaskInputSelector:y,maskInputOptions:k={},maskTextFn:b,maskInputFn:S,slimDOMOptions:T,dataURLOptions:C={},inlineImages:E=!1,recordCanvas:v=!1,onSerialize:_,onIframeLoad:N,iframeLoadTimeout:D=5e3,keepIframeSrcFn:L=(()=>!1)}=o;let{preserveWhiteSpace:O=!0}=o;const A=w(r,{doc:s,blockClass:c,blockSelector:l,unblockSelector:u,maskTextClass:m,maskTextSelector:f,unmaskTextSelector:p,inlineStylesheet:h,maskInputSelector:g,unmaskInputSelector:y,maskInputOptions:k,maskTextFn:b,maskInputFn:S,dataURLOptions:C,inlineImages:E,recordCanvas:v,keepIframeSrcFn:L});if(!A)return console.warn(r,"not serialized"),null;let R;R="__sn"in r?r.__sn.id:!function(t,n){if(n.comment&&t.type===e.Comment)return!0;if(t.type===e.Element){if(n.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(n.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(x(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===x(t.attributes.name)||"icon"===x(t.attributes.rel)||"apple-touch-icon"===x(t.attributes.rel)||"shortcut icon"===x(t.attributes.rel))))return!0;if("meta"===t.tagName){if(n.headMetaDescKeywords&&x(t.attributes.name).match(/^description|keywords$/))return!0;if(n.headMetaSocial&&(x(t.attributes.property).match(/^(og|twitter|fb):/)||x(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===x(t.attributes.name)))return!0;if(n.headMetaRobots&&("robots"===x(t.attributes.name)||"googlebot"===x(t.attributes.name)||"bingbot"===x(t.attributes.name)))return!0;if(n.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(n.headMetaAuthorship&&("author"===x(t.attributes.name)||"generator"===x(t.attributes.name)||"framework"===x(t.attributes.name)||"publisher"===x(t.attributes.name)||"progid"===x(t.attributes.name)||x(t.attributes.property).match(/^article:/)||x(t.attributes.property).match(/^product:/)))return!0;if(n.headMetaVerification&&("google-site-verification"===x(t.attributes.name)||"yandex-verification"===x(t.attributes.name)||"csrf-token"===x(t.attributes.name)||"p:domain_verify"===x(t.attributes.name)||"verify-v1"===x(t.attributes.name)||"verification"===x(t.attributes.name)||"shopify-checkout-api-token"===x(t.attributes.name)))return!0}}return!1}(A,T)&&(O||A.type!==e.Text||A.isStyle||A.textContent.replace(/^\s+|\s+$/gm,"").length)?a++:-2;const M=Object.assign(A,{id:R});if(r.__sn=M,-2===R)return null;i[R]=r,_&&_(r);let F=!d;if(M.type===e.Element&&(F=F&&!M.needBlock,delete M.needBlock,r.shadowRoot&&(M.isShadowHost=!0)),(M.type===e.Document||M.type===e.Element)&&F){T.headWhitespace&&A.type===e.Element&&"head"===A.tagName&&(O=!1);const n={doc:s,map:i,blockClass:c,blockSelector:l,unblockSelector:u,maskTextClass:m,maskTextSelector:f,unmaskTextSelector:p,skipChild:d,inlineStylesheet:h,maskInputSelector:g,unmaskInputSelector:y,maskInputOptions:k,maskTextFn:b,maskInputFn:S,slimDOMOptions:T,dataURLOptions:C,inlineImages:E,recordCanvas:v,preserveWhiteSpace:O,onSerialize:_,onIframeLoad:N,iframeLoadTimeout:D,keepIframeSrcFn:L};for(const e of Array.from(r.childNodes)){const t=I(e,n);t&&M.childNodes.push(t)}if(t(r)&&r.shadowRoot)for(const e of Array.from(r.shadowRoot.childNodes)){const t=I(e,n);t&&(t.isShadow=!0,M.childNodes.push(t))}}return r.parentNode&&n(r.parentNode)&&(M.isShadow=!0),M.type===e.Element&&"iframe"===M.tagName&&function(e,t,n){const r=e.contentWindow;if(!r)return;let o,s=!1;try{o=r.document.readyState}catch(e){return}if("complete"!==o){const r=setTimeout((()=>{s||(t(),s=!0)}),n);return void e.addEventListener("load",(()=>{clearTimeout(r),s=!0,t()}))}const a="about:blank";r.location.href===a&&e.src!==a&&""!==e.src?e.addEventListener("load",t):setTimeout(t,0)}(r,(()=>{const e=r.contentDocument;if(e&&N){const t=I(e,{doc:e,map:i,blockClass:c,blockSelector:l,unblockSelector:u,maskTextClass:m,maskTextSelector:f,unmaskTextSelector:p,skipChild:!1,inlineStylesheet:h,maskInputSelector:g,unmaskInputSelector:y,maskInputOptions:k,maskTextFn:b,maskInputFn:S,slimDOMOptions:T,dataURLOptions:C,inlineImages:E,recordCanvas:v,preserveWhiteSpace:O,onSerialize:_,onIframeLoad:N,iframeLoadTimeout:D,keepIframeSrcFn:L});t&&N(r,t)}}),D),M}function E(e,t){const{blockClass:n="rr-block",blockSelector:r=null,unblockSelector:o=null,maskTextClass:s="rr-mask",maskTextSelector:a=null,unmaskTextSelector:i=null,inlineStylesheet:c=!0,inlineImages:l=!1,recordCanvas:u=!1,maskInputSelector:m=null,unmaskInputSelector:f=null,maskAllInputs:p=!1,maskTextFn:d,maskInputFn:h,slimDOM:g=!1,dataURLOptions:y,preserveWhiteSpace:k,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:T,keepIframeSrcFn:C=(()=>!1)}=t||{},w={};return[I(e,{doc:e,map:w,blockClass:n,blockSelector:r,unblockSelector:o,maskTextClass:s,maskTextSelector:a,unmaskTextSelector:i,skipChild:!1,inlineStylesheet:c,maskInputSelector:m,unmaskInputSelector:f,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,password:!0}:!1===p?{password:!0}:p,maskTextFn:d,maskInputFn:h,slimDOMOptions:!0===g||"all"===g?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===g,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===g?{}:g,dataURLOptions:y,inlineImages:l,recordCanvas:u,preserveWhiteSpace:k,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:T,keepIframeSrcFn:C}),w]}function v(t,n){!function t(r){n(r),r.type!==e.Document&&r.type!==e.Element||r.childNodes.forEach(t)}(t)}function _(){a=1}const N=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function D(e,t={}){let n=1,r=1;function o(e){const t=e.match(/\n/g);t&&(n+=t.length);let o=e.lastIndexOf("\n");r=-1===o?r+e.length:e.length-o}function s(){const e={line:n,column:r};return t=>(t.position=new a(e),p(),t)}class a{constructor(e){this.start=e,this.end={line:n,column:r},this.source=t.source}}a.prototype.content=e;const i=[];function c(o){const s=new Error(t.source+":"+n+":"+r+": "+o);if(s.reason=o,s.filename=t.source,s.line=n,s.column=r,s.source=e,!t.silent)throw s;i.push(s)}function l(){return f(/^{\s*/)}function u(){return f(/^}/)}function m(){let t;const n=[];for(p(),d(n);e.length&&"}"!==e.charAt(0)&&(t=x()||I());)!1!==t&&(n.push(t),d(n));return n}function f(t){const n=t.exec(e);if(!n)return;const r=n[0];return o(r),e=e.slice(r.length),n}function p(){f(/^\s*/)}function d(e=[]){let t;for(;t=h();)!1!==t&&e.push(t),t=h();return e}function h(){const t=s();if("/"!==e.charAt(0)||"*"!==e.charAt(1))return;let n=2;for(;""!==e.charAt(n)&&("*"!==e.charAt(n)||"/"!==e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return c("End of comment missing");const a=e.slice(2,n-2);return r+=2,o(a),e=e.slice(n),r+=2,t({type:"comment",comment:a})}function g(){const e=f(/^([^{]+)/);if(e)return L(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,(e=>e.replace(/,/g,""))).split(/\s*(?![^(]*\)),\s*/).map((e=>e.replace(/\u200C/g,",")))}function y(){const e=s();let t=f(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(!t)return;const n=L(t[0]);if(!f(/^:\s*/))return c("property missing ':'");const r=f(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),o=e({type:"declaration",property:n.replace(N,""),value:r?L(r[0]).replace(N,""):""});return f(/^[;\s]*/),o}function k(){const e=[];if(!l())return c("missing '{'");let t;for(d(e);t=y();)!1!==t&&(e.push(t),d(e)),t=y();return u()?e:c("missing '}'")}function b(){let e;const t=[],n=s();for(;e=f(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),f(/^,\s*/);if(t.length)return n({type:"keyframe",values:t,declarations:k()})}const S=w("import"),T=w("charset"),C=w("namespace");function w(e){const t=new RegExp("^@"+e+"\\s*([^;]+);");return()=>{const n=s(),r=f(t);if(!r)return;const o={type:e};return o[e]=r[1].trim(),n(o)}}function x(){if("@"===e[0])return function(){const e=s();let t=f(/^@([-\w]+)?keyframes\s*/);if(!t)return;const n=t[1];if(t=f(/^([-\w]+)\s*/),!t)return c("@keyframes missing name");const r=t[1];if(!l())return c("@keyframes missing '{'");let o,a=d();for(;o=b();)a.push(o),a=a.concat(d());return u()?e({type:"keyframes",name:r,vendor:n,keyframes:a}):c("@keyframes missing '}'")}()||function(){const e=s(),t=f(/^@media *([^{]+)/);if(!t)return;const n=L(t[1]);if(!l())return c("@media missing '{'");const r=d().concat(m());return u()?e({type:"media",media:n,rules:r}):c("@media missing '}'")}()||function(){const e=s(),t=f(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:L(t[1]),media:L(t[2])})}()||function(){const e=s(),t=f(/^@supports *([^{]+)/);if(!t)return;const n=L(t[1]);if(!l())return c("@supports missing '{'");const r=d().concat(m());return u()?e({type:"supports",supports:n,rules:r}):c("@supports missing '}'")}()||S()||T()||C()||function(){const e=s(),t=f(/^@([-\w]+)?document *([^{]+)/);if(!t)return;const n=L(t[1]),r=L(t[2]);if(!l())return c("@document missing '{'");const o=d().concat(m());return u()?e({type:"document",document:r,vendor:n,rules:o}):c("@document missing '}'")}()||function(){const e=s();if(!f(/^@page */))return;const t=g()||[];if(!l())return c("@page missing '{'");let n,r=d();for(;n=y();)r.push(n),r=r.concat(d());return u()?e({type:"page",selectors:t,declarations:r}):c("@page missing '}'")}()||function(){const e=s();if(!f(/^@host\s*/))return;if(!l())return c("@host missing '{'");const t=d().concat(m());return u()?e({type:"host",rules:t}):c("@host missing '}'")}()||function(){const e=s();if(!f(/^@font-face\s*/))return;if(!l())return c("@font-face missing '{'");let t,n=d();for(;t=y();)n.push(t),n=n.concat(d());return u()?e({type:"font-face",declarations:n}):c("@font-face missing '}'")}()}function I(){const e=s(),t=g();return t?(d(),e({type:"rule",selectors:t,declarations:k()})):c("selector missing")}return O(function(){const e=m();return{type:"stylesheet",stylesheet:{source:t.source,rules:e,parsingErrors:i}}}())}function L(e){return e?e.replace(/^\s+|\s+$/g,""):""}function O(e,t){const n=e&&"string"==typeof e.type,r=n?e:t;for(const t of Object.keys(e)){const n=e[t];Array.isArray(n)?n.forEach((e=>{O(e,r)})):n&&"object"==typeof n&&O(n,r)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}const A={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"};const R=/([^\\]):hover/,M=new RegExp(R.source,"g");function F(e,t){const n=null==t?void 0:t.stylesWithHoverClass.get(e);if(n)return n;const r=D(e,{silent:!0});if(!r.stylesheet)return e;const o=[];if(r.stylesheet.rules.forEach((e=>{"selectors"in e&&(e.selectors||[]).forEach((e=>{R.test(e)&&o.push(e)}))})),0===o.length)return e;const s=new RegExp(o.filter(((e,t)=>o.indexOf(e)===t)).sort(((e,t)=>t.length-e.length)).map((e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))).join("|"),"g"),a=e.replace(s,(e=>{const t=e.replace(M,"$1.\\:hover");return`${e}, ${t}`}));return null==t||t.stylesWithHoverClass.set(e,a),a}function $(){return{stylesWithHoverClass:new Map}}function U(t,n){const{doc:r,hackCss:o,cache:s}=n;switch(t.type){case e.Document:return r.implementation.createDocument(null,"",null);case e.DocumentType:return r.implementation.createDocumentType(t.name||"html",t.publicId,t.systemId);case e.Element:const n=function(e){let t=A[e.tagName]?A[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(t);let a;a=t.isSVG?r.createElementNS("http://www.w3.org/2000/svg",n):r.createElement(n);for(const e in t.attributes){if(!t.attributes.hasOwnProperty(e))continue;let i=t.attributes[e];if("option"!==n||"selected"!==e||!1!==i)if(i="boolean"==typeof i||"number"==typeof i?"":i,e.startsWith("rr_")){if("canvas"===n&&"rr_dataURL"===e){const e=document.createElement("img");e.src=i,e.onload=()=>{const t=a.getContext("2d");t&&t.drawImage(e,0,0,e.width,e.height)}}else if("img"===n&&"rr_dataURL"===e){const e=a;e.currentSrc.startsWith("data:")||(e.setAttribute("rrweb-original-src",t.attributes.src),e.src=i)}if("rr_width"===e)a.style.width=i;else if("rr_height"===e)a.style.height=i;else if("rr_mediaCurrentTime"===e)a.currentTime=t.attributes.rr_mediaCurrentTime;else if("rr_mediaState"===e)switch(i){case"played":a.play().catch((e=>console.warn("media playback error",e)));break;case"paused":a.pause()}}else{const c="textarea"===n&&"value"===e,l="style"===n&&"_cssText"===e;if(l&&o&&(i=F(i,s)),c||l){const e=r.createTextNode(i);for(const e of Array.from(a.childNodes))e.nodeType===a.TEXT_NODE&&a.removeChild(e);a.appendChild(e);continue}try{if(t.isSVG&&"xlink:href"===e)a.setAttributeNS("http://www.w3.org/1999/xlink",e,i);else if("onload"===e||"onclick"===e||"onmouse"===e.substring(0,7))a.setAttribute("_"+e,i);else{if("meta"===n&&"Content-Security-Policy"===t.attributes["http-equiv"]&&"content"===e){a.setAttribute("csp-content",i);continue}"link"===n&&"preload"===t.attributes.rel&&"script"===t.attributes.as||"link"===n&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&t.attributes.href.endsWith(".js")||("img"===n&&t.attributes.srcset&&t.attributes.rr_dataURL?a.setAttribute("rrweb-original-srcset",t.attributes.srcset):a.setAttribute(e,i))}}catch(e){}}}if(t.isShadowHost)if(a.shadowRoot)for(;a.shadowRoot.firstChild;)a.shadowRoot.removeChild(a.shadowRoot.firstChild);else a.attachShadow({mode:"open"});return a;case e.Text:return r.createTextNode(t.isStyle&&o?F(t.textContent,s):t.textContent);case e.CDATA:return r.createCDATASection(t.textContent);case e.Comment:return r.createComment(t.textContent);default:return null}}function W(n,r){const{doc:o,map:s,skipChild:a=!1,hackCss:i=!0,afterAppend:c,cache:l}=r;let u=U(n,{doc:o,hackCss:i,cache:l});if(!u)return null;if(n.rootId&&console.assert(s[n.rootId]===o,"Target document should has the same root id."),n.type===e.Document&&(o.close(),o.open(),"BackCompat"===n.compatMode&&n.childNodes&&n.childNodes[0].type!==e.DocumentType&&(n.childNodes[0].type===e.Element&&"xmlns"in n.childNodes[0].attributes&&"http://www.w3.org/1999/xhtml"===n.childNodes[0].attributes.xmlns?o.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):o.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),u=o),u.__sn=n,s[n.id]=u,(n.type===e.Document||n.type===e.Element)&&!a)for(const e of n.childNodes){const n=W(e,{doc:o,map:s,skipChild:!1,hackCss:i,afterAppend:c,cache:l});n?(e.isShadow&&t(u)&&u.shadowRoot?u.shadowRoot.appendChild(n):u.appendChild(n),c&&c(n)):console.warn("Failed to rebuild",e)}return u}function j(t,n){const{doc:r,onVisit:o,hackCss:s=!0,afterAppend:a,cache:i}=n,c={},l=W(t,{doc:r,map:c,skipChild:!1,hackCss:s,afterAppend:a,cache:i});return function(e,t){for(const r in e)e[r]&&(n=e[r],t(n));var n}(c,(t=>{o&&o(t),function(t){const n=t.__sn;if(n.type!==e.Element)return;const r=t;for(const e in n.attributes){if(!n.attributes.hasOwnProperty(e)||!e.startsWith("rr_"))continue;const t=n.attributes[e];"rr_scrollLeft"===e&&(r.scrollLeft=t),"rr_scrollTop"===e&&(r.scrollTop=t)}}(t)})),[l,c]}export{c as IGNORED_NODE,e as NodeType,F as addHoverClass,W as buildNodeWithSN,_ as cleanupSnapshot,$ as createCache,s as is2DCanvasBlank,t as isElement,n as isShadowRoot,r as maskInputValue,C as needMaskingText,j as rebuild,I as serializeNodeWithId,E as snapshot,T as transformAttribute,v as visitSnapshot}; | ||
//# sourceMappingURL=rrweb-snapshot.min.js.map |
@@ -19,9 +19,7 @@ 'use strict'; | ||
function isShadowRoot(n) { | ||
var _a; | ||
var host = (_a = n) === null || _a === void 0 ? void 0 : _a.host; | ||
const host = n === null || n === void 0 ? void 0 : n.host; | ||
return Boolean(host && host.shadowRoot && host.shadowRoot === n); | ||
} | ||
function maskInputValue(_a) { | ||
var input = _a.input, maskInputSelector = _a.maskInputSelector, unmaskInputSelector = _a.unmaskInputSelector, maskInputOptions = _a.maskInputOptions, tagName = _a.tagName, type = _a.type, value = _a.value, maskInputFn = _a.maskInputFn; | ||
var text = value || ''; | ||
function maskInputValue({ input, maskInputSelector, unmaskInputSelector, maskInputOptions, tagName, type, value, maskInputFn, }) { | ||
let text = value || ''; | ||
if (unmaskInputSelector && input.matches(unmaskInputSelector)) { | ||
@@ -42,16 +40,16 @@ return text; | ||
} | ||
var ORIGINAL_ATTRIBUTE_NAME = '__rrweb_original__'; | ||
const ORIGINAL_ATTRIBUTE_NAME = '__rrweb_original__'; | ||
function is2DCanvasBlank(canvas) { | ||
var ctx = canvas.getContext('2d'); | ||
const ctx = canvas.getContext('2d'); | ||
if (!ctx) | ||
return true; | ||
var chunkSize = 50; | ||
for (var x = 0; x < canvas.width; x += chunkSize) { | ||
for (var y = 0; y < canvas.height; y += chunkSize) { | ||
var getImageData = ctx.getImageData; | ||
var originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData | ||
const chunkSize = 50; | ||
for (let x = 0; x < canvas.width; x += chunkSize) { | ||
for (let y = 0; y < canvas.height; y += chunkSize) { | ||
const getImageData = ctx.getImageData; | ||
const originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData | ||
? getImageData[ORIGINAL_ATTRIBUTE_NAME] | ||
: getImageData; | ||
var pixelBuffer = new Uint32Array(originalGetImageData.call(ctx, x, y, Math.min(chunkSize, canvas.width - x), Math.min(chunkSize, canvas.height - y)).data.buffer); | ||
if (pixelBuffer.some(function (pixel) { return pixel !== 0; })) | ||
const pixelBuffer = new Uint32Array(originalGetImageData.call(ctx, x, y, Math.min(chunkSize, canvas.width - x), Math.min(chunkSize, canvas.height - y)).data.buffer); | ||
if (pixelBuffer.some((pixel) => pixel !== 0)) | ||
return false; | ||
@@ -63,5 +61,5 @@ } | ||
var _id = 1; | ||
var tagNameRegex = new RegExp('[^a-z0-9-_:]'); | ||
var IGNORED_NODE = -2; | ||
let _id = 1; | ||
const tagNameRegex = new RegExp('[^a-z0-9-_:]'); | ||
const IGNORED_NODE = -2; | ||
function genId() { | ||
@@ -74,3 +72,3 @@ return _id++; | ||
} | ||
var processedTagName = element.tagName.toLowerCase().trim(); | ||
const processedTagName = element.tagName.toLowerCase().trim(); | ||
if (tagNameRegex.test(processedTagName)) { | ||
@@ -83,3 +81,3 @@ return 'div'; | ||
try { | ||
var rules = s.rules || s.cssRules; | ||
const rules = s.rules || s.cssRules; | ||
return rules ? Array.from(rules).map(getCssRuleString).join('') : null; | ||
@@ -92,3 +90,3 @@ } | ||
function getCssRuleString(rule) { | ||
var cssStringified = rule.cssText; | ||
let cssStringified = rule.cssText; | ||
if (isCSSImportRule(rule)) { | ||
@@ -109,3 +107,3 @@ try { | ||
? Array.from(sheet.cssRules) | ||
.map(function (rule) { return rule.cssText || ''; }) | ||
.map((rule) => rule.cssText || '') | ||
.join('') | ||
@@ -115,3 +113,3 @@ : ''; | ||
function extractOrigin(url) { | ||
var origin = ''; | ||
let origin = ''; | ||
if (url.indexOf('//') > -1) { | ||
@@ -126,11 +124,11 @@ origin = url.split('/').slice(0, 3).join('/'); | ||
} | ||
var canvasService; | ||
var canvasCtx; | ||
var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm; | ||
var RELATIVE_PATH = /^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/; | ||
var DATA_URI = /^(data:)([^,]*),(.*)/i; | ||
let canvasService; | ||
let canvasCtx; | ||
const URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm; | ||
const RELATIVE_PATH = /^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/; | ||
const DATA_URI = /^(data:)([^,]*),(.*)/i; | ||
function absoluteToStylesheet(cssText, href) { | ||
return (cssText || '').replace(URL_IN_CSS_REF, function (origin, quote1, path1, quote2, path2, path3) { | ||
var filePath = path1 || path2 || path3; | ||
var maybeQuote = quote1 || quote2 || ''; | ||
return (cssText || '').replace(URL_IN_CSS_REF, (origin, quote1, path1, quote2, path2, path3) => { | ||
const filePath = path1 || path2 || path3; | ||
const maybeQuote = quote1 || quote2 || ''; | ||
if (!filePath) { | ||
@@ -140,15 +138,14 @@ return origin; | ||
if (!RELATIVE_PATH.test(filePath)) { | ||
return "url(" + maybeQuote + filePath + maybeQuote + ")"; | ||
return `url(${maybeQuote}${filePath}${maybeQuote})`; | ||
} | ||
if (DATA_URI.test(filePath)) { | ||
return "url(" + maybeQuote + filePath + maybeQuote + ")"; | ||
return `url(${maybeQuote}${filePath}${maybeQuote})`; | ||
} | ||
if (filePath[0] === '/') { | ||
return "url(" + maybeQuote + (extractOrigin(href) + filePath) + maybeQuote + ")"; | ||
return `url(${maybeQuote}${extractOrigin(href) + filePath}${maybeQuote})`; | ||
} | ||
var stack = href.split('/'); | ||
var parts = filePath.split('/'); | ||
const stack = href.split('/'); | ||
const parts = filePath.split('/'); | ||
stack.pop(); | ||
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) { | ||
var part = parts_1[_i]; | ||
for (const part of parts) { | ||
if (part === '.') { | ||
@@ -164,7 +161,7 @@ continue; | ||
} | ||
return "url(" + maybeQuote + stack.join('/') + maybeQuote + ")"; | ||
return `url(${maybeQuote}${stack.join('/')}${maybeQuote})`; | ||
}); | ||
} | ||
var SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/; | ||
var SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/; | ||
const SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/; | ||
const SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/; | ||
function getAbsoluteSrcsetString(doc, attributeValue) { | ||
@@ -174,6 +171,6 @@ if (attributeValue.trim() === '') { | ||
} | ||
var pos = 0; | ||
let pos = 0; | ||
function collectCharacters(regEx) { | ||
var chars; | ||
var match = regEx.exec(attributeValue.substring(pos)); | ||
let chars; | ||
let match = regEx.exec(attributeValue.substring(pos)); | ||
if (match) { | ||
@@ -186,3 +183,3 @@ chars = match[0]; | ||
} | ||
var output = []; | ||
let output = []; | ||
while (true) { | ||
@@ -193,3 +190,3 @@ collectCharacters(SRCSET_COMMAS_OR_SPACES); | ||
} | ||
var url = collectCharacters(SRCSET_NOT_SPACES); | ||
let url = collectCharacters(SRCSET_NOT_SPACES); | ||
if (url.slice(-1) === ',') { | ||
@@ -200,7 +197,7 @@ url = absoluteToDoc(doc, url.substring(0, url.length - 1)); | ||
else { | ||
var descriptorsStr = ''; | ||
let descriptorsStr = ''; | ||
url = absoluteToDoc(doc, url); | ||
var inParens = false; | ||
let inParens = false; | ||
while (true) { | ||
var c = attributeValue.charAt(pos); | ||
let c = attributeValue.charAt(pos); | ||
if (c === '') { | ||
@@ -236,3 +233,3 @@ output.push((url + descriptorsStr).trim()); | ||
} | ||
var a = doc.createElement('a'); | ||
const a = doc.createElement('a'); | ||
a.href = attributeValue; | ||
@@ -245,3 +242,3 @@ return a.href; | ||
function getHref() { | ||
var a = document.createElement('a'); | ||
const a = document.createElement('a'); | ||
a.href = ''; | ||
@@ -285,4 +282,4 @@ return a.href; | ||
else { | ||
for (var eIndex = 0; eIndex < element.classList.length; eIndex++) { | ||
var className = element.classList[eIndex]; | ||
for (let eIndex = 0; eIndex < element.classList.length; eIndex++) { | ||
const className = element.classList[eIndex]; | ||
if (blockClass.test(className)) { | ||
@@ -315,4 +312,4 @@ return true; | ||
else { | ||
for (var eIndex = 0; eIndex < node.classList.length; eIndex++) { | ||
var className = node.classList[eIndex]; | ||
for (let eIndex = 0; eIndex < node.classList.length; eIndex++) { | ||
const className = node.classList[eIndex]; | ||
if (maskTextClass.test(className)) { | ||
@@ -336,8 +333,8 @@ return true; | ||
function onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) { | ||
var win = iframeEl.contentWindow; | ||
const win = iframeEl.contentWindow; | ||
if (!win) { | ||
return; | ||
} | ||
var fired = false; | ||
var readyState; | ||
let fired = false; | ||
let readyState; | ||
try { | ||
@@ -350,3 +347,3 @@ readyState = win.document.readyState; | ||
if (readyState !== 'complete') { | ||
var timer_1 = setTimeout(function () { | ||
const timer = setTimeout(() => { | ||
if (!fired) { | ||
@@ -357,4 +354,4 @@ listener(); | ||
}, iframeLoadTimeout); | ||
iframeEl.addEventListener('load', function () { | ||
clearTimeout(timer_1); | ||
iframeEl.addEventListener('load', () => { | ||
clearTimeout(timer); | ||
fired = true; | ||
@@ -365,3 +362,3 @@ listener(); | ||
} | ||
var blankUrl = 'about:blank'; | ||
const blankUrl = 'about:blank'; | ||
if (win.location.href !== blankUrl || | ||
@@ -377,6 +374,6 @@ iframeEl.src === blankUrl || | ||
var _a; | ||
var doc = options.doc, blockClass = options.blockClass, blockSelector = options.blockSelector, unblockSelector = options.unblockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, unmaskTextSelector = options.unmaskTextSelector, inlineStylesheet = options.inlineStylesheet, maskInputSelector = options.maskInputSelector, unmaskInputSelector = options.unmaskInputSelector, _b = options.maskInputOptions, maskInputOptions = _b === void 0 ? {} : _b, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, _c = options.dataURLOptions, dataURLOptions = _c === void 0 ? {} : _c, inlineImages = options.inlineImages, recordCanvas = options.recordCanvas, keepIframeSrcFn = options.keepIframeSrcFn; | ||
var rootId; | ||
const { doc, blockClass, blockSelector, unblockSelector, maskTextClass, maskTextSelector, unmaskTextSelector, inlineStylesheet, maskInputSelector, unmaskInputSelector, maskInputOptions = {}, maskTextFn, maskInputFn, dataURLOptions = {}, inlineImages, recordCanvas, keepIframeSrcFn, } = options; | ||
let rootId; | ||
if (doc.__sn) { | ||
var docId = doc.__sn.id; | ||
const docId = doc.__sn.id; | ||
rootId = docId === 1 ? undefined : docId; | ||
@@ -391,3 +388,3 @@ } | ||
compatMode: n.compatMode, | ||
rootId: rootId | ||
rootId, | ||
}; | ||
@@ -399,3 +396,3 @@ } | ||
childNodes: [], | ||
rootId: rootId | ||
rootId, | ||
}; | ||
@@ -409,17 +406,16 @@ } | ||
systemId: n.systemId, | ||
rootId: rootId | ||
rootId, | ||
}; | ||
case n.ELEMENT_NODE: | ||
var needBlock = _isBlockedElement(n, blockClass, blockSelector, unblockSelector); | ||
var tagName = getValidTagName(n); | ||
var attributes_1 = {}; | ||
for (var _i = 0, _d = Array.from(n.attributes); _i < _d.length; _i++) { | ||
var _e = _d[_i], name_1 = _e.name, value = _e.value; | ||
attributes_1[name_1] = transformAttribute(doc, tagName, name_1, value); | ||
const needBlock = _isBlockedElement(n, blockClass, blockSelector, unblockSelector); | ||
const tagName = getValidTagName(n); | ||
let attributes = {}; | ||
for (const { name, value } of Array.from(n.attributes)) { | ||
attributes[name] = transformAttribute(doc, tagName, name, value); | ||
} | ||
if (tagName === 'link' && inlineStylesheet) { | ||
var stylesheet = Array.from(doc.styleSheets).find(function (s) { | ||
const stylesheet = Array.from(doc.styleSheets).find((s) => { | ||
return s.href === n.href; | ||
}); | ||
var cssText = null; | ||
let cssText = null; | ||
if (stylesheet) { | ||
@@ -429,5 +425,5 @@ cssText = getCssRulesString(stylesheet); | ||
if (cssText) { | ||
delete attributes_1.rel; | ||
delete attributes_1.href; | ||
attributes_1._cssText = absoluteToStylesheet(cssText, stylesheet.href); | ||
delete attributes.rel; | ||
delete attributes.href; | ||
attributes._cssText = absoluteToStylesheet(cssText, stylesheet.href); | ||
} | ||
@@ -440,5 +436,5 @@ } | ||
'').trim().length) { | ||
var cssText = getCssRulesString(n.sheet); | ||
const cssText = getCssRulesString(n.sheet); | ||
if (cssText) { | ||
attributes_1._cssText = absoluteToStylesheet(cssText, getHref()); | ||
attributes._cssText = absoluteToStylesheet(cssText, getHref()); | ||
} | ||
@@ -449,21 +445,21 @@ } | ||
tagName === 'select') { | ||
var value = n.value; | ||
if (attributes_1.type !== 'radio' && | ||
attributes_1.type !== 'checkbox' && | ||
attributes_1.type !== 'submit' && | ||
attributes_1.type !== 'button' && | ||
const value = n.value; | ||
if (attributes.type !== 'radio' && | ||
attributes.type !== 'checkbox' && | ||
attributes.type !== 'submit' && | ||
attributes.type !== 'button' && | ||
value) { | ||
attributes_1.value = maskInputValue({ | ||
attributes.value = maskInputValue({ | ||
input: n, | ||
type: attributes_1.type, | ||
tagName: tagName, | ||
value: value, | ||
maskInputSelector: maskInputSelector, | ||
unmaskInputSelector: unmaskInputSelector, | ||
maskInputOptions: maskInputOptions, | ||
maskInputFn: maskInputFn | ||
type: attributes.type, | ||
tagName, | ||
value, | ||
maskInputSelector, | ||
unmaskInputSelector, | ||
maskInputOptions, | ||
maskInputFn, | ||
}); | ||
} | ||
else if (n.checked) { | ||
attributes_1.checked = n.checked; | ||
attributes.checked = n.checked; | ||
} | ||
@@ -473,6 +469,6 @@ } | ||
if (n.selected && !maskInputOptions['select']) { | ||
attributes_1.selected = true; | ||
attributes.selected = true; | ||
} | ||
else { | ||
delete attributes_1.selected; | ||
delete attributes.selected; | ||
} | ||
@@ -483,13 +479,13 @@ } | ||
if (!is2DCanvasBlank(n)) { | ||
attributes_1.rr_dataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality); | ||
attributes.rr_dataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality); | ||
} | ||
} | ||
else if (!('__context' in n)) { | ||
var canvasDataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality); | ||
var blankCanvas = document.createElement('canvas'); | ||
const canvasDataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality); | ||
const blankCanvas = document.createElement('canvas'); | ||
blankCanvas.width = n.width; | ||
blankCanvas.height = n.height; | ||
var blankCanvasDataURL = blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality); | ||
const blankCanvasDataURL = blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality); | ||
if (canvasDataURL !== blankCanvasDataURL) { | ||
attributes_1.rr_dataURL = canvasDataURL; | ||
attributes.rr_dataURL = canvasDataURL; | ||
} | ||
@@ -503,64 +499,64 @@ } | ||
} | ||
var image_1 = n; | ||
var oldValue_1 = image_1.crossOrigin; | ||
image_1.crossOrigin = 'anonymous'; | ||
var recordInlineImage = function () { | ||
const image = n; | ||
const oldValue = image.crossOrigin; | ||
image.crossOrigin = 'anonymous'; | ||
const recordInlineImage = () => { | ||
try { | ||
canvasService.width = image_1.naturalWidth; | ||
canvasService.height = image_1.naturalHeight; | ||
canvasCtx.drawImage(image_1, 0, 0); | ||
attributes_1.rr_dataURL = canvasService.toDataURL(dataURLOptions.type, dataURLOptions.quality); | ||
canvasService.width = image.naturalWidth; | ||
canvasService.height = image.naturalHeight; | ||
canvasCtx.drawImage(image, 0, 0); | ||
attributes.rr_dataURL = canvasService.toDataURL(dataURLOptions.type, dataURLOptions.quality); | ||
} | ||
catch (err) { | ||
console.warn("Cannot inline img src=" + image_1.currentSrc + "! Error: " + err); | ||
console.warn(`Cannot inline img src=${image.currentSrc}! Error: ${err}`); | ||
} | ||
oldValue_1 | ||
? (attributes_1.crossOrigin = oldValue_1) | ||
: delete attributes_1.crossOrigin; | ||
oldValue | ||
? (attributes.crossOrigin = oldValue) | ||
: delete attributes.crossOrigin; | ||
}; | ||
if (image_1.complete && image_1.naturalWidth !== 0) | ||
if (image.complete && image.naturalWidth !== 0) | ||
recordInlineImage(); | ||
else | ||
image_1.onload = recordInlineImage; | ||
image.onload = recordInlineImage; | ||
} | ||
if (tagName === 'audio' || tagName === 'video') { | ||
attributes_1.rr_mediaState = n.paused | ||
attributes.rr_mediaState = n.paused | ||
? 'paused' | ||
: 'played'; | ||
attributes_1.rr_mediaCurrentTime = n.currentTime; | ||
attributes.rr_mediaCurrentTime = n.currentTime; | ||
} | ||
if (n.scrollLeft) { | ||
attributes_1.rr_scrollLeft = n.scrollLeft; | ||
attributes.rr_scrollLeft = n.scrollLeft; | ||
} | ||
if (n.scrollTop) { | ||
attributes_1.rr_scrollTop = n.scrollTop; | ||
attributes.rr_scrollTop = n.scrollTop; | ||
} | ||
if (needBlock) { | ||
var _f = n.getBoundingClientRect(), width = _f.width, height = _f.height; | ||
attributes_1 = { | ||
"class": attributes_1["class"], | ||
rr_width: width + "px", | ||
rr_height: height + "px" | ||
const { width, height } = n.getBoundingClientRect(); | ||
attributes = { | ||
class: attributes.class, | ||
rr_width: `${width}px`, | ||
rr_height: `${height}px`, | ||
}; | ||
} | ||
if (tagName === 'iframe' && !keepIframeSrcFn(attributes_1.src)) { | ||
if (tagName === 'iframe' && !keepIframeSrcFn(attributes.src)) { | ||
if (!n.contentDocument) { | ||
attributes_1.rr_src = attributes_1.src; | ||
attributes.rr_src = attributes.src; | ||
} | ||
delete attributes_1.src; | ||
delete attributes.src; | ||
} | ||
return { | ||
type: exports.NodeType.Element, | ||
tagName: tagName, | ||
attributes: attributes_1, | ||
tagName, | ||
attributes, | ||
childNodes: [], | ||
isSVG: isSVGElement(n) || undefined, | ||
needBlock: needBlock, | ||
rootId: rootId | ||
needBlock, | ||
rootId, | ||
}; | ||
case n.TEXT_NODE: | ||
var parentTagName = n.parentNode && n.parentNode.tagName; | ||
var textContent = n.textContent; | ||
var isStyle = parentTagName === 'STYLE' ? true : undefined; | ||
var isScript = parentTagName === 'SCRIPT' ? true : undefined; | ||
const parentTagName = n.parentNode && n.parentNode.tagName; | ||
let textContent = n.textContent; | ||
const isStyle = parentTagName === 'STYLE' ? true : undefined; | ||
const isScript = parentTagName === 'SCRIPT' ? true : undefined; | ||
if (isStyle && textContent) { | ||
@@ -575,3 +571,3 @@ try { | ||
catch (err) { | ||
console.warn("Cannot get CSS styles from text's parentNode. Error: " + err, n); | ||
console.warn(`Cannot get CSS styles from text's parentNode. Error: ${err}`, n); | ||
} | ||
@@ -594,4 +590,4 @@ textContent = absoluteToStylesheet(textContent, getHref()); | ||
textContent: textContent || '', | ||
isStyle: isStyle, | ||
rootId: rootId | ||
isStyle, | ||
rootId, | ||
}; | ||
@@ -602,3 +598,3 @@ case n.CDATA_SECTION_NODE: | ||
textContent: '', | ||
rootId: rootId | ||
rootId, | ||
}; | ||
@@ -609,3 +605,3 @@ case n.COMMENT_NODE: | ||
textContent: n.textContent || '', | ||
rootId: rootId | ||
rootId, | ||
}; | ||
@@ -696,22 +692,22 @@ default: | ||
function serializeNodeWithId(n, options) { | ||
var doc = options.doc, map = options.map, blockClass = options.blockClass, blockSelector = options.blockSelector, unblockSelector = options.unblockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, unmaskTextSelector = options.unmaskTextSelector, _a = options.skipChild, skipChild = _a === void 0 ? false : _a, _b = options.inlineStylesheet, inlineStylesheet = _b === void 0 ? true : _b, maskInputSelector = options.maskInputSelector, unmaskInputSelector = options.unmaskInputSelector, _c = options.maskInputOptions, maskInputOptions = _c === void 0 ? {} : _c, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, slimDOMOptions = options.slimDOMOptions, _d = options.dataURLOptions, dataURLOptions = _d === void 0 ? {} : _d, _e = options.inlineImages, inlineImages = _e === void 0 ? false : _e, _f = options.recordCanvas, recordCanvas = _f === void 0 ? false : _f, onSerialize = options.onSerialize, onIframeLoad = options.onIframeLoad, _g = options.iframeLoadTimeout, iframeLoadTimeout = _g === void 0 ? 5000 : _g, _h = options.keepIframeSrcFn, keepIframeSrcFn = _h === void 0 ? function () { return false; } : _h; | ||
var _j = options.preserveWhiteSpace, preserveWhiteSpace = _j === void 0 ? true : _j; | ||
var _serializedNode = serializeNode(n, { | ||
doc: doc, | ||
blockClass: blockClass, | ||
blockSelector: blockSelector, | ||
unblockSelector: unblockSelector, | ||
maskTextClass: maskTextClass, | ||
maskTextSelector: maskTextSelector, | ||
unmaskTextSelector: unmaskTextSelector, | ||
inlineStylesheet: inlineStylesheet, | ||
maskInputSelector: maskInputSelector, | ||
unmaskInputSelector: unmaskInputSelector, | ||
maskInputOptions: maskInputOptions, | ||
maskTextFn: maskTextFn, | ||
maskInputFn: maskInputFn, | ||
dataURLOptions: dataURLOptions, | ||
inlineImages: inlineImages, | ||
recordCanvas: recordCanvas, | ||
keepIframeSrcFn: keepIframeSrcFn | ||
const { doc, map, blockClass, blockSelector, unblockSelector, maskTextClass, maskTextSelector, unmaskTextSelector, skipChild = false, inlineStylesheet = true, maskInputSelector, unmaskInputSelector, maskInputOptions = {}, maskTextFn, maskInputFn, slimDOMOptions, dataURLOptions = {}, inlineImages = false, recordCanvas = false, onSerialize, onIframeLoad, iframeLoadTimeout = 5000, keepIframeSrcFn = () => false, } = options; | ||
let { preserveWhiteSpace = true } = options; | ||
const _serializedNode = serializeNode(n, { | ||
doc, | ||
blockClass, | ||
blockSelector, | ||
unblockSelector, | ||
maskTextClass, | ||
maskTextSelector, | ||
unmaskTextSelector, | ||
inlineStylesheet, | ||
maskInputSelector, | ||
unmaskInputSelector, | ||
maskInputOptions, | ||
maskTextFn, | ||
maskInputFn, | ||
dataURLOptions, | ||
inlineImages, | ||
recordCanvas, | ||
keepIframeSrcFn, | ||
}); | ||
@@ -722,3 +718,3 @@ if (!_serializedNode) { | ||
} | ||
var id; | ||
let id; | ||
if ('__sn' in n) { | ||
@@ -737,3 +733,3 @@ id = n.__sn.id; | ||
} | ||
var serializedNode = Object.assign(_serializedNode, { id: id }); | ||
const serializedNode = Object.assign(_serializedNode, { id }); | ||
n.__sn = serializedNode; | ||
@@ -747,3 +743,3 @@ if (id === IGNORED_NODE) { | ||
} | ||
var recordChild = !skipChild; | ||
let recordChild = !skipChild; | ||
if (serializedNode.type === exports.NodeType.Element) { | ||
@@ -763,31 +759,30 @@ recordChild = recordChild && !serializedNode.needBlock; | ||
} | ||
var bypassOptions = { | ||
doc: doc, | ||
map: map, | ||
blockClass: blockClass, | ||
blockSelector: blockSelector, | ||
unblockSelector: unblockSelector, | ||
maskTextClass: maskTextClass, | ||
maskTextSelector: maskTextSelector, | ||
unmaskTextSelector: unmaskTextSelector, | ||
skipChild: skipChild, | ||
inlineStylesheet: inlineStylesheet, | ||
maskInputSelector: maskInputSelector, | ||
unmaskInputSelector: unmaskInputSelector, | ||
maskInputOptions: maskInputOptions, | ||
maskTextFn: maskTextFn, | ||
maskInputFn: maskInputFn, | ||
slimDOMOptions: slimDOMOptions, | ||
dataURLOptions: dataURLOptions, | ||
inlineImages: inlineImages, | ||
recordCanvas: recordCanvas, | ||
preserveWhiteSpace: preserveWhiteSpace, | ||
onSerialize: onSerialize, | ||
onIframeLoad: onIframeLoad, | ||
iframeLoadTimeout: iframeLoadTimeout, | ||
keepIframeSrcFn: keepIframeSrcFn | ||
const bypassOptions = { | ||
doc, | ||
map, | ||
blockClass, | ||
blockSelector, | ||
unblockSelector, | ||
maskTextClass, | ||
maskTextSelector, | ||
unmaskTextSelector, | ||
skipChild, | ||
inlineStylesheet, | ||
maskInputSelector, | ||
unmaskInputSelector, | ||
maskInputOptions, | ||
maskTextFn, | ||
maskInputFn, | ||
slimDOMOptions, | ||
dataURLOptions, | ||
inlineImages, | ||
recordCanvas, | ||
preserveWhiteSpace, | ||
onSerialize, | ||
onIframeLoad, | ||
iframeLoadTimeout, | ||
keepIframeSrcFn, | ||
}; | ||
for (var _i = 0, _k = Array.from(n.childNodes); _i < _k.length; _i++) { | ||
var childN = _k[_i]; | ||
var serializedChildNode = serializeNodeWithId(childN, bypassOptions); | ||
for (const childN of Array.from(n.childNodes)) { | ||
const serializedChildNode = serializeNodeWithId(childN, bypassOptions); | ||
if (serializedChildNode) { | ||
@@ -798,5 +793,4 @@ serializedNode.childNodes.push(serializedChildNode); | ||
if (isElement(n) && n.shadowRoot) { | ||
for (var _l = 0, _m = Array.from(n.shadowRoot.childNodes); _l < _m.length; _l++) { | ||
var childN = _m[_l]; | ||
var serializedChildNode = serializeNodeWithId(childN, bypassOptions); | ||
for (const childN of Array.from(n.shadowRoot.childNodes)) { | ||
const serializedChildNode = serializeNodeWithId(childN, bypassOptions); | ||
if (serializedChildNode) { | ||
@@ -814,30 +808,30 @@ serializedChildNode.isShadow = true; | ||
serializedNode.tagName === 'iframe') { | ||
onceIframeLoaded(n, function () { | ||
var iframeDoc = n.contentDocument; | ||
onceIframeLoaded(n, () => { | ||
const iframeDoc = n.contentDocument; | ||
if (iframeDoc && onIframeLoad) { | ||
var serializedIframeNode = serializeNodeWithId(iframeDoc, { | ||
const serializedIframeNode = serializeNodeWithId(iframeDoc, { | ||
doc: iframeDoc, | ||
map: map, | ||
blockClass: blockClass, | ||
blockSelector: blockSelector, | ||
unblockSelector: unblockSelector, | ||
maskTextClass: maskTextClass, | ||
maskTextSelector: maskTextSelector, | ||
unmaskTextSelector: unmaskTextSelector, | ||
map, | ||
blockClass, | ||
blockSelector, | ||
unblockSelector, | ||
maskTextClass, | ||
maskTextSelector, | ||
unmaskTextSelector, | ||
skipChild: false, | ||
inlineStylesheet: inlineStylesheet, | ||
maskInputSelector: maskInputSelector, | ||
unmaskInputSelector: unmaskInputSelector, | ||
maskInputOptions: maskInputOptions, | ||
maskTextFn: maskTextFn, | ||
maskInputFn: maskInputFn, | ||
slimDOMOptions: slimDOMOptions, | ||
dataURLOptions: dataURLOptions, | ||
inlineImages: inlineImages, | ||
recordCanvas: recordCanvas, | ||
preserveWhiteSpace: preserveWhiteSpace, | ||
onSerialize: onSerialize, | ||
onIframeLoad: onIframeLoad, | ||
iframeLoadTimeout: iframeLoadTimeout, | ||
keepIframeSrcFn: keepIframeSrcFn | ||
inlineStylesheet, | ||
maskInputSelector, | ||
unmaskInputSelector, | ||
maskInputOptions, | ||
maskTextFn, | ||
maskInputFn, | ||
slimDOMOptions, | ||
dataURLOptions, | ||
inlineImages, | ||
recordCanvas, | ||
preserveWhiteSpace, | ||
onSerialize, | ||
onIframeLoad, | ||
iframeLoadTimeout, | ||
keepIframeSrcFn, | ||
}); | ||
@@ -853,5 +847,5 @@ if (serializedIframeNode) { | ||
function snapshot(n, options) { | ||
var _a = options || {}, _b = _a.blockClass, blockClass = _b === void 0 ? 'rr-block' : _b, _c = _a.blockSelector, blockSelector = _c === void 0 ? null : _c, _d = _a.unblockSelector, unblockSelector = _d === void 0 ? null : _d, _e = _a.maskTextClass, maskTextClass = _e === void 0 ? 'rr-mask' : _e, _f = _a.maskTextSelector, maskTextSelector = _f === void 0 ? null : _f, _g = _a.unmaskTextSelector, unmaskTextSelector = _g === void 0 ? null : _g, _h = _a.inlineStylesheet, inlineStylesheet = _h === void 0 ? true : _h, _j = _a.inlineImages, inlineImages = _j === void 0 ? false : _j, _k = _a.recordCanvas, recordCanvas = _k === void 0 ? false : _k, _l = _a.maskInputSelector, maskInputSelector = _l === void 0 ? null : _l, _m = _a.unmaskInputSelector, unmaskInputSelector = _m === void 0 ? null : _m, _o = _a.maskAllInputs, maskAllInputs = _o === void 0 ? false : _o, maskTextFn = _a.maskTextFn, maskInputFn = _a.maskInputFn, _p = _a.slimDOM, slimDOM = _p === void 0 ? false : _p, dataURLOptions = _a.dataURLOptions, preserveWhiteSpace = _a.preserveWhiteSpace, onSerialize = _a.onSerialize, onIframeLoad = _a.onIframeLoad, iframeLoadTimeout = _a.iframeLoadTimeout, _q = _a.keepIframeSrcFn, keepIframeSrcFn = _q === void 0 ? function () { return false; } : _q; | ||
var idNodeMap = {}; | ||
var maskInputOptions = maskAllInputs === true | ||
const { blockClass = 'rr-block', blockSelector = null, unblockSelector = null, maskTextClass = 'rr-mask', maskTextSelector = null, unmaskTextSelector = null, inlineStylesheet = true, inlineImages = false, recordCanvas = false, maskInputSelector = null, unmaskInputSelector = null, maskAllInputs = false, maskTextFn, maskInputFn, slimDOM = false, dataURLOptions, preserveWhiteSpace, onSerialize, onIframeLoad, iframeLoadTimeout, keepIframeSrcFn = () => false, } = options || {}; | ||
const idNodeMap = {}; | ||
const maskInputOptions = maskAllInputs === true | ||
? { | ||
@@ -873,10 +867,10 @@ color: true, | ||
select: true, | ||
password: true | ||
password: true, | ||
} | ||
: maskAllInputs === false | ||
? { | ||
password: true | ||
password: true, | ||
} | ||
: maskAllInputs; | ||
var slimDOMOptions = slimDOM === true || slimDOM === 'all' | ||
const slimDOMOptions = slimDOM === true || slimDOM === 'all' | ||
? | ||
@@ -893,3 +887,3 @@ { | ||
headMetaAuthorship: true, | ||
headMetaVerification: true | ||
headMetaVerification: true, | ||
} | ||
@@ -903,24 +897,24 @@ : slimDOM === false | ||
map: idNodeMap, | ||
blockClass: blockClass, | ||
blockSelector: blockSelector, | ||
unblockSelector: unblockSelector, | ||
maskTextClass: maskTextClass, | ||
maskTextSelector: maskTextSelector, | ||
unmaskTextSelector: unmaskTextSelector, | ||
blockClass, | ||
blockSelector, | ||
unblockSelector, | ||
maskTextClass, | ||
maskTextSelector, | ||
unmaskTextSelector, | ||
skipChild: false, | ||
inlineStylesheet: inlineStylesheet, | ||
maskInputSelector: maskInputSelector, | ||
unmaskInputSelector: unmaskInputSelector, | ||
maskInputOptions: maskInputOptions, | ||
maskTextFn: maskTextFn, | ||
maskInputFn: maskInputFn, | ||
slimDOMOptions: slimDOMOptions, | ||
dataURLOptions: dataURLOptions, | ||
inlineImages: inlineImages, | ||
recordCanvas: recordCanvas, | ||
preserveWhiteSpace: preserveWhiteSpace, | ||
onSerialize: onSerialize, | ||
onIframeLoad: onIframeLoad, | ||
iframeLoadTimeout: iframeLoadTimeout, | ||
keepIframeSrcFn: keepIframeSrcFn | ||
inlineStylesheet, | ||
maskInputSelector, | ||
unmaskInputSelector, | ||
maskInputOptions, | ||
maskTextFn, | ||
maskInputFn, | ||
slimDOMOptions, | ||
dataURLOptions, | ||
inlineImages, | ||
recordCanvas, | ||
preserveWhiteSpace, | ||
onSerialize, | ||
onIframeLoad, | ||
iframeLoadTimeout, | ||
keepIframeSrcFn, | ||
}), | ||
@@ -944,18 +938,17 @@ idNodeMap, | ||
var commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g; | ||
function parse(css, options) { | ||
if (options === void 0) { options = {}; } | ||
var lineno = 1; | ||
var column = 1; | ||
const commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g; | ||
function parse(css, options = {}) { | ||
let lineno = 1; | ||
let column = 1; | ||
function updatePosition(str) { | ||
var lines = str.match(/\n/g); | ||
const lines = str.match(/\n/g); | ||
if (lines) { | ||
lineno += lines.length; | ||
} | ||
var i = str.lastIndexOf('\n'); | ||
let i = str.lastIndexOf('\n'); | ||
column = i === -1 ? column + str.length : str.length - i; | ||
} | ||
function position() { | ||
var start = { line: lineno, column: column }; | ||
return function (node) { | ||
const start = { line: lineno, column }; | ||
return (node) => { | ||
node.position = new Position(start); | ||
@@ -966,14 +959,13 @@ whitespace(); | ||
} | ||
var Position = (function () { | ||
function Position(start) { | ||
class Position { | ||
constructor(start) { | ||
this.start = start; | ||
this.end = { line: lineno, column: column }; | ||
this.end = { line: lineno, column }; | ||
this.source = options.source; | ||
} | ||
return Position; | ||
}()); | ||
} | ||
Position.prototype.content = css; | ||
var errorsList = []; | ||
const errorsList = []; | ||
function error(msg) { | ||
var err = new Error(options.source + ':' + lineno + ':' + column + ': ' + msg); | ||
const err = new Error(options.source + ':' + lineno + ':' + column + ': ' + msg); | ||
err.reason = msg; | ||
@@ -992,3 +984,3 @@ err.filename = options.source; | ||
function stylesheet() { | ||
var rulesList = rules(); | ||
const rulesList = rules(); | ||
return { | ||
@@ -999,4 +991,4 @@ type: 'stylesheet', | ||
rules: rulesList, | ||
parsingErrors: errorsList | ||
} | ||
parsingErrors: errorsList, | ||
}, | ||
}; | ||
@@ -1011,4 +1003,4 @@ } | ||
function rules() { | ||
var node; | ||
var rules = []; | ||
let node; | ||
const rules = []; | ||
whitespace(); | ||
@@ -1025,7 +1017,7 @@ comments(rules); | ||
function match(re) { | ||
var m = re.exec(css); | ||
const m = re.exec(css); | ||
if (!m) { | ||
return; | ||
} | ||
var str = m[0]; | ||
const str = m[0]; | ||
updatePosition(str); | ||
@@ -1038,5 +1030,4 @@ css = css.slice(str.length); | ||
} | ||
function comments(rules) { | ||
if (rules === void 0) { rules = []; } | ||
var c; | ||
function comments(rules = []) { | ||
let c; | ||
while ((c = comment())) { | ||
@@ -1051,7 +1042,7 @@ if (c !== false) { | ||
function comment() { | ||
var pos = position(); | ||
const pos = position(); | ||
if ('/' !== css.charAt(0) || '*' !== css.charAt(1)) { | ||
return; | ||
} | ||
var i = 2; | ||
let i = 2; | ||
while ('' !== css.charAt(i) && | ||
@@ -1065,3 +1056,3 @@ ('*' !== css.charAt(i) || '/' !== css.charAt(i + 1))) { | ||
} | ||
var str = css.slice(2, i - 2); | ||
const str = css.slice(2, i - 2); | ||
column += 2; | ||
@@ -1073,7 +1064,7 @@ updatePosition(str); | ||
type: 'comment', | ||
comment: str | ||
comment: str, | ||
}); | ||
} | ||
function selector() { | ||
var m = match(/^([^{]+)/); | ||
const m = match(/^([^{]+)/); | ||
if (!m) { | ||
@@ -1084,7 +1075,7 @@ return; | ||
.replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, '') | ||
.replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, function (m) { | ||
.replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, (m) => { | ||
return m.replace(/,/g, '\u200C'); | ||
}) | ||
.split(/\s*(?![^(]*\)),\s*/) | ||
.map(function (s) { | ||
.map((s) => { | ||
return s.replace(/\u200C/g, ','); | ||
@@ -1094,16 +1085,16 @@ }); | ||
function declaration() { | ||
var pos = position(); | ||
var propMatch = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/); | ||
const pos = position(); | ||
let propMatch = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/); | ||
if (!propMatch) { | ||
return; | ||
} | ||
var prop = trim(propMatch[0]); | ||
const prop = trim(propMatch[0]); | ||
if (!match(/^:\s*/)) { | ||
return error("property missing ':'"); | ||
return error(`property missing ':'`); | ||
} | ||
var val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/); | ||
var ret = pos({ | ||
const val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/); | ||
const ret = pos({ | ||
type: 'declaration', | ||
property: prop.replace(commentre, ''), | ||
value: val ? trim(val[0]).replace(commentre, '') : '' | ||
value: val ? trim(val[0]).replace(commentre, '') : '', | ||
}); | ||
@@ -1114,8 +1105,8 @@ match(/^[;\s]*/); | ||
function declarations() { | ||
var decls = []; | ||
const decls = []; | ||
if (!open()) { | ||
return error("missing '{'"); | ||
return error(`missing '{'`); | ||
} | ||
comments(decls); | ||
var decl; | ||
let decl; | ||
while ((decl = declaration())) { | ||
@@ -1129,3 +1120,3 @@ if (decl !== false) { | ||
if (!close()) { | ||
return error("missing '}'"); | ||
return error(`missing '}'`); | ||
} | ||
@@ -1135,5 +1126,5 @@ return decls; | ||
function keyframe() { | ||
var m; | ||
var vals = []; | ||
var pos = position(); | ||
let m; | ||
const vals = []; | ||
const pos = position(); | ||
while ((m = match(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/))) { | ||
@@ -1149,12 +1140,12 @@ vals.push(m[1]); | ||
values: vals, | ||
declarations: declarations() | ||
declarations: declarations(), | ||
}); | ||
} | ||
function atkeyframes() { | ||
var pos = position(); | ||
var m = match(/^@([-\w]+)?keyframes\s*/); | ||
const pos = position(); | ||
let m = match(/^@([-\w]+)?keyframes\s*/); | ||
if (!m) { | ||
return; | ||
} | ||
var vendor = m[1]; | ||
const vendor = m[1]; | ||
m = match(/^([-\w]+)\s*/); | ||
@@ -1164,8 +1155,8 @@ if (!m) { | ||
} | ||
var name = m[1]; | ||
const name = m[1]; | ||
if (!open()) { | ||
return error("@keyframes missing '{'"); | ||
return error(`@keyframes missing '{'`); | ||
} | ||
var frame; | ||
var frames = comments(); | ||
let frame; | ||
let frames = comments(); | ||
while ((frame = keyframe())) { | ||
@@ -1176,34 +1167,34 @@ frames.push(frame); | ||
if (!close()) { | ||
return error("@keyframes missing '}'"); | ||
return error(`@keyframes missing '}'`); | ||
} | ||
return pos({ | ||
type: 'keyframes', | ||
name: name, | ||
vendor: vendor, | ||
keyframes: frames | ||
name, | ||
vendor, | ||
keyframes: frames, | ||
}); | ||
} | ||
function atsupports() { | ||
var pos = position(); | ||
var m = match(/^@supports *([^{]+)/); | ||
const pos = position(); | ||
const m = match(/^@supports *([^{]+)/); | ||
if (!m) { | ||
return; | ||
} | ||
var supports = trim(m[1]); | ||
const supports = trim(m[1]); | ||
if (!open()) { | ||
return error("@supports missing '{'"); | ||
return error(`@supports missing '{'`); | ||
} | ||
var style = comments().concat(rules()); | ||
const style = comments().concat(rules()); | ||
if (!close()) { | ||
return error("@supports missing '}'"); | ||
return error(`@supports missing '}'`); | ||
} | ||
return pos({ | ||
type: 'supports', | ||
supports: supports, | ||
rules: style | ||
supports, | ||
rules: style, | ||
}); | ||
} | ||
function athost() { | ||
var pos = position(); | ||
var m = match(/^@host\s*/); | ||
const pos = position(); | ||
const m = match(/^@host\s*/); | ||
if (!m) { | ||
@@ -1213,36 +1204,36 @@ return; | ||
if (!open()) { | ||
return error("@host missing '{'"); | ||
return error(`@host missing '{'`); | ||
} | ||
var style = comments().concat(rules()); | ||
const style = comments().concat(rules()); | ||
if (!close()) { | ||
return error("@host missing '}'"); | ||
return error(`@host missing '}'`); | ||
} | ||
return pos({ | ||
type: 'host', | ||
rules: style | ||
rules: style, | ||
}); | ||
} | ||
function atmedia() { | ||
var pos = position(); | ||
var m = match(/^@media *([^{]+)/); | ||
const pos = position(); | ||
const m = match(/^@media *([^{]+)/); | ||
if (!m) { | ||
return; | ||
} | ||
var media = trim(m[1]); | ||
const media = trim(m[1]); | ||
if (!open()) { | ||
return error("@media missing '{'"); | ||
return error(`@media missing '{'`); | ||
} | ||
var style = comments().concat(rules()); | ||
const style = comments().concat(rules()); | ||
if (!close()) { | ||
return error("@media missing '}'"); | ||
return error(`@media missing '}'`); | ||
} | ||
return pos({ | ||
type: 'media', | ||
media: media, | ||
rules: style | ||
media, | ||
rules: style, | ||
}); | ||
} | ||
function atcustommedia() { | ||
var pos = position(); | ||
var m = match(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/); | ||
const pos = position(); | ||
const m = match(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/); | ||
if (!m) { | ||
@@ -1254,17 +1245,17 @@ return; | ||
name: trim(m[1]), | ||
media: trim(m[2]) | ||
media: trim(m[2]), | ||
}); | ||
} | ||
function atpage() { | ||
var pos = position(); | ||
var m = match(/^@page */); | ||
const pos = position(); | ||
const m = match(/^@page */); | ||
if (!m) { | ||
return; | ||
} | ||
var sel = selector() || []; | ||
const sel = selector() || []; | ||
if (!open()) { | ||
return error("@page missing '{'"); | ||
return error(`@page missing '{'`); | ||
} | ||
var decls = comments(); | ||
var decl; | ||
let decls = comments(); | ||
let decl; | ||
while ((decl = declaration())) { | ||
@@ -1275,3 +1266,3 @@ decls.push(decl); | ||
if (!close()) { | ||
return error("@page missing '}'"); | ||
return error(`@page missing '}'`); | ||
} | ||
@@ -1281,19 +1272,19 @@ return pos({ | ||
selectors: sel, | ||
declarations: decls | ||
declarations: decls, | ||
}); | ||
} | ||
function atdocument() { | ||
var pos = position(); | ||
var m = match(/^@([-\w]+)?document *([^{]+)/); | ||
const pos = position(); | ||
const m = match(/^@([-\w]+)?document *([^{]+)/); | ||
if (!m) { | ||
return; | ||
} | ||
var vendor = trim(m[1]); | ||
var doc = trim(m[2]); | ||
const vendor = trim(m[1]); | ||
const doc = trim(m[2]); | ||
if (!open()) { | ||
return error("@document missing '{'"); | ||
return error(`@document missing '{'`); | ||
} | ||
var style = comments().concat(rules()); | ||
const style = comments().concat(rules()); | ||
if (!close()) { | ||
return error("@document missing '}'"); | ||
return error(`@document missing '}'`); | ||
} | ||
@@ -1303,9 +1294,9 @@ return pos({ | ||
document: doc, | ||
vendor: vendor, | ||
rules: style | ||
vendor, | ||
rules: style, | ||
}); | ||
} | ||
function atfontface() { | ||
var pos = position(); | ||
var m = match(/^@font-face\s*/); | ||
const pos = position(); | ||
const m = match(/^@font-face\s*/); | ||
if (!m) { | ||
@@ -1315,6 +1306,6 @@ return; | ||
if (!open()) { | ||
return error("@font-face missing '{'"); | ||
return error(`@font-face missing '{'`); | ||
} | ||
var decls = comments(); | ||
var decl; | ||
let decls = comments(); | ||
let decl; | ||
while ((decl = declaration())) { | ||
@@ -1325,21 +1316,21 @@ decls.push(decl); | ||
if (!close()) { | ||
return error("@font-face missing '}'"); | ||
return error(`@font-face missing '}'`); | ||
} | ||
return pos({ | ||
type: 'font-face', | ||
declarations: decls | ||
declarations: decls, | ||
}); | ||
} | ||
var atimport = _compileAtrule('import'); | ||
var atcharset = _compileAtrule('charset'); | ||
var atnamespace = _compileAtrule('namespace'); | ||
const atimport = _compileAtrule('import'); | ||
const atcharset = _compileAtrule('charset'); | ||
const atnamespace = _compileAtrule('namespace'); | ||
function _compileAtrule(name) { | ||
var re = new RegExp('^@' + name + '\\s*([^;]+);'); | ||
return function () { | ||
var pos = position(); | ||
var m = match(re); | ||
const re = new RegExp('^@' + name + '\\s*([^;]+);'); | ||
return () => { | ||
const pos = position(); | ||
const m = match(re); | ||
if (!m) { | ||
return; | ||
} | ||
var ret = { type: name }; | ||
const ret = { type: name }; | ||
ret[name] = m[1].trim(); | ||
@@ -1366,4 +1357,4 @@ return pos(ret); | ||
function rule() { | ||
var pos = position(); | ||
var sel = selector(); | ||
const pos = position(); | ||
const sel = selector(); | ||
if (!sel) { | ||
@@ -1376,3 +1367,3 @@ return error('selector missing'); | ||
selectors: sel, | ||
declarations: declarations() | ||
declarations: declarations(), | ||
}); | ||
@@ -1386,9 +1377,8 @@ } | ||
function addParent(obj, parent) { | ||
var isNode = obj && typeof obj.type === 'string'; | ||
var childParent = isNode ? obj : parent; | ||
for (var _i = 0, _a = Object.keys(obj); _i < _a.length; _i++) { | ||
var k = _a[_i]; | ||
var value = obj[k]; | ||
const isNode = obj && typeof obj.type === 'string'; | ||
const childParent = isNode ? obj : parent; | ||
for (const k of Object.keys(obj)) { | ||
const value = obj[k]; | ||
if (Array.isArray(value)) { | ||
value.forEach(function (v) { | ||
value.forEach((v) => { | ||
addParent(v, childParent); | ||
@@ -1406,3 +1396,3 @@ }); | ||
enumerable: false, | ||
value: parent || null | ||
value: parent || null, | ||
}); | ||
@@ -1413,3 +1403,3 @@ } | ||
var tagMap = { | ||
const tagMap = { | ||
script: 'noscript', | ||
@@ -1451,6 +1441,6 @@ altglyph: 'altGlyph', | ||
lineargradient: 'linearGradient', | ||
radialgradient: 'radialGradient' | ||
radialgradient: 'radialGradient', | ||
}; | ||
function getTagName(n) { | ||
var tagName = tagMap[n.tagName] ? tagMap[n.tagName] : n.tagName; | ||
let tagName = tagMap[n.tagName] ? tagMap[n.tagName] : n.tagName; | ||
if (tagName === 'link' && n.attributes._cssText) { | ||
@@ -1464,10 +1454,10 @@ tagName = 'style'; | ||
} | ||
var HOVER_SELECTOR = /([^\\]):hover/; | ||
var HOVER_SELECTOR_GLOBAL = new RegExp(HOVER_SELECTOR.source, 'g'); | ||
const HOVER_SELECTOR = /([^\\]):hover/; | ||
const HOVER_SELECTOR_GLOBAL = new RegExp(HOVER_SELECTOR.source, 'g'); | ||
function addHoverClass(cssText, cache) { | ||
var cachedStyle = cache === null || cache === void 0 ? void 0 : cache.stylesWithHoverClass.get(cssText); | ||
const cachedStyle = cache === null || cache === void 0 ? void 0 : cache.stylesWithHoverClass.get(cssText); | ||
if (cachedStyle) | ||
return cachedStyle; | ||
var ast = parse(cssText, { | ||
silent: true | ||
const ast = parse(cssText, { | ||
silent: true, | ||
}); | ||
@@ -1477,6 +1467,6 @@ if (!ast.stylesheet) { | ||
} | ||
var selectors = []; | ||
ast.stylesheet.rules.forEach(function (rule) { | ||
const selectors = []; | ||
ast.stylesheet.rules.forEach((rule) => { | ||
if ('selectors' in rule) { | ||
(rule.selectors || []).forEach(function (selector) { | ||
(rule.selectors || []).forEach((selector) => { | ||
if (HOVER_SELECTOR.test(selector)) { | ||
@@ -1491,12 +1481,12 @@ selectors.push(selector); | ||
} | ||
var selectorMatcher = new RegExp(selectors | ||
.filter(function (selector, index) { return selectors.indexOf(selector) === index; }) | ||
.sort(function (a, b) { return b.length - a.length; }) | ||
.map(function (selector) { | ||
const selectorMatcher = new RegExp(selectors | ||
.filter((selector, index) => selectors.indexOf(selector) === index) | ||
.sort((a, b) => b.length - a.length) | ||
.map((selector) => { | ||
return escapeRegExp(selector); | ||
}) | ||
.join('|'), 'g'); | ||
var result = cssText.replace(selectorMatcher, function (selector) { | ||
var newSelector = selector.replace(HOVER_SELECTOR_GLOBAL, '$1.\\:hover'); | ||
return selector + ", " + newSelector; | ||
const result = cssText.replace(selectorMatcher, (selector) => { | ||
const newSelector = selector.replace(HOVER_SELECTOR_GLOBAL, '$1.\\:hover'); | ||
return `${selector}, ${newSelector}`; | ||
}); | ||
@@ -1507,9 +1497,9 @@ cache === null || cache === void 0 ? void 0 : cache.stylesWithHoverClass.set(cssText, result); | ||
function createCache() { | ||
var stylesWithHoverClass = new Map(); | ||
const stylesWithHoverClass = new Map(); | ||
return { | ||
stylesWithHoverClass: stylesWithHoverClass | ||
stylesWithHoverClass, | ||
}; | ||
} | ||
function buildNode(n, options) { | ||
var doc = options.doc, hackCss = options.hackCss, cache = options.cache; | ||
const { doc, hackCss, cache } = options; | ||
switch (n.type) { | ||
@@ -1521,23 +1511,23 @@ case exports.NodeType.Document: | ||
case exports.NodeType.Element: | ||
var tagName = getTagName(n); | ||
var node_1; | ||
const tagName = getTagName(n); | ||
let node; | ||
if (n.isSVG) { | ||
node_1 = doc.createElementNS('http://www.w3.org/2000/svg', tagName); | ||
node = doc.createElementNS('http://www.w3.org/2000/svg', tagName); | ||
} | ||
else { | ||
node_1 = doc.createElement(tagName); | ||
node = doc.createElement(tagName); | ||
} | ||
var _loop_1 = function (name_1) { | ||
if (!n.attributes.hasOwnProperty(name_1)) { | ||
return "continue"; | ||
for (const name in n.attributes) { | ||
if (!n.attributes.hasOwnProperty(name)) { | ||
continue; | ||
} | ||
var value = n.attributes[name_1]; | ||
if (tagName === 'option' && name_1 === 'selected' && value === false) { | ||
return "continue"; | ||
let value = n.attributes[name]; | ||
if (tagName === 'option' && name === 'selected' && value === false) { | ||
continue; | ||
} | ||
value = | ||
typeof value === 'boolean' || typeof value === 'number' ? '' : value; | ||
if (!name_1.startsWith('rr_')) { | ||
var isTextarea = tagName === 'textarea' && name_1 === 'value'; | ||
var isRemoteOrDynamicCss = tagName === 'style' && name_1 === '_cssText'; | ||
if (!name.startsWith('rr_')) { | ||
const isTextarea = tagName === 'textarea' && name === 'value'; | ||
const isRemoteOrDynamicCss = tagName === 'style' && name === '_cssText'; | ||
if (isRemoteOrDynamicCss && hackCss) { | ||
@@ -1547,26 +1537,25 @@ value = addHoverClass(value, cache); | ||
if (isTextarea || isRemoteOrDynamicCss) { | ||
var child = doc.createTextNode(value); | ||
for (var _i = 0, _a = Array.from(node_1.childNodes); _i < _a.length; _i++) { | ||
var c = _a[_i]; | ||
if (c.nodeType === node_1.TEXT_NODE) { | ||
node_1.removeChild(c); | ||
const child = doc.createTextNode(value); | ||
for (const c of Array.from(node.childNodes)) { | ||
if (c.nodeType === node.TEXT_NODE) { | ||
node.removeChild(c); | ||
} | ||
} | ||
node_1.appendChild(child); | ||
return "continue"; | ||
node.appendChild(child); | ||
continue; | ||
} | ||
try { | ||
if (n.isSVG && name_1 === 'xlink:href') { | ||
node_1.setAttributeNS('http://www.w3.org/1999/xlink', name_1, value); | ||
if (n.isSVG && name === 'xlink:href') { | ||
node.setAttributeNS('http://www.w3.org/1999/xlink', name, value); | ||
} | ||
else if (name_1 === 'onload' || | ||
name_1 === 'onclick' || | ||
name_1.substring(0, 7) === 'onmouse') { | ||
node_1.setAttribute('_' + name_1, value); | ||
else if (name === 'onload' || | ||
name === 'onclick' || | ||
name.substring(0, 7) === 'onmouse') { | ||
node.setAttribute('_' + name, value); | ||
} | ||
else if (tagName === 'meta' && | ||
n.attributes['http-equiv'] === 'Content-Security-Policy' && | ||
name_1 === 'content') { | ||
node_1.setAttribute('csp-content', value); | ||
return "continue"; | ||
name === 'content') { | ||
node.setAttribute('csp-content', value); | ||
continue; | ||
} | ||
@@ -1585,6 +1574,6 @@ else if (tagName === 'link' && | ||
n.attributes.rr_dataURL) { | ||
node_1.setAttribute('rrweb-original-srcset', n.attributes.srcset); | ||
node.setAttribute('rrweb-original-srcset', n.attributes.srcset); | ||
} | ||
else { | ||
node_1.setAttribute(name_1, value); | ||
node.setAttribute(name, value); | ||
} | ||
@@ -1596,14 +1585,14 @@ } | ||
else { | ||
if (tagName === 'canvas' && name_1 === 'rr_dataURL') { | ||
var image_1 = document.createElement('img'); | ||
image_1.src = value; | ||
image_1.onload = function () { | ||
var ctx = node_1.getContext('2d'); | ||
if (tagName === 'canvas' && name === 'rr_dataURL') { | ||
const image = document.createElement('img'); | ||
image.src = value; | ||
image.onload = () => { | ||
const ctx = node.getContext('2d'); | ||
if (ctx) { | ||
ctx.drawImage(image_1, 0, 0, image_1.width, image_1.height); | ||
ctx.drawImage(image, 0, 0, image.width, image.height); | ||
} | ||
}; | ||
} | ||
else if (tagName === 'img' && name_1 === 'rr_dataURL') { | ||
var image = node_1; | ||
else if (tagName === 'img' && name === 'rr_dataURL') { | ||
const image = node; | ||
if (!image.currentSrc.startsWith('data:')) { | ||
@@ -1614,20 +1603,21 @@ image.setAttribute('rrweb-original-src', n.attributes.src); | ||
} | ||
if (name_1 === 'rr_width') { | ||
node_1.style.width = value; | ||
if (name === 'rr_width') { | ||
node.style.width = value; | ||
} | ||
else if (name_1 === 'rr_height') { | ||
node_1.style.height = value; | ||
else if (name === 'rr_height') { | ||
node.style.height = value; | ||
} | ||
else if (name_1 === 'rr_mediaCurrentTime') { | ||
node_1.currentTime = n.attributes | ||
else if (name === 'rr_mediaCurrentTime') { | ||
node.currentTime = n.attributes | ||
.rr_mediaCurrentTime; | ||
} | ||
else if (name_1 === 'rr_mediaState') { | ||
else if (name === 'rr_mediaState') { | ||
switch (value) { | ||
case 'played': | ||
node_1 | ||
.play()["catch"](function (e) { return console.warn('media playback error', e); }); | ||
node | ||
.play() | ||
.catch((e) => console.warn('media playback error', e)); | ||
break; | ||
case 'paused': | ||
node_1.pause(); | ||
node.pause(); | ||
break; | ||
@@ -1637,17 +1627,14 @@ } | ||
} | ||
}; | ||
for (var name_1 in n.attributes) { | ||
_loop_1(name_1); | ||
} | ||
if (n.isShadowHost) { | ||
if (!node_1.shadowRoot) { | ||
node_1.attachShadow({ mode: 'open' }); | ||
if (!node.shadowRoot) { | ||
node.attachShadow({ mode: 'open' }); | ||
} | ||
else { | ||
while (node_1.shadowRoot.firstChild) { | ||
node_1.shadowRoot.removeChild(node_1.shadowRoot.firstChild); | ||
while (node.shadowRoot.firstChild) { | ||
node.shadowRoot.removeChild(node.shadowRoot.firstChild); | ||
} | ||
} | ||
} | ||
return node_1; | ||
return node; | ||
case exports.NodeType.Text: | ||
@@ -1666,4 +1653,4 @@ return doc.createTextNode(n.isStyle && hackCss | ||
function buildNodeWithSN(n, options) { | ||
var doc = options.doc, map = options.map, _a = options.skipChild, skipChild = _a === void 0 ? false : _a, _b = options.hackCss, hackCss = _b === void 0 ? true : _b, afterAppend = options.afterAppend, cache = options.cache; | ||
var node = buildNode(n, { doc: doc, hackCss: hackCss, cache: cache }); | ||
const { doc, map, skipChild = false, hackCss = true, afterAppend, cache, } = options; | ||
let node = buildNode(n, { doc, hackCss, cache }); | ||
if (!node) { | ||
@@ -1696,11 +1683,10 @@ return null; | ||
!skipChild) { | ||
for (var _i = 0, _c = n.childNodes; _i < _c.length; _i++) { | ||
var childN = _c[_i]; | ||
var childNode = buildNodeWithSN(childN, { | ||
doc: doc, | ||
map: map, | ||
for (const childN of n.childNodes) { | ||
const childNode = buildNodeWithSN(childN, { | ||
doc, | ||
map, | ||
skipChild: false, | ||
hackCss: hackCss, | ||
afterAppend: afterAppend, | ||
cache: cache | ||
hackCss, | ||
afterAppend, | ||
cache, | ||
}); | ||
@@ -1728,3 +1714,3 @@ if (!childNode) { | ||
} | ||
for (var key in idNodeMap) { | ||
for (const key in idNodeMap) { | ||
if (idNodeMap[key]) { | ||
@@ -1736,16 +1722,16 @@ walk(idNodeMap[key]); | ||
function handleScroll(node) { | ||
var n = node.__sn; | ||
const n = node.__sn; | ||
if (n.type !== exports.NodeType.Element) { | ||
return; | ||
} | ||
var el = node; | ||
for (var name_2 in n.attributes) { | ||
if (!(n.attributes.hasOwnProperty(name_2) && name_2.startsWith('rr_'))) { | ||
const el = node; | ||
for (const name in n.attributes) { | ||
if (!(n.attributes.hasOwnProperty(name) && name.startsWith('rr_'))) { | ||
continue; | ||
} | ||
var value = n.attributes[name_2]; | ||
if (name_2 === 'rr_scrollLeft') { | ||
const value = n.attributes[name]; | ||
if (name === 'rr_scrollLeft') { | ||
el.scrollLeft = value; | ||
} | ||
if (name_2 === 'rr_scrollTop') { | ||
if (name === 'rr_scrollTop') { | ||
el.scrollTop = value; | ||
@@ -1756,13 +1742,13 @@ } | ||
function rebuild(n, options) { | ||
var doc = options.doc, onVisit = options.onVisit, _a = options.hackCss, hackCss = _a === void 0 ? true : _a, afterAppend = options.afterAppend, cache = options.cache; | ||
var idNodeMap = {}; | ||
var node = buildNodeWithSN(n, { | ||
doc: doc, | ||
const { doc, onVisit, hackCss = true, afterAppend, cache } = options; | ||
const idNodeMap = {}; | ||
const node = buildNodeWithSN(n, { | ||
doc, | ||
map: idNodeMap, | ||
skipChild: false, | ||
hackCss: hackCss, | ||
afterAppend: afterAppend, | ||
cache: cache | ||
hackCss, | ||
afterAppend, | ||
cache, | ||
}); | ||
visit(idNodeMap, function (visitedNode) { | ||
visit(idNodeMap, (visitedNode) => { | ||
if (onVisit) { | ||
@@ -1769,0 +1755,0 @@ onVisit(visitedNode); |
{ | ||
"name": "@sentry-internal/rrweb-snapshot", | ||
"version": "1.100.2", | ||
"version": "1.101.0", | ||
"description": "rrweb's component to take a snapshot of DOM, aka DOM serializer", | ||
@@ -48,19 +48,22 @@ "publishConfig": { | ||
"@types/chai": "^4.1.4", | ||
"@types/jest": "^27.0.2", | ||
"@types/jsdom": "^16.2.4", | ||
"@types/jest": "^29.4.0", | ||
"@types/jsdom": "^20.0.1", | ||
"@types/node": "^10.11.3", | ||
"@types/puppeteer": "^1.12.4", | ||
"@types/puppeteer": "^7.0.4", | ||
"cross-env": "^5.2.0", | ||
"jest": "^27.2.4", | ||
"jest-snapshot": "^23.6.0", | ||
"jsdom": "^16.4.0", | ||
"puppeteer": "^1.15.0", | ||
"jest": "^29.4.1", | ||
"jest-snapshot": "^29.4.1", | ||
"jsdom": "^21.1.0", | ||
"puppeteer": "^19.6.2", | ||
"rollup": "^2.45.2", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"ts-jest": "^27.0.5", | ||
"ts-node": "^7.0.1", | ||
"tslib": "^1.9.3", | ||
"ts-jest": "^29.0.5", | ||
"ts-node": "^10.9.1", | ||
"tslib": "^2.5.0", | ||
"tslint": "^4.5.1", | ||
"typescript": "^3.9.7" | ||
"typescript": "^4.9.5" | ||
}, | ||
"dependencies": { | ||
"jest-environment-jsdom": "^29.4.1" | ||
} | ||
} |
@@ -83,3 +83,3 @@ export interface ParserOptions { | ||
} | ||
export declare type AtRule = Charset | CustomMedia | Document | FontFace | Host | Import | KeyFrames | Media | Namespace | Page | Supports; | ||
export type AtRule = Charset | CustomMedia | Document | FontFace | Host | Import | KeyFrames | Media | Namespace | Page | Supports; | ||
export interface StyleRules { | ||
@@ -86,0 +86,0 @@ source?: string; |
@@ -47,3 +47,3 @@ import { serializedNodeWithId, INode, idNodeMap, MaskInputOptions, SlimDOMOptions, DataURLOptions, MaskTextFn, MaskInputFn, KeepIframeSrcFn } from './types'; | ||
maskInputFn?: MaskTextFn; | ||
slimDOM?: boolean | SlimDOMOptions; | ||
slimDOM?: boolean | SlimDOMOptions | 'all'; | ||
dataURLOptions?: DataURLOptions; | ||
@@ -50,0 +50,0 @@ inlineImages?: boolean; |
@@ -9,3 +9,3 @@ export declare enum NodeType { | ||
} | ||
export declare type documentNode = { | ||
export type documentNode = { | ||
type: NodeType.Document; | ||
@@ -15,3 +15,3 @@ childNodes: serializedNodeWithId[]; | ||
}; | ||
export declare type documentTypeNode = { | ||
export type documentTypeNode = { | ||
type: NodeType.DocumentType; | ||
@@ -22,6 +22,6 @@ name: string; | ||
}; | ||
export declare type attributes = { | ||
export type attributes = { | ||
[key: string]: string | number | boolean; | ||
}; | ||
export declare type elementNode = { | ||
export type elementNode = { | ||
type: NodeType.Element; | ||
@@ -34,3 +34,3 @@ tagName: string; | ||
}; | ||
export declare type textNode = { | ||
export type textNode = { | ||
type: NodeType.Text; | ||
@@ -40,11 +40,11 @@ textContent: string; | ||
}; | ||
export declare type cdataNode = { | ||
export type cdataNode = { | ||
type: NodeType.CDATA; | ||
textContent: ''; | ||
}; | ||
export declare type commentNode = { | ||
export type commentNode = { | ||
type: NodeType.Comment; | ||
textContent: string; | ||
}; | ||
export declare type serializedNode = (documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode) & { | ||
export type serializedNode = (documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode) & { | ||
rootId?: number; | ||
@@ -54,6 +54,6 @@ isShadowHost?: boolean; | ||
}; | ||
export declare type serializedNodeWithId = serializedNode & { | ||
export type serializedNodeWithId = serializedNode & { | ||
id: number; | ||
}; | ||
export declare type tagMap = { | ||
export type tagMap = { | ||
[key: string]: string; | ||
@@ -67,6 +67,6 @@ }; | ||
} | ||
export declare type idNodeMap = { | ||
export type idNodeMap = { | ||
[key: number]: INode; | ||
}; | ||
export declare type MaskInputOptions = Partial<{ | ||
export type MaskInputOptions = Partial<{ | ||
color: boolean; | ||
@@ -89,3 +89,3 @@ date: boolean; | ||
}>; | ||
export declare type SlimDOMOptions = Partial<{ | ||
export type SlimDOMOptions = Partial<{ | ||
script: boolean; | ||
@@ -102,11 +102,11 @@ comment: boolean; | ||
}>; | ||
export declare type DataURLOptions = Partial<{ | ||
export type DataURLOptions = Partial<{ | ||
type: string; | ||
quality: number; | ||
}>; | ||
export declare type MaskTextFn = (text: string) => string; | ||
export declare type MaskInputFn = (text: string) => string; | ||
export declare type KeepIframeSrcFn = (src: string) => boolean; | ||
export declare type BuildCache = { | ||
export type MaskTextFn = (text: string) => string; | ||
export type MaskInputFn = (text: string) => string; | ||
export type KeepIframeSrcFn = (src: string) => boolean; | ||
export type BuildCache = { | ||
stylesWithHoverClass: Map<string, string>; | ||
}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
449351
1
5496
+ Added@babel/code-frame@7.26.2(transitive)
+ Added@babel/helper-validator-identifier@7.25.9(transitive)
+ Added@jest/environment@29.7.0(transitive)
+ Added@jest/fake-timers@29.7.0(transitive)
+ Added@jest/schemas@29.6.3(transitive)
+ Added@jest/types@29.6.3(transitive)
+ Added@sinclair/typebox@0.27.8(transitive)
+ Added@sinonjs/commons@3.0.1(transitive)
+ Added@sinonjs/fake-timers@10.3.0(transitive)
+ Added@tootallnate/once@2.0.0(transitive)
+ Added@types/istanbul-lib-coverage@2.0.6(transitive)
+ Added@types/istanbul-lib-report@3.0.3(transitive)
+ Added@types/istanbul-reports@3.0.4(transitive)
+ Added@types/jsdom@20.0.1(transitive)
+ Added@types/node@22.10.2(transitive)
+ Added@types/stack-utils@2.0.3(transitive)
+ Added@types/tough-cookie@4.0.5(transitive)
+ Added@types/yargs@17.0.33(transitive)
+ Added@types/yargs-parser@21.0.3(transitive)
+ Addedabab@2.0.6(transitive)
+ Addedacorn@8.14.0(transitive)
+ Addedacorn-globals@7.0.1(transitive)
+ Addedacorn-walk@8.3.4(transitive)
+ Addedagent-base@6.0.2(transitive)
+ Addedansi-styles@4.3.05.2.0(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addedchalk@4.1.2(transitive)
+ Addedci-info@3.9.0(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcssom@0.3.80.5.0(transitive)
+ Addedcssstyle@2.3.0(transitive)
+ Addeddata-urls@3.0.2(transitive)
+ Addeddebug@4.4.0(transitive)
+ Addeddecimal.js@10.4.3(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addeddomexception@4.0.0(transitive)
+ Addedentities@4.5.0(transitive)
+ Addedescape-string-regexp@2.0.0(transitive)
+ Addedescodegen@2.1.0(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedestraverse@5.3.0(transitive)
+ Addedesutils@2.0.3(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedform-data@4.0.1(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedhtml-encoding-sniffer@3.0.0(transitive)
+ Addedhttp-proxy-agent@5.0.0(transitive)
+ Addedhttps-proxy-agent@5.0.1(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedis-potential-custom-element-name@1.0.1(transitive)
+ Addedjest-environment-jsdom@29.7.0(transitive)
+ Addedjest-message-util@29.7.0(transitive)
+ Addedjest-mock@29.7.0(transitive)
+ Addedjest-util@29.7.0(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedjsdom@20.0.3(transitive)
+ Addedmicromatch@4.0.8(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedms@2.1.3(transitive)
+ Addednwsapi@2.2.16(transitive)
+ Addedparse5@7.2.1(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedpretty-format@29.7.0(transitive)
+ Addedpsl@1.15.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedquerystringify@2.2.0(transitive)
+ Addedreact-is@18.3.1(transitive)
+ Addedrequires-port@1.0.0(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsaxes@6.0.0(transitive)
+ Addedslash@3.0.0(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedstack-utils@2.0.6(transitive)
+ Addedsupports-color@7.2.0(transitive)
+ Addedsymbol-tree@3.2.4(transitive)
+ Addedto-regex-range@5.0.1(transitive)
+ Addedtough-cookie@4.1.4(transitive)
+ Addedtr46@3.0.0(transitive)
+ Addedtype-detect@4.0.8(transitive)
+ Addedundici-types@6.20.0(transitive)
+ Addeduniversalify@0.2.0(transitive)
+ Addedurl-parse@1.5.10(transitive)
+ Addedw3c-xmlserializer@4.0.0(transitive)
+ Addedwebidl-conversions@7.0.0(transitive)
+ Addedwhatwg-encoding@2.0.0(transitive)
+ Addedwhatwg-mimetype@3.0.0(transitive)
+ Addedwhatwg-url@11.0.0(transitive)
+ Addedws@8.18.0(transitive)
+ Addedxml-name-validator@4.0.0(transitive)
+ Addedxmlchars@2.2.0(transitive)