@amplitude/rrweb-player 2.1.6 → 2.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rrweb-player.cjs +825 -745
- package/dist/rrweb-player.cjs.map +1 -1
- package/dist/rrweb-player.js +825 -745
- package/dist/rrweb-player.js.map +1 -1
- package/dist/rrweb-player.umd.cjs +825 -745
- package/dist/rrweb-player.umd.cjs.map +2 -2
- package/dist/rrweb-player.umd.min.cjs +27 -27
- package/dist/rrweb-player.umd.min.cjs.map +3 -3
- package/package.json +3 -3
package/dist/rrweb-player.js
CHANGED
|
@@ -14012,643 +14012,119 @@ var NodeType$1 = /* @__PURE__ */ ((NodeType2) => {
|
|
|
14012
14012
|
NodeType2[NodeType2["Comment"] = 5] = "Comment";
|
|
14013
14013
|
return NodeType2;
|
|
14014
14014
|
})(NodeType$1 || {});
|
|
14015
|
-
|
|
14016
|
-
|
|
14017
|
-
|
|
14018
|
-
|
|
14019
|
-
const comment2 = /\/\*.*?\*\//g;
|
|
14020
|
-
cssText.replace(comment2, "").split(listDelimiter).forEach(function(item) {
|
|
14021
|
-
if (item) {
|
|
14022
|
-
const tmp = item.split(propertyDelimiter);
|
|
14023
|
-
tmp.length > 1 && (res[camelize(tmp[0].trim())] = tmp[1].trim());
|
|
14024
|
-
}
|
|
14025
|
-
});
|
|
14026
|
-
return res;
|
|
14027
|
-
}
|
|
14028
|
-
function toCSSText(style) {
|
|
14029
|
-
const properties = [];
|
|
14030
|
-
for (const name in style) {
|
|
14031
|
-
const value = style[name];
|
|
14032
|
-
if (typeof value !== "string") continue;
|
|
14033
|
-
const normalizedName = hyphenate(name);
|
|
14034
|
-
properties.push(`${normalizedName}: ${value};`);
|
|
14035
|
-
}
|
|
14036
|
-
return properties.join(" ");
|
|
14037
|
-
}
|
|
14038
|
-
const camelizeRE = /-([a-z])/g;
|
|
14039
|
-
const CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9-]+$/;
|
|
14040
|
-
const camelize = (str) => {
|
|
14041
|
-
if (CUSTOM_PROPERTY_REGEX.test(str)) return str;
|
|
14042
|
-
return str.replace(camelizeRE, (_, c2) => c2 ? c2.toUpperCase() : "");
|
|
14015
|
+
const NAMESPACES = {
|
|
14016
|
+
svg: "http://www.w3.org/2000/svg",
|
|
14017
|
+
"xlink:href": "http://www.w3.org/1999/xlink",
|
|
14018
|
+
xmlns: "http://www.w3.org/2000/xmlns/"
|
|
14043
14019
|
};
|
|
14044
|
-
const
|
|
14045
|
-
|
|
14046
|
-
|
|
14020
|
+
const SVGTagMap = {
|
|
14021
|
+
altglyph: "altGlyph",
|
|
14022
|
+
altglyphdef: "altGlyphDef",
|
|
14023
|
+
altglyphitem: "altGlyphItem",
|
|
14024
|
+
animatecolor: "animateColor",
|
|
14025
|
+
animatemotion: "animateMotion",
|
|
14026
|
+
animatetransform: "animateTransform",
|
|
14027
|
+
clippath: "clipPath",
|
|
14028
|
+
feblend: "feBlend",
|
|
14029
|
+
fecolormatrix: "feColorMatrix",
|
|
14030
|
+
fecomponenttransfer: "feComponentTransfer",
|
|
14031
|
+
fecomposite: "feComposite",
|
|
14032
|
+
feconvolvematrix: "feConvolveMatrix",
|
|
14033
|
+
fediffuselighting: "feDiffuseLighting",
|
|
14034
|
+
fedisplacementmap: "feDisplacementMap",
|
|
14035
|
+
fedistantlight: "feDistantLight",
|
|
14036
|
+
fedropshadow: "feDropShadow",
|
|
14037
|
+
feflood: "feFlood",
|
|
14038
|
+
fefunca: "feFuncA",
|
|
14039
|
+
fefuncb: "feFuncB",
|
|
14040
|
+
fefuncg: "feFuncG",
|
|
14041
|
+
fefuncr: "feFuncR",
|
|
14042
|
+
fegaussianblur: "feGaussianBlur",
|
|
14043
|
+
feimage: "feImage",
|
|
14044
|
+
femerge: "feMerge",
|
|
14045
|
+
femergenode: "feMergeNode",
|
|
14046
|
+
femorphology: "feMorphology",
|
|
14047
|
+
feoffset: "feOffset",
|
|
14048
|
+
fepointlight: "fePointLight",
|
|
14049
|
+
fespecularlighting: "feSpecularLighting",
|
|
14050
|
+
fespotlight: "feSpotLight",
|
|
14051
|
+
fetile: "feTile",
|
|
14052
|
+
feturbulence: "feTurbulence",
|
|
14053
|
+
foreignobject: "foreignObject",
|
|
14054
|
+
glyphref: "glyphRef",
|
|
14055
|
+
lineargradient: "linearGradient",
|
|
14056
|
+
radialgradient: "radialGradient"
|
|
14047
14057
|
};
|
|
14048
|
-
|
|
14049
|
-
|
|
14050
|
-
|
|
14051
|
-
|
|
14052
|
-
|
|
14053
|
-
|
|
14054
|
-
|
|
14055
|
-
|
|
14056
|
-
|
|
14057
|
-
|
|
14058
|
-
__publicField22(this, "ELEMENT_NODE", 1);
|
|
14059
|
-
__publicField22(this, "TEXT_NODE", 3);
|
|
14060
|
-
__publicField22(this, "nodeType");
|
|
14061
|
-
__publicField22(this, "nodeName");
|
|
14062
|
-
__publicField22(this, "RRNodeType");
|
|
14063
|
-
}
|
|
14064
|
-
get childNodes() {
|
|
14065
|
-
const childNodes2 = [];
|
|
14066
|
-
let childIterator = this.firstChild;
|
|
14067
|
-
while (childIterator) {
|
|
14068
|
-
childNodes2.push(childIterator);
|
|
14069
|
-
childIterator = childIterator.nextSibling;
|
|
14070
|
-
}
|
|
14071
|
-
return childNodes2;
|
|
14072
|
-
}
|
|
14073
|
-
contains(node2) {
|
|
14074
|
-
if (!(node2 instanceof BaseRRNode)) return false;
|
|
14075
|
-
else if (node2.ownerDocument !== this.ownerDocument) return false;
|
|
14076
|
-
else if (node2 === this) return true;
|
|
14077
|
-
while (node2.parentNode) {
|
|
14078
|
-
if (node2.parentNode === this) return true;
|
|
14079
|
-
node2 = node2.parentNode;
|
|
14080
|
-
}
|
|
14081
|
-
return false;
|
|
14082
|
-
}
|
|
14083
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14084
|
-
appendChild(_newChild) {
|
|
14085
|
-
throw new Error(
|
|
14086
|
-
`RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.`
|
|
14087
|
-
);
|
|
14088
|
-
}
|
|
14089
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14090
|
-
insertBefore(_newChild, _refChild) {
|
|
14091
|
-
throw new Error(
|
|
14092
|
-
`RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.`
|
|
14093
|
-
);
|
|
14094
|
-
}
|
|
14095
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14096
|
-
removeChild(_node) {
|
|
14097
|
-
throw new Error(
|
|
14098
|
-
`RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.`
|
|
14099
|
-
);
|
|
14100
|
-
}
|
|
14101
|
-
toString() {
|
|
14102
|
-
return "RRNode";
|
|
14103
|
-
}
|
|
14058
|
+
let createdNodeSet = null;
|
|
14059
|
+
function diff(oldTree, newTree, replayer, rrnodeMirror = newTree.mirror || newTree.ownerDocument.mirror) {
|
|
14060
|
+
oldTree = diffBeforeUpdatingChildren(
|
|
14061
|
+
oldTree,
|
|
14062
|
+
newTree,
|
|
14063
|
+
replayer,
|
|
14064
|
+
rrnodeMirror
|
|
14065
|
+
);
|
|
14066
|
+
diffChildren(oldTree, newTree, replayer, rrnodeMirror);
|
|
14067
|
+
diffAfterUpdatingChildren(oldTree, newTree, replayer);
|
|
14104
14068
|
}
|
|
14105
|
-
|
|
14106
|
-
|
|
14107
|
-
|
|
14108
|
-
|
|
14109
|
-
|
|
14110
|
-
|
|
14111
|
-
|
|
14112
|
-
__publicField22(this, "RRNodeType", NodeType$1.Document);
|
|
14113
|
-
__publicField22(this, "textContent", null);
|
|
14114
|
-
this.ownerDocument = this;
|
|
14115
|
-
}
|
|
14116
|
-
get documentElement() {
|
|
14117
|
-
return this.childNodes.find(
|
|
14118
|
-
(node2) => node2.RRNodeType === NodeType$1.Element && node2.tagName === "HTML"
|
|
14119
|
-
) || null;
|
|
14120
|
-
}
|
|
14121
|
-
get body() {
|
|
14122
|
-
var _a22;
|
|
14123
|
-
return ((_a22 = this.documentElement) == null ? void 0 : _a22.childNodes.find(
|
|
14124
|
-
(node2) => node2.RRNodeType === NodeType$1.Element && node2.tagName === "BODY"
|
|
14125
|
-
)) || null;
|
|
14126
|
-
}
|
|
14127
|
-
get head() {
|
|
14128
|
-
var _a22;
|
|
14129
|
-
return ((_a22 = this.documentElement) == null ? void 0 : _a22.childNodes.find(
|
|
14130
|
-
(node2) => node2.RRNodeType === NodeType$1.Element && node2.tagName === "HEAD"
|
|
14131
|
-
)) || null;
|
|
14132
|
-
}
|
|
14133
|
-
get implementation() {
|
|
14134
|
-
return this;
|
|
14069
|
+
function diffBeforeUpdatingChildren(oldTree, newTree, replayer, rrnodeMirror) {
|
|
14070
|
+
var _a22;
|
|
14071
|
+
if (replayer.afterAppend && !createdNodeSet) {
|
|
14072
|
+
createdNodeSet = /* @__PURE__ */ new WeakSet();
|
|
14073
|
+
setTimeout(() => {
|
|
14074
|
+
createdNodeSet = null;
|
|
14075
|
+
}, 0);
|
|
14135
14076
|
}
|
|
14136
|
-
|
|
14137
|
-
|
|
14077
|
+
if (!sameNodeType(oldTree, newTree)) {
|
|
14078
|
+
const calibratedOldTree = createOrGetNode(
|
|
14079
|
+
newTree,
|
|
14080
|
+
replayer.mirror,
|
|
14081
|
+
rrnodeMirror
|
|
14082
|
+
);
|
|
14083
|
+
(_a22 = oldTree.parentNode) == null ? void 0 : _a22.replaceChild(calibratedOldTree, oldTree);
|
|
14084
|
+
oldTree = calibratedOldTree;
|
|
14138
14085
|
}
|
|
14139
|
-
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
|
|
14143
|
-
|
|
14144
|
-
|
|
14145
|
-
|
|
14086
|
+
switch (newTree.RRNodeType) {
|
|
14087
|
+
case NodeType$1.Document: {
|
|
14088
|
+
if (!nodeMatching(oldTree, newTree, replayer.mirror, rrnodeMirror)) {
|
|
14089
|
+
const newMeta = rrnodeMirror.getMeta(newTree);
|
|
14090
|
+
if (newMeta) {
|
|
14091
|
+
replayer.mirror.removeNodeFromMap(oldTree);
|
|
14092
|
+
oldTree.close();
|
|
14093
|
+
oldTree.open();
|
|
14094
|
+
replayer.mirror.add(oldTree, newMeta);
|
|
14095
|
+
createdNodeSet == null ? void 0 : createdNodeSet.add(oldTree);
|
|
14096
|
+
}
|
|
14146
14097
|
}
|
|
14098
|
+
break;
|
|
14147
14099
|
}
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
14154
|
-
|
|
14155
|
-
|
|
14156
|
-
|
|
14157
|
-
|
|
14100
|
+
case NodeType$1.Element: {
|
|
14101
|
+
const oldElement = oldTree;
|
|
14102
|
+
const newRRElement = newTree;
|
|
14103
|
+
switch (newRRElement.tagName) {
|
|
14104
|
+
case "IFRAME": {
|
|
14105
|
+
const oldContentDocument = oldTree.contentDocument;
|
|
14106
|
+
if (!oldContentDocument) break;
|
|
14107
|
+
diff(
|
|
14108
|
+
oldContentDocument,
|
|
14109
|
+
newTree.contentDocument,
|
|
14110
|
+
replayer,
|
|
14111
|
+
rrnodeMirror
|
|
14112
|
+
);
|
|
14113
|
+
break;
|
|
14114
|
+
}
|
|
14115
|
+
}
|
|
14116
|
+
if (newRRElement.shadowRoot) {
|
|
14117
|
+
if (!oldElement.shadowRoot) oldElement.attachShadow({ mode: "open" });
|
|
14118
|
+
diffChildren(
|
|
14119
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
14120
|
+
oldElement.shadowRoot,
|
|
14121
|
+
newRRElement.shadowRoot,
|
|
14122
|
+
replayer,
|
|
14123
|
+
rrnodeMirror
|
|
14158
14124
|
);
|
|
14159
14125
|
}
|
|
14160
|
-
|
|
14161
|
-
|
|
14162
|
-
child2.parentElement = null;
|
|
14163
|
-
return child2;
|
|
14164
|
-
}
|
|
14165
|
-
removeChild(node2) {
|
|
14166
|
-
return removeChild(this, node2);
|
|
14167
|
-
}
|
|
14168
|
-
open() {
|
|
14169
|
-
this.firstChild = null;
|
|
14170
|
-
this.lastChild = null;
|
|
14171
|
-
}
|
|
14172
|
-
close() {
|
|
14173
|
-
}
|
|
14174
|
-
/**
|
|
14175
|
-
* Adhoc implementation for setting xhtml namespace in rebuilt.ts (rrweb-snapshot).
|
|
14176
|
-
* There are two lines used this function:
|
|
14177
|
-
* 1. doc.write('\<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""\>')
|
|
14178
|
-
* 2. doc.write('\<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ""\>')
|
|
14179
|
-
*/
|
|
14180
|
-
write(content) {
|
|
14181
|
-
let publicId;
|
|
14182
|
-
if (content === '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">')
|
|
14183
|
-
publicId = "-//W3C//DTD XHTML 1.0 Transitional//EN";
|
|
14184
|
-
else if (content === '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')
|
|
14185
|
-
publicId = "-//W3C//DTD HTML 4.0 Transitional//EN";
|
|
14186
|
-
if (publicId) {
|
|
14187
|
-
const doctype = this.createDocumentType("html", publicId, "");
|
|
14188
|
-
this.open();
|
|
14189
|
-
this.appendChild(doctype);
|
|
14190
|
-
}
|
|
14191
|
-
}
|
|
14192
|
-
createDocument(_namespace, _qualifiedName, _doctype) {
|
|
14193
|
-
return new BaseRRDocument();
|
|
14194
|
-
}
|
|
14195
|
-
createDocumentType(qualifiedName, publicId, systemId) {
|
|
14196
|
-
const doctype = new BaseRRDocumentType(qualifiedName, publicId, systemId);
|
|
14197
|
-
doctype.ownerDocument = this;
|
|
14198
|
-
return doctype;
|
|
14199
|
-
}
|
|
14200
|
-
createElement(tagName) {
|
|
14201
|
-
const element = new BaseRRElement(tagName);
|
|
14202
|
-
element.ownerDocument = this;
|
|
14203
|
-
return element;
|
|
14204
|
-
}
|
|
14205
|
-
createElementNS(_namespaceURI, qualifiedName) {
|
|
14206
|
-
return this.createElement(qualifiedName);
|
|
14207
|
-
}
|
|
14208
|
-
createTextNode(data) {
|
|
14209
|
-
const text = new BaseRRText(data);
|
|
14210
|
-
text.ownerDocument = this;
|
|
14211
|
-
return text;
|
|
14212
|
-
}
|
|
14213
|
-
createComment(data) {
|
|
14214
|
-
const comment2 = new BaseRRComment(data);
|
|
14215
|
-
comment2.ownerDocument = this;
|
|
14216
|
-
return comment2;
|
|
14217
|
-
}
|
|
14218
|
-
createCDATASection(data) {
|
|
14219
|
-
const CDATASection = new BaseRRCDATASection(data);
|
|
14220
|
-
CDATASection.ownerDocument = this;
|
|
14221
|
-
return CDATASection;
|
|
14222
|
-
}
|
|
14223
|
-
toString() {
|
|
14224
|
-
return "RRDocument";
|
|
14225
|
-
}
|
|
14226
|
-
}
|
|
14227
|
-
class BaseRRDocumentType extends BaseRRNode {
|
|
14228
|
-
constructor(qualifiedName, publicId, systemId) {
|
|
14229
|
-
super();
|
|
14230
|
-
__publicField22(this, "nodeType", 10);
|
|
14231
|
-
__publicField22(this, "RRNodeType", NodeType$1.DocumentType);
|
|
14232
|
-
__publicField22(this, "name");
|
|
14233
|
-
__publicField22(this, "publicId");
|
|
14234
|
-
__publicField22(this, "systemId");
|
|
14235
|
-
__publicField22(this, "textContent", null);
|
|
14236
|
-
this.name = qualifiedName;
|
|
14237
|
-
this.publicId = publicId;
|
|
14238
|
-
this.systemId = systemId;
|
|
14239
|
-
this.nodeName = qualifiedName;
|
|
14240
|
-
}
|
|
14241
|
-
toString() {
|
|
14242
|
-
return "RRDocumentType";
|
|
14243
|
-
}
|
|
14244
|
-
}
|
|
14245
|
-
class BaseRRElement extends BaseRRNode {
|
|
14246
|
-
constructor(tagName) {
|
|
14247
|
-
super();
|
|
14248
|
-
__publicField22(this, "nodeType", 1);
|
|
14249
|
-
__publicField22(this, "RRNodeType", NodeType$1.Element);
|
|
14250
|
-
__publicField22(this, "tagName");
|
|
14251
|
-
__publicField22(this, "attributes", {});
|
|
14252
|
-
__publicField22(this, "shadowRoot", null);
|
|
14253
|
-
__publicField22(this, "scrollLeft");
|
|
14254
|
-
__publicField22(this, "scrollTop");
|
|
14255
|
-
this.tagName = tagName.toUpperCase();
|
|
14256
|
-
this.nodeName = tagName.toUpperCase();
|
|
14257
|
-
}
|
|
14258
|
-
get textContent() {
|
|
14259
|
-
let result2 = "";
|
|
14260
|
-
this.childNodes.forEach((node2) => result2 += node2.textContent);
|
|
14261
|
-
return result2;
|
|
14262
|
-
}
|
|
14263
|
-
set textContent(textContent2) {
|
|
14264
|
-
this.firstChild = null;
|
|
14265
|
-
this.lastChild = null;
|
|
14266
|
-
this.appendChild(this.ownerDocument.createTextNode(textContent2));
|
|
14267
|
-
}
|
|
14268
|
-
get classList() {
|
|
14269
|
-
return new ClassList(
|
|
14270
|
-
this.attributes.class,
|
|
14271
|
-
(newClassName) => {
|
|
14272
|
-
this.attributes.class = newClassName;
|
|
14273
|
-
}
|
|
14274
|
-
);
|
|
14275
|
-
}
|
|
14276
|
-
get id() {
|
|
14277
|
-
return this.attributes.id || "";
|
|
14278
|
-
}
|
|
14279
|
-
get className() {
|
|
14280
|
-
return this.attributes.class || "";
|
|
14281
|
-
}
|
|
14282
|
-
get style() {
|
|
14283
|
-
const style = this.attributes.style ? parseCSSText(this.attributes.style) : {};
|
|
14284
|
-
const hyphenateRE2 = /\B([A-Z])/g;
|
|
14285
|
-
style.setProperty = (name, value, priority) => {
|
|
14286
|
-
if (hyphenateRE2.test(name)) return;
|
|
14287
|
-
const normalizedName = camelize(name);
|
|
14288
|
-
if (!value) delete style[normalizedName];
|
|
14289
|
-
else style[normalizedName] = value;
|
|
14290
|
-
if (priority === "important") style[normalizedName] += " !important";
|
|
14291
|
-
this.attributes.style = toCSSText(style);
|
|
14292
|
-
};
|
|
14293
|
-
style.removeProperty = (name) => {
|
|
14294
|
-
if (hyphenateRE2.test(name)) return "";
|
|
14295
|
-
const normalizedName = camelize(name);
|
|
14296
|
-
const value = style[normalizedName] || "";
|
|
14297
|
-
delete style[normalizedName];
|
|
14298
|
-
this.attributes.style = toCSSText(style);
|
|
14299
|
-
return value;
|
|
14300
|
-
};
|
|
14301
|
-
return style;
|
|
14302
|
-
}
|
|
14303
|
-
getAttribute(name) {
|
|
14304
|
-
if (this.attributes[name] === void 0) return null;
|
|
14305
|
-
return this.attributes[name];
|
|
14306
|
-
}
|
|
14307
|
-
setAttribute(name, attribute) {
|
|
14308
|
-
this.attributes[name] = attribute;
|
|
14309
|
-
}
|
|
14310
|
-
setAttributeNS(_namespace, qualifiedName, value) {
|
|
14311
|
-
this.setAttribute(qualifiedName, value);
|
|
14312
|
-
}
|
|
14313
|
-
removeAttribute(name) {
|
|
14314
|
-
delete this.attributes[name];
|
|
14315
|
-
}
|
|
14316
|
-
appendChild(newChild) {
|
|
14317
|
-
return appendChild(this, newChild);
|
|
14318
|
-
}
|
|
14319
|
-
insertBefore(newChild, refChild) {
|
|
14320
|
-
return insertBefore(this, newChild, refChild);
|
|
14321
|
-
}
|
|
14322
|
-
removeChild(node2) {
|
|
14323
|
-
return removeChild(this, node2);
|
|
14324
|
-
}
|
|
14325
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14326
|
-
attachShadow(_init) {
|
|
14327
|
-
const shadowRoot2 = this.ownerDocument.createElement("SHADOWROOT");
|
|
14328
|
-
this.shadowRoot = shadowRoot2;
|
|
14329
|
-
return shadowRoot2;
|
|
14330
|
-
}
|
|
14331
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14332
|
-
dispatchEvent(_event) {
|
|
14333
|
-
return true;
|
|
14334
|
-
}
|
|
14335
|
-
toString() {
|
|
14336
|
-
let attributeString = "";
|
|
14337
|
-
for (const attribute in this.attributes) {
|
|
14338
|
-
attributeString += `${attribute}="${this.attributes[attribute]}" `;
|
|
14339
|
-
}
|
|
14340
|
-
return `${this.tagName} ${attributeString}`;
|
|
14341
|
-
}
|
|
14342
|
-
}
|
|
14343
|
-
class BaseRRMediaElement extends BaseRRElement {
|
|
14344
|
-
constructor() {
|
|
14345
|
-
super(...arguments);
|
|
14346
|
-
__publicField22(this, "currentTime");
|
|
14347
|
-
__publicField22(this, "volume");
|
|
14348
|
-
__publicField22(this, "paused");
|
|
14349
|
-
__publicField22(this, "muted");
|
|
14350
|
-
__publicField22(this, "playbackRate");
|
|
14351
|
-
__publicField22(this, "loop");
|
|
14352
|
-
}
|
|
14353
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14354
|
-
attachShadow(_init) {
|
|
14355
|
-
throw new Error(
|
|
14356
|
-
`RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow`
|
|
14357
|
-
);
|
|
14358
|
-
}
|
|
14359
|
-
play() {
|
|
14360
|
-
this.paused = false;
|
|
14361
|
-
}
|
|
14362
|
-
pause() {
|
|
14363
|
-
this.paused = true;
|
|
14364
|
-
}
|
|
14365
|
-
}
|
|
14366
|
-
class BaseRRDialogElement extends BaseRRElement {
|
|
14367
|
-
constructor() {
|
|
14368
|
-
super(...arguments);
|
|
14369
|
-
__publicField22(this, "tagName", "DIALOG");
|
|
14370
|
-
__publicField22(this, "nodeName", "DIALOG");
|
|
14371
|
-
}
|
|
14372
|
-
get isModal() {
|
|
14373
|
-
return this.getAttribute("rr_open_mode") === "modal";
|
|
14374
|
-
}
|
|
14375
|
-
get open() {
|
|
14376
|
-
return this.getAttribute("open") !== null;
|
|
14377
|
-
}
|
|
14378
|
-
close() {
|
|
14379
|
-
this.removeAttribute("open");
|
|
14380
|
-
this.removeAttribute("rr_open_mode");
|
|
14381
|
-
}
|
|
14382
|
-
show() {
|
|
14383
|
-
this.setAttribute("open", "");
|
|
14384
|
-
this.setAttribute("rr_open_mode", "non-modal");
|
|
14385
|
-
}
|
|
14386
|
-
showModal() {
|
|
14387
|
-
this.setAttribute("open", "");
|
|
14388
|
-
this.setAttribute("rr_open_mode", "modal");
|
|
14389
|
-
}
|
|
14390
|
-
}
|
|
14391
|
-
class BaseRRText extends BaseRRNode {
|
|
14392
|
-
constructor(data) {
|
|
14393
|
-
super();
|
|
14394
|
-
__publicField22(this, "nodeType", 3);
|
|
14395
|
-
__publicField22(this, "nodeName", "#text");
|
|
14396
|
-
__publicField22(this, "RRNodeType", NodeType$1.Text);
|
|
14397
|
-
__publicField22(this, "data");
|
|
14398
|
-
this.data = data;
|
|
14399
|
-
}
|
|
14400
|
-
get textContent() {
|
|
14401
|
-
return this.data;
|
|
14402
|
-
}
|
|
14403
|
-
set textContent(textContent2) {
|
|
14404
|
-
this.data = textContent2;
|
|
14405
|
-
}
|
|
14406
|
-
toString() {
|
|
14407
|
-
return `RRText text=${JSON.stringify(this.data)}`;
|
|
14408
|
-
}
|
|
14409
|
-
}
|
|
14410
|
-
class BaseRRComment extends BaseRRNode {
|
|
14411
|
-
constructor(data) {
|
|
14412
|
-
super();
|
|
14413
|
-
__publicField22(this, "nodeType", 8);
|
|
14414
|
-
__publicField22(this, "nodeName", "#comment");
|
|
14415
|
-
__publicField22(this, "RRNodeType", NodeType$1.Comment);
|
|
14416
|
-
__publicField22(this, "data");
|
|
14417
|
-
this.data = data;
|
|
14418
|
-
}
|
|
14419
|
-
get textContent() {
|
|
14420
|
-
return this.data;
|
|
14421
|
-
}
|
|
14422
|
-
set textContent(textContent2) {
|
|
14423
|
-
this.data = textContent2;
|
|
14424
|
-
}
|
|
14425
|
-
toString() {
|
|
14426
|
-
return `RRComment text=${JSON.stringify(this.data)}`;
|
|
14427
|
-
}
|
|
14428
|
-
}
|
|
14429
|
-
class BaseRRCDATASection extends BaseRRNode {
|
|
14430
|
-
constructor(data) {
|
|
14431
|
-
super();
|
|
14432
|
-
__publicField22(this, "nodeName", "#cdata-section");
|
|
14433
|
-
__publicField22(this, "nodeType", 4);
|
|
14434
|
-
__publicField22(this, "RRNodeType", NodeType$1.CDATA);
|
|
14435
|
-
__publicField22(this, "data");
|
|
14436
|
-
this.data = data;
|
|
14437
|
-
}
|
|
14438
|
-
get textContent() {
|
|
14439
|
-
return this.data;
|
|
14440
|
-
}
|
|
14441
|
-
set textContent(textContent2) {
|
|
14442
|
-
this.data = textContent2;
|
|
14443
|
-
}
|
|
14444
|
-
toString() {
|
|
14445
|
-
return `RRCDATASection data=${JSON.stringify(this.data)}`;
|
|
14446
|
-
}
|
|
14447
|
-
}
|
|
14448
|
-
class ClassList {
|
|
14449
|
-
constructor(classText, onChange) {
|
|
14450
|
-
__publicField22(this, "onChange");
|
|
14451
|
-
__publicField22(this, "classes", []);
|
|
14452
|
-
__publicField22(this, "add", (...classNames) => {
|
|
14453
|
-
for (const item of classNames) {
|
|
14454
|
-
const className = String(item);
|
|
14455
|
-
if (this.classes.indexOf(className) >= 0) continue;
|
|
14456
|
-
this.classes.push(className);
|
|
14457
|
-
}
|
|
14458
|
-
this.onChange && this.onChange(this.classes.join(" "));
|
|
14459
|
-
});
|
|
14460
|
-
__publicField22(this, "remove", (...classNames) => {
|
|
14461
|
-
this.classes = this.classes.filter(
|
|
14462
|
-
(item) => classNames.indexOf(item) === -1
|
|
14463
|
-
);
|
|
14464
|
-
this.onChange && this.onChange(this.classes.join(" "));
|
|
14465
|
-
});
|
|
14466
|
-
if (classText) {
|
|
14467
|
-
const classes = classText.trim().split(/\s+/);
|
|
14468
|
-
this.classes.push(...classes);
|
|
14469
|
-
}
|
|
14470
|
-
this.onChange = onChange;
|
|
14471
|
-
}
|
|
14472
|
-
}
|
|
14473
|
-
function appendChild(parent, newChild) {
|
|
14474
|
-
if (newChild.parentNode) newChild.parentNode.removeChild(newChild);
|
|
14475
|
-
if (parent.lastChild) {
|
|
14476
|
-
parent.lastChild.nextSibling = newChild;
|
|
14477
|
-
newChild.previousSibling = parent.lastChild;
|
|
14478
|
-
} else {
|
|
14479
|
-
parent.firstChild = newChild;
|
|
14480
|
-
newChild.previousSibling = null;
|
|
14481
|
-
}
|
|
14482
|
-
parent.lastChild = newChild;
|
|
14483
|
-
newChild.nextSibling = null;
|
|
14484
|
-
newChild.parentNode = parent;
|
|
14485
|
-
newChild.parentElement = parent;
|
|
14486
|
-
newChild.ownerDocument = parent.ownerDocument;
|
|
14487
|
-
return newChild;
|
|
14488
|
-
}
|
|
14489
|
-
function insertBefore(parent, newChild, refChild) {
|
|
14490
|
-
if (!refChild) return appendChild(parent, newChild);
|
|
14491
|
-
if (refChild.parentNode !== parent)
|
|
14492
|
-
throw new Error(
|
|
14493
|
-
"Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode."
|
|
14494
|
-
);
|
|
14495
|
-
if (newChild === refChild) return newChild;
|
|
14496
|
-
if (newChild.parentNode) newChild.parentNode.removeChild(newChild);
|
|
14497
|
-
newChild.previousSibling = refChild.previousSibling;
|
|
14498
|
-
refChild.previousSibling = newChild;
|
|
14499
|
-
newChild.nextSibling = refChild;
|
|
14500
|
-
if (newChild.previousSibling) newChild.previousSibling.nextSibling = newChild;
|
|
14501
|
-
else parent.firstChild = newChild;
|
|
14502
|
-
newChild.parentElement = parent;
|
|
14503
|
-
newChild.parentNode = parent;
|
|
14504
|
-
newChild.ownerDocument = parent.ownerDocument;
|
|
14505
|
-
return newChild;
|
|
14506
|
-
}
|
|
14507
|
-
function removeChild(parent, child2) {
|
|
14508
|
-
if (child2.parentNode !== parent)
|
|
14509
|
-
throw new Error(
|
|
14510
|
-
"Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode."
|
|
14511
|
-
);
|
|
14512
|
-
if (child2.previousSibling)
|
|
14513
|
-
child2.previousSibling.nextSibling = child2.nextSibling;
|
|
14514
|
-
else parent.firstChild = child2.nextSibling;
|
|
14515
|
-
if (child2.nextSibling)
|
|
14516
|
-
child2.nextSibling.previousSibling = child2.previousSibling;
|
|
14517
|
-
else parent.lastChild = child2.previousSibling;
|
|
14518
|
-
child2.previousSibling = null;
|
|
14519
|
-
child2.nextSibling = null;
|
|
14520
|
-
child2.parentElement = null;
|
|
14521
|
-
child2.parentNode = null;
|
|
14522
|
-
return child2;
|
|
14523
|
-
}
|
|
14524
|
-
var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
|
|
14525
|
-
NodeType2[NodeType2["PLACEHOLDER"] = 0] = "PLACEHOLDER";
|
|
14526
|
-
NodeType2[NodeType2["ELEMENT_NODE"] = 1] = "ELEMENT_NODE";
|
|
14527
|
-
NodeType2[NodeType2["ATTRIBUTE_NODE"] = 2] = "ATTRIBUTE_NODE";
|
|
14528
|
-
NodeType2[NodeType2["TEXT_NODE"] = 3] = "TEXT_NODE";
|
|
14529
|
-
NodeType2[NodeType2["CDATA_SECTION_NODE"] = 4] = "CDATA_SECTION_NODE";
|
|
14530
|
-
NodeType2[NodeType2["ENTITY_REFERENCE_NODE"] = 5] = "ENTITY_REFERENCE_NODE";
|
|
14531
|
-
NodeType2[NodeType2["ENTITY_NODE"] = 6] = "ENTITY_NODE";
|
|
14532
|
-
NodeType2[NodeType2["PROCESSING_INSTRUCTION_NODE"] = 7] = "PROCESSING_INSTRUCTION_NODE";
|
|
14533
|
-
NodeType2[NodeType2["COMMENT_NODE"] = 8] = "COMMENT_NODE";
|
|
14534
|
-
NodeType2[NodeType2["DOCUMENT_NODE"] = 9] = "DOCUMENT_NODE";
|
|
14535
|
-
NodeType2[NodeType2["DOCUMENT_TYPE_NODE"] = 10] = "DOCUMENT_TYPE_NODE";
|
|
14536
|
-
NodeType2[NodeType2["DOCUMENT_FRAGMENT_NODE"] = 11] = "DOCUMENT_FRAGMENT_NODE";
|
|
14537
|
-
return NodeType2;
|
|
14538
|
-
})(NodeType$2 || {});
|
|
14539
|
-
const NAMESPACES = {
|
|
14540
|
-
svg: "http://www.w3.org/2000/svg",
|
|
14541
|
-
"xlink:href": "http://www.w3.org/1999/xlink",
|
|
14542
|
-
xmlns: "http://www.w3.org/2000/xmlns/"
|
|
14543
|
-
};
|
|
14544
|
-
const SVGTagMap = {
|
|
14545
|
-
altglyph: "altGlyph",
|
|
14546
|
-
altglyphdef: "altGlyphDef",
|
|
14547
|
-
altglyphitem: "altGlyphItem",
|
|
14548
|
-
animatecolor: "animateColor",
|
|
14549
|
-
animatemotion: "animateMotion",
|
|
14550
|
-
animatetransform: "animateTransform",
|
|
14551
|
-
clippath: "clipPath",
|
|
14552
|
-
feblend: "feBlend",
|
|
14553
|
-
fecolormatrix: "feColorMatrix",
|
|
14554
|
-
fecomponenttransfer: "feComponentTransfer",
|
|
14555
|
-
fecomposite: "feComposite",
|
|
14556
|
-
feconvolvematrix: "feConvolveMatrix",
|
|
14557
|
-
fediffuselighting: "feDiffuseLighting",
|
|
14558
|
-
fedisplacementmap: "feDisplacementMap",
|
|
14559
|
-
fedistantlight: "feDistantLight",
|
|
14560
|
-
fedropshadow: "feDropShadow",
|
|
14561
|
-
feflood: "feFlood",
|
|
14562
|
-
fefunca: "feFuncA",
|
|
14563
|
-
fefuncb: "feFuncB",
|
|
14564
|
-
fefuncg: "feFuncG",
|
|
14565
|
-
fefuncr: "feFuncR",
|
|
14566
|
-
fegaussianblur: "feGaussianBlur",
|
|
14567
|
-
feimage: "feImage",
|
|
14568
|
-
femerge: "feMerge",
|
|
14569
|
-
femergenode: "feMergeNode",
|
|
14570
|
-
femorphology: "feMorphology",
|
|
14571
|
-
feoffset: "feOffset",
|
|
14572
|
-
fepointlight: "fePointLight",
|
|
14573
|
-
fespecularlighting: "feSpecularLighting",
|
|
14574
|
-
fespotlight: "feSpotLight",
|
|
14575
|
-
fetile: "feTile",
|
|
14576
|
-
feturbulence: "feTurbulence",
|
|
14577
|
-
foreignobject: "foreignObject",
|
|
14578
|
-
glyphref: "glyphRef",
|
|
14579
|
-
lineargradient: "linearGradient",
|
|
14580
|
-
radialgradient: "radialGradient"
|
|
14581
|
-
};
|
|
14582
|
-
let createdNodeSet = null;
|
|
14583
|
-
function diff(oldTree, newTree, replayer, rrnodeMirror = newTree.mirror || newTree.ownerDocument.mirror) {
|
|
14584
|
-
oldTree = diffBeforeUpdatingChildren(
|
|
14585
|
-
oldTree,
|
|
14586
|
-
newTree,
|
|
14587
|
-
replayer,
|
|
14588
|
-
rrnodeMirror
|
|
14589
|
-
);
|
|
14590
|
-
diffChildren(oldTree, newTree, replayer, rrnodeMirror);
|
|
14591
|
-
diffAfterUpdatingChildren(oldTree, newTree, replayer);
|
|
14592
|
-
}
|
|
14593
|
-
function diffBeforeUpdatingChildren(oldTree, newTree, replayer, rrnodeMirror) {
|
|
14594
|
-
var _a22;
|
|
14595
|
-
if (replayer.afterAppend && !createdNodeSet) {
|
|
14596
|
-
createdNodeSet = /* @__PURE__ */ new WeakSet();
|
|
14597
|
-
setTimeout(() => {
|
|
14598
|
-
createdNodeSet = null;
|
|
14599
|
-
}, 0);
|
|
14600
|
-
}
|
|
14601
|
-
if (!sameNodeType(oldTree, newTree)) {
|
|
14602
|
-
const calibratedOldTree = createOrGetNode(
|
|
14603
|
-
newTree,
|
|
14604
|
-
replayer.mirror,
|
|
14605
|
-
rrnodeMirror
|
|
14606
|
-
);
|
|
14607
|
-
(_a22 = oldTree.parentNode) == null ? void 0 : _a22.replaceChild(calibratedOldTree, oldTree);
|
|
14608
|
-
oldTree = calibratedOldTree;
|
|
14609
|
-
}
|
|
14610
|
-
switch (newTree.RRNodeType) {
|
|
14611
|
-
case NodeType$1.Document: {
|
|
14612
|
-
if (!nodeMatching(oldTree, newTree, replayer.mirror, rrnodeMirror)) {
|
|
14613
|
-
const newMeta = rrnodeMirror.getMeta(newTree);
|
|
14614
|
-
if (newMeta) {
|
|
14615
|
-
replayer.mirror.removeNodeFromMap(oldTree);
|
|
14616
|
-
oldTree.close();
|
|
14617
|
-
oldTree.open();
|
|
14618
|
-
replayer.mirror.add(oldTree, newMeta);
|
|
14619
|
-
createdNodeSet == null ? void 0 : createdNodeSet.add(oldTree);
|
|
14620
|
-
}
|
|
14621
|
-
}
|
|
14622
|
-
break;
|
|
14623
|
-
}
|
|
14624
|
-
case NodeType$1.Element: {
|
|
14625
|
-
const oldElement = oldTree;
|
|
14626
|
-
const newRRElement = newTree;
|
|
14627
|
-
switch (newRRElement.tagName) {
|
|
14628
|
-
case "IFRAME": {
|
|
14629
|
-
const oldContentDocument = oldTree.contentDocument;
|
|
14630
|
-
if (!oldContentDocument) break;
|
|
14631
|
-
diff(
|
|
14632
|
-
oldContentDocument,
|
|
14633
|
-
newTree.contentDocument,
|
|
14634
|
-
replayer,
|
|
14635
|
-
rrnodeMirror
|
|
14636
|
-
);
|
|
14637
|
-
break;
|
|
14638
|
-
}
|
|
14639
|
-
}
|
|
14640
|
-
if (newRRElement.shadowRoot) {
|
|
14641
|
-
if (!oldElement.shadowRoot) oldElement.attachShadow({ mode: "open" });
|
|
14642
|
-
diffChildren(
|
|
14643
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
14644
|
-
oldElement.shadowRoot,
|
|
14645
|
-
newRRElement.shadowRoot,
|
|
14646
|
-
replayer,
|
|
14647
|
-
rrnodeMirror
|
|
14648
|
-
);
|
|
14649
|
-
}
|
|
14650
|
-
diffProps(oldElement, newRRElement, rrnodeMirror);
|
|
14651
|
-
break;
|
|
14126
|
+
diffProps(oldElement, newRRElement, rrnodeMirror);
|
|
14127
|
+
break;
|
|
14652
14128
|
}
|
|
14653
14129
|
}
|
|
14654
14130
|
return oldTree;
|
|
@@ -14810,7 +14286,13 @@ function diffChildren(oldTree, newTree, replayer, rrnodeMirror) {
|
|
|
14810
14286
|
nodeMatching(oldStartNode, newEndNode, replayer.mirror, rrnodeMirror)
|
|
14811
14287
|
) {
|
|
14812
14288
|
try {
|
|
14813
|
-
|
|
14289
|
+
insertPreservingCSSOM(
|
|
14290
|
+
oldTree,
|
|
14291
|
+
oldStartNode,
|
|
14292
|
+
oldEndNode.nextSibling,
|
|
14293
|
+
replayer.mirror,
|
|
14294
|
+
rrnodeMirror
|
|
14295
|
+
);
|
|
14814
14296
|
} catch (e2) {
|
|
14815
14297
|
console.warn(e2);
|
|
14816
14298
|
}
|
|
@@ -14821,7 +14303,13 @@ function diffChildren(oldTree, newTree, replayer, rrnodeMirror) {
|
|
|
14821
14303
|
nodeMatching(oldEndNode, newStartNode, replayer.mirror, rrnodeMirror)
|
|
14822
14304
|
) {
|
|
14823
14305
|
try {
|
|
14824
|
-
|
|
14306
|
+
insertPreservingCSSOM(
|
|
14307
|
+
oldTree,
|
|
14308
|
+
oldEndNode,
|
|
14309
|
+
oldStartNode,
|
|
14310
|
+
replayer.mirror,
|
|
14311
|
+
rrnodeMirror
|
|
14312
|
+
);
|
|
14825
14313
|
} catch (e2) {
|
|
14826
14314
|
console.warn(e2);
|
|
14827
14315
|
}
|
|
@@ -14840,7 +14328,13 @@ function diffChildren(oldTree, newTree, replayer, rrnodeMirror) {
|
|
|
14840
14328
|
const nodeToMove = oldChildren[indexInOld];
|
|
14841
14329
|
if (indexInOld !== void 0 && nodeToMove && nodeMatching(nodeToMove, newStartNode, replayer.mirror, rrnodeMirror)) {
|
|
14842
14330
|
try {
|
|
14843
|
-
|
|
14331
|
+
insertPreservingCSSOM(
|
|
14332
|
+
oldTree,
|
|
14333
|
+
nodeToMove,
|
|
14334
|
+
oldStartNode,
|
|
14335
|
+
replayer.mirror,
|
|
14336
|
+
rrnodeMirror
|
|
14337
|
+
);
|
|
14844
14338
|
} catch (e2) {
|
|
14845
14339
|
console.warn(e2);
|
|
14846
14340
|
}
|
|
@@ -14851,119 +14345,709 @@ function diffChildren(oldTree, newTree, replayer, rrnodeMirror) {
|
|
|
14851
14345
|
replayer.mirror,
|
|
14852
14346
|
rrnodeMirror
|
|
14853
14347
|
);
|
|
14854
|
-
if (oldTree.nodeName === "#document" && oldStartNode && /**
|
|
14855
|
-
* Special case 1: one document isn't allowed to have two doctype nodes at the same time, so we need to remove the old one first before inserting the new one.
|
|
14856
|
-
* How this case happens: A parent document in the old tree already has a doctype node with an id e.g. #1. A new full snapshot rebuilds the replayer with a new doctype node with another id #2. According to the algorithm, the new doctype node will be inserted before the old one, which is not allowed by the Document standard.
|
|
14857
|
-
*/
|
|
14858
|
-
(newNode.nodeType === newNode.DOCUMENT_TYPE_NODE && oldStartNode.nodeType === oldStartNode.DOCUMENT_TYPE_NODE || /**
|
|
14859
|
-
* Special case 2: one document isn't allowed to have two HTMLElements at the same time, so we need to remove the old one first before inserting the new one.
|
|
14860
|
-
* How this case happens: A mounted iframe element has an automatically created HTML element. We should delete it before inserting a serialized one. Otherwise, an error 'Only one element on document allowed' will be thrown.
|
|
14861
|
-
*/
|
|
14862
|
-
newNode.nodeType === newNode.ELEMENT_NODE && oldStartNode.nodeType === oldStartNode.ELEMENT_NODE)) {
|
|
14863
|
-
oldTree.removeChild(oldStartNode);
|
|
14864
|
-
replayer.mirror.removeNodeFromMap(oldStartNode);
|
|
14865
|
-
oldStartNode = oldChildren[++oldStartIndex];
|
|
14866
|
-
}
|
|
14867
|
-
try {
|
|
14868
|
-
|
|
14869
|
-
|
|
14870
|
-
|
|
14871
|
-
|
|
14348
|
+
if (oldTree.nodeName === "#document" && oldStartNode && /**
|
|
14349
|
+
* Special case 1: one document isn't allowed to have two doctype nodes at the same time, so we need to remove the old one first before inserting the new one.
|
|
14350
|
+
* How this case happens: A parent document in the old tree already has a doctype node with an id e.g. #1. A new full snapshot rebuilds the replayer with a new doctype node with another id #2. According to the algorithm, the new doctype node will be inserted before the old one, which is not allowed by the Document standard.
|
|
14351
|
+
*/
|
|
14352
|
+
(newNode.nodeType === newNode.DOCUMENT_TYPE_NODE && oldStartNode.nodeType === oldStartNode.DOCUMENT_TYPE_NODE || /**
|
|
14353
|
+
* Special case 2: one document isn't allowed to have two HTMLElements at the same time, so we need to remove the old one first before inserting the new one.
|
|
14354
|
+
* How this case happens: A mounted iframe element has an automatically created HTML element. We should delete it before inserting a serialized one. Otherwise, an error 'Only one element on document allowed' will be thrown.
|
|
14355
|
+
*/
|
|
14356
|
+
newNode.nodeType === newNode.ELEMENT_NODE && oldStartNode.nodeType === oldStartNode.ELEMENT_NODE)) {
|
|
14357
|
+
oldTree.removeChild(oldStartNode);
|
|
14358
|
+
replayer.mirror.removeNodeFromMap(oldStartNode);
|
|
14359
|
+
oldStartNode = oldChildren[++oldStartIndex];
|
|
14360
|
+
}
|
|
14361
|
+
try {
|
|
14362
|
+
insertPreservingCSSOM(
|
|
14363
|
+
oldTree,
|
|
14364
|
+
newNode,
|
|
14365
|
+
oldStartNode || null,
|
|
14366
|
+
replayer.mirror,
|
|
14367
|
+
rrnodeMirror
|
|
14368
|
+
);
|
|
14369
|
+
} catch (e2) {
|
|
14370
|
+
console.warn(e2);
|
|
14371
|
+
}
|
|
14372
|
+
}
|
|
14373
|
+
newStartNode = newChildren[++newStartIndex];
|
|
14374
|
+
}
|
|
14375
|
+
}
|
|
14376
|
+
if (oldStartIndex > oldEndIndex) {
|
|
14377
|
+
const referenceRRNode = newChildren[newEndIndex + 1];
|
|
14378
|
+
let referenceNode = null;
|
|
14379
|
+
if (referenceRRNode)
|
|
14380
|
+
referenceNode = replayer.mirror.getNode(
|
|
14381
|
+
rrnodeMirror.getId(referenceRRNode)
|
|
14382
|
+
);
|
|
14383
|
+
for (; newStartIndex <= newEndIndex; ++newStartIndex) {
|
|
14384
|
+
const newNode = createOrGetNode(
|
|
14385
|
+
newChildren[newStartIndex],
|
|
14386
|
+
replayer.mirror,
|
|
14387
|
+
rrnodeMirror
|
|
14388
|
+
);
|
|
14389
|
+
try {
|
|
14390
|
+
insertPreservingCSSOM(
|
|
14391
|
+
oldTree,
|
|
14392
|
+
newNode,
|
|
14393
|
+
referenceNode,
|
|
14394
|
+
replayer.mirror,
|
|
14395
|
+
rrnodeMirror
|
|
14396
|
+
);
|
|
14397
|
+
} catch (e2) {
|
|
14398
|
+
console.warn(e2);
|
|
14399
|
+
}
|
|
14400
|
+
}
|
|
14401
|
+
} else if (newStartIndex > newEndIndex) {
|
|
14402
|
+
for (; oldStartIndex <= oldEndIndex; oldStartIndex++) {
|
|
14403
|
+
const node2 = oldChildren[oldStartIndex];
|
|
14404
|
+
if (!node2 || node2.parentNode !== oldTree) continue;
|
|
14405
|
+
try {
|
|
14406
|
+
oldTree.removeChild(node2);
|
|
14407
|
+
replayer.mirror.removeNodeFromMap(node2);
|
|
14408
|
+
} catch (e2) {
|
|
14409
|
+
console.warn(e2);
|
|
14410
|
+
}
|
|
14411
|
+
}
|
|
14412
|
+
}
|
|
14413
|
+
let oldChild = oldTree.firstChild;
|
|
14414
|
+
let newChild = newTree.firstChild;
|
|
14415
|
+
while (oldChild !== null && newChild !== null) {
|
|
14416
|
+
diff(oldChild, newChild, replayer, rrnodeMirror);
|
|
14417
|
+
oldChild = oldChild.nextSibling;
|
|
14418
|
+
newChild = newChild.nextSibling;
|
|
14419
|
+
}
|
|
14420
|
+
}
|
|
14421
|
+
const nodesBuiltFromDom = /* @__PURE__ */ new WeakSet();
|
|
14422
|
+
function insertPreservingCSSOM(parent, node2, referenceNode, domMirror, rrnodeMirror) {
|
|
14423
|
+
const saved = node2.isConnected ? collectStyleRules(node2).filter(([styleElement]) => {
|
|
14424
|
+
const rrNode = rrnodeMirror.getNode(domMirror.getId(styleElement));
|
|
14425
|
+
return rrNode !== null && nodesBuiltFromDom.has(rrNode);
|
|
14426
|
+
}) : [];
|
|
14427
|
+
parent.insertBefore(node2, referenceNode);
|
|
14428
|
+
for (const [styleElement, rules2] of saved)
|
|
14429
|
+
restoreStyleRules(styleElement, rules2);
|
|
14430
|
+
}
|
|
14431
|
+
function collectStyleRules(node2) {
|
|
14432
|
+
if (node2.nodeType !== node2.ELEMENT_NODE) return [];
|
|
14433
|
+
const styleElements = [];
|
|
14434
|
+
const collect = (element) => {
|
|
14435
|
+
if (element.localName === "style")
|
|
14436
|
+
styleElements.push(element);
|
|
14437
|
+
if (element.shadowRoot)
|
|
14438
|
+
for (const child2 of Array.from(element.shadowRoot.children))
|
|
14439
|
+
collect(child2);
|
|
14440
|
+
for (const child2 of Array.from(element.children)) collect(child2);
|
|
14441
|
+
};
|
|
14442
|
+
collect(node2);
|
|
14443
|
+
const saved = [];
|
|
14444
|
+
for (const styleElement of styleElements) {
|
|
14445
|
+
try {
|
|
14446
|
+
const sheet = styleElement.sheet;
|
|
14447
|
+
if (sheet)
|
|
14448
|
+
saved.push([
|
|
14449
|
+
styleElement,
|
|
14450
|
+
Array.from(sheet.cssRules, (rule2) => rule2.cssText)
|
|
14451
|
+
]);
|
|
14452
|
+
} catch (e2) {
|
|
14453
|
+
}
|
|
14454
|
+
}
|
|
14455
|
+
return saved;
|
|
14456
|
+
}
|
|
14457
|
+
function restoreStyleRules(styleElement, rules2) {
|
|
14458
|
+
try {
|
|
14459
|
+
const sheet = styleElement.sheet;
|
|
14460
|
+
if (!sheet) return;
|
|
14461
|
+
const current = sheet.cssRules;
|
|
14462
|
+
if (current.length === rules2.length && rules2.every((rule2, i2) => current[i2].cssText === rule2))
|
|
14463
|
+
return;
|
|
14464
|
+
while (sheet.cssRules.length > 0)
|
|
14465
|
+
sheet.deleteRule(sheet.cssRules.length - 1);
|
|
14466
|
+
for (const rule2 of rules2) {
|
|
14467
|
+
try {
|
|
14468
|
+
sheet.insertRule(rule2, sheet.cssRules.length);
|
|
14469
|
+
} catch (e2) {
|
|
14470
|
+
}
|
|
14471
|
+
}
|
|
14472
|
+
} catch (e2) {
|
|
14473
|
+
}
|
|
14474
|
+
}
|
|
14475
|
+
function createOrGetNode(rrNode, domMirror, rrnodeMirror) {
|
|
14476
|
+
const nodeId = rrnodeMirror.getId(rrNode);
|
|
14477
|
+
const sn = rrnodeMirror.getMeta(rrNode);
|
|
14478
|
+
let node2 = null;
|
|
14479
|
+
if (nodeId > -1) node2 = domMirror.getNode(nodeId);
|
|
14480
|
+
if (node2 !== null && sameNodeType(node2, rrNode)) return node2;
|
|
14481
|
+
switch (rrNode.RRNodeType) {
|
|
14482
|
+
case NodeType$1.Document:
|
|
14483
|
+
node2 = new Document();
|
|
14484
|
+
break;
|
|
14485
|
+
case NodeType$1.DocumentType:
|
|
14486
|
+
node2 = document.implementation.createDocumentType(
|
|
14487
|
+
rrNode.name,
|
|
14488
|
+
rrNode.publicId,
|
|
14489
|
+
rrNode.systemId
|
|
14490
|
+
);
|
|
14491
|
+
break;
|
|
14492
|
+
case NodeType$1.Element: {
|
|
14493
|
+
let tagName = rrNode.tagName.toLowerCase();
|
|
14494
|
+
tagName = SVGTagMap[tagName] || tagName;
|
|
14495
|
+
if (sn && "isSVG" in sn && (sn == null ? void 0 : sn.isSVG)) {
|
|
14496
|
+
node2 = document.createElementNS(NAMESPACES["svg"], tagName);
|
|
14497
|
+
} else node2 = document.createElement(rrNode.tagName);
|
|
14498
|
+
break;
|
|
14499
|
+
}
|
|
14500
|
+
case NodeType$1.Text:
|
|
14501
|
+
node2 = document.createTextNode(rrNode.data);
|
|
14502
|
+
break;
|
|
14503
|
+
case NodeType$1.Comment:
|
|
14504
|
+
node2 = document.createComment(rrNode.data);
|
|
14505
|
+
break;
|
|
14506
|
+
case NodeType$1.CDATA:
|
|
14507
|
+
node2 = document.createCDATASection(rrNode.data);
|
|
14508
|
+
break;
|
|
14509
|
+
}
|
|
14510
|
+
if (sn) domMirror.add(node2, { ...sn });
|
|
14511
|
+
try {
|
|
14512
|
+
createdNodeSet == null ? void 0 : createdNodeSet.add(node2);
|
|
14513
|
+
} catch (e2) {
|
|
14514
|
+
}
|
|
14515
|
+
return node2;
|
|
14516
|
+
}
|
|
14517
|
+
function sameNodeType(node1, node2) {
|
|
14518
|
+
if (node1.nodeType !== node2.nodeType) return false;
|
|
14519
|
+
return node1.nodeType !== node1.ELEMENT_NODE || node1.tagName.toUpperCase() === node2.tagName;
|
|
14520
|
+
}
|
|
14521
|
+
function nodeMatching(node1, node2, domMirror, rrdomMirror) {
|
|
14522
|
+
const node1Id = domMirror.getId(node1);
|
|
14523
|
+
const node2Id = rrdomMirror.getId(node2);
|
|
14524
|
+
if (node1Id === -1 || node1Id !== node2Id) return false;
|
|
14525
|
+
return sameNodeType(node1, node2);
|
|
14526
|
+
}
|
|
14527
|
+
function parseCSSText(cssText) {
|
|
14528
|
+
const res = {};
|
|
14529
|
+
const listDelimiter = /;(?![^(]*\))/g;
|
|
14530
|
+
const propertyDelimiter = /:(.+)/;
|
|
14531
|
+
const comment2 = /\/\*.*?\*\//g;
|
|
14532
|
+
cssText.replace(comment2, "").split(listDelimiter).forEach(function(item) {
|
|
14533
|
+
if (item) {
|
|
14534
|
+
const tmp = item.split(propertyDelimiter);
|
|
14535
|
+
tmp.length > 1 && (res[camelize(tmp[0].trim())] = tmp[1].trim());
|
|
14536
|
+
}
|
|
14537
|
+
});
|
|
14538
|
+
return res;
|
|
14539
|
+
}
|
|
14540
|
+
function toCSSText(style) {
|
|
14541
|
+
const properties = [];
|
|
14542
|
+
for (const name in style) {
|
|
14543
|
+
const value = style[name];
|
|
14544
|
+
if (typeof value !== "string") continue;
|
|
14545
|
+
const normalizedName = hyphenate(name);
|
|
14546
|
+
properties.push(`${normalizedName}: ${value};`);
|
|
14547
|
+
}
|
|
14548
|
+
return properties.join(" ");
|
|
14549
|
+
}
|
|
14550
|
+
const camelizeRE = /-([a-z])/g;
|
|
14551
|
+
const CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9-]+$/;
|
|
14552
|
+
const camelize = (str) => {
|
|
14553
|
+
if (CUSTOM_PROPERTY_REGEX.test(str)) return str;
|
|
14554
|
+
return str.replace(camelizeRE, (_, c2) => c2 ? c2.toUpperCase() : "");
|
|
14555
|
+
};
|
|
14556
|
+
const hyphenateRE = /\B([A-Z])/g;
|
|
14557
|
+
const hyphenate = (str) => {
|
|
14558
|
+
return str.replace(hyphenateRE, "-$1").toLowerCase();
|
|
14559
|
+
};
|
|
14560
|
+
class BaseRRNode {
|
|
14561
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
14562
|
+
constructor(..._args) {
|
|
14563
|
+
__publicField22(this, "parentElement", null);
|
|
14564
|
+
__publicField22(this, "parentNode", null);
|
|
14565
|
+
__publicField22(this, "ownerDocument");
|
|
14566
|
+
__publicField22(this, "firstChild", null);
|
|
14567
|
+
__publicField22(this, "lastChild", null);
|
|
14568
|
+
__publicField22(this, "previousSibling", null);
|
|
14569
|
+
__publicField22(this, "nextSibling", null);
|
|
14570
|
+
__publicField22(this, "ELEMENT_NODE", 1);
|
|
14571
|
+
__publicField22(this, "TEXT_NODE", 3);
|
|
14572
|
+
__publicField22(this, "nodeType");
|
|
14573
|
+
__publicField22(this, "nodeName");
|
|
14574
|
+
__publicField22(this, "RRNodeType");
|
|
14575
|
+
}
|
|
14576
|
+
get childNodes() {
|
|
14577
|
+
const childNodes2 = [];
|
|
14578
|
+
let childIterator = this.firstChild;
|
|
14579
|
+
while (childIterator) {
|
|
14580
|
+
childNodes2.push(childIterator);
|
|
14581
|
+
childIterator = childIterator.nextSibling;
|
|
14582
|
+
}
|
|
14583
|
+
return childNodes2;
|
|
14584
|
+
}
|
|
14585
|
+
contains(node2) {
|
|
14586
|
+
if (!(node2 instanceof BaseRRNode)) return false;
|
|
14587
|
+
else if (node2.ownerDocument !== this.ownerDocument) return false;
|
|
14588
|
+
else if (node2 === this) return true;
|
|
14589
|
+
while (node2.parentNode) {
|
|
14590
|
+
if (node2.parentNode === this) return true;
|
|
14591
|
+
node2 = node2.parentNode;
|
|
14592
|
+
}
|
|
14593
|
+
return false;
|
|
14594
|
+
}
|
|
14595
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14596
|
+
appendChild(_newChild) {
|
|
14597
|
+
throw new Error(
|
|
14598
|
+
`RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.`
|
|
14599
|
+
);
|
|
14600
|
+
}
|
|
14601
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14602
|
+
insertBefore(_newChild, _refChild) {
|
|
14603
|
+
throw new Error(
|
|
14604
|
+
`RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.`
|
|
14605
|
+
);
|
|
14606
|
+
}
|
|
14607
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14608
|
+
removeChild(_node) {
|
|
14609
|
+
throw new Error(
|
|
14610
|
+
`RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.`
|
|
14611
|
+
);
|
|
14612
|
+
}
|
|
14613
|
+
toString() {
|
|
14614
|
+
return "RRNode";
|
|
14615
|
+
}
|
|
14616
|
+
}
|
|
14617
|
+
class BaseRRDocument extends BaseRRNode {
|
|
14618
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14619
|
+
constructor(...args) {
|
|
14620
|
+
super(args);
|
|
14621
|
+
__publicField22(this, "nodeType", 9);
|
|
14622
|
+
__publicField22(this, "nodeName", "#document");
|
|
14623
|
+
__publicField22(this, "compatMode", "CSS1Compat");
|
|
14624
|
+
__publicField22(this, "RRNodeType", NodeType$1.Document);
|
|
14625
|
+
__publicField22(this, "textContent", null);
|
|
14626
|
+
this.ownerDocument = this;
|
|
14627
|
+
}
|
|
14628
|
+
get documentElement() {
|
|
14629
|
+
return this.childNodes.find(
|
|
14630
|
+
(node2) => node2.RRNodeType === NodeType$1.Element && node2.tagName === "HTML"
|
|
14631
|
+
) || null;
|
|
14632
|
+
}
|
|
14633
|
+
get body() {
|
|
14634
|
+
var _a22;
|
|
14635
|
+
return ((_a22 = this.documentElement) == null ? void 0 : _a22.childNodes.find(
|
|
14636
|
+
(node2) => node2.RRNodeType === NodeType$1.Element && node2.tagName === "BODY"
|
|
14637
|
+
)) || null;
|
|
14638
|
+
}
|
|
14639
|
+
get head() {
|
|
14640
|
+
var _a22;
|
|
14641
|
+
return ((_a22 = this.documentElement) == null ? void 0 : _a22.childNodes.find(
|
|
14642
|
+
(node2) => node2.RRNodeType === NodeType$1.Element && node2.tagName === "HEAD"
|
|
14643
|
+
)) || null;
|
|
14644
|
+
}
|
|
14645
|
+
get implementation() {
|
|
14646
|
+
return this;
|
|
14647
|
+
}
|
|
14648
|
+
get firstElementChild() {
|
|
14649
|
+
return this.documentElement;
|
|
14650
|
+
}
|
|
14651
|
+
appendChild(newChild) {
|
|
14652
|
+
const nodeType = newChild.RRNodeType;
|
|
14653
|
+
if (nodeType === NodeType$1.Element || nodeType === NodeType$1.DocumentType) {
|
|
14654
|
+
if (this.childNodes.some((s2) => s2.RRNodeType === nodeType)) {
|
|
14655
|
+
throw new Error(
|
|
14656
|
+
`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${nodeType === NodeType$1.Element ? "RRElement" : "RRDoctype"} on RRDocument allowed.`
|
|
14657
|
+
);
|
|
14872
14658
|
}
|
|
14873
|
-
newStartNode = newChildren[++newStartIndex];
|
|
14874
14659
|
}
|
|
14660
|
+
const child2 = appendChild(this, newChild);
|
|
14661
|
+
child2.parentElement = null;
|
|
14662
|
+
return child2;
|
|
14875
14663
|
}
|
|
14876
|
-
|
|
14877
|
-
const
|
|
14878
|
-
|
|
14879
|
-
|
|
14880
|
-
|
|
14881
|
-
|
|
14882
|
-
|
|
14883
|
-
for (; newStartIndex <= newEndIndex; ++newStartIndex) {
|
|
14884
|
-
const newNode = createOrGetNode(
|
|
14885
|
-
newChildren[newStartIndex],
|
|
14886
|
-
replayer.mirror,
|
|
14887
|
-
rrnodeMirror
|
|
14888
|
-
);
|
|
14889
|
-
try {
|
|
14890
|
-
oldTree.insertBefore(newNode, referenceNode);
|
|
14891
|
-
} catch (e2) {
|
|
14892
|
-
console.warn(e2);
|
|
14664
|
+
insertBefore(newChild, refChild) {
|
|
14665
|
+
const nodeType = newChild.RRNodeType;
|
|
14666
|
+
if (nodeType === NodeType$1.Element || nodeType === NodeType$1.DocumentType) {
|
|
14667
|
+
if (this.childNodes.some((s2) => s2.RRNodeType === nodeType)) {
|
|
14668
|
+
throw new Error(
|
|
14669
|
+
`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${nodeType === NodeType$1.Element ? "RRElement" : "RRDoctype"} on RRDocument allowed.`
|
|
14670
|
+
);
|
|
14893
14671
|
}
|
|
14894
14672
|
}
|
|
14895
|
-
|
|
14896
|
-
|
|
14897
|
-
|
|
14898
|
-
|
|
14899
|
-
|
|
14900
|
-
|
|
14901
|
-
|
|
14902
|
-
|
|
14903
|
-
|
|
14673
|
+
const child2 = insertBefore(this, newChild, refChild);
|
|
14674
|
+
child2.parentElement = null;
|
|
14675
|
+
return child2;
|
|
14676
|
+
}
|
|
14677
|
+
removeChild(node2) {
|
|
14678
|
+
return removeChild(this, node2);
|
|
14679
|
+
}
|
|
14680
|
+
open() {
|
|
14681
|
+
this.firstChild = null;
|
|
14682
|
+
this.lastChild = null;
|
|
14683
|
+
}
|
|
14684
|
+
close() {
|
|
14685
|
+
}
|
|
14686
|
+
/**
|
|
14687
|
+
* Adhoc implementation for setting xhtml namespace in rebuilt.ts (rrweb-snapshot).
|
|
14688
|
+
* There are two lines used this function:
|
|
14689
|
+
* 1. doc.write('\<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""\>')
|
|
14690
|
+
* 2. doc.write('\<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ""\>')
|
|
14691
|
+
*/
|
|
14692
|
+
write(content) {
|
|
14693
|
+
let publicId;
|
|
14694
|
+
if (content === '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">')
|
|
14695
|
+
publicId = "-//W3C//DTD XHTML 1.0 Transitional//EN";
|
|
14696
|
+
else if (content === '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')
|
|
14697
|
+
publicId = "-//W3C//DTD HTML 4.0 Transitional//EN";
|
|
14698
|
+
if (publicId) {
|
|
14699
|
+
const doctype = this.createDocumentType("html", publicId, "");
|
|
14700
|
+
this.open();
|
|
14701
|
+
this.appendChild(doctype);
|
|
14702
|
+
}
|
|
14703
|
+
}
|
|
14704
|
+
createDocument(_namespace, _qualifiedName, _doctype) {
|
|
14705
|
+
return new BaseRRDocument();
|
|
14706
|
+
}
|
|
14707
|
+
createDocumentType(qualifiedName, publicId, systemId) {
|
|
14708
|
+
const doctype = new BaseRRDocumentType(qualifiedName, publicId, systemId);
|
|
14709
|
+
doctype.ownerDocument = this;
|
|
14710
|
+
return doctype;
|
|
14711
|
+
}
|
|
14712
|
+
createElement(tagName) {
|
|
14713
|
+
const element = new BaseRRElement(tagName);
|
|
14714
|
+
element.ownerDocument = this;
|
|
14715
|
+
return element;
|
|
14716
|
+
}
|
|
14717
|
+
createElementNS(_namespaceURI, qualifiedName) {
|
|
14718
|
+
return this.createElement(qualifiedName);
|
|
14719
|
+
}
|
|
14720
|
+
createTextNode(data) {
|
|
14721
|
+
const text = new BaseRRText(data);
|
|
14722
|
+
text.ownerDocument = this;
|
|
14723
|
+
return text;
|
|
14724
|
+
}
|
|
14725
|
+
createComment(data) {
|
|
14726
|
+
const comment2 = new BaseRRComment(data);
|
|
14727
|
+
comment2.ownerDocument = this;
|
|
14728
|
+
return comment2;
|
|
14729
|
+
}
|
|
14730
|
+
createCDATASection(data) {
|
|
14731
|
+
const CDATASection = new BaseRRCDATASection(data);
|
|
14732
|
+
CDATASection.ownerDocument = this;
|
|
14733
|
+
return CDATASection;
|
|
14734
|
+
}
|
|
14735
|
+
toString() {
|
|
14736
|
+
return "RRDocument";
|
|
14737
|
+
}
|
|
14738
|
+
}
|
|
14739
|
+
class BaseRRDocumentType extends BaseRRNode {
|
|
14740
|
+
constructor(qualifiedName, publicId, systemId) {
|
|
14741
|
+
super();
|
|
14742
|
+
__publicField22(this, "nodeType", 10);
|
|
14743
|
+
__publicField22(this, "RRNodeType", NodeType$1.DocumentType);
|
|
14744
|
+
__publicField22(this, "name");
|
|
14745
|
+
__publicField22(this, "publicId");
|
|
14746
|
+
__publicField22(this, "systemId");
|
|
14747
|
+
__publicField22(this, "textContent", null);
|
|
14748
|
+
this.name = qualifiedName;
|
|
14749
|
+
this.publicId = publicId;
|
|
14750
|
+
this.systemId = systemId;
|
|
14751
|
+
this.nodeName = qualifiedName;
|
|
14752
|
+
}
|
|
14753
|
+
toString() {
|
|
14754
|
+
return "RRDocumentType";
|
|
14755
|
+
}
|
|
14756
|
+
}
|
|
14757
|
+
class BaseRRElement extends BaseRRNode {
|
|
14758
|
+
constructor(tagName) {
|
|
14759
|
+
super();
|
|
14760
|
+
__publicField22(this, "nodeType", 1);
|
|
14761
|
+
__publicField22(this, "RRNodeType", NodeType$1.Element);
|
|
14762
|
+
__publicField22(this, "tagName");
|
|
14763
|
+
__publicField22(this, "attributes", {});
|
|
14764
|
+
__publicField22(this, "shadowRoot", null);
|
|
14765
|
+
__publicField22(this, "scrollLeft");
|
|
14766
|
+
__publicField22(this, "scrollTop");
|
|
14767
|
+
this.tagName = tagName.toUpperCase();
|
|
14768
|
+
this.nodeName = tagName.toUpperCase();
|
|
14769
|
+
}
|
|
14770
|
+
get textContent() {
|
|
14771
|
+
let result2 = "";
|
|
14772
|
+
this.childNodes.forEach((node2) => result2 += node2.textContent);
|
|
14773
|
+
return result2;
|
|
14774
|
+
}
|
|
14775
|
+
set textContent(textContent2) {
|
|
14776
|
+
this.firstChild = null;
|
|
14777
|
+
this.lastChild = null;
|
|
14778
|
+
this.appendChild(this.ownerDocument.createTextNode(textContent2));
|
|
14779
|
+
}
|
|
14780
|
+
get classList() {
|
|
14781
|
+
return new ClassList(
|
|
14782
|
+
this.attributes.class,
|
|
14783
|
+
(newClassName) => {
|
|
14784
|
+
this.attributes.class = newClassName;
|
|
14904
14785
|
}
|
|
14786
|
+
);
|
|
14787
|
+
}
|
|
14788
|
+
get id() {
|
|
14789
|
+
return this.attributes.id || "";
|
|
14790
|
+
}
|
|
14791
|
+
get className() {
|
|
14792
|
+
return this.attributes.class || "";
|
|
14793
|
+
}
|
|
14794
|
+
get style() {
|
|
14795
|
+
const style = this.attributes.style ? parseCSSText(this.attributes.style) : {};
|
|
14796
|
+
const hyphenateRE2 = /\B([A-Z])/g;
|
|
14797
|
+
style.setProperty = (name, value, priority) => {
|
|
14798
|
+
if (hyphenateRE2.test(name)) return;
|
|
14799
|
+
const normalizedName = camelize(name);
|
|
14800
|
+
if (!value) delete style[normalizedName];
|
|
14801
|
+
else style[normalizedName] = value;
|
|
14802
|
+
if (priority === "important") style[normalizedName] += " !important";
|
|
14803
|
+
this.attributes.style = toCSSText(style);
|
|
14804
|
+
};
|
|
14805
|
+
style.removeProperty = (name) => {
|
|
14806
|
+
if (hyphenateRE2.test(name)) return "";
|
|
14807
|
+
const normalizedName = camelize(name);
|
|
14808
|
+
const value = style[normalizedName] || "";
|
|
14809
|
+
delete style[normalizedName];
|
|
14810
|
+
this.attributes.style = toCSSText(style);
|
|
14811
|
+
return value;
|
|
14812
|
+
};
|
|
14813
|
+
return style;
|
|
14814
|
+
}
|
|
14815
|
+
getAttribute(name) {
|
|
14816
|
+
if (this.attributes[name] === void 0) return null;
|
|
14817
|
+
return this.attributes[name];
|
|
14818
|
+
}
|
|
14819
|
+
setAttribute(name, attribute) {
|
|
14820
|
+
this.attributes[name] = attribute;
|
|
14821
|
+
}
|
|
14822
|
+
setAttributeNS(_namespace, qualifiedName, value) {
|
|
14823
|
+
this.setAttribute(qualifiedName, value);
|
|
14824
|
+
}
|
|
14825
|
+
removeAttribute(name) {
|
|
14826
|
+
delete this.attributes[name];
|
|
14827
|
+
}
|
|
14828
|
+
appendChild(newChild) {
|
|
14829
|
+
return appendChild(this, newChild);
|
|
14830
|
+
}
|
|
14831
|
+
insertBefore(newChild, refChild) {
|
|
14832
|
+
return insertBefore(this, newChild, refChild);
|
|
14833
|
+
}
|
|
14834
|
+
removeChild(node2) {
|
|
14835
|
+
return removeChild(this, node2);
|
|
14836
|
+
}
|
|
14837
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14838
|
+
attachShadow(_init) {
|
|
14839
|
+
const shadowRoot2 = this.ownerDocument.createElement("SHADOWROOT");
|
|
14840
|
+
this.shadowRoot = shadowRoot2;
|
|
14841
|
+
return shadowRoot2;
|
|
14842
|
+
}
|
|
14843
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14844
|
+
dispatchEvent(_event) {
|
|
14845
|
+
return true;
|
|
14846
|
+
}
|
|
14847
|
+
toString() {
|
|
14848
|
+
let attributeString = "";
|
|
14849
|
+
for (const attribute in this.attributes) {
|
|
14850
|
+
attributeString += `${attribute}="${this.attributes[attribute]}" `;
|
|
14905
14851
|
}
|
|
14852
|
+
return `${this.tagName} ${attributeString}`;
|
|
14906
14853
|
}
|
|
14907
|
-
|
|
14908
|
-
|
|
14909
|
-
|
|
14910
|
-
|
|
14911
|
-
|
|
14912
|
-
|
|
14854
|
+
}
|
|
14855
|
+
class BaseRRMediaElement extends BaseRRElement {
|
|
14856
|
+
constructor() {
|
|
14857
|
+
super(...arguments);
|
|
14858
|
+
__publicField22(this, "currentTime");
|
|
14859
|
+
__publicField22(this, "volume");
|
|
14860
|
+
__publicField22(this, "paused");
|
|
14861
|
+
__publicField22(this, "muted");
|
|
14862
|
+
__publicField22(this, "playbackRate");
|
|
14863
|
+
__publicField22(this, "loop");
|
|
14864
|
+
}
|
|
14865
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14866
|
+
attachShadow(_init) {
|
|
14867
|
+
throw new Error(
|
|
14868
|
+
`RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow`
|
|
14869
|
+
);
|
|
14870
|
+
}
|
|
14871
|
+
play() {
|
|
14872
|
+
this.paused = false;
|
|
14873
|
+
}
|
|
14874
|
+
pause() {
|
|
14875
|
+
this.paused = true;
|
|
14913
14876
|
}
|
|
14914
14877
|
}
|
|
14915
|
-
|
|
14916
|
-
|
|
14917
|
-
|
|
14918
|
-
|
|
14919
|
-
|
|
14920
|
-
|
|
14921
|
-
|
|
14922
|
-
|
|
14923
|
-
|
|
14924
|
-
|
|
14925
|
-
|
|
14926
|
-
|
|
14927
|
-
|
|
14928
|
-
|
|
14929
|
-
|
|
14878
|
+
class BaseRRDialogElement extends BaseRRElement {
|
|
14879
|
+
constructor() {
|
|
14880
|
+
super(...arguments);
|
|
14881
|
+
__publicField22(this, "tagName", "DIALOG");
|
|
14882
|
+
__publicField22(this, "nodeName", "DIALOG");
|
|
14883
|
+
}
|
|
14884
|
+
get isModal() {
|
|
14885
|
+
return this.getAttribute("rr_open_mode") === "modal";
|
|
14886
|
+
}
|
|
14887
|
+
get open() {
|
|
14888
|
+
return this.getAttribute("open") !== null;
|
|
14889
|
+
}
|
|
14890
|
+
close() {
|
|
14891
|
+
this.removeAttribute("open");
|
|
14892
|
+
this.removeAttribute("rr_open_mode");
|
|
14893
|
+
}
|
|
14894
|
+
show() {
|
|
14895
|
+
this.setAttribute("open", "");
|
|
14896
|
+
this.setAttribute("rr_open_mode", "non-modal");
|
|
14897
|
+
}
|
|
14898
|
+
showModal() {
|
|
14899
|
+
this.setAttribute("open", "");
|
|
14900
|
+
this.setAttribute("rr_open_mode", "modal");
|
|
14901
|
+
}
|
|
14902
|
+
}
|
|
14903
|
+
class BaseRRText extends BaseRRNode {
|
|
14904
|
+
constructor(data) {
|
|
14905
|
+
super();
|
|
14906
|
+
__publicField22(this, "nodeType", 3);
|
|
14907
|
+
__publicField22(this, "nodeName", "#text");
|
|
14908
|
+
__publicField22(this, "RRNodeType", NodeType$1.Text);
|
|
14909
|
+
__publicField22(this, "data");
|
|
14910
|
+
this.data = data;
|
|
14911
|
+
}
|
|
14912
|
+
get textContent() {
|
|
14913
|
+
return this.data;
|
|
14914
|
+
}
|
|
14915
|
+
set textContent(textContent2) {
|
|
14916
|
+
this.data = textContent2;
|
|
14917
|
+
}
|
|
14918
|
+
toString() {
|
|
14919
|
+
return `RRText text=${JSON.stringify(this.data)}`;
|
|
14920
|
+
}
|
|
14921
|
+
}
|
|
14922
|
+
class BaseRRComment extends BaseRRNode {
|
|
14923
|
+
constructor(data) {
|
|
14924
|
+
super();
|
|
14925
|
+
__publicField22(this, "nodeType", 8);
|
|
14926
|
+
__publicField22(this, "nodeName", "#comment");
|
|
14927
|
+
__publicField22(this, "RRNodeType", NodeType$1.Comment);
|
|
14928
|
+
__publicField22(this, "data");
|
|
14929
|
+
this.data = data;
|
|
14930
|
+
}
|
|
14931
|
+
get textContent() {
|
|
14932
|
+
return this.data;
|
|
14933
|
+
}
|
|
14934
|
+
set textContent(textContent2) {
|
|
14935
|
+
this.data = textContent2;
|
|
14936
|
+
}
|
|
14937
|
+
toString() {
|
|
14938
|
+
return `RRComment text=${JSON.stringify(this.data)}`;
|
|
14939
|
+
}
|
|
14940
|
+
}
|
|
14941
|
+
class BaseRRCDATASection extends BaseRRNode {
|
|
14942
|
+
constructor(data) {
|
|
14943
|
+
super();
|
|
14944
|
+
__publicField22(this, "nodeName", "#cdata-section");
|
|
14945
|
+
__publicField22(this, "nodeType", 4);
|
|
14946
|
+
__publicField22(this, "RRNodeType", NodeType$1.CDATA);
|
|
14947
|
+
__publicField22(this, "data");
|
|
14948
|
+
this.data = data;
|
|
14949
|
+
}
|
|
14950
|
+
get textContent() {
|
|
14951
|
+
return this.data;
|
|
14952
|
+
}
|
|
14953
|
+
set textContent(textContent2) {
|
|
14954
|
+
this.data = textContent2;
|
|
14955
|
+
}
|
|
14956
|
+
toString() {
|
|
14957
|
+
return `RRCDATASection data=${JSON.stringify(this.data)}`;
|
|
14958
|
+
}
|
|
14959
|
+
}
|
|
14960
|
+
class ClassList {
|
|
14961
|
+
constructor(classText, onChange) {
|
|
14962
|
+
__publicField22(this, "onChange");
|
|
14963
|
+
__publicField22(this, "classes", []);
|
|
14964
|
+
__publicField22(this, "add", (...classNames) => {
|
|
14965
|
+
for (const item of classNames) {
|
|
14966
|
+
const className = String(item);
|
|
14967
|
+
if (this.classes.indexOf(className) >= 0) continue;
|
|
14968
|
+
this.classes.push(className);
|
|
14969
|
+
}
|
|
14970
|
+
this.onChange && this.onChange(this.classes.join(" "));
|
|
14971
|
+
});
|
|
14972
|
+
__publicField22(this, "remove", (...classNames) => {
|
|
14973
|
+
this.classes = this.classes.filter(
|
|
14974
|
+
(item) => classNames.indexOf(item) === -1
|
|
14930
14975
|
);
|
|
14931
|
-
|
|
14932
|
-
|
|
14933
|
-
|
|
14934
|
-
|
|
14935
|
-
|
|
14936
|
-
node2 = document.createElementNS(NAMESPACES["svg"], tagName);
|
|
14937
|
-
} else node2 = document.createElement(rrNode.tagName);
|
|
14938
|
-
break;
|
|
14976
|
+
this.onChange && this.onChange(this.classes.join(" "));
|
|
14977
|
+
});
|
|
14978
|
+
if (classText) {
|
|
14979
|
+
const classes = classText.trim().split(/\s+/);
|
|
14980
|
+
this.classes.push(...classes);
|
|
14939
14981
|
}
|
|
14940
|
-
|
|
14941
|
-
node2 = document.createTextNode(rrNode.data);
|
|
14942
|
-
break;
|
|
14943
|
-
case NodeType$1.Comment:
|
|
14944
|
-
node2 = document.createComment(rrNode.data);
|
|
14945
|
-
break;
|
|
14946
|
-
case NodeType$1.CDATA:
|
|
14947
|
-
node2 = document.createCDATASection(rrNode.data);
|
|
14948
|
-
break;
|
|
14982
|
+
this.onChange = onChange;
|
|
14949
14983
|
}
|
|
14950
|
-
|
|
14951
|
-
|
|
14952
|
-
|
|
14953
|
-
|
|
14984
|
+
}
|
|
14985
|
+
function appendChild(parent, newChild) {
|
|
14986
|
+
if (newChild.parentNode) newChild.parentNode.removeChild(newChild);
|
|
14987
|
+
if (parent.lastChild) {
|
|
14988
|
+
parent.lastChild.nextSibling = newChild;
|
|
14989
|
+
newChild.previousSibling = parent.lastChild;
|
|
14990
|
+
} else {
|
|
14991
|
+
parent.firstChild = newChild;
|
|
14992
|
+
newChild.previousSibling = null;
|
|
14954
14993
|
}
|
|
14955
|
-
|
|
14994
|
+
parent.lastChild = newChild;
|
|
14995
|
+
newChild.nextSibling = null;
|
|
14996
|
+
newChild.parentNode = parent;
|
|
14997
|
+
newChild.parentElement = parent;
|
|
14998
|
+
newChild.ownerDocument = parent.ownerDocument;
|
|
14999
|
+
return newChild;
|
|
14956
15000
|
}
|
|
14957
|
-
function
|
|
14958
|
-
if (
|
|
14959
|
-
|
|
15001
|
+
function insertBefore(parent, newChild, refChild) {
|
|
15002
|
+
if (!refChild) return appendChild(parent, newChild);
|
|
15003
|
+
if (refChild.parentNode !== parent)
|
|
15004
|
+
throw new Error(
|
|
15005
|
+
"Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode."
|
|
15006
|
+
);
|
|
15007
|
+
if (newChild === refChild) return newChild;
|
|
15008
|
+
if (newChild.parentNode) newChild.parentNode.removeChild(newChild);
|
|
15009
|
+
newChild.previousSibling = refChild.previousSibling;
|
|
15010
|
+
refChild.previousSibling = newChild;
|
|
15011
|
+
newChild.nextSibling = refChild;
|
|
15012
|
+
if (newChild.previousSibling) newChild.previousSibling.nextSibling = newChild;
|
|
15013
|
+
else parent.firstChild = newChild;
|
|
15014
|
+
newChild.parentElement = parent;
|
|
15015
|
+
newChild.parentNode = parent;
|
|
15016
|
+
newChild.ownerDocument = parent.ownerDocument;
|
|
15017
|
+
return newChild;
|
|
14960
15018
|
}
|
|
14961
|
-
function
|
|
14962
|
-
|
|
14963
|
-
|
|
14964
|
-
|
|
14965
|
-
|
|
15019
|
+
function removeChild(parent, child2) {
|
|
15020
|
+
if (child2.parentNode !== parent)
|
|
15021
|
+
throw new Error(
|
|
15022
|
+
"Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode."
|
|
15023
|
+
);
|
|
15024
|
+
if (child2.previousSibling)
|
|
15025
|
+
child2.previousSibling.nextSibling = child2.nextSibling;
|
|
15026
|
+
else parent.firstChild = child2.nextSibling;
|
|
15027
|
+
if (child2.nextSibling)
|
|
15028
|
+
child2.nextSibling.previousSibling = child2.previousSibling;
|
|
15029
|
+
else parent.lastChild = child2.previousSibling;
|
|
15030
|
+
child2.previousSibling = null;
|
|
15031
|
+
child2.nextSibling = null;
|
|
15032
|
+
child2.parentElement = null;
|
|
15033
|
+
child2.parentNode = null;
|
|
15034
|
+
return child2;
|
|
14966
15035
|
}
|
|
15036
|
+
var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
|
|
15037
|
+
NodeType2[NodeType2["PLACEHOLDER"] = 0] = "PLACEHOLDER";
|
|
15038
|
+
NodeType2[NodeType2["ELEMENT_NODE"] = 1] = "ELEMENT_NODE";
|
|
15039
|
+
NodeType2[NodeType2["ATTRIBUTE_NODE"] = 2] = "ATTRIBUTE_NODE";
|
|
15040
|
+
NodeType2[NodeType2["TEXT_NODE"] = 3] = "TEXT_NODE";
|
|
15041
|
+
NodeType2[NodeType2["CDATA_SECTION_NODE"] = 4] = "CDATA_SECTION_NODE";
|
|
15042
|
+
NodeType2[NodeType2["ENTITY_REFERENCE_NODE"] = 5] = "ENTITY_REFERENCE_NODE";
|
|
15043
|
+
NodeType2[NodeType2["ENTITY_NODE"] = 6] = "ENTITY_NODE";
|
|
15044
|
+
NodeType2[NodeType2["PROCESSING_INSTRUCTION_NODE"] = 7] = "PROCESSING_INSTRUCTION_NODE";
|
|
15045
|
+
NodeType2[NodeType2["COMMENT_NODE"] = 8] = "COMMENT_NODE";
|
|
15046
|
+
NodeType2[NodeType2["DOCUMENT_NODE"] = 9] = "DOCUMENT_NODE";
|
|
15047
|
+
NodeType2[NodeType2["DOCUMENT_TYPE_NODE"] = 10] = "DOCUMENT_TYPE_NODE";
|
|
15048
|
+
NodeType2[NodeType2["DOCUMENT_FRAGMENT_NODE"] = 11] = "DOCUMENT_FRAGMENT_NODE";
|
|
15049
|
+
return NodeType2;
|
|
15050
|
+
})(NodeType$2 || {});
|
|
14967
15051
|
class RRDocument extends BaseRRDocument {
|
|
14968
15052
|
constructor(mirror2) {
|
|
14969
15053
|
super();
|
|
@@ -15148,6 +15232,7 @@ function buildFromNode(node2, rrdom, domMirror, parentRRNode) {
|
|
|
15148
15232
|
}
|
|
15149
15233
|
rrdom.mirror.add(rrNode, { ...sn });
|
|
15150
15234
|
}
|
|
15235
|
+
nodesBuiltFromDom.add(rrNode);
|
|
15151
15236
|
return rrNode;
|
|
15152
15237
|
}
|
|
15153
15238
|
function buildFromDom(dom, domMirror = createMirror$1(), rrdom = new RRDocument()) {
|
|
@@ -15543,15 +15628,12 @@ function hasShadowRoot(n2) {
|
|
|
15543
15628
|
return Boolean(index.shadowRoot(n2));
|
|
15544
15629
|
}
|
|
15545
15630
|
function getNestedRule(rules2, position) {
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
|
|
15550
|
-
return getNestedRule(
|
|
15551
|
-
rule2.cssRules[position[1]].cssRules,
|
|
15552
|
-
position.slice(2)
|
|
15553
|
-
);
|
|
15631
|
+
var _a22;
|
|
15632
|
+
let rule2 = rules2[position[0]];
|
|
15633
|
+
for (let i2 = 1; i2 < position.length && rule2; i2++) {
|
|
15634
|
+
rule2 = (_a22 = rule2.cssRules) == null ? void 0 : _a22[position[i2]];
|
|
15554
15635
|
}
|
|
15636
|
+
return rule2;
|
|
15555
15637
|
}
|
|
15556
15638
|
function getPositionsAndIndex(nestedIndex) {
|
|
15557
15639
|
const positions = [...nestedIndex];
|
|
@@ -18225,8 +18307,12 @@ class Replayer {
|
|
|
18225
18307
|
case IncrementalSource.StyleDeclaration: {
|
|
18226
18308
|
if (this.usingVirtualDom) {
|
|
18227
18309
|
if (d.styleId) this.constructedStyleMutations.push(d);
|
|
18228
|
-
else if (d.id)
|
|
18229
|
-
|
|
18310
|
+
else if (d.id) {
|
|
18311
|
+
const target = this.virtualDom.mirror.getNode(
|
|
18312
|
+
d.id
|
|
18313
|
+
);
|
|
18314
|
+
(_b2 = target == null ? void 0 : target.rules) == null ? void 0 : _b2.push(d);
|
|
18315
|
+
}
|
|
18230
18316
|
} else this.applyStyleSheetMutation(d);
|
|
18231
18317
|
break;
|
|
18232
18318
|
}
|
|
@@ -18817,11 +18903,9 @@ class Replayer {
|
|
|
18817
18903
|
}
|
|
18818
18904
|
}
|
|
18819
18905
|
applyStyleDeclaration(data, styleSheet) {
|
|
18906
|
+
const rule2 = getNestedRule(styleSheet.cssRules, data.index);
|
|
18907
|
+
if (!(rule2 == null ? void 0 : rule2.style)) return;
|
|
18820
18908
|
if (data.set) {
|
|
18821
|
-
const rule2 = getNestedRule(
|
|
18822
|
-
styleSheet.rules,
|
|
18823
|
-
data.index
|
|
18824
|
-
);
|
|
18825
18909
|
rule2.style.setProperty(
|
|
18826
18910
|
data.set.property,
|
|
18827
18911
|
data.set.value,
|
|
@@ -18829,10 +18913,6 @@ class Replayer {
|
|
|
18829
18913
|
);
|
|
18830
18914
|
}
|
|
18831
18915
|
if (data.remove) {
|
|
18832
|
-
const rule2 = getNestedRule(
|
|
18833
|
-
styleSheet.rules,
|
|
18834
|
-
data.index
|
|
18835
|
-
);
|
|
18836
18916
|
rule2.style.removeProperty(data.remove.property);
|
|
18837
18917
|
}
|
|
18838
18918
|
}
|