@sentry-internal/rrdom
Advanced tools
Comparing version 2.0.0-alpha10.1 to 2.0.0-beta11.0
@@ -5,3 +5,3 @@ import { Mirror as NodeMirror } from '@sentry-internal/rrweb-snapshot'; | ||
import type { Mirror } from '.'; | ||
export declare type ReplayerHandler = { | ||
export type ReplayerHandler = { | ||
mirror: NodeMirror; | ||
@@ -8,0 +8,0 @@ applyCanvas: (canvasEvent: canvasEventWithTime, canvasMutationData: canvasMutationData, target: HTMLCanvasElement) => void; |
@@ -76,3 +76,3 @@ import { NodeType as RRNodeType } from '@sentry-internal/rrweb-snapshot'; | ||
} | ||
declare type ConstrainedConstructor<T = Record<string, unknown>> = new (...args: any[]) => T; | ||
type ConstrainedConstructor<T = Record<string, unknown>> = new (...args: any[]) => T; | ||
export declare class BaseRRNode implements IRRNode { | ||
@@ -327,3 +327,3 @@ parentElement: IRRNode | null; | ||
} | ||
export declare type CSSStyleDeclaration = Record<string, string> & { | ||
export type CSSStyleDeclaration = Record<string, string> & { | ||
setProperty: (name: string, value: string | null, priority?: string | null) => void; | ||
@@ -330,0 +330,0 @@ removeProperty: (name: string) => string; |
@@ -301,3 +301,3 @@ import { NodeType as RRNodeType } from '@sentry-internal/rrweb-snapshot'; | ||
} & typeof RRNode; | ||
export declare type RRText = typeof RRText; | ||
export type RRText = typeof RRText; | ||
export declare const RRComment: { | ||
@@ -327,3 +327,3 @@ new (data: string): { | ||
} & typeof RRNode; | ||
export declare type RRComment = typeof RRComment; | ||
export type RRComment = typeof RRComment; | ||
export declare const RRCDATASection: { | ||
@@ -353,3 +353,3 @@ new (data: string): { | ||
} & typeof RRNode; | ||
export declare type RRCDATASection = typeof RRCDATASection; | ||
export type RRCDATASection = typeof RRCDATASection; | ||
interface RRElementTagNameMap { | ||
@@ -362,3 +362,3 @@ audio: RRMediaElement; | ||
} | ||
declare type RRElementType<K extends keyof HTMLElementTagNameMap> = K extends keyof RRElementTagNameMap ? RRElementTagNameMap[K] : RRElement; | ||
type RRElementType<K extends keyof HTMLElementTagNameMap> = K extends keyof RRElementTagNameMap ? RRElementTagNameMap[K] : RRElement; | ||
export declare function buildFromNode(node: Node, rrdom: IRRDocument, domMirror: NodeMirror, parentRRNode?: IRRNode | null): IRRNode | null; | ||
@@ -365,0 +365,0 @@ export declare function buildFromDom(dom: Document, domMirror?: NodeMirror, rrdom?: IRRDocument): IRRDocument; |
@@ -936,2 +936,5 @@ (function (exports) { | ||
class RRDocument extends BaseRRDocumentImpl(BaseRRNode) { | ||
get unserializedId() { | ||
return this._unserializedId--; | ||
} | ||
constructor(mirror) { | ||
@@ -947,5 +950,2 @@ super(); | ||
} | ||
get unserializedId() { | ||
return this._unserializedId--; | ||
} | ||
createDocument(_namespace, _qualifiedName, _doctype) { | ||
@@ -952,0 +952,0 @@ return new RRDocument(); |
@@ -1,2 +0,2 @@ | ||
!function(e){"use strict";var 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"}(t||(t={}));class n{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function o(e){const t=[];for(const n in e){const o=e[n];if("string"!=typeof o)continue;const r=l(n);t.push(`${r}: ${o};`)}return t.join(" ")}const r=/-([a-z])/g,s=/^--[a-zA-Z0-9-]+$/,i=e=>s.test(e)?e:e.replace(r,((e,t)=>t?t.toUpperCase():"")),a=/\B([A-Z])/g,l=e=>e.replace(a,"-$1").toLowerCase();class d{constructor(...t){this.parentElement=null,this.parentNode=null,this.firstChild=null,this.lastChild=null,this.previousSibling=null,this.nextSibling=null,this.ELEMENT_NODE=e.NodeType.ELEMENT_NODE,this.TEXT_NODE=e.NodeType.TEXT_NODE}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof d))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function c(n){return class o extends n{constructor(...n){super(n),this.nodeType=e.NodeType.DOCUMENT_NODE,this.nodeName="#document",this.compatMode="CSS1Compat",this.RRNodeType=t.Document,this.textContent=null,this.ownerDocument=this}get documentElement(){return this.childNodes.find((e=>e.RRNodeType===t.Element&&"HTML"===e.tagName))||null}get body(){var e;return(null===(e=this.documentElement)||void 0===e?void 0:e.childNodes.find((e=>e.RRNodeType===t.Element&&"BODY"===e.tagName)))||null}get head(){var e;return(null===(e=this.documentElement)||void 0===e?void 0:e.childNodes.find((e=>e.RRNodeType===t.Element&&"HEAD"===e.tagName)))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(e){const n=e.RRNodeType;if((n===t.Element||n===t.DocumentType)&&this.childNodes.some((e=>e.RRNodeType===n)))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${n===t.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const o=f(this,e);return o.parentElement=null,o}insertBefore(e,n){const o=e.RRNodeType;if((o===t.Element||o===t.DocumentType)&&this.childNodes.some((e=>e.RRNodeType===o)))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${o===t.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const r=R(this,e,n);return r.parentElement=null,r}removeChild(e){return D(this,e)}open(){this.firstChild=null,this.lastChild=null}close(){}write(e){let t;if('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'===e?t="-//W3C//DTD XHTML 1.0 Transitional//EN":'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'===e&&(t="-//W3C//DTD HTML 4.0 Transitional//EN"),t){const e=this.createDocumentType("html",t,"");this.open(),this.appendChild(e)}}createDocument(e,t,n){return new o}createDocumentType(e,t,n){const o=new(u(d))(e,t,n);return o.ownerDocument=this,o}createElement(e){const t=new(h(d))(e);return t.ownerDocument=this,t}createElementNS(e,t){return this.createElement(t)}createTextNode(e){const t=new(m(d))(e);return t.ownerDocument=this,t}createComment(e){const t=new(N(d))(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new(E(d))(e);return t.ownerDocument=this,t}toString(){return"RRDocument"}}}function u(n){return class extends n{constructor(n,o,r){super(),this.nodeType=e.NodeType.DOCUMENT_TYPE_NODE,this.RRNodeType=t.DocumentType,this.name=n,this.publicId=o,this.systemId=r,this.nodeName=n,this.textContent=null}toString(){return"RRDocumentType"}}}function h(n){return class extends n{constructor(n){super(),this.nodeType=e.NodeType.ELEMENT_NODE,this.RRNodeType=t.Element,this.attributes={},this.shadowRoot=null,this.tagName=n.toUpperCase(),this.nodeName=n.toUpperCase()}get textContent(){let e="";return this.childNodes.forEach((t=>e+=t.textContent)),e}set textContent(e){this.firstChild=null,this.lastChild=null,this.appendChild(this.ownerDocument.createTextNode(e))}get classList(){return new T(this.attributes.class,(e=>{this.attributes.class=e}))}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const e=this.attributes.style?function(e){const t={},n=/:(.+)/;return e.replace(/\/\*.*?\*\//g,"").split(/;(?![^(]*\))/g).forEach((function(e){if(e){const o=e.split(n);o.length>1&&(t[i(o[0].trim())]=o[1].trim())}})),t}(this.attributes.style):{},t=/\B([A-Z])/g;return e.setProperty=(n,r,s)=>{if(t.test(n))return;const a=i(n);r?e[a]=r:delete e[a],"important"===s&&(e[a]+=" !important"),this.attributes.style=o(e)},e.removeProperty=n=>{if(t.test(n))return"";const r=i(n),s=e[r]||"";return delete e[r],this.attributes.style=o(e),s},e}getAttribute(e){return this.attributes[e]||null}setAttribute(e,t){this.attributes[e]=t}setAttributeNS(e,t,n){this.setAttribute(t,n)}removeAttribute(e){delete this.attributes[e]}appendChild(e){return f(this,e)}insertBefore(e,t){return R(this,e,t)}removeChild(e){return D(this,e)}attachShadow(e){const t=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=t,t}dispatchEvent(e){return!0}toString(){let e="";for(const t in this.attributes)e+=`${t}="${this.attributes[t]}" `;return`${this.tagName} ${e}`}}}function p(e){return class extends e{attachShadow(e){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}}function m(n){return class extends n{constructor(n){super(),this.nodeType=e.NodeType.TEXT_NODE,this.nodeName="#text",this.RRNodeType=t.Text,this.data=n}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRText text=${JSON.stringify(this.data)}`}}}function N(n){return class extends n{constructor(n){super(),this.nodeType=e.NodeType.COMMENT_NODE,this.nodeName="#comment",this.RRNodeType=t.Comment,this.data=n}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}}function E(n){return class extends n{constructor(n){super(),this.nodeName="#cdata-section",this.nodeType=e.NodeType.CDATA_SECTION_NODE,this.RRNodeType=t.CDATA,this.data=n}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}}class T{constructor(e,t){if(this.classes=[],this.add=(...e)=>{for(const t of e){const e=String(t);this.classes.indexOf(e)>=0||this.classes.push(e)}this.onChange&&this.onChange(this.classes.join(" "))},this.remove=(...e)=>{this.classes=this.classes.filter((t=>-1===e.indexOf(t))),this.onChange&&this.onChange(this.classes.join(" "))},e){const t=e.trim().split(/\s+/);this.classes.push(...t)}this.onChange=t}}function f(e,t){return t.parentNode&&t.parentNode.removeChild(t),e.lastChild?(e.lastChild.nextSibling=t,t.previousSibling=e.lastChild):(e.firstChild=t,t.previousSibling=null),e.lastChild=t,t.nextSibling=null,t.parentNode=e,t.parentElement=e,t.ownerDocument=e.ownerDocument,t}function R(e,t,n){if(!n)return f(e,t);if(n.parentNode!==e)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return t===n||(t.parentNode&&t.parentNode.removeChild(t),t.previousSibling=n.previousSibling,n.previousSibling=t,t.nextSibling=n,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,t.parentElement=e,t.parentNode=e,t.ownerDocument=e.ownerDocument),t}function D(e,t){if(t.parentNode!==e)throw new Error("Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode.");return t.previousSibling?t.previousSibling.nextSibling=t.nextSibling:e.firstChild=t.nextSibling,t.nextSibling?t.nextSibling.previousSibling=t.previousSibling:e.lastChild=t.previousSibling,t.previousSibling=null,t.nextSibling=null,t.parentElement=null,t.parentNode=null,t}e.NodeType=void 0,function(e){e[e.PLACEHOLDER=0]="PLACEHOLDER",e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",e[e.ENTITY_NODE=6]="ENTITY_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"}(e.NodeType||(e.NodeType={}));const g={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},C={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};let y=null;function M(e,n,o,r=n.mirror||n.ownerDocument.mirror){e=function(e,n,o,r){var s;o.afterAppend&&!y&&(y=new WeakSet,setTimeout((()=>{y=null}),0));if(!O(e,n)){const t=b(n,o.mirror,r);null===(s=e.parentNode)||void 0===s||s.replaceChild(t,e),e=t}switch(n.RRNodeType){case t.Document:if(!S(e,n,o.mirror,r)){const t=r.getMeta(n);t&&(o.mirror.removeNodeFromMap(e),e.close(),e.open(),o.mirror.add(e,t),null==y||y.add(e))}break;case t.Element:{const t=e,s=n;switch(s.tagName){case"IFRAME":{const t=e.contentDocument;if(!t)break;M(t,n.contentDocument,o,r);break}}s.shadowRoot&&(t.shadowRoot||t.attachShadow({mode:"open"}),w(t.shadowRoot,s.shadowRoot,o,r));break}}return e}(e,n,o,r),w(e,n,o,r),function(e,n,o,r){var s;switch(n.RRNodeType){case t.Document:{const e=n.scrollData;e&&o.applyScroll(e,!0);break}case t.Element:{const t=e,s=n;switch(function(e,t,n){const o=e.attributes,r=t.attributes;for(const o in r){const s=r[o],i=n.getMeta(t);if((null==i?void 0:i.isSVG)&&g[o])e.setAttributeNS(g[o],o,s);else if("CANVAS"===t.tagName&&"rr_dataURL"===o){const t=document.createElement("img");t.src=s,t.onload=()=>{const n=e.getContext("2d");n&&n.drawImage(t,0,0,t.width,t.height)}}else{if("IFRAME"===t.tagName&&"srcdoc"===o)continue;e.setAttribute(o,s)}}for(const{name:t}of Array.from(o))t in r||e.removeAttribute(t);t.scrollLeft&&(e.scrollLeft=t.scrollLeft),t.scrollTop&&(e.scrollTop=t.scrollTop)}(t,s,r),s.scrollData&&o.applyScroll(s.scrollData,!0),s.inputData&&o.applyInput(s.inputData),s.tagName){case"AUDIO":case"VIDEO":{const t=e,n=s;void 0!==n.paused&&(n.paused?t.pause():t.play()),void 0!==n.muted&&(t.muted=n.muted),void 0!==n.volume&&(t.volume=n.volume),void 0!==n.currentTime&&(t.currentTime=n.currentTime),void 0!==n.playbackRate&&(t.playbackRate=n.playbackRate);break}case"CANVAS":{const r=n;if(null!==r.rr_dataURL){const e=document.createElement("img");e.onload=()=>{const n=t.getContext("2d");n&&n.drawImage(e,0,0,e.width,e.height)},e.src=r.rr_dataURL}r.canvasMutations.forEach((t=>o.applyCanvas(t.event,t.mutation,e)));break}case"STYLE":{const e=t.sheet;e&&n.rules.forEach((t=>o.applyStyleSheetMutation(t,e)));break}}break}case t.Text:case t.Comment:case t.CDATA:e.textContent!==n.data&&(e.textContent=n.data)}(null==y?void 0:y.has(e))&&(y.delete(e),null===(s=o.afterAppend)||void 0===s||s.call(o,e,o.mirror.getId(e)))}(e,n,o,r)}function w(e,t,n,o){const r=Array.from(e.childNodes),s=t.childNodes;if(0===r.length&&0===s.length)return;let i,a,l=0,d=r.length-1,c=0,u=s.length-1,h=r[l],p=r[d],m=s[c],N=s[u];for(;l<=d&&c<=u;)if(void 0===h)h=r[++l];else if(void 0===p)p=r[--d];else if(S(h,m,n.mirror,o))h=r[++l],m=s[++c];else if(S(p,N,n.mirror,o))p=r[--d],N=s[--u];else if(S(h,N,n.mirror,o)){try{e.insertBefore(h,p.nextSibling)}catch(e){console.warn(e)}h=r[++l],N=s[--u]}else if(S(p,m,n.mirror,o)){try{e.insertBefore(p,h)}catch(e){console.warn(e)}p=r[--d],m=s[++c]}else{if(!i){i={};for(let e=l;e<=d;e++){const t=r[e];t&&n.mirror.hasNode(t)&&(i[n.mirror.getId(t)]=e)}}a=i[o.getId(m)];const t=r[a];if(void 0!==a&&t&&S(t,m,n.mirror,o)){try{e.insertBefore(t,h)}catch(e){console.warn(e)}r[a]=void 0}else{const t=b(m,n.mirror,o);"#document"===e.nodeName&&h&&(t.nodeType===t.DOCUMENT_TYPE_NODE&&h.nodeType===h.DOCUMENT_TYPE_NODE||t.nodeType===t.ELEMENT_NODE&&h.nodeType===h.ELEMENT_NODE)&&(e.removeChild(h),n.mirror.removeNodeFromMap(h),h=r[++l]);try{e.insertBefore(t,h||null)}catch(e){console.warn(e)}}m=s[++c]}if(l>d){const t=s[u+1];let r=null;for(t&&(r=n.mirror.getNode(o.getId(t)));c<=u;++c){const t=b(s[c],n.mirror,o);try{e.insertBefore(t,r)}catch(e){console.warn(e)}}}else if(c>u)for(;l<=d;l++){const t=r[l];if(t&&t.parentNode===e)try{e.removeChild(t),n.mirror.removeNodeFromMap(t)}catch(e){console.warn(e)}}let E=e.firstChild,T=t.firstChild;for(;null!==E&&null!==T;)M(E,T,n,o),E=E.nextSibling,T=T.nextSibling}function b(e,n,o){const r=o.getId(e),s=o.getMeta(e);let i=null;if(r>-1&&(i=n.getNode(r)),null!==i&&O(i,e))return i;switch(e.RRNodeType){case t.Document:i=new Document;break;case t.DocumentType:i=document.implementation.createDocumentType(e.name,e.publicId,e.systemId);break;case t.Element:{let t=e.tagName.toLowerCase();t=C[t]||t,i=s&&"isSVG"in s&&(null==s?void 0:s.isSVG)?document.createElementNS(g.svg,t):document.createElement(e.tagName);break}case t.Text:i=document.createTextNode(e.data);break;case t.Comment:i=document.createComment(e.data);break;case t.CDATA:i=document.createCDATASection(e.data)}s&&n.add(i,Object.assign({},s));try{null==y||y.add(i)}catch(e){}return i}function O(e,t){return e.nodeType===t.nodeType&&(e.nodeType!==e.ELEMENT_NODE||e.tagName.toUpperCase()===t.tagName)}function S(e,t,n,o){const r=n.getId(e),s=o.getId(t);return-1!==r&&r===s&&O(e,t)}class x extends(c(d)){constructor(e){super(),this.UNSERIALIZED_STARTING_ID=-2,this._unserializedId=this.UNSERIALIZED_STARTING_ID,this.mirror=P(),this.scrollData=null,e&&(this.mirror=e)}get unserializedId(){return this._unserializedId--}createDocument(e,t,n){return new x}createDocumentType(e,t,n){const o=new v(e,t,n);return o.ownerDocument=this,o}createElement(e){const t=e.toUpperCase();let n;switch(t){case"AUDIO":case"VIDEO":n=new I(t);break;case"IFRAME":n=new F(t,this.mirror);break;case"CANVAS":n=new _(t);break;case"STYLE":n=new L(t);break;default:n=new A(t)}return n.ownerDocument=this,n}createComment(e){const t=new U(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new B(e);return t.ownerDocument=this,t}createTextNode(e){const t=new k(e);return t.ownerDocument=this,t}destroyTree(){this.firstChild=null,this.lastChild=null,this.mirror.reset()}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID}}const v=u(d);class A extends(h(d)){constructor(){super(...arguments),this.inputData=null,this.scrollData=null}}class I extends(p(A)){}class _ extends A{constructor(){super(...arguments),this.rr_dataURL=null,this.canvasMutations=[]}getContext(){return null}}class L extends A{constructor(){super(...arguments),this.rules=[]}}class F extends A{constructor(e,t){super(e),this.contentDocument=new x,this.contentDocument.mirror=t}}const k=m(d),U=N(d),B=E(d);function G(t,n,o,r){let s;switch(t.nodeType){case e.NodeType.DOCUMENT_NODE:r&&"IFRAME"===r.nodeName?s=r.contentDocument:(s=n,s.compatMode=t.compatMode);break;case e.NodeType.DOCUMENT_TYPE_NODE:{const e=t;s=n.createDocumentType(e.name,e.publicId,e.systemId);break}case e.NodeType.ELEMENT_NODE:{const e=t,o=(i=e)instanceof HTMLFormElement?"FORM":i.tagName.toUpperCase();s=n.createElement(o);const r=s;for(const{name:t,value:n}of Array.from(e.attributes))r.attributes[t]=n;e.scrollLeft&&(r.scrollLeft=e.scrollLeft),e.scrollTop&&(r.scrollTop=e.scrollTop);break}case e.NodeType.TEXT_NODE:s=n.createTextNode(t.textContent||"");break;case e.NodeType.CDATA_SECTION_NODE:s=n.createCDATASection(t.data);break;case e.NodeType.COMMENT_NODE:s=n.createComment(t.textContent||"");break;case e.NodeType.DOCUMENT_FRAGMENT_NODE:s=r.attachShadow({mode:"open"});break;default:return null}var i;let a=o.getMeta(t);return n instanceof x&&(a||(a=Y(s,n.unserializedId),o.add(t,a)),n.mirror.add(s,Object.assign({},a))),s}function P(){return new $}class ${constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Y(e,n){switch(e.RRNodeType){case t.Document:return{id:n,type:e.RRNodeType,childNodes:[]};case t.DocumentType:{const t=e;return{id:n,type:e.RRNodeType,name:t.name,publicId:t.publicId,systemId:t.systemId}}case t.Element:return{id:n,type:e.RRNodeType,tagName:e.tagName.toLowerCase(),attributes:{},childNodes:[]};case t.Text:case t.Comment:return{id:n,type:e.RRNodeType,textContent:e.textContent||""};case t.CDATA:return{id:n,type:e.RRNodeType,textContent:""}}}function H(e,n,o){let r=`${o}${n.getId(e)} ${e.toString()}\n`;if(e.RRNodeType===t.Element){const t=e;t.shadowRoot&&(r+=H(t.shadowRoot,n,o+" "))}for(const t of e.childNodes)r+=H(t,n,o+" ");return"IFRAME"===e.nodeName&&(r+=H(e.contentDocument,n,o+" ")),r}e.BaseRRCDATASectionImpl=E,e.BaseRRCommentImpl=N,e.BaseRRDocumentImpl=c,e.BaseRRDocumentTypeImpl=u,e.BaseRRElementImpl=h,e.BaseRRMediaElementImpl=p,e.BaseRRNode=d,e.BaseRRTextImpl=m,e.ClassList=T,e.Mirror=$,e.RRCDATASection=B,e.RRCanvasElement=_,e.RRComment=U,e.RRDocument=x,e.RRDocumentType=v,e.RRElement=A,e.RRIFrameElement=F,e.RRMediaElement=I,e.RRNode=d,e.RRStyleElement=L,e.RRText=k,e.buildFromDom=function(t,o=function(){return new n}(),r=new x){return function t(n,s){const i=G(n,r,o,s);if(null!==i)if("IFRAME"!==(null==s?void 0:s.nodeName)&&n.nodeType!==e.NodeType.DOCUMENT_FRAGMENT_NODE&&(null==s||s.appendChild(i),i.parentNode=s,i.parentElement=s),"IFRAME"===n.nodeName){const e=n.contentDocument;e&&t(e,i)}else n.nodeType!==e.NodeType.DOCUMENT_NODE&&n.nodeType!==e.NodeType.ELEMENT_NODE&&n.nodeType!==e.NodeType.DOCUMENT_FRAGMENT_NODE||(n.nodeType===e.NodeType.ELEMENT_NODE&&n.shadowRoot&&t(n.shadowRoot,i),n.childNodes.forEach((e=>t(e,i))))}(t,null),r},e.buildFromNode=G,e.createMirror=P,e.createOrGetNode=b,e.diff=M,e.getDefaultSN=Y,e.printRRDom=function(e,t){return H(e,t,"")},Object.defineProperty(e,"__esModule",{value:!0})}(this["@sentry-internal/rrdom"]=this["@sentry-internal/rrdom"]||{}); | ||
!function(e){"use strict";var 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"}(t||(t={}));class n{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function o(e){const t=[];for(const n in e){const o=e[n];if("string"!=typeof o)continue;const r=l(n);t.push(`${r}: ${o};`)}return t.join(" ")}const r=/-([a-z])/g,s=/^--[a-zA-Z0-9-]+$/,i=e=>s.test(e)?e:e.replace(r,((e,t)=>t?t.toUpperCase():"")),a=/\B([A-Z])/g,l=e=>e.replace(a,"-$1").toLowerCase();class d{constructor(...t){this.parentElement=null,this.parentNode=null,this.firstChild=null,this.lastChild=null,this.previousSibling=null,this.nextSibling=null,this.ELEMENT_NODE=e.NodeType.ELEMENT_NODE,this.TEXT_NODE=e.NodeType.TEXT_NODE}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof d))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function c(n){return class o extends n{constructor(...n){super(n),this.nodeType=e.NodeType.DOCUMENT_NODE,this.nodeName="#document",this.compatMode="CSS1Compat",this.RRNodeType=t.Document,this.textContent=null,this.ownerDocument=this}get documentElement(){return this.childNodes.find((e=>e.RRNodeType===t.Element&&"HTML"===e.tagName))||null}get body(){var e;return(null===(e=this.documentElement)||void 0===e?void 0:e.childNodes.find((e=>e.RRNodeType===t.Element&&"BODY"===e.tagName)))||null}get head(){var e;return(null===(e=this.documentElement)||void 0===e?void 0:e.childNodes.find((e=>e.RRNodeType===t.Element&&"HEAD"===e.tagName)))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(e){const n=e.RRNodeType;if((n===t.Element||n===t.DocumentType)&&this.childNodes.some((e=>e.RRNodeType===n)))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${n===t.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const o=f(this,e);return o.parentElement=null,o}insertBefore(e,n){const o=e.RRNodeType;if((o===t.Element||o===t.DocumentType)&&this.childNodes.some((e=>e.RRNodeType===o)))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${o===t.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const r=R(this,e,n);return r.parentElement=null,r}removeChild(e){return D(this,e)}open(){this.firstChild=null,this.lastChild=null}close(){}write(e){let t;if('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'===e?t="-//W3C//DTD XHTML 1.0 Transitional//EN":'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'===e&&(t="-//W3C//DTD HTML 4.0 Transitional//EN"),t){const e=this.createDocumentType("html",t,"");this.open(),this.appendChild(e)}}createDocument(e,t,n){return new o}createDocumentType(e,t,n){const o=new(u(d))(e,t,n);return o.ownerDocument=this,o}createElement(e){const t=new(h(d))(e);return t.ownerDocument=this,t}createElementNS(e,t){return this.createElement(t)}createTextNode(e){const t=new(m(d))(e);return t.ownerDocument=this,t}createComment(e){const t=new(N(d))(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new(E(d))(e);return t.ownerDocument=this,t}toString(){return"RRDocument"}}}function u(n){return class extends n{constructor(n,o,r){super(),this.nodeType=e.NodeType.DOCUMENT_TYPE_NODE,this.RRNodeType=t.DocumentType,this.name=n,this.publicId=o,this.systemId=r,this.nodeName=n,this.textContent=null}toString(){return"RRDocumentType"}}}function h(n){return class extends n{constructor(n){super(),this.nodeType=e.NodeType.ELEMENT_NODE,this.RRNodeType=t.Element,this.attributes={},this.shadowRoot=null,this.tagName=n.toUpperCase(),this.nodeName=n.toUpperCase()}get textContent(){let e="";return this.childNodes.forEach((t=>e+=t.textContent)),e}set textContent(e){this.firstChild=null,this.lastChild=null,this.appendChild(this.ownerDocument.createTextNode(e))}get classList(){return new T(this.attributes.class,(e=>{this.attributes.class=e}))}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const e=this.attributes.style?function(e){const t={},n=/:(.+)/;return e.replace(/\/\*.*?\*\//g,"").split(/;(?![^(]*\))/g).forEach((function(e){if(e){const o=e.split(n);o.length>1&&(t[i(o[0].trim())]=o[1].trim())}})),t}(this.attributes.style):{},t=/\B([A-Z])/g;return e.setProperty=(n,r,s)=>{if(t.test(n))return;const a=i(n);r?e[a]=r:delete e[a],"important"===s&&(e[a]+=" !important"),this.attributes.style=o(e)},e.removeProperty=n=>{if(t.test(n))return"";const r=i(n),s=e[r]||"";return delete e[r],this.attributes.style=o(e),s},e}getAttribute(e){return this.attributes[e]||null}setAttribute(e,t){this.attributes[e]=t}setAttributeNS(e,t,n){this.setAttribute(t,n)}removeAttribute(e){delete this.attributes[e]}appendChild(e){return f(this,e)}insertBefore(e,t){return R(this,e,t)}removeChild(e){return D(this,e)}attachShadow(e){const t=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=t,t}dispatchEvent(e){return!0}toString(){let e="";for(const t in this.attributes)e+=`${t}="${this.attributes[t]}" `;return`${this.tagName} ${e}`}}}function p(e){return class extends e{attachShadow(e){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}}function m(n){return class extends n{constructor(n){super(),this.nodeType=e.NodeType.TEXT_NODE,this.nodeName="#text",this.RRNodeType=t.Text,this.data=n}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRText text=${JSON.stringify(this.data)}`}}}function N(n){return class extends n{constructor(n){super(),this.nodeType=e.NodeType.COMMENT_NODE,this.nodeName="#comment",this.RRNodeType=t.Comment,this.data=n}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}}function E(n){return class extends n{constructor(n){super(),this.nodeName="#cdata-section",this.nodeType=e.NodeType.CDATA_SECTION_NODE,this.RRNodeType=t.CDATA,this.data=n}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}}class T{constructor(e,t){if(this.classes=[],this.add=(...e)=>{for(const t of e){const e=String(t);this.classes.indexOf(e)>=0||this.classes.push(e)}this.onChange&&this.onChange(this.classes.join(" "))},this.remove=(...e)=>{this.classes=this.classes.filter((t=>-1===e.indexOf(t))),this.onChange&&this.onChange(this.classes.join(" "))},e){const t=e.trim().split(/\s+/);this.classes.push(...t)}this.onChange=t}}function f(e,t){return t.parentNode&&t.parentNode.removeChild(t),e.lastChild?(e.lastChild.nextSibling=t,t.previousSibling=e.lastChild):(e.firstChild=t,t.previousSibling=null),e.lastChild=t,t.nextSibling=null,t.parentNode=e,t.parentElement=e,t.ownerDocument=e.ownerDocument,t}function R(e,t,n){if(!n)return f(e,t);if(n.parentNode!==e)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return t===n||(t.parentNode&&t.parentNode.removeChild(t),t.previousSibling=n.previousSibling,n.previousSibling=t,t.nextSibling=n,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,t.parentElement=e,t.parentNode=e,t.ownerDocument=e.ownerDocument),t}function D(e,t){if(t.parentNode!==e)throw new Error("Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode.");return t.previousSibling?t.previousSibling.nextSibling=t.nextSibling:e.firstChild=t.nextSibling,t.nextSibling?t.nextSibling.previousSibling=t.previousSibling:e.lastChild=t.previousSibling,t.previousSibling=null,t.nextSibling=null,t.parentElement=null,t.parentNode=null,t}e.NodeType=void 0,function(e){e[e.PLACEHOLDER=0]="PLACEHOLDER",e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",e[e.ENTITY_NODE=6]="ENTITY_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"}(e.NodeType||(e.NodeType={}));const g={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},C={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};let y=null;function M(e,n,o,r=n.mirror||n.ownerDocument.mirror){e=function(e,n,o,r){var s;o.afterAppend&&!y&&(y=new WeakSet,setTimeout((()=>{y=null}),0));if(!O(e,n)){const t=b(n,o.mirror,r);null===(s=e.parentNode)||void 0===s||s.replaceChild(t,e),e=t}switch(n.RRNodeType){case t.Document:if(!S(e,n,o.mirror,r)){const t=r.getMeta(n);t&&(o.mirror.removeNodeFromMap(e),e.close(),e.open(),o.mirror.add(e,t),null==y||y.add(e))}break;case t.Element:{const t=e,s=n;switch(s.tagName){case"IFRAME":{const t=e.contentDocument;if(!t)break;M(t,n.contentDocument,o,r);break}}s.shadowRoot&&(t.shadowRoot||t.attachShadow({mode:"open"}),w(t.shadowRoot,s.shadowRoot,o,r));break}}return e}(e,n,o,r),w(e,n,o,r),function(e,n,o,r){var s;switch(n.RRNodeType){case t.Document:{const e=n.scrollData;e&&o.applyScroll(e,!0);break}case t.Element:{const t=e,s=n;switch(function(e,t,n){const o=e.attributes,r=t.attributes;for(const o in r){const s=r[o],i=n.getMeta(t);if((null==i?void 0:i.isSVG)&&g[o])e.setAttributeNS(g[o],o,s);else if("CANVAS"===t.tagName&&"rr_dataURL"===o){const t=document.createElement("img");t.src=s,t.onload=()=>{const n=e.getContext("2d");n&&n.drawImage(t,0,0,t.width,t.height)}}else{if("IFRAME"===t.tagName&&"srcdoc"===o)continue;e.setAttribute(o,s)}}for(const{name:t}of Array.from(o))t in r||e.removeAttribute(t);t.scrollLeft&&(e.scrollLeft=t.scrollLeft),t.scrollTop&&(e.scrollTop=t.scrollTop)}(t,s,r),s.scrollData&&o.applyScroll(s.scrollData,!0),s.inputData&&o.applyInput(s.inputData),s.tagName){case"AUDIO":case"VIDEO":{const t=e,n=s;void 0!==n.paused&&(n.paused?t.pause():t.play()),void 0!==n.muted&&(t.muted=n.muted),void 0!==n.volume&&(t.volume=n.volume),void 0!==n.currentTime&&(t.currentTime=n.currentTime),void 0!==n.playbackRate&&(t.playbackRate=n.playbackRate);break}case"CANVAS":{const r=n;if(null!==r.rr_dataURL){const e=document.createElement("img");e.onload=()=>{const n=t.getContext("2d");n&&n.drawImage(e,0,0,e.width,e.height)},e.src=r.rr_dataURL}r.canvasMutations.forEach((t=>o.applyCanvas(t.event,t.mutation,e)));break}case"STYLE":{const e=t.sheet;e&&n.rules.forEach((t=>o.applyStyleSheetMutation(t,e)));break}}break}case t.Text:case t.Comment:case t.CDATA:e.textContent!==n.data&&(e.textContent=n.data)}(null==y?void 0:y.has(e))&&(y.delete(e),null===(s=o.afterAppend)||void 0===s||s.call(o,e,o.mirror.getId(e)))}(e,n,o,r)}function w(e,t,n,o){const r=Array.from(e.childNodes),s=t.childNodes;if(0===r.length&&0===s.length)return;let i,a,l=0,d=r.length-1,c=0,u=s.length-1,h=r[l],p=r[d],m=s[c],N=s[u];for(;l<=d&&c<=u;)if(void 0===h)h=r[++l];else if(void 0===p)p=r[--d];else if(S(h,m,n.mirror,o))h=r[++l],m=s[++c];else if(S(p,N,n.mirror,o))p=r[--d],N=s[--u];else if(S(h,N,n.mirror,o)){try{e.insertBefore(h,p.nextSibling)}catch(e){console.warn(e)}h=r[++l],N=s[--u]}else if(S(p,m,n.mirror,o)){try{e.insertBefore(p,h)}catch(e){console.warn(e)}p=r[--d],m=s[++c]}else{if(!i){i={};for(let e=l;e<=d;e++){const t=r[e];t&&n.mirror.hasNode(t)&&(i[n.mirror.getId(t)]=e)}}a=i[o.getId(m)];const t=r[a];if(void 0!==a&&t&&S(t,m,n.mirror,o)){try{e.insertBefore(t,h)}catch(e){console.warn(e)}r[a]=void 0}else{const t=b(m,n.mirror,o);"#document"===e.nodeName&&h&&(t.nodeType===t.DOCUMENT_TYPE_NODE&&h.nodeType===h.DOCUMENT_TYPE_NODE||t.nodeType===t.ELEMENT_NODE&&h.nodeType===h.ELEMENT_NODE)&&(e.removeChild(h),n.mirror.removeNodeFromMap(h),h=r[++l]);try{e.insertBefore(t,h||null)}catch(e){console.warn(e)}}m=s[++c]}if(l>d){const t=s[u+1];let r=null;for(t&&(r=n.mirror.getNode(o.getId(t)));c<=u;++c){const t=b(s[c],n.mirror,o);try{e.insertBefore(t,r)}catch(e){console.warn(e)}}}else if(c>u)for(;l<=d;l++){const t=r[l];if(t&&t.parentNode===e)try{e.removeChild(t),n.mirror.removeNodeFromMap(t)}catch(e){console.warn(e)}}let E=e.firstChild,T=t.firstChild;for(;null!==E&&null!==T;)M(E,T,n,o),E=E.nextSibling,T=T.nextSibling}function b(e,n,o){const r=o.getId(e),s=o.getMeta(e);let i=null;if(r>-1&&(i=n.getNode(r)),null!==i&&O(i,e))return i;switch(e.RRNodeType){case t.Document:i=new Document;break;case t.DocumentType:i=document.implementation.createDocumentType(e.name,e.publicId,e.systemId);break;case t.Element:{let t=e.tagName.toLowerCase();t=C[t]||t,i=s&&"isSVG"in s&&(null==s?void 0:s.isSVG)?document.createElementNS(g.svg,t):document.createElement(e.tagName);break}case t.Text:i=document.createTextNode(e.data);break;case t.Comment:i=document.createComment(e.data);break;case t.CDATA:i=document.createCDATASection(e.data)}s&&n.add(i,Object.assign({},s));try{null==y||y.add(i)}catch(e){}return i}function O(e,t){return e.nodeType===t.nodeType&&(e.nodeType!==e.ELEMENT_NODE||e.tagName.toUpperCase()===t.tagName)}function S(e,t,n,o){const r=n.getId(e),s=o.getId(t);return-1!==r&&r===s&&O(e,t)}class x extends(c(d)){get unserializedId(){return this._unserializedId--}constructor(e){super(),this.UNSERIALIZED_STARTING_ID=-2,this._unserializedId=this.UNSERIALIZED_STARTING_ID,this.mirror=P(),this.scrollData=null,e&&(this.mirror=e)}createDocument(e,t,n){return new x}createDocumentType(e,t,n){const o=new v(e,t,n);return o.ownerDocument=this,o}createElement(e){const t=e.toUpperCase();let n;switch(t){case"AUDIO":case"VIDEO":n=new I(t);break;case"IFRAME":n=new F(t,this.mirror);break;case"CANVAS":n=new _(t);break;case"STYLE":n=new L(t);break;default:n=new A(t)}return n.ownerDocument=this,n}createComment(e){const t=new U(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new B(e);return t.ownerDocument=this,t}createTextNode(e){const t=new k(e);return t.ownerDocument=this,t}destroyTree(){this.firstChild=null,this.lastChild=null,this.mirror.reset()}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID}}const v=u(d);class A extends(h(d)){constructor(){super(...arguments),this.inputData=null,this.scrollData=null}}class I extends(p(A)){}class _ extends A{constructor(){super(...arguments),this.rr_dataURL=null,this.canvasMutations=[]}getContext(){return null}}class L extends A{constructor(){super(...arguments),this.rules=[]}}class F extends A{constructor(e,t){super(e),this.contentDocument=new x,this.contentDocument.mirror=t}}const k=m(d),U=N(d),B=E(d);function G(t,n,o,r){let s;switch(t.nodeType){case e.NodeType.DOCUMENT_NODE:r&&"IFRAME"===r.nodeName?s=r.contentDocument:(s=n,s.compatMode=t.compatMode);break;case e.NodeType.DOCUMENT_TYPE_NODE:{const e=t;s=n.createDocumentType(e.name,e.publicId,e.systemId);break}case e.NodeType.ELEMENT_NODE:{const e=t,o=(i=e)instanceof HTMLFormElement?"FORM":i.tagName.toUpperCase();s=n.createElement(o);const r=s;for(const{name:t,value:n}of Array.from(e.attributes))r.attributes[t]=n;e.scrollLeft&&(r.scrollLeft=e.scrollLeft),e.scrollTop&&(r.scrollTop=e.scrollTop);break}case e.NodeType.TEXT_NODE:s=n.createTextNode(t.textContent||"");break;case e.NodeType.CDATA_SECTION_NODE:s=n.createCDATASection(t.data);break;case e.NodeType.COMMENT_NODE:s=n.createComment(t.textContent||"");break;case e.NodeType.DOCUMENT_FRAGMENT_NODE:s=r.attachShadow({mode:"open"});break;default:return null}var i;let a=o.getMeta(t);return n instanceof x&&(a||(a=Y(s,n.unserializedId),o.add(t,a)),n.mirror.add(s,Object.assign({},a))),s}function P(){return new $}class ${constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Y(e,n){switch(e.RRNodeType){case t.Document:return{id:n,type:e.RRNodeType,childNodes:[]};case t.DocumentType:{const t=e;return{id:n,type:e.RRNodeType,name:t.name,publicId:t.publicId,systemId:t.systemId}}case t.Element:return{id:n,type:e.RRNodeType,tagName:e.tagName.toLowerCase(),attributes:{},childNodes:[]};case t.Text:case t.Comment:return{id:n,type:e.RRNodeType,textContent:e.textContent||""};case t.CDATA:return{id:n,type:e.RRNodeType,textContent:""}}}function H(e,n,o){let r=`${o}${n.getId(e)} ${e.toString()}\n`;if(e.RRNodeType===t.Element){const t=e;t.shadowRoot&&(r+=H(t.shadowRoot,n,o+" "))}for(const t of e.childNodes)r+=H(t,n,o+" ");return"IFRAME"===e.nodeName&&(r+=H(e.contentDocument,n,o+" ")),r}e.BaseRRCDATASectionImpl=E,e.BaseRRCommentImpl=N,e.BaseRRDocumentImpl=c,e.BaseRRDocumentTypeImpl=u,e.BaseRRElementImpl=h,e.BaseRRMediaElementImpl=p,e.BaseRRNode=d,e.BaseRRTextImpl=m,e.ClassList=T,e.Mirror=$,e.RRCDATASection=B,e.RRCanvasElement=_,e.RRComment=U,e.RRDocument=x,e.RRDocumentType=v,e.RRElement=A,e.RRIFrameElement=F,e.RRMediaElement=I,e.RRNode=d,e.RRStyleElement=L,e.RRText=k,e.buildFromDom=function(t,o=function(){return new n}(),r=new x){return function t(n,s){const i=G(n,r,o,s);if(null!==i)if("IFRAME"!==(null==s?void 0:s.nodeName)&&n.nodeType!==e.NodeType.DOCUMENT_FRAGMENT_NODE&&(null==s||s.appendChild(i),i.parentNode=s,i.parentElement=s),"IFRAME"===n.nodeName){const e=n.contentDocument;e&&t(e,i)}else n.nodeType!==e.NodeType.DOCUMENT_NODE&&n.nodeType!==e.NodeType.ELEMENT_NODE&&n.nodeType!==e.NodeType.DOCUMENT_FRAGMENT_NODE||(n.nodeType===e.NodeType.ELEMENT_NODE&&n.shadowRoot&&t(n.shadowRoot,i),n.childNodes.forEach((e=>t(e,i))))}(t,null),r},e.buildFromNode=G,e.createMirror=P,e.createOrGetNode=b,e.diff=M,e.getDefaultSN=Y,e.printRRDom=function(e,t){return H(e,t,"")},Object.defineProperty(e,"__esModule",{value:!0})}(this["@sentry-internal/rrdom"]=this["@sentry-internal/rrdom"]||{}); | ||
//# sourceMappingURL=rrdom.min.js.map |
@@ -5,3 +5,3 @@ import { Mirror as NodeMirror } from '@sentry-internal/rrweb-snapshot'; | ||
import type { Mirror } from '.'; | ||
export declare type ReplayerHandler = { | ||
export type ReplayerHandler = { | ||
mirror: NodeMirror; | ||
@@ -8,0 +8,0 @@ applyCanvas: (canvasEvent: canvasEventWithTime, canvasMutationData: canvasMutationData, target: HTMLCanvasElement) => void; |
@@ -76,3 +76,3 @@ import { NodeType as RRNodeType } from '@sentry-internal/rrweb-snapshot'; | ||
} | ||
declare type ConstrainedConstructor<T = Record<string, unknown>> = new (...args: any[]) => T; | ||
type ConstrainedConstructor<T = Record<string, unknown>> = new (...args: any[]) => T; | ||
export declare class BaseRRNode implements IRRNode { | ||
@@ -327,3 +327,3 @@ parentElement: IRRNode | null; | ||
} | ||
export declare type CSSStyleDeclaration = Record<string, string> & { | ||
export type CSSStyleDeclaration = Record<string, string> & { | ||
setProperty: (name: string, value: string | null, priority?: string | null) => void; | ||
@@ -330,0 +330,0 @@ removeProperty: (name: string) => string; |
@@ -301,3 +301,3 @@ import { NodeType as RRNodeType } from '@sentry-internal/rrweb-snapshot'; | ||
} & typeof RRNode; | ||
export declare type RRText = typeof RRText; | ||
export type RRText = typeof RRText; | ||
export declare const RRComment: { | ||
@@ -327,3 +327,3 @@ new (data: string): { | ||
} & typeof RRNode; | ||
export declare type RRComment = typeof RRComment; | ||
export type RRComment = typeof RRComment; | ||
export declare const RRCDATASection: { | ||
@@ -353,3 +353,3 @@ new (data: string): { | ||
} & typeof RRNode; | ||
export declare type RRCDATASection = typeof RRCDATASection; | ||
export type RRCDATASection = typeof RRCDATASection; | ||
interface RRElementTagNameMap { | ||
@@ -362,3 +362,3 @@ audio: RRMediaElement; | ||
} | ||
declare type RRElementType<K extends keyof HTMLElementTagNameMap> = K extends keyof RRElementTagNameMap ? RRElementTagNameMap[K] : RRElement; | ||
type RRElementType<K extends keyof HTMLElementTagNameMap> = K extends keyof RRElementTagNameMap ? RRElementTagNameMap[K] : RRElement; | ||
export declare function buildFromNode(node: Node, rrdom: IRRDocument, domMirror: NodeMirror, parentRRNode?: IRRNode | null): IRRNode | null; | ||
@@ -365,0 +365,0 @@ export declare function buildFromDom(dom: Document, domMirror?: NodeMirror, rrdom?: IRRDocument): IRRDocument; |
@@ -933,2 +933,5 @@ var NodeType$1; | ||
class RRDocument extends BaseRRDocumentImpl(BaseRRNode) { | ||
get unserializedId() { | ||
return this._unserializedId--; | ||
} | ||
constructor(mirror) { | ||
@@ -944,5 +947,2 @@ super(); | ||
} | ||
get unserializedId() { | ||
return this._unserializedId--; | ||
} | ||
createDocument(_namespace, _qualifiedName, _doctype) { | ||
@@ -949,0 +949,0 @@ return new RRDocument(); |
@@ -1,2 +0,2 @@ | ||
var e;!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(e||(e={}));class t{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function n(e){const t=[];for(const n in e){const o=e[n];if("string"!=typeof o)continue;const r=a(n);t.push(`${r}: ${o};`)}return t.join(" ")}const o=/-([a-z])/g,r=/^--[a-zA-Z0-9-]+$/,s=e=>r.test(e)?e:e.replace(o,((e,t)=>t?t.toUpperCase():"")),i=/\B([A-Z])/g,a=e=>e.replace(i,"-$1").toLowerCase();class l{constructor(...e){this.parentElement=null,this.parentNode=null,this.firstChild=null,this.lastChild=null,this.previousSibling=null,this.nextSibling=null,this.ELEMENT_NODE=g.ELEMENT_NODE,this.TEXT_NODE=g.TEXT_NODE}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof l))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function c(t){return class n extends t{constructor(...t){super(t),this.nodeType=g.DOCUMENT_NODE,this.nodeName="#document",this.compatMode="CSS1Compat",this.RRNodeType=e.Document,this.textContent=null,this.ownerDocument=this}get documentElement(){return this.childNodes.find((t=>t.RRNodeType===e.Element&&"HTML"===t.tagName))||null}get body(){var t;return(null===(t=this.documentElement)||void 0===t?void 0:t.childNodes.find((t=>t.RRNodeType===e.Element&&"BODY"===t.tagName)))||null}get head(){var t;return(null===(t=this.documentElement)||void 0===t?void 0:t.childNodes.find((t=>t.RRNodeType===e.Element&&"HEAD"===t.tagName)))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(t){const n=t.RRNodeType;if((n===e.Element||n===e.DocumentType)&&this.childNodes.some((e=>e.RRNodeType===n)))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${n===e.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const o=f(this,t);return o.parentElement=null,o}insertBefore(t,n){const o=t.RRNodeType;if((o===e.Element||o===e.DocumentType)&&this.childNodes.some((e=>e.RRNodeType===o)))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${o===e.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const r=T(this,t,n);return r.parentElement=null,r}removeChild(e){return D(this,e)}open(){this.firstChild=null,this.lastChild=null}close(){}write(e){let t;if('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'===e?t="-//W3C//DTD XHTML 1.0 Transitional//EN":'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'===e&&(t="-//W3C//DTD HTML 4.0 Transitional//EN"),t){const e=this.createDocumentType("html",t,"");this.open(),this.appendChild(e)}}createDocument(e,t,o){return new n}createDocumentType(e,t,n){const o=new(d(l))(e,t,n);return o.ownerDocument=this,o}createElement(e){const t=new(u(l))(e);return t.ownerDocument=this,t}createElementNS(e,t){return this.createElement(t)}createTextNode(e){const t=new(p(l))(e);return t.ownerDocument=this,t}createComment(e){const t=new(m(l))(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new(N(l))(e);return t.ownerDocument=this,t}toString(){return"RRDocument"}}}function d(t){return class extends t{constructor(t,n,o){super(),this.nodeType=g.DOCUMENT_TYPE_NODE,this.RRNodeType=e.DocumentType,this.name=t,this.publicId=n,this.systemId=o,this.nodeName=t,this.textContent=null}toString(){return"RRDocumentType"}}}function u(t){return class extends t{constructor(t){super(),this.nodeType=g.ELEMENT_NODE,this.RRNodeType=e.Element,this.attributes={},this.shadowRoot=null,this.tagName=t.toUpperCase(),this.nodeName=t.toUpperCase()}get textContent(){let e="";return this.childNodes.forEach((t=>e+=t.textContent)),e}set textContent(e){this.firstChild=null,this.lastChild=null,this.appendChild(this.ownerDocument.createTextNode(e))}get classList(){return new E(this.attributes.class,(e=>{this.attributes.class=e}))}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const e=this.attributes.style?function(e){const t={},n=/:(.+)/;return e.replace(/\/\*.*?\*\//g,"").split(/;(?![^(]*\))/g).forEach((function(e){if(e){const o=e.split(n);o.length>1&&(t[s(o[0].trim())]=o[1].trim())}})),t}(this.attributes.style):{},t=/\B([A-Z])/g;return e.setProperty=(o,r,i)=>{if(t.test(o))return;const a=s(o);r?e[a]=r:delete e[a],"important"===i&&(e[a]+=" !important"),this.attributes.style=n(e)},e.removeProperty=o=>{if(t.test(o))return"";const r=s(o),i=e[r]||"";return delete e[r],this.attributes.style=n(e),i},e}getAttribute(e){return this.attributes[e]||null}setAttribute(e,t){this.attributes[e]=t}setAttributeNS(e,t,n){this.setAttribute(t,n)}removeAttribute(e){delete this.attributes[e]}appendChild(e){return f(this,e)}insertBefore(e,t){return T(this,e,t)}removeChild(e){return D(this,e)}attachShadow(e){const t=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=t,t}dispatchEvent(e){return!0}toString(){let e="";for(const t in this.attributes)e+=`${t}="${this.attributes[t]}" `;return`${this.tagName} ${e}`}}}function h(e){return class extends e{attachShadow(e){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}}function p(t){return class extends t{constructor(t){super(),this.nodeType=g.TEXT_NODE,this.nodeName="#text",this.RRNodeType=e.Text,this.data=t}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRText text=${JSON.stringify(this.data)}`}}}function m(t){return class extends t{constructor(t){super(),this.nodeType=g.COMMENT_NODE,this.nodeName="#comment",this.RRNodeType=e.Comment,this.data=t}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}}function N(t){return class extends t{constructor(t){super(),this.nodeName="#cdata-section",this.nodeType=g.CDATA_SECTION_NODE,this.RRNodeType=e.CDATA,this.data=t}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}}class E{constructor(e,t){if(this.classes=[],this.add=(...e)=>{for(const t of e){const e=String(t);this.classes.indexOf(e)>=0||this.classes.push(e)}this.onChange&&this.onChange(this.classes.join(" "))},this.remove=(...e)=>{this.classes=this.classes.filter((t=>-1===e.indexOf(t))),this.onChange&&this.onChange(this.classes.join(" "))},e){const t=e.trim().split(/\s+/);this.classes.push(...t)}this.onChange=t}}function f(e,t){return t.parentNode&&t.parentNode.removeChild(t),e.lastChild?(e.lastChild.nextSibling=t,t.previousSibling=e.lastChild):(e.firstChild=t,t.previousSibling=null),e.lastChild=t,t.nextSibling=null,t.parentNode=e,t.parentElement=e,t.ownerDocument=e.ownerDocument,t}function T(e,t,n){if(!n)return f(e,t);if(n.parentNode!==e)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return t===n||(t.parentNode&&t.parentNode.removeChild(t),t.previousSibling=n.previousSibling,n.previousSibling=t,t.nextSibling=n,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,t.parentElement=e,t.parentNode=e,t.ownerDocument=e.ownerDocument),t}function D(e,t){if(t.parentNode!==e)throw new Error("Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode.");return t.previousSibling?t.previousSibling.nextSibling=t.nextSibling:e.firstChild=t.nextSibling,t.nextSibling?t.nextSibling.previousSibling=t.previousSibling:e.lastChild=t.previousSibling,t.previousSibling=null,t.nextSibling=null,t.parentElement=null,t.parentNode=null,t}var g;!function(e){e[e.PLACEHOLDER=0]="PLACEHOLDER",e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",e[e.ENTITY_NODE=6]="ENTITY_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"}(g||(g={}));const R={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},C={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};let M=null;function w(t,n,o,r=n.mirror||n.ownerDocument.mirror){t=function(t,n,o,r){var s;o.afterAppend&&!M&&(M=new WeakSet,setTimeout((()=>{M=null}),0));if(!O(t,n)){const e=b(n,o.mirror,r);null===(s=t.parentNode)||void 0===s||s.replaceChild(e,t),t=e}switch(n.RRNodeType){case e.Document:if(!S(t,n,o.mirror,r)){const e=r.getMeta(n);e&&(o.mirror.removeNodeFromMap(t),t.close(),t.open(),o.mirror.add(t,e),null==M||M.add(t))}break;case e.Element:{const e=t,s=n;switch(s.tagName){case"IFRAME":{const e=t.contentDocument;if(!e)break;w(e,n.contentDocument,o,r);break}}s.shadowRoot&&(e.shadowRoot||e.attachShadow({mode:"open"}),y(e.shadowRoot,s.shadowRoot,o,r));break}}return t}(t,n,o,r),y(t,n,o,r),function(t,n,o,r){var s;switch(n.RRNodeType){case e.Document:{const e=n.scrollData;e&&o.applyScroll(e,!0);break}case e.Element:{const e=t,s=n;switch(function(e,t,n){const o=e.attributes,r=t.attributes;for(const o in r){const s=r[o],i=n.getMeta(t);if((null==i?void 0:i.isSVG)&&R[o])e.setAttributeNS(R[o],o,s);else if("CANVAS"===t.tagName&&"rr_dataURL"===o){const t=document.createElement("img");t.src=s,t.onload=()=>{const n=e.getContext("2d");n&&n.drawImage(t,0,0,t.width,t.height)}}else{if("IFRAME"===t.tagName&&"srcdoc"===o)continue;e.setAttribute(o,s)}}for(const{name:t}of Array.from(o))t in r||e.removeAttribute(t);t.scrollLeft&&(e.scrollLeft=t.scrollLeft),t.scrollTop&&(e.scrollTop=t.scrollTop)}(e,s,r),s.scrollData&&o.applyScroll(s.scrollData,!0),s.inputData&&o.applyInput(s.inputData),s.tagName){case"AUDIO":case"VIDEO":{const e=t,n=s;void 0!==n.paused&&(n.paused?e.pause():e.play()),void 0!==n.muted&&(e.muted=n.muted),void 0!==n.volume&&(e.volume=n.volume),void 0!==n.currentTime&&(e.currentTime=n.currentTime),void 0!==n.playbackRate&&(e.playbackRate=n.playbackRate);break}case"CANVAS":{const r=n;if(null!==r.rr_dataURL){const t=document.createElement("img");t.onload=()=>{const n=e.getContext("2d");n&&n.drawImage(t,0,0,t.width,t.height)},t.src=r.rr_dataURL}r.canvasMutations.forEach((e=>o.applyCanvas(e.event,e.mutation,t)));break}case"STYLE":{const t=e.sheet;t&&n.rules.forEach((e=>o.applyStyleSheetMutation(e,t)));break}}break}case e.Text:case e.Comment:case e.CDATA:t.textContent!==n.data&&(t.textContent=n.data)}(null==M?void 0:M.has(t))&&(M.delete(t),null===(s=o.afterAppend)||void 0===s||s.call(o,t,o.mirror.getId(t)))}(t,n,o,r)}function y(e,t,n,o){const r=Array.from(e.childNodes),s=t.childNodes;if(0===r.length&&0===s.length)return;let i,a,l=0,c=r.length-1,d=0,u=s.length-1,h=r[l],p=r[c],m=s[d],N=s[u];for(;l<=c&&d<=u;)if(void 0===h)h=r[++l];else if(void 0===p)p=r[--c];else if(S(h,m,n.mirror,o))h=r[++l],m=s[++d];else if(S(p,N,n.mirror,o))p=r[--c],N=s[--u];else if(S(h,N,n.mirror,o)){try{e.insertBefore(h,p.nextSibling)}catch(e){console.warn(e)}h=r[++l],N=s[--u]}else if(S(p,m,n.mirror,o)){try{e.insertBefore(p,h)}catch(e){console.warn(e)}p=r[--c],m=s[++d]}else{if(!i){i={};for(let e=l;e<=c;e++){const t=r[e];t&&n.mirror.hasNode(t)&&(i[n.mirror.getId(t)]=e)}}a=i[o.getId(m)];const t=r[a];if(void 0!==a&&t&&S(t,m,n.mirror,o)){try{e.insertBefore(t,h)}catch(e){console.warn(e)}r[a]=void 0}else{const t=b(m,n.mirror,o);"#document"===e.nodeName&&h&&(t.nodeType===t.DOCUMENT_TYPE_NODE&&h.nodeType===h.DOCUMENT_TYPE_NODE||t.nodeType===t.ELEMENT_NODE&&h.nodeType===h.ELEMENT_NODE)&&(e.removeChild(h),n.mirror.removeNodeFromMap(h),h=r[++l]);try{e.insertBefore(t,h||null)}catch(e){console.warn(e)}}m=s[++d]}if(l>c){const t=s[u+1];let r=null;for(t&&(r=n.mirror.getNode(o.getId(t)));d<=u;++d){const t=b(s[d],n.mirror,o);try{e.insertBefore(t,r)}catch(e){console.warn(e)}}}else if(d>u)for(;l<=c;l++){const t=r[l];if(t&&t.parentNode===e)try{e.removeChild(t),n.mirror.removeNodeFromMap(t)}catch(e){console.warn(e)}}let E=e.firstChild,f=t.firstChild;for(;null!==E&&null!==f;)w(E,f,n,o),E=E.nextSibling,f=f.nextSibling}function b(t,n,o){const r=o.getId(t),s=o.getMeta(t);let i=null;if(r>-1&&(i=n.getNode(r)),null!==i&&O(i,t))return i;switch(t.RRNodeType){case e.Document:i=new Document;break;case e.DocumentType:i=document.implementation.createDocumentType(t.name,t.publicId,t.systemId);break;case e.Element:{let e=t.tagName.toLowerCase();e=C[e]||e,i=s&&"isSVG"in s&&(null==s?void 0:s.isSVG)?document.createElementNS(R.svg,e):document.createElement(t.tagName);break}case e.Text:i=document.createTextNode(t.data);break;case e.Comment:i=document.createComment(t.data);break;case e.CDATA:i=document.createCDATASection(t.data)}s&&n.add(i,Object.assign({},s));try{null==M||M.add(i)}catch(e){}return i}function O(e,t){return e.nodeType===t.nodeType&&(e.nodeType!==e.ELEMENT_NODE||e.tagName.toUpperCase()===t.tagName)}function S(e,t,n,o){const r=n.getId(e),s=o.getId(t);return-1!==r&&r===s&&O(e,t)}class x extends(c(l)){constructor(e){super(),this.UNSERIALIZED_STARTING_ID=-2,this._unserializedId=this.UNSERIALIZED_STARTING_ID,this.mirror=$(),this.scrollData=null,e&&(this.mirror=e)}get unserializedId(){return this._unserializedId--}createDocument(e,t,n){return new x}createDocumentType(e,t,n){const o=new v(e,t,n);return o.ownerDocument=this,o}createElement(e){const t=e.toUpperCase();let n;switch(t){case"AUDIO":case"VIDEO":n=new _(t);break;case"IFRAME":n=new k(t,this.mirror);break;case"CANVAS":n=new I(t);break;case"STYLE":n=new L(t);break;default:n=new A(t)}return n.ownerDocument=this,n}createComment(e){const t=new F(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new B(e);return t.ownerDocument=this,t}createTextNode(e){const t=new U(e);return t.ownerDocument=this,t}destroyTree(){this.firstChild=null,this.lastChild=null,this.mirror.reset()}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID}}const v=d(l);class A extends(u(l)){constructor(){super(...arguments),this.inputData=null,this.scrollData=null}}class _ extends(h(A)){}class I extends A{constructor(){super(...arguments),this.rr_dataURL=null,this.canvasMutations=[]}getContext(){return null}}class L extends A{constructor(){super(...arguments),this.rules=[]}}class k extends A{constructor(e,t){super(e),this.contentDocument=new x,this.contentDocument.mirror=t}}const U=p(l),F=m(l),B=N(l);function G(e,t,n,o){let r;switch(e.nodeType){case g.DOCUMENT_NODE:o&&"IFRAME"===o.nodeName?r=o.contentDocument:(r=t,r.compatMode=e.compatMode);break;case g.DOCUMENT_TYPE_NODE:{const n=e;r=t.createDocumentType(n.name,n.publicId,n.systemId);break}case g.ELEMENT_NODE:{const n=e,o=(s=n)instanceof HTMLFormElement?"FORM":s.tagName.toUpperCase();r=t.createElement(o);const i=r;for(const{name:e,value:t}of Array.from(n.attributes))i.attributes[e]=t;n.scrollLeft&&(i.scrollLeft=n.scrollLeft),n.scrollTop&&(i.scrollTop=n.scrollTop);break}case g.TEXT_NODE:r=t.createTextNode(e.textContent||"");break;case g.CDATA_SECTION_NODE:r=t.createCDATASection(e.data);break;case g.COMMENT_NODE:r=t.createComment(e.textContent||"");break;case g.DOCUMENT_FRAGMENT_NODE:r=o.attachShadow({mode:"open"});break;default:return null}var s;let i=n.getMeta(e);return t instanceof x&&(i||(i=H(r,t.unserializedId),n.add(e,i)),t.mirror.add(r,Object.assign({},i))),r}function P(e,n=function(){return new t}(),o=new x){return function e(t,r){const s=G(t,o,n,r);if(null!==s)if("IFRAME"!==(null==r?void 0:r.nodeName)&&t.nodeType!==g.DOCUMENT_FRAGMENT_NODE&&(null==r||r.appendChild(s),s.parentNode=r,s.parentElement=r),"IFRAME"===t.nodeName){const n=t.contentDocument;n&&e(n,s)}else t.nodeType!==g.DOCUMENT_NODE&&t.nodeType!==g.ELEMENT_NODE&&t.nodeType!==g.DOCUMENT_FRAGMENT_NODE||(t.nodeType===g.ELEMENT_NODE&&t.shadowRoot&&e(t.shadowRoot,s),t.childNodes.forEach((t=>e(t,s))))}(e,null),o}function $(){return new Y}class Y{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function H(t,n){switch(t.RRNodeType){case e.Document:return{id:n,type:t.RRNodeType,childNodes:[]};case e.DocumentType:{const e=t;return{id:n,type:t.RRNodeType,name:e.name,publicId:e.publicId,systemId:e.systemId}}case e.Element:return{id:n,type:t.RRNodeType,tagName:t.tagName.toLowerCase(),attributes:{},childNodes:[]};case e.Text:case e.Comment:return{id:n,type:t.RRNodeType,textContent:t.textContent||""};case e.CDATA:return{id:n,type:t.RRNodeType,textContent:""}}}function W(e,t){return V(e,t,"")}function V(t,n,o){let r=`${o}${n.getId(t)} ${t.toString()}\n`;if(t.RRNodeType===e.Element){const e=t;e.shadowRoot&&(r+=V(e.shadowRoot,n,o+" "))}for(const e of t.childNodes)r+=V(e,n,o+" ");return"IFRAME"===t.nodeName&&(r+=V(t.contentDocument,n,o+" ")),r}export{N as BaseRRCDATASectionImpl,m as BaseRRCommentImpl,c as BaseRRDocumentImpl,d as BaseRRDocumentTypeImpl,u as BaseRRElementImpl,h as BaseRRMediaElementImpl,l as BaseRRNode,p as BaseRRTextImpl,E as ClassList,Y as Mirror,g as NodeType,B as RRCDATASection,I as RRCanvasElement,F as RRComment,x as RRDocument,v as RRDocumentType,A as RRElement,k as RRIFrameElement,_ as RRMediaElement,l as RRNode,L as RRStyleElement,U as RRText,P as buildFromDom,G as buildFromNode,$ as createMirror,b as createOrGetNode,w as diff,H as getDefaultSN,W as printRRDom}; | ||
var e;!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(e||(e={}));class t{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function n(e){const t=[];for(const n in e){const o=e[n];if("string"!=typeof o)continue;const r=a(n);t.push(`${r}: ${o};`)}return t.join(" ")}const o=/-([a-z])/g,r=/^--[a-zA-Z0-9-]+$/,s=e=>r.test(e)?e:e.replace(o,((e,t)=>t?t.toUpperCase():"")),i=/\B([A-Z])/g,a=e=>e.replace(i,"-$1").toLowerCase();class l{constructor(...e){this.parentElement=null,this.parentNode=null,this.firstChild=null,this.lastChild=null,this.previousSibling=null,this.nextSibling=null,this.ELEMENT_NODE=g.ELEMENT_NODE,this.TEXT_NODE=g.TEXT_NODE}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof l))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function c(t){return class n extends t{constructor(...t){super(t),this.nodeType=g.DOCUMENT_NODE,this.nodeName="#document",this.compatMode="CSS1Compat",this.RRNodeType=e.Document,this.textContent=null,this.ownerDocument=this}get documentElement(){return this.childNodes.find((t=>t.RRNodeType===e.Element&&"HTML"===t.tagName))||null}get body(){var t;return(null===(t=this.documentElement)||void 0===t?void 0:t.childNodes.find((t=>t.RRNodeType===e.Element&&"BODY"===t.tagName)))||null}get head(){var t;return(null===(t=this.documentElement)||void 0===t?void 0:t.childNodes.find((t=>t.RRNodeType===e.Element&&"HEAD"===t.tagName)))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(t){const n=t.RRNodeType;if((n===e.Element||n===e.DocumentType)&&this.childNodes.some((e=>e.RRNodeType===n)))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${n===e.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const o=f(this,t);return o.parentElement=null,o}insertBefore(t,n){const o=t.RRNodeType;if((o===e.Element||o===e.DocumentType)&&this.childNodes.some((e=>e.RRNodeType===o)))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${o===e.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const r=T(this,t,n);return r.parentElement=null,r}removeChild(e){return D(this,e)}open(){this.firstChild=null,this.lastChild=null}close(){}write(e){let t;if('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'===e?t="-//W3C//DTD XHTML 1.0 Transitional//EN":'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'===e&&(t="-//W3C//DTD HTML 4.0 Transitional//EN"),t){const e=this.createDocumentType("html",t,"");this.open(),this.appendChild(e)}}createDocument(e,t,o){return new n}createDocumentType(e,t,n){const o=new(d(l))(e,t,n);return o.ownerDocument=this,o}createElement(e){const t=new(u(l))(e);return t.ownerDocument=this,t}createElementNS(e,t){return this.createElement(t)}createTextNode(e){const t=new(p(l))(e);return t.ownerDocument=this,t}createComment(e){const t=new(m(l))(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new(N(l))(e);return t.ownerDocument=this,t}toString(){return"RRDocument"}}}function d(t){return class extends t{constructor(t,n,o){super(),this.nodeType=g.DOCUMENT_TYPE_NODE,this.RRNodeType=e.DocumentType,this.name=t,this.publicId=n,this.systemId=o,this.nodeName=t,this.textContent=null}toString(){return"RRDocumentType"}}}function u(t){return class extends t{constructor(t){super(),this.nodeType=g.ELEMENT_NODE,this.RRNodeType=e.Element,this.attributes={},this.shadowRoot=null,this.tagName=t.toUpperCase(),this.nodeName=t.toUpperCase()}get textContent(){let e="";return this.childNodes.forEach((t=>e+=t.textContent)),e}set textContent(e){this.firstChild=null,this.lastChild=null,this.appendChild(this.ownerDocument.createTextNode(e))}get classList(){return new E(this.attributes.class,(e=>{this.attributes.class=e}))}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const e=this.attributes.style?function(e){const t={},n=/:(.+)/;return e.replace(/\/\*.*?\*\//g,"").split(/;(?![^(]*\))/g).forEach((function(e){if(e){const o=e.split(n);o.length>1&&(t[s(o[0].trim())]=o[1].trim())}})),t}(this.attributes.style):{},t=/\B([A-Z])/g;return e.setProperty=(o,r,i)=>{if(t.test(o))return;const a=s(o);r?e[a]=r:delete e[a],"important"===i&&(e[a]+=" !important"),this.attributes.style=n(e)},e.removeProperty=o=>{if(t.test(o))return"";const r=s(o),i=e[r]||"";return delete e[r],this.attributes.style=n(e),i},e}getAttribute(e){return this.attributes[e]||null}setAttribute(e,t){this.attributes[e]=t}setAttributeNS(e,t,n){this.setAttribute(t,n)}removeAttribute(e){delete this.attributes[e]}appendChild(e){return f(this,e)}insertBefore(e,t){return T(this,e,t)}removeChild(e){return D(this,e)}attachShadow(e){const t=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=t,t}dispatchEvent(e){return!0}toString(){let e="";for(const t in this.attributes)e+=`${t}="${this.attributes[t]}" `;return`${this.tagName} ${e}`}}}function h(e){return class extends e{attachShadow(e){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}}function p(t){return class extends t{constructor(t){super(),this.nodeType=g.TEXT_NODE,this.nodeName="#text",this.RRNodeType=e.Text,this.data=t}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRText text=${JSON.stringify(this.data)}`}}}function m(t){return class extends t{constructor(t){super(),this.nodeType=g.COMMENT_NODE,this.nodeName="#comment",this.RRNodeType=e.Comment,this.data=t}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}}function N(t){return class extends t{constructor(t){super(),this.nodeName="#cdata-section",this.nodeType=g.CDATA_SECTION_NODE,this.RRNodeType=e.CDATA,this.data=t}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}}class E{constructor(e,t){if(this.classes=[],this.add=(...e)=>{for(const t of e){const e=String(t);this.classes.indexOf(e)>=0||this.classes.push(e)}this.onChange&&this.onChange(this.classes.join(" "))},this.remove=(...e)=>{this.classes=this.classes.filter((t=>-1===e.indexOf(t))),this.onChange&&this.onChange(this.classes.join(" "))},e){const t=e.trim().split(/\s+/);this.classes.push(...t)}this.onChange=t}}function f(e,t){return t.parentNode&&t.parentNode.removeChild(t),e.lastChild?(e.lastChild.nextSibling=t,t.previousSibling=e.lastChild):(e.firstChild=t,t.previousSibling=null),e.lastChild=t,t.nextSibling=null,t.parentNode=e,t.parentElement=e,t.ownerDocument=e.ownerDocument,t}function T(e,t,n){if(!n)return f(e,t);if(n.parentNode!==e)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return t===n||(t.parentNode&&t.parentNode.removeChild(t),t.previousSibling=n.previousSibling,n.previousSibling=t,t.nextSibling=n,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,t.parentElement=e,t.parentNode=e,t.ownerDocument=e.ownerDocument),t}function D(e,t){if(t.parentNode!==e)throw new Error("Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode.");return t.previousSibling?t.previousSibling.nextSibling=t.nextSibling:e.firstChild=t.nextSibling,t.nextSibling?t.nextSibling.previousSibling=t.previousSibling:e.lastChild=t.previousSibling,t.previousSibling=null,t.nextSibling=null,t.parentElement=null,t.parentNode=null,t}var g;!function(e){e[e.PLACEHOLDER=0]="PLACEHOLDER",e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",e[e.ENTITY_NODE=6]="ENTITY_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"}(g||(g={}));const R={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},C={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};let M=null;function w(t,n,o,r=n.mirror||n.ownerDocument.mirror){t=function(t,n,o,r){var s;o.afterAppend&&!M&&(M=new WeakSet,setTimeout((()=>{M=null}),0));if(!O(t,n)){const e=b(n,o.mirror,r);null===(s=t.parentNode)||void 0===s||s.replaceChild(e,t),t=e}switch(n.RRNodeType){case e.Document:if(!S(t,n,o.mirror,r)){const e=r.getMeta(n);e&&(o.mirror.removeNodeFromMap(t),t.close(),t.open(),o.mirror.add(t,e),null==M||M.add(t))}break;case e.Element:{const e=t,s=n;switch(s.tagName){case"IFRAME":{const e=t.contentDocument;if(!e)break;w(e,n.contentDocument,o,r);break}}s.shadowRoot&&(e.shadowRoot||e.attachShadow({mode:"open"}),y(e.shadowRoot,s.shadowRoot,o,r));break}}return t}(t,n,o,r),y(t,n,o,r),function(t,n,o,r){var s;switch(n.RRNodeType){case e.Document:{const e=n.scrollData;e&&o.applyScroll(e,!0);break}case e.Element:{const e=t,s=n;switch(function(e,t,n){const o=e.attributes,r=t.attributes;for(const o in r){const s=r[o],i=n.getMeta(t);if((null==i?void 0:i.isSVG)&&R[o])e.setAttributeNS(R[o],o,s);else if("CANVAS"===t.tagName&&"rr_dataURL"===o){const t=document.createElement("img");t.src=s,t.onload=()=>{const n=e.getContext("2d");n&&n.drawImage(t,0,0,t.width,t.height)}}else{if("IFRAME"===t.tagName&&"srcdoc"===o)continue;e.setAttribute(o,s)}}for(const{name:t}of Array.from(o))t in r||e.removeAttribute(t);t.scrollLeft&&(e.scrollLeft=t.scrollLeft),t.scrollTop&&(e.scrollTop=t.scrollTop)}(e,s,r),s.scrollData&&o.applyScroll(s.scrollData,!0),s.inputData&&o.applyInput(s.inputData),s.tagName){case"AUDIO":case"VIDEO":{const e=t,n=s;void 0!==n.paused&&(n.paused?e.pause():e.play()),void 0!==n.muted&&(e.muted=n.muted),void 0!==n.volume&&(e.volume=n.volume),void 0!==n.currentTime&&(e.currentTime=n.currentTime),void 0!==n.playbackRate&&(e.playbackRate=n.playbackRate);break}case"CANVAS":{const r=n;if(null!==r.rr_dataURL){const t=document.createElement("img");t.onload=()=>{const n=e.getContext("2d");n&&n.drawImage(t,0,0,t.width,t.height)},t.src=r.rr_dataURL}r.canvasMutations.forEach((e=>o.applyCanvas(e.event,e.mutation,t)));break}case"STYLE":{const t=e.sheet;t&&n.rules.forEach((e=>o.applyStyleSheetMutation(e,t)));break}}break}case e.Text:case e.Comment:case e.CDATA:t.textContent!==n.data&&(t.textContent=n.data)}(null==M?void 0:M.has(t))&&(M.delete(t),null===(s=o.afterAppend)||void 0===s||s.call(o,t,o.mirror.getId(t)))}(t,n,o,r)}function y(e,t,n,o){const r=Array.from(e.childNodes),s=t.childNodes;if(0===r.length&&0===s.length)return;let i,a,l=0,c=r.length-1,d=0,u=s.length-1,h=r[l],p=r[c],m=s[d],N=s[u];for(;l<=c&&d<=u;)if(void 0===h)h=r[++l];else if(void 0===p)p=r[--c];else if(S(h,m,n.mirror,o))h=r[++l],m=s[++d];else if(S(p,N,n.mirror,o))p=r[--c],N=s[--u];else if(S(h,N,n.mirror,o)){try{e.insertBefore(h,p.nextSibling)}catch(e){console.warn(e)}h=r[++l],N=s[--u]}else if(S(p,m,n.mirror,o)){try{e.insertBefore(p,h)}catch(e){console.warn(e)}p=r[--c],m=s[++d]}else{if(!i){i={};for(let e=l;e<=c;e++){const t=r[e];t&&n.mirror.hasNode(t)&&(i[n.mirror.getId(t)]=e)}}a=i[o.getId(m)];const t=r[a];if(void 0!==a&&t&&S(t,m,n.mirror,o)){try{e.insertBefore(t,h)}catch(e){console.warn(e)}r[a]=void 0}else{const t=b(m,n.mirror,o);"#document"===e.nodeName&&h&&(t.nodeType===t.DOCUMENT_TYPE_NODE&&h.nodeType===h.DOCUMENT_TYPE_NODE||t.nodeType===t.ELEMENT_NODE&&h.nodeType===h.ELEMENT_NODE)&&(e.removeChild(h),n.mirror.removeNodeFromMap(h),h=r[++l]);try{e.insertBefore(t,h||null)}catch(e){console.warn(e)}}m=s[++d]}if(l>c){const t=s[u+1];let r=null;for(t&&(r=n.mirror.getNode(o.getId(t)));d<=u;++d){const t=b(s[d],n.mirror,o);try{e.insertBefore(t,r)}catch(e){console.warn(e)}}}else if(d>u)for(;l<=c;l++){const t=r[l];if(t&&t.parentNode===e)try{e.removeChild(t),n.mirror.removeNodeFromMap(t)}catch(e){console.warn(e)}}let E=e.firstChild,f=t.firstChild;for(;null!==E&&null!==f;)w(E,f,n,o),E=E.nextSibling,f=f.nextSibling}function b(t,n,o){const r=o.getId(t),s=o.getMeta(t);let i=null;if(r>-1&&(i=n.getNode(r)),null!==i&&O(i,t))return i;switch(t.RRNodeType){case e.Document:i=new Document;break;case e.DocumentType:i=document.implementation.createDocumentType(t.name,t.publicId,t.systemId);break;case e.Element:{let e=t.tagName.toLowerCase();e=C[e]||e,i=s&&"isSVG"in s&&(null==s?void 0:s.isSVG)?document.createElementNS(R.svg,e):document.createElement(t.tagName);break}case e.Text:i=document.createTextNode(t.data);break;case e.Comment:i=document.createComment(t.data);break;case e.CDATA:i=document.createCDATASection(t.data)}s&&n.add(i,Object.assign({},s));try{null==M||M.add(i)}catch(e){}return i}function O(e,t){return e.nodeType===t.nodeType&&(e.nodeType!==e.ELEMENT_NODE||e.tagName.toUpperCase()===t.tagName)}function S(e,t,n,o){const r=n.getId(e),s=o.getId(t);return-1!==r&&r===s&&O(e,t)}class x extends(c(l)){get unserializedId(){return this._unserializedId--}constructor(e){super(),this.UNSERIALIZED_STARTING_ID=-2,this._unserializedId=this.UNSERIALIZED_STARTING_ID,this.mirror=$(),this.scrollData=null,e&&(this.mirror=e)}createDocument(e,t,n){return new x}createDocumentType(e,t,n){const o=new v(e,t,n);return o.ownerDocument=this,o}createElement(e){const t=e.toUpperCase();let n;switch(t){case"AUDIO":case"VIDEO":n=new _(t);break;case"IFRAME":n=new k(t,this.mirror);break;case"CANVAS":n=new I(t);break;case"STYLE":n=new L(t);break;default:n=new A(t)}return n.ownerDocument=this,n}createComment(e){const t=new F(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new B(e);return t.ownerDocument=this,t}createTextNode(e){const t=new U(e);return t.ownerDocument=this,t}destroyTree(){this.firstChild=null,this.lastChild=null,this.mirror.reset()}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID}}const v=d(l);class A extends(u(l)){constructor(){super(...arguments),this.inputData=null,this.scrollData=null}}class _ extends(h(A)){}class I extends A{constructor(){super(...arguments),this.rr_dataURL=null,this.canvasMutations=[]}getContext(){return null}}class L extends A{constructor(){super(...arguments),this.rules=[]}}class k extends A{constructor(e,t){super(e),this.contentDocument=new x,this.contentDocument.mirror=t}}const U=p(l),F=m(l),B=N(l);function G(e,t,n,o){let r;switch(e.nodeType){case g.DOCUMENT_NODE:o&&"IFRAME"===o.nodeName?r=o.contentDocument:(r=t,r.compatMode=e.compatMode);break;case g.DOCUMENT_TYPE_NODE:{const n=e;r=t.createDocumentType(n.name,n.publicId,n.systemId);break}case g.ELEMENT_NODE:{const n=e,o=(s=n)instanceof HTMLFormElement?"FORM":s.tagName.toUpperCase();r=t.createElement(o);const i=r;for(const{name:e,value:t}of Array.from(n.attributes))i.attributes[e]=t;n.scrollLeft&&(i.scrollLeft=n.scrollLeft),n.scrollTop&&(i.scrollTop=n.scrollTop);break}case g.TEXT_NODE:r=t.createTextNode(e.textContent||"");break;case g.CDATA_SECTION_NODE:r=t.createCDATASection(e.data);break;case g.COMMENT_NODE:r=t.createComment(e.textContent||"");break;case g.DOCUMENT_FRAGMENT_NODE:r=o.attachShadow({mode:"open"});break;default:return null}var s;let i=n.getMeta(e);return t instanceof x&&(i||(i=H(r,t.unserializedId),n.add(e,i)),t.mirror.add(r,Object.assign({},i))),r}function P(e,n=function(){return new t}(),o=new x){return function e(t,r){const s=G(t,o,n,r);if(null!==s)if("IFRAME"!==(null==r?void 0:r.nodeName)&&t.nodeType!==g.DOCUMENT_FRAGMENT_NODE&&(null==r||r.appendChild(s),s.parentNode=r,s.parentElement=r),"IFRAME"===t.nodeName){const n=t.contentDocument;n&&e(n,s)}else t.nodeType!==g.DOCUMENT_NODE&&t.nodeType!==g.ELEMENT_NODE&&t.nodeType!==g.DOCUMENT_FRAGMENT_NODE||(t.nodeType===g.ELEMENT_NODE&&t.shadowRoot&&e(t.shadowRoot,s),t.childNodes.forEach((t=>e(t,s))))}(e,null),o}function $(){return new Y}class Y{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function H(t,n){switch(t.RRNodeType){case e.Document:return{id:n,type:t.RRNodeType,childNodes:[]};case e.DocumentType:{const e=t;return{id:n,type:t.RRNodeType,name:e.name,publicId:e.publicId,systemId:e.systemId}}case e.Element:return{id:n,type:t.RRNodeType,tagName:t.tagName.toLowerCase(),attributes:{},childNodes:[]};case e.Text:case e.Comment:return{id:n,type:t.RRNodeType,textContent:t.textContent||""};case e.CDATA:return{id:n,type:t.RRNodeType,textContent:""}}}function W(e,t){return V(e,t,"")}function V(t,n,o){let r=`${o}${n.getId(t)} ${t.toString()}\n`;if(t.RRNodeType===e.Element){const e=t;e.shadowRoot&&(r+=V(e.shadowRoot,n,o+" "))}for(const e of t.childNodes)r+=V(e,n,o+" ");return"IFRAME"===t.nodeName&&(r+=V(t.contentDocument,n,o+" ")),r}export{N as BaseRRCDATASectionImpl,m as BaseRRCommentImpl,c as BaseRRDocumentImpl,d as BaseRRDocumentTypeImpl,u as BaseRRElementImpl,h as BaseRRMediaElementImpl,l as BaseRRNode,p as BaseRRTextImpl,E as ClassList,Y as Mirror,g as NodeType,B as RRCDATASection,I as RRCanvasElement,F as RRComment,x as RRDocument,v as RRDocumentType,A as RRElement,k as RRIFrameElement,_ as RRMediaElement,l as RRNode,L as RRStyleElement,U as RRText,P as buildFromDom,G as buildFromNode,$ as createMirror,b as createOrGetNode,w as diff,H as getDefaultSN,W as printRRDom}; | ||
//# sourceMappingURL=rrdom.min.js.map |
@@ -5,3 +5,3 @@ import { Mirror as NodeMirror } from '@sentry-internal/rrweb-snapshot'; | ||
import type { Mirror } from '.'; | ||
export declare type ReplayerHandler = { | ||
export type ReplayerHandler = { | ||
mirror: NodeMirror; | ||
@@ -8,0 +8,0 @@ applyCanvas: (canvasEvent: canvasEventWithTime, canvasMutationData: canvasMutationData, target: HTMLCanvasElement) => void; |
@@ -76,3 +76,3 @@ import { NodeType as RRNodeType } from '@sentry-internal/rrweb-snapshot'; | ||
} | ||
declare type ConstrainedConstructor<T = Record<string, unknown>> = new (...args: any[]) => T; | ||
type ConstrainedConstructor<T = Record<string, unknown>> = new (...args: any[]) => T; | ||
export declare class BaseRRNode implements IRRNode { | ||
@@ -327,3 +327,3 @@ parentElement: IRRNode | null; | ||
} | ||
export declare type CSSStyleDeclaration = Record<string, string> & { | ||
export type CSSStyleDeclaration = Record<string, string> & { | ||
setProperty: (name: string, value: string | null, priority?: string | null) => void; | ||
@@ -330,0 +330,0 @@ removeProperty: (name: string) => string; |
@@ -301,3 +301,3 @@ import { NodeType as RRNodeType } from '@sentry-internal/rrweb-snapshot'; | ||
} & typeof RRNode; | ||
export declare type RRText = typeof RRText; | ||
export type RRText = typeof RRText; | ||
export declare const RRComment: { | ||
@@ -327,3 +327,3 @@ new (data: string): { | ||
} & typeof RRNode; | ||
export declare type RRComment = typeof RRComment; | ||
export type RRComment = typeof RRComment; | ||
export declare const RRCDATASection: { | ||
@@ -353,3 +353,3 @@ new (data: string): { | ||
} & typeof RRNode; | ||
export declare type RRCDATASection = typeof RRCDATASection; | ||
export type RRCDATASection = typeof RRCDATASection; | ||
interface RRElementTagNameMap { | ||
@@ -362,3 +362,3 @@ audio: RRMediaElement; | ||
} | ||
declare type RRElementType<K extends keyof HTMLElementTagNameMap> = K extends keyof RRElementTagNameMap ? RRElementTagNameMap[K] : RRElement; | ||
type RRElementType<K extends keyof HTMLElementTagNameMap> = K extends keyof RRElementTagNameMap ? RRElementTagNameMap[K] : RRElement; | ||
export declare function buildFromNode(node: Node, rrdom: IRRDocument, domMirror: NodeMirror, parentRRNode?: IRRNode | null): IRRNode | null; | ||
@@ -365,0 +365,0 @@ export declare function buildFromDom(dom: Document, domMirror?: NodeMirror, rrdom?: IRRDocument): IRRDocument; |
{ | ||
"name": "@sentry-internal/rrdom", | ||
"version": "2.0.0-alpha10.1", | ||
"version": "2.0.0-beta11.0", | ||
"homepage": "https://github.com/rrweb-io/rrweb/tree/main/packages/rrdom#readme", | ||
@@ -37,3 +37,3 @@ "license": "MIT", | ||
"@rollup/plugin-commonjs": "^20.0.0", | ||
"@sentry-internal/rrweb-types": "2.0.0-alpha10.1", | ||
"@sentry-internal/rrweb-types": "2.0.0-beta11.0", | ||
"@types/jest": "^27.4.1", | ||
@@ -53,4 +53,4 @@ "@types/puppeteer": "^5.4.4", | ||
"dependencies": { | ||
"@sentry-internal/rrweb-snapshot": "2.0.0-alpha10.1" | ||
"@sentry-internal/rrweb-snapshot": "2.0.0-beta11.0" | ||
} | ||
} |
@@ -5,3 +5,3 @@ import { Mirror as NodeMirror } from '@sentry-internal/rrweb-snapshot'; | ||
import type { Mirror } from '.'; | ||
export declare type ReplayerHandler = { | ||
export type ReplayerHandler = { | ||
mirror: NodeMirror; | ||
@@ -8,0 +8,0 @@ applyCanvas: (canvasEvent: canvasEventWithTime, canvasMutationData: canvasMutationData, target: HTMLCanvasElement) => void; |
@@ -76,3 +76,3 @@ import { NodeType as RRNodeType } from '@sentry-internal/rrweb-snapshot'; | ||
} | ||
declare type ConstrainedConstructor<T = Record<string, unknown>> = new (...args: any[]) => T; | ||
type ConstrainedConstructor<T = Record<string, unknown>> = new (...args: any[]) => T; | ||
export declare class BaseRRNode implements IRRNode { | ||
@@ -327,3 +327,3 @@ parentElement: IRRNode | null; | ||
} | ||
export declare type CSSStyleDeclaration = Record<string, string> & { | ||
export type CSSStyleDeclaration = Record<string, string> & { | ||
setProperty: (name: string, value: string | null, priority?: string | null) => void; | ||
@@ -330,0 +330,0 @@ removeProperty: (name: string) => string; |
@@ -301,3 +301,3 @@ import { NodeType as RRNodeType } from '@sentry-internal/rrweb-snapshot'; | ||
} & typeof RRNode; | ||
export declare type RRText = typeof RRText; | ||
export type RRText = typeof RRText; | ||
export declare const RRComment: { | ||
@@ -327,3 +327,3 @@ new (data: string): { | ||
} & typeof RRNode; | ||
export declare type RRComment = typeof RRComment; | ||
export type RRComment = typeof RRComment; | ||
export declare const RRCDATASection: { | ||
@@ -353,3 +353,3 @@ new (data: string): { | ||
} & typeof RRNode; | ||
export declare type RRCDATASection = typeof RRCDATASection; | ||
export type RRCDATASection = typeof RRCDATASection; | ||
interface RRElementTagNameMap { | ||
@@ -362,3 +362,3 @@ audio: RRMediaElement; | ||
} | ||
declare type RRElementType<K extends keyof HTMLElementTagNameMap> = K extends keyof RRElementTagNameMap ? RRElementTagNameMap[K] : RRElement; | ||
type RRElementType<K extends keyof HTMLElementTagNameMap> = K extends keyof RRElementTagNameMap ? RRElementTagNameMap[K] : RRElement; | ||
export declare function buildFromNode(node: Node, rrdom: IRRDocument, domMirror: NodeMirror, parentRRNode?: IRRNode | null): IRRNode | null; | ||
@@ -365,0 +365,0 @@ export declare function buildFromDom(dom: Document, domMirror?: NodeMirror, rrdom?: IRRDocument): IRRDocument; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
636402
+ Added@sentry-internal/rrweb-snapshot@2.0.0-beta11.0(transitive)
- Removed@sentry-internal/rrweb-snapshot@2.0.0-alpha10.1(transitive)