rrweb-snapshot
Advanced tools
Comparing version 2.0.0-alpha.0 to 2.0.0-alpha.1
@@ -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=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}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 a=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var r=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=r?r:-1},e.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},e.prototype.removeNodeFromMap=function(e){var t=this,r=this.getId(e);this.idNodeMap.delete(r),e.childNodes&&e.childNodes.forEach((function(e){return t.removeNodeFromMap(e)}))},e.prototype.has=function(e){return this.idNodeMap.has(e)},e.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},e.prototype.add=function(e,t){var r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function o(e){var t=e.maskInputOptions,r=e.tagName,n=e.type,a=e.value,o=e.maskInputFn,i=a||"";return(t[r.toLowerCase()]||t[n])&&(i=o?o(i):"*".repeat(i.length)),i}var i="__rrweb_original__";function s(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,o=i in a?a.__rrweb_original__:a;if(new Uint32Array(o.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 c,l,u=1,d=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,h=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,v=/^(data:)([^,]*),(.*)/i;function y(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(!h.test(c))return"url(".concat(l).concat(c).concat(l,")");if(v.test(c))return"url(".concat(l).concat(c).concat(l,")");if("/"===c[0])return"url(".concat(l).concat((s=t,(s.indexOf("//")>-1?s.split("/").slice(0,3).join("/"):s.split("/")[0]).split("?")[0]+c)).concat(l,")");var u=t.split("/"),d=c.split("/");u.pop();for(var p=0,f=d;p<f.length;p++){var m=f[p];"."!==m&&(".."===m?u.pop():u.push(m))}return"url(".concat(l).concat(u.join("/")).concat(l,")")}))}var g=/^[^ \t\n\r\u000c]+/,T=/^[, \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 b(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function N(){var e=document.createElement("a");return e.href="",e.href}function C(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(T),!(r>=t.length);){var o=n(g);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?y(n,N()):"object"===t&&"data"===r&&n?k(e,n):n:k(e,n)}function w(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&w(e.parentNode,t,r);for(var n=e.classList.length;n--;){var a=e.classList[n];if(t.test(a))return!0}return!!r&&w(e.parentNode,t,r)}function S(e,t,r){var n=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===n)return!1;if("string"==typeof t){if(n.classList.contains(t))return!0;if(n.closest(".".concat(t)))return!0}else if(w(n,t,!0))return!0;if(r){if(n.matches(r))return!0;if(n.closest(r))return!0}return!1}function x(t,r){var n=r.doc,a=r.mirror,i=r.blockClass,u=r.blockSelector,f=r.maskTextClass,m=r.maskTextSelector,h=r.inlineStylesheet,v=r.maskInputOptions,g=void 0===v?{}:v,T=r.maskTextFn,k=r.maskInputFn,w=r.dataURLOptions,x=void 0===w?{}:w,I=r.inlineImages,E=r.recordCanvas,L=r.keepIframeSrcFn,M=r.newlyAddedElement,O=void 0!==M&&M,D=function(e,t){if(!t.hasNode(e))return;var r=t.getId(e);return 1===r?void 0:r}(n,a);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:e.NodeType.Document,childNodes:[],compatMode:t.compatMode,rootId:D}:{type:e.NodeType.Document,childNodes:[],rootId:D};case t.DOCUMENT_TYPE_NODE:return{type:e.NodeType.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:D};case t.ELEMENT_NODE:return function(t,r){for(var n=r.doc,a=r.blockClass,i=r.blockSelector,u=r.inlineStylesheet,f=r.maskInputOptions,m=void 0===f?{}:f,h=r.maskInputFn,v=r.dataURLOptions,g=void 0===v?{}:v,T=r.inlineImages,k=r.recordCanvas,w=r.keepIframeSrcFn,S=r.newlyAddedElement,x=void 0!==S&&S,I=r.rootId,E=function(e,t,r){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var n=e.classList.length;n--;){var a=e.classList[n];if(t.test(a))return!0}return!!r&&e.matches(r)}(t,a,i),L=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return d.test(t)?"div":t}(t),M={},O=t.attributes.length,D=0;D<O;D++){var _=t.attributes[D];M[_.name]=C(n,L,_.name,_.value)}if("link"===L&&u){var A=Array.from(n.styleSheets).find((function(e){return e.href===t.href})),R=null;A&&(R=p(A)),R&&(delete M.rel,delete M.href,M._cssText=y(R,A.href))}if("style"===L&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){(R=p(t.sheet))&&(M._cssText=y(R,N()))}if("input"===L||"textarea"===L||"select"===L){var F=t.value;"radio"!==M.type&&"checkbox"!==M.type&&"submit"!==M.type&&"button"!==M.type&&F?M.value=o({type:M.type,tagName:L,value:F,maskInputOptions:m,maskInputFn:h}):t.checked&&(M.checked=t.checked)}"option"===L&&(t.selected&&!m.select?M.selected=!0:delete M.selected);if("canvas"===L&&k)if("2d"===t.__context)s(t)||(M.rr_dataURL=t.toDataURL(g.type,g.quality));else if(!("__context"in t)){var U=t.toDataURL(g.type,g.quality),W=document.createElement("canvas");W.width=t.width,W.height=t.height,U!==W.toDataURL(g.type,g.quality)&&(M.rr_dataURL=U)}if("img"===L&&T){c||(c=n.createElement("canvas"),l=c.getContext("2d"));var j=t,P=j.crossOrigin;j.crossOrigin="anonymous";var B=function(){try{c.width=j.naturalWidth,c.height=j.naturalHeight,l.drawImage(j,0,0),M.rr_dataURL=c.toDataURL(g.type,g.quality)}catch(e){console.warn("Cannot inline img src=".concat(j.currentSrc,"! Error: ").concat(e))}P?M.crossOrigin=P:j.removeAttribute("crossorigin")};j.complete&&0!==j.naturalWidth?B():j.onload=B}"audio"!==L&&"video"!==L||(M.rr_mediaState=t.paused?"paused":"played",M.rr_mediaCurrentTime=t.currentTime);x||(t.scrollLeft&&(M.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(M.rr_scrollTop=t.scrollTop));if(E){var H=t.getBoundingClientRect(),z=H.width,G=H.height;M={class:M.class,rr_width:"".concat(z,"px"),rr_height:"".concat(G,"px")}}"iframe"!==L||w(M.src)||(t.contentDocument||(M.rr_src=M.src),delete M.src);return{type:e.NodeType.Element,tagName:L,attributes:M,childNodes:[],isSVG:b(t)||void 0,needBlock:E,rootId:I}}(t,{doc:n,blockClass:i,blockSelector:u,inlineStylesheet:h,maskInputOptions:g,maskInputFn:k,dataURLOptions:x,inlineImages:I,recordCanvas:E,keepIframeSrcFn:L,newlyAddedElement:O,rootId:D});case t.TEXT_NODE:return function(t,r){var n,a=r.maskTextClass,o=r.maskTextSelector,i=r.maskTextFn,s=r.rootId,c=t.parentNode&&t.parentNode.tagName,l=t.textContent,u="STYLE"===c||void 0,d="SCRIPT"===c||void 0;if(u&&l){try{t.nextSibling||t.previousSibling||(null===(n=t.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(l=(p=t.parentNode.sheet).cssRules?Array.from(p.cssRules).map((function(e){return e.cssText||""})).join(""):"")}catch(e){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(e),t)}l=y(l,N())}var p;d&&(l="SCRIPT_PLACEHOLDER");!u&&!d&&l&&S(t,a,o)&&(l=i?i(l):l.replace(/[\S]/g,"*"));return{type:e.NodeType.Text,textContent:l||"",isStyle:u,rootId:s}}(t,{maskTextClass:f,maskTextSelector:m,maskTextFn:T,rootId:D});case t.CDATA_SECTION_NODE:return{type:e.NodeType.CDATA,textContent:"",rootId:D};case t.COMMENT_NODE:return{type:e.NodeType.Comment,textContent:t.textContent||"",rootId:D};default:return!1}}function I(e){return void 0===e?"":e.toLowerCase()}function E(t,a){var o,i=a.doc,s=a.mirror,c=a.blockClass,l=a.blockSelector,d=a.maskTextClass,p=a.maskTextSelector,f=a.skipChild,m=void 0!==f&&f,h=a.inlineStylesheet,v=void 0===h||h,y=a.maskInputOptions,g=void 0===y?{}:y,T=a.maskTextFn,k=a.maskInputFn,b=a.slimDOMOptions,N=a.dataURLOptions,C=void 0===N?{}:N,w=a.inlineImages,S=void 0!==w&&w,L=a.recordCanvas,M=void 0!==L&&L,O=a.onSerialize,D=a.onIframeLoad,_=a.iframeLoadTimeout,A=void 0===_?5e3:_,R=a.onStylesheetLoad,F=a.stylesheetLoadTimeout,U=void 0===F?5e3:F,W=a.keepIframeSrcFn,j=void 0===W?function(){return!1}:W,P=a.newlyAddedElement,B=void 0!==P&&P,H=a.preserveWhiteSpace,z=void 0===H||H,G=x(t,{doc:i,mirror:s,blockClass:c,blockSelector:l,maskTextClass:d,maskTextSelector:p,inlineStylesheet:v,maskInputOptions:g,maskTextFn:T,maskInputFn:k,dataURLOptions:C,inlineImages:S,recordCanvas:M,keepIframeSrcFn:j,newlyAddedElement:B});if(!G)return console.warn(t,"not serialized"),null;if(-2===(o=s.hasNode(t)?s.getId(t):!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&&(I(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===I(t.attributes.name)||"icon"===I(t.attributes.rel)||"apple-touch-icon"===I(t.attributes.rel)||"shortcut icon"===I(t.attributes.rel))))return!0;if("meta"===t.tagName){if(r.headMetaDescKeywords&&I(t.attributes.name).match(/^description|keywords$/))return!0;if(r.headMetaSocial&&(I(t.attributes.property).match(/^(og|twitter|fb):/)||I(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===I(t.attributes.name)))return!0;if(r.headMetaRobots&&("robots"===I(t.attributes.name)||"googlebot"===I(t.attributes.name)||"bingbot"===I(t.attributes.name)))return!0;if(r.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(r.headMetaAuthorship&&("author"===I(t.attributes.name)||"generator"===I(t.attributes.name)||"framework"===I(t.attributes.name)||"publisher"===I(t.attributes.name)||"progid"===I(t.attributes.name)||I(t.attributes.property).match(/^article:/)||I(t.attributes.property).match(/^product:/)))return!0;if(r.headMetaVerification&&("google-site-verification"===I(t.attributes.name)||"yandex-verification"===I(t.attributes.name)||"csrf-token"===I(t.attributes.name)||"p:domain_verify"===I(t.attributes.name)||"verify-v1"===I(t.attributes.name)||"verification"===I(t.attributes.name)||"shopify-checkout-api-token"===I(t.attributes.name)))return!0}}return!1}(G,b)&&(z||G.type!==e.NodeType.Text||G.isStyle||G.textContent.replace(/^\s+|\s+$/gm,"").length)?u++:-2))return null;var q=Object.assign(G,{id:o});s.add(t,q),O&&O(t);var V,$=!m;if(q.type===e.NodeType.Element&&($=$&&!q.needBlock,delete q.needBlock,t.shadowRoot&&(q.isShadowHost=!0)),(q.type===e.NodeType.Document||q.type===e.NodeType.Element)&&$){b.headWhitespace&&q.type===e.NodeType.Element&&"head"===q.tagName&&(z=!1);for(var Y={doc:i,mirror:s,blockClass:c,blockSelector:l,maskTextClass:d,maskTextSelector:p,skipChild:m,inlineStylesheet:v,maskInputOptions:g,maskTextFn:T,maskInputFn:k,slimDOMOptions:b,dataURLOptions:C,inlineImages:S,recordCanvas:M,preserveWhiteSpace:z,onSerialize:O,onIframeLoad:D,iframeLoadTimeout:A,onStylesheetLoad:R,stylesheetLoadTimeout:U,keepIframeSrcFn:j},X=0,K=Array.from(t.childNodes);X<K.length;X++){(Q=E(K[X],Y))&&q.childNodes.push(Q)}if(r(t)&&t.shadowRoot)for(var Z=0,J=Array.from(t.shadowRoot.childNodes);Z<J.length;Z++){var Q;(Q=E(J[Z],Y))&&(Q.isShadow=!0,q.childNodes.push(Q))}}return t.parentNode&&n(t.parentNode)&&(q.isShadow=!0),q.type===e.NodeType.Element&&"iframe"===q.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&&D){var r=E(e,{doc:e,mirror:s,blockClass:c,blockSelector:l,maskTextClass:d,maskTextSelector:p,skipChild:!1,inlineStylesheet:v,maskInputOptions:g,maskTextFn:T,maskInputFn:k,slimDOMOptions:b,dataURLOptions:C,inlineImages:S,recordCanvas:M,preserveWhiteSpace:z,onSerialize:O,onIframeLoad:D,iframeLoadTimeout:A,onStylesheetLoad:R,stylesheetLoadTimeout:U,keepIframeSrcFn:j});r&&D(t,r)}}),A),q.type===e.NodeType.Element&&"link"===q.tagName&&"stylesheet"===q.attributes.rel&&(function(e,t,r){var n,a=!1;try{n=e.sheet}catch(e){return}if(!n){var o=setTimeout((function(){a||(t(),a=!0)}),r);e.addEventListener("load",(function(){clearTimeout(o),a=!0,t()}))}}(t,(function(){if(R){var e=E(t,{doc:i,mirror:s,blockClass:c,blockSelector:l,maskTextClass:d,maskTextSelector:p,skipChild:!1,inlineStylesheet:v,maskInputOptions:g,maskTextFn:T,maskInputFn:k,slimDOMOptions:b,dataURLOptions:C,inlineImages:S,recordCanvas:M,preserveWhiteSpace:z,onSerialize:O,onIframeLoad:D,iframeLoadTimeout:A,onStylesheetLoad:R,stylesheetLoadTimeout:U,keepIframeSrcFn:j});e&&R(t,e)}}),U),!1==(!(V=t).getAttribute("href")||null!==V.sheet))?null:q}var L=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function M(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),f(),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("".concat(t.source||"",":").concat(r,":").concat(n,": ").concat(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 p(/^{\s*/)}function u(){return p(/^}/)}function d(){var t,r=[];for(f(),m(r);e.length&&"}"!==e.charAt(0)&&(t=S()||x());)!1!==t&&(r.push(t),m(r));return r}function p(t){var r=t.exec(e);if(r){var n=r[0];return a(n),e=e.slice(n.length),r}}function f(){p(/^\s*/)}function m(e){var t;for(void 0===e&&(e=[]);t=h();)!1!==t&&e.push(t),t=h();return e}function h(){var t=o();if("/"===e.charAt(0)&&"*"===e.charAt(1)){for(var r=2;""!==e.charAt(r)&&("*"!==e.charAt(r)||"/"!==e.charAt(r+1));)++r;if(r+=2,""===e.charAt(r-1))return c("End of comment missing");var i=e.slice(2,r-2);return n+=2,a(i),e=e.slice(r),n+=2,t({type:"comment",comment:i})}}function v(){var e=p(/^([^{]+)/);if(e)return O(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,(function(e){return e.replace(/,/g,"")})).split(/\s*(?![^(]*\)),\s*/).map((function(e){return e.replace(/\u200C/g,",")}))}function y(){var e=o(),t=p(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(t){var r=O(t[0]);if(!p(/^:\s*/))return c("property missing ':'");var n=p(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),a=e({type:"declaration",property:r.replace(L,""),value:n?O(n[0]).replace(L,""):""});return p(/^[;\s]*/),a}}function g(){var e,t=[];if(!l())return c("missing '{'");for(m(t);e=y();)!1!==e&&(t.push(e),m(t)),e=y();return u()?t:c("missing '}'")}function T(){for(var e,t=[],r=o();e=p(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),p(/^,\s*/);if(t.length)return r({type:"keyframe",values:t,declarations:g()})}var k,b=w("import"),N=w("charset"),C=w("namespace");function w(e){var t=new RegExp("^@"+e+"\\s*([^;]+);");return function(){var r=o(),n=p(t);if(n){var a={type:e};return a[e]=n[1].trim(),r(a)}}}function S(){if("@"===e[0])return function(){var e=o(),t=p(/^@([-\w]+)?keyframes\s*/);if(t){var r=t[1];if(!(t=p(/^([-\w]+)\s*/)))return c("@keyframes missing name");var n,a=t[1];if(!l())return c("@keyframes missing '{'");for(var i=m();n=T();)i.push(n),i=i.concat(m());return u()?e({type:"keyframes",name:a,vendor:r,keyframes:i}):c("@keyframes missing '}'")}}()||function(){var e=o(),t=p(/^@media *([^{]+)/);if(t){var r=O(t[1]);if(!l())return c("@media missing '{'");var n=m().concat(d());return u()?e({type:"media",media:r,rules:n}):c("@media missing '}'")}}()||function(){var e=o(),t=p(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:O(t[1]),media:O(t[2])})}()||function(){var e=o(),t=p(/^@supports *([^{]+)/);if(t){var r=O(t[1]);if(!l())return c("@supports missing '{'");var n=m().concat(d());return u()?e({type:"supports",supports:r,rules:n}):c("@supports missing '}'")}}()||b()||N()||C()||function(){var e=o(),t=p(/^@([-\w]+)?document *([^{]+)/);if(t){var r=O(t[1]),n=O(t[2]);if(!l())return c("@document missing '{'");var a=m().concat(d());return u()?e({type:"document",document:n,vendor:r,rules:a}):c("@document missing '}'")}}()||function(){var e=o();if(p(/^@page */)){var t=v()||[];if(!l())return c("@page missing '{'");for(var r,n=m();r=y();)n.push(r),n=n.concat(m());return u()?e({type:"page",selectors:t,declarations:n}):c("@page missing '}'")}}()||function(){var e=o();if(p(/^@host\s*/)){if(!l())return c("@host missing '{'");var t=m().concat(d());return u()?e({type:"host",rules:t}):c("@host missing '}'")}}()||function(){var e=o();if(p(/^@font-face\s*/)){if(!l())return c("@font-face missing '{'");for(var t,r=m();t=y();)r.push(t),r=r.concat(m());return u()?e({type:"font-face",declarations:r}):c("@font-face missing '}'")}}()}function x(){var e=o(),t=v();return t?(m(),e({type:"rule",selectors:t,declarations:g()})):c("selector missing")}return D((k=d(),{type:"stylesheet",stylesheet:{source:t.source,rules:k,parsingErrors:s}}))}function O(e){return e?e.replace(/^\s+|\s+$/g,""):""}function D(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){D(e,n)})):i&&"object"==typeof i&&D(i,n)}return r&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var _={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 F(e,t){var r=null==t?void 0:t.stylesWithHoverClass.get(e);if(r)return r;var n=M(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 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(R,"$1.\\:hover");return"".concat(e,", ").concat(t)}));return null==t||t.stylesWithHoverClass.set(e,i),i}function U(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=_[e.tagName]?_[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(!Object.prototype.hasOwnProperty.call(t.attributes,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,d="style"===s&&"_cssText"===e;if(d&&a&&(r=F(r,o)),u||d){for(var p=n.createTextNode(r),f=0,m=Array.from(i.childNodes);f<m.length;f++){var h=m[f];h.nodeType===i.TEXT_NODE&&i.removeChild(h)}return i.appendChild(p),"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?F(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 W(t,n){var a=n.doc,o=n.mirror,i=n.skipChild,s=void 0!==i&&i,c=n.hackCss,l=void 0===c||c,u=n.afterAppend,d=n.cache,p=U(t,{doc:a,hackCss:l,cache:d});if(!p)return null;if(t.rootId&&console.assert(o.getNode(t.rootId)===a,"Target document should have 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" "">')),p=a),o.add(p,t),(t.type===e.NodeType.Document||t.type===e.NodeType.Element)&&!s)for(var f=0,m=t.childNodes;f<m.length;f++){var h=m[f],v=W(h,{doc:a,mirror:o,skipChild:!1,hackCss:l,afterAppend:u,cache:d});v?(h.isShadow&&r(p)&&p.shadowRoot?p.shadowRoot.appendChild(v):p.appendChild(v),u&&u(v)):console.warn("Failed to rebuild",h)}return p}return e.IGNORED_NODE=-2,e.Mirror=a,e.addHoverClass=F,e.buildNodeWithSN=W,e.classMatchesRegex=w,e.cleanupSnapshot=function(){u=1},e.createCache=function(){return{stylesWithHoverClass:new Map}},e.createMirror=function(){return new a},e.is2DCanvasBlank=s,e.isElement=r,e.isShadowRoot=n,e.maskInputValue=o,e.needMaskingText=S,e.rebuild=function(t,r){var n=r.doc,o=r.onVisit,i=r.hackCss,s=void 0===i||i,c=r.afterAppend,l=r.cache,u=r.mirror,d=void 0===u?new a:u,p=W(t,{doc:n,mirror:d,skipChild:!1,hackCss:s,afterAppend:c,cache:l});return function(e,t){for(var r=0,n=e.getIds();r<n.length;r++){var a=n[r];e.has(a)&&t(e.getNode(a))}}(d,(function(t){o&&o(t),function(t,r){var n=r.getMeta(t);if((null==n?void 0:n.type)===e.NodeType.Element){var a=t;for(var o in n.attributes)if(Object.prototype.hasOwnProperty.call(n.attributes,o)&&o.startsWith("rr_")){var i=n.attributes[o];"rr_scrollLeft"===o&&(a.scrollLeft=i),"rr_scrollTop"===o&&(a.scrollTop=i)}}}(t,d)})),p},e.serializeNodeWithId=E,e.snapshot=function(e,t){var r=t||{},n=r.mirror,o=void 0===n?new a:n,i=r.blockClass,s=void 0===i?"rr-block":i,c=r.blockSelector,l=void 0===c?null:c,u=r.maskTextClass,d=void 0===u?"rr-mask":u,p=r.maskTextSelector,f=void 0===p?null:p,m=r.inlineStylesheet,h=void 0===m||m,v=r.inlineImages,y=void 0!==v&&v,g=r.recordCanvas,T=void 0!==g&&g,k=r.maskAllInputs,b=void 0!==k&&k,N=r.maskTextFn,C=r.maskInputFn,w=r.slimDOM,S=void 0!==w&&w,x=r.dataURLOptions,I=r.preserveWhiteSpace,L=r.onSerialize,M=r.onIframeLoad,O=r.iframeLoadTimeout,D=r.onStylesheetLoad,_=r.stylesheetLoadTimeout,A=r.keepIframeSrcFn;return E(e,{doc:e,mirror:o,blockClass:s,blockSelector:l,maskTextClass:d,maskTextSelector:f,skipChild:!1,inlineStylesheet:h,maskInputOptions:!0===b?{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===b?{password:!0}:b,maskTextFn:N,maskInputFn:C,slimDOMOptions:!0===S||"all"===S?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===S,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===S?{}:S,dataURLOptions:x,inlineImages:y,recordCanvas:T,preserveWhiteSpace:I,onSerialize:L,onIframeLoad:M,iframeLoadTimeout:O,onStylesheetLoad:D,stylesheetLoadTimeout:_,keepIframeSrcFn:void 0===A?function(){return!1}:A,newlyAddedElement:!1})},e.transformAttribute=C,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 r(e){return e.nodeType===e.ELEMENT_NODE}function n(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function a(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}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=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var r=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=r?r:-1},e.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},e.prototype.removeNodeFromMap=function(e){var t=this,r=this.getId(e);this.idNodeMap.delete(r),e.childNodes&&e.childNodes.forEach((function(e){return t.removeNodeFromMap(e)}))},e.prototype.has=function(e){return this.idNodeMap.has(e)},e.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},e.prototype.add=function(e,t){var r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function i(e){var t=e.maskInputOptions,r=e.tagName,n=e.type,a=e.value,o=e.maskInputFn,i=a||"";return(t[r.toLowerCase()]||t[n])&&(i=o?o(i):"*".repeat(i.length)),i}var s="__rrweb_original__";function c(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,o=s in a?a.__rrweb_original__:a;if(new Uint32Array(o.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 l,u,d=1,p=new RegExp("[^a-z0-9-_:]");function f(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).map(m).join(""):null}catch(e){return null}}function m(e){var t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=f(e.styleSheet)||t}catch(e){}return t}var h=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,v=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,y=/^(data:)([^,]*),(.*)/i;function g(e,t){return(e||"").replace(h,(function(e,r,n,a,o,i){var s,c=n||o||i,l=r||a||"";if(!c)return e;if(!v.test(c))return"url(".concat(l).concat(c).concat(l,")");if(y.test(c))return"url(".concat(l).concat(c).concat(l,")");if("/"===c[0])return"url(".concat(l).concat((s=t,(s.indexOf("//")>-1?s.split("/").slice(0,3).join("/"):s.split("/")[0]).split("?")[0]+c)).concat(l,")");var u=t.split("/"),d=c.split("/");u.pop();for(var p=0,f=d;p<f.length;p++){var m=f[p];"."!==m&&(".."===m?u.pop():u.push(m))}return"url(".concat(l).concat(u.join("/")).concat(l,")")}))}var T=/^[^ \t\n\r\u000c]+/,b=/^[, \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 N(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function C(){var e=document.createElement("a");return e.href="",e.href}function w(e,t,r,n){return"src"===r||"href"===r&&n&&("use"!==t||"#"!==n[0])||"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(b),!(r>=t.length);){var o=n(T);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?g(n,C()):"object"===t&&"data"===r&&n?k(e,n):n:k(e,n)}function S(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&S(e.parentNode,t,r);for(var n=e.classList.length;n--;){var a=e.classList[n];if(t.test(a))return!0}return!!r&&S(e.parentNode,t,r)}function x(e,t,r){var n=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===n)return!1;if("string"==typeof t){if(n.classList.contains(t))return!0;if(n.closest(".".concat(t)))return!0}else if(S(n,t,!0))return!0;if(r){if(n.matches(r))return!0;if(n.closest(r))return!0}return!1}function I(t,r){var n=r.doc,a=r.mirror,o=r.blockClass,s=r.blockSelector,d=r.maskTextClass,m=r.maskTextSelector,h=r.inlineStylesheet,v=r.maskInputOptions,y=void 0===v?{}:v,T=r.maskTextFn,b=r.maskInputFn,k=r.dataURLOptions,S=void 0===k?{}:k,I=r.inlineImages,E=r.recordCanvas,L=r.keepIframeSrcFn,M=r.newlyAddedElement,O=void 0!==M&&M,D=function(e,t){if(!t.hasNode(e))return;var r=t.getId(e);return 1===r?void 0:r}(n,a);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:e.NodeType.Document,childNodes:[],compatMode:t.compatMode,rootId:D}:{type:e.NodeType.Document,childNodes:[],rootId:D};case t.DOCUMENT_TYPE_NODE:return{type:e.NodeType.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:D};case t.ELEMENT_NODE:return function(t,r){for(var n=r.doc,a=r.blockClass,o=r.blockSelector,s=r.inlineStylesheet,d=r.maskInputOptions,m=void 0===d?{}:d,h=r.maskInputFn,v=r.dataURLOptions,y=void 0===v?{}:v,T=r.inlineImages,b=r.recordCanvas,k=r.keepIframeSrcFn,S=r.newlyAddedElement,x=void 0!==S&&S,I=r.rootId,E=function(e,t,r){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var n=e.classList.length;n--;){var a=e.classList[n];if(t.test(a))return!0}return!!r&&e.matches(r)}(t,a,o),L=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return p.test(t)?"div":t}(t),M={},O=t.attributes.length,D=0;D<O;D++){var _=t.attributes[D];M[_.name]=w(n,L,_.name,_.value)}if("link"===L&&s){var A=Array.from(n.styleSheets).find((function(e){return e.href===t.href})),R=null;A&&(R=f(A)),R&&(delete M.rel,delete M.href,M._cssText=g(R,A.href))}if("style"===L&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){(R=f(t.sheet))&&(M._cssText=g(R,C()))}if("input"===L||"textarea"===L||"select"===L){var F=t.value;"radio"!==M.type&&"checkbox"!==M.type&&"submit"!==M.type&&"button"!==M.type&&F?M.value=i({type:M.type,tagName:L,value:F,maskInputOptions:m,maskInputFn:h}):t.checked&&(M.checked=t.checked)}"option"===L&&(t.selected&&!m.select?M.selected=!0:delete M.selected);if("canvas"===L&&b)if("2d"===t.__context)c(t)||(M.rr_dataURL=t.toDataURL(y.type,y.quality));else if(!("__context"in t)){var U=t.toDataURL(y.type,y.quality),W=document.createElement("canvas");W.width=t.width,W.height=t.height,U!==W.toDataURL(y.type,y.quality)&&(M.rr_dataURL=U)}if("img"===L&&T){l||(l=n.createElement("canvas"),u=l.getContext("2d"));var j=t,P=j.crossOrigin;j.crossOrigin="anonymous";var B=function(){try{l.width=j.naturalWidth,l.height=j.naturalHeight,u.drawImage(j,0,0),M.rr_dataURL=l.toDataURL(y.type,y.quality)}catch(e){console.warn("Cannot inline img src=".concat(j.currentSrc,"! Error: ").concat(e))}P?M.crossOrigin=P:j.removeAttribute("crossorigin")};j.complete&&0!==j.naturalWidth?B():j.onload=B}"audio"!==L&&"video"!==L||(M.rr_mediaState=t.paused?"paused":"played",M.rr_mediaCurrentTime=t.currentTime);x||(t.scrollLeft&&(M.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(M.rr_scrollTop=t.scrollTop));if(E){var H=t.getBoundingClientRect(),z=H.width,G=H.height;M={class:M.class,rr_width:"".concat(z,"px"),rr_height:"".concat(G,"px")}}"iframe"!==L||k(M.src)||(t.contentDocument||(M.rr_src=M.src),delete M.src);return{type:e.NodeType.Element,tagName:L,attributes:M,childNodes:[],isSVG:N(t)||void 0,needBlock:E,rootId:I}}(t,{doc:n,blockClass:o,blockSelector:s,inlineStylesheet:h,maskInputOptions:y,maskInputFn:b,dataURLOptions:S,inlineImages:I,recordCanvas:E,keepIframeSrcFn:L,newlyAddedElement:O,rootId:D});case t.TEXT_NODE:return function(t,r){var n,a=r.maskTextClass,o=r.maskTextSelector,i=r.maskTextFn,s=r.rootId,c=t.parentNode&&t.parentNode.tagName,l=t.textContent,u="STYLE"===c||void 0,d="SCRIPT"===c||void 0;if(u&&l){try{t.nextSibling||t.previousSibling||(null===(n=t.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(l=(p=t.parentNode.sheet).cssRules?Array.from(p.cssRules).map((function(e){return e.cssText||""})).join(""):"")}catch(e){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(e),t)}l=g(l,C())}var p;d&&(l="SCRIPT_PLACEHOLDER");!u&&!d&&l&&x(t,a,o)&&(l=i?i(l):l.replace(/[\S]/g,"*"));return{type:e.NodeType.Text,textContent:l||"",isStyle:u,rootId:s}}(t,{maskTextClass:d,maskTextSelector:m,maskTextFn:T,rootId:D});case t.CDATA_SECTION_NODE:return{type:e.NodeType.CDATA,textContent:"",rootId:D};case t.COMMENT_NODE:return{type:e.NodeType.Comment,textContent:t.textContent||"",rootId:D};default:return!1}}function E(e){return void 0===e?"":e.toLowerCase()}function L(t,o){var i,s=o.doc,c=o.mirror,l=o.blockClass,u=o.blockSelector,p=o.maskTextClass,f=o.maskTextSelector,m=o.skipChild,h=void 0!==m&&m,v=o.inlineStylesheet,y=void 0===v||v,g=o.maskInputOptions,T=void 0===g?{}:g,b=o.maskTextFn,k=o.maskInputFn,N=o.slimDOMOptions,C=o.dataURLOptions,w=void 0===C?{}:C,S=o.inlineImages,x=void 0!==S&&S,M=o.recordCanvas,O=void 0!==M&&M,D=o.onSerialize,_=o.onIframeLoad,A=o.iframeLoadTimeout,R=void 0===A?5e3:A,F=o.onStylesheetLoad,U=o.stylesheetLoadTimeout,W=void 0===U?5e3:U,j=o.keepIframeSrcFn,P=void 0===j?function(){return!1}:j,B=o.newlyAddedElement,H=void 0!==B&&B,z=o.preserveWhiteSpace,G=void 0===z||z,q=I(t,{doc:s,mirror:c,blockClass:l,blockSelector:u,maskTextClass:p,maskTextSelector:f,inlineStylesheet:y,maskInputOptions:T,maskTextFn:b,maskInputFn:k,dataURLOptions:w,inlineImages:x,recordCanvas:O,keepIframeSrcFn:P,newlyAddedElement:H});if(!q)return console.warn(t,"not serialized"),null;if(-2===(i=c.hasNode(t)?c.getId(t):!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&&(E(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===E(t.attributes.name)||"icon"===E(t.attributes.rel)||"apple-touch-icon"===E(t.attributes.rel)||"shortcut icon"===E(t.attributes.rel))))return!0;if("meta"===t.tagName){if(r.headMetaDescKeywords&&E(t.attributes.name).match(/^description|keywords$/))return!0;if(r.headMetaSocial&&(E(t.attributes.property).match(/^(og|twitter|fb):/)||E(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===E(t.attributes.name)))return!0;if(r.headMetaRobots&&("robots"===E(t.attributes.name)||"googlebot"===E(t.attributes.name)||"bingbot"===E(t.attributes.name)))return!0;if(r.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(r.headMetaAuthorship&&("author"===E(t.attributes.name)||"generator"===E(t.attributes.name)||"framework"===E(t.attributes.name)||"publisher"===E(t.attributes.name)||"progid"===E(t.attributes.name)||E(t.attributes.property).match(/^article:/)||E(t.attributes.property).match(/^product:/)))return!0;if(r.headMetaVerification&&("google-site-verification"===E(t.attributes.name)||"yandex-verification"===E(t.attributes.name)||"csrf-token"===E(t.attributes.name)||"p:domain_verify"===E(t.attributes.name)||"verify-v1"===E(t.attributes.name)||"verification"===E(t.attributes.name)||"shopify-checkout-api-token"===E(t.attributes.name)))return!0}}return!1}(q,N)&&(G||q.type!==e.NodeType.Text||q.isStyle||q.textContent.replace(/^\s+|\s+$/gm,"").length)?d++:-2))return null;var V=Object.assign(q,{id:i});c.add(t,V),D&&D(t);var $,Y=!h;if(V.type===e.NodeType.Element){Y=Y&&!V.needBlock,delete V.needBlock;var X=t.shadowRoot;X&&a(X)&&(V.isShadowHost=!0)}if((V.type===e.NodeType.Document||V.type===e.NodeType.Element)&&Y){N.headWhitespace&&V.type===e.NodeType.Element&&"head"===V.tagName&&(G=!1);for(var K={doc:s,mirror:c,blockClass:l,blockSelector:u,maskTextClass:p,maskTextSelector:f,skipChild:h,inlineStylesheet:y,maskInputOptions:T,maskTextFn:b,maskInputFn:k,slimDOMOptions:N,dataURLOptions:w,inlineImages:x,recordCanvas:O,preserveWhiteSpace:G,onSerialize:D,onIframeLoad:_,iframeLoadTimeout:R,onStylesheetLoad:F,stylesheetLoadTimeout:W,keepIframeSrcFn:P},Z=0,J=Array.from(t.childNodes);Z<J.length;Z++){(te=L(J[Z],K))&&V.childNodes.push(te)}if(r(t)&&t.shadowRoot)for(var Q=0,ee=Array.from(t.shadowRoot.childNodes);Q<ee.length;Q++){var te;(te=L(ee[Q],K))&&(a(t.shadowRoot)&&(te.isShadow=!0),V.childNodes.push(te))}}return t.parentNode&&n(t.parentNode)&&a(t.parentNode)&&(V.isShadow=!0),V.type===e.NodeType.Element&&"iframe"===V.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&&_){var r=L(e,{doc:e,mirror:c,blockClass:l,blockSelector:u,maskTextClass:p,maskTextSelector:f,skipChild:!1,inlineStylesheet:y,maskInputOptions:T,maskTextFn:b,maskInputFn:k,slimDOMOptions:N,dataURLOptions:w,inlineImages:x,recordCanvas:O,preserveWhiteSpace:G,onSerialize:D,onIframeLoad:_,iframeLoadTimeout:R,onStylesheetLoad:F,stylesheetLoadTimeout:W,keepIframeSrcFn:P});r&&_(t,r)}}),R),V.type===e.NodeType.Element&&"link"===V.tagName&&"stylesheet"===V.attributes.rel&&(function(e,t,r){var n,a=!1;try{n=e.sheet}catch(e){return}if(!n){var o=setTimeout((function(){a||(t(),a=!0)}),r);e.addEventListener("load",(function(){clearTimeout(o),a=!0,t()}))}}(t,(function(){if(F){var e=L(t,{doc:s,mirror:c,blockClass:l,blockSelector:u,maskTextClass:p,maskTextSelector:f,skipChild:!1,inlineStylesheet:y,maskInputOptions:T,maskTextFn:b,maskInputFn:k,slimDOMOptions:N,dataURLOptions:w,inlineImages:x,recordCanvas:O,preserveWhiteSpace:G,onSerialize:D,onIframeLoad:_,iframeLoadTimeout:R,onStylesheetLoad:F,stylesheetLoadTimeout:W,keepIframeSrcFn:P});e&&F(t,e)}}),W),!1==(!($=t).getAttribute("href")||null!==$.sheet))?null:V}var M=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function O(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),f(),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("".concat(t.source||"",":").concat(r,":").concat(n,": ").concat(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 p(/^{\s*/)}function u(){return p(/^}/)}function d(){var t,r=[];for(f(),m(r);e.length&&"}"!==e.charAt(0)&&(t=S()||x());)!1!==t&&(r.push(t),m(r));return r}function p(t){var r=t.exec(e);if(r){var n=r[0];return a(n),e=e.slice(n.length),r}}function f(){p(/^\s*/)}function m(e){var t;for(void 0===e&&(e=[]);t=h();)!1!==t&&e.push(t),t=h();return e}function h(){var t=o();if("/"===e.charAt(0)&&"*"===e.charAt(1)){for(var r=2;""!==e.charAt(r)&&("*"!==e.charAt(r)||"/"!==e.charAt(r+1));)++r;if(r+=2,""===e.charAt(r-1))return c("End of comment missing");var i=e.slice(2,r-2);return n+=2,a(i),e=e.slice(r),n+=2,t({type:"comment",comment:i})}}function v(){var e=p(/^([^{]+)/);if(e)return 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 y(){var e=o(),t=p(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(t){var r=D(t[0]);if(!p(/^:\s*/))return c("property missing ':'");var n=p(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),a=e({type:"declaration",property:r.replace(M,""),value:n?D(n[0]).replace(M,""):""});return p(/^[;\s]*/),a}}function g(){var e,t=[];if(!l())return c("missing '{'");for(m(t);e=y();)!1!==e&&(t.push(e),m(t)),e=y();return u()?t:c("missing '}'")}function T(){for(var e,t=[],r=o();e=p(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),p(/^,\s*/);if(t.length)return r({type:"keyframe",values:t,declarations:g()})}var b,k=w("import"),N=w("charset"),C=w("namespace");function w(e){var t=new RegExp("^@"+e+"\\s*([^;]+);");return function(){var r=o(),n=p(t);if(n){var a={type:e};return a[e]=n[1].trim(),r(a)}}}function S(){if("@"===e[0])return function(){var e=o(),t=p(/^@([-\w]+)?keyframes\s*/);if(t){var r=t[1];if(!(t=p(/^([-\w]+)\s*/)))return c("@keyframes missing name");var n,a=t[1];if(!l())return c("@keyframes missing '{'");for(var i=m();n=T();)i.push(n),i=i.concat(m());return u()?e({type:"keyframes",name:a,vendor:r,keyframes:i}):c("@keyframes missing '}'")}}()||function(){var e=o(),t=p(/^@media *([^{]+)/);if(t){var r=D(t[1]);if(!l())return c("@media missing '{'");var n=m().concat(d());return u()?e({type:"media",media:r,rules:n}):c("@media missing '}'")}}()||function(){var e=o(),t=p(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:D(t[1]),media:D(t[2])})}()||function(){var e=o(),t=p(/^@supports *([^{]+)/);if(t){var r=D(t[1]);if(!l())return c("@supports missing '{'");var n=m().concat(d());return u()?e({type:"supports",supports:r,rules:n}):c("@supports missing '}'")}}()||k()||N()||C()||function(){var e=o(),t=p(/^@([-\w]+)?document *([^{]+)/);if(t){var r=D(t[1]),n=D(t[2]);if(!l())return c("@document missing '{'");var a=m().concat(d());return u()?e({type:"document",document:n,vendor:r,rules:a}):c("@document missing '}'")}}()||function(){var e=o();if(p(/^@page */)){var t=v()||[];if(!l())return c("@page missing '{'");for(var r,n=m();r=y();)n.push(r),n=n.concat(m());return u()?e({type:"page",selectors:t,declarations:n}):c("@page missing '}'")}}()||function(){var e=o();if(p(/^@host\s*/)){if(!l())return c("@host missing '{'");var t=m().concat(d());return u()?e({type:"host",rules:t}):c("@host missing '}'")}}()||function(){var e=o();if(p(/^@font-face\s*/)){if(!l())return c("@font-face missing '{'");for(var t,r=m();t=y();)r.push(t),r=r.concat(m());return u()?e({type:"font-face",declarations:r}):c("@font-face missing '}'")}}()}function x(){var e=o(),t=v();return t?(m(),e({type:"rule",selectors:t,declarations:g()})):c("selector missing")}return _((b=d(),{type:"stylesheet",stylesheet:{source:t.source,rules:b,parsingErrors:s}}))}function D(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 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"};var R=/([^\\]):hover/,F=new RegExp(R.source,"g");function U(e,t){var r=null==t?void 0:t.stylesWithHoverClass.get(e);if(r)return r;var n=O(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){R.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(F,"$1.\\:hover");return"".concat(e,", ").concat(t)}));return null==t||t.stylesWithHoverClass.set(e,i),i}function W(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=A[e.tagName]?A[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(!Object.prototype.hasOwnProperty.call(t.attributes,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.onload=function(){var e=i.getContext("2d");e&&e.drawImage(c,0,0,c.width,c.height)},c.src=r,i.RRNodeType&&(i.rr_dataURL=r)}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,d="style"===s&&"_cssText"===e;if(d&&a&&(r=U(r,o)),u||d){for(var p=n.createTextNode(r),f=0,m=Array.from(i.childNodes);f<m.length;f++){var h=m[f];h.nodeType===i.TEXT_NODE&&i.removeChild(h)}return i.appendChild(p),"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?U(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 j(t,n){var a=n.doc,o=n.mirror,i=n.skipChild,s=void 0!==i&&i,c=n.hackCss,l=void 0===c||c,u=n.afterAppend,d=n.cache,p=W(t,{doc:a,hackCss:l,cache:d});if(!p)return null;if(t.rootId&&console.assert(o.getNode(t.rootId)===a,"Target document should have 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" "">')),p=a),o.add(p,t),(t.type===e.NodeType.Document||t.type===e.NodeType.Element)&&!s)for(var f=0,m=t.childNodes;f<m.length;f++){var h=m[f],v=j(h,{doc:a,mirror:o,skipChild:!1,hackCss:l,afterAppend:u,cache:d});v?(h.isShadow&&r(p)&&p.shadowRoot?p.shadowRoot.appendChild(v):p.appendChild(v),u&&u(v)):console.warn("Failed to rebuild",h)}return p}return e.IGNORED_NODE=-2,e.Mirror=o,e.addHoverClass=U,e.buildNodeWithSN=j,e.classMatchesRegex=S,e.cleanupSnapshot=function(){d=1},e.createCache=function(){return{stylesWithHoverClass:new Map}},e.createMirror=function(){return new o},e.is2DCanvasBlank=c,e.isElement=r,e.isNativeShadowDom=a,e.isShadowRoot=n,e.maskInputValue=i,e.needMaskingText=x,e.rebuild=function(t,r){var n=r.doc,a=r.onVisit,i=r.hackCss,s=void 0===i||i,c=r.afterAppend,l=r.cache,u=r.mirror,d=void 0===u?new o:u,p=j(t,{doc:n,mirror:d,skipChild:!1,hackCss:s,afterAppend:c,cache:l});return function(e,t){for(var r=0,n=e.getIds();r<n.length;r++){var a=n[r];e.has(a)&&t(e.getNode(a))}}(d,(function(t){a&&a(t),function(t,r){var n=r.getMeta(t);if((null==n?void 0:n.type)===e.NodeType.Element){var a=t;for(var o in n.attributes)if(Object.prototype.hasOwnProperty.call(n.attributes,o)&&o.startsWith("rr_")){var i=n.attributes[o];"rr_scrollLeft"===o&&(a.scrollLeft=i),"rr_scrollTop"===o&&(a.scrollTop=i)}}}(t,d)})),p},e.serializeNodeWithId=L,e.snapshot=function(e,t){var r=t||{},n=r.mirror,a=void 0===n?new o:n,i=r.blockClass,s=void 0===i?"rr-block":i,c=r.blockSelector,l=void 0===c?null:c,u=r.maskTextClass,d=void 0===u?"rr-mask":u,p=r.maskTextSelector,f=void 0===p?null:p,m=r.inlineStylesheet,h=void 0===m||m,v=r.inlineImages,y=void 0!==v&&v,g=r.recordCanvas,T=void 0!==g&&g,b=r.maskAllInputs,k=void 0!==b&&b,N=r.maskTextFn,C=r.maskInputFn,w=r.slimDOM,S=void 0!==w&&w,x=r.dataURLOptions,I=r.preserveWhiteSpace,E=r.onSerialize,M=r.onIframeLoad,O=r.iframeLoadTimeout,D=r.onStylesheetLoad,_=r.stylesheetLoadTimeout,A=r.keepIframeSrcFn;return L(e,{doc:e,mirror:a,blockClass:s,blockSelector:l,maskTextClass:d,maskTextSelector:f,skipChild:!1,inlineStylesheet:h,maskInputOptions:!0===k?{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===k?{password:!0}:k,maskTextFn:N,maskInputFn:C,slimDOMOptions:!0===S||"all"===S?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===S,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===S?{}:S,dataURLOptions:x,inlineImages:y,recordCanvas:T,preserveWhiteSpace:I,onSerialize:E,onIframeLoad:M,iframeLoadTimeout:O,onStylesheetLoad:D,stylesheetLoadTimeout:_,keepIframeSrcFn:void 0===A?function(){return!1}:A,newlyAddedElement:!1})},e.transformAttribute=w,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}({}); | ||
//# sourceMappingURL=rrweb-snapshot.min.js.map |
@@ -1,2 +0,2 @@ | ||
var e;function t(e){return e.nodeType===e.ELEMENT_NODE}function r(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(e||(e={}));var n=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var r=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=r?r:-1},e.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},e.prototype.removeNodeFromMap=function(e){var t=this,r=this.getId(e);this.idNodeMap.delete(r),e.childNodes&&e.childNodes.forEach((function(e){return t.removeNodeFromMap(e)}))},e.prototype.has=function(e){return this.idNodeMap.has(e)},e.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},e.prototype.add=function(e,t){var r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function a(){return new n}function o(e){var t=e.maskInputOptions,r=e.tagName,n=e.type,a=e.value,o=e.maskInputFn,i=a||"";return(t[r.toLowerCase()]||t[n])&&(i=o?o(i):"*".repeat(i.length)),i}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,o="__rrweb_original__"in a?a.__rrweb_original__:a;if(new Uint32Array(o.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-_:]"),d=-2;function f(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).map(m).join(""):null}catch(e){return null}}function m(e){var t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=f(e.styleSheet)||t}catch(e){}return t}var p=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,h=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,v=/^(data:)([^,]*),(.*)/i;function g(e,t){return(e||"").replace(p,(function(e,r,n,a,o,i){var s,c=n||o||i,l=r||a||"";if(!c)return e;if(!h.test(c))return"url(".concat(l).concat(c).concat(l,")");if(v.test(c))return"url(".concat(l).concat(c).concat(l,")");if("/"===c[0])return"url(".concat(l).concat((s=t,(s.indexOf("//")>-1?s.split("/").slice(0,3).join("/"):s.split("/")[0]).split("?")[0]+c)).concat(l,")");var u=t.split("/"),d=c.split("/");u.pop();for(var f=0,m=d;f<m.length;f++){var p=m[f];"."!==p&&(".."===p?u.pop():u.push(p))}return"url(".concat(l).concat(u.join("/")).concat(l,")")}))}var y=/^[^ \t\n\r\u000c]+/,k=/^[, \t\n\r\u000c]+/;function b(e,t){if(!t||""===t.trim())return t;var r=e.createElement("a");return r.href=t,r.href}function T(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function C(){var e=document.createElement("a");return e.href="",e.href}function w(e,t,r,n){return"src"===r||"href"===r&&n||"xlink:href"===r&&n&&"#"!==n[0]?b(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(k),!(r>=t.length);){var o=n(y);if(","===o.slice(-1))o=b(e,o.substring(0,o.length-1)),a.push(o);else{var i="";o=b(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?g(n,C()):"object"===t&&"data"===r&&n?b(e,n):n:b(e,n)}function S(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&S(e.parentNode,t,r);for(var n=e.classList.length;n--;){var a=e.classList[n];if(t.test(a))return!0}return!!r&&S(e.parentNode,t,r)}function x(e,t,r){var n=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===n)return!1;if("string"==typeof t){if(n.classList.contains(t))return!0;if(n.closest(".".concat(t)))return!0}else if(S(n,t,!0))return!0;if(r){if(n.matches(r))return!0;if(n.closest(r))return!0}return!1}function I(t,r){var n=r.doc,a=r.mirror,l=r.blockClass,d=r.blockSelector,m=r.maskTextClass,p=r.maskTextSelector,h=r.inlineStylesheet,v=r.maskInputOptions,y=void 0===v?{}:v,k=r.maskTextFn,b=r.maskInputFn,S=r.dataURLOptions,I=void 0===S?{}:S,E=r.inlineImages,N=r.recordCanvas,L=r.keepIframeSrcFn,M=r.newlyAddedElement,O=void 0!==M&&M,D=function(e,t){if(!t.hasNode(e))return;var r=t.getId(e);return 1===r?void 0:r}(n,a);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:e.Document,childNodes:[],compatMode:t.compatMode,rootId:D}:{type:e.Document,childNodes:[],rootId:D};case t.DOCUMENT_TYPE_NODE:return{type:e.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:D};case t.ELEMENT_NODE:return function(t,r){for(var n=r.doc,a=r.blockClass,l=r.blockSelector,d=r.inlineStylesheet,m=r.maskInputOptions,p=void 0===m?{}:m,h=r.maskInputFn,v=r.dataURLOptions,y=void 0===v?{}:v,k=r.inlineImages,b=r.recordCanvas,S=r.keepIframeSrcFn,x=r.newlyAddedElement,I=void 0!==x&&x,E=r.rootId,N=function(e,t,r){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var n=e.classList.length;n--;){var a=e.classList[n];if(t.test(a))return!0}return!!r&&e.matches(r)}(t,a,l),L=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return u.test(t)?"div":t}(t),M={},O=t.attributes.length,D=0;D<O;D++){var _=t.attributes[D];M[_.name]=w(n,L,_.name,_.value)}if("link"===L&&d){var A=Array.from(n.styleSheets).find((function(e){return e.href===t.href})),R=null;A&&(R=f(A)),R&&(delete M.rel,delete M.href,M._cssText=g(R,A.href))}if("style"===L&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){(R=f(t.sheet))&&(M._cssText=g(R,C()))}if("input"===L||"textarea"===L||"select"===L){var F=t.value;"radio"!==M.type&&"checkbox"!==M.type&&"submit"!==M.type&&"button"!==M.type&&F?M.value=o({type:M.type,tagName:L,value:F,maskInputOptions:p,maskInputFn:h}):t.checked&&(M.checked=t.checked)}"option"===L&&(t.selected&&!p.select?M.selected=!0:delete M.selected);if("canvas"===L&&b)if("2d"===t.__context)i(t)||(M.rr_dataURL=t.toDataURL(y.type,y.quality));else if(!("__context"in t)){var U=t.toDataURL(y.type,y.quality),W=document.createElement("canvas");W.width=t.width,W.height=t.height,U!==W.toDataURL(y.type,y.quality)&&(M.rr_dataURL=U)}if("img"===L&&k){s||(s=n.createElement("canvas"),c=s.getContext("2d"));var j=t,P=j.crossOrigin;j.crossOrigin="anonymous";var B=function(){try{s.width=j.naturalWidth,s.height=j.naturalHeight,c.drawImage(j,0,0),M.rr_dataURL=s.toDataURL(y.type,y.quality)}catch(e){console.warn("Cannot inline img src=".concat(j.currentSrc,"! Error: ").concat(e))}P?M.crossOrigin=P:j.removeAttribute("crossorigin")};j.complete&&0!==j.naturalWidth?B():j.onload=B}"audio"!==L&&"video"!==L||(M.rr_mediaState=t.paused?"paused":"played",M.rr_mediaCurrentTime=t.currentTime);I||(t.scrollLeft&&(M.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(M.rr_scrollTop=t.scrollTop));if(N){var H=t.getBoundingClientRect(),z=H.width,G=H.height;M={class:M.class,rr_width:"".concat(z,"px"),rr_height:"".concat(G,"px")}}"iframe"!==L||S(M.src)||(t.contentDocument||(M.rr_src=M.src),delete M.src);return{type:e.Element,tagName:L,attributes:M,childNodes:[],isSVG:T(t)||void 0,needBlock:N,rootId:E}}(t,{doc:n,blockClass:l,blockSelector:d,inlineStylesheet:h,maskInputOptions:y,maskInputFn:b,dataURLOptions:I,inlineImages:E,recordCanvas:N,keepIframeSrcFn:L,newlyAddedElement:O,rootId:D});case t.TEXT_NODE:return function(t,r){var n,a=r.maskTextClass,o=r.maskTextSelector,i=r.maskTextFn,s=r.rootId,c=t.parentNode&&t.parentNode.tagName,l=t.textContent,u="STYLE"===c||void 0,d="SCRIPT"===c||void 0;if(u&&l){try{t.nextSibling||t.previousSibling||(null===(n=t.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(l=(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: ".concat(e),t)}l=g(l,C())}var f;d&&(l="SCRIPT_PLACEHOLDER");!u&&!d&&l&&x(t,a,o)&&(l=i?i(l):l.replace(/[\S]/g,"*"));return{type:e.Text,textContent:l||"",isStyle:u,rootId:s}}(t,{maskTextClass:m,maskTextSelector:p,maskTextFn:k,rootId:D});case t.CDATA_SECTION_NODE:return{type:e.CDATA,textContent:"",rootId:D};case t.COMMENT_NODE:return{type:e.Comment,textContent:t.textContent||"",rootId:D};default:return!1}}function E(e){return void 0===e?"":e.toLowerCase()}function N(n,a){var o,i=a.doc,s=a.mirror,c=a.blockClass,u=a.blockSelector,d=a.maskTextClass,f=a.maskTextSelector,m=a.skipChild,p=void 0!==m&&m,h=a.inlineStylesheet,v=void 0===h||h,g=a.maskInputOptions,y=void 0===g?{}:g,k=a.maskTextFn,b=a.maskInputFn,T=a.slimDOMOptions,C=a.dataURLOptions,w=void 0===C?{}:C,S=a.inlineImages,x=void 0!==S&&S,L=a.recordCanvas,M=void 0!==L&&L,O=a.onSerialize,D=a.onIframeLoad,_=a.iframeLoadTimeout,A=void 0===_?5e3:_,R=a.onStylesheetLoad,F=a.stylesheetLoadTimeout,U=void 0===F?5e3:F,W=a.keepIframeSrcFn,j=void 0===W?function(){return!1}:W,P=a.newlyAddedElement,B=void 0!==P&&P,H=a.preserveWhiteSpace,z=void 0===H||H,G=I(n,{doc:i,mirror:s,blockClass:c,blockSelector:u,maskTextClass:d,maskTextSelector:f,inlineStylesheet:v,maskInputOptions:y,maskTextFn:k,maskInputFn:b,dataURLOptions:w,inlineImages:x,recordCanvas:M,keepIframeSrcFn:j,newlyAddedElement:B});if(!G)return console.warn(n,"not serialized"),null;if(-2===(o=s.hasNode(n)?s.getId(n):!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&&(E(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===E(t.attributes.name)||"icon"===E(t.attributes.rel)||"apple-touch-icon"===E(t.attributes.rel)||"shortcut icon"===E(t.attributes.rel))))return!0;if("meta"===t.tagName){if(r.headMetaDescKeywords&&E(t.attributes.name).match(/^description|keywords$/))return!0;if(r.headMetaSocial&&(E(t.attributes.property).match(/^(og|twitter|fb):/)||E(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===E(t.attributes.name)))return!0;if(r.headMetaRobots&&("robots"===E(t.attributes.name)||"googlebot"===E(t.attributes.name)||"bingbot"===E(t.attributes.name)))return!0;if(r.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(r.headMetaAuthorship&&("author"===E(t.attributes.name)||"generator"===E(t.attributes.name)||"framework"===E(t.attributes.name)||"publisher"===E(t.attributes.name)||"progid"===E(t.attributes.name)||E(t.attributes.property).match(/^article:/)||E(t.attributes.property).match(/^product:/)))return!0;if(r.headMetaVerification&&("google-site-verification"===E(t.attributes.name)||"yandex-verification"===E(t.attributes.name)||"csrf-token"===E(t.attributes.name)||"p:domain_verify"===E(t.attributes.name)||"verify-v1"===E(t.attributes.name)||"verification"===E(t.attributes.name)||"shopify-checkout-api-token"===E(t.attributes.name)))return!0}}return!1}(G,T)&&(z||G.type!==e.Text||G.isStyle||G.textContent.replace(/^\s+|\s+$/gm,"").length)?l++:-2))return null;var q=Object.assign(G,{id:o});s.add(n,q),O&&O(n);var V,$=!p;if(q.type===e.Element&&($=$&&!q.needBlock,delete q.needBlock,n.shadowRoot&&(q.isShadowHost=!0)),(q.type===e.Document||q.type===e.Element)&&$){T.headWhitespace&&q.type===e.Element&&"head"===q.tagName&&(z=!1);for(var Y={doc:i,mirror:s,blockClass:c,blockSelector:u,maskTextClass:d,maskTextSelector:f,skipChild:p,inlineStylesheet:v,maskInputOptions:y,maskTextFn:k,maskInputFn:b,slimDOMOptions:T,dataURLOptions:w,inlineImages:x,recordCanvas:M,preserveWhiteSpace:z,onSerialize:O,onIframeLoad:D,iframeLoadTimeout:A,onStylesheetLoad:R,stylesheetLoadTimeout:U,keepIframeSrcFn:j},X=0,K=Array.from(n.childNodes);X<K.length;X++){(Q=N(K[X],Y))&&q.childNodes.push(Q)}if(t(n)&&n.shadowRoot)for(var Z=0,J=Array.from(n.shadowRoot.childNodes);Z<J.length;Z++){var Q;(Q=N(J[Z],Y))&&(Q.isShadow=!0,q.childNodes.push(Q))}}return n.parentNode&&r(n.parentNode)&&(q.isShadow=!0),q.type===e.Element&&"iframe"===q.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()}))}}}(n,(function(){var e=n.contentDocument;if(e&&D){var t=N(e,{doc:e,mirror:s,blockClass:c,blockSelector:u,maskTextClass:d,maskTextSelector:f,skipChild:!1,inlineStylesheet:v,maskInputOptions:y,maskTextFn:k,maskInputFn:b,slimDOMOptions:T,dataURLOptions:w,inlineImages:x,recordCanvas:M,preserveWhiteSpace:z,onSerialize:O,onIframeLoad:D,iframeLoadTimeout:A,onStylesheetLoad:R,stylesheetLoadTimeout:U,keepIframeSrcFn:j});t&&D(n,t)}}),A),q.type===e.Element&&"link"===q.tagName&&"stylesheet"===q.attributes.rel&&(function(e,t,r){var n,a=!1;try{n=e.sheet}catch(e){return}if(!n){var o=setTimeout((function(){a||(t(),a=!0)}),r);e.addEventListener("load",(function(){clearTimeout(o),a=!0,t()}))}}(n,(function(){if(R){var e=N(n,{doc:i,mirror:s,blockClass:c,blockSelector:u,maskTextClass:d,maskTextSelector:f,skipChild:!1,inlineStylesheet:v,maskInputOptions:y,maskTextFn:k,maskInputFn:b,slimDOMOptions:T,dataURLOptions:w,inlineImages:x,recordCanvas:M,preserveWhiteSpace:z,onSerialize:O,onIframeLoad:D,iframeLoadTimeout:A,onStylesheetLoad:R,stylesheetLoadTimeout:U,keepIframeSrcFn:j});e&&R(n,e)}}),U),!1==(!(V=n).getAttribute("href")||null!==V.sheet))?null:q}function L(e,t){var r=t||{},a=r.mirror,o=void 0===a?new n:a,i=r.blockClass,s=void 0===i?"rr-block":i,c=r.blockSelector,l=void 0===c?null:c,u=r.maskTextClass,d=void 0===u?"rr-mask":u,f=r.maskTextSelector,m=void 0===f?null:f,p=r.inlineStylesheet,h=void 0===p||p,v=r.inlineImages,g=void 0!==v&&v,y=r.recordCanvas,k=void 0!==y&&y,b=r.maskAllInputs,T=void 0!==b&&b,C=r.maskTextFn,w=r.maskInputFn,S=r.slimDOM,x=void 0!==S&&S,I=r.dataURLOptions,E=r.preserveWhiteSpace,L=r.onSerialize,M=r.onIframeLoad,O=r.iframeLoadTimeout,D=r.onStylesheetLoad,_=r.stylesheetLoadTimeout,A=r.keepIframeSrcFn;return N(e,{doc:e,mirror:o,blockClass:s,blockSelector:l,maskTextClass:d,maskTextSelector:m,skipChild:!1,inlineStylesheet:h,maskInputOptions:!0===T?{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===T?{password:!0}:T,maskTextFn:C,maskInputFn:w,slimDOMOptions:!0===x||"all"===x?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===x,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===x?{}:x,dataURLOptions:I,inlineImages:g,recordCanvas:k,preserveWhiteSpace:E,onSerialize:L,onIframeLoad:M,iframeLoadTimeout:O,onStylesheetLoad:D,stylesheetLoadTimeout:_,keepIframeSrcFn:void 0===A?function(){return!1}:A,newlyAddedElement:!1})}function M(t,r){!function t(n){r(n),n.type!==e.Document&&n.type!==e.Element||n.childNodes.forEach(t)}(t)}function O(){l=1}var D=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function _(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("".concat(t.source||"",":").concat(r,":").concat(n,": ").concat(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 d(){var t,r=[];for(m(),p(r);e.length&&"}"!==e.charAt(0)&&(t=x()||I());)!1!==t&&(r.push(t),p(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 p(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 A(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=o(),t=f(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(t){var r=A(t[0]);if(!f(/^:\s*/))return c("property missing ':'");var n=f(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),a=e({type:"declaration",property:r.replace(D,""),value:n?A(n[0]).replace(D,""):""});return f(/^[;\s]*/),a}}function y(){var e,t=[];if(!l())return c("missing '{'");for(p(t);e=g();)!1!==e&&(t.push(e),p(t)),e=g();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:y()})}var b,T=S("import"),C=S("charset"),w=S("namespace");function S(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 x(){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=p();n=k();)i.push(n),i=i.concat(p());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=A(t[1]);if(!l())return c("@media missing '{'");var n=p().concat(d());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:A(t[1]),media:A(t[2])})}()||function(){var e=o(),t=f(/^@supports *([^{]+)/);if(t){var r=A(t[1]);if(!l())return c("@supports missing '{'");var n=p().concat(d());return u()?e({type:"supports",supports:r,rules:n}):c("@supports missing '}'")}}()||T()||C()||w()||function(){var e=o(),t=f(/^@([-\w]+)?document *([^{]+)/);if(t){var r=A(t[1]),n=A(t[2]);if(!l())return c("@document missing '{'");var a=p().concat(d());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=p();r=g();)n.push(r),n=n.concat(p());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=p().concat(d());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=p();t=g();)r.push(t),r=r.concat(p());return u()?e({type:"font-face",declarations:r}):c("@font-face missing '}'")}}()}function I(){var e=o(),t=v();return t?(p(),e({type:"rule",selectors:t,declarations:y()})):c("selector missing")}return R((b=d(),{type:"stylesheet",stylesheet:{source:t.source,rules:b,parsingErrors:s}}))}function A(e){return e?e.replace(/^\s+|\s+$/g,""):""}function R(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){R(e,n)})):i&&"object"==typeof i&&R(i,n)}return r&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var F={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 U=/([^\\]):hover/,W=new RegExp(U.source,"g");function j(e,t){var r=null==t?void 0:t.stylesWithHoverClass.get(e);if(r)return r;var 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){U.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(W,"$1.\\:hover");return"".concat(e,", ").concat(t)}));return null==t||t.stylesWithHoverClass.set(e,i),i}function P(){return{stylesWithHoverClass:new Map}}function B(t,r){var n=r.doc,a=r.hackCss,o=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 i,s=function(e){var t=F[e.tagName]?F[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(!Object.prototype.hasOwnProperty.call(t.attributes,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,d="style"===s&&"_cssText"===e;if(d&&a&&(r=j(r,o)),u||d){for(var f=n.createTextNode(r),m=0,p=Array.from(i.childNodes);m<p.length;m++){var h=p[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.Text:return n.createTextNode(t.isStyle&&a?j(t.textContent,o):t.textContent);case e.CDATA:return n.createCDATASection(t.textContent);case e.Comment:return n.createComment(t.textContent);default:return null}}function H(r,n){var a=n.doc,o=n.mirror,i=n.skipChild,s=void 0!==i&&i,c=n.hackCss,l=void 0===c||c,u=n.afterAppend,d=n.cache,f=B(r,{doc:a,hackCss:l,cache:d});if(!f)return null;if(r.rootId&&console.assert(o.getNode(r.rootId)===a,"Target document should have 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" "">')),f=a),o.add(f,r),(r.type===e.Document||r.type===e.Element)&&!s)for(var m=0,p=r.childNodes;m<p.length;m++){var h=p[m],v=H(h,{doc:a,mirror:o,skipChild:!1,hackCss:l,afterAppend:u,cache:d});v?(h.isShadow&&t(f)&&f.shadowRoot?f.shadowRoot.appendChild(v):f.appendChild(v),u&&u(v)):console.warn("Failed to rebuild",h)}return f}function z(t,r){var a=r.doc,o=r.onVisit,i=r.hackCss,s=void 0===i||i,c=r.afterAppend,l=r.cache,u=r.mirror,d=void 0===u?new n:u,f=H(t,{doc:a,mirror:d,skipChild:!1,hackCss:s,afterAppend:c,cache:l});return function(e,t){for(var r=0,n=e.getIds();r<n.length;r++){var a=n[r];e.has(a)&&t(e.getNode(a))}}(d,(function(t){o&&o(t),function(t,r){var n=r.getMeta(t);if((null==n?void 0:n.type)===e.Element){var a=t;for(var o in n.attributes)if(Object.prototype.hasOwnProperty.call(n.attributes,o)&&o.startsWith("rr_")){var i=n.attributes[o];"rr_scrollLeft"===o&&(a.scrollLeft=i),"rr_scrollTop"===o&&(a.scrollTop=i)}}}(t,d)})),f}export{d as IGNORED_NODE,n as Mirror,e as NodeType,j as addHoverClass,H as buildNodeWithSN,S as classMatchesRegex,O as cleanupSnapshot,P as createCache,a as createMirror,i as is2DCanvasBlank,t as isElement,r as isShadowRoot,o as maskInputValue,x as needMaskingText,z as rebuild,N as serializeNodeWithId,L as snapshot,w as transformAttribute,M as visitSnapshot}; | ||
var e;function t(e){return e.nodeType===e.ELEMENT_NODE}function r(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function n(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(e||(e={}));var a=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var r=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=r?r:-1},e.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},e.prototype.removeNodeFromMap=function(e){var t=this,r=this.getId(e);this.idNodeMap.delete(r),e.childNodes&&e.childNodes.forEach((function(e){return t.removeNodeFromMap(e)}))},e.prototype.has=function(e){return this.idNodeMap.has(e)},e.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},e.prototype.add=function(e,t){var r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function o(){return new a}function i(e){var t=e.maskInputOptions,r=e.tagName,n=e.type,a=e.value,o=e.maskInputFn,i=a||"";return(t[r.toLowerCase()]||t[n])&&(i=o?o(i):"*".repeat(i.length)),i}function s(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,o="__rrweb_original__"in a?a.__rrweb_original__:a;if(new Uint32Array(o.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 c,l,u=1,d=new RegExp("[^a-z0-9-_:]"),f=-2;function m(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).map(p).join(""):null}catch(e){return null}}function p(e){var t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=m(e.styleSheet)||t}catch(e){}return t}var h=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,v=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,g=/^(data:)([^,]*),(.*)/i;function y(e,t){return(e||"").replace(h,(function(e,r,n,a,o,i){var s,c=n||o||i,l=r||a||"";if(!c)return e;if(!v.test(c))return"url(".concat(l).concat(c).concat(l,")");if(g.test(c))return"url(".concat(l).concat(c).concat(l,")");if("/"===c[0])return"url(".concat(l).concat((s=t,(s.indexOf("//")>-1?s.split("/").slice(0,3).join("/"):s.split("/")[0]).split("?")[0]+c)).concat(l,")");var u=t.split("/"),d=c.split("/");u.pop();for(var f=0,m=d;f<m.length;f++){var p=m[f];"."!==p&&(".."===p?u.pop():u.push(p))}return"url(".concat(l).concat(u.join("/")).concat(l,")")}))}var k=/^[^ \t\n\r\u000c]+/,b=/^[, \t\n\r\u000c]+/;function T(e,t){if(!t||""===t.trim())return t;var r=e.createElement("a");return r.href=t,r.href}function C(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function w(){var e=document.createElement("a");return e.href="",e.href}function S(e,t,r,n){return"src"===r||"href"===r&&n&&("use"!==t||"#"!==n[0])||"xlink:href"===r&&n&&"#"!==n[0]?T(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(b),!(r>=t.length);){var o=n(k);if(","===o.slice(-1))o=T(e,o.substring(0,o.length-1)),a.push(o);else{var i="";o=T(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?y(n,w()):"object"===t&&"data"===r&&n?T(e,n):n:T(e,n)}function x(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&x(e.parentNode,t,r);for(var n=e.classList.length;n--;){var a=e.classList[n];if(t.test(a))return!0}return!!r&&x(e.parentNode,t,r)}function N(e,t,r){var n=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===n)return!1;if("string"==typeof t){if(n.classList.contains(t))return!0;if(n.closest(".".concat(t)))return!0}else if(x(n,t,!0))return!0;if(r){if(n.matches(r))return!0;if(n.closest(r))return!0}return!1}function I(t,r){var n=r.doc,a=r.mirror,o=r.blockClass,u=r.blockSelector,f=r.maskTextClass,p=r.maskTextSelector,h=r.inlineStylesheet,v=r.maskInputOptions,g=void 0===v?{}:v,k=r.maskTextFn,b=r.maskInputFn,T=r.dataURLOptions,x=void 0===T?{}:T,I=r.inlineImages,E=r.recordCanvas,L=r.keepIframeSrcFn,M=r.newlyAddedElement,O=void 0!==M&&M,D=function(e,t){if(!t.hasNode(e))return;var r=t.getId(e);return 1===r?void 0:r}(n,a);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:e.Document,childNodes:[],compatMode:t.compatMode,rootId:D}:{type:e.Document,childNodes:[],rootId:D};case t.DOCUMENT_TYPE_NODE:return{type:e.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:D};case t.ELEMENT_NODE:return function(t,r){for(var n=r.doc,a=r.blockClass,o=r.blockSelector,u=r.inlineStylesheet,f=r.maskInputOptions,p=void 0===f?{}:f,h=r.maskInputFn,v=r.dataURLOptions,g=void 0===v?{}:v,k=r.inlineImages,b=r.recordCanvas,T=r.keepIframeSrcFn,x=r.newlyAddedElement,N=void 0!==x&&x,I=r.rootId,E=function(e,t,r){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var n=e.classList.length;n--;){var a=e.classList[n];if(t.test(a))return!0}return!!r&&e.matches(r)}(t,a,o),L=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return d.test(t)?"div":t}(t),M={},O=t.attributes.length,D=0;D<O;D++){var _=t.attributes[D];M[_.name]=S(n,L,_.name,_.value)}if("link"===L&&u){var A=Array.from(n.styleSheets).find((function(e){return e.href===t.href})),R=null;A&&(R=m(A)),R&&(delete M.rel,delete M.href,M._cssText=y(R,A.href))}if("style"===L&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){(R=m(t.sheet))&&(M._cssText=y(R,w()))}if("input"===L||"textarea"===L||"select"===L){var F=t.value;"radio"!==M.type&&"checkbox"!==M.type&&"submit"!==M.type&&"button"!==M.type&&F?M.value=i({type:M.type,tagName:L,value:F,maskInputOptions:p,maskInputFn:h}):t.checked&&(M.checked=t.checked)}"option"===L&&(t.selected&&!p.select?M.selected=!0:delete M.selected);if("canvas"===L&&b)if("2d"===t.__context)s(t)||(M.rr_dataURL=t.toDataURL(g.type,g.quality));else if(!("__context"in t)){var U=t.toDataURL(g.type,g.quality),W=document.createElement("canvas");W.width=t.width,W.height=t.height,U!==W.toDataURL(g.type,g.quality)&&(M.rr_dataURL=U)}if("img"===L&&k){c||(c=n.createElement("canvas"),l=c.getContext("2d"));var j=t,P=j.crossOrigin;j.crossOrigin="anonymous";var B=function(){try{c.width=j.naturalWidth,c.height=j.naturalHeight,l.drawImage(j,0,0),M.rr_dataURL=c.toDataURL(g.type,g.quality)}catch(e){console.warn("Cannot inline img src=".concat(j.currentSrc,"! Error: ").concat(e))}P?M.crossOrigin=P:j.removeAttribute("crossorigin")};j.complete&&0!==j.naturalWidth?B():j.onload=B}"audio"!==L&&"video"!==L||(M.rr_mediaState=t.paused?"paused":"played",M.rr_mediaCurrentTime=t.currentTime);N||(t.scrollLeft&&(M.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(M.rr_scrollTop=t.scrollTop));if(E){var H=t.getBoundingClientRect(),z=H.width,G=H.height;M={class:M.class,rr_width:"".concat(z,"px"),rr_height:"".concat(G,"px")}}"iframe"!==L||T(M.src)||(t.contentDocument||(M.rr_src=M.src),delete M.src);return{type:e.Element,tagName:L,attributes:M,childNodes:[],isSVG:C(t)||void 0,needBlock:E,rootId:I}}(t,{doc:n,blockClass:o,blockSelector:u,inlineStylesheet:h,maskInputOptions:g,maskInputFn:b,dataURLOptions:x,inlineImages:I,recordCanvas:E,keepIframeSrcFn:L,newlyAddedElement:O,rootId:D});case t.TEXT_NODE:return function(t,r){var n,a=r.maskTextClass,o=r.maskTextSelector,i=r.maskTextFn,s=r.rootId,c=t.parentNode&&t.parentNode.tagName,l=t.textContent,u="STYLE"===c||void 0,d="SCRIPT"===c||void 0;if(u&&l){try{t.nextSibling||t.previousSibling||(null===(n=t.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(l=(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: ".concat(e),t)}l=y(l,w())}var f;d&&(l="SCRIPT_PLACEHOLDER");!u&&!d&&l&&N(t,a,o)&&(l=i?i(l):l.replace(/[\S]/g,"*"));return{type:e.Text,textContent:l||"",isStyle:u,rootId:s}}(t,{maskTextClass:f,maskTextSelector:p,maskTextFn:k,rootId:D});case t.CDATA_SECTION_NODE:return{type:e.CDATA,textContent:"",rootId:D};case t.COMMENT_NODE:return{type:e.Comment,textContent:t.textContent||"",rootId:D};default:return!1}}function E(e){return void 0===e?"":e.toLowerCase()}function L(a,o){var i,s=o.doc,c=o.mirror,l=o.blockClass,d=o.blockSelector,f=o.maskTextClass,m=o.maskTextSelector,p=o.skipChild,h=void 0!==p&&p,v=o.inlineStylesheet,g=void 0===v||v,y=o.maskInputOptions,k=void 0===y?{}:y,b=o.maskTextFn,T=o.maskInputFn,C=o.slimDOMOptions,w=o.dataURLOptions,S=void 0===w?{}:w,x=o.inlineImages,N=void 0!==x&&x,M=o.recordCanvas,O=void 0!==M&&M,D=o.onSerialize,_=o.onIframeLoad,A=o.iframeLoadTimeout,R=void 0===A?5e3:A,F=o.onStylesheetLoad,U=o.stylesheetLoadTimeout,W=void 0===U?5e3:U,j=o.keepIframeSrcFn,P=void 0===j?function(){return!1}:j,B=o.newlyAddedElement,H=void 0!==B&&B,z=o.preserveWhiteSpace,G=void 0===z||z,q=I(a,{doc:s,mirror:c,blockClass:l,blockSelector:d,maskTextClass:f,maskTextSelector:m,inlineStylesheet:g,maskInputOptions:k,maskTextFn:b,maskInputFn:T,dataURLOptions:S,inlineImages:N,recordCanvas:O,keepIframeSrcFn:P,newlyAddedElement:H});if(!q)return console.warn(a,"not serialized"),null;if(-2===(i=c.hasNode(a)?c.getId(a):!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&&(E(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===E(t.attributes.name)||"icon"===E(t.attributes.rel)||"apple-touch-icon"===E(t.attributes.rel)||"shortcut icon"===E(t.attributes.rel))))return!0;if("meta"===t.tagName){if(r.headMetaDescKeywords&&E(t.attributes.name).match(/^description|keywords$/))return!0;if(r.headMetaSocial&&(E(t.attributes.property).match(/^(og|twitter|fb):/)||E(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===E(t.attributes.name)))return!0;if(r.headMetaRobots&&("robots"===E(t.attributes.name)||"googlebot"===E(t.attributes.name)||"bingbot"===E(t.attributes.name)))return!0;if(r.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(r.headMetaAuthorship&&("author"===E(t.attributes.name)||"generator"===E(t.attributes.name)||"framework"===E(t.attributes.name)||"publisher"===E(t.attributes.name)||"progid"===E(t.attributes.name)||E(t.attributes.property).match(/^article:/)||E(t.attributes.property).match(/^product:/)))return!0;if(r.headMetaVerification&&("google-site-verification"===E(t.attributes.name)||"yandex-verification"===E(t.attributes.name)||"csrf-token"===E(t.attributes.name)||"p:domain_verify"===E(t.attributes.name)||"verify-v1"===E(t.attributes.name)||"verification"===E(t.attributes.name)||"shopify-checkout-api-token"===E(t.attributes.name)))return!0}}return!1}(q,C)&&(G||q.type!==e.Text||q.isStyle||q.textContent.replace(/^\s+|\s+$/gm,"").length)?u++:-2))return null;var V=Object.assign(q,{id:i});c.add(a,V),D&&D(a);var $,Y=!h;if(V.type===e.Element){Y=Y&&!V.needBlock,delete V.needBlock;var X=a.shadowRoot;X&&n(X)&&(V.isShadowHost=!0)}if((V.type===e.Document||V.type===e.Element)&&Y){C.headWhitespace&&V.type===e.Element&&"head"===V.tagName&&(G=!1);for(var K={doc:s,mirror:c,blockClass:l,blockSelector:d,maskTextClass:f,maskTextSelector:m,skipChild:h,inlineStylesheet:g,maskInputOptions:k,maskTextFn:b,maskInputFn:T,slimDOMOptions:C,dataURLOptions:S,inlineImages:N,recordCanvas:O,preserveWhiteSpace:G,onSerialize:D,onIframeLoad:_,iframeLoadTimeout:R,onStylesheetLoad:F,stylesheetLoadTimeout:W,keepIframeSrcFn:P},Z=0,J=Array.from(a.childNodes);Z<J.length;Z++){(te=L(J[Z],K))&&V.childNodes.push(te)}if(t(a)&&a.shadowRoot)for(var Q=0,ee=Array.from(a.shadowRoot.childNodes);Q<ee.length;Q++){var te;(te=L(ee[Q],K))&&(n(a.shadowRoot)&&(te.isShadow=!0),V.childNodes.push(te))}}return a.parentNode&&r(a.parentNode)&&n(a.parentNode)&&(V.isShadow=!0),V.type===e.Element&&"iframe"===V.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()}))}}}(a,(function(){var e=a.contentDocument;if(e&&_){var t=L(e,{doc:e,mirror:c,blockClass:l,blockSelector:d,maskTextClass:f,maskTextSelector:m,skipChild:!1,inlineStylesheet:g,maskInputOptions:k,maskTextFn:b,maskInputFn:T,slimDOMOptions:C,dataURLOptions:S,inlineImages:N,recordCanvas:O,preserveWhiteSpace:G,onSerialize:D,onIframeLoad:_,iframeLoadTimeout:R,onStylesheetLoad:F,stylesheetLoadTimeout:W,keepIframeSrcFn:P});t&&_(a,t)}}),R),V.type===e.Element&&"link"===V.tagName&&"stylesheet"===V.attributes.rel&&(function(e,t,r){var n,a=!1;try{n=e.sheet}catch(e){return}if(!n){var o=setTimeout((function(){a||(t(),a=!0)}),r);e.addEventListener("load",(function(){clearTimeout(o),a=!0,t()}))}}(a,(function(){if(F){var e=L(a,{doc:s,mirror:c,blockClass:l,blockSelector:d,maskTextClass:f,maskTextSelector:m,skipChild:!1,inlineStylesheet:g,maskInputOptions:k,maskTextFn:b,maskInputFn:T,slimDOMOptions:C,dataURLOptions:S,inlineImages:N,recordCanvas:O,preserveWhiteSpace:G,onSerialize:D,onIframeLoad:_,iframeLoadTimeout:R,onStylesheetLoad:F,stylesheetLoadTimeout:W,keepIframeSrcFn:P});e&&F(a,e)}}),W),!1==(!($=a).getAttribute("href")||null!==$.sheet))?null:V}function M(e,t){var r=t||{},n=r.mirror,o=void 0===n?new a:n,i=r.blockClass,s=void 0===i?"rr-block":i,c=r.blockSelector,l=void 0===c?null:c,u=r.maskTextClass,d=void 0===u?"rr-mask":u,f=r.maskTextSelector,m=void 0===f?null:f,p=r.inlineStylesheet,h=void 0===p||p,v=r.inlineImages,g=void 0!==v&&v,y=r.recordCanvas,k=void 0!==y&&y,b=r.maskAllInputs,T=void 0!==b&&b,C=r.maskTextFn,w=r.maskInputFn,S=r.slimDOM,x=void 0!==S&&S,N=r.dataURLOptions,I=r.preserveWhiteSpace,E=r.onSerialize,M=r.onIframeLoad,O=r.iframeLoadTimeout,D=r.onStylesheetLoad,_=r.stylesheetLoadTimeout,A=r.keepIframeSrcFn;return L(e,{doc:e,mirror:o,blockClass:s,blockSelector:l,maskTextClass:d,maskTextSelector:m,skipChild:!1,inlineStylesheet:h,maskInputOptions:!0===T?{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===T?{password:!0}:T,maskTextFn:C,maskInputFn:w,slimDOMOptions:!0===x||"all"===x?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===x,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===x?{}:x,dataURLOptions:N,inlineImages:g,recordCanvas:k,preserveWhiteSpace:I,onSerialize:E,onIframeLoad:M,iframeLoadTimeout:O,onStylesheetLoad:D,stylesheetLoadTimeout:_,keepIframeSrcFn:void 0===A?function(){return!1}:A,newlyAddedElement:!1})}function O(t,r){!function t(n){r(n),n.type!==e.Document&&n.type!==e.Element||n.childNodes.forEach(t)}(t)}function D(){u=1}var _=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function A(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("".concat(t.source||"",":").concat(r,":").concat(n,": ").concat(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 d(){var t,r=[];for(m(),p(r);e.length&&"}"!==e.charAt(0)&&(t=x()||N());)!1!==t&&(r.push(t),p(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 p(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 R(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=o(),t=f(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(t){var r=R(t[0]);if(!f(/^:\s*/))return c("property missing ':'");var n=f(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),a=e({type:"declaration",property:r.replace(_,""),value:n?R(n[0]).replace(_,""):""});return f(/^[;\s]*/),a}}function y(){var e,t=[];if(!l())return c("missing '{'");for(p(t);e=g();)!1!==e&&(t.push(e),p(t)),e=g();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:y()})}var b,T=S("import"),C=S("charset"),w=S("namespace");function S(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 x(){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=p();n=k();)i.push(n),i=i.concat(p());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=R(t[1]);if(!l())return c("@media missing '{'");var n=p().concat(d());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:R(t[1]),media:R(t[2])})}()||function(){var e=o(),t=f(/^@supports *([^{]+)/);if(t){var r=R(t[1]);if(!l())return c("@supports missing '{'");var n=p().concat(d());return u()?e({type:"supports",supports:r,rules:n}):c("@supports missing '}'")}}()||T()||C()||w()||function(){var e=o(),t=f(/^@([-\w]+)?document *([^{]+)/);if(t){var r=R(t[1]),n=R(t[2]);if(!l())return c("@document missing '{'");var a=p().concat(d());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=p();r=g();)n.push(r),n=n.concat(p());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=p().concat(d());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=p();t=g();)r.push(t),r=r.concat(p());return u()?e({type:"font-face",declarations:r}):c("@font-face missing '}'")}}()}function N(){var e=o(),t=v();return t?(p(),e({type:"rule",selectors:t,declarations:y()})):c("selector missing")}return F((b=d(),{type:"stylesheet",stylesheet:{source:t.source,rules:b,parsingErrors:s}}))}function R(e){return e?e.replace(/^\s+|\s+$/g,""):""}function F(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){F(e,n)})):i&&"object"==typeof i&&F(i,n)}return r&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var U={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 W=/([^\\]):hover/,j=new RegExp(W.source,"g");function P(e,t){var r=null==t?void 0:t.stylesWithHoverClass.get(e);if(r)return r;var n=A(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){W.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(j,"$1.\\:hover");return"".concat(e,", ").concat(t)}));return null==t||t.stylesWithHoverClass.set(e,i),i}function B(){return{stylesWithHoverClass:new Map}}function H(t,r){var n=r.doc,a=r.hackCss,o=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 i,s=function(e){var t=U[e.tagName]?U[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(!Object.prototype.hasOwnProperty.call(t.attributes,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.onload=function(){var e=i.getContext("2d");e&&e.drawImage(c,0,0,c.width,c.height)},c.src=r,i.RRNodeType&&(i.rr_dataURL=r)}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,d="style"===s&&"_cssText"===e;if(d&&a&&(r=P(r,o)),u||d){for(var f=n.createTextNode(r),m=0,p=Array.from(i.childNodes);m<p.length;m++){var h=p[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.Text:return n.createTextNode(t.isStyle&&a?P(t.textContent,o):t.textContent);case e.CDATA:return n.createCDATASection(t.textContent);case e.Comment:return n.createComment(t.textContent);default:return null}}function z(r,n){var a=n.doc,o=n.mirror,i=n.skipChild,s=void 0!==i&&i,c=n.hackCss,l=void 0===c||c,u=n.afterAppend,d=n.cache,f=H(r,{doc:a,hackCss:l,cache:d});if(!f)return null;if(r.rootId&&console.assert(o.getNode(r.rootId)===a,"Target document should have 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" "">')),f=a),o.add(f,r),(r.type===e.Document||r.type===e.Element)&&!s)for(var m=0,p=r.childNodes;m<p.length;m++){var h=p[m],v=z(h,{doc:a,mirror:o,skipChild:!1,hackCss:l,afterAppend:u,cache:d});v?(h.isShadow&&t(f)&&f.shadowRoot?f.shadowRoot.appendChild(v):f.appendChild(v),u&&u(v)):console.warn("Failed to rebuild",h)}return f}function G(t,r){var n=r.doc,o=r.onVisit,i=r.hackCss,s=void 0===i||i,c=r.afterAppend,l=r.cache,u=r.mirror,d=void 0===u?new a:u,f=z(t,{doc:n,mirror:d,skipChild:!1,hackCss:s,afterAppend:c,cache:l});return function(e,t){for(var r=0,n=e.getIds();r<n.length;r++){var a=n[r];e.has(a)&&t(e.getNode(a))}}(d,(function(t){o&&o(t),function(t,r){var n=r.getMeta(t);if((null==n?void 0:n.type)===e.Element){var a=t;for(var o in n.attributes)if(Object.prototype.hasOwnProperty.call(n.attributes,o)&&o.startsWith("rr_")){var i=n.attributes[o];"rr_scrollLeft"===o&&(a.scrollLeft=i),"rr_scrollTop"===o&&(a.scrollTop=i)}}}(t,d)})),f}export{f as IGNORED_NODE,a as Mirror,e as NodeType,P as addHoverClass,z as buildNodeWithSN,x as classMatchesRegex,D as cleanupSnapshot,B as createCache,o as createMirror,s as is2DCanvasBlank,t as isElement,n as isNativeShadowDom,r as isShadowRoot,i as maskInputValue,N as needMaskingText,G as rebuild,L as serializeNodeWithId,M as snapshot,S as transformAttribute,O as visitSnapshot}; | ||
//# sourceMappingURL=rrweb-snapshot.min.js.map |
{ | ||
"name": "rrweb-snapshot", | ||
"version": "2.0.0-alpha.0", | ||
"version": "2.0.0-alpha.1", | ||
"description": "rrweb's component to take a snapshot of DOM, aka DOM serializer", | ||
@@ -45,3 +45,3 @@ "scripts": { | ||
"@types/jest": "^27.0.2", | ||
"@types/jsdom": "^16.2.4", | ||
"@types/jsdom": "^20.0.0", | ||
"@types/node": "^10.11.3", | ||
@@ -62,3 +62,3 @@ "@types/puppeteer": "^1.12.4", | ||
}, | ||
"gitHead": "2d4dd2296670387c7a7d652c1dd5e66fad8d64c1" | ||
"gitHead": "abc035fd00972c3ffa1a9cf379b46f53cb74d394" | ||
} |
import { MaskInputFn, MaskInputOptions, IMirror, serializedNodeWithId } from './types'; | ||
export declare function isElement(n: Node): n is Element; | ||
export declare function isShadowRoot(n: Node): n is ShadowRoot; | ||
export declare function isNativeShadowDom(shadowRoot: ShadowRoot): boolean; | ||
export declare class Mirror implements IMirror<Node> { | ||
@@ -5,0 +6,0 @@ private idNodeMap; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
274671
6041