core-outline 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +2 -0
- package/.eslintrc.json +23 -0
- package/.prettierignore +2 -0
- package/.prettierrc +7 -0
- package/.storybook/main.js +7 -7
- package/dist/index.es.js +3979 -15
- package/dist/index.js +3985 -15
- package/package.json +8 -2
- package/rollup.config.js +35 -35
- package/src/components/CoreOutline/CoreOutline.js +70 -45
- package/src/components/CoreOutline/RWebRecorder.js +26 -26
- package/src/components/CoreOutline/index.js +1 -1
- package/src/index.js +1 -1
- package/src/stories/Button.jsx +0 -40
- package/src/stories/Button.stories.js +0 -49
- package/src/stories/Configure.mdx +0 -364
- package/src/stories/Header.jsx +0 -60
- package/src/stories/Header.stories.js +0 -29
- package/src/stories/Page.jsx +0 -69
- package/src/stories/Page.stories.js +0 -28
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +0 -1
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +0 -1
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +0 -1
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +0 -1
- package/src/stories/assets/youtube.svg +0 -1
- package/src/stories/button.css +0 -30
- package/src/stories/header.css +0 -32
- package/src/stories/page.css +0 -69
package/dist/index.es.js
CHANGED
|
@@ -1,15 +1,3979 @@
|
|
|
1
|
-
import e,{useRef as t,useEffect as n}from"react";var o;function r(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function s(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function a(e){try{var t=e.rules||e.cssRules;return t?((n=Array.from(t).map(i).join("")).includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")&&(n=n.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),n):null}catch(e){return null}var n}function i(e){var t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=a(e.styleSheet)||t}catch(e){}return t}!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"}(o||(o={}));var c=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-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,n=this.getId(e);this.idNodeMap.delete(n),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 n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){var n=this.getNode(e);if(n){var o=this.nodeMetaMap.get(n);o&&this.nodeMetaMap.set(t,o)}this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function l(e){var t=e.maskInputOptions,n=e.tagName,o=e.type,r=e.value,s=e.maskInputFn,a=r||"";return(t[n.toLowerCase()]||t[o])&&(a=s?s(a):"*".repeat(a.length)),a}var d="__rrweb_original__";var u,h,p=1,g=new RegExp("[^a-z0-9-_:]");function m(){return p++}var I=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,C=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,f=/^(data:)([^,]*),(.*)/i;function y(e,t){return(e||"").replace(I,(function(e,n,o,r,s,a){var i,c=o||s||a,l=n||r||"";if(!c)return e;if(!C.test(c))return"url(".concat(l).concat(c).concat(l,")");if(f.test(c))return"url(".concat(l).concat(c).concat(l,")");if("/"===c[0])return"url(".concat(l).concat((i=t,(i.indexOf("//")>-1?i.split("/").slice(0,3).join("/"):i.split("/")[0]).split("?")[0]+c)).concat(l,")");var d=t.split("/"),u=c.split("/");d.pop();for(var h=0,p=u;h<p.length;h++){var g=p[h];"."!==g&&(".."===g?d.pop():d.push(g))}return"url(".concat(l).concat(d.join("/")).concat(l,")")}))}var S=/^[^ \t\n\r\u000c]+/,b=/^[, \t\n\r\u000c]+/;function v(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function A(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function k(){var e=document.createElement("a");return e.href="",e.href}function w(e,t,n,o){return"src"===n||"href"===n&&o&&("use"!==t||"#"!==o[0])||"xlink:href"===n&&o&&"#"!==o[0]?v(e,o):"background"!==n||!o||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n&&o?function(e,t){if(""===t.trim())return t;var n=0;function o(e){var o,r=e.exec(t.substring(n));return r?(o=r[0],n+=o.length,o):""}for(var r=[];o(b),!(n>=t.length);){var s=o(S);if(","===s.slice(-1))s=v(e,s.substring(0,s.length-1)),r.push(s);else{var a="";s=v(e,s);for(var i=!1;;){var c=t.charAt(n);if(""===c){r.push((s+a).trim());break}if(i)")"===c&&(i=!1);else{if(","===c){n+=1,r.push((s+a).trim());break}"("===c&&(i=!0)}a+=c,n+=1}}}return r.join(", ")}(e,o):"style"===n&&o?y(o,k()):"object"===t&&"data"===n&&o?v(e,o):o:v(e,o)}function M(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&M(e.parentNode,t,n);for(var o=e.classList.length;o--;){var r=e.classList[o];if(t.test(r))return!0}return!!n&&M(e.parentNode,t,n)}function T(e,t,n){var o=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===o)return!1;if("string"==typeof t){if(o.classList.contains(t))return!0;if(o.closest(".".concat(t)))return!0}else if(M(o,t,!0))return!0;if(n){if(o.matches(n))return!0;if(o.closest(n))return!0}return!1}function N(e,t){var n=t.doc,r=t.mirror,s=t.blockClass,i=t.blockSelector,c=t.maskTextClass,p=t.maskTextSelector,m=t.inlineStylesheet,I=t.maskInputOptions,C=void 0===I?{}:I,f=t.maskTextFn,S=t.maskInputFn,b=t.dataURLOptions,v=void 0===b?{}:b,M=t.inlineImages,N=t.recordCanvas,R=t.keepIframeSrcFn,E=t.newlyAddedElement,O=void 0!==E&&E,F=function(e,t){if(!t.hasNode(e))return;var n=t.getId(e);return 1===n?void 0:n}(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:o.Document,childNodes:[],compatMode:e.compatMode}:{type:o.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:o.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:F};case e.ELEMENT_NODE:return function(e,t){for(var n=t.doc,r=t.blockClass,s=t.blockSelector,i=t.inlineStylesheet,c=t.maskInputOptions,p=void 0===c?{}:c,m=t.maskInputFn,I=t.dataURLOptions,C=void 0===I?{}:I,f=t.inlineImages,S=t.recordCanvas,b=t.keepIframeSrcFn,v=t.newlyAddedElement,M=void 0!==v&&v,T=t.rootId,N=function(e,t,n){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var o=e.classList.length;o--;){var r=e.classList[o];if(t.test(r))return!0}return!!n&&e.matches(n)}(e,r,s),R=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return g.test(t)?"div":t}(e),E={},O=e.attributes.length,F=0;F<O;F++){var x=e.attributes[F];E[x.name]=w(n,R,x.name,x.value)}if("link"===R&&i){var L=Array.from(n.styleSheets).find((function(t){return t.href===e.href})),D=null;L&&(D=a(L)),D&&(delete E.rel,delete E.href,E._cssText=y(D,L.href))}if("style"===R&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){(D=a(e.sheet))&&(E._cssText=y(D,k()))}if("input"===R||"textarea"===R||"select"===R){var W=e.value,Z=e.checked;"radio"!==E.type&&"checkbox"!==E.type&&"submit"!==E.type&&"button"!==E.type&&W?E.value=l({type:E.type,tagName:R,value:W,maskInputOptions:p,maskInputFn:m}):Z&&(E.checked=Z)}"option"===R&&(e.selected&&!p.select?E.selected=!0:delete E.selected);if("canvas"===R&&S)if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var n=0;n<e.width;n+=50)for(var o=0;o<e.height;o+=50){var r=t.getImageData,s=d in r?r[d]:r;if(new Uint32Array(s.call(t,n,o,Math.min(50,e.width-n),Math.min(50,e.height-o)).data.buffer).some((function(e){return 0!==e})))return!1}return!0})(e)||(E.rr_dataURL=e.toDataURL(C.type,C.quality));else if(!("__context"in e)){var B=e.toDataURL(C.type,C.quality),G=document.createElement("canvas");G.width=e.width,G.height=e.height,B!==G.toDataURL(C.type,C.quality)&&(E.rr_dataURL=B)}if("img"===R&&f){u||(u=n.createElement("canvas"),h=u.getContext("2d"));var V=e,U=V.crossOrigin;V.crossOrigin="anonymous";var K=function(){try{u.width=V.naturalWidth,u.height=V.naturalHeight,h.drawImage(V,0,0),E.rr_dataURL=u.toDataURL(C.type,C.quality)}catch(e){console.warn("Cannot inline img src=".concat(V.currentSrc,"! Error: ").concat(e))}U?E.crossOrigin=U:V.removeAttribute("crossorigin")};V.complete&&0!==V.naturalWidth?K():V.onload=K}"audio"!==R&&"video"!==R||(E.rr_mediaState=e.paused?"paused":"played",E.rr_mediaCurrentTime=e.currentTime);M||(e.scrollLeft&&(E.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(E.rr_scrollTop=e.scrollTop));if(N){var Y=e.getBoundingClientRect(),_=Y.width,J=Y.height;E={class:E.class,rr_width:"".concat(_,"px"),rr_height:"".concat(J,"px")}}"iframe"!==R||b(E.src)||(e.contentDocument||(E.rr_src=E.src),delete E.src);return{type:o.Element,tagName:R,attributes:E,childNodes:[],isSVG:A(e)||void 0,needBlock:N,rootId:T}}(e,{doc:n,blockClass:s,blockSelector:i,inlineStylesheet:m,maskInputOptions:C,maskInputFn:S,dataURLOptions:v,inlineImages:M,recordCanvas:N,keepIframeSrcFn:R,newlyAddedElement:O,rootId:F});case e.TEXT_NODE:return function(e,t){var n,r=t.maskTextClass,s=t.maskTextSelector,a=t.maskTextFn,i=t.rootId,c=e.parentNode&&e.parentNode.tagName,l=e.textContent,d="STYLE"===c||void 0,u="SCRIPT"===c||void 0;if(d&&l){try{e.nextSibling||e.previousSibling||(null===(n=e.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(l=(h=e.parentNode.sheet).cssRules?Array.from(h.cssRules).map((function(e){return e.cssText||""})).join(""):"")}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(t),e)}l=y(l,k())}var h;u&&(l="SCRIPT_PLACEHOLDER");!d&&!u&&l&&T(e,r,s)&&(l=a?a(l):l.replace(/[\S]/g,"*"));return{type:o.Text,textContent:l||"",isStyle:d,rootId:i}}(e,{maskTextClass:c,maskTextSelector:p,maskTextFn:f,rootId:F});case e.CDATA_SECTION_NODE:return{type:o.CDATA,textContent:"",rootId:F};case e.COMMENT_NODE:return{type:o.Comment,textContent:e.textContent||"",rootId:F};default:return!1}}function R(e){return void 0===e?"":e.toLowerCase()}function E(e,t){var n,a=t.doc,i=t.mirror,c=t.blockClass,l=t.blockSelector,d=t.maskTextClass,u=t.maskTextSelector,h=t.skipChild,p=void 0!==h&&h,g=t.inlineStylesheet,I=void 0===g||g,C=t.maskInputOptions,f=void 0===C?{}:C,y=t.maskTextFn,S=t.maskInputFn,b=t.slimDOMOptions,v=t.dataURLOptions,A=void 0===v?{}:v,k=t.inlineImages,w=void 0!==k&&k,M=t.recordCanvas,T=void 0!==M&&M,O=t.onSerialize,F=t.onIframeLoad,x=t.iframeLoadTimeout,L=void 0===x?5e3:x,D=t.onStylesheetLoad,W=t.stylesheetLoadTimeout,Z=void 0===W?5e3:W,B=t.keepIframeSrcFn,G=void 0===B?function(){return!1}:B,V=t.newlyAddedElement,U=void 0!==V&&V,K=t.preserveWhiteSpace,Y=void 0===K||K,_=N(e,{doc:a,mirror:i,blockClass:c,blockSelector:l,maskTextClass:d,maskTextSelector:u,inlineStylesheet:I,maskInputOptions:f,maskTextFn:y,maskInputFn:S,dataURLOptions:A,inlineImages:w,recordCanvas:T,keepIframeSrcFn:G,newlyAddedElement:U});if(!_)return console.warn(e,"not serialized"),null;n=i.hasNode(e)?i.getId(e):!function(e,t){if(t.comment&&e.type===o.Comment)return!0;if(e.type===o.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&"preload"===e.attributes.rel&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(R(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===R(e.attributes.name)||"icon"===R(e.attributes.rel)||"apple-touch-icon"===R(e.attributes.rel)||"shortcut icon"===R(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&R(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(R(e.attributes.property).match(/^(og|twitter|fb):/)||R(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===R(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===R(e.attributes.name)||"googlebot"===R(e.attributes.name)||"bingbot"===R(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===R(e.attributes.name)||"generator"===R(e.attributes.name)||"framework"===R(e.attributes.name)||"publisher"===R(e.attributes.name)||"progid"===R(e.attributes.name)||R(e.attributes.property).match(/^article:/)||R(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===R(e.attributes.name)||"yandex-verification"===R(e.attributes.name)||"csrf-token"===R(e.attributes.name)||"p:domain_verify"===R(e.attributes.name)||"verify-v1"===R(e.attributes.name)||"verification"===R(e.attributes.name)||"shopify-checkout-api-token"===R(e.attributes.name)))return!0}}return!1}(_,b)&&(Y||_.type!==o.Text||_.isStyle||_.textContent.replace(/^\s+|\s+$/gm,"").length)?m():-2;var J=Object.assign(_,{id:n});if(i.add(e,J),-2===n)return null;O&&O(e);var z=!p;if(J.type===o.Element){z=z&&!J.needBlock,delete J.needBlock;var Q=e.shadowRoot;Q&&s(Q)&&(J.isShadowHost=!0)}if((J.type===o.Document||J.type===o.Element)&&z){b.headWhitespace&&J.type===o.Element&&"head"===J.tagName&&(Y=!1);for(var H={doc:a,mirror:i,blockClass:c,blockSelector:l,maskTextClass:d,maskTextSelector:u,skipChild:p,inlineStylesheet:I,maskInputOptions:f,maskTextFn:y,maskInputFn:S,slimDOMOptions:b,dataURLOptions:A,inlineImages:w,recordCanvas:T,preserveWhiteSpace:Y,onSerialize:O,onIframeLoad:F,iframeLoadTimeout:L,onStylesheetLoad:D,stylesheetLoadTimeout:Z,keepIframeSrcFn:G},X=0,j=Array.from(e.childNodes);X<j.length;X++){($=E(j[X],H))&&J.childNodes.push($)}if(function(e){return e.nodeType===e.ELEMENT_NODE}(e)&&e.shadowRoot)for(var P=0,q=Array.from(e.shadowRoot.childNodes);P<q.length;P++){var $;($=E(q[P],H))&&(s(e.shadowRoot)&&($.isShadow=!0),J.childNodes.push($))}}return e.parentNode&&r(e.parentNode)&&s(e.parentNode)&&(J.isShadow=!0),J.type===o.Element&&"iframe"===J.tagName&&function(e,t,n){var o=e.contentWindow;if(o){var r,s=!1;try{r=o.document.readyState}catch(e){return}if("complete"===r){var a="about:blank";if(o.location.href!==a||e.src===a||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}else{var i=setTimeout((function(){s||(t(),s=!0)}),n);e.addEventListener("load",(function(){clearTimeout(i),s=!0,t()}))}}}(e,(function(){var t=e.contentDocument;if(t&&F){var n=E(t,{doc:t,mirror:i,blockClass:c,blockSelector:l,maskTextClass:d,maskTextSelector:u,skipChild:!1,inlineStylesheet:I,maskInputOptions:f,maskTextFn:y,maskInputFn:S,slimDOMOptions:b,dataURLOptions:A,inlineImages:w,recordCanvas:T,preserveWhiteSpace:Y,onSerialize:O,onIframeLoad:F,iframeLoadTimeout:L,onStylesheetLoad:D,stylesheetLoadTimeout:Z,keepIframeSrcFn:G});n&&F(e,n)}}),L),J.type===o.Element&&"link"===J.tagName&&"stylesheet"===J.attributes.rel&&function(e,t,n){var o,r=!1;try{o=e.sheet}catch(e){return}if(!o){var s=setTimeout((function(){r||(t(),r=!0)}),n);e.addEventListener("load",(function(){clearTimeout(s),r=!0,t()}))}}(e,(function(){if(D){var t=E(e,{doc:a,mirror:i,blockClass:c,blockSelector:l,maskTextClass:d,maskTextSelector:u,skipChild:!1,inlineStylesheet:I,maskInputOptions:f,maskTextFn:y,maskInputFn:S,slimDOMOptions:b,dataURLOptions:A,inlineImages:w,recordCanvas:T,preserveWhiteSpace:Y,onSerialize:O,onIframeLoad:F,iframeLoadTimeout:L,onStylesheetLoad:D,stylesheetLoadTimeout:Z,keepIframeSrcFn:G});t&&D(e,t)}}),Z),J}function O(e,t,n=document){const o={capture:!0,passive:!0};return n.addEventListener(e,t,o),()=>n.removeEventListener(e,t,o)}const F="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let x={map:{},getId:()=>(console.error(F),-1),getNode:()=>(console.error(F),null),removeNodeFromMap(){console.error(F)},has:()=>(console.error(F),!1),reset(){console.error(F)}};function L(e,t,n={}){let o=null,r=0;return function(...s){const a=Date.now();r||!1!==n.leading||(r=a);const i=t-(a-r),c=this;i<=0||i>t?(o&&(clearTimeout(o),o=null),r=a,e.apply(c,s)):o||!1===n.trailing||(o=setTimeout((()=>{r=!1===n.leading?0:Date.now(),o=null,e.apply(c,s)}),i))}}function D(e,t,n,o,r=window){const s=r.Object.getOwnPropertyDescriptor(e,t);return r.Object.defineProperty(e,t,o?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),s&&s.set&&s.set.call(this,e)}}),()=>D(e,t,s||{},!0)}function W(e,t,n){try{if(!(t in e))return()=>{};const o=e[t],r=n(o);return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:o}})),e[t]=r,()=>{e[t]=o}}catch(e){return()=>{}}}function Z(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function B(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function G(e,t,n,o){if(!e)return!1;const r=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(!r)return!1;if("string"==typeof t){if(r.classList.contains(t))return!0;if(o&&null!==r.closest("."+t))return!0}else if(M(r,t,o))return!0;if(n){if(e.matches(n))return!0;if(o&&null!==r.closest(n))return!0}return!1}function V(e,t){return-2===t.getId(e)}function U(e,t){if(r(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||U(e.parentNode,t))}function K(e){return Boolean(e.changedTouches)}function Y(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function _(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function J(e){return Boolean(null==e?void 0:e.shadowRoot)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(x=new Proxy(x,{get:(e,t,n)=>("map"===t&&console.error(F),Reflect.get(e,t,n))}));class z{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}var Q=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Q||{}),H=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e))(H||{}),X=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(X||{}),j=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(j||{});function P(e){return"__ln"in e}class q{constructor(){this.length=0,this.head=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&P(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&P(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next&&(t.next.previous=t.previous)):(this.head=t.next,this.head&&(this.head.previous=null)),e.__ln&&delete e.__ln,this.length--)}}const $=(e,t)=>`${e}@${t}`;class ee{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new q,n=e=>{let t=e,n=-2;for(;-2===n;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},o=o=>{var s,a,i,c;let l=null;(null===(a=null===(s=o.getRootNode)||void 0===s?void 0:s.call(o))||void 0===a?void 0:a.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&o.getRootNode().host&&(l=o.getRootNode().host);let d=l;for(;(null===(c=null===(i=null==d?void 0:d.getRootNode)||void 0===i?void 0:i.call(d))||void 0===c?void 0:c.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&d.getRootNode().host;)d=d.getRootNode().host;const u=!(this.doc.contains(o)||d&&this.doc.contains(d));if(!o.parentNode||u)return;const h=r(o.parentNode)?this.mirror.getId(l):this.mirror.getId(o.parentNode),p=n(o);if(-1===h||-1===p)return t.addNode(o);const g=E(o,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{Y(e,this.mirror)&&this.iframeManager.addIframe(e),_(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),J(o)&&this.shadowDomManager.addShadowRoot(o.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});g&&e.push({parentId:h,nextId:p,node:g})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of Array.from(this.movedSet.values()))ne(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||o(e);for(const e of Array.from(this.addedSet.values()))re(this.droppedSet,e)||ne(this.removes,e,this.mirror)?re(this.movedSet,e)?o(e):this.droppedSet.add(e):o(e);let s=null;for(;t.length;){let e=null;if(s){const t=this.mirror.getId(s.value.parentNode),o=n(s.value);-1!==t&&-1!==o&&(e=s)}if(!e)for(let o=t.length-1;o>=0;o--){const r=t.get(o);if(r){const t=this.mirror.getId(r.value.parentNode);if(-1===n(r.value))continue;if(-1!==t){e=r;break}{const t=r.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const n=t.parentNode.host;if(-1!==this.mirror.getId(n)){e=r;break}}}}}if(!e){for(;t.head;)t.removeNode(t.head.value);break}s=e.previous,t.removeNode(e.value),o(e.value)}const a={texts:this.texts.map((e=>({id:this.mirror.getId(e.node),value:e.value}))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>({id:this.mirror.getId(e.node),attributes:e.attributes}))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(a.texts.length||a.attributes.length||a.removes.length||a.adds.length)&&(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(a))},this.processMutation=e=>{if(!V(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;G(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:T(e.target,this.maskTextClass,this.maskTextSelector)&&t?this.maskTextFn?this.maskTextFn(t):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let n=e.target.getAttribute(e.attributeName);if("value"===e.attributeName&&(n=l({maskInputOptions:this.maskInputOptions,tagName:e.target.tagName,type:e.target.getAttribute("type"),value:n,maskInputFn:this.maskInputFn})),G(e.target,this.blockClass,this.blockSelector,!1)||n===e.oldValue)return;let o=this.attributes.find((t=>t.node===e.target));if("IFRAME"===t.tagName&&"src"===e.attributeName&&!this.keepIframeSrcFn(n)){if(t.contentDocument)return;e.attributeName="rr_src"}if(o||(o={node:e.target,attributes:{}},this.attributes.push(o)),"style"===e.attributeName){const n=this.doc.createElement("span");e.oldValue&&n.setAttribute("style",e.oldValue),void 0!==o.attributes.style&&null!==o.attributes.style||(o.attributes.style={});const r=o.attributes.style;for(const e of Array.from(t.style)){const o=t.style.getPropertyValue(e),s=t.style.getPropertyPriority(e);o===n.style.getPropertyValue(e)&&s===n.style.getPropertyPriority(e)||(r[e]=""===s?o:[o,s])}for(const e of Array.from(n.style))""===t.style.getPropertyValue(e)&&(r[e]=!1)}else o.attributes[e.attributeName]=w(this.doc,t.tagName,e.attributeName,n);break}case"childList":if(G(e.target,this.blockClass,this.blockSelector,!0))return;e.addedNodes.forEach((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{const n=this.mirror.getId(t),o=r(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);G(e.target,this.blockClass,this.blockSelector,!1)||V(t,this.mirror)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(te(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||U(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[$(n,o)]?te(this.movedSet,t):this.removes.push({parentId:o,id:n,isShadow:!(!r(e.target)||!s(e.target))||void 0})),this.mapRemoves.push(t))}))}},this.genAdds=(e,t)=>{if(this.mirror.hasNode(e)){if(V(e,this.mirror))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[$(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);G(e,this.blockClass,this.blockSelector,!1)||e.childNodes.forEach((e=>this.genAdds(e)))}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].forEach((t=>{this[t]=e[t]}))}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function te(e,t){e.delete(t),t.childNodes.forEach((t=>te(e,t)))}function ne(e,t,n){return 0!==e.length&&oe(e,t,n)}function oe(e,t,n){const{parentNode:o}=t;if(!o)return!1;const r=n.getId(o);return!!e.some((e=>e.id===r))||oe(e,o,n)}function re(e,t){return 0!==e.size&&se(e,t)}function se(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||se(e,n))}const ae=[],ie="undefined"!=typeof CSSGroupingRule,ce="undefined"!=typeof CSSMediaRule,le="undefined"!=typeof CSSSupportsRule,de="undefined"!=typeof CSSConditionRule;function ue(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0];return e.target}catch(t){return e.target}}function he(e,t){var n,o;const r=new ee;ae.push(r),r.init(e);let s=window.MutationObserver||window.__rrMutationObserver;const a=null===(o=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===o?void 0:o.call(n,"MutationObserver");a&&window[a]&&(s=window[a]);const i=new s(r.processMutations.bind(r));return i.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),i}function pe({mouseInteractionCb:e,doc:t,mirror:n,blockClass:o,blockSelector:r,sampling:s}){if(!1===s.mouseInteraction)return()=>{};const a=!0===s.mouseInteraction||void 0===s.mouseInteraction?{}:s.mouseInteraction,i=[];return Object.keys(X).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==a[e])).forEach((s=>{const a=s.toLowerCase(),c=(t=>s=>{const a=ue(s);if(G(a,o,r,!0))return;const i=K(s)?s.changedTouches[0]:s;if(!i)return;const c=n.getId(a),{clientX:l,clientY:d}=i;e({type:X[t],id:c,x:l,y:d})})(s);i.push(O(a,c,t))})),()=>{i.forEach((e=>e()))}}function ge({scrollCb:e,doc:t,mirror:n,blockClass:o,blockSelector:r,sampling:s}){return O("scroll",L((s=>{const a=ue(s);if(!a||G(a,o,r,!0))return;const i=n.getId(a);if(a===t){const n=t.scrollingElement||t.documentElement;e({id:i,x:n.scrollLeft,y:n.scrollTop})}else e({id:i,x:a.scrollLeft,y:a.scrollTop})}),s.scroll||100),t)}function me(e,t){const n=Object.assign({},e);return t||delete n.userTriggered,n}const Ie=["INPUT","TEXTAREA","SELECT"],Ce=new WeakMap;function fe(e){return function(e,t){if(ie&&e.parentRule instanceof CSSGroupingRule||ce&&e.parentRule instanceof CSSMediaRule||le&&e.parentRule instanceof CSSSupportsRule||de&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function ye(e,t,n){let o,r;return e?(e.ownerNode?o=t.getId(e.ownerNode):r=n.getId(e),{styleId:r,id:o}):{}}function Se({mirror:e,stylesheetManager:t},n){var o,r,s;let a=null;a="#document"===n.nodeName?e.getId(n):e.getId(n.host);const i="#document"===n.nodeName?null===(o=n.defaultView)||void 0===o?void 0:o.Document:null===(s=null===(r=n.ownerDocument)||void 0===r?void 0:r.defaultView)||void 0===s?void 0:s.ShadowRoot,c=Object.getOwnPropertyDescriptor(null==i?void 0:i.prototype,"adoptedStyleSheets");return null!==a&&-1!==a&&i&&c?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var e;return null===(e=c.get)||void 0===e?void 0:e.call(this)},set(e){var n;const o=null===(n=c.set)||void 0===n?void 0:n.call(this,e);if(null!==a&&-1!==a)try{t.adoptStyleSheets(e,a)}catch(e){}return o}}),()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}):()=>{}}function be(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};!function(e,t){const{mutationCb:n,mousemoveCb:o,mouseInteractionCb:r,scrollCb:s,viewportResizeCb:a,inputCb:i,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:d,canvasMutationCb:u,fontCb:h,selectionCb:p}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),o(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),r(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),s(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),a(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),i(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),c(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),l(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),d(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),u(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)}}(e,t);const o=he(e,e.doc),r=function({mousemoveCb:e,sampling:t,doc:n,mirror:o}){if(!1===t.mousemove)return()=>{};const r="number"==typeof t.mousemove?t.mousemove:50,s="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let a,i=[];const c=L((t=>{const n=Date.now()-a;e(i.map((e=>(e.timeOffset-=n,e))),t),i=[],a=null}),s),l=L((e=>{const t=ue(e),{clientX:n,clientY:r}=K(e)?e.changedTouches[0]:e;a||(a=Date.now()),i.push({x:n,y:r,id:o.getId(t),timeOffset:Date.now()-a}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?H.Drag:e instanceof MouseEvent?H.MouseMove:H.TouchMove)}),r,{trailing:!1}),d=[O("mousemove",l,n),O("touchmove",l,n),O("drag",l,n)];return()=>{d.forEach((e=>e()))}}(e),s=pe(e),a=ge(e),i=function({viewportResizeCb:e}){let t=-1,n=-1;return O("resize",L((()=>{const o=Z(),r=B();t===o&&n===r||(e({width:Number(r),height:Number(o)}),t=o,n=r)}),200),window)}(e),c=function({inputCb:e,doc:t,mirror:n,blockClass:o,blockSelector:r,ignoreClass:s,maskInputOptions:a,maskInputFn:i,sampling:c,userTriggeredOnInput:d}){function u(e){let n=ue(e);const c=e.isTrusted;if(n&&"OPTION"===n.tagName&&(n=n.parentElement),!n||!n.tagName||Ie.indexOf(n.tagName)<0||G(n,o,r,!0))return;const u=n.type;if(n.classList.contains(s))return;let p=n.value,g=!1;"radio"===u||"checkbox"===u?g=n.checked:(a[n.tagName.toLowerCase()]||a[u])&&(p=l({maskInputOptions:a,tagName:n.tagName,type:u,value:p,maskInputFn:i})),h(n,me({text:p,isChecked:g,userTriggered:c},d));const m=n.name;"radio"===u&&m&&g&&t.querySelectorAll(`input[type="radio"][name="${m}"]`).forEach((e=>{e!==n&&h(e,me({text:e.value,isChecked:!g,userTriggered:!1},d))}))}function h(t,o){const r=Ce.get(t);if(!r||r.text!==o.text||r.isChecked!==o.isChecked){Ce.set(t,o);const r=n.getId(t);e(Object.assign(Object.assign({},o),{id:r}))}}const p=("last"===c.input?["change"]:["input","change"]).map((e=>O(e,u,t))),g=t.defaultView;if(!g)return()=>{p.forEach((e=>e()))};const m=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value"),I=[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&p.push(...I.map((e=>D(e[0],e[1],{set(){u({target:this})}},!1,g)))),()=>{p.forEach((e=>e()))}}(e),d=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:o,sampling:r}){const s=s=>L((r=>{const a=ue(r);if(!a||G(a,t,n,!0))return;const{currentTime:i,volume:c,muted:l,playbackRate:d}=a;e({type:s,id:o.getId(a),currentTime:i,volume:c,muted:l,playbackRate:d})}),r.media||500),a=[O("play",s(0)),O("pause",s(1)),O("seeked",s(2)),O("volumechange",s(3)),O("ratechange",s(4))];return()=>{a.forEach((e=>e()))}}(e),u=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:o}){const r=o.CSSStyleSheet.prototype.insertRule;o.CSSStyleSheet.prototype.insertRule=function(o,s){const{id:a,styleId:i}=ye(this,t,n.styleMirror);return(a&&-1!==a||i&&-1!==i)&&e({id:a,styleId:i,adds:[{rule:o,index:s}]}),r.apply(this,[o,s])};const s=o.CSSStyleSheet.prototype.deleteRule;let a,i;o.CSSStyleSheet.prototype.deleteRule=function(o){const{id:r,styleId:a}=ye(this,t,n.styleMirror);return(r&&-1!==r||a&&-1!==a)&&e({id:r,styleId:a,removes:[{index:o}]}),s.apply(this,[o])},o.CSSStyleSheet.prototype.replace&&(a=o.CSSStyleSheet.prototype.replace,o.CSSStyleSheet.prototype.replace=function(o){const{id:r,styleId:s}=ye(this,t,n.styleMirror);return(r&&-1!==r||s&&-1!==s)&&e({id:r,styleId:s,replace:o}),a.apply(this,[o])}),o.CSSStyleSheet.prototype.replaceSync&&(i=o.CSSStyleSheet.prototype.replaceSync,o.CSSStyleSheet.prototype.replaceSync=function(o){const{id:r,styleId:s}=ye(this,t,n.styleMirror);return(r&&-1!==r||s&&-1!==s)&&e({id:r,styleId:s,replaceSync:o}),i.apply(this,[o])});const c={};ie?c.CSSGroupingRule=o.CSSGroupingRule:(ce&&(c.CSSMediaRule=o.CSSMediaRule),de&&(c.CSSConditionRule=o.CSSConditionRule),le&&(c.CSSSupportsRule=o.CSSSupportsRule));const l={};return Object.entries(c).forEach((([o,r])=>{l[o]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=function(r,s){const{id:a,styleId:i}=ye(this.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||i&&-1!==i)&&e({id:a,styleId:i,adds:[{rule:r,index:[...fe(this),s||0]}]}),l[o].insertRule.apply(this,[r,s])},r.prototype.deleteRule=function(r){const{id:s,styleId:a}=ye(this.parentStyleSheet,t,n.styleMirror);return(s&&-1!==s||a&&-1!==a)&&e({id:s,styleId:a,removes:[{index:[...fe(this),r]}]}),l[o].deleteRule.apply(this,[r])}})),()=>{o.CSSStyleSheet.prototype.insertRule=r,o.CSSStyleSheet.prototype.deleteRule=s,a&&(o.CSSStyleSheet.prototype.replace=a),i&&(o.CSSStyleSheet.prototype.replaceSync=i),Object.entries(c).forEach((([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule}))}}(e,{win:n}),h=Se(e,e.doc),p=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:o},{win:r}){const s=r.CSSStyleDeclaration.prototype.setProperty;r.CSSStyleDeclaration.prototype.setProperty=function(r,a,i){var c;if(n.has(r))return s.apply(this,[r,a,i]);const{id:l,styleId:d}=ye(null===(c=this.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,o.styleMirror);return(l&&-1!==l||d&&-1!==d)&&e({id:l,styleId:d,set:{property:r,value:a,priority:i},index:fe(this.parentRule)}),s.apply(this,[r,a,i])};const a=r.CSSStyleDeclaration.prototype.removeProperty;return r.CSSStyleDeclaration.prototype.removeProperty=function(r){var s;if(n.has(r))return a.apply(this,[r]);const{id:i,styleId:c}=ye(null===(s=this.parentRule)||void 0===s?void 0:s.parentStyleSheet,t,o.styleMirror);return(i&&-1!==i||c&&-1!==c)&&e({id:i,styleId:c,remove:{property:r},index:fe(this.parentRule)}),a.apply(this,[r])},()=>{r.CSSStyleDeclaration.prototype.setProperty=s,r.CSSStyleDeclaration.prototype.removeProperty=a}}(e,{win:n}),g=e.collectFonts?function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const o=[],r=new WeakMap,s=n.FontFace;n.FontFace=function(e,t,n){const o=new s(e,t,n);return r.set(o,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),o};const a=W(t.fonts,"add",(function(t){return function(n){return setTimeout((()=>{const t=r.get(n);t&&(e(t),r.delete(n))}),0),t.apply(this,[n])}}));return o.push((()=>{n.FontFace=s})),o.push(a),()=>{o.forEach((e=>e()))}}(e):()=>{},m=function(e){const{doc:t,mirror:n,blockClass:o,blockSelector:r,selectionCb:s}=e;let a=!0;const i=()=>{const e=t.getSelection();if(!e||a&&(null==e?void 0:e.isCollapsed))return;a=e.isCollapsed||!1;const i=[],c=e.rangeCount||0;for(let t=0;t<c;t++){const s=e.getRangeAt(t),{startContainer:a,startOffset:c,endContainer:l,endOffset:d}=s;G(a,o,r,!0)||G(l,o,r,!0)||i.push({start:n.getId(a),startOffset:c,end:n.getId(l),endOffset:d})}s({ranges:i})};return i(),O("selectionchange",i)}(e),I=[];for(const t of e.plugins)I.push(t.observer(t.callback,n,t.options));return()=>{ae.forEach((e=>e.reset())),o.disconnect(),r(),s(),a(),i(),c(),d(),u(),h(),p(),g(),m(),I.forEach((e=>e()))}}class ve{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,o){const r=n||this.getIdToRemoteIdMap(e),s=o||this.getRemoteIdToIdMap(e);let a=r.get(t);return a||(a=this.generateIdFn(),r.set(t,a),s.set(a,t)),a}getIds(e,t){const n=this.getIdToRemoteIdMap(e),o=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,o)))}getRemoteId(e,t,n){const o=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const r=o.get(t);return r||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,n)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class Ae{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new ve(m),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new ve(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){if("rrweb"===e.data.type){if(!e.source)return;const t=this.crossOriginIframeMap.get(e.source);if(!t)return;const n=this.transformCrossOriginEvent(t,e.data.event);n&&this.wrappedEmit(n,e.data.isCheckout)}}transformCrossOriginEvent(e,t){var n;switch(t.type){case Q.FullSnapshot:return this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e),{timestamp:t.timestamp,type:Q.IncrementalSnapshot,data:{source:H.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case Q.Meta:case Q.Load:case Q.DomContentLoaded:return!1;case Q.Plugin:return t;case Q.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Q.IncrementalSnapshot:switch(t.data.source){case H.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case H.Drag:case H.TouchMove:case H.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case H.ViewportResize:return!1;case H.MediaInteraction:case H.MouseInteraction:case H.Scroll:case H.CanvasMutation:case H.Input:return this.replaceIds(t.data,e,["id"]),t;case H.StyleSheetRule:case H.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case H.Font:return t;case H.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case H.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}}replace(e,t,n,o){for(const r of o)(Array.isArray(t[r])||"number"==typeof t[r])&&(Array.isArray(t[r])?t[r]=e.getIds(n,t[r]):t[r]=e.getId(n,t[r]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}}class ke{constructor(e){this.shadowDoms=new WeakSet,this.restorePatches=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror;const t=this;this.restorePatches.push(W(Element.prototype,"attachShadow",(function(e){return function(n){const o=e.call(this,n);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,this.ownerDocument),o}})))}addShadowRoot(e,t){s(e)&&(this.shadowDoms.has(e)||(this.shadowDoms.add(e),he(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),ge(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),Se({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)}),0)))}observeAttachShadow(e){if(e.contentWindow){const t=this;this.restorePatches.push(W(e.contentWindow.HTMLElement.prototype,"attachShadow",(function(n){return function(o){const r=n.call(this,o);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,e.contentDocument),r}})))}}reset(){this.restorePatches.forEach((e=>e())),this.shadowDoms=new WeakSet}}
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
***************************************************************************** */function we(e,t,n,o){return new(n||(n=Promise))((function(r,s){function a(e){try{c(o.next(e))}catch(e){s(e)}}function i(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,i)}c((o=o.apply(e,t||[])).next())}))}for(var Me="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Te="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Ne=0;Ne<64;Ne++)Te[Me.charCodeAt(Ne)]=Ne;const Re=new Map;const Ee=(e,t,n)=>{if(!e||!xe(e,t)&&"object"!=typeof e)return;const o=function(e,t){let n=Re.get(e);return n||(n=new Map,Re.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let r=o.indexOf(e);return-1===r&&(r=o.length,o.push(e)),r};function Oe(e,t,n){if(e instanceof Array)return e.map((e=>Oe(e,t,n)));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray){return{rr_type:e.constructor.name,args:[Object.values(e)]}}if(e instanceof ArrayBuffer){const t=e.constructor.name,n=function(e){var t,n=new Uint8Array(e),o=n.length,r="";for(t=0;t<o;t+=3)r+=Me[n[t]>>2],r+=Me[(3&n[t])<<4|n[t+1]>>4],r+=Me[(15&n[t+1])<<2|n[t+2]>>6],r+=Me[63&n[t+2]];return o%3==2?r=r.substring(0,r.length-1)+"=":o%3==1&&(r=r.substring(0,r.length-2)+"=="),r}(e);return{rr_type:t,base64:n}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[Oe(e.buffer,t,n),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[Oe(e.data,t,n),e.width,e.height]}}if(xe(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:Ee(e,t,n)}}return e}const Fe=(e,t,n)=>[...e].map((e=>Oe(e,t,n))),xe=(e,t)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof t[e]));return Boolean(n.find((n=>e instanceof t[n])))};function Le(e,t,n){const o=[];try{const r=W(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(o,...r){return G(this,t,n,!0)||"__context"in this||(this.__context=o),e.apply(this,[o,...r])}}));o.push(r)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach((e=>e()))}}function De(e,t,n,o,r,s,a){const i=[],c=Object.getOwnPropertyNames(e);for(const s of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(s))try{if("function"!=typeof e[s])continue;const c=W(e,s,(function(e){return function(...i){const c=e.apply(this,i);if(Ee(c,a,this),!G(this.canvas,o,r,!0)){const e=Fe([...i],a,this),o={type:t,property:s,args:e};n(this.canvas,o)}return c}}));i.push(c)}catch(o){const r=D(e,s,{set(e){n(this.canvas,{type:t,property:s,args:[e],setter:!0})}});i.push(r)}return i}var We=null;try{var Ze="undefined"!=typeof module&&"function"==typeof module.require&&module.require("worker_threads")||"function"==typeof __non_webpack_require__&&__non_webpack_require__("worker_threads")||"function"==typeof require&&require("worker_threads");We=Ze.Worker}catch(e){}function Be(e,t,n){var o=void 0===t?null:t,r=function(e,t){return Buffer.from(e,"base64").toString(t?"utf16":"utf8")}(e,void 0!==n&&n),s=r.indexOf("\n",10)+1,a=r.substring(s)+(o?"//# sourceMappingURL="+o:"");return function(e){return new We(a,Object.assign({},e,{eval:!0}))}}function Ge(e,t,n){var o=void 0===t?null:t,r=function(e,t){var n=atob(e);if(t){for(var o=new Uint8Array(n.length),r=0,s=n.length;r<s;++r)o[r]=n.charCodeAt(r);return String.fromCharCode.apply(null,new Uint16Array(o.buffer))}return n}(e,void 0!==n&&n),s=r.indexOf("\n",10)+1,a=r.substring(s)+(o?"//# sourceMappingURL="+o:""),i=new Blob([a],{type:"application/javascript"});return URL.createObjectURL(i)}var Ve="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0);var Ue,Ke,Ye,_e=(Ue="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",Ke=null,Ye=!1,Ve?Be(Ue,Ke,Ye):function(e,t,n){var o;return function(r){return o=o||Ge(e,t,n),new Worker(o,r)}}(Ue,Ke,Ye));class Je{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:n,blockClass:o,blockSelector:r,recordCanvas:s,dataURLOptions:a}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,s&&"all"===t&&this.initCanvasMutationObserver(n,o,r),s&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,o,r,{dataURLOptions:a})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,n,o,r){const s=Le(t,n,o),a=new Map,i=new _e;i.onmessage=e=>{const{id:t}=e.data;if(a.set(t,!1),!("base64"in e.data))return;const{base64:n,type:o,width:r,height:s}=e.data;this.mutationCb({id:t,type:j["2D"],commands:[{property:"clearRect",args:[0,0,r,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:o}]},0,0]}]})};const c=1e3/e;let l,d=0;const u=e=>{d&&e-d<c||(d=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{G(t,n,o,!0)||e.push(t)})),e})().forEach((e=>we(this,void 0,void 0,(function*(){var t;const n=this.mirror.getId(e);if(a.get(n))return;if(a.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&(null==n||n.clear(n.COLOR_BUFFER_BIT))}const o=yield createImageBitmap(e);i.postMessage({id:n,bitmap:o,width:e.width,height:e.height,dataURLOptions:r.dataURLOptions},[o])}))))),l=requestAnimationFrame(u)};l=requestAnimationFrame(u),this.resetObservers=()=>{s(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const o=Le(e,t,n),r=function(e,t,n,o){const r=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const a of s)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[a])continue;const s=W(t.CanvasRenderingContext2D.prototype,a,(function(r){return function(...s){return G(this.canvas,n,o,!0)||setTimeout((()=>{const n=Fe([...s],t,this);e(this.canvas,{type:j["2D"],property:a,args:n})}),0),r.apply(this,s)}}));r.push(s)}catch(n){const o=D(t.CanvasRenderingContext2D.prototype,a,{set(t){e(this.canvas,{type:j["2D"],property:a,args:[t],setter:!0})}});r.push(o)}return()=>{r.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),s=function(e,t,n,o){const r=[];return r.push(...De(t.WebGLRenderingContext.prototype,j.WebGL,e,n,o,0,t)),void 0!==t.WebGL2RenderingContext&&r.push(...De(t.WebGL2RenderingContext.prototype,j.WebGL2,e,n,o,0,t)),()=>{r.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{o(),r(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const o=n.map((e=>{const t=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(e,["type"]);return t})),{type:r}=n[0];this.mutationCb({id:t,type:r,commands:o}),this.pendingCanvasMutations.delete(e)}}class ze{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new z,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},o=[];for(const t of e){let e;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{e=this.styleMirror.add(t);const n=Array.from(t.rules||CSSRule);o.push({styleId:e,rules:n.map(((e,t)=>({rule:i(e),index:t})))})}n.styleIds.push(e)}o.length>0&&(n.styles=o),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}function Qe(e){return Object.assign(Object.assign({},e),{timestamp:Date.now()})}let He,Xe,je,Pe=!1;const qe=new c;function $e(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:o,blockClass:r="rr-block",blockSelector:s=null,ignoreClass:a="rr-ignore",maskTextClass:i="rr-mask",maskTextSelector:l=null,inlineStylesheet:d=!0,maskAllInputs:u,maskInputOptions:h,slimDOMOptions:p,maskInputFn:g,maskTextFn:m,hooks:I,packFn:C,sampling:f={},dataURLOptions:y={},mousemoveWait:S,recordCanvas:b=!1,recordCrossOriginIframes:v=!1,userTriggeredOnInput:A=!1,collectFonts:k=!1,inlineImages:w=!1,plugins:M,keepIframeSrcFn:T=()=>!1,ignoreCSSAttributes:N=new Set([])}=e,R=!v||window.parent===window;let F=!1;if(!R)try{window.parent.document,F=!1}catch(e){F=!0}if(R&&!t)throw new Error("emit function is required");void 0!==S&&void 0===f.mousemove&&(f.mousemove=S),qe.reset();const x=!0===u?{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}:void 0!==h?h:{password:!0},L=!0===p||"all"===p?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===p,headMetaDescKeywords:"all"===p}:p||{};let D;!function(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}();let W=0;const G=e=>{for(const t of M||[])t.eventProcessor&&(e=t.eventProcessor(e));return C&&(e=C(e)),e};He=(e,r)=>{var s;if(!(null===(s=ae[0])||void 0===s?void 0:s.isFrozen())||e.type===Q.FullSnapshot||e.type===Q.IncrementalSnapshot&&e.data.source===H.Mutation||ae.forEach((e=>e.unfreeze())),R)null==t||t(G(e),r);else if(F){const t={type:"rrweb",event:G(e),isCheckout:r};window.parent.postMessage(t,"*")}if(e.type===Q.FullSnapshot)D=e,W=0;else if(e.type===Q.IncrementalSnapshot){if(e.data.source===H.Mutation&&e.data.isAttachIframe)return;W++;const t=o&&W>=o,r=n&&e.timestamp-D.timestamp>n;(t||r)&&Xe(!0)}};const V=e=>{He(Qe({type:Q.IncrementalSnapshot,data:Object.assign({source:H.Mutation},e)}))},U=e=>He(Qe({type:Q.IncrementalSnapshot,data:Object.assign({source:H.Scroll},e)})),K=e=>He(Qe({type:Q.IncrementalSnapshot,data:Object.assign({source:H.CanvasMutation},e)})),z=new ze({mutationCb:V,adoptedStyleSheetCb:e=>He(Qe({type:Q.IncrementalSnapshot,data:Object.assign({source:H.AdoptedStyleSheet},e)}))}),X=new Ae({mirror:qe,mutationCb:V,stylesheetManager:z,recordCrossOriginIframes:v,wrappedEmit:He});for(const e of M||[])e.getMirror&&e.getMirror({nodeMirror:qe,crossOriginIframeMirror:X.crossOriginIframeMirror,crossOriginIframeStyleMirror:X.crossOriginIframeStyleMirror});je=new Je({recordCanvas:b,mutationCb:K,win:window,blockClass:r,blockSelector:s,mirror:qe,sampling:f.canvas,dataURLOptions:y});const j=new ke({mutationCb:V,scrollCb:U,bypassOptions:{blockClass:r,blockSelector:s,maskTextClass:i,maskTextSelector:l,inlineStylesheet:d,maskInputOptions:x,dataURLOptions:y,maskTextFn:m,maskInputFn:g,recordCanvas:b,inlineImages:w,sampling:f,slimDOMOptions:L,iframeManager:X,stylesheetManager:z,canvasManager:je,keepIframeSrcFn:T},mirror:qe});Xe=(e=!1)=>{var t,n,o,a,u,h;He(Qe({type:Q.Meta,data:{href:window.location.href,width:B(),height:Z()}}),e),z.reset(),ae.forEach((e=>e.lock()));const p=function(e,t){var n=t||{},o=n.mirror,r=void 0===o?new c:o,s=n.blockClass,a=void 0===s?"rr-block":s,i=n.blockSelector,l=void 0===i?null:i,d=n.maskTextClass,u=void 0===d?"rr-mask":d,h=n.maskTextSelector,p=void 0===h?null:h,g=n.inlineStylesheet,m=void 0===g||g,I=n.inlineImages,C=void 0!==I&&I,f=n.recordCanvas,y=void 0!==f&&f,S=n.maskAllInputs,b=void 0!==S&&S,v=n.maskTextFn,A=n.maskInputFn,k=n.slimDOM,w=void 0!==k&&k,M=n.dataURLOptions,T=n.preserveWhiteSpace,N=n.onSerialize,R=n.onIframeLoad,O=n.iframeLoadTimeout,F=n.onStylesheetLoad,x=n.stylesheetLoadTimeout,L=n.keepIframeSrcFn;return E(e,{doc:e,mirror:r,blockClass:a,blockSelector:l,maskTextClass:u,maskTextSelector:p,skipChild:!1,inlineStylesheet:m,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:v,maskInputFn:A,slimDOMOptions:!0===w||"all"===w?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===w,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===w?{}:w,dataURLOptions:M,inlineImages:C,recordCanvas:y,preserveWhiteSpace:T,onSerialize:N,onIframeLoad:R,iframeLoadTimeout:O,onStylesheetLoad:F,stylesheetLoadTimeout:x,keepIframeSrcFn:void 0===L?function(){return!1}:L,newlyAddedElement:!1})}(document,{mirror:qe,blockClass:r,blockSelector:s,maskTextClass:i,maskTextSelector:l,inlineStylesheet:d,maskAllInputs:x,maskTextFn:m,slimDOM:L,dataURLOptions:y,recordCanvas:b,inlineImages:w,onSerialize:e=>{Y(e,qe)&&X.addIframe(e),_(e,qe)&&z.trackLinkElement(e),J(e)&&j.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{X.attachIframe(e,t),j.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{z.attachLinkElement(e,t)},keepIframeSrcFn:T});if(!p)return console.warn("Failed to snapshot the document");He(Qe({type:Q.FullSnapshot,data:{node:p,initialOffset:{left:void 0!==window.pageXOffset?window.pageXOffset:(null===document||void 0===document?void 0:document.documentElement.scrollLeft)||(null===(n=null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(o=null===document||void 0===document?void 0:document.body)||void 0===o?void 0:o.scrollLeft)||0,top:void 0!==window.pageYOffset?window.pageYOffset:(null===document||void 0===document?void 0:document.documentElement.scrollTop)||(null===(u=null===(a=null===document||void 0===document?void 0:document.body)||void 0===a?void 0:a.parentElement)||void 0===u?void 0:u.scrollTop)||(null===(h=null===document||void 0===document?void 0:document.body)||void 0===h?void 0:h.scrollTop)||0}}})),ae.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&z.adoptStyleSheets(document.adoptedStyleSheets,qe.getId(document))};try{const e=[];e.push(O("DOMContentLoaded",(()=>{He(Qe({type:Q.DomContentLoaded,data:{}}))})));const t=e=>{var t;return be({mutationCb:V,mousemoveCb:(e,t)=>He(Qe({type:Q.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>He(Qe({type:Q.IncrementalSnapshot,data:Object.assign({source:H.MouseInteraction},e)})),scrollCb:U,viewportResizeCb:e=>He(Qe({type:Q.IncrementalSnapshot,data:Object.assign({source:H.ViewportResize},e)})),inputCb:e=>He(Qe({type:Q.IncrementalSnapshot,data:Object.assign({source:H.Input},e)})),mediaInteractionCb:e=>He(Qe({type:Q.IncrementalSnapshot,data:Object.assign({source:H.MediaInteraction},e)})),styleSheetRuleCb:e=>He(Qe({type:Q.IncrementalSnapshot,data:Object.assign({source:H.StyleSheetRule},e)})),styleDeclarationCb:e=>He(Qe({type:Q.IncrementalSnapshot,data:Object.assign({source:H.StyleDeclaration},e)})),canvasMutationCb:K,fontCb:e=>He(Qe({type:Q.IncrementalSnapshot,data:Object.assign({source:H.Font},e)})),selectionCb:e=>{He(Qe({type:Q.IncrementalSnapshot,data:Object.assign({source:H.Selection},e)}))},blockClass:r,ignoreClass:a,maskTextClass:i,maskTextSelector:l,maskInputOptions:x,inlineStylesheet:d,sampling:f,recordCanvas:b,inlineImages:w,userTriggeredOnInput:A,collectFonts:k,doc:e,maskInputFn:g,maskTextFn:m,keepIframeSrcFn:T,blockSelector:s,slimDOMOptions:L,dataURLOptions:y,mirror:qe,iframeManager:X,stylesheetManager:z,shadowDomManager:j,canvasManager:je,ignoreCSSAttributes:N,plugins:(null===(t=null==M?void 0:M.filter((e=>e.observer)))||void 0===t?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>He(Qe({type:Q.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},I)};X.addLoadListener((n=>{e.push(t(n.contentDocument))}));const n=()=>{Xe(),e.push(t(document)),Pe=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():e.push(O("load",(()=>{He(Qe({type:Q.Load,data:{}})),n()}),window)),()=>{e.forEach((e=>e())),Pe=!1}}catch(e){console.warn(e)}}$e.addCustomEvent=(e,t)=>{if(!Pe)throw new Error("please add custom event after start recording");He(Qe({type:Q.Custom,data:{tag:e,payload:t}}))},$e.freezePage=()=>{ae.forEach((e=>e.freeze()))},$e.takeFullSnapshot=e=>{if(!Pe)throw new Error("please take full snapshot after start recording");Xe(e)},$e.mirror=qe;const et=({children:o})=>{const r=(()=>{const e=t([]);return n((()=>{const t=$e({emit(t){t&&e.current.push(t)}});return()=>{t&&t()}}),[]),e})();return n((()=>{const e=r.current;localStorage.setItem("rrweb-events",JSON.stringify(e))}),[]),n((()=>()=>{const e=r.current;localStorage.setItem("rrweb-events",JSON.stringify(e));const t={method:"PUT",headers:{"Content-Type":"application/json"},body:localStorage.getItem("rrweb-events")};let n="";fetch("http://localhost:8000/generate-s3-url").then((e=>e.json())).then((e=>{n=e.signed_url,fetch(n,t).catch((e=>{console.error("Error uploading to S3:",e)}))})).catch((e=>{console.error("Error fetching S3 URL:",e)}))}),[]),e.createElement(e.Fragment,null,o)};export{et as default};
|
|
1
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
var NodeType;
|
|
4
|
+
(function (NodeType) {
|
|
5
|
+
NodeType[NodeType["Document"] = 0] = "Document";
|
|
6
|
+
NodeType[NodeType["DocumentType"] = 1] = "DocumentType";
|
|
7
|
+
NodeType[NodeType["Element"] = 2] = "Element";
|
|
8
|
+
NodeType[NodeType["Text"] = 3] = "Text";
|
|
9
|
+
NodeType[NodeType["CDATA"] = 4] = "CDATA";
|
|
10
|
+
NodeType[NodeType["Comment"] = 5] = "Comment";
|
|
11
|
+
})(NodeType || (NodeType = {}));
|
|
12
|
+
|
|
13
|
+
function isElement(n) {
|
|
14
|
+
return n.nodeType === n.ELEMENT_NODE;
|
|
15
|
+
}
|
|
16
|
+
function isShadowRoot(n) {
|
|
17
|
+
var host = n === null || n === void 0 ? void 0 : n.host;
|
|
18
|
+
return Boolean((host === null || host === void 0 ? void 0 : host.shadowRoot) === n);
|
|
19
|
+
}
|
|
20
|
+
function isNativeShadowDom(shadowRoot) {
|
|
21
|
+
return Object.prototype.toString.call(shadowRoot) === '[object ShadowRoot]';
|
|
22
|
+
}
|
|
23
|
+
function fixBrowserCompatibilityIssuesInCSS(cssText) {
|
|
24
|
+
if (cssText.includes(' background-clip: text;') &&
|
|
25
|
+
!cssText.includes(' -webkit-background-clip: text;')) {
|
|
26
|
+
cssText = cssText.replace(' background-clip: text;', ' -webkit-background-clip: text; background-clip: text;');
|
|
27
|
+
}
|
|
28
|
+
return cssText;
|
|
29
|
+
}
|
|
30
|
+
function getCssRulesString(s) {
|
|
31
|
+
try {
|
|
32
|
+
var rules = s.rules || s.cssRules;
|
|
33
|
+
return rules
|
|
34
|
+
? fixBrowserCompatibilityIssuesInCSS(Array.from(rules).map(getCssRuleString).join(''))
|
|
35
|
+
: null;
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function getCssRuleString(rule) {
|
|
42
|
+
var cssStringified = rule.cssText;
|
|
43
|
+
if (isCSSImportRule(rule)) {
|
|
44
|
+
try {
|
|
45
|
+
cssStringified = getCssRulesString(rule.styleSheet) || cssStringified;
|
|
46
|
+
}
|
|
47
|
+
catch (_a) {
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return cssStringified;
|
|
51
|
+
}
|
|
52
|
+
function isCSSImportRule(rule) {
|
|
53
|
+
return 'styleSheet' in rule;
|
|
54
|
+
}
|
|
55
|
+
var Mirror = (function () {
|
|
56
|
+
function Mirror() {
|
|
57
|
+
this.idNodeMap = new Map();
|
|
58
|
+
this.nodeMetaMap = new WeakMap();
|
|
59
|
+
}
|
|
60
|
+
Mirror.prototype.getId = function (n) {
|
|
61
|
+
var _a;
|
|
62
|
+
if (!n)
|
|
63
|
+
return -1;
|
|
64
|
+
var id = (_a = this.getMeta(n)) === null || _a === void 0 ? void 0 : _a.id;
|
|
65
|
+
return id !== null && id !== void 0 ? id : -1;
|
|
66
|
+
};
|
|
67
|
+
Mirror.prototype.getNode = function (id) {
|
|
68
|
+
return this.idNodeMap.get(id) || null;
|
|
69
|
+
};
|
|
70
|
+
Mirror.prototype.getIds = function () {
|
|
71
|
+
return Array.from(this.idNodeMap.keys());
|
|
72
|
+
};
|
|
73
|
+
Mirror.prototype.getMeta = function (n) {
|
|
74
|
+
return this.nodeMetaMap.get(n) || null;
|
|
75
|
+
};
|
|
76
|
+
Mirror.prototype.removeNodeFromMap = function (n) {
|
|
77
|
+
var _this = this;
|
|
78
|
+
var id = this.getId(n);
|
|
79
|
+
this.idNodeMap["delete"](id);
|
|
80
|
+
if (n.childNodes) {
|
|
81
|
+
n.childNodes.forEach(function (childNode) {
|
|
82
|
+
return _this.removeNodeFromMap(childNode);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
Mirror.prototype.has = function (id) {
|
|
87
|
+
return this.idNodeMap.has(id);
|
|
88
|
+
};
|
|
89
|
+
Mirror.prototype.hasNode = function (node) {
|
|
90
|
+
return this.nodeMetaMap.has(node);
|
|
91
|
+
};
|
|
92
|
+
Mirror.prototype.add = function (n, meta) {
|
|
93
|
+
var id = meta.id;
|
|
94
|
+
this.idNodeMap.set(id, n);
|
|
95
|
+
this.nodeMetaMap.set(n, meta);
|
|
96
|
+
};
|
|
97
|
+
Mirror.prototype.replace = function (id, n) {
|
|
98
|
+
var oldNode = this.getNode(id);
|
|
99
|
+
if (oldNode) {
|
|
100
|
+
var meta = this.nodeMetaMap.get(oldNode);
|
|
101
|
+
if (meta)
|
|
102
|
+
this.nodeMetaMap.set(n, meta);
|
|
103
|
+
}
|
|
104
|
+
this.idNodeMap.set(id, n);
|
|
105
|
+
};
|
|
106
|
+
Mirror.prototype.reset = function () {
|
|
107
|
+
this.idNodeMap = new Map();
|
|
108
|
+
this.nodeMetaMap = new WeakMap();
|
|
109
|
+
};
|
|
110
|
+
return Mirror;
|
|
111
|
+
}());
|
|
112
|
+
function createMirror() {
|
|
113
|
+
return new Mirror();
|
|
114
|
+
}
|
|
115
|
+
function maskInputValue(_a) {
|
|
116
|
+
var maskInputOptions = _a.maskInputOptions, tagName = _a.tagName, type = _a.type, value = _a.value, maskInputFn = _a.maskInputFn;
|
|
117
|
+
var text = value || '';
|
|
118
|
+
if (maskInputOptions[tagName.toLowerCase()] ||
|
|
119
|
+
maskInputOptions[type]) {
|
|
120
|
+
if (maskInputFn) {
|
|
121
|
+
text = maskInputFn(text);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
text = '*'.repeat(text.length);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return text;
|
|
128
|
+
}
|
|
129
|
+
var ORIGINAL_ATTRIBUTE_NAME = '__rrweb_original__';
|
|
130
|
+
function is2DCanvasBlank(canvas) {
|
|
131
|
+
var ctx = canvas.getContext('2d');
|
|
132
|
+
if (!ctx)
|
|
133
|
+
return true;
|
|
134
|
+
var chunkSize = 50;
|
|
135
|
+
for (var x = 0; x < canvas.width; x += chunkSize) {
|
|
136
|
+
for (var y = 0; y < canvas.height; y += chunkSize) {
|
|
137
|
+
var getImageData = ctx.getImageData;
|
|
138
|
+
var originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData
|
|
139
|
+
? getImageData[ORIGINAL_ATTRIBUTE_NAME]
|
|
140
|
+
: getImageData;
|
|
141
|
+
var pixelBuffer = new Uint32Array(originalGetImageData.call(ctx, x, y, Math.min(chunkSize, canvas.width - x), Math.min(chunkSize, canvas.height - y)).data.buffer);
|
|
142
|
+
if (pixelBuffer.some(function (pixel) { return pixel !== 0; }))
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
var _id = 1;
|
|
150
|
+
var tagNameRegex = new RegExp('[^a-z0-9-_:]');
|
|
151
|
+
var IGNORED_NODE = -2;
|
|
152
|
+
function genId() {
|
|
153
|
+
return _id++;
|
|
154
|
+
}
|
|
155
|
+
function getValidTagName(element) {
|
|
156
|
+
if (element instanceof HTMLFormElement) {
|
|
157
|
+
return 'form';
|
|
158
|
+
}
|
|
159
|
+
var processedTagName = element.tagName.toLowerCase().trim();
|
|
160
|
+
if (tagNameRegex.test(processedTagName)) {
|
|
161
|
+
return 'div';
|
|
162
|
+
}
|
|
163
|
+
return processedTagName;
|
|
164
|
+
}
|
|
165
|
+
function stringifyStyleSheet(sheet) {
|
|
166
|
+
return sheet.cssRules
|
|
167
|
+
? Array.from(sheet.cssRules)
|
|
168
|
+
.map(function (rule) { return rule.cssText || ''; })
|
|
169
|
+
.join('')
|
|
170
|
+
: '';
|
|
171
|
+
}
|
|
172
|
+
function extractOrigin(url) {
|
|
173
|
+
var origin = '';
|
|
174
|
+
if (url.indexOf('//') > -1) {
|
|
175
|
+
origin = url.split('/').slice(0, 3).join('/');
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
origin = url.split('/')[0];
|
|
179
|
+
}
|
|
180
|
+
origin = origin.split('?')[0];
|
|
181
|
+
return origin;
|
|
182
|
+
}
|
|
183
|
+
var canvasService;
|
|
184
|
+
var canvasCtx;
|
|
185
|
+
var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm;
|
|
186
|
+
var RELATIVE_PATH = /^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/;
|
|
187
|
+
var DATA_URI = /^(data:)([^,]*),(.*)/i;
|
|
188
|
+
function absoluteToStylesheet(cssText, href) {
|
|
189
|
+
return (cssText || '').replace(URL_IN_CSS_REF, function (origin, quote1, path1, quote2, path2, path3) {
|
|
190
|
+
var filePath = path1 || path2 || path3;
|
|
191
|
+
var maybeQuote = quote1 || quote2 || '';
|
|
192
|
+
if (!filePath) {
|
|
193
|
+
return origin;
|
|
194
|
+
}
|
|
195
|
+
if (!RELATIVE_PATH.test(filePath)) {
|
|
196
|
+
return "url(".concat(maybeQuote).concat(filePath).concat(maybeQuote, ")");
|
|
197
|
+
}
|
|
198
|
+
if (DATA_URI.test(filePath)) {
|
|
199
|
+
return "url(".concat(maybeQuote).concat(filePath).concat(maybeQuote, ")");
|
|
200
|
+
}
|
|
201
|
+
if (filePath[0] === '/') {
|
|
202
|
+
return "url(".concat(maybeQuote).concat(extractOrigin(href) + filePath).concat(maybeQuote, ")");
|
|
203
|
+
}
|
|
204
|
+
var stack = href.split('/');
|
|
205
|
+
var parts = filePath.split('/');
|
|
206
|
+
stack.pop();
|
|
207
|
+
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
|
|
208
|
+
var part = parts_1[_i];
|
|
209
|
+
if (part === '.') {
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
else if (part === '..') {
|
|
213
|
+
stack.pop();
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
stack.push(part);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return "url(".concat(maybeQuote).concat(stack.join('/')).concat(maybeQuote, ")");
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
var SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/;
|
|
223
|
+
var SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/;
|
|
224
|
+
function getAbsoluteSrcsetString(doc, attributeValue) {
|
|
225
|
+
if (attributeValue.trim() === '') {
|
|
226
|
+
return attributeValue;
|
|
227
|
+
}
|
|
228
|
+
var pos = 0;
|
|
229
|
+
function collectCharacters(regEx) {
|
|
230
|
+
var chars;
|
|
231
|
+
var match = regEx.exec(attributeValue.substring(pos));
|
|
232
|
+
if (match) {
|
|
233
|
+
chars = match[0];
|
|
234
|
+
pos += chars.length;
|
|
235
|
+
return chars;
|
|
236
|
+
}
|
|
237
|
+
return '';
|
|
238
|
+
}
|
|
239
|
+
var output = [];
|
|
240
|
+
while (true) {
|
|
241
|
+
collectCharacters(SRCSET_COMMAS_OR_SPACES);
|
|
242
|
+
if (pos >= attributeValue.length) {
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
var url = collectCharacters(SRCSET_NOT_SPACES);
|
|
246
|
+
if (url.slice(-1) === ',') {
|
|
247
|
+
url = absoluteToDoc(doc, url.substring(0, url.length - 1));
|
|
248
|
+
output.push(url);
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
var descriptorsStr = '';
|
|
252
|
+
url = absoluteToDoc(doc, url);
|
|
253
|
+
var inParens = false;
|
|
254
|
+
while (true) {
|
|
255
|
+
var c = attributeValue.charAt(pos);
|
|
256
|
+
if (c === '') {
|
|
257
|
+
output.push((url + descriptorsStr).trim());
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
else if (!inParens) {
|
|
261
|
+
if (c === ',') {
|
|
262
|
+
pos += 1;
|
|
263
|
+
output.push((url + descriptorsStr).trim());
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
else if (c === '(') {
|
|
267
|
+
inParens = true;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
if (c === ')') {
|
|
272
|
+
inParens = false;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
descriptorsStr += c;
|
|
276
|
+
pos += 1;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return output.join(', ');
|
|
281
|
+
}
|
|
282
|
+
function absoluteToDoc(doc, attributeValue) {
|
|
283
|
+
if (!attributeValue || attributeValue.trim() === '') {
|
|
284
|
+
return attributeValue;
|
|
285
|
+
}
|
|
286
|
+
var a = doc.createElement('a');
|
|
287
|
+
a.href = attributeValue;
|
|
288
|
+
return a.href;
|
|
289
|
+
}
|
|
290
|
+
function isSVGElement(el) {
|
|
291
|
+
return Boolean(el.tagName === 'svg' || el.ownerSVGElement);
|
|
292
|
+
}
|
|
293
|
+
function getHref() {
|
|
294
|
+
var a = document.createElement('a');
|
|
295
|
+
a.href = '';
|
|
296
|
+
return a.href;
|
|
297
|
+
}
|
|
298
|
+
function transformAttribute(doc, tagName, name, value) {
|
|
299
|
+
if (name === 'src' ||
|
|
300
|
+
(name === 'href' && value && !(tagName === 'use' && value[0] === '#'))) {
|
|
301
|
+
return absoluteToDoc(doc, value);
|
|
302
|
+
}
|
|
303
|
+
else if (name === 'xlink:href' && value && value[0] !== '#') {
|
|
304
|
+
return absoluteToDoc(doc, value);
|
|
305
|
+
}
|
|
306
|
+
else if (name === 'background' &&
|
|
307
|
+
value &&
|
|
308
|
+
(tagName === 'table' || tagName === 'td' || tagName === 'th')) {
|
|
309
|
+
return absoluteToDoc(doc, value);
|
|
310
|
+
}
|
|
311
|
+
else if (name === 'srcset' && value) {
|
|
312
|
+
return getAbsoluteSrcsetString(doc, value);
|
|
313
|
+
}
|
|
314
|
+
else if (name === 'style' && value) {
|
|
315
|
+
return absoluteToStylesheet(value, getHref());
|
|
316
|
+
}
|
|
317
|
+
else if (tagName === 'object' && name === 'data' && value) {
|
|
318
|
+
return absoluteToDoc(doc, value);
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
return value;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
function _isBlockedElement(element, blockClass, blockSelector) {
|
|
325
|
+
if (typeof blockClass === 'string') {
|
|
326
|
+
if (element.classList.contains(blockClass)) {
|
|
327
|
+
return true;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
for (var eIndex = element.classList.length; eIndex--;) {
|
|
332
|
+
var className = element.classList[eIndex];
|
|
333
|
+
if (blockClass.test(className)) {
|
|
334
|
+
return true;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
if (blockSelector) {
|
|
339
|
+
return element.matches(blockSelector);
|
|
340
|
+
}
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
function classMatchesRegex(node, regex, checkAncestors) {
|
|
344
|
+
if (!node)
|
|
345
|
+
return false;
|
|
346
|
+
if (node.nodeType !== node.ELEMENT_NODE) {
|
|
347
|
+
if (!checkAncestors)
|
|
348
|
+
return false;
|
|
349
|
+
return classMatchesRegex(node.parentNode, regex, checkAncestors);
|
|
350
|
+
}
|
|
351
|
+
for (var eIndex = node.classList.length; eIndex--;) {
|
|
352
|
+
var className = node.classList[eIndex];
|
|
353
|
+
if (regex.test(className)) {
|
|
354
|
+
return true;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
if (!checkAncestors)
|
|
358
|
+
return false;
|
|
359
|
+
return classMatchesRegex(node.parentNode, regex, checkAncestors);
|
|
360
|
+
}
|
|
361
|
+
function needMaskingText(node, maskTextClass, maskTextSelector) {
|
|
362
|
+
var el = node.nodeType === node.ELEMENT_NODE
|
|
363
|
+
? node
|
|
364
|
+
: node.parentElement;
|
|
365
|
+
if (el === null)
|
|
366
|
+
return false;
|
|
367
|
+
if (typeof maskTextClass === 'string') {
|
|
368
|
+
if (el.classList.contains(maskTextClass))
|
|
369
|
+
return true;
|
|
370
|
+
if (el.closest(".".concat(maskTextClass)))
|
|
371
|
+
return true;
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
if (classMatchesRegex(el, maskTextClass, true))
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
377
|
+
if (maskTextSelector) {
|
|
378
|
+
if (el.matches(maskTextSelector))
|
|
379
|
+
return true;
|
|
380
|
+
if (el.closest(maskTextSelector))
|
|
381
|
+
return true;
|
|
382
|
+
}
|
|
383
|
+
return false;
|
|
384
|
+
}
|
|
385
|
+
function onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) {
|
|
386
|
+
var win = iframeEl.contentWindow;
|
|
387
|
+
if (!win) {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
var fired = false;
|
|
391
|
+
var readyState;
|
|
392
|
+
try {
|
|
393
|
+
readyState = win.document.readyState;
|
|
394
|
+
}
|
|
395
|
+
catch (error) {
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
if (readyState !== 'complete') {
|
|
399
|
+
var timer_1 = setTimeout(function () {
|
|
400
|
+
if (!fired) {
|
|
401
|
+
listener();
|
|
402
|
+
fired = true;
|
|
403
|
+
}
|
|
404
|
+
}, iframeLoadTimeout);
|
|
405
|
+
iframeEl.addEventListener('load', function () {
|
|
406
|
+
clearTimeout(timer_1);
|
|
407
|
+
fired = true;
|
|
408
|
+
listener();
|
|
409
|
+
});
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
var blankUrl = 'about:blank';
|
|
413
|
+
if (win.location.href !== blankUrl ||
|
|
414
|
+
iframeEl.src === blankUrl ||
|
|
415
|
+
iframeEl.src === '') {
|
|
416
|
+
setTimeout(listener, 0);
|
|
417
|
+
return iframeEl.addEventListener('load', listener);
|
|
418
|
+
}
|
|
419
|
+
iframeEl.addEventListener('load', listener);
|
|
420
|
+
}
|
|
421
|
+
function onceStylesheetLoaded(link, listener, styleSheetLoadTimeout) {
|
|
422
|
+
var fired = false;
|
|
423
|
+
var styleSheetLoaded;
|
|
424
|
+
try {
|
|
425
|
+
styleSheetLoaded = link.sheet;
|
|
426
|
+
}
|
|
427
|
+
catch (error) {
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
if (styleSheetLoaded)
|
|
431
|
+
return;
|
|
432
|
+
var timer = setTimeout(function () {
|
|
433
|
+
if (!fired) {
|
|
434
|
+
listener();
|
|
435
|
+
fired = true;
|
|
436
|
+
}
|
|
437
|
+
}, styleSheetLoadTimeout);
|
|
438
|
+
link.addEventListener('load', function () {
|
|
439
|
+
clearTimeout(timer);
|
|
440
|
+
fired = true;
|
|
441
|
+
listener();
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
function serializeNode(n, options) {
|
|
445
|
+
var doc = options.doc, mirror = options.mirror, blockClass = options.blockClass, blockSelector = options.blockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, inlineStylesheet = options.inlineStylesheet, _a = options.maskInputOptions, maskInputOptions = _a === void 0 ? {} : _a, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, _b = options.dataURLOptions, dataURLOptions = _b === void 0 ? {} : _b, inlineImages = options.inlineImages, recordCanvas = options.recordCanvas, keepIframeSrcFn = options.keepIframeSrcFn, _c = options.newlyAddedElement, newlyAddedElement = _c === void 0 ? false : _c;
|
|
446
|
+
var rootId = getRootId(doc, mirror);
|
|
447
|
+
switch (n.nodeType) {
|
|
448
|
+
case n.DOCUMENT_NODE:
|
|
449
|
+
if (n.compatMode !== 'CSS1Compat') {
|
|
450
|
+
return {
|
|
451
|
+
type: NodeType.Document,
|
|
452
|
+
childNodes: [],
|
|
453
|
+
compatMode: n.compatMode
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
457
|
+
return {
|
|
458
|
+
type: NodeType.Document,
|
|
459
|
+
childNodes: []
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
case n.DOCUMENT_TYPE_NODE:
|
|
463
|
+
return {
|
|
464
|
+
type: NodeType.DocumentType,
|
|
465
|
+
name: n.name,
|
|
466
|
+
publicId: n.publicId,
|
|
467
|
+
systemId: n.systemId,
|
|
468
|
+
rootId: rootId
|
|
469
|
+
};
|
|
470
|
+
case n.ELEMENT_NODE:
|
|
471
|
+
return serializeElementNode(n, {
|
|
472
|
+
doc: doc,
|
|
473
|
+
blockClass: blockClass,
|
|
474
|
+
blockSelector: blockSelector,
|
|
475
|
+
inlineStylesheet: inlineStylesheet,
|
|
476
|
+
maskInputOptions: maskInputOptions,
|
|
477
|
+
maskInputFn: maskInputFn,
|
|
478
|
+
dataURLOptions: dataURLOptions,
|
|
479
|
+
inlineImages: inlineImages,
|
|
480
|
+
recordCanvas: recordCanvas,
|
|
481
|
+
keepIframeSrcFn: keepIframeSrcFn,
|
|
482
|
+
newlyAddedElement: newlyAddedElement,
|
|
483
|
+
rootId: rootId
|
|
484
|
+
});
|
|
485
|
+
case n.TEXT_NODE:
|
|
486
|
+
return serializeTextNode(n, {
|
|
487
|
+
maskTextClass: maskTextClass,
|
|
488
|
+
maskTextSelector: maskTextSelector,
|
|
489
|
+
maskTextFn: maskTextFn,
|
|
490
|
+
rootId: rootId
|
|
491
|
+
});
|
|
492
|
+
case n.CDATA_SECTION_NODE:
|
|
493
|
+
return {
|
|
494
|
+
type: NodeType.CDATA,
|
|
495
|
+
textContent: '',
|
|
496
|
+
rootId: rootId
|
|
497
|
+
};
|
|
498
|
+
case n.COMMENT_NODE:
|
|
499
|
+
return {
|
|
500
|
+
type: NodeType.Comment,
|
|
501
|
+
textContent: n.textContent || '',
|
|
502
|
+
rootId: rootId
|
|
503
|
+
};
|
|
504
|
+
default:
|
|
505
|
+
return false;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
function getRootId(doc, mirror) {
|
|
509
|
+
if (!mirror.hasNode(doc))
|
|
510
|
+
return undefined;
|
|
511
|
+
var docId = mirror.getId(doc);
|
|
512
|
+
return docId === 1 ? undefined : docId;
|
|
513
|
+
}
|
|
514
|
+
function serializeTextNode(n, options) {
|
|
515
|
+
var _a;
|
|
516
|
+
var maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, maskTextFn = options.maskTextFn, rootId = options.rootId;
|
|
517
|
+
var parentTagName = n.parentNode && n.parentNode.tagName;
|
|
518
|
+
var textContent = n.textContent;
|
|
519
|
+
var isStyle = parentTagName === 'STYLE' ? true : undefined;
|
|
520
|
+
var isScript = parentTagName === 'SCRIPT' ? true : undefined;
|
|
521
|
+
if (isStyle && textContent) {
|
|
522
|
+
try {
|
|
523
|
+
if (n.nextSibling || n.previousSibling) {
|
|
524
|
+
}
|
|
525
|
+
else if ((_a = n.parentNode.sheet) === null || _a === void 0 ? void 0 : _a.cssRules) {
|
|
526
|
+
textContent = stringifyStyleSheet(n.parentNode.sheet);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
catch (err) {
|
|
530
|
+
console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(err), n);
|
|
531
|
+
}
|
|
532
|
+
textContent = absoluteToStylesheet(textContent, getHref());
|
|
533
|
+
}
|
|
534
|
+
if (isScript) {
|
|
535
|
+
textContent = 'SCRIPT_PLACEHOLDER';
|
|
536
|
+
}
|
|
537
|
+
if (!isStyle &&
|
|
538
|
+
!isScript &&
|
|
539
|
+
textContent &&
|
|
540
|
+
needMaskingText(n, maskTextClass, maskTextSelector)) {
|
|
541
|
+
textContent = maskTextFn
|
|
542
|
+
? maskTextFn(textContent)
|
|
543
|
+
: textContent.replace(/[\S]/g, '*');
|
|
544
|
+
}
|
|
545
|
+
return {
|
|
546
|
+
type: NodeType.Text,
|
|
547
|
+
textContent: textContent || '',
|
|
548
|
+
isStyle: isStyle,
|
|
549
|
+
rootId: rootId
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
function serializeElementNode(n, options) {
|
|
553
|
+
var doc = options.doc, blockClass = options.blockClass, blockSelector = options.blockSelector, inlineStylesheet = options.inlineStylesheet, _a = options.maskInputOptions, maskInputOptions = _a === void 0 ? {} : _a, maskInputFn = options.maskInputFn, _b = options.dataURLOptions, dataURLOptions = _b === void 0 ? {} : _b, inlineImages = options.inlineImages, recordCanvas = options.recordCanvas, keepIframeSrcFn = options.keepIframeSrcFn, _c = options.newlyAddedElement, newlyAddedElement = _c === void 0 ? false : _c, rootId = options.rootId;
|
|
554
|
+
var needBlock = _isBlockedElement(n, blockClass, blockSelector);
|
|
555
|
+
var tagName = getValidTagName(n);
|
|
556
|
+
var attributes = {};
|
|
557
|
+
var len = n.attributes.length;
|
|
558
|
+
for (var i = 0; i < len; i++) {
|
|
559
|
+
var attr = n.attributes[i];
|
|
560
|
+
attributes[attr.name] = transformAttribute(doc, tagName, attr.name, attr.value);
|
|
561
|
+
}
|
|
562
|
+
if (tagName === 'link' && inlineStylesheet) {
|
|
563
|
+
var stylesheet = Array.from(doc.styleSheets).find(function (s) {
|
|
564
|
+
return s.href === n.href;
|
|
565
|
+
});
|
|
566
|
+
var cssText = null;
|
|
567
|
+
if (stylesheet) {
|
|
568
|
+
cssText = getCssRulesString(stylesheet);
|
|
569
|
+
}
|
|
570
|
+
if (cssText) {
|
|
571
|
+
delete attributes.rel;
|
|
572
|
+
delete attributes.href;
|
|
573
|
+
attributes._cssText = absoluteToStylesheet(cssText, stylesheet.href);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
if (tagName === 'style' &&
|
|
577
|
+
n.sheet &&
|
|
578
|
+
!(n.innerText || n.textContent || '').trim().length) {
|
|
579
|
+
var cssText = getCssRulesString(n.sheet);
|
|
580
|
+
if (cssText) {
|
|
581
|
+
attributes._cssText = absoluteToStylesheet(cssText, getHref());
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
if (tagName === 'input' || tagName === 'textarea' || tagName === 'select') {
|
|
585
|
+
var value = n.value;
|
|
586
|
+
var checked = n.checked;
|
|
587
|
+
if (attributes.type !== 'radio' &&
|
|
588
|
+
attributes.type !== 'checkbox' &&
|
|
589
|
+
attributes.type !== 'submit' &&
|
|
590
|
+
attributes.type !== 'button' &&
|
|
591
|
+
value) {
|
|
592
|
+
attributes.value = maskInputValue({
|
|
593
|
+
type: attributes.type,
|
|
594
|
+
tagName: tagName,
|
|
595
|
+
value: value,
|
|
596
|
+
maskInputOptions: maskInputOptions,
|
|
597
|
+
maskInputFn: maskInputFn
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
else if (checked) {
|
|
601
|
+
attributes.checked = checked;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
if (tagName === 'option') {
|
|
605
|
+
if (n.selected && !maskInputOptions['select']) {
|
|
606
|
+
attributes.selected = true;
|
|
607
|
+
}
|
|
608
|
+
else {
|
|
609
|
+
delete attributes.selected;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
if (tagName === 'canvas' && recordCanvas) {
|
|
613
|
+
if (n.__context === '2d') {
|
|
614
|
+
if (!is2DCanvasBlank(n)) {
|
|
615
|
+
attributes.rr_dataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
else if (!('__context' in n)) {
|
|
619
|
+
var canvasDataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
620
|
+
var blankCanvas = document.createElement('canvas');
|
|
621
|
+
blankCanvas.width = n.width;
|
|
622
|
+
blankCanvas.height = n.height;
|
|
623
|
+
var blankCanvasDataURL = blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
624
|
+
if (canvasDataURL !== blankCanvasDataURL) {
|
|
625
|
+
attributes.rr_dataURL = canvasDataURL;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
if (tagName === 'img' && inlineImages) {
|
|
630
|
+
if (!canvasService) {
|
|
631
|
+
canvasService = doc.createElement('canvas');
|
|
632
|
+
canvasCtx = canvasService.getContext('2d');
|
|
633
|
+
}
|
|
634
|
+
var image_1 = n;
|
|
635
|
+
var oldValue_1 = image_1.crossOrigin;
|
|
636
|
+
image_1.crossOrigin = 'anonymous';
|
|
637
|
+
var recordInlineImage = function () {
|
|
638
|
+
try {
|
|
639
|
+
canvasService.width = image_1.naturalWidth;
|
|
640
|
+
canvasService.height = image_1.naturalHeight;
|
|
641
|
+
canvasCtx.drawImage(image_1, 0, 0);
|
|
642
|
+
attributes.rr_dataURL = canvasService.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
643
|
+
}
|
|
644
|
+
catch (err) {
|
|
645
|
+
console.warn("Cannot inline img src=".concat(image_1.currentSrc, "! Error: ").concat(err));
|
|
646
|
+
}
|
|
647
|
+
oldValue_1
|
|
648
|
+
? (attributes.crossOrigin = oldValue_1)
|
|
649
|
+
: image_1.removeAttribute('crossorigin');
|
|
650
|
+
};
|
|
651
|
+
if (image_1.complete && image_1.naturalWidth !== 0)
|
|
652
|
+
recordInlineImage();
|
|
653
|
+
else
|
|
654
|
+
image_1.onload = recordInlineImage;
|
|
655
|
+
}
|
|
656
|
+
if (tagName === 'audio' || tagName === 'video') {
|
|
657
|
+
attributes.rr_mediaState = n.paused
|
|
658
|
+
? 'paused'
|
|
659
|
+
: 'played';
|
|
660
|
+
attributes.rr_mediaCurrentTime = n.currentTime;
|
|
661
|
+
}
|
|
662
|
+
if (!newlyAddedElement) {
|
|
663
|
+
if (n.scrollLeft) {
|
|
664
|
+
attributes.rr_scrollLeft = n.scrollLeft;
|
|
665
|
+
}
|
|
666
|
+
if (n.scrollTop) {
|
|
667
|
+
attributes.rr_scrollTop = n.scrollTop;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
if (needBlock) {
|
|
671
|
+
var _d = n.getBoundingClientRect(), width = _d.width, height = _d.height;
|
|
672
|
+
attributes = {
|
|
673
|
+
"class": attributes["class"],
|
|
674
|
+
rr_width: "".concat(width, "px"),
|
|
675
|
+
rr_height: "".concat(height, "px")
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
if (tagName === 'iframe' && !keepIframeSrcFn(attributes.src)) {
|
|
679
|
+
if (!n.contentDocument) {
|
|
680
|
+
attributes.rr_src = attributes.src;
|
|
681
|
+
}
|
|
682
|
+
delete attributes.src;
|
|
683
|
+
}
|
|
684
|
+
return {
|
|
685
|
+
type: NodeType.Element,
|
|
686
|
+
tagName: tagName,
|
|
687
|
+
attributes: attributes,
|
|
688
|
+
childNodes: [],
|
|
689
|
+
isSVG: isSVGElement(n) || undefined,
|
|
690
|
+
needBlock: needBlock,
|
|
691
|
+
rootId: rootId
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
function lowerIfExists(maybeAttr) {
|
|
695
|
+
if (maybeAttr === undefined) {
|
|
696
|
+
return '';
|
|
697
|
+
}
|
|
698
|
+
else {
|
|
699
|
+
return maybeAttr.toLowerCase();
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
function slimDOMExcluded(sn, slimDOMOptions) {
|
|
703
|
+
if (slimDOMOptions.comment && sn.type === NodeType.Comment) {
|
|
704
|
+
return true;
|
|
705
|
+
}
|
|
706
|
+
else if (sn.type === NodeType.Element) {
|
|
707
|
+
if (slimDOMOptions.script &&
|
|
708
|
+
(sn.tagName === 'script' ||
|
|
709
|
+
(sn.tagName === 'link' &&
|
|
710
|
+
sn.attributes.rel === 'preload' &&
|
|
711
|
+
sn.attributes.as === 'script') ||
|
|
712
|
+
(sn.tagName === 'link' &&
|
|
713
|
+
sn.attributes.rel === 'prefetch' &&
|
|
714
|
+
typeof sn.attributes.href === 'string' &&
|
|
715
|
+
sn.attributes.href.endsWith('.js')))) {
|
|
716
|
+
return true;
|
|
717
|
+
}
|
|
718
|
+
else if (slimDOMOptions.headFavicon &&
|
|
719
|
+
((sn.tagName === 'link' && sn.attributes.rel === 'shortcut icon') ||
|
|
720
|
+
(sn.tagName === 'meta' &&
|
|
721
|
+
(lowerIfExists(sn.attributes.name).match(/^msapplication-tile(image|color)$/) ||
|
|
722
|
+
lowerIfExists(sn.attributes.name) === 'application-name' ||
|
|
723
|
+
lowerIfExists(sn.attributes.rel) === 'icon' ||
|
|
724
|
+
lowerIfExists(sn.attributes.rel) === 'apple-touch-icon' ||
|
|
725
|
+
lowerIfExists(sn.attributes.rel) === 'shortcut icon')))) {
|
|
726
|
+
return true;
|
|
727
|
+
}
|
|
728
|
+
else if (sn.tagName === 'meta') {
|
|
729
|
+
if (slimDOMOptions.headMetaDescKeywords &&
|
|
730
|
+
lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {
|
|
731
|
+
return true;
|
|
732
|
+
}
|
|
733
|
+
else if (slimDOMOptions.headMetaSocial &&
|
|
734
|
+
(lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) ||
|
|
735
|
+
lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) ||
|
|
736
|
+
lowerIfExists(sn.attributes.name) === 'pinterest')) {
|
|
737
|
+
return true;
|
|
738
|
+
}
|
|
739
|
+
else if (slimDOMOptions.headMetaRobots &&
|
|
740
|
+
(lowerIfExists(sn.attributes.name) === 'robots' ||
|
|
741
|
+
lowerIfExists(sn.attributes.name) === 'googlebot' ||
|
|
742
|
+
lowerIfExists(sn.attributes.name) === 'bingbot')) {
|
|
743
|
+
return true;
|
|
744
|
+
}
|
|
745
|
+
else if (slimDOMOptions.headMetaHttpEquiv &&
|
|
746
|
+
sn.attributes['http-equiv'] !== undefined) {
|
|
747
|
+
return true;
|
|
748
|
+
}
|
|
749
|
+
else if (slimDOMOptions.headMetaAuthorship &&
|
|
750
|
+
(lowerIfExists(sn.attributes.name) === 'author' ||
|
|
751
|
+
lowerIfExists(sn.attributes.name) === 'generator' ||
|
|
752
|
+
lowerIfExists(sn.attributes.name) === 'framework' ||
|
|
753
|
+
lowerIfExists(sn.attributes.name) === 'publisher' ||
|
|
754
|
+
lowerIfExists(sn.attributes.name) === 'progid' ||
|
|
755
|
+
lowerIfExists(sn.attributes.property).match(/^article:/) ||
|
|
756
|
+
lowerIfExists(sn.attributes.property).match(/^product:/))) {
|
|
757
|
+
return true;
|
|
758
|
+
}
|
|
759
|
+
else if (slimDOMOptions.headMetaVerification &&
|
|
760
|
+
(lowerIfExists(sn.attributes.name) === 'google-site-verification' ||
|
|
761
|
+
lowerIfExists(sn.attributes.name) === 'yandex-verification' ||
|
|
762
|
+
lowerIfExists(sn.attributes.name) === 'csrf-token' ||
|
|
763
|
+
lowerIfExists(sn.attributes.name) === 'p:domain_verify' ||
|
|
764
|
+
lowerIfExists(sn.attributes.name) === 'verify-v1' ||
|
|
765
|
+
lowerIfExists(sn.attributes.name) === 'verification' ||
|
|
766
|
+
lowerIfExists(sn.attributes.name) === 'shopify-checkout-api-token')) {
|
|
767
|
+
return true;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
return false;
|
|
772
|
+
}
|
|
773
|
+
function serializeNodeWithId(n, options) {
|
|
774
|
+
var doc = options.doc, mirror = options.mirror, blockClass = options.blockClass, blockSelector = options.blockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, _a = options.skipChild, skipChild = _a === void 0 ? false : _a, _b = options.inlineStylesheet, inlineStylesheet = _b === void 0 ? true : _b, _c = options.maskInputOptions, maskInputOptions = _c === void 0 ? {} : _c, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, slimDOMOptions = options.slimDOMOptions, _d = options.dataURLOptions, dataURLOptions = _d === void 0 ? {} : _d, _e = options.inlineImages, inlineImages = _e === void 0 ? false : _e, _f = options.recordCanvas, recordCanvas = _f === void 0 ? false : _f, onSerialize = options.onSerialize, onIframeLoad = options.onIframeLoad, _g = options.iframeLoadTimeout, iframeLoadTimeout = _g === void 0 ? 5000 : _g, onStylesheetLoad = options.onStylesheetLoad, _h = options.stylesheetLoadTimeout, stylesheetLoadTimeout = _h === void 0 ? 5000 : _h, _j = options.keepIframeSrcFn, keepIframeSrcFn = _j === void 0 ? function () { return false; } : _j, _k = options.newlyAddedElement, newlyAddedElement = _k === void 0 ? false : _k;
|
|
775
|
+
var _l = options.preserveWhiteSpace, preserveWhiteSpace = _l === void 0 ? true : _l;
|
|
776
|
+
var _serializedNode = serializeNode(n, {
|
|
777
|
+
doc: doc,
|
|
778
|
+
mirror: mirror,
|
|
779
|
+
blockClass: blockClass,
|
|
780
|
+
blockSelector: blockSelector,
|
|
781
|
+
maskTextClass: maskTextClass,
|
|
782
|
+
maskTextSelector: maskTextSelector,
|
|
783
|
+
inlineStylesheet: inlineStylesheet,
|
|
784
|
+
maskInputOptions: maskInputOptions,
|
|
785
|
+
maskTextFn: maskTextFn,
|
|
786
|
+
maskInputFn: maskInputFn,
|
|
787
|
+
dataURLOptions: dataURLOptions,
|
|
788
|
+
inlineImages: inlineImages,
|
|
789
|
+
recordCanvas: recordCanvas,
|
|
790
|
+
keepIframeSrcFn: keepIframeSrcFn,
|
|
791
|
+
newlyAddedElement: newlyAddedElement
|
|
792
|
+
});
|
|
793
|
+
if (!_serializedNode) {
|
|
794
|
+
console.warn(n, 'not serialized');
|
|
795
|
+
return null;
|
|
796
|
+
}
|
|
797
|
+
var id;
|
|
798
|
+
if (mirror.hasNode(n)) {
|
|
799
|
+
id = mirror.getId(n);
|
|
800
|
+
}
|
|
801
|
+
else if (slimDOMExcluded(_serializedNode, slimDOMOptions) ||
|
|
802
|
+
(!preserveWhiteSpace &&
|
|
803
|
+
_serializedNode.type === NodeType.Text &&
|
|
804
|
+
!_serializedNode.isStyle &&
|
|
805
|
+
!_serializedNode.textContent.replace(/^\s+|\s+$/gm, '').length)) {
|
|
806
|
+
id = IGNORED_NODE;
|
|
807
|
+
}
|
|
808
|
+
else {
|
|
809
|
+
id = genId();
|
|
810
|
+
}
|
|
811
|
+
var serializedNode = Object.assign(_serializedNode, { id: id });
|
|
812
|
+
mirror.add(n, serializedNode);
|
|
813
|
+
if (id === IGNORED_NODE) {
|
|
814
|
+
return null;
|
|
815
|
+
}
|
|
816
|
+
if (onSerialize) {
|
|
817
|
+
onSerialize(n);
|
|
818
|
+
}
|
|
819
|
+
var recordChild = !skipChild;
|
|
820
|
+
if (serializedNode.type === NodeType.Element) {
|
|
821
|
+
recordChild = recordChild && !serializedNode.needBlock;
|
|
822
|
+
delete serializedNode.needBlock;
|
|
823
|
+
var shadowRoot = n.shadowRoot;
|
|
824
|
+
if (shadowRoot && isNativeShadowDom(shadowRoot))
|
|
825
|
+
serializedNode.isShadowHost = true;
|
|
826
|
+
}
|
|
827
|
+
if ((serializedNode.type === NodeType.Document ||
|
|
828
|
+
serializedNode.type === NodeType.Element) &&
|
|
829
|
+
recordChild) {
|
|
830
|
+
if (slimDOMOptions.headWhitespace &&
|
|
831
|
+
serializedNode.type === NodeType.Element &&
|
|
832
|
+
serializedNode.tagName === 'head') {
|
|
833
|
+
preserveWhiteSpace = false;
|
|
834
|
+
}
|
|
835
|
+
var bypassOptions = {
|
|
836
|
+
doc: doc,
|
|
837
|
+
mirror: mirror,
|
|
838
|
+
blockClass: blockClass,
|
|
839
|
+
blockSelector: blockSelector,
|
|
840
|
+
maskTextClass: maskTextClass,
|
|
841
|
+
maskTextSelector: maskTextSelector,
|
|
842
|
+
skipChild: skipChild,
|
|
843
|
+
inlineStylesheet: inlineStylesheet,
|
|
844
|
+
maskInputOptions: maskInputOptions,
|
|
845
|
+
maskTextFn: maskTextFn,
|
|
846
|
+
maskInputFn: maskInputFn,
|
|
847
|
+
slimDOMOptions: slimDOMOptions,
|
|
848
|
+
dataURLOptions: dataURLOptions,
|
|
849
|
+
inlineImages: inlineImages,
|
|
850
|
+
recordCanvas: recordCanvas,
|
|
851
|
+
preserveWhiteSpace: preserveWhiteSpace,
|
|
852
|
+
onSerialize: onSerialize,
|
|
853
|
+
onIframeLoad: onIframeLoad,
|
|
854
|
+
iframeLoadTimeout: iframeLoadTimeout,
|
|
855
|
+
onStylesheetLoad: onStylesheetLoad,
|
|
856
|
+
stylesheetLoadTimeout: stylesheetLoadTimeout,
|
|
857
|
+
keepIframeSrcFn: keepIframeSrcFn
|
|
858
|
+
};
|
|
859
|
+
for (var _i = 0, _m = Array.from(n.childNodes); _i < _m.length; _i++) {
|
|
860
|
+
var childN = _m[_i];
|
|
861
|
+
var serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
862
|
+
if (serializedChildNode) {
|
|
863
|
+
serializedNode.childNodes.push(serializedChildNode);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
if (isElement(n) && n.shadowRoot) {
|
|
867
|
+
for (var _o = 0, _p = Array.from(n.shadowRoot.childNodes); _o < _p.length; _o++) {
|
|
868
|
+
var childN = _p[_o];
|
|
869
|
+
var serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
870
|
+
if (serializedChildNode) {
|
|
871
|
+
isNativeShadowDom(n.shadowRoot) &&
|
|
872
|
+
(serializedChildNode.isShadow = true);
|
|
873
|
+
serializedNode.childNodes.push(serializedChildNode);
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
if (n.parentNode &&
|
|
879
|
+
isShadowRoot(n.parentNode) &&
|
|
880
|
+
isNativeShadowDom(n.parentNode)) {
|
|
881
|
+
serializedNode.isShadow = true;
|
|
882
|
+
}
|
|
883
|
+
if (serializedNode.type === NodeType.Element &&
|
|
884
|
+
serializedNode.tagName === 'iframe') {
|
|
885
|
+
onceIframeLoaded(n, function () {
|
|
886
|
+
var iframeDoc = n.contentDocument;
|
|
887
|
+
if (iframeDoc && onIframeLoad) {
|
|
888
|
+
var serializedIframeNode = serializeNodeWithId(iframeDoc, {
|
|
889
|
+
doc: iframeDoc,
|
|
890
|
+
mirror: mirror,
|
|
891
|
+
blockClass: blockClass,
|
|
892
|
+
blockSelector: blockSelector,
|
|
893
|
+
maskTextClass: maskTextClass,
|
|
894
|
+
maskTextSelector: maskTextSelector,
|
|
895
|
+
skipChild: false,
|
|
896
|
+
inlineStylesheet: inlineStylesheet,
|
|
897
|
+
maskInputOptions: maskInputOptions,
|
|
898
|
+
maskTextFn: maskTextFn,
|
|
899
|
+
maskInputFn: maskInputFn,
|
|
900
|
+
slimDOMOptions: slimDOMOptions,
|
|
901
|
+
dataURLOptions: dataURLOptions,
|
|
902
|
+
inlineImages: inlineImages,
|
|
903
|
+
recordCanvas: recordCanvas,
|
|
904
|
+
preserveWhiteSpace: preserveWhiteSpace,
|
|
905
|
+
onSerialize: onSerialize,
|
|
906
|
+
onIframeLoad: onIframeLoad,
|
|
907
|
+
iframeLoadTimeout: iframeLoadTimeout,
|
|
908
|
+
onStylesheetLoad: onStylesheetLoad,
|
|
909
|
+
stylesheetLoadTimeout: stylesheetLoadTimeout,
|
|
910
|
+
keepIframeSrcFn: keepIframeSrcFn
|
|
911
|
+
});
|
|
912
|
+
if (serializedIframeNode) {
|
|
913
|
+
onIframeLoad(n, serializedIframeNode);
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
}, iframeLoadTimeout);
|
|
917
|
+
}
|
|
918
|
+
if (serializedNode.type === NodeType.Element &&
|
|
919
|
+
serializedNode.tagName === 'link' &&
|
|
920
|
+
serializedNode.attributes.rel === 'stylesheet') {
|
|
921
|
+
onceStylesheetLoaded(n, function () {
|
|
922
|
+
if (onStylesheetLoad) {
|
|
923
|
+
var serializedLinkNode = serializeNodeWithId(n, {
|
|
924
|
+
doc: doc,
|
|
925
|
+
mirror: mirror,
|
|
926
|
+
blockClass: blockClass,
|
|
927
|
+
blockSelector: blockSelector,
|
|
928
|
+
maskTextClass: maskTextClass,
|
|
929
|
+
maskTextSelector: maskTextSelector,
|
|
930
|
+
skipChild: false,
|
|
931
|
+
inlineStylesheet: inlineStylesheet,
|
|
932
|
+
maskInputOptions: maskInputOptions,
|
|
933
|
+
maskTextFn: maskTextFn,
|
|
934
|
+
maskInputFn: maskInputFn,
|
|
935
|
+
slimDOMOptions: slimDOMOptions,
|
|
936
|
+
dataURLOptions: dataURLOptions,
|
|
937
|
+
inlineImages: inlineImages,
|
|
938
|
+
recordCanvas: recordCanvas,
|
|
939
|
+
preserveWhiteSpace: preserveWhiteSpace,
|
|
940
|
+
onSerialize: onSerialize,
|
|
941
|
+
onIframeLoad: onIframeLoad,
|
|
942
|
+
iframeLoadTimeout: iframeLoadTimeout,
|
|
943
|
+
onStylesheetLoad: onStylesheetLoad,
|
|
944
|
+
stylesheetLoadTimeout: stylesheetLoadTimeout,
|
|
945
|
+
keepIframeSrcFn: keepIframeSrcFn
|
|
946
|
+
});
|
|
947
|
+
if (serializedLinkNode) {
|
|
948
|
+
onStylesheetLoad(n, serializedLinkNode);
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
}, stylesheetLoadTimeout);
|
|
952
|
+
}
|
|
953
|
+
return serializedNode;
|
|
954
|
+
}
|
|
955
|
+
function snapshot(n, options) {
|
|
956
|
+
var _a = options || {}, _b = _a.mirror, mirror = _b === void 0 ? new Mirror() : _b, _c = _a.blockClass, blockClass = _c === void 0 ? 'rr-block' : _c, _d = _a.blockSelector, blockSelector = _d === void 0 ? null : _d, _e = _a.maskTextClass, maskTextClass = _e === void 0 ? 'rr-mask' : _e, _f = _a.maskTextSelector, maskTextSelector = _f === void 0 ? null : _f, _g = _a.inlineStylesheet, inlineStylesheet = _g === void 0 ? true : _g, _h = _a.inlineImages, inlineImages = _h === void 0 ? false : _h, _j = _a.recordCanvas, recordCanvas = _j === void 0 ? false : _j, _k = _a.maskAllInputs, maskAllInputs = _k === void 0 ? false : _k, maskTextFn = _a.maskTextFn, maskInputFn = _a.maskInputFn, _l = _a.slimDOM, slimDOM = _l === void 0 ? false : _l, dataURLOptions = _a.dataURLOptions, preserveWhiteSpace = _a.preserveWhiteSpace, onSerialize = _a.onSerialize, onIframeLoad = _a.onIframeLoad, iframeLoadTimeout = _a.iframeLoadTimeout, onStylesheetLoad = _a.onStylesheetLoad, stylesheetLoadTimeout = _a.stylesheetLoadTimeout, _m = _a.keepIframeSrcFn, keepIframeSrcFn = _m === void 0 ? function () { return false; } : _m;
|
|
957
|
+
var maskInputOptions = maskAllInputs === true
|
|
958
|
+
? {
|
|
959
|
+
color: true,
|
|
960
|
+
date: true,
|
|
961
|
+
'datetime-local': true,
|
|
962
|
+
email: true,
|
|
963
|
+
month: true,
|
|
964
|
+
number: true,
|
|
965
|
+
range: true,
|
|
966
|
+
search: true,
|
|
967
|
+
tel: true,
|
|
968
|
+
text: true,
|
|
969
|
+
time: true,
|
|
970
|
+
url: true,
|
|
971
|
+
week: true,
|
|
972
|
+
textarea: true,
|
|
973
|
+
select: true,
|
|
974
|
+
password: true
|
|
975
|
+
}
|
|
976
|
+
: maskAllInputs === false
|
|
977
|
+
? {
|
|
978
|
+
password: true
|
|
979
|
+
}
|
|
980
|
+
: maskAllInputs;
|
|
981
|
+
var slimDOMOptions = slimDOM === true || slimDOM === 'all'
|
|
982
|
+
?
|
|
983
|
+
{
|
|
984
|
+
script: true,
|
|
985
|
+
comment: true,
|
|
986
|
+
headFavicon: true,
|
|
987
|
+
headWhitespace: true,
|
|
988
|
+
headMetaDescKeywords: slimDOM === 'all',
|
|
989
|
+
headMetaSocial: true,
|
|
990
|
+
headMetaRobots: true,
|
|
991
|
+
headMetaHttpEquiv: true,
|
|
992
|
+
headMetaAuthorship: true,
|
|
993
|
+
headMetaVerification: true
|
|
994
|
+
}
|
|
995
|
+
: slimDOM === false
|
|
996
|
+
? {}
|
|
997
|
+
: slimDOM;
|
|
998
|
+
return serializeNodeWithId(n, {
|
|
999
|
+
doc: n,
|
|
1000
|
+
mirror: mirror,
|
|
1001
|
+
blockClass: blockClass,
|
|
1002
|
+
blockSelector: blockSelector,
|
|
1003
|
+
maskTextClass: maskTextClass,
|
|
1004
|
+
maskTextSelector: maskTextSelector,
|
|
1005
|
+
skipChild: false,
|
|
1006
|
+
inlineStylesheet: inlineStylesheet,
|
|
1007
|
+
maskInputOptions: maskInputOptions,
|
|
1008
|
+
maskTextFn: maskTextFn,
|
|
1009
|
+
maskInputFn: maskInputFn,
|
|
1010
|
+
slimDOMOptions: slimDOMOptions,
|
|
1011
|
+
dataURLOptions: dataURLOptions,
|
|
1012
|
+
inlineImages: inlineImages,
|
|
1013
|
+
recordCanvas: recordCanvas,
|
|
1014
|
+
preserveWhiteSpace: preserveWhiteSpace,
|
|
1015
|
+
onSerialize: onSerialize,
|
|
1016
|
+
onIframeLoad: onIframeLoad,
|
|
1017
|
+
iframeLoadTimeout: iframeLoadTimeout,
|
|
1018
|
+
onStylesheetLoad: onStylesheetLoad,
|
|
1019
|
+
stylesheetLoadTimeout: stylesheetLoadTimeout,
|
|
1020
|
+
keepIframeSrcFn: keepIframeSrcFn,
|
|
1021
|
+
newlyAddedElement: false
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
function on(type, fn, target = document) {
|
|
1026
|
+
const options = { capture: true, passive: true };
|
|
1027
|
+
target.addEventListener(type, fn, options);
|
|
1028
|
+
return () => target.removeEventListener(type, fn, options);
|
|
1029
|
+
}
|
|
1030
|
+
const DEPARTED_MIRROR_ACCESS_WARNING = 'Please stop import mirror directly. Instead of that,' +
|
|
1031
|
+
'\r\n' +
|
|
1032
|
+
'now you can use replayer.getMirror() to access the mirror instance of a replayer,' +
|
|
1033
|
+
'\r\n' +
|
|
1034
|
+
'or you can use record.mirror to access the mirror instance during recording.';
|
|
1035
|
+
let _mirror = {
|
|
1036
|
+
map: {},
|
|
1037
|
+
getId() {
|
|
1038
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
1039
|
+
return -1;
|
|
1040
|
+
},
|
|
1041
|
+
getNode() {
|
|
1042
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
1043
|
+
return null;
|
|
1044
|
+
},
|
|
1045
|
+
removeNodeFromMap() {
|
|
1046
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
1047
|
+
},
|
|
1048
|
+
has() {
|
|
1049
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
1050
|
+
return false;
|
|
1051
|
+
},
|
|
1052
|
+
reset() {
|
|
1053
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
1054
|
+
},
|
|
1055
|
+
};
|
|
1056
|
+
if (typeof window !== 'undefined' && window.Proxy && window.Reflect) {
|
|
1057
|
+
_mirror = new Proxy(_mirror, {
|
|
1058
|
+
get(target, prop, receiver) {
|
|
1059
|
+
if (prop === 'map') {
|
|
1060
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
1061
|
+
}
|
|
1062
|
+
return Reflect.get(target, prop, receiver);
|
|
1063
|
+
},
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
1066
|
+
function throttle(func, wait, options = {}) {
|
|
1067
|
+
let timeout = null;
|
|
1068
|
+
let previous = 0;
|
|
1069
|
+
return function (...args) {
|
|
1070
|
+
const now = Date.now();
|
|
1071
|
+
if (!previous && options.leading === false) {
|
|
1072
|
+
previous = now;
|
|
1073
|
+
}
|
|
1074
|
+
const remaining = wait - (now - previous);
|
|
1075
|
+
const context = this;
|
|
1076
|
+
if (remaining <= 0 || remaining > wait) {
|
|
1077
|
+
if (timeout) {
|
|
1078
|
+
clearTimeout(timeout);
|
|
1079
|
+
timeout = null;
|
|
1080
|
+
}
|
|
1081
|
+
previous = now;
|
|
1082
|
+
func.apply(context, args);
|
|
1083
|
+
}
|
|
1084
|
+
else if (!timeout && options.trailing !== false) {
|
|
1085
|
+
timeout = setTimeout(() => {
|
|
1086
|
+
previous = options.leading === false ? 0 : Date.now();
|
|
1087
|
+
timeout = null;
|
|
1088
|
+
func.apply(context, args);
|
|
1089
|
+
}, remaining);
|
|
1090
|
+
}
|
|
1091
|
+
};
|
|
1092
|
+
}
|
|
1093
|
+
function hookSetter(target, key, d, isRevoked, win = window) {
|
|
1094
|
+
const original = win.Object.getOwnPropertyDescriptor(target, key);
|
|
1095
|
+
win.Object.defineProperty(target, key, isRevoked
|
|
1096
|
+
? d
|
|
1097
|
+
: {
|
|
1098
|
+
set(value) {
|
|
1099
|
+
setTimeout(() => {
|
|
1100
|
+
d.set.call(this, value);
|
|
1101
|
+
}, 0);
|
|
1102
|
+
if (original && original.set) {
|
|
1103
|
+
original.set.call(this, value);
|
|
1104
|
+
}
|
|
1105
|
+
},
|
|
1106
|
+
});
|
|
1107
|
+
return () => hookSetter(target, key, original || {}, true);
|
|
1108
|
+
}
|
|
1109
|
+
function patch(source, name, replacement) {
|
|
1110
|
+
try {
|
|
1111
|
+
if (!(name in source)) {
|
|
1112
|
+
return () => {
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1115
|
+
const original = source[name];
|
|
1116
|
+
const wrapped = replacement(original);
|
|
1117
|
+
if (typeof wrapped === 'function') {
|
|
1118
|
+
wrapped.prototype = wrapped.prototype || {};
|
|
1119
|
+
Object.defineProperties(wrapped, {
|
|
1120
|
+
__rrweb_original__: {
|
|
1121
|
+
enumerable: false,
|
|
1122
|
+
value: original,
|
|
1123
|
+
},
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
source[name] = wrapped;
|
|
1127
|
+
return () => {
|
|
1128
|
+
source[name] = original;
|
|
1129
|
+
};
|
|
1130
|
+
}
|
|
1131
|
+
catch (_a) {
|
|
1132
|
+
return () => {
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
function getWindowHeight() {
|
|
1137
|
+
return (window.innerHeight ||
|
|
1138
|
+
(document.documentElement && document.documentElement.clientHeight) ||
|
|
1139
|
+
(document.body && document.body.clientHeight));
|
|
1140
|
+
}
|
|
1141
|
+
function getWindowWidth() {
|
|
1142
|
+
return (window.innerWidth ||
|
|
1143
|
+
(document.documentElement && document.documentElement.clientWidth) ||
|
|
1144
|
+
(document.body && document.body.clientWidth));
|
|
1145
|
+
}
|
|
1146
|
+
function isBlocked(node, blockClass, blockSelector, checkAncestors) {
|
|
1147
|
+
if (!node) {
|
|
1148
|
+
return false;
|
|
1149
|
+
}
|
|
1150
|
+
const el = node.nodeType === node.ELEMENT_NODE
|
|
1151
|
+
? node
|
|
1152
|
+
: node.parentElement;
|
|
1153
|
+
if (!el)
|
|
1154
|
+
return false;
|
|
1155
|
+
if (typeof blockClass === 'string') {
|
|
1156
|
+
if (el.classList.contains(blockClass))
|
|
1157
|
+
return true;
|
|
1158
|
+
if (checkAncestors && el.closest('.' + blockClass) !== null)
|
|
1159
|
+
return true;
|
|
1160
|
+
}
|
|
1161
|
+
else {
|
|
1162
|
+
if (classMatchesRegex(el, blockClass, checkAncestors))
|
|
1163
|
+
return true;
|
|
1164
|
+
}
|
|
1165
|
+
if (blockSelector) {
|
|
1166
|
+
if (node.matches(blockSelector))
|
|
1167
|
+
return true;
|
|
1168
|
+
if (checkAncestors && el.closest(blockSelector) !== null)
|
|
1169
|
+
return true;
|
|
1170
|
+
}
|
|
1171
|
+
return false;
|
|
1172
|
+
}
|
|
1173
|
+
function isSerialized(n, mirror) {
|
|
1174
|
+
return mirror.getId(n) !== -1;
|
|
1175
|
+
}
|
|
1176
|
+
function isIgnored(n, mirror) {
|
|
1177
|
+
return mirror.getId(n) === IGNORED_NODE;
|
|
1178
|
+
}
|
|
1179
|
+
function isAncestorRemoved(target, mirror) {
|
|
1180
|
+
if (isShadowRoot(target)) {
|
|
1181
|
+
return false;
|
|
1182
|
+
}
|
|
1183
|
+
const id = mirror.getId(target);
|
|
1184
|
+
if (!mirror.has(id)) {
|
|
1185
|
+
return true;
|
|
1186
|
+
}
|
|
1187
|
+
if (target.parentNode &&
|
|
1188
|
+
target.parentNode.nodeType === target.DOCUMENT_NODE) {
|
|
1189
|
+
return false;
|
|
1190
|
+
}
|
|
1191
|
+
if (!target.parentNode) {
|
|
1192
|
+
return true;
|
|
1193
|
+
}
|
|
1194
|
+
return isAncestorRemoved(target.parentNode, mirror);
|
|
1195
|
+
}
|
|
1196
|
+
function isTouchEvent(event) {
|
|
1197
|
+
return Boolean(event.changedTouches);
|
|
1198
|
+
}
|
|
1199
|
+
function polyfill(win = window) {
|
|
1200
|
+
if ('NodeList' in win && !win.NodeList.prototype.forEach) {
|
|
1201
|
+
win.NodeList.prototype.forEach = Array.prototype
|
|
1202
|
+
.forEach;
|
|
1203
|
+
}
|
|
1204
|
+
if ('DOMTokenList' in win && !win.DOMTokenList.prototype.forEach) {
|
|
1205
|
+
win.DOMTokenList.prototype.forEach = Array.prototype
|
|
1206
|
+
.forEach;
|
|
1207
|
+
}
|
|
1208
|
+
if (!Node.prototype.contains) {
|
|
1209
|
+
Node.prototype.contains = (...args) => {
|
|
1210
|
+
let node = args[0];
|
|
1211
|
+
if (!(0 in args)) {
|
|
1212
|
+
throw new TypeError('1 argument is required');
|
|
1213
|
+
}
|
|
1214
|
+
do {
|
|
1215
|
+
if (this === node) {
|
|
1216
|
+
return true;
|
|
1217
|
+
}
|
|
1218
|
+
} while ((node = node && node.parentNode));
|
|
1219
|
+
return false;
|
|
1220
|
+
};
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
function isSerializedIframe(n, mirror) {
|
|
1224
|
+
return Boolean(n.nodeName === 'IFRAME' && mirror.getMeta(n));
|
|
1225
|
+
}
|
|
1226
|
+
function isSerializedStylesheet(n, mirror) {
|
|
1227
|
+
return Boolean(n.nodeName === 'LINK' &&
|
|
1228
|
+
n.nodeType === n.ELEMENT_NODE &&
|
|
1229
|
+
n.getAttribute &&
|
|
1230
|
+
n.getAttribute('rel') === 'stylesheet' &&
|
|
1231
|
+
mirror.getMeta(n));
|
|
1232
|
+
}
|
|
1233
|
+
function hasShadowRoot(n) {
|
|
1234
|
+
return Boolean(n === null || n === void 0 ? void 0 : n.shadowRoot);
|
|
1235
|
+
}
|
|
1236
|
+
class StyleSheetMirror {
|
|
1237
|
+
constructor() {
|
|
1238
|
+
this.id = 1;
|
|
1239
|
+
this.styleIDMap = new WeakMap();
|
|
1240
|
+
this.idStyleMap = new Map();
|
|
1241
|
+
}
|
|
1242
|
+
getId(stylesheet) {
|
|
1243
|
+
var _a;
|
|
1244
|
+
return (_a = this.styleIDMap.get(stylesheet)) !== null && _a !== void 0 ? _a : -1;
|
|
1245
|
+
}
|
|
1246
|
+
has(stylesheet) {
|
|
1247
|
+
return this.styleIDMap.has(stylesheet);
|
|
1248
|
+
}
|
|
1249
|
+
add(stylesheet, id) {
|
|
1250
|
+
if (this.has(stylesheet))
|
|
1251
|
+
return this.getId(stylesheet);
|
|
1252
|
+
let newId;
|
|
1253
|
+
if (id === undefined) {
|
|
1254
|
+
newId = this.id++;
|
|
1255
|
+
}
|
|
1256
|
+
else
|
|
1257
|
+
newId = id;
|
|
1258
|
+
this.styleIDMap.set(stylesheet, newId);
|
|
1259
|
+
this.idStyleMap.set(newId, stylesheet);
|
|
1260
|
+
return newId;
|
|
1261
|
+
}
|
|
1262
|
+
getStyle(id) {
|
|
1263
|
+
return this.idStyleMap.get(id) || null;
|
|
1264
|
+
}
|
|
1265
|
+
reset() {
|
|
1266
|
+
this.styleIDMap = new WeakMap();
|
|
1267
|
+
this.idStyleMap = new Map();
|
|
1268
|
+
this.id = 1;
|
|
1269
|
+
}
|
|
1270
|
+
generateId() {
|
|
1271
|
+
return this.id++;
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
var EventType = /* @__PURE__ */ ((EventType2) => {
|
|
1276
|
+
EventType2[EventType2["DomContentLoaded"] = 0] = "DomContentLoaded";
|
|
1277
|
+
EventType2[EventType2["Load"] = 1] = "Load";
|
|
1278
|
+
EventType2[EventType2["FullSnapshot"] = 2] = "FullSnapshot";
|
|
1279
|
+
EventType2[EventType2["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
|
|
1280
|
+
EventType2[EventType2["Meta"] = 4] = "Meta";
|
|
1281
|
+
EventType2[EventType2["Custom"] = 5] = "Custom";
|
|
1282
|
+
EventType2[EventType2["Plugin"] = 6] = "Plugin";
|
|
1283
|
+
return EventType2;
|
|
1284
|
+
})(EventType || {});
|
|
1285
|
+
var IncrementalSource = /* @__PURE__ */ ((IncrementalSource2) => {
|
|
1286
|
+
IncrementalSource2[IncrementalSource2["Mutation"] = 0] = "Mutation";
|
|
1287
|
+
IncrementalSource2[IncrementalSource2["MouseMove"] = 1] = "MouseMove";
|
|
1288
|
+
IncrementalSource2[IncrementalSource2["MouseInteraction"] = 2] = "MouseInteraction";
|
|
1289
|
+
IncrementalSource2[IncrementalSource2["Scroll"] = 3] = "Scroll";
|
|
1290
|
+
IncrementalSource2[IncrementalSource2["ViewportResize"] = 4] = "ViewportResize";
|
|
1291
|
+
IncrementalSource2[IncrementalSource2["Input"] = 5] = "Input";
|
|
1292
|
+
IncrementalSource2[IncrementalSource2["TouchMove"] = 6] = "TouchMove";
|
|
1293
|
+
IncrementalSource2[IncrementalSource2["MediaInteraction"] = 7] = "MediaInteraction";
|
|
1294
|
+
IncrementalSource2[IncrementalSource2["StyleSheetRule"] = 8] = "StyleSheetRule";
|
|
1295
|
+
IncrementalSource2[IncrementalSource2["CanvasMutation"] = 9] = "CanvasMutation";
|
|
1296
|
+
IncrementalSource2[IncrementalSource2["Font"] = 10] = "Font";
|
|
1297
|
+
IncrementalSource2[IncrementalSource2["Log"] = 11] = "Log";
|
|
1298
|
+
IncrementalSource2[IncrementalSource2["Drag"] = 12] = "Drag";
|
|
1299
|
+
IncrementalSource2[IncrementalSource2["StyleDeclaration"] = 13] = "StyleDeclaration";
|
|
1300
|
+
IncrementalSource2[IncrementalSource2["Selection"] = 14] = "Selection";
|
|
1301
|
+
IncrementalSource2[IncrementalSource2["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet";
|
|
1302
|
+
return IncrementalSource2;
|
|
1303
|
+
})(IncrementalSource || {});
|
|
1304
|
+
var MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => {
|
|
1305
|
+
MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp";
|
|
1306
|
+
MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown";
|
|
1307
|
+
MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click";
|
|
1308
|
+
MouseInteractions2[MouseInteractions2["ContextMenu"] = 3] = "ContextMenu";
|
|
1309
|
+
MouseInteractions2[MouseInteractions2["DblClick"] = 4] = "DblClick";
|
|
1310
|
+
MouseInteractions2[MouseInteractions2["Focus"] = 5] = "Focus";
|
|
1311
|
+
MouseInteractions2[MouseInteractions2["Blur"] = 6] = "Blur";
|
|
1312
|
+
MouseInteractions2[MouseInteractions2["TouchStart"] = 7] = "TouchStart";
|
|
1313
|
+
MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 8] = "TouchMove_Departed";
|
|
1314
|
+
MouseInteractions2[MouseInteractions2["TouchEnd"] = 9] = "TouchEnd";
|
|
1315
|
+
MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel";
|
|
1316
|
+
return MouseInteractions2;
|
|
1317
|
+
})(MouseInteractions || {});
|
|
1318
|
+
var CanvasContext = /* @__PURE__ */ ((CanvasContext2) => {
|
|
1319
|
+
CanvasContext2[CanvasContext2["2D"] = 0] = "2D";
|
|
1320
|
+
CanvasContext2[CanvasContext2["WebGL"] = 1] = "WebGL";
|
|
1321
|
+
CanvasContext2[CanvasContext2["WebGL2"] = 2] = "WebGL2";
|
|
1322
|
+
return CanvasContext2;
|
|
1323
|
+
})(CanvasContext || {});
|
|
1324
|
+
|
|
1325
|
+
function isNodeInLinkedList(n) {
|
|
1326
|
+
return '__ln' in n;
|
|
1327
|
+
}
|
|
1328
|
+
class DoubleLinkedList {
|
|
1329
|
+
constructor() {
|
|
1330
|
+
this.length = 0;
|
|
1331
|
+
this.head = null;
|
|
1332
|
+
}
|
|
1333
|
+
get(position) {
|
|
1334
|
+
if (position >= this.length) {
|
|
1335
|
+
throw new Error('Position outside of list range');
|
|
1336
|
+
}
|
|
1337
|
+
let current = this.head;
|
|
1338
|
+
for (let index = 0; index < position; index++) {
|
|
1339
|
+
current = (current === null || current === void 0 ? void 0 : current.next) || null;
|
|
1340
|
+
}
|
|
1341
|
+
return current;
|
|
1342
|
+
}
|
|
1343
|
+
addNode(n) {
|
|
1344
|
+
const node = {
|
|
1345
|
+
value: n,
|
|
1346
|
+
previous: null,
|
|
1347
|
+
next: null,
|
|
1348
|
+
};
|
|
1349
|
+
n.__ln = node;
|
|
1350
|
+
if (n.previousSibling && isNodeInLinkedList(n.previousSibling)) {
|
|
1351
|
+
const current = n.previousSibling.__ln.next;
|
|
1352
|
+
node.next = current;
|
|
1353
|
+
node.previous = n.previousSibling.__ln;
|
|
1354
|
+
n.previousSibling.__ln.next = node;
|
|
1355
|
+
if (current) {
|
|
1356
|
+
current.previous = node;
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
else if (n.nextSibling &&
|
|
1360
|
+
isNodeInLinkedList(n.nextSibling) &&
|
|
1361
|
+
n.nextSibling.__ln.previous) {
|
|
1362
|
+
const current = n.nextSibling.__ln.previous;
|
|
1363
|
+
node.previous = current;
|
|
1364
|
+
node.next = n.nextSibling.__ln;
|
|
1365
|
+
n.nextSibling.__ln.previous = node;
|
|
1366
|
+
if (current) {
|
|
1367
|
+
current.next = node;
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
else {
|
|
1371
|
+
if (this.head) {
|
|
1372
|
+
this.head.previous = node;
|
|
1373
|
+
}
|
|
1374
|
+
node.next = this.head;
|
|
1375
|
+
this.head = node;
|
|
1376
|
+
}
|
|
1377
|
+
this.length++;
|
|
1378
|
+
}
|
|
1379
|
+
removeNode(n) {
|
|
1380
|
+
const current = n.__ln;
|
|
1381
|
+
if (!this.head) {
|
|
1382
|
+
return;
|
|
1383
|
+
}
|
|
1384
|
+
if (!current.previous) {
|
|
1385
|
+
this.head = current.next;
|
|
1386
|
+
if (this.head) {
|
|
1387
|
+
this.head.previous = null;
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
else {
|
|
1391
|
+
current.previous.next = current.next;
|
|
1392
|
+
if (current.next) {
|
|
1393
|
+
current.next.previous = current.previous;
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
if (n.__ln) {
|
|
1397
|
+
delete n.__ln;
|
|
1398
|
+
}
|
|
1399
|
+
this.length--;
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
const moveKey = (id, parentId) => `${id}@${parentId}`;
|
|
1403
|
+
class MutationBuffer {
|
|
1404
|
+
constructor() {
|
|
1405
|
+
this.frozen = false;
|
|
1406
|
+
this.locked = false;
|
|
1407
|
+
this.texts = [];
|
|
1408
|
+
this.attributes = [];
|
|
1409
|
+
this.removes = [];
|
|
1410
|
+
this.mapRemoves = [];
|
|
1411
|
+
this.movedMap = {};
|
|
1412
|
+
this.addedSet = new Set();
|
|
1413
|
+
this.movedSet = new Set();
|
|
1414
|
+
this.droppedSet = new Set();
|
|
1415
|
+
this.processMutations = (mutations) => {
|
|
1416
|
+
mutations.forEach(this.processMutation);
|
|
1417
|
+
this.emit();
|
|
1418
|
+
};
|
|
1419
|
+
this.emit = () => {
|
|
1420
|
+
if (this.frozen || this.locked) {
|
|
1421
|
+
return;
|
|
1422
|
+
}
|
|
1423
|
+
const adds = [];
|
|
1424
|
+
const addList = new DoubleLinkedList();
|
|
1425
|
+
const getNextId = (n) => {
|
|
1426
|
+
let ns = n;
|
|
1427
|
+
let nextId = IGNORED_NODE;
|
|
1428
|
+
while (nextId === IGNORED_NODE) {
|
|
1429
|
+
ns = ns && ns.nextSibling;
|
|
1430
|
+
nextId = ns && this.mirror.getId(ns);
|
|
1431
|
+
}
|
|
1432
|
+
return nextId;
|
|
1433
|
+
};
|
|
1434
|
+
const pushAdd = (n) => {
|
|
1435
|
+
var _a, _b, _c, _d;
|
|
1436
|
+
let shadowHost = null;
|
|
1437
|
+
if (((_b = (_a = n.getRootNode) === null || _a === void 0 ? void 0 : _a.call(n)) === null || _b === void 0 ? void 0 : _b.nodeType) === Node.DOCUMENT_FRAGMENT_NODE &&
|
|
1438
|
+
n.getRootNode().host)
|
|
1439
|
+
shadowHost = n.getRootNode().host;
|
|
1440
|
+
let rootShadowHost = shadowHost;
|
|
1441
|
+
while (((_d = (_c = rootShadowHost === null || rootShadowHost === void 0 ? void 0 : rootShadowHost.getRootNode) === null || _c === void 0 ? void 0 : _c.call(rootShadowHost)) === null || _d === void 0 ? void 0 : _d.nodeType) ===
|
|
1442
|
+
Node.DOCUMENT_FRAGMENT_NODE &&
|
|
1443
|
+
rootShadowHost.getRootNode().host)
|
|
1444
|
+
rootShadowHost = rootShadowHost.getRootNode().host;
|
|
1445
|
+
const notInDoc = !this.doc.contains(n) &&
|
|
1446
|
+
(!rootShadowHost || !this.doc.contains(rootShadowHost));
|
|
1447
|
+
if (!n.parentNode || notInDoc) {
|
|
1448
|
+
return;
|
|
1449
|
+
}
|
|
1450
|
+
const parentId = isShadowRoot(n.parentNode)
|
|
1451
|
+
? this.mirror.getId(shadowHost)
|
|
1452
|
+
: this.mirror.getId(n.parentNode);
|
|
1453
|
+
const nextId = getNextId(n);
|
|
1454
|
+
if (parentId === -1 || nextId === -1) {
|
|
1455
|
+
return addList.addNode(n);
|
|
1456
|
+
}
|
|
1457
|
+
const sn = serializeNodeWithId(n, {
|
|
1458
|
+
doc: this.doc,
|
|
1459
|
+
mirror: this.mirror,
|
|
1460
|
+
blockClass: this.blockClass,
|
|
1461
|
+
blockSelector: this.blockSelector,
|
|
1462
|
+
maskTextClass: this.maskTextClass,
|
|
1463
|
+
maskTextSelector: this.maskTextSelector,
|
|
1464
|
+
skipChild: true,
|
|
1465
|
+
newlyAddedElement: true,
|
|
1466
|
+
inlineStylesheet: this.inlineStylesheet,
|
|
1467
|
+
maskInputOptions: this.maskInputOptions,
|
|
1468
|
+
maskTextFn: this.maskTextFn,
|
|
1469
|
+
maskInputFn: this.maskInputFn,
|
|
1470
|
+
slimDOMOptions: this.slimDOMOptions,
|
|
1471
|
+
dataURLOptions: this.dataURLOptions,
|
|
1472
|
+
recordCanvas: this.recordCanvas,
|
|
1473
|
+
inlineImages: this.inlineImages,
|
|
1474
|
+
onSerialize: (currentN) => {
|
|
1475
|
+
if (isSerializedIframe(currentN, this.mirror)) {
|
|
1476
|
+
this.iframeManager.addIframe(currentN);
|
|
1477
|
+
}
|
|
1478
|
+
if (isSerializedStylesheet(currentN, this.mirror)) {
|
|
1479
|
+
this.stylesheetManager.trackLinkElement(currentN);
|
|
1480
|
+
}
|
|
1481
|
+
if (hasShadowRoot(n)) {
|
|
1482
|
+
this.shadowDomManager.addShadowRoot(n.shadowRoot, this.doc);
|
|
1483
|
+
}
|
|
1484
|
+
},
|
|
1485
|
+
onIframeLoad: (iframe, childSn) => {
|
|
1486
|
+
this.iframeManager.attachIframe(iframe, childSn);
|
|
1487
|
+
this.shadowDomManager.observeAttachShadow(iframe);
|
|
1488
|
+
},
|
|
1489
|
+
onStylesheetLoad: (link, childSn) => {
|
|
1490
|
+
this.stylesheetManager.attachLinkElement(link, childSn);
|
|
1491
|
+
},
|
|
1492
|
+
});
|
|
1493
|
+
if (sn) {
|
|
1494
|
+
adds.push({
|
|
1495
|
+
parentId,
|
|
1496
|
+
nextId,
|
|
1497
|
+
node: sn,
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
};
|
|
1501
|
+
while (this.mapRemoves.length) {
|
|
1502
|
+
this.mirror.removeNodeFromMap(this.mapRemoves.shift());
|
|
1503
|
+
}
|
|
1504
|
+
for (const n of Array.from(this.movedSet.values())) {
|
|
1505
|
+
if (isParentRemoved(this.removes, n, this.mirror) &&
|
|
1506
|
+
!this.movedSet.has(n.parentNode)) {
|
|
1507
|
+
continue;
|
|
1508
|
+
}
|
|
1509
|
+
pushAdd(n);
|
|
1510
|
+
}
|
|
1511
|
+
for (const n of Array.from(this.addedSet.values())) {
|
|
1512
|
+
if (!isAncestorInSet(this.droppedSet, n) &&
|
|
1513
|
+
!isParentRemoved(this.removes, n, this.mirror)) {
|
|
1514
|
+
pushAdd(n);
|
|
1515
|
+
}
|
|
1516
|
+
else if (isAncestorInSet(this.movedSet, n)) {
|
|
1517
|
+
pushAdd(n);
|
|
1518
|
+
}
|
|
1519
|
+
else {
|
|
1520
|
+
this.droppedSet.add(n);
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
let candidate = null;
|
|
1524
|
+
while (addList.length) {
|
|
1525
|
+
let node = null;
|
|
1526
|
+
if (candidate) {
|
|
1527
|
+
const parentId = this.mirror.getId(candidate.value.parentNode);
|
|
1528
|
+
const nextId = getNextId(candidate.value);
|
|
1529
|
+
if (parentId !== -1 && nextId !== -1) {
|
|
1530
|
+
node = candidate;
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
if (!node) {
|
|
1534
|
+
for (let index = addList.length - 1; index >= 0; index--) {
|
|
1535
|
+
const _node = addList.get(index);
|
|
1536
|
+
if (_node) {
|
|
1537
|
+
const parentId = this.mirror.getId(_node.value.parentNode);
|
|
1538
|
+
const nextId = getNextId(_node.value);
|
|
1539
|
+
if (nextId === -1)
|
|
1540
|
+
continue;
|
|
1541
|
+
else if (parentId !== -1) {
|
|
1542
|
+
node = _node;
|
|
1543
|
+
break;
|
|
1544
|
+
}
|
|
1545
|
+
else {
|
|
1546
|
+
const unhandledNode = _node.value;
|
|
1547
|
+
if (unhandledNode.parentNode &&
|
|
1548
|
+
unhandledNode.parentNode.nodeType ===
|
|
1549
|
+
Node.DOCUMENT_FRAGMENT_NODE) {
|
|
1550
|
+
const shadowHost = unhandledNode.parentNode
|
|
1551
|
+
.host;
|
|
1552
|
+
const parentId = this.mirror.getId(shadowHost);
|
|
1553
|
+
if (parentId !== -1) {
|
|
1554
|
+
node = _node;
|
|
1555
|
+
break;
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
if (!node) {
|
|
1563
|
+
while (addList.head) {
|
|
1564
|
+
addList.removeNode(addList.head.value);
|
|
1565
|
+
}
|
|
1566
|
+
break;
|
|
1567
|
+
}
|
|
1568
|
+
candidate = node.previous;
|
|
1569
|
+
addList.removeNode(node.value);
|
|
1570
|
+
pushAdd(node.value);
|
|
1571
|
+
}
|
|
1572
|
+
const payload = {
|
|
1573
|
+
texts: this.texts
|
|
1574
|
+
.map((text) => ({
|
|
1575
|
+
id: this.mirror.getId(text.node),
|
|
1576
|
+
value: text.value,
|
|
1577
|
+
}))
|
|
1578
|
+
.filter((text) => this.mirror.has(text.id)),
|
|
1579
|
+
attributes: this.attributes
|
|
1580
|
+
.map((attribute) => ({
|
|
1581
|
+
id: this.mirror.getId(attribute.node),
|
|
1582
|
+
attributes: attribute.attributes,
|
|
1583
|
+
}))
|
|
1584
|
+
.filter((attribute) => this.mirror.has(attribute.id)),
|
|
1585
|
+
removes: this.removes,
|
|
1586
|
+
adds,
|
|
1587
|
+
};
|
|
1588
|
+
if (!payload.texts.length &&
|
|
1589
|
+
!payload.attributes.length &&
|
|
1590
|
+
!payload.removes.length &&
|
|
1591
|
+
!payload.adds.length) {
|
|
1592
|
+
return;
|
|
1593
|
+
}
|
|
1594
|
+
this.texts = [];
|
|
1595
|
+
this.attributes = [];
|
|
1596
|
+
this.removes = [];
|
|
1597
|
+
this.addedSet = new Set();
|
|
1598
|
+
this.movedSet = new Set();
|
|
1599
|
+
this.droppedSet = new Set();
|
|
1600
|
+
this.movedMap = {};
|
|
1601
|
+
this.mutationCb(payload);
|
|
1602
|
+
};
|
|
1603
|
+
this.processMutation = (m) => {
|
|
1604
|
+
if (isIgnored(m.target, this.mirror)) {
|
|
1605
|
+
return;
|
|
1606
|
+
}
|
|
1607
|
+
switch (m.type) {
|
|
1608
|
+
case 'characterData': {
|
|
1609
|
+
const value = m.target.textContent;
|
|
1610
|
+
if (!isBlocked(m.target, this.blockClass, this.blockSelector, false) &&
|
|
1611
|
+
value !== m.oldValue) {
|
|
1612
|
+
this.texts.push({
|
|
1613
|
+
value: needMaskingText(m.target, this.maskTextClass, this.maskTextSelector) && value
|
|
1614
|
+
? this.maskTextFn
|
|
1615
|
+
? this.maskTextFn(value)
|
|
1616
|
+
: value.replace(/[\S]/g, '*')
|
|
1617
|
+
: value,
|
|
1618
|
+
node: m.target,
|
|
1619
|
+
});
|
|
1620
|
+
}
|
|
1621
|
+
break;
|
|
1622
|
+
}
|
|
1623
|
+
case 'attributes': {
|
|
1624
|
+
const target = m.target;
|
|
1625
|
+
let value = m.target.getAttribute(m.attributeName);
|
|
1626
|
+
if (m.attributeName === 'value') {
|
|
1627
|
+
value = maskInputValue({
|
|
1628
|
+
maskInputOptions: this.maskInputOptions,
|
|
1629
|
+
tagName: m.target.tagName,
|
|
1630
|
+
type: m.target.getAttribute('type'),
|
|
1631
|
+
value,
|
|
1632
|
+
maskInputFn: this.maskInputFn,
|
|
1633
|
+
});
|
|
1634
|
+
}
|
|
1635
|
+
if (isBlocked(m.target, this.blockClass, this.blockSelector, false) ||
|
|
1636
|
+
value === m.oldValue) {
|
|
1637
|
+
return;
|
|
1638
|
+
}
|
|
1639
|
+
let item = this.attributes.find((a) => a.node === m.target);
|
|
1640
|
+
if (target.tagName === 'IFRAME' &&
|
|
1641
|
+
m.attributeName === 'src' &&
|
|
1642
|
+
!this.keepIframeSrcFn(value)) {
|
|
1643
|
+
if (!target.contentDocument) {
|
|
1644
|
+
m.attributeName = 'rr_src';
|
|
1645
|
+
}
|
|
1646
|
+
else {
|
|
1647
|
+
return;
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
if (!item) {
|
|
1651
|
+
item = {
|
|
1652
|
+
node: m.target,
|
|
1653
|
+
attributes: {},
|
|
1654
|
+
};
|
|
1655
|
+
this.attributes.push(item);
|
|
1656
|
+
}
|
|
1657
|
+
if (m.attributeName === 'style') {
|
|
1658
|
+
const old = this.doc.createElement('span');
|
|
1659
|
+
if (m.oldValue) {
|
|
1660
|
+
old.setAttribute('style', m.oldValue);
|
|
1661
|
+
}
|
|
1662
|
+
if (item.attributes.style === undefined ||
|
|
1663
|
+
item.attributes.style === null) {
|
|
1664
|
+
item.attributes.style = {};
|
|
1665
|
+
}
|
|
1666
|
+
const styleObj = item.attributes.style;
|
|
1667
|
+
for (const pname of Array.from(target.style)) {
|
|
1668
|
+
const newValue = target.style.getPropertyValue(pname);
|
|
1669
|
+
const newPriority = target.style.getPropertyPriority(pname);
|
|
1670
|
+
if (newValue !== old.style.getPropertyValue(pname) ||
|
|
1671
|
+
newPriority !== old.style.getPropertyPriority(pname)) {
|
|
1672
|
+
if (newPriority === '') {
|
|
1673
|
+
styleObj[pname] = newValue;
|
|
1674
|
+
}
|
|
1675
|
+
else {
|
|
1676
|
+
styleObj[pname] = [newValue, newPriority];
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
for (const pname of Array.from(old.style)) {
|
|
1681
|
+
if (target.style.getPropertyValue(pname) === '') {
|
|
1682
|
+
styleObj[pname] = false;
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
else {
|
|
1687
|
+
item.attributes[m.attributeName] = transformAttribute(this.doc, target.tagName, m.attributeName, value);
|
|
1688
|
+
}
|
|
1689
|
+
break;
|
|
1690
|
+
}
|
|
1691
|
+
case 'childList': {
|
|
1692
|
+
if (isBlocked(m.target, this.blockClass, this.blockSelector, true))
|
|
1693
|
+
return;
|
|
1694
|
+
m.addedNodes.forEach((n) => this.genAdds(n, m.target));
|
|
1695
|
+
m.removedNodes.forEach((n) => {
|
|
1696
|
+
const nodeId = this.mirror.getId(n);
|
|
1697
|
+
const parentId = isShadowRoot(m.target)
|
|
1698
|
+
? this.mirror.getId(m.target.host)
|
|
1699
|
+
: this.mirror.getId(m.target);
|
|
1700
|
+
if (isBlocked(m.target, this.blockClass, this.blockSelector, false) ||
|
|
1701
|
+
isIgnored(n, this.mirror) ||
|
|
1702
|
+
!isSerialized(n, this.mirror)) {
|
|
1703
|
+
return;
|
|
1704
|
+
}
|
|
1705
|
+
if (this.addedSet.has(n)) {
|
|
1706
|
+
deepDelete(this.addedSet, n);
|
|
1707
|
+
this.droppedSet.add(n);
|
|
1708
|
+
}
|
|
1709
|
+
else if (this.addedSet.has(m.target) && nodeId === -1) ;
|
|
1710
|
+
else if (isAncestorRemoved(m.target, this.mirror)) ;
|
|
1711
|
+
else if (this.movedSet.has(n) &&
|
|
1712
|
+
this.movedMap[moveKey(nodeId, parentId)]) {
|
|
1713
|
+
deepDelete(this.movedSet, n);
|
|
1714
|
+
}
|
|
1715
|
+
else {
|
|
1716
|
+
this.removes.push({
|
|
1717
|
+
parentId,
|
|
1718
|
+
id: nodeId,
|
|
1719
|
+
isShadow: isShadowRoot(m.target) && isNativeShadowDom(m.target)
|
|
1720
|
+
? true
|
|
1721
|
+
: undefined,
|
|
1722
|
+
});
|
|
1723
|
+
}
|
|
1724
|
+
this.mapRemoves.push(n);
|
|
1725
|
+
});
|
|
1726
|
+
break;
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
};
|
|
1730
|
+
this.genAdds = (n, target) => {
|
|
1731
|
+
if (this.mirror.hasNode(n)) {
|
|
1732
|
+
if (isIgnored(n, this.mirror)) {
|
|
1733
|
+
return;
|
|
1734
|
+
}
|
|
1735
|
+
this.movedSet.add(n);
|
|
1736
|
+
let targetId = null;
|
|
1737
|
+
if (target && this.mirror.hasNode(target)) {
|
|
1738
|
+
targetId = this.mirror.getId(target);
|
|
1739
|
+
}
|
|
1740
|
+
if (targetId && targetId !== -1) {
|
|
1741
|
+
this.movedMap[moveKey(this.mirror.getId(n), targetId)] = true;
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
else {
|
|
1745
|
+
this.addedSet.add(n);
|
|
1746
|
+
this.droppedSet.delete(n);
|
|
1747
|
+
}
|
|
1748
|
+
if (!isBlocked(n, this.blockClass, this.blockSelector, false))
|
|
1749
|
+
n.childNodes.forEach((childN) => this.genAdds(childN));
|
|
1750
|
+
};
|
|
1751
|
+
}
|
|
1752
|
+
init(options) {
|
|
1753
|
+
[
|
|
1754
|
+
'mutationCb',
|
|
1755
|
+
'blockClass',
|
|
1756
|
+
'blockSelector',
|
|
1757
|
+
'maskTextClass',
|
|
1758
|
+
'maskTextSelector',
|
|
1759
|
+
'inlineStylesheet',
|
|
1760
|
+
'maskInputOptions',
|
|
1761
|
+
'maskTextFn',
|
|
1762
|
+
'maskInputFn',
|
|
1763
|
+
'keepIframeSrcFn',
|
|
1764
|
+
'recordCanvas',
|
|
1765
|
+
'inlineImages',
|
|
1766
|
+
'slimDOMOptions',
|
|
1767
|
+
'dataURLOptions',
|
|
1768
|
+
'doc',
|
|
1769
|
+
'mirror',
|
|
1770
|
+
'iframeManager',
|
|
1771
|
+
'stylesheetManager',
|
|
1772
|
+
'shadowDomManager',
|
|
1773
|
+
'canvasManager',
|
|
1774
|
+
].forEach((key) => {
|
|
1775
|
+
this[key] = options[key];
|
|
1776
|
+
});
|
|
1777
|
+
}
|
|
1778
|
+
freeze() {
|
|
1779
|
+
this.frozen = true;
|
|
1780
|
+
this.canvasManager.freeze();
|
|
1781
|
+
}
|
|
1782
|
+
unfreeze() {
|
|
1783
|
+
this.frozen = false;
|
|
1784
|
+
this.canvasManager.unfreeze();
|
|
1785
|
+
this.emit();
|
|
1786
|
+
}
|
|
1787
|
+
isFrozen() {
|
|
1788
|
+
return this.frozen;
|
|
1789
|
+
}
|
|
1790
|
+
lock() {
|
|
1791
|
+
this.locked = true;
|
|
1792
|
+
this.canvasManager.lock();
|
|
1793
|
+
}
|
|
1794
|
+
unlock() {
|
|
1795
|
+
this.locked = false;
|
|
1796
|
+
this.canvasManager.unlock();
|
|
1797
|
+
this.emit();
|
|
1798
|
+
}
|
|
1799
|
+
reset() {
|
|
1800
|
+
this.shadowDomManager.reset();
|
|
1801
|
+
this.canvasManager.reset();
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
function deepDelete(addsSet, n) {
|
|
1805
|
+
addsSet.delete(n);
|
|
1806
|
+
n.childNodes.forEach((childN) => deepDelete(addsSet, childN));
|
|
1807
|
+
}
|
|
1808
|
+
function isParentRemoved(removes, n, mirror) {
|
|
1809
|
+
if (removes.length === 0)
|
|
1810
|
+
return false;
|
|
1811
|
+
return _isParentRemoved(removes, n, mirror);
|
|
1812
|
+
}
|
|
1813
|
+
function _isParentRemoved(removes, n, mirror) {
|
|
1814
|
+
const { parentNode } = n;
|
|
1815
|
+
if (!parentNode) {
|
|
1816
|
+
return false;
|
|
1817
|
+
}
|
|
1818
|
+
const parentId = mirror.getId(parentNode);
|
|
1819
|
+
if (removes.some((r) => r.id === parentId)) {
|
|
1820
|
+
return true;
|
|
1821
|
+
}
|
|
1822
|
+
return _isParentRemoved(removes, parentNode, mirror);
|
|
1823
|
+
}
|
|
1824
|
+
function isAncestorInSet(set, n) {
|
|
1825
|
+
if (set.size === 0)
|
|
1826
|
+
return false;
|
|
1827
|
+
return _isAncestorInSet(set, n);
|
|
1828
|
+
}
|
|
1829
|
+
function _isAncestorInSet(set, n) {
|
|
1830
|
+
const { parentNode } = n;
|
|
1831
|
+
if (!parentNode) {
|
|
1832
|
+
return false;
|
|
1833
|
+
}
|
|
1834
|
+
if (set.has(parentNode)) {
|
|
1835
|
+
return true;
|
|
1836
|
+
}
|
|
1837
|
+
return _isAncestorInSet(set, parentNode);
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
const mutationBuffers = [];
|
|
1841
|
+
const isCSSGroupingRuleSupported = typeof CSSGroupingRule !== 'undefined';
|
|
1842
|
+
const isCSSMediaRuleSupported = typeof CSSMediaRule !== 'undefined';
|
|
1843
|
+
const isCSSSupportsRuleSupported = typeof CSSSupportsRule !== 'undefined';
|
|
1844
|
+
const isCSSConditionRuleSupported = typeof CSSConditionRule !== 'undefined';
|
|
1845
|
+
function getEventTarget(event) {
|
|
1846
|
+
try {
|
|
1847
|
+
if ('composedPath' in event) {
|
|
1848
|
+
const path = event.composedPath();
|
|
1849
|
+
if (path.length) {
|
|
1850
|
+
return path[0];
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
else if ('path' in event && event.path.length) {
|
|
1854
|
+
return event.path[0];
|
|
1855
|
+
}
|
|
1856
|
+
return event.target;
|
|
1857
|
+
}
|
|
1858
|
+
catch (_a) {
|
|
1859
|
+
return event.target;
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
function initMutationObserver(options, rootEl) {
|
|
1863
|
+
var _a, _b;
|
|
1864
|
+
const mutationBuffer = new MutationBuffer();
|
|
1865
|
+
mutationBuffers.push(mutationBuffer);
|
|
1866
|
+
mutationBuffer.init(options);
|
|
1867
|
+
let mutationObserverCtor = window.MutationObserver ||
|
|
1868
|
+
window.__rrMutationObserver;
|
|
1869
|
+
const angularZoneSymbol = (_b = (_a = window === null || window === void 0 ? void 0 : window.Zone) === null || _a === void 0 ? void 0 : _a.__symbol__) === null || _b === void 0 ? void 0 : _b.call(_a, 'MutationObserver');
|
|
1870
|
+
if (angularZoneSymbol &&
|
|
1871
|
+
window[angularZoneSymbol]) {
|
|
1872
|
+
mutationObserverCtor = window[angularZoneSymbol];
|
|
1873
|
+
}
|
|
1874
|
+
const observer = new mutationObserverCtor(mutationBuffer.processMutations.bind(mutationBuffer));
|
|
1875
|
+
observer.observe(rootEl, {
|
|
1876
|
+
attributes: true,
|
|
1877
|
+
attributeOldValue: true,
|
|
1878
|
+
characterData: true,
|
|
1879
|
+
characterDataOldValue: true,
|
|
1880
|
+
childList: true,
|
|
1881
|
+
subtree: true,
|
|
1882
|
+
});
|
|
1883
|
+
return observer;
|
|
1884
|
+
}
|
|
1885
|
+
function initMoveObserver({ mousemoveCb, sampling, doc, mirror, }) {
|
|
1886
|
+
if (sampling.mousemove === false) {
|
|
1887
|
+
return () => {
|
|
1888
|
+
};
|
|
1889
|
+
}
|
|
1890
|
+
const threshold = typeof sampling.mousemove === 'number' ? sampling.mousemove : 50;
|
|
1891
|
+
const callbackThreshold = typeof sampling.mousemoveCallback === 'number'
|
|
1892
|
+
? sampling.mousemoveCallback
|
|
1893
|
+
: 500;
|
|
1894
|
+
let positions = [];
|
|
1895
|
+
let timeBaseline;
|
|
1896
|
+
const wrappedCb = throttle((source) => {
|
|
1897
|
+
const totalOffset = Date.now() - timeBaseline;
|
|
1898
|
+
mousemoveCb(positions.map((p) => {
|
|
1899
|
+
p.timeOffset -= totalOffset;
|
|
1900
|
+
return p;
|
|
1901
|
+
}), source);
|
|
1902
|
+
positions = [];
|
|
1903
|
+
timeBaseline = null;
|
|
1904
|
+
}, callbackThreshold);
|
|
1905
|
+
const updatePosition = throttle((evt) => {
|
|
1906
|
+
const target = getEventTarget(evt);
|
|
1907
|
+
const { clientX, clientY } = isTouchEvent(evt)
|
|
1908
|
+
? evt.changedTouches[0]
|
|
1909
|
+
: evt;
|
|
1910
|
+
if (!timeBaseline) {
|
|
1911
|
+
timeBaseline = Date.now();
|
|
1912
|
+
}
|
|
1913
|
+
positions.push({
|
|
1914
|
+
x: clientX,
|
|
1915
|
+
y: clientY,
|
|
1916
|
+
id: mirror.getId(target),
|
|
1917
|
+
timeOffset: Date.now() - timeBaseline,
|
|
1918
|
+
});
|
|
1919
|
+
wrappedCb(typeof DragEvent !== 'undefined' && evt instanceof DragEvent
|
|
1920
|
+
? IncrementalSource.Drag
|
|
1921
|
+
: evt instanceof MouseEvent
|
|
1922
|
+
? IncrementalSource.MouseMove
|
|
1923
|
+
: IncrementalSource.TouchMove);
|
|
1924
|
+
}, threshold, {
|
|
1925
|
+
trailing: false,
|
|
1926
|
+
});
|
|
1927
|
+
const handlers = [
|
|
1928
|
+
on('mousemove', updatePosition, doc),
|
|
1929
|
+
on('touchmove', updatePosition, doc),
|
|
1930
|
+
on('drag', updatePosition, doc),
|
|
1931
|
+
];
|
|
1932
|
+
return () => {
|
|
1933
|
+
handlers.forEach((h) => h());
|
|
1934
|
+
};
|
|
1935
|
+
}
|
|
1936
|
+
function initMouseInteractionObserver({ mouseInteractionCb, doc, mirror, blockClass, blockSelector, sampling, }) {
|
|
1937
|
+
if (sampling.mouseInteraction === false) {
|
|
1938
|
+
return () => {
|
|
1939
|
+
};
|
|
1940
|
+
}
|
|
1941
|
+
const disableMap = sampling.mouseInteraction === true ||
|
|
1942
|
+
sampling.mouseInteraction === undefined
|
|
1943
|
+
? {}
|
|
1944
|
+
: sampling.mouseInteraction;
|
|
1945
|
+
const handlers = [];
|
|
1946
|
+
const getHandler = (eventKey) => {
|
|
1947
|
+
return (event) => {
|
|
1948
|
+
const target = getEventTarget(event);
|
|
1949
|
+
if (isBlocked(target, blockClass, blockSelector, true)) {
|
|
1950
|
+
return;
|
|
1951
|
+
}
|
|
1952
|
+
const e = isTouchEvent(event) ? event.changedTouches[0] : event;
|
|
1953
|
+
if (!e) {
|
|
1954
|
+
return;
|
|
1955
|
+
}
|
|
1956
|
+
const id = mirror.getId(target);
|
|
1957
|
+
const { clientX, clientY } = e;
|
|
1958
|
+
mouseInteractionCb({
|
|
1959
|
+
type: MouseInteractions[eventKey],
|
|
1960
|
+
id,
|
|
1961
|
+
x: clientX,
|
|
1962
|
+
y: clientY,
|
|
1963
|
+
});
|
|
1964
|
+
};
|
|
1965
|
+
};
|
|
1966
|
+
Object.keys(MouseInteractions)
|
|
1967
|
+
.filter((key) => Number.isNaN(Number(key)) &&
|
|
1968
|
+
!key.endsWith('_Departed') &&
|
|
1969
|
+
disableMap[key] !== false)
|
|
1970
|
+
.forEach((eventKey) => {
|
|
1971
|
+
const eventName = eventKey.toLowerCase();
|
|
1972
|
+
const handler = getHandler(eventKey);
|
|
1973
|
+
handlers.push(on(eventName, handler, doc));
|
|
1974
|
+
});
|
|
1975
|
+
return () => {
|
|
1976
|
+
handlers.forEach((h) => h());
|
|
1977
|
+
};
|
|
1978
|
+
}
|
|
1979
|
+
function initScrollObserver({ scrollCb, doc, mirror, blockClass, blockSelector, sampling, }) {
|
|
1980
|
+
const updatePosition = throttle((evt) => {
|
|
1981
|
+
const target = getEventTarget(evt);
|
|
1982
|
+
if (!target || isBlocked(target, blockClass, blockSelector, true)) {
|
|
1983
|
+
return;
|
|
1984
|
+
}
|
|
1985
|
+
const id = mirror.getId(target);
|
|
1986
|
+
if (target === doc) {
|
|
1987
|
+
const scrollEl = (doc.scrollingElement || doc.documentElement);
|
|
1988
|
+
scrollCb({
|
|
1989
|
+
id,
|
|
1990
|
+
x: scrollEl.scrollLeft,
|
|
1991
|
+
y: scrollEl.scrollTop,
|
|
1992
|
+
});
|
|
1993
|
+
}
|
|
1994
|
+
else {
|
|
1995
|
+
scrollCb({
|
|
1996
|
+
id,
|
|
1997
|
+
x: target.scrollLeft,
|
|
1998
|
+
y: target.scrollTop,
|
|
1999
|
+
});
|
|
2000
|
+
}
|
|
2001
|
+
}, sampling.scroll || 100);
|
|
2002
|
+
return on('scroll', updatePosition, doc);
|
|
2003
|
+
}
|
|
2004
|
+
function initViewportResizeObserver({ viewportResizeCb, }) {
|
|
2005
|
+
let lastH = -1;
|
|
2006
|
+
let lastW = -1;
|
|
2007
|
+
const updateDimension = throttle(() => {
|
|
2008
|
+
const height = getWindowHeight();
|
|
2009
|
+
const width = getWindowWidth();
|
|
2010
|
+
if (lastH !== height || lastW !== width) {
|
|
2011
|
+
viewportResizeCb({
|
|
2012
|
+
width: Number(width),
|
|
2013
|
+
height: Number(height),
|
|
2014
|
+
});
|
|
2015
|
+
lastH = height;
|
|
2016
|
+
lastW = width;
|
|
2017
|
+
}
|
|
2018
|
+
}, 200);
|
|
2019
|
+
return on('resize', updateDimension, window);
|
|
2020
|
+
}
|
|
2021
|
+
function wrapEventWithUserTriggeredFlag(v, enable) {
|
|
2022
|
+
const value = Object.assign({}, v);
|
|
2023
|
+
if (!enable)
|
|
2024
|
+
delete value.userTriggered;
|
|
2025
|
+
return value;
|
|
2026
|
+
}
|
|
2027
|
+
const INPUT_TAGS = ['INPUT', 'TEXTAREA', 'SELECT'];
|
|
2028
|
+
const lastInputValueMap = new WeakMap();
|
|
2029
|
+
function initInputObserver({ inputCb, doc, mirror, blockClass, blockSelector, ignoreClass, maskInputOptions, maskInputFn, sampling, userTriggeredOnInput, }) {
|
|
2030
|
+
function eventHandler(event) {
|
|
2031
|
+
let target = getEventTarget(event);
|
|
2032
|
+
const userTriggered = event.isTrusted;
|
|
2033
|
+
if (target && target.tagName === 'OPTION')
|
|
2034
|
+
target = target.parentElement;
|
|
2035
|
+
if (!target ||
|
|
2036
|
+
!target.tagName ||
|
|
2037
|
+
INPUT_TAGS.indexOf(target.tagName) < 0 ||
|
|
2038
|
+
isBlocked(target, blockClass, blockSelector, true)) {
|
|
2039
|
+
return;
|
|
2040
|
+
}
|
|
2041
|
+
const type = target.type;
|
|
2042
|
+
if (target.classList.contains(ignoreClass)) {
|
|
2043
|
+
return;
|
|
2044
|
+
}
|
|
2045
|
+
let text = target.value;
|
|
2046
|
+
let isChecked = false;
|
|
2047
|
+
if (type === 'radio' || type === 'checkbox') {
|
|
2048
|
+
isChecked = target.checked;
|
|
2049
|
+
}
|
|
2050
|
+
else if (maskInputOptions[target.tagName.toLowerCase()] ||
|
|
2051
|
+
maskInputOptions[type]) {
|
|
2052
|
+
text = maskInputValue({
|
|
2053
|
+
maskInputOptions,
|
|
2054
|
+
tagName: target.tagName,
|
|
2055
|
+
type,
|
|
2056
|
+
value: text,
|
|
2057
|
+
maskInputFn,
|
|
2058
|
+
});
|
|
2059
|
+
}
|
|
2060
|
+
cbWithDedup(target, wrapEventWithUserTriggeredFlag({ text, isChecked, userTriggered }, userTriggeredOnInput));
|
|
2061
|
+
const name = target.name;
|
|
2062
|
+
if (type === 'radio' && name && isChecked) {
|
|
2063
|
+
doc
|
|
2064
|
+
.querySelectorAll(`input[type="radio"][name="${name}"]`)
|
|
2065
|
+
.forEach((el) => {
|
|
2066
|
+
if (el !== target) {
|
|
2067
|
+
cbWithDedup(el, wrapEventWithUserTriggeredFlag({
|
|
2068
|
+
text: el.value,
|
|
2069
|
+
isChecked: !isChecked,
|
|
2070
|
+
userTriggered: false,
|
|
2071
|
+
}, userTriggeredOnInput));
|
|
2072
|
+
}
|
|
2073
|
+
});
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
function cbWithDedup(target, v) {
|
|
2077
|
+
const lastInputValue = lastInputValueMap.get(target);
|
|
2078
|
+
if (!lastInputValue ||
|
|
2079
|
+
lastInputValue.text !== v.text ||
|
|
2080
|
+
lastInputValue.isChecked !== v.isChecked) {
|
|
2081
|
+
lastInputValueMap.set(target, v);
|
|
2082
|
+
const id = mirror.getId(target);
|
|
2083
|
+
inputCb(Object.assign(Object.assign({}, v), { id }));
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
const events = sampling.input === 'last' ? ['change'] : ['input', 'change'];
|
|
2087
|
+
const handlers = events.map((eventName) => on(eventName, eventHandler, doc));
|
|
2088
|
+
const currentWindow = doc.defaultView;
|
|
2089
|
+
if (!currentWindow) {
|
|
2090
|
+
return () => {
|
|
2091
|
+
handlers.forEach((h) => h());
|
|
2092
|
+
};
|
|
2093
|
+
}
|
|
2094
|
+
const propertyDescriptor = currentWindow.Object.getOwnPropertyDescriptor(currentWindow.HTMLInputElement.prototype, 'value');
|
|
2095
|
+
const hookProperties = [
|
|
2096
|
+
[currentWindow.HTMLInputElement.prototype, 'value'],
|
|
2097
|
+
[currentWindow.HTMLInputElement.prototype, 'checked'],
|
|
2098
|
+
[currentWindow.HTMLSelectElement.prototype, 'value'],
|
|
2099
|
+
[currentWindow.HTMLTextAreaElement.prototype, 'value'],
|
|
2100
|
+
[currentWindow.HTMLSelectElement.prototype, 'selectedIndex'],
|
|
2101
|
+
[currentWindow.HTMLOptionElement.prototype, 'selected'],
|
|
2102
|
+
];
|
|
2103
|
+
if (propertyDescriptor && propertyDescriptor.set) {
|
|
2104
|
+
handlers.push(...hookProperties.map((p) => hookSetter(p[0], p[1], {
|
|
2105
|
+
set() {
|
|
2106
|
+
eventHandler({ target: this });
|
|
2107
|
+
},
|
|
2108
|
+
}, false, currentWindow)));
|
|
2109
|
+
}
|
|
2110
|
+
return () => {
|
|
2111
|
+
handlers.forEach((h) => h());
|
|
2112
|
+
};
|
|
2113
|
+
}
|
|
2114
|
+
function getNestedCSSRulePositions(rule) {
|
|
2115
|
+
const positions = [];
|
|
2116
|
+
function recurse(childRule, pos) {
|
|
2117
|
+
if ((isCSSGroupingRuleSupported &&
|
|
2118
|
+
childRule.parentRule instanceof CSSGroupingRule) ||
|
|
2119
|
+
(isCSSMediaRuleSupported &&
|
|
2120
|
+
childRule.parentRule instanceof CSSMediaRule) ||
|
|
2121
|
+
(isCSSSupportsRuleSupported &&
|
|
2122
|
+
childRule.parentRule instanceof CSSSupportsRule) ||
|
|
2123
|
+
(isCSSConditionRuleSupported &&
|
|
2124
|
+
childRule.parentRule instanceof CSSConditionRule)) {
|
|
2125
|
+
const rules = Array.from(childRule.parentRule.cssRules);
|
|
2126
|
+
const index = rules.indexOf(childRule);
|
|
2127
|
+
pos.unshift(index);
|
|
2128
|
+
}
|
|
2129
|
+
else if (childRule.parentStyleSheet) {
|
|
2130
|
+
const rules = Array.from(childRule.parentStyleSheet.cssRules);
|
|
2131
|
+
const index = rules.indexOf(childRule);
|
|
2132
|
+
pos.unshift(index);
|
|
2133
|
+
}
|
|
2134
|
+
return pos;
|
|
2135
|
+
}
|
|
2136
|
+
return recurse(rule, positions);
|
|
2137
|
+
}
|
|
2138
|
+
function getIdAndStyleId(sheet, mirror, styleMirror) {
|
|
2139
|
+
let id, styleId;
|
|
2140
|
+
if (!sheet)
|
|
2141
|
+
return {};
|
|
2142
|
+
if (sheet.ownerNode)
|
|
2143
|
+
id = mirror.getId(sheet.ownerNode);
|
|
2144
|
+
else
|
|
2145
|
+
styleId = styleMirror.getId(sheet);
|
|
2146
|
+
return {
|
|
2147
|
+
styleId,
|
|
2148
|
+
id,
|
|
2149
|
+
};
|
|
2150
|
+
}
|
|
2151
|
+
function initStyleSheetObserver({ styleSheetRuleCb, mirror, stylesheetManager }, { win }) {
|
|
2152
|
+
const insertRule = win.CSSStyleSheet.prototype.insertRule;
|
|
2153
|
+
win.CSSStyleSheet.prototype.insertRule = function (rule, index) {
|
|
2154
|
+
const { id, styleId } = getIdAndStyleId(this, mirror, stylesheetManager.styleMirror);
|
|
2155
|
+
if ((id && id !== -1) || (styleId && styleId !== -1)) {
|
|
2156
|
+
styleSheetRuleCb({
|
|
2157
|
+
id,
|
|
2158
|
+
styleId,
|
|
2159
|
+
adds: [{ rule, index }],
|
|
2160
|
+
});
|
|
2161
|
+
}
|
|
2162
|
+
return insertRule.apply(this, [rule, index]);
|
|
2163
|
+
};
|
|
2164
|
+
const deleteRule = win.CSSStyleSheet.prototype.deleteRule;
|
|
2165
|
+
win.CSSStyleSheet.prototype.deleteRule = function (index) {
|
|
2166
|
+
const { id, styleId } = getIdAndStyleId(this, mirror, stylesheetManager.styleMirror);
|
|
2167
|
+
if ((id && id !== -1) || (styleId && styleId !== -1)) {
|
|
2168
|
+
styleSheetRuleCb({
|
|
2169
|
+
id,
|
|
2170
|
+
styleId,
|
|
2171
|
+
removes: [{ index }],
|
|
2172
|
+
});
|
|
2173
|
+
}
|
|
2174
|
+
return deleteRule.apply(this, [index]);
|
|
2175
|
+
};
|
|
2176
|
+
let replace;
|
|
2177
|
+
if (win.CSSStyleSheet.prototype.replace) {
|
|
2178
|
+
replace = win.CSSStyleSheet.prototype.replace;
|
|
2179
|
+
win.CSSStyleSheet.prototype.replace = function (text) {
|
|
2180
|
+
const { id, styleId } = getIdAndStyleId(this, mirror, stylesheetManager.styleMirror);
|
|
2181
|
+
if ((id && id !== -1) || (styleId && styleId !== -1)) {
|
|
2182
|
+
styleSheetRuleCb({
|
|
2183
|
+
id,
|
|
2184
|
+
styleId,
|
|
2185
|
+
replace: text,
|
|
2186
|
+
});
|
|
2187
|
+
}
|
|
2188
|
+
return replace.apply(this, [text]);
|
|
2189
|
+
};
|
|
2190
|
+
}
|
|
2191
|
+
let replaceSync;
|
|
2192
|
+
if (win.CSSStyleSheet.prototype.replaceSync) {
|
|
2193
|
+
replaceSync = win.CSSStyleSheet.prototype.replaceSync;
|
|
2194
|
+
win.CSSStyleSheet.prototype.replaceSync = function (text) {
|
|
2195
|
+
const { id, styleId } = getIdAndStyleId(this, mirror, stylesheetManager.styleMirror);
|
|
2196
|
+
if ((id && id !== -1) || (styleId && styleId !== -1)) {
|
|
2197
|
+
styleSheetRuleCb({
|
|
2198
|
+
id,
|
|
2199
|
+
styleId,
|
|
2200
|
+
replaceSync: text,
|
|
2201
|
+
});
|
|
2202
|
+
}
|
|
2203
|
+
return replaceSync.apply(this, [text]);
|
|
2204
|
+
};
|
|
2205
|
+
}
|
|
2206
|
+
const supportedNestedCSSRuleTypes = {};
|
|
2207
|
+
if (isCSSGroupingRuleSupported) {
|
|
2208
|
+
supportedNestedCSSRuleTypes.CSSGroupingRule = win.CSSGroupingRule;
|
|
2209
|
+
}
|
|
2210
|
+
else {
|
|
2211
|
+
if (isCSSMediaRuleSupported) {
|
|
2212
|
+
supportedNestedCSSRuleTypes.CSSMediaRule = win.CSSMediaRule;
|
|
2213
|
+
}
|
|
2214
|
+
if (isCSSConditionRuleSupported) {
|
|
2215
|
+
supportedNestedCSSRuleTypes.CSSConditionRule = win.CSSConditionRule;
|
|
2216
|
+
}
|
|
2217
|
+
if (isCSSSupportsRuleSupported) {
|
|
2218
|
+
supportedNestedCSSRuleTypes.CSSSupportsRule = win.CSSSupportsRule;
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2221
|
+
const unmodifiedFunctions = {};
|
|
2222
|
+
Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => {
|
|
2223
|
+
unmodifiedFunctions[typeKey] = {
|
|
2224
|
+
insertRule: type.prototype.insertRule,
|
|
2225
|
+
deleteRule: type.prototype.deleteRule,
|
|
2226
|
+
};
|
|
2227
|
+
type.prototype.insertRule = function (rule, index) {
|
|
2228
|
+
const { id, styleId } = getIdAndStyleId(this.parentStyleSheet, mirror, stylesheetManager.styleMirror);
|
|
2229
|
+
if ((id && id !== -1) || (styleId && styleId !== -1)) {
|
|
2230
|
+
styleSheetRuleCb({
|
|
2231
|
+
id,
|
|
2232
|
+
styleId,
|
|
2233
|
+
adds: [
|
|
2234
|
+
{
|
|
2235
|
+
rule,
|
|
2236
|
+
index: [
|
|
2237
|
+
...getNestedCSSRulePositions(this),
|
|
2238
|
+
index || 0,
|
|
2239
|
+
],
|
|
2240
|
+
},
|
|
2241
|
+
],
|
|
2242
|
+
});
|
|
2243
|
+
}
|
|
2244
|
+
return unmodifiedFunctions[typeKey].insertRule.apply(this, [rule, index]);
|
|
2245
|
+
};
|
|
2246
|
+
type.prototype.deleteRule = function (index) {
|
|
2247
|
+
const { id, styleId } = getIdAndStyleId(this.parentStyleSheet, mirror, stylesheetManager.styleMirror);
|
|
2248
|
+
if ((id && id !== -1) || (styleId && styleId !== -1)) {
|
|
2249
|
+
styleSheetRuleCb({
|
|
2250
|
+
id,
|
|
2251
|
+
styleId,
|
|
2252
|
+
removes: [
|
|
2253
|
+
{ index: [...getNestedCSSRulePositions(this), index] },
|
|
2254
|
+
],
|
|
2255
|
+
});
|
|
2256
|
+
}
|
|
2257
|
+
return unmodifiedFunctions[typeKey].deleteRule.apply(this, [index]);
|
|
2258
|
+
};
|
|
2259
|
+
});
|
|
2260
|
+
return () => {
|
|
2261
|
+
win.CSSStyleSheet.prototype.insertRule = insertRule;
|
|
2262
|
+
win.CSSStyleSheet.prototype.deleteRule = deleteRule;
|
|
2263
|
+
replace && (win.CSSStyleSheet.prototype.replace = replace);
|
|
2264
|
+
replaceSync && (win.CSSStyleSheet.prototype.replaceSync = replaceSync);
|
|
2265
|
+
Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => {
|
|
2266
|
+
type.prototype.insertRule = unmodifiedFunctions[typeKey].insertRule;
|
|
2267
|
+
type.prototype.deleteRule = unmodifiedFunctions[typeKey].deleteRule;
|
|
2268
|
+
});
|
|
2269
|
+
};
|
|
2270
|
+
}
|
|
2271
|
+
function initAdoptedStyleSheetObserver({ mirror, stylesheetManager, }, host) {
|
|
2272
|
+
var _a, _b, _c;
|
|
2273
|
+
let hostId = null;
|
|
2274
|
+
if (host.nodeName === '#document')
|
|
2275
|
+
hostId = mirror.getId(host);
|
|
2276
|
+
else
|
|
2277
|
+
hostId = mirror.getId(host.host);
|
|
2278
|
+
const patchTarget = host.nodeName === '#document'
|
|
2279
|
+
? (_a = host.defaultView) === null || _a === void 0 ? void 0 : _a.Document
|
|
2280
|
+
: (_c = (_b = host.ownerDocument) === null || _b === void 0 ? void 0 : _b.defaultView) === null || _c === void 0 ? void 0 : _c.ShadowRoot;
|
|
2281
|
+
const originalPropertyDescriptor = Object.getOwnPropertyDescriptor(patchTarget === null || patchTarget === void 0 ? void 0 : patchTarget.prototype, 'adoptedStyleSheets');
|
|
2282
|
+
if (hostId === null ||
|
|
2283
|
+
hostId === -1 ||
|
|
2284
|
+
!patchTarget ||
|
|
2285
|
+
!originalPropertyDescriptor)
|
|
2286
|
+
return () => {
|
|
2287
|
+
};
|
|
2288
|
+
Object.defineProperty(host, 'adoptedStyleSheets', {
|
|
2289
|
+
configurable: originalPropertyDescriptor.configurable,
|
|
2290
|
+
enumerable: originalPropertyDescriptor.enumerable,
|
|
2291
|
+
get() {
|
|
2292
|
+
var _a;
|
|
2293
|
+
return (_a = originalPropertyDescriptor.get) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
2294
|
+
},
|
|
2295
|
+
set(sheets) {
|
|
2296
|
+
var _a;
|
|
2297
|
+
const result = (_a = originalPropertyDescriptor.set) === null || _a === void 0 ? void 0 : _a.call(this, sheets);
|
|
2298
|
+
if (hostId !== null && hostId !== -1) {
|
|
2299
|
+
try {
|
|
2300
|
+
stylesheetManager.adoptStyleSheets(sheets, hostId);
|
|
2301
|
+
}
|
|
2302
|
+
catch (e) {
|
|
2303
|
+
}
|
|
2304
|
+
}
|
|
2305
|
+
return result;
|
|
2306
|
+
},
|
|
2307
|
+
});
|
|
2308
|
+
return () => {
|
|
2309
|
+
Object.defineProperty(host, 'adoptedStyleSheets', {
|
|
2310
|
+
configurable: originalPropertyDescriptor.configurable,
|
|
2311
|
+
enumerable: originalPropertyDescriptor.enumerable,
|
|
2312
|
+
get: originalPropertyDescriptor.get,
|
|
2313
|
+
set: originalPropertyDescriptor.set,
|
|
2314
|
+
});
|
|
2315
|
+
};
|
|
2316
|
+
}
|
|
2317
|
+
function initStyleDeclarationObserver({ styleDeclarationCb, mirror, ignoreCSSAttributes, stylesheetManager, }, { win }) {
|
|
2318
|
+
const setProperty = win.CSSStyleDeclaration.prototype.setProperty;
|
|
2319
|
+
win.CSSStyleDeclaration.prototype.setProperty = function (property, value, priority) {
|
|
2320
|
+
var _a;
|
|
2321
|
+
if (ignoreCSSAttributes.has(property)) {
|
|
2322
|
+
return setProperty.apply(this, [property, value, priority]);
|
|
2323
|
+
}
|
|
2324
|
+
const { id, styleId } = getIdAndStyleId((_a = this.parentRule) === null || _a === void 0 ? void 0 : _a.parentStyleSheet, mirror, stylesheetManager.styleMirror);
|
|
2325
|
+
if ((id && id !== -1) || (styleId && styleId !== -1)) {
|
|
2326
|
+
styleDeclarationCb({
|
|
2327
|
+
id,
|
|
2328
|
+
styleId,
|
|
2329
|
+
set: {
|
|
2330
|
+
property,
|
|
2331
|
+
value,
|
|
2332
|
+
priority,
|
|
2333
|
+
},
|
|
2334
|
+
index: getNestedCSSRulePositions(this.parentRule),
|
|
2335
|
+
});
|
|
2336
|
+
}
|
|
2337
|
+
return setProperty.apply(this, [property, value, priority]);
|
|
2338
|
+
};
|
|
2339
|
+
const removeProperty = win.CSSStyleDeclaration.prototype.removeProperty;
|
|
2340
|
+
win.CSSStyleDeclaration.prototype.removeProperty = function (property) {
|
|
2341
|
+
var _a;
|
|
2342
|
+
if (ignoreCSSAttributes.has(property)) {
|
|
2343
|
+
return removeProperty.apply(this, [property]);
|
|
2344
|
+
}
|
|
2345
|
+
const { id, styleId } = getIdAndStyleId((_a = this.parentRule) === null || _a === void 0 ? void 0 : _a.parentStyleSheet, mirror, stylesheetManager.styleMirror);
|
|
2346
|
+
if ((id && id !== -1) || (styleId && styleId !== -1)) {
|
|
2347
|
+
styleDeclarationCb({
|
|
2348
|
+
id,
|
|
2349
|
+
styleId,
|
|
2350
|
+
remove: {
|
|
2351
|
+
property,
|
|
2352
|
+
},
|
|
2353
|
+
index: getNestedCSSRulePositions(this.parentRule),
|
|
2354
|
+
});
|
|
2355
|
+
}
|
|
2356
|
+
return removeProperty.apply(this, [property]);
|
|
2357
|
+
};
|
|
2358
|
+
return () => {
|
|
2359
|
+
win.CSSStyleDeclaration.prototype.setProperty = setProperty;
|
|
2360
|
+
win.CSSStyleDeclaration.prototype.removeProperty = removeProperty;
|
|
2361
|
+
};
|
|
2362
|
+
}
|
|
2363
|
+
function initMediaInteractionObserver({ mediaInteractionCb, blockClass, blockSelector, mirror, sampling, }) {
|
|
2364
|
+
const handler = (type) => throttle((event) => {
|
|
2365
|
+
const target = getEventTarget(event);
|
|
2366
|
+
if (!target ||
|
|
2367
|
+
isBlocked(target, blockClass, blockSelector, true)) {
|
|
2368
|
+
return;
|
|
2369
|
+
}
|
|
2370
|
+
const { currentTime, volume, muted, playbackRate, } = target;
|
|
2371
|
+
mediaInteractionCb({
|
|
2372
|
+
type,
|
|
2373
|
+
id: mirror.getId(target),
|
|
2374
|
+
currentTime,
|
|
2375
|
+
volume,
|
|
2376
|
+
muted,
|
|
2377
|
+
playbackRate,
|
|
2378
|
+
});
|
|
2379
|
+
}, sampling.media || 500);
|
|
2380
|
+
const handlers = [
|
|
2381
|
+
on('play', handler(0)),
|
|
2382
|
+
on('pause', handler(1)),
|
|
2383
|
+
on('seeked', handler(2)),
|
|
2384
|
+
on('volumechange', handler(3)),
|
|
2385
|
+
on('ratechange', handler(4)),
|
|
2386
|
+
];
|
|
2387
|
+
return () => {
|
|
2388
|
+
handlers.forEach((h) => h());
|
|
2389
|
+
};
|
|
2390
|
+
}
|
|
2391
|
+
function initFontObserver({ fontCb, doc }) {
|
|
2392
|
+
const win = doc.defaultView;
|
|
2393
|
+
if (!win) {
|
|
2394
|
+
return () => {
|
|
2395
|
+
};
|
|
2396
|
+
}
|
|
2397
|
+
const handlers = [];
|
|
2398
|
+
const fontMap = new WeakMap();
|
|
2399
|
+
const originalFontFace = win.FontFace;
|
|
2400
|
+
win.FontFace = function FontFace(family, source, descriptors) {
|
|
2401
|
+
const fontFace = new originalFontFace(family, source, descriptors);
|
|
2402
|
+
fontMap.set(fontFace, {
|
|
2403
|
+
family,
|
|
2404
|
+
buffer: typeof source !== 'string',
|
|
2405
|
+
descriptors,
|
|
2406
|
+
fontSource: typeof source === 'string'
|
|
2407
|
+
? source
|
|
2408
|
+
: JSON.stringify(Array.from(new Uint8Array(source))),
|
|
2409
|
+
});
|
|
2410
|
+
return fontFace;
|
|
2411
|
+
};
|
|
2412
|
+
const restoreHandler = patch(doc.fonts, 'add', function (original) {
|
|
2413
|
+
return function (fontFace) {
|
|
2414
|
+
setTimeout(() => {
|
|
2415
|
+
const p = fontMap.get(fontFace);
|
|
2416
|
+
if (p) {
|
|
2417
|
+
fontCb(p);
|
|
2418
|
+
fontMap.delete(fontFace);
|
|
2419
|
+
}
|
|
2420
|
+
}, 0);
|
|
2421
|
+
return original.apply(this, [fontFace]);
|
|
2422
|
+
};
|
|
2423
|
+
});
|
|
2424
|
+
handlers.push(() => {
|
|
2425
|
+
win.FontFace = originalFontFace;
|
|
2426
|
+
});
|
|
2427
|
+
handlers.push(restoreHandler);
|
|
2428
|
+
return () => {
|
|
2429
|
+
handlers.forEach((h) => h());
|
|
2430
|
+
};
|
|
2431
|
+
}
|
|
2432
|
+
function initSelectionObserver(param) {
|
|
2433
|
+
const { doc, mirror, blockClass, blockSelector, selectionCb } = param;
|
|
2434
|
+
let collapsed = true;
|
|
2435
|
+
const updateSelection = () => {
|
|
2436
|
+
const selection = doc.getSelection();
|
|
2437
|
+
if (!selection || (collapsed && (selection === null || selection === void 0 ? void 0 : selection.isCollapsed)))
|
|
2438
|
+
return;
|
|
2439
|
+
collapsed = selection.isCollapsed || false;
|
|
2440
|
+
const ranges = [];
|
|
2441
|
+
const count = selection.rangeCount || 0;
|
|
2442
|
+
for (let i = 0; i < count; i++) {
|
|
2443
|
+
const range = selection.getRangeAt(i);
|
|
2444
|
+
const { startContainer, startOffset, endContainer, endOffset } = range;
|
|
2445
|
+
const blocked = isBlocked(startContainer, blockClass, blockSelector, true) ||
|
|
2446
|
+
isBlocked(endContainer, blockClass, blockSelector, true);
|
|
2447
|
+
if (blocked)
|
|
2448
|
+
continue;
|
|
2449
|
+
ranges.push({
|
|
2450
|
+
start: mirror.getId(startContainer),
|
|
2451
|
+
startOffset,
|
|
2452
|
+
end: mirror.getId(endContainer),
|
|
2453
|
+
endOffset,
|
|
2454
|
+
});
|
|
2455
|
+
}
|
|
2456
|
+
selectionCb({ ranges });
|
|
2457
|
+
};
|
|
2458
|
+
updateSelection();
|
|
2459
|
+
return on('selectionchange', updateSelection);
|
|
2460
|
+
}
|
|
2461
|
+
function mergeHooks(o, hooks) {
|
|
2462
|
+
const { mutationCb, mousemoveCb, mouseInteractionCb, scrollCb, viewportResizeCb, inputCb, mediaInteractionCb, styleSheetRuleCb, styleDeclarationCb, canvasMutationCb, fontCb, selectionCb, } = o;
|
|
2463
|
+
o.mutationCb = (...p) => {
|
|
2464
|
+
if (hooks.mutation) {
|
|
2465
|
+
hooks.mutation(...p);
|
|
2466
|
+
}
|
|
2467
|
+
mutationCb(...p);
|
|
2468
|
+
};
|
|
2469
|
+
o.mousemoveCb = (...p) => {
|
|
2470
|
+
if (hooks.mousemove) {
|
|
2471
|
+
hooks.mousemove(...p);
|
|
2472
|
+
}
|
|
2473
|
+
mousemoveCb(...p);
|
|
2474
|
+
};
|
|
2475
|
+
o.mouseInteractionCb = (...p) => {
|
|
2476
|
+
if (hooks.mouseInteraction) {
|
|
2477
|
+
hooks.mouseInteraction(...p);
|
|
2478
|
+
}
|
|
2479
|
+
mouseInteractionCb(...p);
|
|
2480
|
+
};
|
|
2481
|
+
o.scrollCb = (...p) => {
|
|
2482
|
+
if (hooks.scroll) {
|
|
2483
|
+
hooks.scroll(...p);
|
|
2484
|
+
}
|
|
2485
|
+
scrollCb(...p);
|
|
2486
|
+
};
|
|
2487
|
+
o.viewportResizeCb = (...p) => {
|
|
2488
|
+
if (hooks.viewportResize) {
|
|
2489
|
+
hooks.viewportResize(...p);
|
|
2490
|
+
}
|
|
2491
|
+
viewportResizeCb(...p);
|
|
2492
|
+
};
|
|
2493
|
+
o.inputCb = (...p) => {
|
|
2494
|
+
if (hooks.input) {
|
|
2495
|
+
hooks.input(...p);
|
|
2496
|
+
}
|
|
2497
|
+
inputCb(...p);
|
|
2498
|
+
};
|
|
2499
|
+
o.mediaInteractionCb = (...p) => {
|
|
2500
|
+
if (hooks.mediaInteaction) {
|
|
2501
|
+
hooks.mediaInteaction(...p);
|
|
2502
|
+
}
|
|
2503
|
+
mediaInteractionCb(...p);
|
|
2504
|
+
};
|
|
2505
|
+
o.styleSheetRuleCb = (...p) => {
|
|
2506
|
+
if (hooks.styleSheetRule) {
|
|
2507
|
+
hooks.styleSheetRule(...p);
|
|
2508
|
+
}
|
|
2509
|
+
styleSheetRuleCb(...p);
|
|
2510
|
+
};
|
|
2511
|
+
o.styleDeclarationCb = (...p) => {
|
|
2512
|
+
if (hooks.styleDeclaration) {
|
|
2513
|
+
hooks.styleDeclaration(...p);
|
|
2514
|
+
}
|
|
2515
|
+
styleDeclarationCb(...p);
|
|
2516
|
+
};
|
|
2517
|
+
o.canvasMutationCb = (...p) => {
|
|
2518
|
+
if (hooks.canvasMutation) {
|
|
2519
|
+
hooks.canvasMutation(...p);
|
|
2520
|
+
}
|
|
2521
|
+
canvasMutationCb(...p);
|
|
2522
|
+
};
|
|
2523
|
+
o.fontCb = (...p) => {
|
|
2524
|
+
if (hooks.font) {
|
|
2525
|
+
hooks.font(...p);
|
|
2526
|
+
}
|
|
2527
|
+
fontCb(...p);
|
|
2528
|
+
};
|
|
2529
|
+
o.selectionCb = (...p) => {
|
|
2530
|
+
if (hooks.selection) {
|
|
2531
|
+
hooks.selection(...p);
|
|
2532
|
+
}
|
|
2533
|
+
selectionCb(...p);
|
|
2534
|
+
};
|
|
2535
|
+
}
|
|
2536
|
+
function initObservers(o, hooks = {}) {
|
|
2537
|
+
const currentWindow = o.doc.defaultView;
|
|
2538
|
+
if (!currentWindow) {
|
|
2539
|
+
return () => {
|
|
2540
|
+
};
|
|
2541
|
+
}
|
|
2542
|
+
mergeHooks(o, hooks);
|
|
2543
|
+
const mutationObserver = initMutationObserver(o, o.doc);
|
|
2544
|
+
const mousemoveHandler = initMoveObserver(o);
|
|
2545
|
+
const mouseInteractionHandler = initMouseInteractionObserver(o);
|
|
2546
|
+
const scrollHandler = initScrollObserver(o);
|
|
2547
|
+
const viewportResizeHandler = initViewportResizeObserver(o);
|
|
2548
|
+
const inputHandler = initInputObserver(o);
|
|
2549
|
+
const mediaInteractionHandler = initMediaInteractionObserver(o);
|
|
2550
|
+
const styleSheetObserver = initStyleSheetObserver(o, { win: currentWindow });
|
|
2551
|
+
const adoptedStyleSheetObserver = initAdoptedStyleSheetObserver(o, o.doc);
|
|
2552
|
+
const styleDeclarationObserver = initStyleDeclarationObserver(o, {
|
|
2553
|
+
win: currentWindow,
|
|
2554
|
+
});
|
|
2555
|
+
const fontObserver = o.collectFonts
|
|
2556
|
+
? initFontObserver(o)
|
|
2557
|
+
: () => {
|
|
2558
|
+
};
|
|
2559
|
+
const selectionObserver = initSelectionObserver(o);
|
|
2560
|
+
const pluginHandlers = [];
|
|
2561
|
+
for (const plugin of o.plugins) {
|
|
2562
|
+
pluginHandlers.push(plugin.observer(plugin.callback, currentWindow, plugin.options));
|
|
2563
|
+
}
|
|
2564
|
+
return () => {
|
|
2565
|
+
mutationBuffers.forEach((b) => b.reset());
|
|
2566
|
+
mutationObserver.disconnect();
|
|
2567
|
+
mousemoveHandler();
|
|
2568
|
+
mouseInteractionHandler();
|
|
2569
|
+
scrollHandler();
|
|
2570
|
+
viewportResizeHandler();
|
|
2571
|
+
inputHandler();
|
|
2572
|
+
mediaInteractionHandler();
|
|
2573
|
+
styleSheetObserver();
|
|
2574
|
+
adoptedStyleSheetObserver();
|
|
2575
|
+
styleDeclarationObserver();
|
|
2576
|
+
fontObserver();
|
|
2577
|
+
selectionObserver();
|
|
2578
|
+
pluginHandlers.forEach((h) => h());
|
|
2579
|
+
};
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
class CrossOriginIframeMirror {
|
|
2583
|
+
constructor(generateIdFn) {
|
|
2584
|
+
this.generateIdFn = generateIdFn;
|
|
2585
|
+
this.iframeIdToRemoteIdMap = new WeakMap();
|
|
2586
|
+
this.iframeRemoteIdToIdMap = new WeakMap();
|
|
2587
|
+
}
|
|
2588
|
+
getId(iframe, remoteId, idToRemoteMap, remoteToIdMap) {
|
|
2589
|
+
const idToRemoteIdMap = idToRemoteMap || this.getIdToRemoteIdMap(iframe);
|
|
2590
|
+
const remoteIdToIdMap = remoteToIdMap || this.getRemoteIdToIdMap(iframe);
|
|
2591
|
+
let id = idToRemoteIdMap.get(remoteId);
|
|
2592
|
+
if (!id) {
|
|
2593
|
+
id = this.generateIdFn();
|
|
2594
|
+
idToRemoteIdMap.set(remoteId, id);
|
|
2595
|
+
remoteIdToIdMap.set(id, remoteId);
|
|
2596
|
+
}
|
|
2597
|
+
return id;
|
|
2598
|
+
}
|
|
2599
|
+
getIds(iframe, remoteId) {
|
|
2600
|
+
const idToRemoteIdMap = this.getIdToRemoteIdMap(iframe);
|
|
2601
|
+
const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe);
|
|
2602
|
+
return remoteId.map((id) => this.getId(iframe, id, idToRemoteIdMap, remoteIdToIdMap));
|
|
2603
|
+
}
|
|
2604
|
+
getRemoteId(iframe, id, map) {
|
|
2605
|
+
const remoteIdToIdMap = map || this.getRemoteIdToIdMap(iframe);
|
|
2606
|
+
if (typeof id !== 'number')
|
|
2607
|
+
return id;
|
|
2608
|
+
const remoteId = remoteIdToIdMap.get(id);
|
|
2609
|
+
if (!remoteId)
|
|
2610
|
+
return -1;
|
|
2611
|
+
return remoteId;
|
|
2612
|
+
}
|
|
2613
|
+
getRemoteIds(iframe, ids) {
|
|
2614
|
+
const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe);
|
|
2615
|
+
return ids.map((id) => this.getRemoteId(iframe, id, remoteIdToIdMap));
|
|
2616
|
+
}
|
|
2617
|
+
reset(iframe) {
|
|
2618
|
+
if (!iframe) {
|
|
2619
|
+
this.iframeIdToRemoteIdMap = new WeakMap();
|
|
2620
|
+
this.iframeRemoteIdToIdMap = new WeakMap();
|
|
2621
|
+
return;
|
|
2622
|
+
}
|
|
2623
|
+
this.iframeIdToRemoteIdMap.delete(iframe);
|
|
2624
|
+
this.iframeRemoteIdToIdMap.delete(iframe);
|
|
2625
|
+
}
|
|
2626
|
+
getIdToRemoteIdMap(iframe) {
|
|
2627
|
+
let idToRemoteIdMap = this.iframeIdToRemoteIdMap.get(iframe);
|
|
2628
|
+
if (!idToRemoteIdMap) {
|
|
2629
|
+
idToRemoteIdMap = new Map();
|
|
2630
|
+
this.iframeIdToRemoteIdMap.set(iframe, idToRemoteIdMap);
|
|
2631
|
+
}
|
|
2632
|
+
return idToRemoteIdMap;
|
|
2633
|
+
}
|
|
2634
|
+
getRemoteIdToIdMap(iframe) {
|
|
2635
|
+
let remoteIdToIdMap = this.iframeRemoteIdToIdMap.get(iframe);
|
|
2636
|
+
if (!remoteIdToIdMap) {
|
|
2637
|
+
remoteIdToIdMap = new Map();
|
|
2638
|
+
this.iframeRemoteIdToIdMap.set(iframe, remoteIdToIdMap);
|
|
2639
|
+
}
|
|
2640
|
+
return remoteIdToIdMap;
|
|
2641
|
+
}
|
|
2642
|
+
}
|
|
2643
|
+
|
|
2644
|
+
class IframeManager {
|
|
2645
|
+
constructor(options) {
|
|
2646
|
+
this.iframes = new WeakMap();
|
|
2647
|
+
this.crossOriginIframeMap = new WeakMap();
|
|
2648
|
+
this.crossOriginIframeMirror = new CrossOriginIframeMirror(genId);
|
|
2649
|
+
this.mutationCb = options.mutationCb;
|
|
2650
|
+
this.wrappedEmit = options.wrappedEmit;
|
|
2651
|
+
this.stylesheetManager = options.stylesheetManager;
|
|
2652
|
+
this.recordCrossOriginIframes = options.recordCrossOriginIframes;
|
|
2653
|
+
this.crossOriginIframeStyleMirror = new CrossOriginIframeMirror(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror));
|
|
2654
|
+
this.mirror = options.mirror;
|
|
2655
|
+
if (this.recordCrossOriginIframes) {
|
|
2656
|
+
window.addEventListener('message', this.handleMessage.bind(this));
|
|
2657
|
+
}
|
|
2658
|
+
}
|
|
2659
|
+
addIframe(iframeEl) {
|
|
2660
|
+
this.iframes.set(iframeEl, true);
|
|
2661
|
+
if (iframeEl.contentWindow)
|
|
2662
|
+
this.crossOriginIframeMap.set(iframeEl.contentWindow, iframeEl);
|
|
2663
|
+
}
|
|
2664
|
+
addLoadListener(cb) {
|
|
2665
|
+
this.loadListener = cb;
|
|
2666
|
+
}
|
|
2667
|
+
attachIframe(iframeEl, childSn) {
|
|
2668
|
+
var _a;
|
|
2669
|
+
this.mutationCb({
|
|
2670
|
+
adds: [
|
|
2671
|
+
{
|
|
2672
|
+
parentId: this.mirror.getId(iframeEl),
|
|
2673
|
+
nextId: null,
|
|
2674
|
+
node: childSn,
|
|
2675
|
+
},
|
|
2676
|
+
],
|
|
2677
|
+
removes: [],
|
|
2678
|
+
texts: [],
|
|
2679
|
+
attributes: [],
|
|
2680
|
+
isAttachIframe: true,
|
|
2681
|
+
});
|
|
2682
|
+
(_a = this.loadListener) === null || _a === void 0 ? void 0 : _a.call(this, iframeEl);
|
|
2683
|
+
if (iframeEl.contentDocument &&
|
|
2684
|
+
iframeEl.contentDocument.adoptedStyleSheets &&
|
|
2685
|
+
iframeEl.contentDocument.adoptedStyleSheets.length > 0)
|
|
2686
|
+
this.stylesheetManager.adoptStyleSheets(iframeEl.contentDocument.adoptedStyleSheets, this.mirror.getId(iframeEl.contentDocument));
|
|
2687
|
+
}
|
|
2688
|
+
handleMessage(message) {
|
|
2689
|
+
if (message.data.type === 'rrweb') {
|
|
2690
|
+
const iframeSourceWindow = message.source;
|
|
2691
|
+
if (!iframeSourceWindow)
|
|
2692
|
+
return;
|
|
2693
|
+
const iframeEl = this.crossOriginIframeMap.get(message.source);
|
|
2694
|
+
if (!iframeEl)
|
|
2695
|
+
return;
|
|
2696
|
+
const transformedEvent = this.transformCrossOriginEvent(iframeEl, message.data.event);
|
|
2697
|
+
if (transformedEvent)
|
|
2698
|
+
this.wrappedEmit(transformedEvent, message.data.isCheckout);
|
|
2699
|
+
}
|
|
2700
|
+
}
|
|
2701
|
+
transformCrossOriginEvent(iframeEl, e) {
|
|
2702
|
+
var _a;
|
|
2703
|
+
switch (e.type) {
|
|
2704
|
+
case EventType.FullSnapshot: {
|
|
2705
|
+
this.crossOriginIframeMirror.reset(iframeEl);
|
|
2706
|
+
this.crossOriginIframeStyleMirror.reset(iframeEl);
|
|
2707
|
+
this.replaceIdOnNode(e.data.node, iframeEl);
|
|
2708
|
+
return {
|
|
2709
|
+
timestamp: e.timestamp,
|
|
2710
|
+
type: EventType.IncrementalSnapshot,
|
|
2711
|
+
data: {
|
|
2712
|
+
source: IncrementalSource.Mutation,
|
|
2713
|
+
adds: [
|
|
2714
|
+
{
|
|
2715
|
+
parentId: this.mirror.getId(iframeEl),
|
|
2716
|
+
nextId: null,
|
|
2717
|
+
node: e.data.node,
|
|
2718
|
+
},
|
|
2719
|
+
],
|
|
2720
|
+
removes: [],
|
|
2721
|
+
texts: [],
|
|
2722
|
+
attributes: [],
|
|
2723
|
+
isAttachIframe: true,
|
|
2724
|
+
},
|
|
2725
|
+
};
|
|
2726
|
+
}
|
|
2727
|
+
case EventType.Meta:
|
|
2728
|
+
case EventType.Load:
|
|
2729
|
+
case EventType.DomContentLoaded: {
|
|
2730
|
+
return false;
|
|
2731
|
+
}
|
|
2732
|
+
case EventType.Plugin: {
|
|
2733
|
+
return e;
|
|
2734
|
+
}
|
|
2735
|
+
case EventType.Custom: {
|
|
2736
|
+
this.replaceIds(e.data.payload, iframeEl, ['id', 'parentId', 'previousId', 'nextId']);
|
|
2737
|
+
return e;
|
|
2738
|
+
}
|
|
2739
|
+
case EventType.IncrementalSnapshot: {
|
|
2740
|
+
switch (e.data.source) {
|
|
2741
|
+
case IncrementalSource.Mutation: {
|
|
2742
|
+
e.data.adds.forEach((n) => {
|
|
2743
|
+
this.replaceIds(n, iframeEl, [
|
|
2744
|
+
'parentId',
|
|
2745
|
+
'nextId',
|
|
2746
|
+
'previousId',
|
|
2747
|
+
]);
|
|
2748
|
+
this.replaceIdOnNode(n.node, iframeEl);
|
|
2749
|
+
});
|
|
2750
|
+
e.data.removes.forEach((n) => {
|
|
2751
|
+
this.replaceIds(n, iframeEl, ['parentId', 'id']);
|
|
2752
|
+
});
|
|
2753
|
+
e.data.attributes.forEach((n) => {
|
|
2754
|
+
this.replaceIds(n, iframeEl, ['id']);
|
|
2755
|
+
});
|
|
2756
|
+
e.data.texts.forEach((n) => {
|
|
2757
|
+
this.replaceIds(n, iframeEl, ['id']);
|
|
2758
|
+
});
|
|
2759
|
+
return e;
|
|
2760
|
+
}
|
|
2761
|
+
case IncrementalSource.Drag:
|
|
2762
|
+
case IncrementalSource.TouchMove:
|
|
2763
|
+
case IncrementalSource.MouseMove: {
|
|
2764
|
+
e.data.positions.forEach((p) => {
|
|
2765
|
+
this.replaceIds(p, iframeEl, ['id']);
|
|
2766
|
+
});
|
|
2767
|
+
return e;
|
|
2768
|
+
}
|
|
2769
|
+
case IncrementalSource.ViewportResize: {
|
|
2770
|
+
return false;
|
|
2771
|
+
}
|
|
2772
|
+
case IncrementalSource.MediaInteraction:
|
|
2773
|
+
case IncrementalSource.MouseInteraction:
|
|
2774
|
+
case IncrementalSource.Scroll:
|
|
2775
|
+
case IncrementalSource.CanvasMutation:
|
|
2776
|
+
case IncrementalSource.Input: {
|
|
2777
|
+
this.replaceIds(e.data, iframeEl, ['id']);
|
|
2778
|
+
return e;
|
|
2779
|
+
}
|
|
2780
|
+
case IncrementalSource.StyleSheetRule:
|
|
2781
|
+
case IncrementalSource.StyleDeclaration: {
|
|
2782
|
+
this.replaceIds(e.data, iframeEl, ['id']);
|
|
2783
|
+
this.replaceStyleIds(e.data, iframeEl, ['styleId']);
|
|
2784
|
+
return e;
|
|
2785
|
+
}
|
|
2786
|
+
case IncrementalSource.Font: {
|
|
2787
|
+
return e;
|
|
2788
|
+
}
|
|
2789
|
+
case IncrementalSource.Selection: {
|
|
2790
|
+
e.data.ranges.forEach((range) => {
|
|
2791
|
+
this.replaceIds(range, iframeEl, ['start', 'end']);
|
|
2792
|
+
});
|
|
2793
|
+
return e;
|
|
2794
|
+
}
|
|
2795
|
+
case IncrementalSource.AdoptedStyleSheet: {
|
|
2796
|
+
this.replaceIds(e.data, iframeEl, ['id']);
|
|
2797
|
+
this.replaceStyleIds(e.data, iframeEl, ['styleIds']);
|
|
2798
|
+
(_a = e.data.styles) === null || _a === void 0 ? void 0 : _a.forEach((style) => {
|
|
2799
|
+
this.replaceStyleIds(style, iframeEl, ['styleId']);
|
|
2800
|
+
});
|
|
2801
|
+
return e;
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2807
|
+
replace(iframeMirror, obj, iframeEl, keys) {
|
|
2808
|
+
for (const key of keys) {
|
|
2809
|
+
if (!Array.isArray(obj[key]) && typeof obj[key] !== 'number')
|
|
2810
|
+
continue;
|
|
2811
|
+
if (Array.isArray(obj[key])) {
|
|
2812
|
+
obj[key] = iframeMirror.getIds(iframeEl, obj[key]);
|
|
2813
|
+
}
|
|
2814
|
+
else {
|
|
2815
|
+
obj[key] = iframeMirror.getId(iframeEl, obj[key]);
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2818
|
+
return obj;
|
|
2819
|
+
}
|
|
2820
|
+
replaceIds(obj, iframeEl, keys) {
|
|
2821
|
+
return this.replace(this.crossOriginIframeMirror, obj, iframeEl, keys);
|
|
2822
|
+
}
|
|
2823
|
+
replaceStyleIds(obj, iframeEl, keys) {
|
|
2824
|
+
return this.replace(this.crossOriginIframeStyleMirror, obj, iframeEl, keys);
|
|
2825
|
+
}
|
|
2826
|
+
replaceIdOnNode(node, iframeEl) {
|
|
2827
|
+
this.replaceIds(node, iframeEl, ['id']);
|
|
2828
|
+
if ('childNodes' in node) {
|
|
2829
|
+
node.childNodes.forEach((child) => {
|
|
2830
|
+
this.replaceIdOnNode(child, iframeEl);
|
|
2831
|
+
});
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2836
|
+
class ShadowDomManager {
|
|
2837
|
+
constructor(options) {
|
|
2838
|
+
this.shadowDoms = new WeakSet();
|
|
2839
|
+
this.restorePatches = [];
|
|
2840
|
+
this.mutationCb = options.mutationCb;
|
|
2841
|
+
this.scrollCb = options.scrollCb;
|
|
2842
|
+
this.bypassOptions = options.bypassOptions;
|
|
2843
|
+
this.mirror = options.mirror;
|
|
2844
|
+
const manager = this;
|
|
2845
|
+
this.restorePatches.push(patch(Element.prototype, 'attachShadow', function (original) {
|
|
2846
|
+
return function (option) {
|
|
2847
|
+
const shadowRoot = original.call(this, option);
|
|
2848
|
+
if (this.shadowRoot)
|
|
2849
|
+
manager.addShadowRoot(this.shadowRoot, this.ownerDocument);
|
|
2850
|
+
return shadowRoot;
|
|
2851
|
+
};
|
|
2852
|
+
}));
|
|
2853
|
+
}
|
|
2854
|
+
addShadowRoot(shadowRoot, doc) {
|
|
2855
|
+
if (!isNativeShadowDom(shadowRoot))
|
|
2856
|
+
return;
|
|
2857
|
+
if (this.shadowDoms.has(shadowRoot))
|
|
2858
|
+
return;
|
|
2859
|
+
this.shadowDoms.add(shadowRoot);
|
|
2860
|
+
initMutationObserver(Object.assign(Object.assign({}, this.bypassOptions), { doc, mutationCb: this.mutationCb, mirror: this.mirror, shadowDomManager: this }), shadowRoot);
|
|
2861
|
+
initScrollObserver(Object.assign(Object.assign({}, this.bypassOptions), { scrollCb: this.scrollCb, doc: shadowRoot, mirror: this.mirror }));
|
|
2862
|
+
setTimeout(() => {
|
|
2863
|
+
if (shadowRoot.adoptedStyleSheets &&
|
|
2864
|
+
shadowRoot.adoptedStyleSheets.length > 0)
|
|
2865
|
+
this.bypassOptions.stylesheetManager.adoptStyleSheets(shadowRoot.adoptedStyleSheets, this.mirror.getId(shadowRoot.host));
|
|
2866
|
+
initAdoptedStyleSheetObserver({
|
|
2867
|
+
mirror: this.mirror,
|
|
2868
|
+
stylesheetManager: this.bypassOptions.stylesheetManager,
|
|
2869
|
+
}, shadowRoot);
|
|
2870
|
+
}, 0);
|
|
2871
|
+
}
|
|
2872
|
+
observeAttachShadow(iframeElement) {
|
|
2873
|
+
if (iframeElement.contentWindow) {
|
|
2874
|
+
const manager = this;
|
|
2875
|
+
this.restorePatches.push(patch(iframeElement.contentWindow.HTMLElement.prototype, 'attachShadow', function (original) {
|
|
2876
|
+
return function (option) {
|
|
2877
|
+
const shadowRoot = original.call(this, option);
|
|
2878
|
+
if (this.shadowRoot)
|
|
2879
|
+
manager.addShadowRoot(this.shadowRoot, iframeElement.contentDocument);
|
|
2880
|
+
return shadowRoot;
|
|
2881
|
+
};
|
|
2882
|
+
}));
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
reset() {
|
|
2886
|
+
this.restorePatches.forEach((restorePatch) => restorePatch());
|
|
2887
|
+
this.shadowDoms = new WeakSet();
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
|
|
2891
|
+
/*! *****************************************************************************
|
|
2892
|
+
Copyright (c) Microsoft Corporation.
|
|
2893
|
+
|
|
2894
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
2895
|
+
purpose with or without fee is hereby granted.
|
|
2896
|
+
|
|
2897
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2898
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2899
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2900
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2901
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2902
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2903
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
2904
|
+
***************************************************************************** */
|
|
2905
|
+
|
|
2906
|
+
function __rest(s, e) {
|
|
2907
|
+
var t = {};
|
|
2908
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
2909
|
+
t[p] = s[p];
|
|
2910
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2911
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2912
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
2913
|
+
t[p[i]] = s[p[i]];
|
|
2914
|
+
}
|
|
2915
|
+
return t;
|
|
2916
|
+
}
|
|
2917
|
+
|
|
2918
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
2919
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2920
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2921
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
2922
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
2923
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
2924
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2925
|
+
});
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2928
|
+
/*
|
|
2929
|
+
* base64-arraybuffer 1.0.1 <https://github.com/niklasvh/base64-arraybuffer>
|
|
2930
|
+
* Copyright (c) 2021 Niklas von Hertzen <https://hertzen.com>
|
|
2931
|
+
* Released under MIT License
|
|
2932
|
+
*/
|
|
2933
|
+
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
2934
|
+
// Use a lookup table to find the index.
|
|
2935
|
+
var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
|
|
2936
|
+
for (var i = 0; i < chars.length; i++) {
|
|
2937
|
+
lookup[chars.charCodeAt(i)] = i;
|
|
2938
|
+
}
|
|
2939
|
+
var encode = function (arraybuffer) {
|
|
2940
|
+
var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = '';
|
|
2941
|
+
for (i = 0; i < len; i += 3) {
|
|
2942
|
+
base64 += chars[bytes[i] >> 2];
|
|
2943
|
+
base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
|
|
2944
|
+
base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
|
|
2945
|
+
base64 += chars[bytes[i + 2] & 63];
|
|
2946
|
+
}
|
|
2947
|
+
if (len % 3 === 2) {
|
|
2948
|
+
base64 = base64.substring(0, base64.length - 1) + '=';
|
|
2949
|
+
}
|
|
2950
|
+
else if (len % 3 === 1) {
|
|
2951
|
+
base64 = base64.substring(0, base64.length - 2) + '==';
|
|
2952
|
+
}
|
|
2953
|
+
return base64;
|
|
2954
|
+
};
|
|
2955
|
+
|
|
2956
|
+
const canvasVarMap = new Map();
|
|
2957
|
+
function variableListFor(ctx, ctor) {
|
|
2958
|
+
let contextMap = canvasVarMap.get(ctx);
|
|
2959
|
+
if (!contextMap) {
|
|
2960
|
+
contextMap = new Map();
|
|
2961
|
+
canvasVarMap.set(ctx, contextMap);
|
|
2962
|
+
}
|
|
2963
|
+
if (!contextMap.has(ctor)) {
|
|
2964
|
+
contextMap.set(ctor, []);
|
|
2965
|
+
}
|
|
2966
|
+
return contextMap.get(ctor);
|
|
2967
|
+
}
|
|
2968
|
+
const saveWebGLVar = (value, win, ctx) => {
|
|
2969
|
+
if (!value ||
|
|
2970
|
+
!(isInstanceOfWebGLObject(value, win) || typeof value === 'object'))
|
|
2971
|
+
return;
|
|
2972
|
+
const name = value.constructor.name;
|
|
2973
|
+
const list = variableListFor(ctx, name);
|
|
2974
|
+
let index = list.indexOf(value);
|
|
2975
|
+
if (index === -1) {
|
|
2976
|
+
index = list.length;
|
|
2977
|
+
list.push(value);
|
|
2978
|
+
}
|
|
2979
|
+
return index;
|
|
2980
|
+
};
|
|
2981
|
+
function serializeArg(value, win, ctx) {
|
|
2982
|
+
if (value instanceof Array) {
|
|
2983
|
+
return value.map((arg) => serializeArg(arg, win, ctx));
|
|
2984
|
+
}
|
|
2985
|
+
else if (value === null) {
|
|
2986
|
+
return value;
|
|
2987
|
+
}
|
|
2988
|
+
else if (value instanceof Float32Array ||
|
|
2989
|
+
value instanceof Float64Array ||
|
|
2990
|
+
value instanceof Int32Array ||
|
|
2991
|
+
value instanceof Uint32Array ||
|
|
2992
|
+
value instanceof Uint8Array ||
|
|
2993
|
+
value instanceof Uint16Array ||
|
|
2994
|
+
value instanceof Int16Array ||
|
|
2995
|
+
value instanceof Int8Array ||
|
|
2996
|
+
value instanceof Uint8ClampedArray) {
|
|
2997
|
+
const name = value.constructor.name;
|
|
2998
|
+
return {
|
|
2999
|
+
rr_type: name,
|
|
3000
|
+
args: [Object.values(value)],
|
|
3001
|
+
};
|
|
3002
|
+
}
|
|
3003
|
+
else if (value instanceof ArrayBuffer) {
|
|
3004
|
+
const name = value.constructor.name;
|
|
3005
|
+
const base64 = encode(value);
|
|
3006
|
+
return {
|
|
3007
|
+
rr_type: name,
|
|
3008
|
+
base64,
|
|
3009
|
+
};
|
|
3010
|
+
}
|
|
3011
|
+
else if (value instanceof DataView) {
|
|
3012
|
+
const name = value.constructor.name;
|
|
3013
|
+
return {
|
|
3014
|
+
rr_type: name,
|
|
3015
|
+
args: [
|
|
3016
|
+
serializeArg(value.buffer, win, ctx),
|
|
3017
|
+
value.byteOffset,
|
|
3018
|
+
value.byteLength,
|
|
3019
|
+
],
|
|
3020
|
+
};
|
|
3021
|
+
}
|
|
3022
|
+
else if (value instanceof HTMLImageElement) {
|
|
3023
|
+
const name = value.constructor.name;
|
|
3024
|
+
const { src } = value;
|
|
3025
|
+
return {
|
|
3026
|
+
rr_type: name,
|
|
3027
|
+
src,
|
|
3028
|
+
};
|
|
3029
|
+
}
|
|
3030
|
+
else if (value instanceof HTMLCanvasElement) {
|
|
3031
|
+
const name = 'HTMLImageElement';
|
|
3032
|
+
const src = value.toDataURL();
|
|
3033
|
+
return {
|
|
3034
|
+
rr_type: name,
|
|
3035
|
+
src,
|
|
3036
|
+
};
|
|
3037
|
+
}
|
|
3038
|
+
else if (value instanceof ImageData) {
|
|
3039
|
+
const name = value.constructor.name;
|
|
3040
|
+
return {
|
|
3041
|
+
rr_type: name,
|
|
3042
|
+
args: [serializeArg(value.data, win, ctx), value.width, value.height],
|
|
3043
|
+
};
|
|
3044
|
+
}
|
|
3045
|
+
else if (isInstanceOfWebGLObject(value, win) || typeof value === 'object') {
|
|
3046
|
+
const name = value.constructor.name;
|
|
3047
|
+
const index = saveWebGLVar(value, win, ctx);
|
|
3048
|
+
return {
|
|
3049
|
+
rr_type: name,
|
|
3050
|
+
index: index,
|
|
3051
|
+
};
|
|
3052
|
+
}
|
|
3053
|
+
return value;
|
|
3054
|
+
}
|
|
3055
|
+
const serializeArgs = (args, win, ctx) => {
|
|
3056
|
+
return [...args].map((arg) => serializeArg(arg, win, ctx));
|
|
3057
|
+
};
|
|
3058
|
+
const isInstanceOfWebGLObject = (value, win) => {
|
|
3059
|
+
const webGLConstructorNames = [
|
|
3060
|
+
'WebGLActiveInfo',
|
|
3061
|
+
'WebGLBuffer',
|
|
3062
|
+
'WebGLFramebuffer',
|
|
3063
|
+
'WebGLProgram',
|
|
3064
|
+
'WebGLRenderbuffer',
|
|
3065
|
+
'WebGLShader',
|
|
3066
|
+
'WebGLShaderPrecisionFormat',
|
|
3067
|
+
'WebGLTexture',
|
|
3068
|
+
'WebGLUniformLocation',
|
|
3069
|
+
'WebGLVertexArrayObject',
|
|
3070
|
+
'WebGLVertexArrayObjectOES',
|
|
3071
|
+
];
|
|
3072
|
+
const supportedWebGLConstructorNames = webGLConstructorNames.filter((name) => typeof win[name] === 'function');
|
|
3073
|
+
return Boolean(supportedWebGLConstructorNames.find((name) => value instanceof win[name]));
|
|
3074
|
+
};
|
|
3075
|
+
|
|
3076
|
+
function initCanvas2DMutationObserver(cb, win, blockClass, blockSelector) {
|
|
3077
|
+
const handlers = [];
|
|
3078
|
+
const props2D = Object.getOwnPropertyNames(win.CanvasRenderingContext2D.prototype);
|
|
3079
|
+
for (const prop of props2D) {
|
|
3080
|
+
try {
|
|
3081
|
+
if (typeof win.CanvasRenderingContext2D.prototype[prop] !== 'function') {
|
|
3082
|
+
continue;
|
|
3083
|
+
}
|
|
3084
|
+
const restoreHandler = patch(win.CanvasRenderingContext2D.prototype, prop, function (original) {
|
|
3085
|
+
return function (...args) {
|
|
3086
|
+
if (!isBlocked(this.canvas, blockClass, blockSelector, true)) {
|
|
3087
|
+
setTimeout(() => {
|
|
3088
|
+
const recordArgs = serializeArgs([...args], win, this);
|
|
3089
|
+
cb(this.canvas, {
|
|
3090
|
+
type: CanvasContext['2D'],
|
|
3091
|
+
property: prop,
|
|
3092
|
+
args: recordArgs,
|
|
3093
|
+
});
|
|
3094
|
+
}, 0);
|
|
3095
|
+
}
|
|
3096
|
+
return original.apply(this, args);
|
|
3097
|
+
};
|
|
3098
|
+
});
|
|
3099
|
+
handlers.push(restoreHandler);
|
|
3100
|
+
}
|
|
3101
|
+
catch (_a) {
|
|
3102
|
+
const hookHandler = hookSetter(win.CanvasRenderingContext2D.prototype, prop, {
|
|
3103
|
+
set(v) {
|
|
3104
|
+
cb(this.canvas, {
|
|
3105
|
+
type: CanvasContext['2D'],
|
|
3106
|
+
property: prop,
|
|
3107
|
+
args: [v],
|
|
3108
|
+
setter: true,
|
|
3109
|
+
});
|
|
3110
|
+
},
|
|
3111
|
+
});
|
|
3112
|
+
handlers.push(hookHandler);
|
|
3113
|
+
}
|
|
3114
|
+
}
|
|
3115
|
+
return () => {
|
|
3116
|
+
handlers.forEach((h) => h());
|
|
3117
|
+
};
|
|
3118
|
+
}
|
|
3119
|
+
|
|
3120
|
+
function initCanvasContextObserver(win, blockClass, blockSelector) {
|
|
3121
|
+
const handlers = [];
|
|
3122
|
+
try {
|
|
3123
|
+
const restoreHandler = patch(win.HTMLCanvasElement.prototype, 'getContext', function (original) {
|
|
3124
|
+
return function (contextType, ...args) {
|
|
3125
|
+
if (!isBlocked(this, blockClass, blockSelector, true)) {
|
|
3126
|
+
if (!('__context' in this))
|
|
3127
|
+
this.__context = contextType;
|
|
3128
|
+
}
|
|
3129
|
+
return original.apply(this, [contextType, ...args]);
|
|
3130
|
+
};
|
|
3131
|
+
});
|
|
3132
|
+
handlers.push(restoreHandler);
|
|
3133
|
+
}
|
|
3134
|
+
catch (_a) {
|
|
3135
|
+
console.error('failed to patch HTMLCanvasElement.prototype.getContext');
|
|
3136
|
+
}
|
|
3137
|
+
return () => {
|
|
3138
|
+
handlers.forEach((h) => h());
|
|
3139
|
+
};
|
|
3140
|
+
}
|
|
3141
|
+
|
|
3142
|
+
function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, mirror, win) {
|
|
3143
|
+
const handlers = [];
|
|
3144
|
+
const props = Object.getOwnPropertyNames(prototype);
|
|
3145
|
+
for (const prop of props) {
|
|
3146
|
+
if ([
|
|
3147
|
+
'isContextLost',
|
|
3148
|
+
'canvas',
|
|
3149
|
+
'drawingBufferWidth',
|
|
3150
|
+
'drawingBufferHeight',
|
|
3151
|
+
].includes(prop)) {
|
|
3152
|
+
continue;
|
|
3153
|
+
}
|
|
3154
|
+
try {
|
|
3155
|
+
if (typeof prototype[prop] !== 'function') {
|
|
3156
|
+
continue;
|
|
3157
|
+
}
|
|
3158
|
+
const restoreHandler = patch(prototype, prop, function (original) {
|
|
3159
|
+
return function (...args) {
|
|
3160
|
+
const result = original.apply(this, args);
|
|
3161
|
+
saveWebGLVar(result, win, this);
|
|
3162
|
+
if (!isBlocked(this.canvas, blockClass, blockSelector, true)) {
|
|
3163
|
+
const recordArgs = serializeArgs([...args], win, this);
|
|
3164
|
+
const mutation = {
|
|
3165
|
+
type,
|
|
3166
|
+
property: prop,
|
|
3167
|
+
args: recordArgs,
|
|
3168
|
+
};
|
|
3169
|
+
cb(this.canvas, mutation);
|
|
3170
|
+
}
|
|
3171
|
+
return result;
|
|
3172
|
+
};
|
|
3173
|
+
});
|
|
3174
|
+
handlers.push(restoreHandler);
|
|
3175
|
+
}
|
|
3176
|
+
catch (_a) {
|
|
3177
|
+
const hookHandler = hookSetter(prototype, prop, {
|
|
3178
|
+
set(v) {
|
|
3179
|
+
cb(this.canvas, {
|
|
3180
|
+
type,
|
|
3181
|
+
property: prop,
|
|
3182
|
+
args: [v],
|
|
3183
|
+
setter: true,
|
|
3184
|
+
});
|
|
3185
|
+
},
|
|
3186
|
+
});
|
|
3187
|
+
handlers.push(hookHandler);
|
|
3188
|
+
}
|
|
3189
|
+
}
|
|
3190
|
+
return handlers;
|
|
3191
|
+
}
|
|
3192
|
+
function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector, mirror) {
|
|
3193
|
+
const handlers = [];
|
|
3194
|
+
handlers.push(...patchGLPrototype(win.WebGLRenderingContext.prototype, CanvasContext.WebGL, cb, blockClass, blockSelector, mirror, win));
|
|
3195
|
+
if (typeof win.WebGL2RenderingContext !== 'undefined') {
|
|
3196
|
+
handlers.push(...patchGLPrototype(win.WebGL2RenderingContext.prototype, CanvasContext.WebGL2, cb, blockClass, blockSelector, mirror, win));
|
|
3197
|
+
}
|
|
3198
|
+
return () => {
|
|
3199
|
+
handlers.forEach((h) => h());
|
|
3200
|
+
};
|
|
3201
|
+
}
|
|
3202
|
+
|
|
3203
|
+
var WorkerClass = null;
|
|
3204
|
+
|
|
3205
|
+
try {
|
|
3206
|
+
var WorkerThreads =
|
|
3207
|
+
typeof module !== 'undefined' && typeof module.require === 'function' && module.require('worker_threads') ||
|
|
3208
|
+
typeof __non_webpack_require__ === 'function' && __non_webpack_require__('worker_threads') ||
|
|
3209
|
+
typeof require === 'function' && require('worker_threads');
|
|
3210
|
+
WorkerClass = WorkerThreads.Worker;
|
|
3211
|
+
} catch(e) {} // eslint-disable-line
|
|
3212
|
+
|
|
3213
|
+
function decodeBase64$1(base64, enableUnicode) {
|
|
3214
|
+
return Buffer.from(base64, 'base64').toString(enableUnicode ? 'utf16' : 'utf8');
|
|
3215
|
+
}
|
|
3216
|
+
|
|
3217
|
+
function createBase64WorkerFactory$2(base64, sourcemapArg, enableUnicodeArg) {
|
|
3218
|
+
var sourcemap = sourcemapArg === undefined ? null : sourcemapArg;
|
|
3219
|
+
var enableUnicode = enableUnicodeArg === undefined ? false : enableUnicodeArg;
|
|
3220
|
+
var source = decodeBase64$1(base64, enableUnicode);
|
|
3221
|
+
var start = source.indexOf('\n', 10) + 1;
|
|
3222
|
+
var body = source.substring(start) + (sourcemap ? '\/\/# sourceMappingURL=' + sourcemap : '');
|
|
3223
|
+
return function WorkerFactory(options) {
|
|
3224
|
+
return new WorkerClass(body, Object.assign({}, options, { eval: true }));
|
|
3225
|
+
};
|
|
3226
|
+
}
|
|
3227
|
+
|
|
3228
|
+
function decodeBase64(base64, enableUnicode) {
|
|
3229
|
+
var binaryString = atob(base64);
|
|
3230
|
+
if (enableUnicode) {
|
|
3231
|
+
var binaryView = new Uint8Array(binaryString.length);
|
|
3232
|
+
for (var i = 0, n = binaryString.length; i < n; ++i) {
|
|
3233
|
+
binaryView[i] = binaryString.charCodeAt(i);
|
|
3234
|
+
}
|
|
3235
|
+
return String.fromCharCode.apply(null, new Uint16Array(binaryView.buffer));
|
|
3236
|
+
}
|
|
3237
|
+
return binaryString;
|
|
3238
|
+
}
|
|
3239
|
+
|
|
3240
|
+
function createURL(base64, sourcemapArg, enableUnicodeArg) {
|
|
3241
|
+
var sourcemap = sourcemapArg === undefined ? null : sourcemapArg;
|
|
3242
|
+
var enableUnicode = enableUnicodeArg === undefined ? false : enableUnicodeArg;
|
|
3243
|
+
var source = decodeBase64(base64, enableUnicode);
|
|
3244
|
+
var start = source.indexOf('\n', 10) + 1;
|
|
3245
|
+
var body = source.substring(start) + (sourcemap ? '\/\/# sourceMappingURL=' + sourcemap : '');
|
|
3246
|
+
var blob = new Blob([body], { type: 'application/javascript' });
|
|
3247
|
+
return URL.createObjectURL(blob);
|
|
3248
|
+
}
|
|
3249
|
+
|
|
3250
|
+
function createBase64WorkerFactory$1(base64, sourcemapArg, enableUnicodeArg) {
|
|
3251
|
+
var url;
|
|
3252
|
+
return function WorkerFactory(options) {
|
|
3253
|
+
url = url || createURL(base64, sourcemapArg, enableUnicodeArg);
|
|
3254
|
+
return new Worker(url, options);
|
|
3255
|
+
};
|
|
3256
|
+
}
|
|
3257
|
+
|
|
3258
|
+
var kIsNodeJS = Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';
|
|
3259
|
+
|
|
3260
|
+
function isNodeJS() {
|
|
3261
|
+
return kIsNodeJS;
|
|
3262
|
+
}
|
|
3263
|
+
|
|
3264
|
+
function createBase64WorkerFactory(base64, sourcemapArg, enableUnicodeArg) {
|
|
3265
|
+
if (isNodeJS()) {
|
|
3266
|
+
return createBase64WorkerFactory$2(base64, sourcemapArg, enableUnicodeArg);
|
|
3267
|
+
}
|
|
3268
|
+
return createBase64WorkerFactory$1(base64, sourcemapArg, enableUnicodeArg);
|
|
3269
|
+
}
|
|
3270
|
+
|
|
3271
|
+
var WorkerFactory = createBase64WorkerFactory('Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=', null, false);
|
|
3272
|
+
|
|
3273
|
+
class CanvasManager {
|
|
3274
|
+
constructor(options) {
|
|
3275
|
+
this.pendingCanvasMutations = new Map();
|
|
3276
|
+
this.rafStamps = { latestId: 0, invokeId: null };
|
|
3277
|
+
this.frozen = false;
|
|
3278
|
+
this.locked = false;
|
|
3279
|
+
this.processMutation = (target, mutation) => {
|
|
3280
|
+
const newFrame = this.rafStamps.invokeId &&
|
|
3281
|
+
this.rafStamps.latestId !== this.rafStamps.invokeId;
|
|
3282
|
+
if (newFrame || !this.rafStamps.invokeId)
|
|
3283
|
+
this.rafStamps.invokeId = this.rafStamps.latestId;
|
|
3284
|
+
if (!this.pendingCanvasMutations.has(target)) {
|
|
3285
|
+
this.pendingCanvasMutations.set(target, []);
|
|
3286
|
+
}
|
|
3287
|
+
this.pendingCanvasMutations.get(target).push(mutation);
|
|
3288
|
+
};
|
|
3289
|
+
const { sampling = 'all', win, blockClass, blockSelector, recordCanvas, dataURLOptions, } = options;
|
|
3290
|
+
this.mutationCb = options.mutationCb;
|
|
3291
|
+
this.mirror = options.mirror;
|
|
3292
|
+
if (recordCanvas && sampling === 'all')
|
|
3293
|
+
this.initCanvasMutationObserver(win, blockClass, blockSelector);
|
|
3294
|
+
if (recordCanvas && typeof sampling === 'number')
|
|
3295
|
+
this.initCanvasFPSObserver(sampling, win, blockClass, blockSelector, {
|
|
3296
|
+
dataURLOptions,
|
|
3297
|
+
});
|
|
3298
|
+
}
|
|
3299
|
+
reset() {
|
|
3300
|
+
this.pendingCanvasMutations.clear();
|
|
3301
|
+
this.resetObservers && this.resetObservers();
|
|
3302
|
+
}
|
|
3303
|
+
freeze() {
|
|
3304
|
+
this.frozen = true;
|
|
3305
|
+
}
|
|
3306
|
+
unfreeze() {
|
|
3307
|
+
this.frozen = false;
|
|
3308
|
+
}
|
|
3309
|
+
lock() {
|
|
3310
|
+
this.locked = true;
|
|
3311
|
+
}
|
|
3312
|
+
unlock() {
|
|
3313
|
+
this.locked = false;
|
|
3314
|
+
}
|
|
3315
|
+
initCanvasFPSObserver(fps, win, blockClass, blockSelector, options) {
|
|
3316
|
+
const canvasContextReset = initCanvasContextObserver(win, blockClass, blockSelector);
|
|
3317
|
+
const snapshotInProgressMap = new Map();
|
|
3318
|
+
const worker = new WorkerFactory();
|
|
3319
|
+
worker.onmessage = (e) => {
|
|
3320
|
+
const { id } = e.data;
|
|
3321
|
+
snapshotInProgressMap.set(id, false);
|
|
3322
|
+
if (!('base64' in e.data))
|
|
3323
|
+
return;
|
|
3324
|
+
const { base64, type, width, height } = e.data;
|
|
3325
|
+
this.mutationCb({
|
|
3326
|
+
id,
|
|
3327
|
+
type: CanvasContext['2D'],
|
|
3328
|
+
commands: [
|
|
3329
|
+
{
|
|
3330
|
+
property: 'clearRect',
|
|
3331
|
+
args: [0, 0, width, height],
|
|
3332
|
+
},
|
|
3333
|
+
{
|
|
3334
|
+
property: 'drawImage',
|
|
3335
|
+
args: [
|
|
3336
|
+
{
|
|
3337
|
+
rr_type: 'ImageBitmap',
|
|
3338
|
+
args: [
|
|
3339
|
+
{
|
|
3340
|
+
rr_type: 'Blob',
|
|
3341
|
+
data: [{ rr_type: 'ArrayBuffer', base64 }],
|
|
3342
|
+
type,
|
|
3343
|
+
},
|
|
3344
|
+
],
|
|
3345
|
+
},
|
|
3346
|
+
0,
|
|
3347
|
+
0,
|
|
3348
|
+
],
|
|
3349
|
+
},
|
|
3350
|
+
],
|
|
3351
|
+
});
|
|
3352
|
+
};
|
|
3353
|
+
const timeBetweenSnapshots = 1000 / fps;
|
|
3354
|
+
let lastSnapshotTime = 0;
|
|
3355
|
+
let rafId;
|
|
3356
|
+
const getCanvas = () => {
|
|
3357
|
+
const matchedCanvas = [];
|
|
3358
|
+
win.document.querySelectorAll('canvas').forEach((canvas) => {
|
|
3359
|
+
if (!isBlocked(canvas, blockClass, blockSelector, true)) {
|
|
3360
|
+
matchedCanvas.push(canvas);
|
|
3361
|
+
}
|
|
3362
|
+
});
|
|
3363
|
+
return matchedCanvas;
|
|
3364
|
+
};
|
|
3365
|
+
const takeCanvasSnapshots = (timestamp) => {
|
|
3366
|
+
if (lastSnapshotTime &&
|
|
3367
|
+
timestamp - lastSnapshotTime < timeBetweenSnapshots) {
|
|
3368
|
+
rafId = requestAnimationFrame(takeCanvasSnapshots);
|
|
3369
|
+
return;
|
|
3370
|
+
}
|
|
3371
|
+
lastSnapshotTime = timestamp;
|
|
3372
|
+
getCanvas()
|
|
3373
|
+
.forEach((canvas) => __awaiter(this, void 0, void 0, function* () {
|
|
3374
|
+
var _a;
|
|
3375
|
+
const id = this.mirror.getId(canvas);
|
|
3376
|
+
if (snapshotInProgressMap.get(id))
|
|
3377
|
+
return;
|
|
3378
|
+
snapshotInProgressMap.set(id, true);
|
|
3379
|
+
if (['webgl', 'webgl2'].includes(canvas.__context)) {
|
|
3380
|
+
const context = canvas.getContext(canvas.__context);
|
|
3381
|
+
if (((_a = context === null || context === void 0 ? void 0 : context.getContextAttributes()) === null || _a === void 0 ? void 0 : _a.preserveDrawingBuffer) === false) {
|
|
3382
|
+
context === null || context === void 0 ? void 0 : context.clear(context.COLOR_BUFFER_BIT);
|
|
3383
|
+
}
|
|
3384
|
+
}
|
|
3385
|
+
const bitmap = yield createImageBitmap(canvas);
|
|
3386
|
+
worker.postMessage({
|
|
3387
|
+
id,
|
|
3388
|
+
bitmap,
|
|
3389
|
+
width: canvas.width,
|
|
3390
|
+
height: canvas.height,
|
|
3391
|
+
dataURLOptions: options.dataURLOptions,
|
|
3392
|
+
}, [bitmap]);
|
|
3393
|
+
}));
|
|
3394
|
+
rafId = requestAnimationFrame(takeCanvasSnapshots);
|
|
3395
|
+
};
|
|
3396
|
+
rafId = requestAnimationFrame(takeCanvasSnapshots);
|
|
3397
|
+
this.resetObservers = () => {
|
|
3398
|
+
canvasContextReset();
|
|
3399
|
+
cancelAnimationFrame(rafId);
|
|
3400
|
+
};
|
|
3401
|
+
}
|
|
3402
|
+
initCanvasMutationObserver(win, blockClass, blockSelector) {
|
|
3403
|
+
this.startRAFTimestamping();
|
|
3404
|
+
this.startPendingCanvasMutationFlusher();
|
|
3405
|
+
const canvasContextReset = initCanvasContextObserver(win, blockClass, blockSelector);
|
|
3406
|
+
const canvas2DReset = initCanvas2DMutationObserver(this.processMutation.bind(this), win, blockClass, blockSelector);
|
|
3407
|
+
const canvasWebGL1and2Reset = initCanvasWebGLMutationObserver(this.processMutation.bind(this), win, blockClass, blockSelector, this.mirror);
|
|
3408
|
+
this.resetObservers = () => {
|
|
3409
|
+
canvasContextReset();
|
|
3410
|
+
canvas2DReset();
|
|
3411
|
+
canvasWebGL1and2Reset();
|
|
3412
|
+
};
|
|
3413
|
+
}
|
|
3414
|
+
startPendingCanvasMutationFlusher() {
|
|
3415
|
+
requestAnimationFrame(() => this.flushPendingCanvasMutations());
|
|
3416
|
+
}
|
|
3417
|
+
startRAFTimestamping() {
|
|
3418
|
+
const setLatestRAFTimestamp = (timestamp) => {
|
|
3419
|
+
this.rafStamps.latestId = timestamp;
|
|
3420
|
+
requestAnimationFrame(setLatestRAFTimestamp);
|
|
3421
|
+
};
|
|
3422
|
+
requestAnimationFrame(setLatestRAFTimestamp);
|
|
3423
|
+
}
|
|
3424
|
+
flushPendingCanvasMutations() {
|
|
3425
|
+
this.pendingCanvasMutations.forEach((values, canvas) => {
|
|
3426
|
+
const id = this.mirror.getId(canvas);
|
|
3427
|
+
this.flushPendingCanvasMutationFor(canvas, id);
|
|
3428
|
+
});
|
|
3429
|
+
requestAnimationFrame(() => this.flushPendingCanvasMutations());
|
|
3430
|
+
}
|
|
3431
|
+
flushPendingCanvasMutationFor(canvas, id) {
|
|
3432
|
+
if (this.frozen || this.locked) {
|
|
3433
|
+
return;
|
|
3434
|
+
}
|
|
3435
|
+
const valuesWithType = this.pendingCanvasMutations.get(canvas);
|
|
3436
|
+
if (!valuesWithType || id === -1)
|
|
3437
|
+
return;
|
|
3438
|
+
const values = valuesWithType.map((value) => {
|
|
3439
|
+
const rest = __rest(value, ["type"]);
|
|
3440
|
+
return rest;
|
|
3441
|
+
});
|
|
3442
|
+
const { type } = valuesWithType[0];
|
|
3443
|
+
this.mutationCb({ id, type, commands: values });
|
|
3444
|
+
this.pendingCanvasMutations.delete(canvas);
|
|
3445
|
+
}
|
|
3446
|
+
}
|
|
3447
|
+
|
|
3448
|
+
class StylesheetManager {
|
|
3449
|
+
constructor(options) {
|
|
3450
|
+
this.trackedLinkElements = new WeakSet();
|
|
3451
|
+
this.styleMirror = new StyleSheetMirror();
|
|
3452
|
+
this.mutationCb = options.mutationCb;
|
|
3453
|
+
this.adoptedStyleSheetCb = options.adoptedStyleSheetCb;
|
|
3454
|
+
}
|
|
3455
|
+
attachLinkElement(linkEl, childSn) {
|
|
3456
|
+
if ('_cssText' in childSn.attributes)
|
|
3457
|
+
this.mutationCb({
|
|
3458
|
+
adds: [],
|
|
3459
|
+
removes: [],
|
|
3460
|
+
texts: [],
|
|
3461
|
+
attributes: [
|
|
3462
|
+
{
|
|
3463
|
+
id: childSn.id,
|
|
3464
|
+
attributes: childSn
|
|
3465
|
+
.attributes,
|
|
3466
|
+
},
|
|
3467
|
+
],
|
|
3468
|
+
});
|
|
3469
|
+
this.trackLinkElement(linkEl);
|
|
3470
|
+
}
|
|
3471
|
+
trackLinkElement(linkEl) {
|
|
3472
|
+
if (this.trackedLinkElements.has(linkEl))
|
|
3473
|
+
return;
|
|
3474
|
+
this.trackedLinkElements.add(linkEl);
|
|
3475
|
+
this.trackStylesheetInLinkElement(linkEl);
|
|
3476
|
+
}
|
|
3477
|
+
adoptStyleSheets(sheets, hostId) {
|
|
3478
|
+
if (sheets.length === 0)
|
|
3479
|
+
return;
|
|
3480
|
+
const adoptedStyleSheetData = {
|
|
3481
|
+
id: hostId,
|
|
3482
|
+
styleIds: [],
|
|
3483
|
+
};
|
|
3484
|
+
const styles = [];
|
|
3485
|
+
for (const sheet of sheets) {
|
|
3486
|
+
let styleId;
|
|
3487
|
+
if (!this.styleMirror.has(sheet)) {
|
|
3488
|
+
styleId = this.styleMirror.add(sheet);
|
|
3489
|
+
const rules = Array.from(sheet.rules || CSSRule);
|
|
3490
|
+
styles.push({
|
|
3491
|
+
styleId,
|
|
3492
|
+
rules: rules.map((r, index) => {
|
|
3493
|
+
return {
|
|
3494
|
+
rule: getCssRuleString(r),
|
|
3495
|
+
index,
|
|
3496
|
+
};
|
|
3497
|
+
}),
|
|
3498
|
+
});
|
|
3499
|
+
}
|
|
3500
|
+
else
|
|
3501
|
+
styleId = this.styleMirror.getId(sheet);
|
|
3502
|
+
adoptedStyleSheetData.styleIds.push(styleId);
|
|
3503
|
+
}
|
|
3504
|
+
if (styles.length > 0)
|
|
3505
|
+
adoptedStyleSheetData.styles = styles;
|
|
3506
|
+
this.adoptedStyleSheetCb(adoptedStyleSheetData);
|
|
3507
|
+
}
|
|
3508
|
+
reset() {
|
|
3509
|
+
this.styleMirror.reset();
|
|
3510
|
+
this.trackedLinkElements = new WeakSet();
|
|
3511
|
+
}
|
|
3512
|
+
trackStylesheetInLinkElement(linkEl) {
|
|
3513
|
+
}
|
|
3514
|
+
}
|
|
3515
|
+
|
|
3516
|
+
function wrapEvent(e) {
|
|
3517
|
+
return Object.assign(Object.assign({}, e), { timestamp: Date.now() });
|
|
3518
|
+
}
|
|
3519
|
+
let wrappedEmit;
|
|
3520
|
+
let takeFullSnapshot;
|
|
3521
|
+
let canvasManager;
|
|
3522
|
+
let recording = false;
|
|
3523
|
+
const mirror = createMirror();
|
|
3524
|
+
function record(options = {}) {
|
|
3525
|
+
const { emit, checkoutEveryNms, checkoutEveryNth, blockClass = 'rr-block', blockSelector = null, ignoreClass = 'rr-ignore', maskTextClass = 'rr-mask', maskTextSelector = null, inlineStylesheet = true, maskAllInputs, maskInputOptions: _maskInputOptions, slimDOMOptions: _slimDOMOptions, maskInputFn, maskTextFn, hooks, packFn, sampling = {}, dataURLOptions = {}, mousemoveWait, recordCanvas = false, recordCrossOriginIframes = false, userTriggeredOnInput = false, collectFonts = false, inlineImages = false, plugins, keepIframeSrcFn = () => false, ignoreCSSAttributes = new Set([]), } = options;
|
|
3526
|
+
const inEmittingFrame = recordCrossOriginIframes
|
|
3527
|
+
? window.parent === window
|
|
3528
|
+
: true;
|
|
3529
|
+
let passEmitsToParent = false;
|
|
3530
|
+
if (!inEmittingFrame) {
|
|
3531
|
+
try {
|
|
3532
|
+
window.parent.document;
|
|
3533
|
+
passEmitsToParent = false;
|
|
3534
|
+
}
|
|
3535
|
+
catch (e) {
|
|
3536
|
+
passEmitsToParent = true;
|
|
3537
|
+
}
|
|
3538
|
+
}
|
|
3539
|
+
if (inEmittingFrame && !emit) {
|
|
3540
|
+
throw new Error('emit function is required');
|
|
3541
|
+
}
|
|
3542
|
+
if (mousemoveWait !== undefined && sampling.mousemove === undefined) {
|
|
3543
|
+
sampling.mousemove = mousemoveWait;
|
|
3544
|
+
}
|
|
3545
|
+
mirror.reset();
|
|
3546
|
+
const maskInputOptions = maskAllInputs === true
|
|
3547
|
+
? {
|
|
3548
|
+
color: true,
|
|
3549
|
+
date: true,
|
|
3550
|
+
'datetime-local': true,
|
|
3551
|
+
email: true,
|
|
3552
|
+
month: true,
|
|
3553
|
+
number: true,
|
|
3554
|
+
range: true,
|
|
3555
|
+
search: true,
|
|
3556
|
+
tel: true,
|
|
3557
|
+
text: true,
|
|
3558
|
+
time: true,
|
|
3559
|
+
url: true,
|
|
3560
|
+
week: true,
|
|
3561
|
+
textarea: true,
|
|
3562
|
+
select: true,
|
|
3563
|
+
password: true,
|
|
3564
|
+
}
|
|
3565
|
+
: _maskInputOptions !== undefined
|
|
3566
|
+
? _maskInputOptions
|
|
3567
|
+
: { password: true };
|
|
3568
|
+
const slimDOMOptions = _slimDOMOptions === true || _slimDOMOptions === 'all'
|
|
3569
|
+
? {
|
|
3570
|
+
script: true,
|
|
3571
|
+
comment: true,
|
|
3572
|
+
headFavicon: true,
|
|
3573
|
+
headWhitespace: true,
|
|
3574
|
+
headMetaSocial: true,
|
|
3575
|
+
headMetaRobots: true,
|
|
3576
|
+
headMetaHttpEquiv: true,
|
|
3577
|
+
headMetaVerification: true,
|
|
3578
|
+
headMetaAuthorship: _slimDOMOptions === 'all',
|
|
3579
|
+
headMetaDescKeywords: _slimDOMOptions === 'all',
|
|
3580
|
+
}
|
|
3581
|
+
: _slimDOMOptions
|
|
3582
|
+
? _slimDOMOptions
|
|
3583
|
+
: {};
|
|
3584
|
+
polyfill();
|
|
3585
|
+
let lastFullSnapshotEvent;
|
|
3586
|
+
let incrementalSnapshotCount = 0;
|
|
3587
|
+
const eventProcessor = (e) => {
|
|
3588
|
+
for (const plugin of plugins || []) {
|
|
3589
|
+
if (plugin.eventProcessor) {
|
|
3590
|
+
e = plugin.eventProcessor(e);
|
|
3591
|
+
}
|
|
3592
|
+
}
|
|
3593
|
+
if (packFn) {
|
|
3594
|
+
e = packFn(e);
|
|
3595
|
+
}
|
|
3596
|
+
return e;
|
|
3597
|
+
};
|
|
3598
|
+
wrappedEmit = (e, isCheckout) => {
|
|
3599
|
+
var _a;
|
|
3600
|
+
if (((_a = mutationBuffers[0]) === null || _a === void 0 ? void 0 : _a.isFrozen()) &&
|
|
3601
|
+
e.type !== EventType.FullSnapshot &&
|
|
3602
|
+
!(e.type === EventType.IncrementalSnapshot &&
|
|
3603
|
+
e.data.source === IncrementalSource.Mutation)) {
|
|
3604
|
+
mutationBuffers.forEach((buf) => buf.unfreeze());
|
|
3605
|
+
}
|
|
3606
|
+
if (inEmittingFrame) {
|
|
3607
|
+
emit === null || emit === void 0 ? void 0 : emit(eventProcessor(e), isCheckout);
|
|
3608
|
+
}
|
|
3609
|
+
else if (passEmitsToParent) {
|
|
3610
|
+
const message = {
|
|
3611
|
+
type: 'rrweb',
|
|
3612
|
+
event: eventProcessor(e),
|
|
3613
|
+
isCheckout,
|
|
3614
|
+
};
|
|
3615
|
+
window.parent.postMessage(message, '*');
|
|
3616
|
+
}
|
|
3617
|
+
if (e.type === EventType.FullSnapshot) {
|
|
3618
|
+
lastFullSnapshotEvent = e;
|
|
3619
|
+
incrementalSnapshotCount = 0;
|
|
3620
|
+
}
|
|
3621
|
+
else if (e.type === EventType.IncrementalSnapshot) {
|
|
3622
|
+
if (e.data.source === IncrementalSource.Mutation &&
|
|
3623
|
+
e.data.isAttachIframe) {
|
|
3624
|
+
return;
|
|
3625
|
+
}
|
|
3626
|
+
incrementalSnapshotCount++;
|
|
3627
|
+
const exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;
|
|
3628
|
+
const exceedTime = checkoutEveryNms &&
|
|
3629
|
+
e.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;
|
|
3630
|
+
if (exceedCount || exceedTime) {
|
|
3631
|
+
takeFullSnapshot(true);
|
|
3632
|
+
}
|
|
3633
|
+
}
|
|
3634
|
+
};
|
|
3635
|
+
const wrappedMutationEmit = (m) => {
|
|
3636
|
+
wrappedEmit(wrapEvent({
|
|
3637
|
+
type: EventType.IncrementalSnapshot,
|
|
3638
|
+
data: Object.assign({ source: IncrementalSource.Mutation }, m),
|
|
3639
|
+
}));
|
|
3640
|
+
};
|
|
3641
|
+
const wrappedScrollEmit = (p) => wrappedEmit(wrapEvent({
|
|
3642
|
+
type: EventType.IncrementalSnapshot,
|
|
3643
|
+
data: Object.assign({ source: IncrementalSource.Scroll }, p),
|
|
3644
|
+
}));
|
|
3645
|
+
const wrappedCanvasMutationEmit = (p) => wrappedEmit(wrapEvent({
|
|
3646
|
+
type: EventType.IncrementalSnapshot,
|
|
3647
|
+
data: Object.assign({ source: IncrementalSource.CanvasMutation }, p),
|
|
3648
|
+
}));
|
|
3649
|
+
const wrappedAdoptedStyleSheetEmit = (a) => wrappedEmit(wrapEvent({
|
|
3650
|
+
type: EventType.IncrementalSnapshot,
|
|
3651
|
+
data: Object.assign({ source: IncrementalSource.AdoptedStyleSheet }, a),
|
|
3652
|
+
}));
|
|
3653
|
+
const stylesheetManager = new StylesheetManager({
|
|
3654
|
+
mutationCb: wrappedMutationEmit,
|
|
3655
|
+
adoptedStyleSheetCb: wrappedAdoptedStyleSheetEmit,
|
|
3656
|
+
});
|
|
3657
|
+
const iframeManager = new IframeManager({
|
|
3658
|
+
mirror,
|
|
3659
|
+
mutationCb: wrappedMutationEmit,
|
|
3660
|
+
stylesheetManager: stylesheetManager,
|
|
3661
|
+
recordCrossOriginIframes,
|
|
3662
|
+
wrappedEmit,
|
|
3663
|
+
});
|
|
3664
|
+
for (const plugin of plugins || []) {
|
|
3665
|
+
if (plugin.getMirror)
|
|
3666
|
+
plugin.getMirror({
|
|
3667
|
+
nodeMirror: mirror,
|
|
3668
|
+
crossOriginIframeMirror: iframeManager.crossOriginIframeMirror,
|
|
3669
|
+
crossOriginIframeStyleMirror: iframeManager.crossOriginIframeStyleMirror,
|
|
3670
|
+
});
|
|
3671
|
+
}
|
|
3672
|
+
canvasManager = new CanvasManager({
|
|
3673
|
+
recordCanvas,
|
|
3674
|
+
mutationCb: wrappedCanvasMutationEmit,
|
|
3675
|
+
win: window,
|
|
3676
|
+
blockClass,
|
|
3677
|
+
blockSelector,
|
|
3678
|
+
mirror,
|
|
3679
|
+
sampling: sampling.canvas,
|
|
3680
|
+
dataURLOptions,
|
|
3681
|
+
});
|
|
3682
|
+
const shadowDomManager = new ShadowDomManager({
|
|
3683
|
+
mutationCb: wrappedMutationEmit,
|
|
3684
|
+
scrollCb: wrappedScrollEmit,
|
|
3685
|
+
bypassOptions: {
|
|
3686
|
+
blockClass,
|
|
3687
|
+
blockSelector,
|
|
3688
|
+
maskTextClass,
|
|
3689
|
+
maskTextSelector,
|
|
3690
|
+
inlineStylesheet,
|
|
3691
|
+
maskInputOptions,
|
|
3692
|
+
dataURLOptions,
|
|
3693
|
+
maskTextFn,
|
|
3694
|
+
maskInputFn,
|
|
3695
|
+
recordCanvas,
|
|
3696
|
+
inlineImages,
|
|
3697
|
+
sampling,
|
|
3698
|
+
slimDOMOptions,
|
|
3699
|
+
iframeManager,
|
|
3700
|
+
stylesheetManager,
|
|
3701
|
+
canvasManager,
|
|
3702
|
+
keepIframeSrcFn,
|
|
3703
|
+
},
|
|
3704
|
+
mirror,
|
|
3705
|
+
});
|
|
3706
|
+
takeFullSnapshot = (isCheckout = false) => {
|
|
3707
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3708
|
+
wrappedEmit(wrapEvent({
|
|
3709
|
+
type: EventType.Meta,
|
|
3710
|
+
data: {
|
|
3711
|
+
href: window.location.href,
|
|
3712
|
+
width: getWindowWidth(),
|
|
3713
|
+
height: getWindowHeight(),
|
|
3714
|
+
},
|
|
3715
|
+
}), isCheckout);
|
|
3716
|
+
stylesheetManager.reset();
|
|
3717
|
+
mutationBuffers.forEach((buf) => buf.lock());
|
|
3718
|
+
const node = snapshot(document, {
|
|
3719
|
+
mirror,
|
|
3720
|
+
blockClass,
|
|
3721
|
+
blockSelector,
|
|
3722
|
+
maskTextClass,
|
|
3723
|
+
maskTextSelector,
|
|
3724
|
+
inlineStylesheet,
|
|
3725
|
+
maskAllInputs: maskInputOptions,
|
|
3726
|
+
maskTextFn,
|
|
3727
|
+
slimDOM: slimDOMOptions,
|
|
3728
|
+
dataURLOptions,
|
|
3729
|
+
recordCanvas,
|
|
3730
|
+
inlineImages,
|
|
3731
|
+
onSerialize: (n) => {
|
|
3732
|
+
if (isSerializedIframe(n, mirror)) {
|
|
3733
|
+
iframeManager.addIframe(n);
|
|
3734
|
+
}
|
|
3735
|
+
if (isSerializedStylesheet(n, mirror)) {
|
|
3736
|
+
stylesheetManager.trackLinkElement(n);
|
|
3737
|
+
}
|
|
3738
|
+
if (hasShadowRoot(n)) {
|
|
3739
|
+
shadowDomManager.addShadowRoot(n.shadowRoot, document);
|
|
3740
|
+
}
|
|
3741
|
+
},
|
|
3742
|
+
onIframeLoad: (iframe, childSn) => {
|
|
3743
|
+
iframeManager.attachIframe(iframe, childSn);
|
|
3744
|
+
shadowDomManager.observeAttachShadow(iframe);
|
|
3745
|
+
},
|
|
3746
|
+
onStylesheetLoad: (linkEl, childSn) => {
|
|
3747
|
+
stylesheetManager.attachLinkElement(linkEl, childSn);
|
|
3748
|
+
},
|
|
3749
|
+
keepIframeSrcFn,
|
|
3750
|
+
});
|
|
3751
|
+
if (!node) {
|
|
3752
|
+
return console.warn('Failed to snapshot the document');
|
|
3753
|
+
}
|
|
3754
|
+
wrappedEmit(wrapEvent({
|
|
3755
|
+
type: EventType.FullSnapshot,
|
|
3756
|
+
data: {
|
|
3757
|
+
node,
|
|
3758
|
+
initialOffset: {
|
|
3759
|
+
left: window.pageXOffset !== undefined
|
|
3760
|
+
? window.pageXOffset
|
|
3761
|
+
: (document === null || document === void 0 ? void 0 : document.documentElement.scrollLeft) ||
|
|
3762
|
+
((_b = (_a = document === null || document === void 0 ? void 0 : document.body) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.scrollLeft) ||
|
|
3763
|
+
((_c = document === null || document === void 0 ? void 0 : document.body) === null || _c === void 0 ? void 0 : _c.scrollLeft) ||
|
|
3764
|
+
0,
|
|
3765
|
+
top: window.pageYOffset !== undefined
|
|
3766
|
+
? window.pageYOffset
|
|
3767
|
+
: (document === null || document === void 0 ? void 0 : document.documentElement.scrollTop) ||
|
|
3768
|
+
((_e = (_d = document === null || document === void 0 ? void 0 : document.body) === null || _d === void 0 ? void 0 : _d.parentElement) === null || _e === void 0 ? void 0 : _e.scrollTop) ||
|
|
3769
|
+
((_f = document === null || document === void 0 ? void 0 : document.body) === null || _f === void 0 ? void 0 : _f.scrollTop) ||
|
|
3770
|
+
0,
|
|
3771
|
+
},
|
|
3772
|
+
},
|
|
3773
|
+
}));
|
|
3774
|
+
mutationBuffers.forEach((buf) => buf.unlock());
|
|
3775
|
+
if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
|
|
3776
|
+
stylesheetManager.adoptStyleSheets(document.adoptedStyleSheets, mirror.getId(document));
|
|
3777
|
+
};
|
|
3778
|
+
try {
|
|
3779
|
+
const handlers = [];
|
|
3780
|
+
handlers.push(on('DOMContentLoaded', () => {
|
|
3781
|
+
wrappedEmit(wrapEvent({
|
|
3782
|
+
type: EventType.DomContentLoaded,
|
|
3783
|
+
data: {},
|
|
3784
|
+
}));
|
|
3785
|
+
}));
|
|
3786
|
+
const observe = (doc) => {
|
|
3787
|
+
var _a;
|
|
3788
|
+
return initObservers({
|
|
3789
|
+
mutationCb: wrappedMutationEmit,
|
|
3790
|
+
mousemoveCb: (positions, source) => wrappedEmit(wrapEvent({
|
|
3791
|
+
type: EventType.IncrementalSnapshot,
|
|
3792
|
+
data: {
|
|
3793
|
+
source,
|
|
3794
|
+
positions,
|
|
3795
|
+
},
|
|
3796
|
+
})),
|
|
3797
|
+
mouseInteractionCb: (d) => wrappedEmit(wrapEvent({
|
|
3798
|
+
type: EventType.IncrementalSnapshot,
|
|
3799
|
+
data: Object.assign({ source: IncrementalSource.MouseInteraction }, d),
|
|
3800
|
+
})),
|
|
3801
|
+
scrollCb: wrappedScrollEmit,
|
|
3802
|
+
viewportResizeCb: (d) => wrappedEmit(wrapEvent({
|
|
3803
|
+
type: EventType.IncrementalSnapshot,
|
|
3804
|
+
data: Object.assign({ source: IncrementalSource.ViewportResize }, d),
|
|
3805
|
+
})),
|
|
3806
|
+
inputCb: (v) => wrappedEmit(wrapEvent({
|
|
3807
|
+
type: EventType.IncrementalSnapshot,
|
|
3808
|
+
data: Object.assign({ source: IncrementalSource.Input }, v),
|
|
3809
|
+
})),
|
|
3810
|
+
mediaInteractionCb: (p) => wrappedEmit(wrapEvent({
|
|
3811
|
+
type: EventType.IncrementalSnapshot,
|
|
3812
|
+
data: Object.assign({ source: IncrementalSource.MediaInteraction }, p),
|
|
3813
|
+
})),
|
|
3814
|
+
styleSheetRuleCb: (r) => wrappedEmit(wrapEvent({
|
|
3815
|
+
type: EventType.IncrementalSnapshot,
|
|
3816
|
+
data: Object.assign({ source: IncrementalSource.StyleSheetRule }, r),
|
|
3817
|
+
})),
|
|
3818
|
+
styleDeclarationCb: (r) => wrappedEmit(wrapEvent({
|
|
3819
|
+
type: EventType.IncrementalSnapshot,
|
|
3820
|
+
data: Object.assign({ source: IncrementalSource.StyleDeclaration }, r),
|
|
3821
|
+
})),
|
|
3822
|
+
canvasMutationCb: wrappedCanvasMutationEmit,
|
|
3823
|
+
fontCb: (p) => wrappedEmit(wrapEvent({
|
|
3824
|
+
type: EventType.IncrementalSnapshot,
|
|
3825
|
+
data: Object.assign({ source: IncrementalSource.Font }, p),
|
|
3826
|
+
})),
|
|
3827
|
+
selectionCb: (p) => {
|
|
3828
|
+
wrappedEmit(wrapEvent({
|
|
3829
|
+
type: EventType.IncrementalSnapshot,
|
|
3830
|
+
data: Object.assign({ source: IncrementalSource.Selection }, p),
|
|
3831
|
+
}));
|
|
3832
|
+
},
|
|
3833
|
+
blockClass,
|
|
3834
|
+
ignoreClass,
|
|
3835
|
+
maskTextClass,
|
|
3836
|
+
maskTextSelector,
|
|
3837
|
+
maskInputOptions,
|
|
3838
|
+
inlineStylesheet,
|
|
3839
|
+
sampling,
|
|
3840
|
+
recordCanvas,
|
|
3841
|
+
inlineImages,
|
|
3842
|
+
userTriggeredOnInput,
|
|
3843
|
+
collectFonts,
|
|
3844
|
+
doc,
|
|
3845
|
+
maskInputFn,
|
|
3846
|
+
maskTextFn,
|
|
3847
|
+
keepIframeSrcFn,
|
|
3848
|
+
blockSelector,
|
|
3849
|
+
slimDOMOptions,
|
|
3850
|
+
dataURLOptions,
|
|
3851
|
+
mirror,
|
|
3852
|
+
iframeManager,
|
|
3853
|
+
stylesheetManager,
|
|
3854
|
+
shadowDomManager,
|
|
3855
|
+
canvasManager,
|
|
3856
|
+
ignoreCSSAttributes,
|
|
3857
|
+
plugins: ((_a = plugins === null || plugins === void 0 ? void 0 : plugins.filter((p) => p.observer)) === null || _a === void 0 ? void 0 : _a.map((p) => ({
|
|
3858
|
+
observer: p.observer,
|
|
3859
|
+
options: p.options,
|
|
3860
|
+
callback: (payload) => wrappedEmit(wrapEvent({
|
|
3861
|
+
type: EventType.Plugin,
|
|
3862
|
+
data: {
|
|
3863
|
+
plugin: p.name,
|
|
3864
|
+
payload,
|
|
3865
|
+
},
|
|
3866
|
+
})),
|
|
3867
|
+
}))) || [],
|
|
3868
|
+
}, hooks);
|
|
3869
|
+
};
|
|
3870
|
+
iframeManager.addLoadListener((iframeEl) => {
|
|
3871
|
+
handlers.push(observe(iframeEl.contentDocument));
|
|
3872
|
+
});
|
|
3873
|
+
const init = () => {
|
|
3874
|
+
takeFullSnapshot();
|
|
3875
|
+
handlers.push(observe(document));
|
|
3876
|
+
recording = true;
|
|
3877
|
+
};
|
|
3878
|
+
if (document.readyState === 'interactive' ||
|
|
3879
|
+
document.readyState === 'complete') {
|
|
3880
|
+
init();
|
|
3881
|
+
}
|
|
3882
|
+
else {
|
|
3883
|
+
handlers.push(on('load', () => {
|
|
3884
|
+
wrappedEmit(wrapEvent({
|
|
3885
|
+
type: EventType.Load,
|
|
3886
|
+
data: {},
|
|
3887
|
+
}));
|
|
3888
|
+
init();
|
|
3889
|
+
}, window));
|
|
3890
|
+
}
|
|
3891
|
+
return () => {
|
|
3892
|
+
handlers.forEach((h) => h());
|
|
3893
|
+
recording = false;
|
|
3894
|
+
};
|
|
3895
|
+
}
|
|
3896
|
+
catch (error) {
|
|
3897
|
+
console.warn(error);
|
|
3898
|
+
}
|
|
3899
|
+
}
|
|
3900
|
+
record.addCustomEvent = (tag, payload) => {
|
|
3901
|
+
if (!recording) {
|
|
3902
|
+
throw new Error('please add custom event after start recording');
|
|
3903
|
+
}
|
|
3904
|
+
wrappedEmit(wrapEvent({
|
|
3905
|
+
type: EventType.Custom,
|
|
3906
|
+
data: {
|
|
3907
|
+
tag,
|
|
3908
|
+
payload,
|
|
3909
|
+
},
|
|
3910
|
+
}));
|
|
3911
|
+
};
|
|
3912
|
+
record.freezePage = () => {
|
|
3913
|
+
mutationBuffers.forEach((buf) => buf.freeze());
|
|
3914
|
+
};
|
|
3915
|
+
record.takeFullSnapshot = (isCheckout) => {
|
|
3916
|
+
if (!recording) {
|
|
3917
|
+
throw new Error('please take full snapshot after start recording');
|
|
3918
|
+
}
|
|
3919
|
+
takeFullSnapshot(isCheckout);
|
|
3920
|
+
};
|
|
3921
|
+
record.mirror = mirror;
|
|
3922
|
+
|
|
3923
|
+
const CoreOutline = ({
|
|
3924
|
+
children
|
|
3925
|
+
}) => {
|
|
3926
|
+
const [events, setEvents] = useState([]);
|
|
3927
|
+
const recorderActive = useRef(false);
|
|
3928
|
+
const [currentPage, setCurrentPage] = useState(window.location.href);
|
|
3929
|
+
useEffect(() => {
|
|
3930
|
+
console.log(currentPage);
|
|
3931
|
+
const handleNavigation = () => {
|
|
3932
|
+
setCurrentPage(window.location.href);
|
|
3933
|
+
saveEvents(events);
|
|
3934
|
+
};
|
|
3935
|
+
window.addEventListener('popstate', handleNavigation);
|
|
3936
|
+
const originalPushState = window.history.pushState;
|
|
3937
|
+
window.history.pushState = function (...args) {
|
|
3938
|
+
originalPushState.apply(this, args);
|
|
3939
|
+
handleNavigation();
|
|
3940
|
+
};
|
|
3941
|
+
return () => {
|
|
3942
|
+
window.removeEventListener('popstate', handleNavigation);
|
|
3943
|
+
window.history.pushState = originalPushState;
|
|
3944
|
+
};
|
|
3945
|
+
}, [currentPage]);
|
|
3946
|
+
useEffect(() => {
|
|
3947
|
+
let stopFn;
|
|
3948
|
+
if (!recorderActive.current) {
|
|
3949
|
+
stopFn = record({
|
|
3950
|
+
emit(event) {
|
|
3951
|
+
setEvents(prevEvents => [...prevEvents, event]);
|
|
3952
|
+
}
|
|
3953
|
+
});
|
|
3954
|
+
recorderActive.current = true;
|
|
3955
|
+
}
|
|
3956
|
+
return () => {
|
|
3957
|
+
if (stopFn) {
|
|
3958
|
+
stopFn();
|
|
3959
|
+
recorderActive.current = false;
|
|
3960
|
+
}
|
|
3961
|
+
};
|
|
3962
|
+
}, []);
|
|
3963
|
+
function saveEvents(events) {
|
|
3964
|
+
const requestOptions = {
|
|
3965
|
+
method: 'PUT',
|
|
3966
|
+
headers: {
|
|
3967
|
+
'Content-Type': 'application/json'
|
|
3968
|
+
},
|
|
3969
|
+
body: events
|
|
3970
|
+
};
|
|
3971
|
+
fetch('http://localhost:8000/generate-s3-url').then(response => response.json()).then(data => {
|
|
3972
|
+
const uploadURL = data.signed_url;
|
|
3973
|
+
return fetch(uploadURL, requestOptions);
|
|
3974
|
+
});
|
|
3975
|
+
}
|
|
3976
|
+
return /*#__PURE__*/React.createElement("div", null, children);
|
|
3977
|
+
};
|
|
3978
|
+
|
|
3979
|
+
export { CoreOutline as default };
|