denwa-web-shared 1.0.57 → 1.0.59
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/server/index.cjs.js +23 -3648
- package/dist/server/index.es.js +23 -3646
- package/dist/server/lib/utils.d.ts +1 -1
- package/dist/server/ui/index.d.ts +0 -1
- package/package.json +1 -3
- package/skills/infinity-list/SKILL.md +1 -1
- package/skills/render-picture/SKILL.md +1 -1
- package/skills/shared-constants/SKILL.md +1 -1
- package/skills/viewport-hooks/SKILL.md +1 -1
- package/skills/yandex-feed/SKILL.md +1 -1
- package/dist/server/ui/html-content.d.ts +0 -7
package/dist/server/index.cjs.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
6
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
7
|
-
const require$$0 = require("react");
|
|
8
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
9
|
-
const require$$0__default = /* @__PURE__ */ _interopDefault(require$$0);
|
|
10
4
|
const TIME = {
|
|
11
5
|
seconds: {
|
|
12
6
|
minutes10: 600
|
|
@@ -119,17 +113,17 @@ const getSubdomain = (host, SUB_DOMAIN) => {
|
|
|
119
113
|
return item;
|
|
120
114
|
};
|
|
121
115
|
const updateTextByTemplate = ({
|
|
122
|
-
text
|
|
116
|
+
text,
|
|
123
117
|
subdomain,
|
|
124
118
|
SUBDOMAIN_NAME,
|
|
125
119
|
SUBDOMAIN_MASK
|
|
126
120
|
}) => {
|
|
127
|
-
if (!subdomain || !SUBDOMAIN_NAME || !SUBDOMAIN_MASK) return
|
|
121
|
+
if (!subdomain || !SUBDOMAIN_NAME || !SUBDOMAIN_MASK) return text;
|
|
128
122
|
const key = SUBDOMAIN_NAME[subdomain];
|
|
129
|
-
if (!subdomain || !key) return
|
|
123
|
+
if (!subdomain || !key) return text;
|
|
130
124
|
const subdomainData = getByKey(SUBDOMAIN_NAME, subdomain);
|
|
131
|
-
if (!subdomainData) return
|
|
132
|
-
let result =
|
|
125
|
+
if (!subdomainData) return text;
|
|
126
|
+
let result = text;
|
|
133
127
|
const { name, declination, region, regionDeclination } = subdomainData;
|
|
134
128
|
const cityReg = new RegExp(SUBDOMAIN_MASK.CITY, "g");
|
|
135
129
|
const cityDeclReg = new RegExp(SUBDOMAIN_MASK.CITY_DECL, "g");
|
|
@@ -326,8 +320,8 @@ const preparePageParam = (page) => {
|
|
|
326
320
|
}
|
|
327
321
|
return 1;
|
|
328
322
|
};
|
|
329
|
-
const isNotEmptyHtml = (
|
|
330
|
-
return !!
|
|
323
|
+
const isNotEmptyHtml = (html) => {
|
|
324
|
+
return !!html && html !== '<p class="content-paragraph" ></p>';
|
|
331
325
|
};
|
|
332
326
|
const createCityLink = (city, href) => {
|
|
333
327
|
return `/${city}${href}`;
|
|
@@ -3539,9 +3533,9 @@ const globalConfig = {};
|
|
|
3539
3533
|
function config(newConfig) {
|
|
3540
3534
|
return globalConfig;
|
|
3541
3535
|
}
|
|
3542
|
-
function getEnumValues(
|
|
3543
|
-
const numericValues = Object.values(
|
|
3544
|
-
const values = Object.entries(
|
|
3536
|
+
function getEnumValues(entries) {
|
|
3537
|
+
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
3538
|
+
const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
3545
3539
|
return values;
|
|
3546
3540
|
}
|
|
3547
3541
|
function jsonStringifyReplacer(_, value) {
|
|
@@ -3669,7 +3663,7 @@ const propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"])
|
|
|
3669
3663
|
function escapeRegex(str) {
|
|
3670
3664
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3671
3665
|
}
|
|
3672
|
-
function clone
|
|
3666
|
+
function clone(inst, def, params) {
|
|
3673
3667
|
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
3674
3668
|
if (!def || (params == null ? void 0 : params.parent))
|
|
3675
3669
|
cl._zod.parent = inst;
|
|
@@ -3721,7 +3715,7 @@ function pick(schema, mask) {
|
|
|
3721
3715
|
},
|
|
3722
3716
|
checks: []
|
|
3723
3717
|
});
|
|
3724
|
-
return clone
|
|
3718
|
+
return clone(schema, def);
|
|
3725
3719
|
}
|
|
3726
3720
|
function omit(schema, mask) {
|
|
3727
3721
|
const currDef = schema._zod.def;
|
|
@@ -3741,7 +3735,7 @@ function omit(schema, mask) {
|
|
|
3741
3735
|
},
|
|
3742
3736
|
checks: []
|
|
3743
3737
|
});
|
|
3744
|
-
return clone
|
|
3738
|
+
return clone(schema, def);
|
|
3745
3739
|
}
|
|
3746
3740
|
function extend(schema, shape) {
|
|
3747
3741
|
if (!isPlainObject(shape)) {
|
|
@@ -3760,7 +3754,7 @@ function extend(schema, shape) {
|
|
|
3760
3754
|
},
|
|
3761
3755
|
checks: []
|
|
3762
3756
|
});
|
|
3763
|
-
return clone
|
|
3757
|
+
return clone(schema, def);
|
|
3764
3758
|
}
|
|
3765
3759
|
function safeExtend(schema, shape) {
|
|
3766
3760
|
if (!isPlainObject(shape)) {
|
|
@@ -3775,7 +3769,7 @@ function safeExtend(schema, shape) {
|
|
|
3775
3769
|
},
|
|
3776
3770
|
checks: schema._zod.def.checks
|
|
3777
3771
|
};
|
|
3778
|
-
return clone
|
|
3772
|
+
return clone(schema, def);
|
|
3779
3773
|
}
|
|
3780
3774
|
function merge(a, b) {
|
|
3781
3775
|
const def = mergeDefs(a._zod.def, {
|
|
@@ -3790,7 +3784,7 @@ function merge(a, b) {
|
|
|
3790
3784
|
checks: []
|
|
3791
3785
|
// delete existing checks
|
|
3792
3786
|
});
|
|
3793
|
-
return clone
|
|
3787
|
+
return clone(a, def);
|
|
3794
3788
|
}
|
|
3795
3789
|
function partial(Class, schema, mask) {
|
|
3796
3790
|
const def = mergeDefs(schema._zod.def, {
|
|
@@ -3822,7 +3816,7 @@ function partial(Class, schema, mask) {
|
|
|
3822
3816
|
},
|
|
3823
3817
|
checks: []
|
|
3824
3818
|
});
|
|
3825
|
-
return clone
|
|
3819
|
+
return clone(schema, def);
|
|
3826
3820
|
}
|
|
3827
3821
|
function required(Class, schema, mask) {
|
|
3828
3822
|
const def = mergeDefs(schema._zod.def, {
|
|
@@ -3854,7 +3848,7 @@ function required(Class, schema, mask) {
|
|
|
3854
3848
|
},
|
|
3855
3849
|
checks: []
|
|
3856
3850
|
});
|
|
3857
|
-
return clone
|
|
3851
|
+
return clone(schema, def);
|
|
3858
3852
|
}
|
|
3859
3853
|
function aborted(x, startIndex = 0) {
|
|
3860
3854
|
var _a;
|
|
@@ -6190,7 +6184,7 @@ const initializer = (inst, issues) => {
|
|
|
6190
6184
|
const ZodRealError = $constructor("ZodError", initializer, {
|
|
6191
6185
|
Parent: Error
|
|
6192
6186
|
});
|
|
6193
|
-
const parse
|
|
6187
|
+
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
6194
6188
|
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
6195
6189
|
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
6196
6190
|
const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
@@ -6219,13 +6213,13 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
6219
6213
|
// { parent: true }
|
|
6220
6214
|
);
|
|
6221
6215
|
};
|
|
6222
|
-
inst.clone = (def2, params) => clone
|
|
6216
|
+
inst.clone = (def2, params) => clone(inst, def2, params);
|
|
6223
6217
|
inst.brand = () => inst;
|
|
6224
6218
|
inst.register = ((reg, meta) => {
|
|
6225
6219
|
reg.add(inst, meta);
|
|
6226
6220
|
return inst;
|
|
6227
6221
|
});
|
|
6228
|
-
inst.parse = (data, params) => parse
|
|
6222
|
+
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
6229
6223
|
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
6230
6224
|
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
6231
6225
|
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
@@ -6577,10 +6571,10 @@ const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
|
6577
6571
|
};
|
|
6578
6572
|
});
|
|
6579
6573
|
function _enum(values, params) {
|
|
6580
|
-
const
|
|
6574
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
|
6581
6575
|
return new ZodEnum({
|
|
6582
6576
|
type: "enum",
|
|
6583
|
-
entries
|
|
6577
|
+
entries,
|
|
6584
6578
|
...normalizeParams(params)
|
|
6585
6579
|
});
|
|
6586
6580
|
}
|
|
@@ -7109,3624 +7103,6 @@ const Video = ({
|
|
|
7109
7103
|
}
|
|
7110
7104
|
);
|
|
7111
7105
|
};
|
|
7112
|
-
/*! @license DOMPurify 3.4.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.2/LICENSE */
|
|
7113
|
-
const {
|
|
7114
|
-
entries,
|
|
7115
|
-
setPrototypeOf,
|
|
7116
|
-
isFrozen,
|
|
7117
|
-
getPrototypeOf,
|
|
7118
|
-
getOwnPropertyDescriptor
|
|
7119
|
-
} = Object;
|
|
7120
|
-
let {
|
|
7121
|
-
freeze,
|
|
7122
|
-
seal,
|
|
7123
|
-
create
|
|
7124
|
-
} = Object;
|
|
7125
|
-
let {
|
|
7126
|
-
apply,
|
|
7127
|
-
construct
|
|
7128
|
-
} = typeof Reflect !== "undefined" && Reflect;
|
|
7129
|
-
if (!freeze) {
|
|
7130
|
-
freeze = function freeze2(x) {
|
|
7131
|
-
return x;
|
|
7132
|
-
};
|
|
7133
|
-
}
|
|
7134
|
-
if (!seal) {
|
|
7135
|
-
seal = function seal2(x) {
|
|
7136
|
-
return x;
|
|
7137
|
-
};
|
|
7138
|
-
}
|
|
7139
|
-
if (!apply) {
|
|
7140
|
-
apply = function apply2(func, thisArg) {
|
|
7141
|
-
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
7142
|
-
args[_key - 2] = arguments[_key];
|
|
7143
|
-
}
|
|
7144
|
-
return func.apply(thisArg, args);
|
|
7145
|
-
};
|
|
7146
|
-
}
|
|
7147
|
-
if (!construct) {
|
|
7148
|
-
construct = function construct2(Func) {
|
|
7149
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
7150
|
-
args[_key2 - 1] = arguments[_key2];
|
|
7151
|
-
}
|
|
7152
|
-
return new Func(...args);
|
|
7153
|
-
};
|
|
7154
|
-
}
|
|
7155
|
-
const arrayForEach = unapply(Array.prototype.forEach);
|
|
7156
|
-
const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
|
|
7157
|
-
const arrayPop = unapply(Array.prototype.pop);
|
|
7158
|
-
const arrayPush = unapply(Array.prototype.push);
|
|
7159
|
-
const arraySplice = unapply(Array.prototype.splice);
|
|
7160
|
-
const arrayIsArray = Array.isArray;
|
|
7161
|
-
const stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
7162
|
-
const stringToString = unapply(String.prototype.toString);
|
|
7163
|
-
const stringMatch = unapply(String.prototype.match);
|
|
7164
|
-
const stringReplace = unapply(String.prototype.replace);
|
|
7165
|
-
const stringIndexOf = unapply(String.prototype.indexOf);
|
|
7166
|
-
const stringTrim = unapply(String.prototype.trim);
|
|
7167
|
-
const numberToString = unapply(Number.prototype.toString);
|
|
7168
|
-
const booleanToString = unapply(Boolean.prototype.toString);
|
|
7169
|
-
const bigintToString = typeof BigInt === "undefined" ? null : unapply(BigInt.prototype.toString);
|
|
7170
|
-
const symbolToString = typeof Symbol === "undefined" ? null : unapply(Symbol.prototype.toString);
|
|
7171
|
-
const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
|
|
7172
|
-
const objectToString = unapply(Object.prototype.toString);
|
|
7173
|
-
const regExpTest = unapply(RegExp.prototype.test);
|
|
7174
|
-
const typeErrorCreate = unconstruct(TypeError);
|
|
7175
|
-
function unapply(func) {
|
|
7176
|
-
return function(thisArg) {
|
|
7177
|
-
if (thisArg instanceof RegExp) {
|
|
7178
|
-
thisArg.lastIndex = 0;
|
|
7179
|
-
}
|
|
7180
|
-
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
7181
|
-
args[_key3 - 1] = arguments[_key3];
|
|
7182
|
-
}
|
|
7183
|
-
return apply(func, thisArg, args);
|
|
7184
|
-
};
|
|
7185
|
-
}
|
|
7186
|
-
function unconstruct(Func) {
|
|
7187
|
-
return function() {
|
|
7188
|
-
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
7189
|
-
args[_key4] = arguments[_key4];
|
|
7190
|
-
}
|
|
7191
|
-
return construct(Func, args);
|
|
7192
|
-
};
|
|
7193
|
-
}
|
|
7194
|
-
function addToSet(set, array2) {
|
|
7195
|
-
let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
|
|
7196
|
-
if (setPrototypeOf) {
|
|
7197
|
-
setPrototypeOf(set, null);
|
|
7198
|
-
}
|
|
7199
|
-
if (!arrayIsArray(array2)) {
|
|
7200
|
-
return set;
|
|
7201
|
-
}
|
|
7202
|
-
let l = array2.length;
|
|
7203
|
-
while (l--) {
|
|
7204
|
-
let element = array2[l];
|
|
7205
|
-
if (typeof element === "string") {
|
|
7206
|
-
const lcElement = transformCaseFunc(element);
|
|
7207
|
-
if (lcElement !== element) {
|
|
7208
|
-
if (!isFrozen(array2)) {
|
|
7209
|
-
array2[l] = lcElement;
|
|
7210
|
-
}
|
|
7211
|
-
element = lcElement;
|
|
7212
|
-
}
|
|
7213
|
-
}
|
|
7214
|
-
set[element] = true;
|
|
7215
|
-
}
|
|
7216
|
-
return set;
|
|
7217
|
-
}
|
|
7218
|
-
function cleanArray(array2) {
|
|
7219
|
-
for (let index = 0; index < array2.length; index++) {
|
|
7220
|
-
const isPropertyExist = objectHasOwnProperty(array2, index);
|
|
7221
|
-
if (!isPropertyExist) {
|
|
7222
|
-
array2[index] = null;
|
|
7223
|
-
}
|
|
7224
|
-
}
|
|
7225
|
-
return array2;
|
|
7226
|
-
}
|
|
7227
|
-
function clone(object2) {
|
|
7228
|
-
const newObject = create(null);
|
|
7229
|
-
for (const [property, value] of entries(object2)) {
|
|
7230
|
-
const isPropertyExist = objectHasOwnProperty(object2, property);
|
|
7231
|
-
if (isPropertyExist) {
|
|
7232
|
-
if (arrayIsArray(value)) {
|
|
7233
|
-
newObject[property] = cleanArray(value);
|
|
7234
|
-
} else if (value && typeof value === "object" && value.constructor === Object) {
|
|
7235
|
-
newObject[property] = clone(value);
|
|
7236
|
-
} else {
|
|
7237
|
-
newObject[property] = value;
|
|
7238
|
-
}
|
|
7239
|
-
}
|
|
7240
|
-
}
|
|
7241
|
-
return newObject;
|
|
7242
|
-
}
|
|
7243
|
-
function stringifyValue(value) {
|
|
7244
|
-
switch (typeof value) {
|
|
7245
|
-
case "string": {
|
|
7246
|
-
return value;
|
|
7247
|
-
}
|
|
7248
|
-
case "number": {
|
|
7249
|
-
return numberToString(value);
|
|
7250
|
-
}
|
|
7251
|
-
case "boolean": {
|
|
7252
|
-
return booleanToString(value);
|
|
7253
|
-
}
|
|
7254
|
-
case "bigint": {
|
|
7255
|
-
return bigintToString ? bigintToString(value) : "0";
|
|
7256
|
-
}
|
|
7257
|
-
case "symbol": {
|
|
7258
|
-
return symbolToString ? symbolToString(value) : "Symbol()";
|
|
7259
|
-
}
|
|
7260
|
-
case "undefined": {
|
|
7261
|
-
return objectToString(value);
|
|
7262
|
-
}
|
|
7263
|
-
case "function":
|
|
7264
|
-
case "object": {
|
|
7265
|
-
if (value === null) {
|
|
7266
|
-
return objectToString(value);
|
|
7267
|
-
}
|
|
7268
|
-
const valueAsRecord = value;
|
|
7269
|
-
const valueToString = lookupGetter(valueAsRecord, "toString");
|
|
7270
|
-
if (typeof valueToString === "function") {
|
|
7271
|
-
const stringified = valueToString(valueAsRecord);
|
|
7272
|
-
return typeof stringified === "string" ? stringified : objectToString(stringified);
|
|
7273
|
-
}
|
|
7274
|
-
return objectToString(value);
|
|
7275
|
-
}
|
|
7276
|
-
default: {
|
|
7277
|
-
return objectToString(value);
|
|
7278
|
-
}
|
|
7279
|
-
}
|
|
7280
|
-
}
|
|
7281
|
-
function lookupGetter(object2, prop) {
|
|
7282
|
-
while (object2 !== null) {
|
|
7283
|
-
const desc = getOwnPropertyDescriptor(object2, prop);
|
|
7284
|
-
if (desc) {
|
|
7285
|
-
if (desc.get) {
|
|
7286
|
-
return unapply(desc.get);
|
|
7287
|
-
}
|
|
7288
|
-
if (typeof desc.value === "function") {
|
|
7289
|
-
return unapply(desc.value);
|
|
7290
|
-
}
|
|
7291
|
-
}
|
|
7292
|
-
object2 = getPrototypeOf(object2);
|
|
7293
|
-
}
|
|
7294
|
-
function fallbackValue() {
|
|
7295
|
-
return null;
|
|
7296
|
-
}
|
|
7297
|
-
return fallbackValue;
|
|
7298
|
-
}
|
|
7299
|
-
function isRegex(value) {
|
|
7300
|
-
try {
|
|
7301
|
-
regExpTest(value, "");
|
|
7302
|
-
return true;
|
|
7303
|
-
} catch (_unused) {
|
|
7304
|
-
return false;
|
|
7305
|
-
}
|
|
7306
|
-
}
|
|
7307
|
-
const html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]);
|
|
7308
|
-
const svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]);
|
|
7309
|
-
const svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]);
|
|
7310
|
-
const svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]);
|
|
7311
|
-
const mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]);
|
|
7312
|
-
const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
|
|
7313
|
-
const text = freeze(["#text"]);
|
|
7314
|
-
const html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns"]);
|
|
7315
|
-
const svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]);
|
|
7316
|
-
const mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnalign", "columnlines", "columnspacing", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lquote", "lspace", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]);
|
|
7317
|
-
const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
|
|
7318
|
-
const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm);
|
|
7319
|
-
const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
|
|
7320
|
-
const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm);
|
|
7321
|
-
const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
|
|
7322
|
-
const ARIA_ATTR = seal(/^aria-[\-\w]+$/);
|
|
7323
|
-
const IS_ALLOWED_URI = seal(
|
|
7324
|
-
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
7325
|
-
// eslint-disable-line no-useless-escape
|
|
7326
|
-
);
|
|
7327
|
-
const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
|
|
7328
|
-
const ATTR_WHITESPACE = seal(
|
|
7329
|
-
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
7330
|
-
// eslint-disable-line no-control-regex
|
|
7331
|
-
);
|
|
7332
|
-
const DOCTYPE_NAME = seal(/^html$/i);
|
|
7333
|
-
const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
7334
|
-
var EXPRESSIONS = /* @__PURE__ */ Object.freeze({
|
|
7335
|
-
__proto__: null,
|
|
7336
|
-
ARIA_ATTR,
|
|
7337
|
-
ATTR_WHITESPACE,
|
|
7338
|
-
CUSTOM_ELEMENT,
|
|
7339
|
-
DATA_ATTR,
|
|
7340
|
-
DOCTYPE_NAME,
|
|
7341
|
-
ERB_EXPR,
|
|
7342
|
-
IS_ALLOWED_URI,
|
|
7343
|
-
IS_SCRIPT_OR_DATA,
|
|
7344
|
-
MUSTACHE_EXPR,
|
|
7345
|
-
TMPLIT_EXPR
|
|
7346
|
-
});
|
|
7347
|
-
const NODE_TYPE = {
|
|
7348
|
-
element: 1,
|
|
7349
|
-
text: 3,
|
|
7350
|
-
// Deprecated
|
|
7351
|
-
progressingInstruction: 7,
|
|
7352
|
-
comment: 8,
|
|
7353
|
-
document: 9
|
|
7354
|
-
};
|
|
7355
|
-
const getGlobal = function getGlobal2() {
|
|
7356
|
-
return typeof window === "undefined" ? null : window;
|
|
7357
|
-
};
|
|
7358
|
-
const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
|
|
7359
|
-
if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
|
|
7360
|
-
return null;
|
|
7361
|
-
}
|
|
7362
|
-
let suffix = null;
|
|
7363
|
-
const ATTR_NAME = "data-tt-policy-suffix";
|
|
7364
|
-
if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
|
|
7365
|
-
suffix = purifyHostElement.getAttribute(ATTR_NAME);
|
|
7366
|
-
}
|
|
7367
|
-
const policyName = "dompurify" + (suffix ? "#" + suffix : "");
|
|
7368
|
-
try {
|
|
7369
|
-
return trustedTypes.createPolicy(policyName, {
|
|
7370
|
-
createHTML(html2) {
|
|
7371
|
-
return html2;
|
|
7372
|
-
},
|
|
7373
|
-
createScriptURL(scriptUrl) {
|
|
7374
|
-
return scriptUrl;
|
|
7375
|
-
}
|
|
7376
|
-
});
|
|
7377
|
-
} catch (_) {
|
|
7378
|
-
console.warn("TrustedTypes policy " + policyName + " could not be created.");
|
|
7379
|
-
return null;
|
|
7380
|
-
}
|
|
7381
|
-
};
|
|
7382
|
-
const _createHooksMap = function _createHooksMap2() {
|
|
7383
|
-
return {
|
|
7384
|
-
afterSanitizeAttributes: [],
|
|
7385
|
-
afterSanitizeElements: [],
|
|
7386
|
-
afterSanitizeShadowDOM: [],
|
|
7387
|
-
beforeSanitizeAttributes: [],
|
|
7388
|
-
beforeSanitizeElements: [],
|
|
7389
|
-
beforeSanitizeShadowDOM: [],
|
|
7390
|
-
uponSanitizeAttribute: [],
|
|
7391
|
-
uponSanitizeElement: [],
|
|
7392
|
-
uponSanitizeShadowNode: []
|
|
7393
|
-
};
|
|
7394
|
-
};
|
|
7395
|
-
function createDOMPurify() {
|
|
7396
|
-
let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
|
|
7397
|
-
const DOMPurify = (root) => createDOMPurify(root);
|
|
7398
|
-
DOMPurify.version = "3.4.2";
|
|
7399
|
-
DOMPurify.removed = [];
|
|
7400
|
-
if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document || !window2.Element) {
|
|
7401
|
-
DOMPurify.isSupported = false;
|
|
7402
|
-
return DOMPurify;
|
|
7403
|
-
}
|
|
7404
|
-
let {
|
|
7405
|
-
document: document2
|
|
7406
|
-
} = window2;
|
|
7407
|
-
const originalDocument = document2;
|
|
7408
|
-
const currentScript = originalDocument.currentScript;
|
|
7409
|
-
const {
|
|
7410
|
-
DocumentFragment,
|
|
7411
|
-
HTMLTemplateElement,
|
|
7412
|
-
Node: Node2,
|
|
7413
|
-
Element: Element2,
|
|
7414
|
-
NodeFilter,
|
|
7415
|
-
NamedNodeMap = window2.NamedNodeMap || window2.MozNamedAttrMap,
|
|
7416
|
-
HTMLFormElement,
|
|
7417
|
-
DOMParser,
|
|
7418
|
-
trustedTypes
|
|
7419
|
-
} = window2;
|
|
7420
|
-
const ElementPrototype = Element2.prototype;
|
|
7421
|
-
const cloneNode2 = lookupGetter(ElementPrototype, "cloneNode");
|
|
7422
|
-
const remove = lookupGetter(ElementPrototype, "remove");
|
|
7423
|
-
const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
|
|
7424
|
-
const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
|
|
7425
|
-
const getParentNode = lookupGetter(ElementPrototype, "parentNode");
|
|
7426
|
-
if (typeof HTMLTemplateElement === "function") {
|
|
7427
|
-
const template = document2.createElement("template");
|
|
7428
|
-
if (template.content && template.content.ownerDocument) {
|
|
7429
|
-
document2 = template.content.ownerDocument;
|
|
7430
|
-
}
|
|
7431
|
-
}
|
|
7432
|
-
let trustedTypesPolicy;
|
|
7433
|
-
let emptyHTML = "";
|
|
7434
|
-
const {
|
|
7435
|
-
implementation,
|
|
7436
|
-
createNodeIterator,
|
|
7437
|
-
createDocumentFragment,
|
|
7438
|
-
getElementsByTagName
|
|
7439
|
-
} = document2;
|
|
7440
|
-
const {
|
|
7441
|
-
importNode
|
|
7442
|
-
} = originalDocument;
|
|
7443
|
-
let hooks = _createHooksMap();
|
|
7444
|
-
DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
|
|
7445
|
-
const {
|
|
7446
|
-
MUSTACHE_EXPR: MUSTACHE_EXPR2,
|
|
7447
|
-
ERB_EXPR: ERB_EXPR2,
|
|
7448
|
-
TMPLIT_EXPR: TMPLIT_EXPR2,
|
|
7449
|
-
DATA_ATTR: DATA_ATTR2,
|
|
7450
|
-
ARIA_ATTR: ARIA_ATTR2,
|
|
7451
|
-
IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA2,
|
|
7452
|
-
ATTR_WHITESPACE: ATTR_WHITESPACE2,
|
|
7453
|
-
CUSTOM_ELEMENT: CUSTOM_ELEMENT2
|
|
7454
|
-
} = EXPRESSIONS;
|
|
7455
|
-
let {
|
|
7456
|
-
IS_ALLOWED_URI: IS_ALLOWED_URI$1
|
|
7457
|
-
} = EXPRESSIONS;
|
|
7458
|
-
let ALLOWED_TAGS = null;
|
|
7459
|
-
const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
|
|
7460
|
-
let ALLOWED_ATTR = null;
|
|
7461
|
-
const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
|
|
7462
|
-
let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
|
|
7463
|
-
tagNameCheck: {
|
|
7464
|
-
writable: true,
|
|
7465
|
-
configurable: false,
|
|
7466
|
-
enumerable: true,
|
|
7467
|
-
value: null
|
|
7468
|
-
},
|
|
7469
|
-
attributeNameCheck: {
|
|
7470
|
-
writable: true,
|
|
7471
|
-
configurable: false,
|
|
7472
|
-
enumerable: true,
|
|
7473
|
-
value: null
|
|
7474
|
-
},
|
|
7475
|
-
allowCustomizedBuiltInElements: {
|
|
7476
|
-
writable: true,
|
|
7477
|
-
configurable: false,
|
|
7478
|
-
enumerable: true,
|
|
7479
|
-
value: false
|
|
7480
|
-
}
|
|
7481
|
-
}));
|
|
7482
|
-
let FORBID_TAGS = null;
|
|
7483
|
-
let FORBID_ATTR = null;
|
|
7484
|
-
const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
|
|
7485
|
-
tagCheck: {
|
|
7486
|
-
writable: true,
|
|
7487
|
-
configurable: false,
|
|
7488
|
-
enumerable: true,
|
|
7489
|
-
value: null
|
|
7490
|
-
},
|
|
7491
|
-
attributeCheck: {
|
|
7492
|
-
writable: true,
|
|
7493
|
-
configurable: false,
|
|
7494
|
-
enumerable: true,
|
|
7495
|
-
value: null
|
|
7496
|
-
}
|
|
7497
|
-
}));
|
|
7498
|
-
let ALLOW_ARIA_ATTR = true;
|
|
7499
|
-
let ALLOW_DATA_ATTR = true;
|
|
7500
|
-
let ALLOW_UNKNOWN_PROTOCOLS = false;
|
|
7501
|
-
let ALLOW_SELF_CLOSE_IN_ATTR = true;
|
|
7502
|
-
let SAFE_FOR_TEMPLATES = false;
|
|
7503
|
-
let SAFE_FOR_XML = true;
|
|
7504
|
-
let WHOLE_DOCUMENT = false;
|
|
7505
|
-
let SET_CONFIG = false;
|
|
7506
|
-
let FORCE_BODY = false;
|
|
7507
|
-
let RETURN_DOM = false;
|
|
7508
|
-
let RETURN_DOM_FRAGMENT = false;
|
|
7509
|
-
let RETURN_TRUSTED_TYPE = false;
|
|
7510
|
-
let SANITIZE_DOM = true;
|
|
7511
|
-
let SANITIZE_NAMED_PROPS = false;
|
|
7512
|
-
const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
|
|
7513
|
-
let KEEP_CONTENT = true;
|
|
7514
|
-
let IN_PLACE = false;
|
|
7515
|
-
let USE_PROFILES = {};
|
|
7516
|
-
let FORBID_CONTENTS = null;
|
|
7517
|
-
const DEFAULT_FORBID_CONTENTS = addToSet({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
|
|
7518
|
-
let DATA_URI_TAGS = null;
|
|
7519
|
-
const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
7520
|
-
let URI_SAFE_ATTRIBUTES = null;
|
|
7521
|
-
const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
|
|
7522
|
-
const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
|
|
7523
|
-
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
7524
|
-
const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
|
7525
|
-
let NAMESPACE = HTML_NAMESPACE;
|
|
7526
|
-
let IS_EMPTY_INPUT = false;
|
|
7527
|
-
let ALLOWED_NAMESPACES = null;
|
|
7528
|
-
const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
|
|
7529
|
-
let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
|
|
7530
|
-
let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]);
|
|
7531
|
-
const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
|
|
7532
|
-
let PARSER_MEDIA_TYPE = null;
|
|
7533
|
-
const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
|
|
7534
|
-
const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
|
|
7535
|
-
let transformCaseFunc = null;
|
|
7536
|
-
let CONFIG = null;
|
|
7537
|
-
const formElement = document2.createElement("form");
|
|
7538
|
-
const isRegexOrFunction = function isRegexOrFunction2(testValue) {
|
|
7539
|
-
return testValue instanceof RegExp || testValue instanceof Function;
|
|
7540
|
-
};
|
|
7541
|
-
const _parseConfig = function _parseConfig2() {
|
|
7542
|
-
let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
7543
|
-
if (CONFIG && CONFIG === cfg) {
|
|
7544
|
-
return;
|
|
7545
|
-
}
|
|
7546
|
-
if (!cfg || typeof cfg !== "object") {
|
|
7547
|
-
cfg = {};
|
|
7548
|
-
}
|
|
7549
|
-
cfg = clone(cfg);
|
|
7550
|
-
PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
|
|
7551
|
-
SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
|
|
7552
|
-
transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
|
|
7553
|
-
ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") && arrayIsArray(cfg.ALLOWED_TAGS) ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
|
|
7554
|
-
ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") && arrayIsArray(cfg.ALLOWED_ATTR) ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
|
|
7555
|
-
ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") && arrayIsArray(cfg.ALLOWED_NAMESPACES) ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
|
|
7556
|
-
URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR) ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
|
|
7557
|
-
DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") && arrayIsArray(cfg.ADD_DATA_URI_TAGS) ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
|
|
7558
|
-
FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS) ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
|
|
7559
|
-
FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") && arrayIsArray(cfg.FORBID_TAGS) ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
|
|
7560
|
-
FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") && arrayIsArray(cfg.FORBID_ATTR) ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
|
|
7561
|
-
USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
|
|
7562
|
-
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
|
|
7563
|
-
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
|
|
7564
|
-
ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
|
|
7565
|
-
ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
|
|
7566
|
-
SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
|
|
7567
|
-
SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
|
|
7568
|
-
WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
|
|
7569
|
-
RETURN_DOM = cfg.RETURN_DOM || false;
|
|
7570
|
-
RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
|
|
7571
|
-
RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
|
|
7572
|
-
FORCE_BODY = cfg.FORCE_BODY || false;
|
|
7573
|
-
SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
|
|
7574
|
-
SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
|
|
7575
|
-
KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
|
|
7576
|
-
IN_PLACE = cfg.IN_PLACE || false;
|
|
7577
|
-
IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
|
|
7578
|
-
NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
|
|
7579
|
-
MATHML_TEXT_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "MATHML_TEXT_INTEGRATION_POINTS") && cfg.MATHML_TEXT_INTEGRATION_POINTS && typeof cfg.MATHML_TEXT_INTEGRATION_POINTS === "object" ? clone(cfg.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
|
|
7580
|
-
HTML_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "HTML_INTEGRATION_POINTS") && cfg.HTML_INTEGRATION_POINTS && typeof cfg.HTML_INTEGRATION_POINTS === "object" ? clone(cfg.HTML_INTEGRATION_POINTS) : addToSet({}, ["annotation-xml"]);
|
|
7581
|
-
const customElementHandling = objectHasOwnProperty(cfg, "CUSTOM_ELEMENT_HANDLING") && cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING === "object" ? clone(cfg.CUSTOM_ELEMENT_HANDLING) : create(null);
|
|
7582
|
-
CUSTOM_ELEMENT_HANDLING = create(null);
|
|
7583
|
-
if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) {
|
|
7584
|
-
CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
|
|
7585
|
-
}
|
|
7586
|
-
if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) {
|
|
7587
|
-
CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
|
|
7588
|
-
}
|
|
7589
|
-
if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") {
|
|
7590
|
-
CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
|
|
7591
|
-
}
|
|
7592
|
-
if (SAFE_FOR_TEMPLATES) {
|
|
7593
|
-
ALLOW_DATA_ATTR = false;
|
|
7594
|
-
}
|
|
7595
|
-
if (RETURN_DOM_FRAGMENT) {
|
|
7596
|
-
RETURN_DOM = true;
|
|
7597
|
-
}
|
|
7598
|
-
if (USE_PROFILES) {
|
|
7599
|
-
ALLOWED_TAGS = addToSet({}, text);
|
|
7600
|
-
ALLOWED_ATTR = create(null);
|
|
7601
|
-
if (USE_PROFILES.html === true) {
|
|
7602
|
-
addToSet(ALLOWED_TAGS, html$1);
|
|
7603
|
-
addToSet(ALLOWED_ATTR, html);
|
|
7604
|
-
}
|
|
7605
|
-
if (USE_PROFILES.svg === true) {
|
|
7606
|
-
addToSet(ALLOWED_TAGS, svg$1);
|
|
7607
|
-
addToSet(ALLOWED_ATTR, svg);
|
|
7608
|
-
addToSet(ALLOWED_ATTR, xml);
|
|
7609
|
-
}
|
|
7610
|
-
if (USE_PROFILES.svgFilters === true) {
|
|
7611
|
-
addToSet(ALLOWED_TAGS, svgFilters);
|
|
7612
|
-
addToSet(ALLOWED_ATTR, svg);
|
|
7613
|
-
addToSet(ALLOWED_ATTR, xml);
|
|
7614
|
-
}
|
|
7615
|
-
if (USE_PROFILES.mathMl === true) {
|
|
7616
|
-
addToSet(ALLOWED_TAGS, mathMl$1);
|
|
7617
|
-
addToSet(ALLOWED_ATTR, mathMl);
|
|
7618
|
-
addToSet(ALLOWED_ATTR, xml);
|
|
7619
|
-
}
|
|
7620
|
-
}
|
|
7621
|
-
EXTRA_ELEMENT_HANDLING.tagCheck = null;
|
|
7622
|
-
EXTRA_ELEMENT_HANDLING.attributeCheck = null;
|
|
7623
|
-
if (objectHasOwnProperty(cfg, "ADD_TAGS")) {
|
|
7624
|
-
if (typeof cfg.ADD_TAGS === "function") {
|
|
7625
|
-
EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
|
|
7626
|
-
} else if (arrayIsArray(cfg.ADD_TAGS)) {
|
|
7627
|
-
if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
|
|
7628
|
-
ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
|
7629
|
-
}
|
|
7630
|
-
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
|
|
7631
|
-
}
|
|
7632
|
-
}
|
|
7633
|
-
if (objectHasOwnProperty(cfg, "ADD_ATTR")) {
|
|
7634
|
-
if (typeof cfg.ADD_ATTR === "function") {
|
|
7635
|
-
EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
|
|
7636
|
-
} else if (arrayIsArray(cfg.ADD_ATTR)) {
|
|
7637
|
-
if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
|
|
7638
|
-
ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
7639
|
-
}
|
|
7640
|
-
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
|
7641
|
-
}
|
|
7642
|
-
}
|
|
7643
|
-
if (objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) {
|
|
7644
|
-
addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
|
|
7645
|
-
}
|
|
7646
|
-
if (objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS)) {
|
|
7647
|
-
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
|
|
7648
|
-
FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
7649
|
-
}
|
|
7650
|
-
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
|
|
7651
|
-
}
|
|
7652
|
-
if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
|
|
7653
|
-
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
|
|
7654
|
-
FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
7655
|
-
}
|
|
7656
|
-
addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
|
|
7657
|
-
}
|
|
7658
|
-
if (KEEP_CONTENT) {
|
|
7659
|
-
ALLOWED_TAGS["#text"] = true;
|
|
7660
|
-
}
|
|
7661
|
-
if (WHOLE_DOCUMENT) {
|
|
7662
|
-
addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
|
|
7663
|
-
}
|
|
7664
|
-
if (ALLOWED_TAGS.table) {
|
|
7665
|
-
addToSet(ALLOWED_TAGS, ["tbody"]);
|
|
7666
|
-
delete FORBID_TAGS.tbody;
|
|
7667
|
-
}
|
|
7668
|
-
if (cfg.TRUSTED_TYPES_POLICY) {
|
|
7669
|
-
if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
|
|
7670
|
-
throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
7671
|
-
}
|
|
7672
|
-
if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
|
|
7673
|
-
throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
7674
|
-
}
|
|
7675
|
-
trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
|
|
7676
|
-
emptyHTML = trustedTypesPolicy.createHTML("");
|
|
7677
|
-
} else {
|
|
7678
|
-
if (trustedTypesPolicy === void 0) {
|
|
7679
|
-
trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
|
|
7680
|
-
}
|
|
7681
|
-
if (trustedTypesPolicy !== null && typeof emptyHTML === "string") {
|
|
7682
|
-
emptyHTML = trustedTypesPolicy.createHTML("");
|
|
7683
|
-
}
|
|
7684
|
-
}
|
|
7685
|
-
if (freeze) {
|
|
7686
|
-
freeze(cfg);
|
|
7687
|
-
}
|
|
7688
|
-
CONFIG = cfg;
|
|
7689
|
-
};
|
|
7690
|
-
const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
|
|
7691
|
-
const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
|
|
7692
|
-
const _checkValidNamespace = function _checkValidNamespace2(element) {
|
|
7693
|
-
let parent = getParentNode(element);
|
|
7694
|
-
if (!parent || !parent.tagName) {
|
|
7695
|
-
parent = {
|
|
7696
|
-
namespaceURI: NAMESPACE,
|
|
7697
|
-
tagName: "template"
|
|
7698
|
-
};
|
|
7699
|
-
}
|
|
7700
|
-
const tagName = stringToLowerCase(element.tagName);
|
|
7701
|
-
const parentTagName = stringToLowerCase(parent.tagName);
|
|
7702
|
-
if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
|
|
7703
|
-
return false;
|
|
7704
|
-
}
|
|
7705
|
-
if (element.namespaceURI === SVG_NAMESPACE) {
|
|
7706
|
-
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
7707
|
-
return tagName === "svg";
|
|
7708
|
-
}
|
|
7709
|
-
if (parent.namespaceURI === MATHML_NAMESPACE) {
|
|
7710
|
-
return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
|
|
7711
|
-
}
|
|
7712
|
-
return Boolean(ALL_SVG_TAGS[tagName]);
|
|
7713
|
-
}
|
|
7714
|
-
if (element.namespaceURI === MATHML_NAMESPACE) {
|
|
7715
|
-
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
7716
|
-
return tagName === "math";
|
|
7717
|
-
}
|
|
7718
|
-
if (parent.namespaceURI === SVG_NAMESPACE) {
|
|
7719
|
-
return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
|
|
7720
|
-
}
|
|
7721
|
-
return Boolean(ALL_MATHML_TAGS[tagName]);
|
|
7722
|
-
}
|
|
7723
|
-
if (element.namespaceURI === HTML_NAMESPACE) {
|
|
7724
|
-
if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
|
|
7725
|
-
return false;
|
|
7726
|
-
}
|
|
7727
|
-
if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
|
|
7728
|
-
return false;
|
|
7729
|
-
}
|
|
7730
|
-
return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
|
|
7731
|
-
}
|
|
7732
|
-
if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
|
|
7733
|
-
return true;
|
|
7734
|
-
}
|
|
7735
|
-
return false;
|
|
7736
|
-
};
|
|
7737
|
-
const _forceRemove = function _forceRemove2(node) {
|
|
7738
|
-
arrayPush(DOMPurify.removed, {
|
|
7739
|
-
element: node
|
|
7740
|
-
});
|
|
7741
|
-
try {
|
|
7742
|
-
getParentNode(node).removeChild(node);
|
|
7743
|
-
} catch (_) {
|
|
7744
|
-
remove(node);
|
|
7745
|
-
}
|
|
7746
|
-
};
|
|
7747
|
-
const _removeAttribute = function _removeAttribute2(name, element) {
|
|
7748
|
-
try {
|
|
7749
|
-
arrayPush(DOMPurify.removed, {
|
|
7750
|
-
attribute: element.getAttributeNode(name),
|
|
7751
|
-
from: element
|
|
7752
|
-
});
|
|
7753
|
-
} catch (_) {
|
|
7754
|
-
arrayPush(DOMPurify.removed, {
|
|
7755
|
-
attribute: null,
|
|
7756
|
-
from: element
|
|
7757
|
-
});
|
|
7758
|
-
}
|
|
7759
|
-
element.removeAttribute(name);
|
|
7760
|
-
if (name === "is") {
|
|
7761
|
-
if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
|
|
7762
|
-
try {
|
|
7763
|
-
_forceRemove(element);
|
|
7764
|
-
} catch (_) {
|
|
7765
|
-
}
|
|
7766
|
-
} else {
|
|
7767
|
-
try {
|
|
7768
|
-
element.setAttribute(name, "");
|
|
7769
|
-
} catch (_) {
|
|
7770
|
-
}
|
|
7771
|
-
}
|
|
7772
|
-
}
|
|
7773
|
-
};
|
|
7774
|
-
const _initDocument = function _initDocument2(dirty) {
|
|
7775
|
-
let doc = null;
|
|
7776
|
-
let leadingWhitespace = null;
|
|
7777
|
-
if (FORCE_BODY) {
|
|
7778
|
-
dirty = "<remove></remove>" + dirty;
|
|
7779
|
-
} else {
|
|
7780
|
-
const matches = stringMatch(dirty, /^[\r\n\t ]+/);
|
|
7781
|
-
leadingWhitespace = matches && matches[0];
|
|
7782
|
-
}
|
|
7783
|
-
if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
|
|
7784
|
-
dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
|
|
7785
|
-
}
|
|
7786
|
-
const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
|
7787
|
-
if (NAMESPACE === HTML_NAMESPACE) {
|
|
7788
|
-
try {
|
|
7789
|
-
doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
|
|
7790
|
-
} catch (_) {
|
|
7791
|
-
}
|
|
7792
|
-
}
|
|
7793
|
-
if (!doc || !doc.documentElement) {
|
|
7794
|
-
doc = implementation.createDocument(NAMESPACE, "template", null);
|
|
7795
|
-
try {
|
|
7796
|
-
doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
|
|
7797
|
-
} catch (_) {
|
|
7798
|
-
}
|
|
7799
|
-
}
|
|
7800
|
-
const body = doc.body || doc.documentElement;
|
|
7801
|
-
if (dirty && leadingWhitespace) {
|
|
7802
|
-
body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
|
|
7803
|
-
}
|
|
7804
|
-
if (NAMESPACE === HTML_NAMESPACE) {
|
|
7805
|
-
return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
|
|
7806
|
-
}
|
|
7807
|
-
return WHOLE_DOCUMENT ? doc.documentElement : body;
|
|
7808
|
-
};
|
|
7809
|
-
const _createNodeIterator = function _createNodeIterator2(root) {
|
|
7810
|
-
return createNodeIterator.call(
|
|
7811
|
-
root.ownerDocument || root,
|
|
7812
|
-
root,
|
|
7813
|
-
// eslint-disable-next-line no-bitwise
|
|
7814
|
-
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION,
|
|
7815
|
-
null
|
|
7816
|
-
);
|
|
7817
|
-
};
|
|
7818
|
-
const _isClobbered = function _isClobbered2(element) {
|
|
7819
|
-
return element instanceof HTMLFormElement && (typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function");
|
|
7820
|
-
};
|
|
7821
|
-
const _isNode = function _isNode2(value) {
|
|
7822
|
-
return typeof Node2 === "function" && value instanceof Node2;
|
|
7823
|
-
};
|
|
7824
|
-
function _executeHooks(hooks2, currentNode, data) {
|
|
7825
|
-
arrayForEach(hooks2, (hook) => {
|
|
7826
|
-
hook.call(DOMPurify, currentNode, data, CONFIG);
|
|
7827
|
-
});
|
|
7828
|
-
}
|
|
7829
|
-
const _sanitizeElements = function _sanitizeElements2(currentNode) {
|
|
7830
|
-
let content = null;
|
|
7831
|
-
_executeHooks(hooks.beforeSanitizeElements, currentNode, null);
|
|
7832
|
-
if (_isClobbered(currentNode)) {
|
|
7833
|
-
_forceRemove(currentNode);
|
|
7834
|
-
return true;
|
|
7835
|
-
}
|
|
7836
|
-
const tagName = transformCaseFunc(currentNode.nodeName);
|
|
7837
|
-
_executeHooks(hooks.uponSanitizeElement, currentNode, {
|
|
7838
|
-
tagName,
|
|
7839
|
-
allowedTags: ALLOWED_TAGS
|
|
7840
|
-
});
|
|
7841
|
-
if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
|
|
7842
|
-
_forceRemove(currentNode);
|
|
7843
|
-
return true;
|
|
7844
|
-
}
|
|
7845
|
-
if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "style" && _isNode(currentNode.firstElementChild)) {
|
|
7846
|
-
_forceRemove(currentNode);
|
|
7847
|
-
return true;
|
|
7848
|
-
}
|
|
7849
|
-
if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
|
|
7850
|
-
_forceRemove(currentNode);
|
|
7851
|
-
return true;
|
|
7852
|
-
}
|
|
7853
|
-
if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
|
|
7854
|
-
_forceRemove(currentNode);
|
|
7855
|
-
return true;
|
|
7856
|
-
}
|
|
7857
|
-
if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
|
|
7858
|
-
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
|
|
7859
|
-
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
|
|
7860
|
-
return false;
|
|
7861
|
-
}
|
|
7862
|
-
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
|
|
7863
|
-
return false;
|
|
7864
|
-
}
|
|
7865
|
-
}
|
|
7866
|
-
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
|
7867
|
-
const parentNode = getParentNode(currentNode) || currentNode.parentNode;
|
|
7868
|
-
const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
|
|
7869
|
-
if (childNodes && parentNode) {
|
|
7870
|
-
const childCount = childNodes.length;
|
|
7871
|
-
for (let i = childCount - 1; i >= 0; --i) {
|
|
7872
|
-
const childClone = cloneNode2(childNodes[i], true);
|
|
7873
|
-
parentNode.insertBefore(childClone, getNextSibling(currentNode));
|
|
7874
|
-
}
|
|
7875
|
-
}
|
|
7876
|
-
}
|
|
7877
|
-
_forceRemove(currentNode);
|
|
7878
|
-
return true;
|
|
7879
|
-
}
|
|
7880
|
-
if (currentNode instanceof Element2 && !_checkValidNamespace(currentNode)) {
|
|
7881
|
-
_forceRemove(currentNode);
|
|
7882
|
-
return true;
|
|
7883
|
-
}
|
|
7884
|
-
if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
|
|
7885
|
-
_forceRemove(currentNode);
|
|
7886
|
-
return true;
|
|
7887
|
-
}
|
|
7888
|
-
if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
|
|
7889
|
-
content = currentNode.textContent;
|
|
7890
|
-
arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
|
|
7891
|
-
content = stringReplace(content, expr, " ");
|
|
7892
|
-
});
|
|
7893
|
-
if (currentNode.textContent !== content) {
|
|
7894
|
-
arrayPush(DOMPurify.removed, {
|
|
7895
|
-
element: currentNode.cloneNode()
|
|
7896
|
-
});
|
|
7897
|
-
currentNode.textContent = content;
|
|
7898
|
-
}
|
|
7899
|
-
}
|
|
7900
|
-
_executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
|
7901
|
-
return false;
|
|
7902
|
-
};
|
|
7903
|
-
const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
|
|
7904
|
-
if (FORBID_ATTR[lcName]) {
|
|
7905
|
-
return false;
|
|
7906
|
-
}
|
|
7907
|
-
if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
|
|
7908
|
-
return false;
|
|
7909
|
-
}
|
|
7910
|
-
const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
|
|
7911
|
-
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName)) ;
|
|
7912
|
-
else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR2, lcName)) ;
|
|
7913
|
-
else if (!nameIsPermitted || FORBID_ATTR[lcName]) {
|
|
7914
|
-
if (
|
|
7915
|
-
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
7916
|
-
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
7917
|
-
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
7918
|
-
_isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
7919
|
-
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
7920
|
-
lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))
|
|
7921
|
-
) ;
|
|
7922
|
-
else {
|
|
7923
|
-
return false;
|
|
7924
|
-
}
|
|
7925
|
-
} else if (URI_SAFE_ATTRIBUTES[lcName]) ;
|
|
7926
|
-
else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE2, ""))) ;
|
|
7927
|
-
else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) ;
|
|
7928
|
-
else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA2, stringReplace(value, ATTR_WHITESPACE2, ""))) ;
|
|
7929
|
-
else if (value) {
|
|
7930
|
-
return false;
|
|
7931
|
-
} else ;
|
|
7932
|
-
return true;
|
|
7933
|
-
};
|
|
7934
|
-
const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, ["annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph"]);
|
|
7935
|
-
const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
|
|
7936
|
-
return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT2, tagName);
|
|
7937
|
-
};
|
|
7938
|
-
const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
|
|
7939
|
-
_executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
|
|
7940
|
-
const {
|
|
7941
|
-
attributes
|
|
7942
|
-
} = currentNode;
|
|
7943
|
-
if (!attributes || _isClobbered(currentNode)) {
|
|
7944
|
-
return;
|
|
7945
|
-
}
|
|
7946
|
-
const hookEvent = {
|
|
7947
|
-
attrName: "",
|
|
7948
|
-
attrValue: "",
|
|
7949
|
-
keepAttr: true,
|
|
7950
|
-
allowedAttributes: ALLOWED_ATTR,
|
|
7951
|
-
forceKeepAttr: void 0
|
|
7952
|
-
};
|
|
7953
|
-
let l = attributes.length;
|
|
7954
|
-
while (l--) {
|
|
7955
|
-
const attr = attributes[l];
|
|
7956
|
-
const {
|
|
7957
|
-
name,
|
|
7958
|
-
namespaceURI,
|
|
7959
|
-
value: attrValue
|
|
7960
|
-
} = attr;
|
|
7961
|
-
const lcName = transformCaseFunc(name);
|
|
7962
|
-
const initValue = attrValue;
|
|
7963
|
-
let value = name === "value" ? initValue : stringTrim(initValue);
|
|
7964
|
-
hookEvent.attrName = lcName;
|
|
7965
|
-
hookEvent.attrValue = value;
|
|
7966
|
-
hookEvent.keepAttr = true;
|
|
7967
|
-
hookEvent.forceKeepAttr = void 0;
|
|
7968
|
-
_executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
|
|
7969
|
-
value = hookEvent.attrValue;
|
|
7970
|
-
if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
|
|
7971
|
-
_removeAttribute(name, currentNode);
|
|
7972
|
-
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
7973
|
-
}
|
|
7974
|
-
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
|
|
7975
|
-
_removeAttribute(name, currentNode);
|
|
7976
|
-
continue;
|
|
7977
|
-
}
|
|
7978
|
-
if (lcName === "attributename" && stringMatch(value, "href")) {
|
|
7979
|
-
_removeAttribute(name, currentNode);
|
|
7980
|
-
continue;
|
|
7981
|
-
}
|
|
7982
|
-
if (hookEvent.forceKeepAttr) {
|
|
7983
|
-
continue;
|
|
7984
|
-
}
|
|
7985
|
-
if (!hookEvent.keepAttr) {
|
|
7986
|
-
_removeAttribute(name, currentNode);
|
|
7987
|
-
continue;
|
|
7988
|
-
}
|
|
7989
|
-
if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
|
|
7990
|
-
_removeAttribute(name, currentNode);
|
|
7991
|
-
continue;
|
|
7992
|
-
}
|
|
7993
|
-
if (SAFE_FOR_TEMPLATES) {
|
|
7994
|
-
arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
|
|
7995
|
-
value = stringReplace(value, expr, " ");
|
|
7996
|
-
});
|
|
7997
|
-
}
|
|
7998
|
-
const lcTag = transformCaseFunc(currentNode.nodeName);
|
|
7999
|
-
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
8000
|
-
_removeAttribute(name, currentNode);
|
|
8001
|
-
continue;
|
|
8002
|
-
}
|
|
8003
|
-
if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") {
|
|
8004
|
-
if (namespaceURI) ;
|
|
8005
|
-
else {
|
|
8006
|
-
switch (trustedTypes.getAttributeType(lcTag, lcName)) {
|
|
8007
|
-
case "TrustedHTML": {
|
|
8008
|
-
value = trustedTypesPolicy.createHTML(value);
|
|
8009
|
-
break;
|
|
8010
|
-
}
|
|
8011
|
-
case "TrustedScriptURL": {
|
|
8012
|
-
value = trustedTypesPolicy.createScriptURL(value);
|
|
8013
|
-
break;
|
|
8014
|
-
}
|
|
8015
|
-
}
|
|
8016
|
-
}
|
|
8017
|
-
}
|
|
8018
|
-
if (value !== initValue) {
|
|
8019
|
-
try {
|
|
8020
|
-
if (namespaceURI) {
|
|
8021
|
-
currentNode.setAttributeNS(namespaceURI, name, value);
|
|
8022
|
-
} else {
|
|
8023
|
-
currentNode.setAttribute(name, value);
|
|
8024
|
-
}
|
|
8025
|
-
if (_isClobbered(currentNode)) {
|
|
8026
|
-
_forceRemove(currentNode);
|
|
8027
|
-
} else {
|
|
8028
|
-
arrayPop(DOMPurify.removed);
|
|
8029
|
-
}
|
|
8030
|
-
} catch (_) {
|
|
8031
|
-
_removeAttribute(name, currentNode);
|
|
8032
|
-
}
|
|
8033
|
-
}
|
|
8034
|
-
}
|
|
8035
|
-
_executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
|
|
8036
|
-
};
|
|
8037
|
-
const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
|
|
8038
|
-
let shadowNode = null;
|
|
8039
|
-
const shadowIterator = _createNodeIterator(fragment);
|
|
8040
|
-
_executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
|
|
8041
|
-
while (shadowNode = shadowIterator.nextNode()) {
|
|
8042
|
-
_executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
|
|
8043
|
-
_sanitizeElements(shadowNode);
|
|
8044
|
-
_sanitizeAttributes(shadowNode);
|
|
8045
|
-
if (shadowNode.content instanceof DocumentFragment) {
|
|
8046
|
-
_sanitizeShadowDOM2(shadowNode.content);
|
|
8047
|
-
}
|
|
8048
|
-
}
|
|
8049
|
-
_executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
|
|
8050
|
-
};
|
|
8051
|
-
DOMPurify.sanitize = function(dirty) {
|
|
8052
|
-
let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
8053
|
-
let body = null;
|
|
8054
|
-
let importedNode = null;
|
|
8055
|
-
let currentNode = null;
|
|
8056
|
-
let returnNode = null;
|
|
8057
|
-
IS_EMPTY_INPUT = !dirty;
|
|
8058
|
-
if (IS_EMPTY_INPUT) {
|
|
8059
|
-
dirty = "<!-->";
|
|
8060
|
-
}
|
|
8061
|
-
if (typeof dirty !== "string" && !_isNode(dirty)) {
|
|
8062
|
-
dirty = stringifyValue(dirty);
|
|
8063
|
-
if (typeof dirty !== "string") {
|
|
8064
|
-
throw typeErrorCreate("dirty is not a string, aborting");
|
|
8065
|
-
}
|
|
8066
|
-
}
|
|
8067
|
-
if (!DOMPurify.isSupported) {
|
|
8068
|
-
return dirty;
|
|
8069
|
-
}
|
|
8070
|
-
if (!SET_CONFIG) {
|
|
8071
|
-
_parseConfig(cfg);
|
|
8072
|
-
}
|
|
8073
|
-
DOMPurify.removed = [];
|
|
8074
|
-
if (typeof dirty === "string") {
|
|
8075
|
-
IN_PLACE = false;
|
|
8076
|
-
}
|
|
8077
|
-
if (IN_PLACE) {
|
|
8078
|
-
const nn = dirty.nodeName;
|
|
8079
|
-
if (typeof nn === "string") {
|
|
8080
|
-
const tagName = transformCaseFunc(nn);
|
|
8081
|
-
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
8082
|
-
throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
|
|
8083
|
-
}
|
|
8084
|
-
}
|
|
8085
|
-
} else if (dirty instanceof Node2) {
|
|
8086
|
-
body = _initDocument("<!---->");
|
|
8087
|
-
importedNode = body.ownerDocument.importNode(dirty, true);
|
|
8088
|
-
if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") {
|
|
8089
|
-
body = importedNode;
|
|
8090
|
-
} else if (importedNode.nodeName === "HTML") {
|
|
8091
|
-
body = importedNode;
|
|
8092
|
-
} else {
|
|
8093
|
-
body.appendChild(importedNode);
|
|
8094
|
-
}
|
|
8095
|
-
} else {
|
|
8096
|
-
if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
|
|
8097
|
-
dirty.indexOf("<") === -1) {
|
|
8098
|
-
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
|
8099
|
-
}
|
|
8100
|
-
body = _initDocument(dirty);
|
|
8101
|
-
if (!body) {
|
|
8102
|
-
return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
|
|
8103
|
-
}
|
|
8104
|
-
}
|
|
8105
|
-
if (body && FORCE_BODY) {
|
|
8106
|
-
_forceRemove(body.firstChild);
|
|
8107
|
-
}
|
|
8108
|
-
const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
|
|
8109
|
-
while (currentNode = nodeIterator.nextNode()) {
|
|
8110
|
-
_sanitizeElements(currentNode);
|
|
8111
|
-
_sanitizeAttributes(currentNode);
|
|
8112
|
-
if (currentNode.content instanceof DocumentFragment) {
|
|
8113
|
-
_sanitizeShadowDOM2(currentNode.content);
|
|
8114
|
-
}
|
|
8115
|
-
}
|
|
8116
|
-
if (IN_PLACE) {
|
|
8117
|
-
return dirty;
|
|
8118
|
-
}
|
|
8119
|
-
if (RETURN_DOM) {
|
|
8120
|
-
if (SAFE_FOR_TEMPLATES) {
|
|
8121
|
-
body.normalize();
|
|
8122
|
-
let html2 = body.innerHTML;
|
|
8123
|
-
arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
|
|
8124
|
-
html2 = stringReplace(html2, expr, " ");
|
|
8125
|
-
});
|
|
8126
|
-
body.innerHTML = html2;
|
|
8127
|
-
}
|
|
8128
|
-
if (RETURN_DOM_FRAGMENT) {
|
|
8129
|
-
returnNode = createDocumentFragment.call(body.ownerDocument);
|
|
8130
|
-
while (body.firstChild) {
|
|
8131
|
-
returnNode.appendChild(body.firstChild);
|
|
8132
|
-
}
|
|
8133
|
-
} else {
|
|
8134
|
-
returnNode = body;
|
|
8135
|
-
}
|
|
8136
|
-
if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
|
|
8137
|
-
returnNode = importNode.call(originalDocument, returnNode, true);
|
|
8138
|
-
}
|
|
8139
|
-
return returnNode;
|
|
8140
|
-
}
|
|
8141
|
-
let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
|
|
8142
|
-
if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
|
|
8143
|
-
serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
|
|
8144
|
-
}
|
|
8145
|
-
if (SAFE_FOR_TEMPLATES) {
|
|
8146
|
-
arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
|
|
8147
|
-
serializedHTML = stringReplace(serializedHTML, expr, " ");
|
|
8148
|
-
});
|
|
8149
|
-
}
|
|
8150
|
-
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
|
|
8151
|
-
};
|
|
8152
|
-
DOMPurify.setConfig = function() {
|
|
8153
|
-
let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
8154
|
-
_parseConfig(cfg);
|
|
8155
|
-
SET_CONFIG = true;
|
|
8156
|
-
};
|
|
8157
|
-
DOMPurify.clearConfig = function() {
|
|
8158
|
-
CONFIG = null;
|
|
8159
|
-
SET_CONFIG = false;
|
|
8160
|
-
};
|
|
8161
|
-
DOMPurify.isValidAttribute = function(tag, attr, value) {
|
|
8162
|
-
if (!CONFIG) {
|
|
8163
|
-
_parseConfig({});
|
|
8164
|
-
}
|
|
8165
|
-
const lcTag = transformCaseFunc(tag);
|
|
8166
|
-
const lcName = transformCaseFunc(attr);
|
|
8167
|
-
return _isValidAttribute(lcTag, lcName, value);
|
|
8168
|
-
};
|
|
8169
|
-
DOMPurify.addHook = function(entryPoint, hookFunction) {
|
|
8170
|
-
if (typeof hookFunction !== "function") {
|
|
8171
|
-
return;
|
|
8172
|
-
}
|
|
8173
|
-
arrayPush(hooks[entryPoint], hookFunction);
|
|
8174
|
-
};
|
|
8175
|
-
DOMPurify.removeHook = function(entryPoint, hookFunction) {
|
|
8176
|
-
if (hookFunction !== void 0) {
|
|
8177
|
-
const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
|
|
8178
|
-
return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0];
|
|
8179
|
-
}
|
|
8180
|
-
return arrayPop(hooks[entryPoint]);
|
|
8181
|
-
};
|
|
8182
|
-
DOMPurify.removeHooks = function(entryPoint) {
|
|
8183
|
-
hooks[entryPoint] = [];
|
|
8184
|
-
};
|
|
8185
|
-
DOMPurify.removeAllHooks = function() {
|
|
8186
|
-
hooks = _createHooksMap();
|
|
8187
|
-
};
|
|
8188
|
-
return DOMPurify;
|
|
8189
|
-
}
|
|
8190
|
-
var purify = createDOMPurify();
|
|
8191
|
-
var browser_default = purify;
|
|
8192
|
-
purify.sanitize.bind(purify);
|
|
8193
|
-
purify.isSupported;
|
|
8194
|
-
purify.addHook.bind(purify);
|
|
8195
|
-
purify.removeHook.bind(purify);
|
|
8196
|
-
purify.removeHooks.bind(purify);
|
|
8197
|
-
purify.removeAllHooks.bind(purify);
|
|
8198
|
-
purify.setConfig.bind(purify);
|
|
8199
|
-
purify.clearConfig.bind(purify);
|
|
8200
|
-
purify.isValidAttribute.bind(purify);
|
|
8201
|
-
purify.version;
|
|
8202
|
-
purify.removed;
|
|
8203
|
-
function getDefaultExportFromCjs(x) {
|
|
8204
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
8205
|
-
}
|
|
8206
|
-
function getAugmentedNamespace(n) {
|
|
8207
|
-
if (Object.prototype.hasOwnProperty.call(n, "__esModule")) return n;
|
|
8208
|
-
var f = n.default;
|
|
8209
|
-
if (typeof f == "function") {
|
|
8210
|
-
var a = function a2() {
|
|
8211
|
-
if (this instanceof a2) {
|
|
8212
|
-
return Reflect.construct(f, arguments, this.constructor);
|
|
8213
|
-
}
|
|
8214
|
-
return f.apply(this, arguments);
|
|
8215
|
-
};
|
|
8216
|
-
a.prototype = f.prototype;
|
|
8217
|
-
} else a = {};
|
|
8218
|
-
Object.defineProperty(a, "__esModule", { value: true });
|
|
8219
|
-
Object.keys(n).forEach(function(k) {
|
|
8220
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
8221
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
8222
|
-
enumerable: true,
|
|
8223
|
-
get: function() {
|
|
8224
|
-
return n[k];
|
|
8225
|
-
}
|
|
8226
|
-
});
|
|
8227
|
-
});
|
|
8228
|
-
return a;
|
|
8229
|
-
}
|
|
8230
|
-
var lib$1 = {};
|
|
8231
|
-
var htmlToDom = {};
|
|
8232
|
-
var hasRequiredHtmlToDom;
|
|
8233
|
-
function requireHtmlToDom() {
|
|
8234
|
-
if (hasRequiredHtmlToDom) return htmlToDom;
|
|
8235
|
-
hasRequiredHtmlToDom = 1;
|
|
8236
|
-
Object.defineProperty(htmlToDom, "__esModule", { value: true });
|
|
8237
|
-
var ElementType2;
|
|
8238
|
-
(function(ElementType3) {
|
|
8239
|
-
ElementType3["Root"] = "root";
|
|
8240
|
-
ElementType3["Text"] = "text";
|
|
8241
|
-
ElementType3["Directive"] = "directive";
|
|
8242
|
-
ElementType3["Comment"] = "comment";
|
|
8243
|
-
ElementType3["Script"] = "script";
|
|
8244
|
-
ElementType3["Style"] = "style";
|
|
8245
|
-
ElementType3["Tag"] = "tag";
|
|
8246
|
-
ElementType3["CDATA"] = "cdata";
|
|
8247
|
-
ElementType3["Doctype"] = "doctype";
|
|
8248
|
-
})(ElementType2 || (ElementType2 = {}));
|
|
8249
|
-
function isTag$12(element) {
|
|
8250
|
-
return element.type === ElementType2.Tag || element.type === ElementType2.Script || element.type === ElementType2.Style;
|
|
8251
|
-
}
|
|
8252
|
-
ElementType2.Root;
|
|
8253
|
-
ElementType2.Text;
|
|
8254
|
-
ElementType2.Directive;
|
|
8255
|
-
ElementType2.Comment;
|
|
8256
|
-
ElementType2.Script;
|
|
8257
|
-
ElementType2.Style;
|
|
8258
|
-
ElementType2.Tag;
|
|
8259
|
-
ElementType2.CDATA;
|
|
8260
|
-
ElementType2.Doctype;
|
|
8261
|
-
class Node2 {
|
|
8262
|
-
constructor() {
|
|
8263
|
-
/** Parent of the node */
|
|
8264
|
-
__publicField(this, "parent", null);
|
|
8265
|
-
/** Previous sibling */
|
|
8266
|
-
__publicField(this, "prev", null);
|
|
8267
|
-
/** Next sibling */
|
|
8268
|
-
__publicField(this, "next", null);
|
|
8269
|
-
/** The start index of the node. Requires `withStartIndices` on the handler to be `true. */
|
|
8270
|
-
__publicField(this, "startIndex", null);
|
|
8271
|
-
/** The end index of the node. Requires `withEndIndices` on the handler to be `true. */
|
|
8272
|
-
__publicField(this, "endIndex", null);
|
|
8273
|
-
}
|
|
8274
|
-
// Read-write aliases for properties
|
|
8275
|
-
/**
|
|
8276
|
-
* Same as {@link parent}.
|
|
8277
|
-
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
|
8278
|
-
*/
|
|
8279
|
-
get parentNode() {
|
|
8280
|
-
return this.parent;
|
|
8281
|
-
}
|
|
8282
|
-
set parentNode(parent) {
|
|
8283
|
-
this.parent = parent;
|
|
8284
|
-
}
|
|
8285
|
-
/**
|
|
8286
|
-
* Same as {@link prev}.
|
|
8287
|
-
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
|
8288
|
-
*/
|
|
8289
|
-
get previousSibling() {
|
|
8290
|
-
return this.prev;
|
|
8291
|
-
}
|
|
8292
|
-
set previousSibling(previous) {
|
|
8293
|
-
this.prev = previous;
|
|
8294
|
-
}
|
|
8295
|
-
/**
|
|
8296
|
-
* Same as {@link next}.
|
|
8297
|
-
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
|
8298
|
-
*/
|
|
8299
|
-
get nextSibling() {
|
|
8300
|
-
return this.next;
|
|
8301
|
-
}
|
|
8302
|
-
set nextSibling(next) {
|
|
8303
|
-
this.next = next;
|
|
8304
|
-
}
|
|
8305
|
-
/**
|
|
8306
|
-
* Clone this node, and optionally its children.
|
|
8307
|
-
* @param recursive Clone child nodes as well.
|
|
8308
|
-
* @returns A clone of the node.
|
|
8309
|
-
*/
|
|
8310
|
-
cloneNode(recursive = false) {
|
|
8311
|
-
return cloneNode2(this, recursive);
|
|
8312
|
-
}
|
|
8313
|
-
}
|
|
8314
|
-
class DataNode2 extends Node2 {
|
|
8315
|
-
/**
|
|
8316
|
-
* @param data The content of the data node
|
|
8317
|
-
*/
|
|
8318
|
-
constructor(data) {
|
|
8319
|
-
super();
|
|
8320
|
-
__publicField(this, "data");
|
|
8321
|
-
this.data = data;
|
|
8322
|
-
}
|
|
8323
|
-
/**
|
|
8324
|
-
* Same as {@link data}.
|
|
8325
|
-
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
|
8326
|
-
*/
|
|
8327
|
-
get nodeValue() {
|
|
8328
|
-
return this.data;
|
|
8329
|
-
}
|
|
8330
|
-
set nodeValue(data) {
|
|
8331
|
-
this.data = data;
|
|
8332
|
-
}
|
|
8333
|
-
}
|
|
8334
|
-
class Text2 extends DataNode2 {
|
|
8335
|
-
constructor() {
|
|
8336
|
-
super(...arguments);
|
|
8337
|
-
__publicField(this, "type", ElementType2.Text);
|
|
8338
|
-
}
|
|
8339
|
-
get nodeType() {
|
|
8340
|
-
return 3;
|
|
8341
|
-
}
|
|
8342
|
-
}
|
|
8343
|
-
class Comment2 extends DataNode2 {
|
|
8344
|
-
constructor() {
|
|
8345
|
-
super(...arguments);
|
|
8346
|
-
__publicField(this, "type", ElementType2.Comment);
|
|
8347
|
-
}
|
|
8348
|
-
get nodeType() {
|
|
8349
|
-
return 8;
|
|
8350
|
-
}
|
|
8351
|
-
}
|
|
8352
|
-
class ProcessingInstruction2 extends DataNode2 {
|
|
8353
|
-
constructor(name, data) {
|
|
8354
|
-
super(data);
|
|
8355
|
-
__publicField(this, "type", ElementType2.Directive);
|
|
8356
|
-
__publicField(this, "name");
|
|
8357
|
-
/** If this is a doctype, the document type name (parse5 only). */
|
|
8358
|
-
__publicField(this, "x-name");
|
|
8359
|
-
/** If this is a doctype, the document type public identifier (parse5 only). */
|
|
8360
|
-
__publicField(this, "x-publicId");
|
|
8361
|
-
/** If this is a doctype, the document type system identifier (parse5 only). */
|
|
8362
|
-
__publicField(this, "x-systemId");
|
|
8363
|
-
this.name = name;
|
|
8364
|
-
}
|
|
8365
|
-
get nodeType() {
|
|
8366
|
-
return 1;
|
|
8367
|
-
}
|
|
8368
|
-
}
|
|
8369
|
-
class NodeWithChildren2 extends Node2 {
|
|
8370
|
-
/**
|
|
8371
|
-
* @param children Children of the node. Only certain node types can have children.
|
|
8372
|
-
*/
|
|
8373
|
-
constructor(children) {
|
|
8374
|
-
super();
|
|
8375
|
-
__publicField(this, "children");
|
|
8376
|
-
this.children = children;
|
|
8377
|
-
}
|
|
8378
|
-
// Aliases
|
|
8379
|
-
/** First child of the node. */
|
|
8380
|
-
get firstChild() {
|
|
8381
|
-
return this.children[0] ?? null;
|
|
8382
|
-
}
|
|
8383
|
-
/** Last child of the node. */
|
|
8384
|
-
get lastChild() {
|
|
8385
|
-
return this.children.length > 0 ? this.children[this.children.length - 1] : null;
|
|
8386
|
-
}
|
|
8387
|
-
/**
|
|
8388
|
-
* Same as {@link children}.
|
|
8389
|
-
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
|
8390
|
-
*/
|
|
8391
|
-
get childNodes() {
|
|
8392
|
-
return this.children;
|
|
8393
|
-
}
|
|
8394
|
-
set childNodes(children) {
|
|
8395
|
-
this.children = children;
|
|
8396
|
-
}
|
|
8397
|
-
}
|
|
8398
|
-
class CDATA2 extends NodeWithChildren2 {
|
|
8399
|
-
constructor() {
|
|
8400
|
-
super(...arguments);
|
|
8401
|
-
__publicField(this, "type", ElementType2.CDATA);
|
|
8402
|
-
}
|
|
8403
|
-
get nodeType() {
|
|
8404
|
-
return 4;
|
|
8405
|
-
}
|
|
8406
|
-
}
|
|
8407
|
-
class Document2 extends NodeWithChildren2 {
|
|
8408
|
-
constructor() {
|
|
8409
|
-
super(...arguments);
|
|
8410
|
-
__publicField(this, "type", ElementType2.Root);
|
|
8411
|
-
}
|
|
8412
|
-
get nodeType() {
|
|
8413
|
-
return 9;
|
|
8414
|
-
}
|
|
8415
|
-
}
|
|
8416
|
-
class Element2 extends NodeWithChildren2 {
|
|
8417
|
-
/**
|
|
8418
|
-
* @param name Name of the tag, eg. `div`, `span`.
|
|
8419
|
-
* @param attribs Object mapping attribute names to attribute values.
|
|
8420
|
-
* @param children Children of the node.
|
|
8421
|
-
* @param type Node type used for the new node instance.
|
|
8422
|
-
*/
|
|
8423
|
-
constructor(name, attribs, children = [], type = name === "script" ? ElementType2.Script : name === "style" ? ElementType2.Style : ElementType2.Tag) {
|
|
8424
|
-
super(children);
|
|
8425
|
-
__publicField(this, "name");
|
|
8426
|
-
__publicField(this, "attribs");
|
|
8427
|
-
__publicField(this, "type");
|
|
8428
|
-
/** Element namespace (parse5 only). */
|
|
8429
|
-
__publicField(this, "namespace");
|
|
8430
|
-
/** Element attribute namespaces (parse5 only). */
|
|
8431
|
-
__publicField(this, "x-attribsNamespace");
|
|
8432
|
-
/** Element attribute namespace-related prefixes (parse5 only). */
|
|
8433
|
-
__publicField(this, "x-attribsPrefix");
|
|
8434
|
-
this.name = name;
|
|
8435
|
-
this.attribs = attribs;
|
|
8436
|
-
this.type = type;
|
|
8437
|
-
}
|
|
8438
|
-
get nodeType() {
|
|
8439
|
-
return 1;
|
|
8440
|
-
}
|
|
8441
|
-
// DOM Level 1 aliases
|
|
8442
|
-
/**
|
|
8443
|
-
* Same as {@link name}.
|
|
8444
|
-
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
|
8445
|
-
*/
|
|
8446
|
-
get tagName() {
|
|
8447
|
-
return this.name;
|
|
8448
|
-
}
|
|
8449
|
-
set tagName(name) {
|
|
8450
|
-
this.name = name;
|
|
8451
|
-
}
|
|
8452
|
-
get attributes() {
|
|
8453
|
-
return Object.keys(this.attribs).map((name) => {
|
|
8454
|
-
var _a, _b;
|
|
8455
|
-
return {
|
|
8456
|
-
name,
|
|
8457
|
-
value: this.attribs[name],
|
|
8458
|
-
namespace: (_a = this["x-attribsNamespace"]) == null ? void 0 : _a[name],
|
|
8459
|
-
prefix: (_b = this["x-attribsPrefix"]) == null ? void 0 : _b[name]
|
|
8460
|
-
};
|
|
8461
|
-
});
|
|
8462
|
-
}
|
|
8463
|
-
}
|
|
8464
|
-
function isTag2(node) {
|
|
8465
|
-
return isTag$12(node);
|
|
8466
|
-
}
|
|
8467
|
-
function isCDATA2(node) {
|
|
8468
|
-
return node.type === ElementType2.CDATA;
|
|
8469
|
-
}
|
|
8470
|
-
function isText2(node) {
|
|
8471
|
-
return node.type === ElementType2.Text;
|
|
8472
|
-
}
|
|
8473
|
-
function isComment2(node) {
|
|
8474
|
-
return node.type === ElementType2.Comment;
|
|
8475
|
-
}
|
|
8476
|
-
function isDirective2(node) {
|
|
8477
|
-
return node.type === ElementType2.Directive;
|
|
8478
|
-
}
|
|
8479
|
-
function isDocument2(node) {
|
|
8480
|
-
return node.type === ElementType2.Root;
|
|
8481
|
-
}
|
|
8482
|
-
function cloneNode2(node, recursive = false) {
|
|
8483
|
-
let result;
|
|
8484
|
-
if (isText2(node)) {
|
|
8485
|
-
result = new Text2(node.data);
|
|
8486
|
-
} else if (isComment2(node)) {
|
|
8487
|
-
result = new Comment2(node.data);
|
|
8488
|
-
} else if (isTag2(node)) {
|
|
8489
|
-
const children = recursive ? cloneChildren2(node.children) : [];
|
|
8490
|
-
const clone2 = new Element2(node.name, { ...node.attribs }, children);
|
|
8491
|
-
for (const child of children) {
|
|
8492
|
-
child.parent = clone2;
|
|
8493
|
-
}
|
|
8494
|
-
if (node.namespace != null) {
|
|
8495
|
-
clone2.namespace = node.namespace;
|
|
8496
|
-
}
|
|
8497
|
-
if (node["x-attribsNamespace"]) {
|
|
8498
|
-
clone2["x-attribsNamespace"] = { ...node["x-attribsNamespace"] };
|
|
8499
|
-
}
|
|
8500
|
-
if (node["x-attribsPrefix"]) {
|
|
8501
|
-
clone2["x-attribsPrefix"] = { ...node["x-attribsPrefix"] };
|
|
8502
|
-
}
|
|
8503
|
-
result = clone2;
|
|
8504
|
-
} else if (isCDATA2(node)) {
|
|
8505
|
-
const children = recursive ? cloneChildren2(node.children) : [];
|
|
8506
|
-
const clone2 = new CDATA2(children);
|
|
8507
|
-
for (const child of children) {
|
|
8508
|
-
child.parent = clone2;
|
|
8509
|
-
}
|
|
8510
|
-
result = clone2;
|
|
8511
|
-
} else if (isDocument2(node)) {
|
|
8512
|
-
const children = recursive ? cloneChildren2(node.children) : [];
|
|
8513
|
-
const clone2 = new Document2(children);
|
|
8514
|
-
for (const child of children) {
|
|
8515
|
-
child.parent = clone2;
|
|
8516
|
-
}
|
|
8517
|
-
if (node["x-mode"]) {
|
|
8518
|
-
clone2["x-mode"] = node["x-mode"];
|
|
8519
|
-
}
|
|
8520
|
-
result = clone2;
|
|
8521
|
-
} else if (isDirective2(node)) {
|
|
8522
|
-
const instruction = new ProcessingInstruction2(node.name, node.data);
|
|
8523
|
-
if (node["x-name"] != null) {
|
|
8524
|
-
instruction["x-name"] = node["x-name"];
|
|
8525
|
-
instruction["x-publicId"] = node["x-publicId"];
|
|
8526
|
-
instruction["x-systemId"] = node["x-systemId"];
|
|
8527
|
-
}
|
|
8528
|
-
result = instruction;
|
|
8529
|
-
} else {
|
|
8530
|
-
throw new Error(`Not implemented yet: ${node.type}`);
|
|
8531
|
-
}
|
|
8532
|
-
result.startIndex = node.startIndex;
|
|
8533
|
-
result.endIndex = node.endIndex;
|
|
8534
|
-
if (node.sourceCodeLocation != null) {
|
|
8535
|
-
result.sourceCodeLocation = node.sourceCodeLocation;
|
|
8536
|
-
}
|
|
8537
|
-
return result;
|
|
8538
|
-
}
|
|
8539
|
-
function cloneChildren2(childs) {
|
|
8540
|
-
const children = childs.map((child) => cloneNode2(child, true));
|
|
8541
|
-
for (let index = 1; index < children.length; index++) {
|
|
8542
|
-
children[index].prev = children[index - 1];
|
|
8543
|
-
children[index - 1].next = children[index];
|
|
8544
|
-
}
|
|
8545
|
-
return children;
|
|
8546
|
-
}
|
|
8547
|
-
var CASE_SENSITIVE_TAG_NAMES = [
|
|
8548
|
-
"animateMotion",
|
|
8549
|
-
"animateTransform",
|
|
8550
|
-
"clipPath",
|
|
8551
|
-
"feBlend",
|
|
8552
|
-
"feColorMatrix",
|
|
8553
|
-
"feComponentTransfer",
|
|
8554
|
-
"feComposite",
|
|
8555
|
-
"feConvolveMatrix",
|
|
8556
|
-
"feDiffuseLighting",
|
|
8557
|
-
"feDisplacementMap",
|
|
8558
|
-
"feDropShadow",
|
|
8559
|
-
"feFlood",
|
|
8560
|
-
"feFuncA",
|
|
8561
|
-
"feFuncB",
|
|
8562
|
-
"feFuncG",
|
|
8563
|
-
"feFuncR",
|
|
8564
|
-
"feGaussianBlur",
|
|
8565
|
-
"feImage",
|
|
8566
|
-
"feMerge",
|
|
8567
|
-
"feMergeNode",
|
|
8568
|
-
"feMorphology",
|
|
8569
|
-
"feOffset",
|
|
8570
|
-
"fePointLight",
|
|
8571
|
-
"feSpecularLighting",
|
|
8572
|
-
"feSpotLight",
|
|
8573
|
-
"feTile",
|
|
8574
|
-
"feTurbulence",
|
|
8575
|
-
"foreignObject",
|
|
8576
|
-
"linearGradient",
|
|
8577
|
-
"radialGradient",
|
|
8578
|
-
"textPath"
|
|
8579
|
-
];
|
|
8580
|
-
var CASE_SENSITIVE_TAG_NAMES_MAP = CASE_SENSITIVE_TAG_NAMES.reduce(function(accumulator, tagName) {
|
|
8581
|
-
accumulator[tagName.toLowerCase()] = tagName;
|
|
8582
|
-
return accumulator;
|
|
8583
|
-
}, {});
|
|
8584
|
-
var CARRIAGE_RETURN = "\r";
|
|
8585
|
-
var CARRIAGE_RETURN_REGEX = new RegExp(CARRIAGE_RETURN, "g");
|
|
8586
|
-
var CARRIAGE_RETURN_PLACEHOLDER = "__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_".concat(Date.now().toString(), "__");
|
|
8587
|
-
var CARRIAGE_RETURN_PLACEHOLDER_REGEX = new RegExp(CARRIAGE_RETURN_PLACEHOLDER, "g");
|
|
8588
|
-
function getCaseSensitiveTagName(tagName) {
|
|
8589
|
-
return CASE_SENSITIVE_TAG_NAMES_MAP[tagName];
|
|
8590
|
-
}
|
|
8591
|
-
function formatAttributes(attributes) {
|
|
8592
|
-
var map = {};
|
|
8593
|
-
var index = 0;
|
|
8594
|
-
var attributesLength = attributes.length;
|
|
8595
|
-
for (; index < attributesLength; index++) {
|
|
8596
|
-
var attribute = attributes[index];
|
|
8597
|
-
map[attribute.name] = attribute.value;
|
|
8598
|
-
}
|
|
8599
|
-
return map;
|
|
8600
|
-
}
|
|
8601
|
-
function formatTagName(tagName) {
|
|
8602
|
-
tagName = tagName.toLowerCase();
|
|
8603
|
-
var caseSensitiveTagName = getCaseSensitiveTagName(tagName);
|
|
8604
|
-
if (caseSensitiveTagName) {
|
|
8605
|
-
return caseSensitiveTagName;
|
|
8606
|
-
}
|
|
8607
|
-
return tagName;
|
|
8608
|
-
}
|
|
8609
|
-
function hasOpenTag(html2, tagName) {
|
|
8610
|
-
var openTag = "<" + tagName;
|
|
8611
|
-
var index = html2.toLowerCase().indexOf(openTag);
|
|
8612
|
-
if (index === -1) {
|
|
8613
|
-
return false;
|
|
8614
|
-
}
|
|
8615
|
-
var char = html2[index + openTag.length];
|
|
8616
|
-
return char === ">" || char === " " || char === " " || char === "\n" || char === "\r" || char === "/";
|
|
8617
|
-
}
|
|
8618
|
-
function escapeSpecialCharacters(html2) {
|
|
8619
|
-
return html2.replace(CARRIAGE_RETURN_REGEX, CARRIAGE_RETURN_PLACEHOLDER);
|
|
8620
|
-
}
|
|
8621
|
-
function revertEscapedCharacters(text2) {
|
|
8622
|
-
return text2.replace(CARRIAGE_RETURN_PLACEHOLDER_REGEX, CARRIAGE_RETURN);
|
|
8623
|
-
}
|
|
8624
|
-
function formatDOM(nodes, parent, directive) {
|
|
8625
|
-
var _a, _b, _c, _d;
|
|
8626
|
-
if (parent === void 0) {
|
|
8627
|
-
parent = null;
|
|
8628
|
-
}
|
|
8629
|
-
var domNodes = [];
|
|
8630
|
-
var current;
|
|
8631
|
-
var index = 0;
|
|
8632
|
-
var nodesLength = nodes.length;
|
|
8633
|
-
for (; index < nodesLength; index++) {
|
|
8634
|
-
var node = nodes[index];
|
|
8635
|
-
switch (node.nodeType) {
|
|
8636
|
-
case 1: {
|
|
8637
|
-
var tagName = formatTagName(node.nodeName);
|
|
8638
|
-
current = new Element2(tagName, formatAttributes(node.attributes));
|
|
8639
|
-
current.children = formatDOM(
|
|
8640
|
-
// template children are on content
|
|
8641
|
-
tagName === "template" ? node.content.childNodes : node.childNodes,
|
|
8642
|
-
current
|
|
8643
|
-
);
|
|
8644
|
-
break;
|
|
8645
|
-
}
|
|
8646
|
-
/* v8 ignore start */
|
|
8647
|
-
case 3:
|
|
8648
|
-
current = new Text2(revertEscapedCharacters((_a = node.nodeValue) !== null && _a !== void 0 ? _a : ""));
|
|
8649
|
-
break;
|
|
8650
|
-
case 8:
|
|
8651
|
-
current = new Comment2((_b = node.nodeValue) !== null && _b !== void 0 ? _b : "");
|
|
8652
|
-
break;
|
|
8653
|
-
/* v8 ignore stop */
|
|
8654
|
-
default:
|
|
8655
|
-
continue;
|
|
8656
|
-
}
|
|
8657
|
-
var prev = (_c = domNodes[index - 1]) !== null && _c !== void 0 ? _c : null;
|
|
8658
|
-
if (prev) {
|
|
8659
|
-
prev.next = current;
|
|
8660
|
-
}
|
|
8661
|
-
current.parent = parent;
|
|
8662
|
-
current.prev = prev;
|
|
8663
|
-
current.next = null;
|
|
8664
|
-
domNodes.push(current);
|
|
8665
|
-
}
|
|
8666
|
-
if (directive) {
|
|
8667
|
-
current = new ProcessingInstruction2(directive.substring(0, directive.indexOf(" ")).toLowerCase(), directive);
|
|
8668
|
-
current.next = (_d = domNodes[0]) !== null && _d !== void 0 ? _d : null;
|
|
8669
|
-
current.parent = parent;
|
|
8670
|
-
domNodes.unshift(current);
|
|
8671
|
-
if (domNodes[1]) {
|
|
8672
|
-
domNodes[1].prev = domNodes[0];
|
|
8673
|
-
}
|
|
8674
|
-
}
|
|
8675
|
-
return domNodes;
|
|
8676
|
-
}
|
|
8677
|
-
var HTML = "html";
|
|
8678
|
-
var HEAD = "head";
|
|
8679
|
-
var BODY = "body";
|
|
8680
|
-
var FIRST_TAG_REGEX = /<([a-zA-Z]+[0-9]?)/;
|
|
8681
|
-
function getHTMLForInnerHTML(html2, trustedTypePolicy) {
|
|
8682
|
-
return trustedTypePolicy ? trustedTypePolicy.createHTML(html2) : html2;
|
|
8683
|
-
}
|
|
8684
|
-
var parseFromDocument = function(html2, tagName, trustedTypePolicy) {
|
|
8685
|
-
throw new Error("This browser does not support `document.implementation.createHTMLDocument`");
|
|
8686
|
-
};
|
|
8687
|
-
var parseFromString = function(html2, tagName, trustedTypePolicy) {
|
|
8688
|
-
throw new Error("This browser does not support `DOMParser.prototype.parseFromString`");
|
|
8689
|
-
};
|
|
8690
|
-
var DOMParser = typeof window === "object" && window.DOMParser;
|
|
8691
|
-
if (typeof DOMParser === "function") {
|
|
8692
|
-
var domParser_1 = new DOMParser();
|
|
8693
|
-
var mimeType_1 = "text/html";
|
|
8694
|
-
parseFromString = function(html2, tagName, trustedTypePolicy) {
|
|
8695
|
-
if (tagName) {
|
|
8696
|
-
html2 = "<".concat(tagName, ">").concat(html2, "</").concat(tagName, ">");
|
|
8697
|
-
}
|
|
8698
|
-
return domParser_1.parseFromString(html2, mimeType_1);
|
|
8699
|
-
};
|
|
8700
|
-
parseFromDocument = parseFromString;
|
|
8701
|
-
}
|
|
8702
|
-
if (typeof document === "object" && document.implementation) {
|
|
8703
|
-
var htmlDocument_1 = document.implementation.createHTMLDocument();
|
|
8704
|
-
parseFromDocument = function(html2, tagName, trustedTypePolicy) {
|
|
8705
|
-
if (tagName) {
|
|
8706
|
-
var element = htmlDocument_1.documentElement.querySelector(tagName);
|
|
8707
|
-
if (element) {
|
|
8708
|
-
element.innerHTML = getHTMLForInnerHTML(html2, trustedTypePolicy);
|
|
8709
|
-
}
|
|
8710
|
-
return htmlDocument_1;
|
|
8711
|
-
}
|
|
8712
|
-
htmlDocument_1.documentElement.innerHTML = getHTMLForInnerHTML(html2, trustedTypePolicy);
|
|
8713
|
-
return htmlDocument_1;
|
|
8714
|
-
};
|
|
8715
|
-
}
|
|
8716
|
-
var template = typeof document === "object" && document.createElement("template");
|
|
8717
|
-
var parseFromTemplate;
|
|
8718
|
-
if (template && template.content) {
|
|
8719
|
-
parseFromTemplate = function(html2, trustedTypePolicy) {
|
|
8720
|
-
template.innerHTML = getHTMLForInnerHTML(html2, trustedTypePolicy);
|
|
8721
|
-
return template.content.childNodes;
|
|
8722
|
-
};
|
|
8723
|
-
}
|
|
8724
|
-
var createNodeList = function() {
|
|
8725
|
-
return document.createDocumentFragment().childNodes;
|
|
8726
|
-
};
|
|
8727
|
-
function domparser(html2, trustedTypePolicy) {
|
|
8728
|
-
var _a, _b, _c, _d, _e, _f;
|
|
8729
|
-
html2 = escapeSpecialCharacters(html2);
|
|
8730
|
-
var match = FIRST_TAG_REGEX.exec(html2);
|
|
8731
|
-
var firstTagName = (_a = match === null || match === void 0 ? void 0 : match[1]) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
8732
|
-
switch (firstTagName) {
|
|
8733
|
-
case HTML: {
|
|
8734
|
-
var doc = parseFromString(html2);
|
|
8735
|
-
if (!hasOpenTag(html2, HEAD)) {
|
|
8736
|
-
var element = doc.querySelector(HEAD);
|
|
8737
|
-
(_b = element === null || element === void 0 ? void 0 : element.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(element);
|
|
8738
|
-
}
|
|
8739
|
-
if (!hasOpenTag(html2, BODY)) {
|
|
8740
|
-
var element = doc.querySelector(BODY);
|
|
8741
|
-
(_c = element === null || element === void 0 ? void 0 : element.parentNode) === null || _c === void 0 ? void 0 : _c.removeChild(element);
|
|
8742
|
-
}
|
|
8743
|
-
return doc.querySelectorAll(HTML);
|
|
8744
|
-
}
|
|
8745
|
-
case HEAD:
|
|
8746
|
-
case BODY: {
|
|
8747
|
-
var elements = parseFromDocument(html2, void 0, trustedTypePolicy).querySelectorAll(firstTagName);
|
|
8748
|
-
if (hasOpenTag(html2, BODY) && hasOpenTag(html2, HEAD)) {
|
|
8749
|
-
return (_e = (_d = elements[0].parentNode) === null || _d === void 0 ? void 0 : _d.childNodes) !== null && _e !== void 0 ? _e : createNodeList();
|
|
8750
|
-
}
|
|
8751
|
-
return elements;
|
|
8752
|
-
}
|
|
8753
|
-
// low-level tag or text
|
|
8754
|
-
/* v8 ignore start */
|
|
8755
|
-
default: {
|
|
8756
|
-
if (parseFromTemplate) {
|
|
8757
|
-
return parseFromTemplate(html2, trustedTypePolicy);
|
|
8758
|
-
}
|
|
8759
|
-
var element = parseFromDocument(html2, BODY, trustedTypePolicy).querySelector(BODY);
|
|
8760
|
-
return (_f = element === null || element === void 0 ? void 0 : element.childNodes) !== null && _f !== void 0 ? _f : createNodeList();
|
|
8761
|
-
}
|
|
8762
|
-
}
|
|
8763
|
-
}
|
|
8764
|
-
var DIRECTIVE_REGEX = /<(![a-zA-Z\s]+)>/;
|
|
8765
|
-
function HTMLDOMParser(html2, options) {
|
|
8766
|
-
if (typeof html2 !== "string") {
|
|
8767
|
-
throw new TypeError("First argument must be a string");
|
|
8768
|
-
}
|
|
8769
|
-
if (!html2) {
|
|
8770
|
-
return [];
|
|
8771
|
-
}
|
|
8772
|
-
var match = DIRECTIVE_REGEX.exec(html2);
|
|
8773
|
-
var directive = match ? match[1] : void 0;
|
|
8774
|
-
return formatDOM(domparser(html2, options === null || options === void 0 ? void 0 : options.trustedTypePolicy), null, directive);
|
|
8775
|
-
}
|
|
8776
|
-
htmlToDom.default = HTMLDOMParser;
|
|
8777
|
-
return htmlToDom;
|
|
8778
|
-
}
|
|
8779
|
-
var attributesToProps = {};
|
|
8780
|
-
var lib = {};
|
|
8781
|
-
var possibleStandardNamesOptimized = {};
|
|
8782
|
-
var hasRequiredPossibleStandardNamesOptimized;
|
|
8783
|
-
function requirePossibleStandardNamesOptimized() {
|
|
8784
|
-
if (hasRequiredPossibleStandardNamesOptimized) return possibleStandardNamesOptimized;
|
|
8785
|
-
hasRequiredPossibleStandardNamesOptimized = 1;
|
|
8786
|
-
var SAME = 0;
|
|
8787
|
-
possibleStandardNamesOptimized.SAME = SAME;
|
|
8788
|
-
var CAMELCASE = 1;
|
|
8789
|
-
possibleStandardNamesOptimized.CAMELCASE = CAMELCASE;
|
|
8790
|
-
possibleStandardNamesOptimized.possibleStandardNames = {
|
|
8791
|
-
accept: 0,
|
|
8792
|
-
acceptCharset: 1,
|
|
8793
|
-
"accept-charset": "acceptCharset",
|
|
8794
|
-
accessKey: 1,
|
|
8795
|
-
action: 0,
|
|
8796
|
-
allowFullScreen: 1,
|
|
8797
|
-
alt: 0,
|
|
8798
|
-
as: 0,
|
|
8799
|
-
async: 0,
|
|
8800
|
-
autoCapitalize: 1,
|
|
8801
|
-
autoComplete: 1,
|
|
8802
|
-
autoCorrect: 1,
|
|
8803
|
-
autoFocus: 1,
|
|
8804
|
-
autoPlay: 1,
|
|
8805
|
-
autoSave: 1,
|
|
8806
|
-
capture: 0,
|
|
8807
|
-
cellPadding: 1,
|
|
8808
|
-
cellSpacing: 1,
|
|
8809
|
-
challenge: 0,
|
|
8810
|
-
charSet: 1,
|
|
8811
|
-
checked: 0,
|
|
8812
|
-
children: 0,
|
|
8813
|
-
cite: 0,
|
|
8814
|
-
class: "className",
|
|
8815
|
-
classID: 1,
|
|
8816
|
-
className: 1,
|
|
8817
|
-
cols: 0,
|
|
8818
|
-
colSpan: 1,
|
|
8819
|
-
content: 0,
|
|
8820
|
-
contentEditable: 1,
|
|
8821
|
-
contextMenu: 1,
|
|
8822
|
-
controls: 0,
|
|
8823
|
-
controlsList: 1,
|
|
8824
|
-
coords: 0,
|
|
8825
|
-
crossOrigin: 1,
|
|
8826
|
-
dangerouslySetInnerHTML: 1,
|
|
8827
|
-
data: 0,
|
|
8828
|
-
dateTime: 1,
|
|
8829
|
-
default: 0,
|
|
8830
|
-
defaultChecked: 1,
|
|
8831
|
-
defaultValue: 1,
|
|
8832
|
-
defer: 0,
|
|
8833
|
-
dir: 0,
|
|
8834
|
-
disabled: 0,
|
|
8835
|
-
disablePictureInPicture: 1,
|
|
8836
|
-
disableRemotePlayback: 1,
|
|
8837
|
-
download: 0,
|
|
8838
|
-
draggable: 0,
|
|
8839
|
-
encType: 1,
|
|
8840
|
-
enterKeyHint: 1,
|
|
8841
|
-
for: "htmlFor",
|
|
8842
|
-
form: 0,
|
|
8843
|
-
formMethod: 1,
|
|
8844
|
-
formAction: 1,
|
|
8845
|
-
formEncType: 1,
|
|
8846
|
-
formNoValidate: 1,
|
|
8847
|
-
formTarget: 1,
|
|
8848
|
-
frameBorder: 1,
|
|
8849
|
-
headers: 0,
|
|
8850
|
-
height: 0,
|
|
8851
|
-
hidden: 0,
|
|
8852
|
-
high: 0,
|
|
8853
|
-
href: 0,
|
|
8854
|
-
hrefLang: 1,
|
|
8855
|
-
htmlFor: 1,
|
|
8856
|
-
httpEquiv: 1,
|
|
8857
|
-
"http-equiv": "httpEquiv",
|
|
8858
|
-
icon: 0,
|
|
8859
|
-
id: 0,
|
|
8860
|
-
innerHTML: 1,
|
|
8861
|
-
inputMode: 1,
|
|
8862
|
-
integrity: 0,
|
|
8863
|
-
is: 0,
|
|
8864
|
-
itemID: 1,
|
|
8865
|
-
itemProp: 1,
|
|
8866
|
-
itemRef: 1,
|
|
8867
|
-
itemScope: 1,
|
|
8868
|
-
itemType: 1,
|
|
8869
|
-
keyParams: 1,
|
|
8870
|
-
keyType: 1,
|
|
8871
|
-
kind: 0,
|
|
8872
|
-
label: 0,
|
|
8873
|
-
lang: 0,
|
|
8874
|
-
list: 0,
|
|
8875
|
-
loop: 0,
|
|
8876
|
-
low: 0,
|
|
8877
|
-
manifest: 0,
|
|
8878
|
-
marginWidth: 1,
|
|
8879
|
-
marginHeight: 1,
|
|
8880
|
-
max: 0,
|
|
8881
|
-
maxLength: 1,
|
|
8882
|
-
media: 0,
|
|
8883
|
-
mediaGroup: 1,
|
|
8884
|
-
method: 0,
|
|
8885
|
-
min: 0,
|
|
8886
|
-
minLength: 1,
|
|
8887
|
-
multiple: 0,
|
|
8888
|
-
muted: 0,
|
|
8889
|
-
name: 0,
|
|
8890
|
-
noModule: 1,
|
|
8891
|
-
nonce: 0,
|
|
8892
|
-
noValidate: 1,
|
|
8893
|
-
open: 0,
|
|
8894
|
-
optimum: 0,
|
|
8895
|
-
pattern: 0,
|
|
8896
|
-
placeholder: 0,
|
|
8897
|
-
playsInline: 1,
|
|
8898
|
-
poster: 0,
|
|
8899
|
-
preload: 0,
|
|
8900
|
-
profile: 0,
|
|
8901
|
-
radioGroup: 1,
|
|
8902
|
-
readOnly: 1,
|
|
8903
|
-
referrerPolicy: 1,
|
|
8904
|
-
rel: 0,
|
|
8905
|
-
required: 0,
|
|
8906
|
-
reversed: 0,
|
|
8907
|
-
role: 0,
|
|
8908
|
-
rows: 0,
|
|
8909
|
-
rowSpan: 1,
|
|
8910
|
-
sandbox: 0,
|
|
8911
|
-
scope: 0,
|
|
8912
|
-
scoped: 0,
|
|
8913
|
-
scrolling: 0,
|
|
8914
|
-
seamless: 0,
|
|
8915
|
-
selected: 0,
|
|
8916
|
-
shape: 0,
|
|
8917
|
-
size: 0,
|
|
8918
|
-
sizes: 0,
|
|
8919
|
-
span: 0,
|
|
8920
|
-
spellCheck: 1,
|
|
8921
|
-
src: 0,
|
|
8922
|
-
srcDoc: 1,
|
|
8923
|
-
srcLang: 1,
|
|
8924
|
-
srcSet: 1,
|
|
8925
|
-
start: 0,
|
|
8926
|
-
step: 0,
|
|
8927
|
-
style: 0,
|
|
8928
|
-
summary: 0,
|
|
8929
|
-
tabIndex: 1,
|
|
8930
|
-
target: 0,
|
|
8931
|
-
title: 0,
|
|
8932
|
-
type: 0,
|
|
8933
|
-
useMap: 1,
|
|
8934
|
-
value: 0,
|
|
8935
|
-
width: 0,
|
|
8936
|
-
wmode: 0,
|
|
8937
|
-
wrap: 0,
|
|
8938
|
-
about: 0,
|
|
8939
|
-
accentHeight: 1,
|
|
8940
|
-
"accent-height": "accentHeight",
|
|
8941
|
-
accumulate: 0,
|
|
8942
|
-
additive: 0,
|
|
8943
|
-
alignmentBaseline: 1,
|
|
8944
|
-
"alignment-baseline": "alignmentBaseline",
|
|
8945
|
-
allowReorder: 1,
|
|
8946
|
-
alphabetic: 0,
|
|
8947
|
-
amplitude: 0,
|
|
8948
|
-
arabicForm: 1,
|
|
8949
|
-
"arabic-form": "arabicForm",
|
|
8950
|
-
ascent: 0,
|
|
8951
|
-
attributeName: 1,
|
|
8952
|
-
attributeType: 1,
|
|
8953
|
-
autoReverse: 1,
|
|
8954
|
-
azimuth: 0,
|
|
8955
|
-
baseFrequency: 1,
|
|
8956
|
-
baselineShift: 1,
|
|
8957
|
-
"baseline-shift": "baselineShift",
|
|
8958
|
-
baseProfile: 1,
|
|
8959
|
-
bbox: 0,
|
|
8960
|
-
begin: 0,
|
|
8961
|
-
bias: 0,
|
|
8962
|
-
by: 0,
|
|
8963
|
-
calcMode: 1,
|
|
8964
|
-
capHeight: 1,
|
|
8965
|
-
"cap-height": "capHeight",
|
|
8966
|
-
clip: 0,
|
|
8967
|
-
clipPath: 1,
|
|
8968
|
-
"clip-path": "clipPath",
|
|
8969
|
-
clipPathUnits: 1,
|
|
8970
|
-
clipRule: 1,
|
|
8971
|
-
"clip-rule": "clipRule",
|
|
8972
|
-
color: 0,
|
|
8973
|
-
colorInterpolation: 1,
|
|
8974
|
-
"color-interpolation": "colorInterpolation",
|
|
8975
|
-
colorInterpolationFilters: 1,
|
|
8976
|
-
"color-interpolation-filters": "colorInterpolationFilters",
|
|
8977
|
-
colorProfile: 1,
|
|
8978
|
-
"color-profile": "colorProfile",
|
|
8979
|
-
colorRendering: 1,
|
|
8980
|
-
"color-rendering": "colorRendering",
|
|
8981
|
-
contentScriptType: 1,
|
|
8982
|
-
contentStyleType: 1,
|
|
8983
|
-
cursor: 0,
|
|
8984
|
-
cx: 0,
|
|
8985
|
-
cy: 0,
|
|
8986
|
-
d: 0,
|
|
8987
|
-
datatype: 0,
|
|
8988
|
-
decelerate: 0,
|
|
8989
|
-
descent: 0,
|
|
8990
|
-
diffuseConstant: 1,
|
|
8991
|
-
direction: 0,
|
|
8992
|
-
display: 0,
|
|
8993
|
-
divisor: 0,
|
|
8994
|
-
dominantBaseline: 1,
|
|
8995
|
-
"dominant-baseline": "dominantBaseline",
|
|
8996
|
-
dur: 0,
|
|
8997
|
-
dx: 0,
|
|
8998
|
-
dy: 0,
|
|
8999
|
-
edgeMode: 1,
|
|
9000
|
-
elevation: 0,
|
|
9001
|
-
enableBackground: 1,
|
|
9002
|
-
"enable-background": "enableBackground",
|
|
9003
|
-
end: 0,
|
|
9004
|
-
exponent: 0,
|
|
9005
|
-
externalResourcesRequired: 1,
|
|
9006
|
-
fill: 0,
|
|
9007
|
-
fillOpacity: 1,
|
|
9008
|
-
"fill-opacity": "fillOpacity",
|
|
9009
|
-
fillRule: 1,
|
|
9010
|
-
"fill-rule": "fillRule",
|
|
9011
|
-
filter: 0,
|
|
9012
|
-
filterRes: 1,
|
|
9013
|
-
filterUnits: 1,
|
|
9014
|
-
floodOpacity: 1,
|
|
9015
|
-
"flood-opacity": "floodOpacity",
|
|
9016
|
-
floodColor: 1,
|
|
9017
|
-
"flood-color": "floodColor",
|
|
9018
|
-
focusable: 0,
|
|
9019
|
-
fontFamily: 1,
|
|
9020
|
-
"font-family": "fontFamily",
|
|
9021
|
-
fontSize: 1,
|
|
9022
|
-
"font-size": "fontSize",
|
|
9023
|
-
fontSizeAdjust: 1,
|
|
9024
|
-
"font-size-adjust": "fontSizeAdjust",
|
|
9025
|
-
fontStretch: 1,
|
|
9026
|
-
"font-stretch": "fontStretch",
|
|
9027
|
-
fontStyle: 1,
|
|
9028
|
-
"font-style": "fontStyle",
|
|
9029
|
-
fontVariant: 1,
|
|
9030
|
-
"font-variant": "fontVariant",
|
|
9031
|
-
fontWeight: 1,
|
|
9032
|
-
"font-weight": "fontWeight",
|
|
9033
|
-
format: 0,
|
|
9034
|
-
from: 0,
|
|
9035
|
-
fx: 0,
|
|
9036
|
-
fy: 0,
|
|
9037
|
-
g1: 0,
|
|
9038
|
-
g2: 0,
|
|
9039
|
-
glyphName: 1,
|
|
9040
|
-
"glyph-name": "glyphName",
|
|
9041
|
-
glyphOrientationHorizontal: 1,
|
|
9042
|
-
"glyph-orientation-horizontal": "glyphOrientationHorizontal",
|
|
9043
|
-
glyphOrientationVertical: 1,
|
|
9044
|
-
"glyph-orientation-vertical": "glyphOrientationVertical",
|
|
9045
|
-
glyphRef: 1,
|
|
9046
|
-
gradientTransform: 1,
|
|
9047
|
-
gradientUnits: 1,
|
|
9048
|
-
hanging: 0,
|
|
9049
|
-
horizAdvX: 1,
|
|
9050
|
-
"horiz-adv-x": "horizAdvX",
|
|
9051
|
-
horizOriginX: 1,
|
|
9052
|
-
"horiz-origin-x": "horizOriginX",
|
|
9053
|
-
ideographic: 0,
|
|
9054
|
-
imageRendering: 1,
|
|
9055
|
-
"image-rendering": "imageRendering",
|
|
9056
|
-
in2: 0,
|
|
9057
|
-
in: 0,
|
|
9058
|
-
inlist: 0,
|
|
9059
|
-
intercept: 0,
|
|
9060
|
-
k1: 0,
|
|
9061
|
-
k2: 0,
|
|
9062
|
-
k3: 0,
|
|
9063
|
-
k4: 0,
|
|
9064
|
-
k: 0,
|
|
9065
|
-
kernelMatrix: 1,
|
|
9066
|
-
kernelUnitLength: 1,
|
|
9067
|
-
kerning: 0,
|
|
9068
|
-
keyPoints: 1,
|
|
9069
|
-
keySplines: 1,
|
|
9070
|
-
keyTimes: 1,
|
|
9071
|
-
lengthAdjust: 1,
|
|
9072
|
-
letterSpacing: 1,
|
|
9073
|
-
"letter-spacing": "letterSpacing",
|
|
9074
|
-
lightingColor: 1,
|
|
9075
|
-
"lighting-color": "lightingColor",
|
|
9076
|
-
limitingConeAngle: 1,
|
|
9077
|
-
local: 0,
|
|
9078
|
-
markerEnd: 1,
|
|
9079
|
-
"marker-end": "markerEnd",
|
|
9080
|
-
markerHeight: 1,
|
|
9081
|
-
markerMid: 1,
|
|
9082
|
-
"marker-mid": "markerMid",
|
|
9083
|
-
markerStart: 1,
|
|
9084
|
-
"marker-start": "markerStart",
|
|
9085
|
-
markerUnits: 1,
|
|
9086
|
-
markerWidth: 1,
|
|
9087
|
-
mask: 0,
|
|
9088
|
-
maskContentUnits: 1,
|
|
9089
|
-
maskUnits: 1,
|
|
9090
|
-
mathematical: 0,
|
|
9091
|
-
mode: 0,
|
|
9092
|
-
numOctaves: 1,
|
|
9093
|
-
offset: 0,
|
|
9094
|
-
opacity: 0,
|
|
9095
|
-
operator: 0,
|
|
9096
|
-
order: 0,
|
|
9097
|
-
orient: 0,
|
|
9098
|
-
orientation: 0,
|
|
9099
|
-
origin: 0,
|
|
9100
|
-
overflow: 0,
|
|
9101
|
-
overlinePosition: 1,
|
|
9102
|
-
"overline-position": "overlinePosition",
|
|
9103
|
-
overlineThickness: 1,
|
|
9104
|
-
"overline-thickness": "overlineThickness",
|
|
9105
|
-
paintOrder: 1,
|
|
9106
|
-
"paint-order": "paintOrder",
|
|
9107
|
-
panose1: 0,
|
|
9108
|
-
"panose-1": "panose1",
|
|
9109
|
-
pathLength: 1,
|
|
9110
|
-
patternContentUnits: 1,
|
|
9111
|
-
patternTransform: 1,
|
|
9112
|
-
patternUnits: 1,
|
|
9113
|
-
pointerEvents: 1,
|
|
9114
|
-
"pointer-events": "pointerEvents",
|
|
9115
|
-
points: 0,
|
|
9116
|
-
pointsAtX: 1,
|
|
9117
|
-
pointsAtY: 1,
|
|
9118
|
-
pointsAtZ: 1,
|
|
9119
|
-
prefix: 0,
|
|
9120
|
-
preserveAlpha: 1,
|
|
9121
|
-
preserveAspectRatio: 1,
|
|
9122
|
-
primitiveUnits: 1,
|
|
9123
|
-
property: 0,
|
|
9124
|
-
r: 0,
|
|
9125
|
-
radius: 0,
|
|
9126
|
-
refX: 1,
|
|
9127
|
-
refY: 1,
|
|
9128
|
-
renderingIntent: 1,
|
|
9129
|
-
"rendering-intent": "renderingIntent",
|
|
9130
|
-
repeatCount: 1,
|
|
9131
|
-
repeatDur: 1,
|
|
9132
|
-
requiredExtensions: 1,
|
|
9133
|
-
requiredFeatures: 1,
|
|
9134
|
-
resource: 0,
|
|
9135
|
-
restart: 0,
|
|
9136
|
-
result: 0,
|
|
9137
|
-
results: 0,
|
|
9138
|
-
rotate: 0,
|
|
9139
|
-
rx: 0,
|
|
9140
|
-
ry: 0,
|
|
9141
|
-
scale: 0,
|
|
9142
|
-
security: 0,
|
|
9143
|
-
seed: 0,
|
|
9144
|
-
shapeRendering: 1,
|
|
9145
|
-
"shape-rendering": "shapeRendering",
|
|
9146
|
-
slope: 0,
|
|
9147
|
-
spacing: 0,
|
|
9148
|
-
specularConstant: 1,
|
|
9149
|
-
specularExponent: 1,
|
|
9150
|
-
speed: 0,
|
|
9151
|
-
spreadMethod: 1,
|
|
9152
|
-
startOffset: 1,
|
|
9153
|
-
stdDeviation: 1,
|
|
9154
|
-
stemh: 0,
|
|
9155
|
-
stemv: 0,
|
|
9156
|
-
stitchTiles: 1,
|
|
9157
|
-
stopColor: 1,
|
|
9158
|
-
"stop-color": "stopColor",
|
|
9159
|
-
stopOpacity: 1,
|
|
9160
|
-
"stop-opacity": "stopOpacity",
|
|
9161
|
-
strikethroughPosition: 1,
|
|
9162
|
-
"strikethrough-position": "strikethroughPosition",
|
|
9163
|
-
strikethroughThickness: 1,
|
|
9164
|
-
"strikethrough-thickness": "strikethroughThickness",
|
|
9165
|
-
string: 0,
|
|
9166
|
-
stroke: 0,
|
|
9167
|
-
strokeDasharray: 1,
|
|
9168
|
-
"stroke-dasharray": "strokeDasharray",
|
|
9169
|
-
strokeDashoffset: 1,
|
|
9170
|
-
"stroke-dashoffset": "strokeDashoffset",
|
|
9171
|
-
strokeLinecap: 1,
|
|
9172
|
-
"stroke-linecap": "strokeLinecap",
|
|
9173
|
-
strokeLinejoin: 1,
|
|
9174
|
-
"stroke-linejoin": "strokeLinejoin",
|
|
9175
|
-
strokeMiterlimit: 1,
|
|
9176
|
-
"stroke-miterlimit": "strokeMiterlimit",
|
|
9177
|
-
strokeWidth: 1,
|
|
9178
|
-
"stroke-width": "strokeWidth",
|
|
9179
|
-
strokeOpacity: 1,
|
|
9180
|
-
"stroke-opacity": "strokeOpacity",
|
|
9181
|
-
suppressContentEditableWarning: 1,
|
|
9182
|
-
suppressHydrationWarning: 1,
|
|
9183
|
-
surfaceScale: 1,
|
|
9184
|
-
systemLanguage: 1,
|
|
9185
|
-
tableValues: 1,
|
|
9186
|
-
targetX: 1,
|
|
9187
|
-
targetY: 1,
|
|
9188
|
-
textAnchor: 1,
|
|
9189
|
-
"text-anchor": "textAnchor",
|
|
9190
|
-
textDecoration: 1,
|
|
9191
|
-
"text-decoration": "textDecoration",
|
|
9192
|
-
textLength: 1,
|
|
9193
|
-
textRendering: 1,
|
|
9194
|
-
"text-rendering": "textRendering",
|
|
9195
|
-
to: 0,
|
|
9196
|
-
transform: 0,
|
|
9197
|
-
typeof: 0,
|
|
9198
|
-
u1: 0,
|
|
9199
|
-
u2: 0,
|
|
9200
|
-
underlinePosition: 1,
|
|
9201
|
-
"underline-position": "underlinePosition",
|
|
9202
|
-
underlineThickness: 1,
|
|
9203
|
-
"underline-thickness": "underlineThickness",
|
|
9204
|
-
unicode: 0,
|
|
9205
|
-
unicodeBidi: 1,
|
|
9206
|
-
"unicode-bidi": "unicodeBidi",
|
|
9207
|
-
unicodeRange: 1,
|
|
9208
|
-
"unicode-range": "unicodeRange",
|
|
9209
|
-
unitsPerEm: 1,
|
|
9210
|
-
"units-per-em": "unitsPerEm",
|
|
9211
|
-
unselectable: 0,
|
|
9212
|
-
vAlphabetic: 1,
|
|
9213
|
-
"v-alphabetic": "vAlphabetic",
|
|
9214
|
-
values: 0,
|
|
9215
|
-
vectorEffect: 1,
|
|
9216
|
-
"vector-effect": "vectorEffect",
|
|
9217
|
-
version: 0,
|
|
9218
|
-
vertAdvY: 1,
|
|
9219
|
-
"vert-adv-y": "vertAdvY",
|
|
9220
|
-
vertOriginX: 1,
|
|
9221
|
-
"vert-origin-x": "vertOriginX",
|
|
9222
|
-
vertOriginY: 1,
|
|
9223
|
-
"vert-origin-y": "vertOriginY",
|
|
9224
|
-
vHanging: 1,
|
|
9225
|
-
"v-hanging": "vHanging",
|
|
9226
|
-
vIdeographic: 1,
|
|
9227
|
-
"v-ideographic": "vIdeographic",
|
|
9228
|
-
viewBox: 1,
|
|
9229
|
-
viewTarget: 1,
|
|
9230
|
-
visibility: 0,
|
|
9231
|
-
vMathematical: 1,
|
|
9232
|
-
"v-mathematical": "vMathematical",
|
|
9233
|
-
vocab: 0,
|
|
9234
|
-
widths: 0,
|
|
9235
|
-
wordSpacing: 1,
|
|
9236
|
-
"word-spacing": "wordSpacing",
|
|
9237
|
-
writingMode: 1,
|
|
9238
|
-
"writing-mode": "writingMode",
|
|
9239
|
-
x1: 0,
|
|
9240
|
-
x2: 0,
|
|
9241
|
-
x: 0,
|
|
9242
|
-
xChannelSelector: 1,
|
|
9243
|
-
xHeight: 1,
|
|
9244
|
-
"x-height": "xHeight",
|
|
9245
|
-
xlinkActuate: 1,
|
|
9246
|
-
"xlink:actuate": "xlinkActuate",
|
|
9247
|
-
xlinkArcrole: 1,
|
|
9248
|
-
"xlink:arcrole": "xlinkArcrole",
|
|
9249
|
-
xlinkHref: 1,
|
|
9250
|
-
"xlink:href": "xlinkHref",
|
|
9251
|
-
xlinkRole: 1,
|
|
9252
|
-
"xlink:role": "xlinkRole",
|
|
9253
|
-
xlinkShow: 1,
|
|
9254
|
-
"xlink:show": "xlinkShow",
|
|
9255
|
-
xlinkTitle: 1,
|
|
9256
|
-
"xlink:title": "xlinkTitle",
|
|
9257
|
-
xlinkType: 1,
|
|
9258
|
-
"xlink:type": "xlinkType",
|
|
9259
|
-
xmlBase: 1,
|
|
9260
|
-
"xml:base": "xmlBase",
|
|
9261
|
-
xmlLang: 1,
|
|
9262
|
-
"xml:lang": "xmlLang",
|
|
9263
|
-
xmlns: 0,
|
|
9264
|
-
"xml:space": "xmlSpace",
|
|
9265
|
-
xmlnsXlink: 1,
|
|
9266
|
-
"xmlns:xlink": "xmlnsXlink",
|
|
9267
|
-
xmlSpace: 1,
|
|
9268
|
-
y1: 0,
|
|
9269
|
-
y2: 0,
|
|
9270
|
-
y: 0,
|
|
9271
|
-
yChannelSelector: 1,
|
|
9272
|
-
z: 0,
|
|
9273
|
-
zoomAndPan: 1
|
|
9274
|
-
};
|
|
9275
|
-
return possibleStandardNamesOptimized;
|
|
9276
|
-
}
|
|
9277
|
-
var hasRequiredLib$1;
|
|
9278
|
-
function requireLib$1() {
|
|
9279
|
-
if (hasRequiredLib$1) return lib;
|
|
9280
|
-
hasRequiredLib$1 = 1;
|
|
9281
|
-
const RESERVED = 0;
|
|
9282
|
-
const STRING = 1;
|
|
9283
|
-
const BOOLEANISH_STRING = 2;
|
|
9284
|
-
const BOOLEAN = 3;
|
|
9285
|
-
const OVERLOADED_BOOLEAN = 4;
|
|
9286
|
-
const NUMERIC = 5;
|
|
9287
|
-
const POSITIVE_NUMERIC = 6;
|
|
9288
|
-
function getPropertyInfo(name) {
|
|
9289
|
-
return properties.hasOwnProperty(name) ? properties[name] : null;
|
|
9290
|
-
}
|
|
9291
|
-
function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL, removeEmptyString) {
|
|
9292
|
-
this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
|
|
9293
|
-
this.attributeName = attributeName;
|
|
9294
|
-
this.attributeNamespace = attributeNamespace;
|
|
9295
|
-
this.mustUseProperty = mustUseProperty;
|
|
9296
|
-
this.propertyName = name;
|
|
9297
|
-
this.type = type;
|
|
9298
|
-
this.sanitizeURL = sanitizeURL;
|
|
9299
|
-
this.removeEmptyString = removeEmptyString;
|
|
9300
|
-
}
|
|
9301
|
-
const properties = {};
|
|
9302
|
-
const reservedProps = [
|
|
9303
|
-
"children",
|
|
9304
|
-
"dangerouslySetInnerHTML",
|
|
9305
|
-
// TODO: This prevents the assignment of defaultValue to regular
|
|
9306
|
-
// elements (not just inputs). Now that ReactDOMInput assigns to the
|
|
9307
|
-
// defaultValue property -- do we need this?
|
|
9308
|
-
"defaultValue",
|
|
9309
|
-
"defaultChecked",
|
|
9310
|
-
"innerHTML",
|
|
9311
|
-
"suppressContentEditableWarning",
|
|
9312
|
-
"suppressHydrationWarning",
|
|
9313
|
-
"style"
|
|
9314
|
-
];
|
|
9315
|
-
reservedProps.forEach((name) => {
|
|
9316
|
-
properties[name] = new PropertyInfoRecord(
|
|
9317
|
-
name,
|
|
9318
|
-
RESERVED,
|
|
9319
|
-
false,
|
|
9320
|
-
// mustUseProperty
|
|
9321
|
-
name,
|
|
9322
|
-
// attributeName
|
|
9323
|
-
null,
|
|
9324
|
-
// attributeNamespace
|
|
9325
|
-
false,
|
|
9326
|
-
// sanitizeURL
|
|
9327
|
-
false
|
|
9328
|
-
// removeEmptyString
|
|
9329
|
-
);
|
|
9330
|
-
});
|
|
9331
|
-
[
|
|
9332
|
-
["acceptCharset", "accept-charset"],
|
|
9333
|
-
["className", "class"],
|
|
9334
|
-
["htmlFor", "for"],
|
|
9335
|
-
["httpEquiv", "http-equiv"]
|
|
9336
|
-
].forEach(([name, attributeName]) => {
|
|
9337
|
-
properties[name] = new PropertyInfoRecord(
|
|
9338
|
-
name,
|
|
9339
|
-
STRING,
|
|
9340
|
-
false,
|
|
9341
|
-
// mustUseProperty
|
|
9342
|
-
attributeName,
|
|
9343
|
-
// attributeName
|
|
9344
|
-
null,
|
|
9345
|
-
// attributeNamespace
|
|
9346
|
-
false,
|
|
9347
|
-
// sanitizeURL
|
|
9348
|
-
false
|
|
9349
|
-
// removeEmptyString
|
|
9350
|
-
);
|
|
9351
|
-
});
|
|
9352
|
-
["contentEditable", "draggable", "spellCheck", "value"].forEach((name) => {
|
|
9353
|
-
properties[name] = new PropertyInfoRecord(
|
|
9354
|
-
name,
|
|
9355
|
-
BOOLEANISH_STRING,
|
|
9356
|
-
false,
|
|
9357
|
-
// mustUseProperty
|
|
9358
|
-
name.toLowerCase(),
|
|
9359
|
-
// attributeName
|
|
9360
|
-
null,
|
|
9361
|
-
// attributeNamespace
|
|
9362
|
-
false,
|
|
9363
|
-
// sanitizeURL
|
|
9364
|
-
false
|
|
9365
|
-
// removeEmptyString
|
|
9366
|
-
);
|
|
9367
|
-
});
|
|
9368
|
-
[
|
|
9369
|
-
"autoReverse",
|
|
9370
|
-
"externalResourcesRequired",
|
|
9371
|
-
"focusable",
|
|
9372
|
-
"preserveAlpha"
|
|
9373
|
-
].forEach((name) => {
|
|
9374
|
-
properties[name] = new PropertyInfoRecord(
|
|
9375
|
-
name,
|
|
9376
|
-
BOOLEANISH_STRING,
|
|
9377
|
-
false,
|
|
9378
|
-
// mustUseProperty
|
|
9379
|
-
name,
|
|
9380
|
-
// attributeName
|
|
9381
|
-
null,
|
|
9382
|
-
// attributeNamespace
|
|
9383
|
-
false,
|
|
9384
|
-
// sanitizeURL
|
|
9385
|
-
false
|
|
9386
|
-
// removeEmptyString
|
|
9387
|
-
);
|
|
9388
|
-
});
|
|
9389
|
-
[
|
|
9390
|
-
"allowFullScreen",
|
|
9391
|
-
"async",
|
|
9392
|
-
// Note: there is a special case that prevents it from being written to the DOM
|
|
9393
|
-
// on the client side because the browsers are inconsistent. Instead we call focus().
|
|
9394
|
-
"autoFocus",
|
|
9395
|
-
"autoPlay",
|
|
9396
|
-
"controls",
|
|
9397
|
-
"default",
|
|
9398
|
-
"defer",
|
|
9399
|
-
"disabled",
|
|
9400
|
-
"disablePictureInPicture",
|
|
9401
|
-
"disableRemotePlayback",
|
|
9402
|
-
"formNoValidate",
|
|
9403
|
-
"hidden",
|
|
9404
|
-
"loop",
|
|
9405
|
-
"noModule",
|
|
9406
|
-
"noValidate",
|
|
9407
|
-
"open",
|
|
9408
|
-
"playsInline",
|
|
9409
|
-
"readOnly",
|
|
9410
|
-
"required",
|
|
9411
|
-
"reversed",
|
|
9412
|
-
"scoped",
|
|
9413
|
-
"seamless",
|
|
9414
|
-
// Microdata
|
|
9415
|
-
"itemScope"
|
|
9416
|
-
].forEach((name) => {
|
|
9417
|
-
properties[name] = new PropertyInfoRecord(
|
|
9418
|
-
name,
|
|
9419
|
-
BOOLEAN,
|
|
9420
|
-
false,
|
|
9421
|
-
// mustUseProperty
|
|
9422
|
-
name.toLowerCase(),
|
|
9423
|
-
// attributeName
|
|
9424
|
-
null,
|
|
9425
|
-
// attributeNamespace
|
|
9426
|
-
false,
|
|
9427
|
-
// sanitizeURL
|
|
9428
|
-
false
|
|
9429
|
-
// removeEmptyString
|
|
9430
|
-
);
|
|
9431
|
-
});
|
|
9432
|
-
[
|
|
9433
|
-
"checked",
|
|
9434
|
-
// Note: `option.selected` is not updated if `select.multiple` is
|
|
9435
|
-
// disabled with `removeAttribute`. We have special logic for handling this.
|
|
9436
|
-
"multiple",
|
|
9437
|
-
"muted",
|
|
9438
|
-
"selected"
|
|
9439
|
-
// NOTE: if you add a camelCased prop to this list,
|
|
9440
|
-
// you'll need to set attributeName to name.toLowerCase()
|
|
9441
|
-
// instead in the assignment below.
|
|
9442
|
-
].forEach((name) => {
|
|
9443
|
-
properties[name] = new PropertyInfoRecord(
|
|
9444
|
-
name,
|
|
9445
|
-
BOOLEAN,
|
|
9446
|
-
true,
|
|
9447
|
-
// mustUseProperty
|
|
9448
|
-
name,
|
|
9449
|
-
// attributeName
|
|
9450
|
-
null,
|
|
9451
|
-
// attributeNamespace
|
|
9452
|
-
false,
|
|
9453
|
-
// sanitizeURL
|
|
9454
|
-
false
|
|
9455
|
-
// removeEmptyString
|
|
9456
|
-
);
|
|
9457
|
-
});
|
|
9458
|
-
[
|
|
9459
|
-
"capture",
|
|
9460
|
-
"download"
|
|
9461
|
-
// NOTE: if you add a camelCased prop to this list,
|
|
9462
|
-
// you'll need to set attributeName to name.toLowerCase()
|
|
9463
|
-
// instead in the assignment below.
|
|
9464
|
-
].forEach((name) => {
|
|
9465
|
-
properties[name] = new PropertyInfoRecord(
|
|
9466
|
-
name,
|
|
9467
|
-
OVERLOADED_BOOLEAN,
|
|
9468
|
-
false,
|
|
9469
|
-
// mustUseProperty
|
|
9470
|
-
name,
|
|
9471
|
-
// attributeName
|
|
9472
|
-
null,
|
|
9473
|
-
// attributeNamespace
|
|
9474
|
-
false,
|
|
9475
|
-
// sanitizeURL
|
|
9476
|
-
false
|
|
9477
|
-
// removeEmptyString
|
|
9478
|
-
);
|
|
9479
|
-
});
|
|
9480
|
-
[
|
|
9481
|
-
"cols",
|
|
9482
|
-
"rows",
|
|
9483
|
-
"size",
|
|
9484
|
-
"span"
|
|
9485
|
-
// NOTE: if you add a camelCased prop to this list,
|
|
9486
|
-
// you'll need to set attributeName to name.toLowerCase()
|
|
9487
|
-
// instead in the assignment below.
|
|
9488
|
-
].forEach((name) => {
|
|
9489
|
-
properties[name] = new PropertyInfoRecord(
|
|
9490
|
-
name,
|
|
9491
|
-
POSITIVE_NUMERIC,
|
|
9492
|
-
false,
|
|
9493
|
-
// mustUseProperty
|
|
9494
|
-
name,
|
|
9495
|
-
// attributeName
|
|
9496
|
-
null,
|
|
9497
|
-
// attributeNamespace
|
|
9498
|
-
false,
|
|
9499
|
-
// sanitizeURL
|
|
9500
|
-
false
|
|
9501
|
-
// removeEmptyString
|
|
9502
|
-
);
|
|
9503
|
-
});
|
|
9504
|
-
["rowSpan", "start"].forEach((name) => {
|
|
9505
|
-
properties[name] = new PropertyInfoRecord(
|
|
9506
|
-
name,
|
|
9507
|
-
NUMERIC,
|
|
9508
|
-
false,
|
|
9509
|
-
// mustUseProperty
|
|
9510
|
-
name.toLowerCase(),
|
|
9511
|
-
// attributeName
|
|
9512
|
-
null,
|
|
9513
|
-
// attributeNamespace
|
|
9514
|
-
false,
|
|
9515
|
-
// sanitizeURL
|
|
9516
|
-
false
|
|
9517
|
-
// removeEmptyString
|
|
9518
|
-
);
|
|
9519
|
-
});
|
|
9520
|
-
const CAMELIZE = /[\-\:]([a-z])/g;
|
|
9521
|
-
const capitalize = (token) => token[1].toUpperCase();
|
|
9522
|
-
[
|
|
9523
|
-
"accent-height",
|
|
9524
|
-
"alignment-baseline",
|
|
9525
|
-
"arabic-form",
|
|
9526
|
-
"baseline-shift",
|
|
9527
|
-
"cap-height",
|
|
9528
|
-
"clip-path",
|
|
9529
|
-
"clip-rule",
|
|
9530
|
-
"color-interpolation",
|
|
9531
|
-
"color-interpolation-filters",
|
|
9532
|
-
"color-profile",
|
|
9533
|
-
"color-rendering",
|
|
9534
|
-
"dominant-baseline",
|
|
9535
|
-
"enable-background",
|
|
9536
|
-
"fill-opacity",
|
|
9537
|
-
"fill-rule",
|
|
9538
|
-
"flood-color",
|
|
9539
|
-
"flood-opacity",
|
|
9540
|
-
"font-family",
|
|
9541
|
-
"font-size",
|
|
9542
|
-
"font-size-adjust",
|
|
9543
|
-
"font-stretch",
|
|
9544
|
-
"font-style",
|
|
9545
|
-
"font-variant",
|
|
9546
|
-
"font-weight",
|
|
9547
|
-
"glyph-name",
|
|
9548
|
-
"glyph-orientation-horizontal",
|
|
9549
|
-
"glyph-orientation-vertical",
|
|
9550
|
-
"horiz-adv-x",
|
|
9551
|
-
"horiz-origin-x",
|
|
9552
|
-
"image-rendering",
|
|
9553
|
-
"letter-spacing",
|
|
9554
|
-
"lighting-color",
|
|
9555
|
-
"marker-end",
|
|
9556
|
-
"marker-mid",
|
|
9557
|
-
"marker-start",
|
|
9558
|
-
"overline-position",
|
|
9559
|
-
"overline-thickness",
|
|
9560
|
-
"paint-order",
|
|
9561
|
-
"panose-1",
|
|
9562
|
-
"pointer-events",
|
|
9563
|
-
"rendering-intent",
|
|
9564
|
-
"shape-rendering",
|
|
9565
|
-
"stop-color",
|
|
9566
|
-
"stop-opacity",
|
|
9567
|
-
"strikethrough-position",
|
|
9568
|
-
"strikethrough-thickness",
|
|
9569
|
-
"stroke-dasharray",
|
|
9570
|
-
"stroke-dashoffset",
|
|
9571
|
-
"stroke-linecap",
|
|
9572
|
-
"stroke-linejoin",
|
|
9573
|
-
"stroke-miterlimit",
|
|
9574
|
-
"stroke-opacity",
|
|
9575
|
-
"stroke-width",
|
|
9576
|
-
"text-anchor",
|
|
9577
|
-
"text-decoration",
|
|
9578
|
-
"text-rendering",
|
|
9579
|
-
"underline-position",
|
|
9580
|
-
"underline-thickness",
|
|
9581
|
-
"unicode-bidi",
|
|
9582
|
-
"unicode-range",
|
|
9583
|
-
"units-per-em",
|
|
9584
|
-
"v-alphabetic",
|
|
9585
|
-
"v-hanging",
|
|
9586
|
-
"v-ideographic",
|
|
9587
|
-
"v-mathematical",
|
|
9588
|
-
"vector-effect",
|
|
9589
|
-
"vert-adv-y",
|
|
9590
|
-
"vert-origin-x",
|
|
9591
|
-
"vert-origin-y",
|
|
9592
|
-
"word-spacing",
|
|
9593
|
-
"writing-mode",
|
|
9594
|
-
"xmlns:xlink",
|
|
9595
|
-
"x-height"
|
|
9596
|
-
// NOTE: if you add a camelCased prop to this list,
|
|
9597
|
-
// you'll need to set attributeName to name.toLowerCase()
|
|
9598
|
-
// instead in the assignment below.
|
|
9599
|
-
].forEach((attributeName) => {
|
|
9600
|
-
const name = attributeName.replace(CAMELIZE, capitalize);
|
|
9601
|
-
properties[name] = new PropertyInfoRecord(
|
|
9602
|
-
name,
|
|
9603
|
-
STRING,
|
|
9604
|
-
false,
|
|
9605
|
-
// mustUseProperty
|
|
9606
|
-
attributeName,
|
|
9607
|
-
null,
|
|
9608
|
-
// attributeNamespace
|
|
9609
|
-
false,
|
|
9610
|
-
// sanitizeURL
|
|
9611
|
-
false
|
|
9612
|
-
// removeEmptyString
|
|
9613
|
-
);
|
|
9614
|
-
});
|
|
9615
|
-
[
|
|
9616
|
-
"xlink:actuate",
|
|
9617
|
-
"xlink:arcrole",
|
|
9618
|
-
"xlink:role",
|
|
9619
|
-
"xlink:show",
|
|
9620
|
-
"xlink:title",
|
|
9621
|
-
"xlink:type"
|
|
9622
|
-
// NOTE: if you add a camelCased prop to this list,
|
|
9623
|
-
// you'll need to set attributeName to name.toLowerCase()
|
|
9624
|
-
// instead in the assignment below.
|
|
9625
|
-
].forEach((attributeName) => {
|
|
9626
|
-
const name = attributeName.replace(CAMELIZE, capitalize);
|
|
9627
|
-
properties[name] = new PropertyInfoRecord(
|
|
9628
|
-
name,
|
|
9629
|
-
STRING,
|
|
9630
|
-
false,
|
|
9631
|
-
// mustUseProperty
|
|
9632
|
-
attributeName,
|
|
9633
|
-
"http://www.w3.org/1999/xlink",
|
|
9634
|
-
false,
|
|
9635
|
-
// sanitizeURL
|
|
9636
|
-
false
|
|
9637
|
-
// removeEmptyString
|
|
9638
|
-
);
|
|
9639
|
-
});
|
|
9640
|
-
[
|
|
9641
|
-
"xml:base",
|
|
9642
|
-
"xml:lang",
|
|
9643
|
-
"xml:space"
|
|
9644
|
-
// NOTE: if you add a camelCased prop to this list,
|
|
9645
|
-
// you'll need to set attributeName to name.toLowerCase()
|
|
9646
|
-
// instead in the assignment below.
|
|
9647
|
-
].forEach((attributeName) => {
|
|
9648
|
-
const name = attributeName.replace(CAMELIZE, capitalize);
|
|
9649
|
-
properties[name] = new PropertyInfoRecord(
|
|
9650
|
-
name,
|
|
9651
|
-
STRING,
|
|
9652
|
-
false,
|
|
9653
|
-
// mustUseProperty
|
|
9654
|
-
attributeName,
|
|
9655
|
-
"http://www.w3.org/XML/1998/namespace",
|
|
9656
|
-
false,
|
|
9657
|
-
// sanitizeURL
|
|
9658
|
-
false
|
|
9659
|
-
// removeEmptyString
|
|
9660
|
-
);
|
|
9661
|
-
});
|
|
9662
|
-
["tabIndex", "crossOrigin"].forEach((attributeName) => {
|
|
9663
|
-
properties[attributeName] = new PropertyInfoRecord(
|
|
9664
|
-
attributeName,
|
|
9665
|
-
STRING,
|
|
9666
|
-
false,
|
|
9667
|
-
// mustUseProperty
|
|
9668
|
-
attributeName.toLowerCase(),
|
|
9669
|
-
// attributeName
|
|
9670
|
-
null,
|
|
9671
|
-
// attributeNamespace
|
|
9672
|
-
false,
|
|
9673
|
-
// sanitizeURL
|
|
9674
|
-
false
|
|
9675
|
-
// removeEmptyString
|
|
9676
|
-
);
|
|
9677
|
-
});
|
|
9678
|
-
const xlinkHref = "xlinkHref";
|
|
9679
|
-
properties[xlinkHref] = new PropertyInfoRecord(
|
|
9680
|
-
"xlinkHref",
|
|
9681
|
-
STRING,
|
|
9682
|
-
false,
|
|
9683
|
-
// mustUseProperty
|
|
9684
|
-
"xlink:href",
|
|
9685
|
-
"http://www.w3.org/1999/xlink",
|
|
9686
|
-
true,
|
|
9687
|
-
// sanitizeURL
|
|
9688
|
-
false
|
|
9689
|
-
// removeEmptyString
|
|
9690
|
-
);
|
|
9691
|
-
["src", "href", "action", "formAction"].forEach((attributeName) => {
|
|
9692
|
-
properties[attributeName] = new PropertyInfoRecord(
|
|
9693
|
-
attributeName,
|
|
9694
|
-
STRING,
|
|
9695
|
-
false,
|
|
9696
|
-
// mustUseProperty
|
|
9697
|
-
attributeName.toLowerCase(),
|
|
9698
|
-
// attributeName
|
|
9699
|
-
null,
|
|
9700
|
-
// attributeNamespace
|
|
9701
|
-
true,
|
|
9702
|
-
// sanitizeURL
|
|
9703
|
-
true
|
|
9704
|
-
// removeEmptyString
|
|
9705
|
-
);
|
|
9706
|
-
});
|
|
9707
|
-
const {
|
|
9708
|
-
CAMELCASE,
|
|
9709
|
-
SAME,
|
|
9710
|
-
possibleStandardNames: possibleStandardNamesOptimized2
|
|
9711
|
-
} = requirePossibleStandardNamesOptimized();
|
|
9712
|
-
const ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
|
|
9713
|
-
const ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
|
9714
|
-
const isCustomAttribute = RegExp.prototype.test.bind(
|
|
9715
|
-
// eslint-disable-next-line no-misleading-character-class
|
|
9716
|
-
new RegExp("^(data|aria)-[" + ATTRIBUTE_NAME_CHAR + "]*$")
|
|
9717
|
-
);
|
|
9718
|
-
const possibleStandardNames = Object.keys(
|
|
9719
|
-
possibleStandardNamesOptimized2
|
|
9720
|
-
).reduce((accumulator, standardName) => {
|
|
9721
|
-
const propName = possibleStandardNamesOptimized2[standardName];
|
|
9722
|
-
if (propName === SAME) {
|
|
9723
|
-
accumulator[standardName] = standardName;
|
|
9724
|
-
} else if (propName === CAMELCASE) {
|
|
9725
|
-
accumulator[standardName.toLowerCase()] = standardName;
|
|
9726
|
-
} else {
|
|
9727
|
-
accumulator[standardName] = propName;
|
|
9728
|
-
}
|
|
9729
|
-
return accumulator;
|
|
9730
|
-
}, {});
|
|
9731
|
-
lib.BOOLEAN = BOOLEAN;
|
|
9732
|
-
lib.BOOLEANISH_STRING = BOOLEANISH_STRING;
|
|
9733
|
-
lib.NUMERIC = NUMERIC;
|
|
9734
|
-
lib.OVERLOADED_BOOLEAN = OVERLOADED_BOOLEAN;
|
|
9735
|
-
lib.POSITIVE_NUMERIC = POSITIVE_NUMERIC;
|
|
9736
|
-
lib.RESERVED = RESERVED;
|
|
9737
|
-
lib.STRING = STRING;
|
|
9738
|
-
lib.getPropertyInfo = getPropertyInfo;
|
|
9739
|
-
lib.isCustomAttribute = isCustomAttribute;
|
|
9740
|
-
lib.possibleStandardNames = possibleStandardNames;
|
|
9741
|
-
return lib;
|
|
9742
|
-
}
|
|
9743
|
-
var utilities$1 = {};
|
|
9744
|
-
var cjs$2 = {};
|
|
9745
|
-
var cjs$1;
|
|
9746
|
-
var hasRequiredCjs$2;
|
|
9747
|
-
function requireCjs$2() {
|
|
9748
|
-
if (hasRequiredCjs$2) return cjs$1;
|
|
9749
|
-
hasRequiredCjs$2 = 1;
|
|
9750
|
-
var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
|
|
9751
|
-
var NEWLINE_REGEX = /\n/g;
|
|
9752
|
-
var WHITESPACE_REGEX = /^\s*/;
|
|
9753
|
-
var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/;
|
|
9754
|
-
var COLON_REGEX = /^:\s*/;
|
|
9755
|
-
var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/;
|
|
9756
|
-
var SEMICOLON_REGEX = /^[;\s]*/;
|
|
9757
|
-
var TRIM_REGEX = /^\s+|\s+$/g;
|
|
9758
|
-
var NEWLINE = "\n";
|
|
9759
|
-
var FORWARD_SLASH = "/";
|
|
9760
|
-
var ASTERISK = "*";
|
|
9761
|
-
var EMPTY_STRING = "";
|
|
9762
|
-
var TYPE_COMMENT = "comment";
|
|
9763
|
-
var TYPE_DECLARATION = "declaration";
|
|
9764
|
-
function index(style, options) {
|
|
9765
|
-
if (typeof style !== "string") {
|
|
9766
|
-
throw new TypeError("First argument must be a string");
|
|
9767
|
-
}
|
|
9768
|
-
if (!style) return [];
|
|
9769
|
-
options = options || {};
|
|
9770
|
-
var lineno = 1;
|
|
9771
|
-
var column = 1;
|
|
9772
|
-
function updatePosition(str) {
|
|
9773
|
-
var lines = str.match(NEWLINE_REGEX);
|
|
9774
|
-
if (lines) lineno += lines.length;
|
|
9775
|
-
var i = str.lastIndexOf(NEWLINE);
|
|
9776
|
-
column = ~i ? str.length - i : column + str.length;
|
|
9777
|
-
}
|
|
9778
|
-
function position() {
|
|
9779
|
-
var start = { line: lineno, column };
|
|
9780
|
-
return function(node) {
|
|
9781
|
-
node.position = new Position(start);
|
|
9782
|
-
whitespace();
|
|
9783
|
-
return node;
|
|
9784
|
-
};
|
|
9785
|
-
}
|
|
9786
|
-
function Position(start) {
|
|
9787
|
-
this.start = start;
|
|
9788
|
-
this.end = { line: lineno, column };
|
|
9789
|
-
this.source = options.source;
|
|
9790
|
-
}
|
|
9791
|
-
Position.prototype.content = style;
|
|
9792
|
-
function error(msg) {
|
|
9793
|
-
var err = new Error(
|
|
9794
|
-
options.source + ":" + lineno + ":" + column + ": " + msg
|
|
9795
|
-
);
|
|
9796
|
-
err.reason = msg;
|
|
9797
|
-
err.filename = options.source;
|
|
9798
|
-
err.line = lineno;
|
|
9799
|
-
err.column = column;
|
|
9800
|
-
err.source = style;
|
|
9801
|
-
if (options.silent) ;
|
|
9802
|
-
else {
|
|
9803
|
-
throw err;
|
|
9804
|
-
}
|
|
9805
|
-
}
|
|
9806
|
-
function match(re) {
|
|
9807
|
-
var m = re.exec(style);
|
|
9808
|
-
if (!m) return;
|
|
9809
|
-
var str = m[0];
|
|
9810
|
-
updatePosition(str);
|
|
9811
|
-
style = style.slice(str.length);
|
|
9812
|
-
return m;
|
|
9813
|
-
}
|
|
9814
|
-
function whitespace() {
|
|
9815
|
-
match(WHITESPACE_REGEX);
|
|
9816
|
-
}
|
|
9817
|
-
function comments(rules) {
|
|
9818
|
-
var c;
|
|
9819
|
-
rules = rules || [];
|
|
9820
|
-
while (c = comment()) {
|
|
9821
|
-
if (c !== false) {
|
|
9822
|
-
rules.push(c);
|
|
9823
|
-
}
|
|
9824
|
-
}
|
|
9825
|
-
return rules;
|
|
9826
|
-
}
|
|
9827
|
-
function comment() {
|
|
9828
|
-
var pos = position();
|
|
9829
|
-
if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;
|
|
9830
|
-
var i = 2;
|
|
9831
|
-
while (EMPTY_STRING != style.charAt(i) && (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))) {
|
|
9832
|
-
++i;
|
|
9833
|
-
}
|
|
9834
|
-
i += 2;
|
|
9835
|
-
if (EMPTY_STRING === style.charAt(i - 1)) {
|
|
9836
|
-
return error("End of comment missing");
|
|
9837
|
-
}
|
|
9838
|
-
var str = style.slice(2, i - 2);
|
|
9839
|
-
column += 2;
|
|
9840
|
-
updatePosition(str);
|
|
9841
|
-
style = style.slice(i);
|
|
9842
|
-
column += 2;
|
|
9843
|
-
return pos({
|
|
9844
|
-
type: TYPE_COMMENT,
|
|
9845
|
-
comment: str
|
|
9846
|
-
});
|
|
9847
|
-
}
|
|
9848
|
-
function declaration() {
|
|
9849
|
-
var pos = position();
|
|
9850
|
-
var prop = match(PROPERTY_REGEX);
|
|
9851
|
-
if (!prop) return;
|
|
9852
|
-
comment();
|
|
9853
|
-
if (!match(COLON_REGEX)) return error("property missing ':'");
|
|
9854
|
-
var val = match(VALUE_REGEX);
|
|
9855
|
-
var ret = pos({
|
|
9856
|
-
type: TYPE_DECLARATION,
|
|
9857
|
-
property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),
|
|
9858
|
-
value: val ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING)) : EMPTY_STRING
|
|
9859
|
-
});
|
|
9860
|
-
match(SEMICOLON_REGEX);
|
|
9861
|
-
return ret;
|
|
9862
|
-
}
|
|
9863
|
-
function declarations() {
|
|
9864
|
-
var decls = [];
|
|
9865
|
-
comments(decls);
|
|
9866
|
-
var decl;
|
|
9867
|
-
while (decl = declaration()) {
|
|
9868
|
-
if (decl !== false) {
|
|
9869
|
-
decls.push(decl);
|
|
9870
|
-
comments(decls);
|
|
9871
|
-
}
|
|
9872
|
-
}
|
|
9873
|
-
return decls;
|
|
9874
|
-
}
|
|
9875
|
-
whitespace();
|
|
9876
|
-
return declarations();
|
|
9877
|
-
}
|
|
9878
|
-
function trim(str) {
|
|
9879
|
-
return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
|
|
9880
|
-
}
|
|
9881
|
-
cjs$1 = index;
|
|
9882
|
-
return cjs$1;
|
|
9883
|
-
}
|
|
9884
|
-
var hasRequiredCjs$1;
|
|
9885
|
-
function requireCjs$1() {
|
|
9886
|
-
if (hasRequiredCjs$1) return cjs$2;
|
|
9887
|
-
hasRequiredCjs$1 = 1;
|
|
9888
|
-
var __importDefault = cjs$2 && cjs$2.__importDefault || function(mod) {
|
|
9889
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
9890
|
-
};
|
|
9891
|
-
Object.defineProperty(cjs$2, "__esModule", { value: true });
|
|
9892
|
-
cjs$2.default = StyleToObject;
|
|
9893
|
-
const inline_style_parser_1 = __importDefault(requireCjs$2());
|
|
9894
|
-
function StyleToObject(style, iterator) {
|
|
9895
|
-
let styleObject = null;
|
|
9896
|
-
if (!style || typeof style !== "string") {
|
|
9897
|
-
return styleObject;
|
|
9898
|
-
}
|
|
9899
|
-
const declarations = (0, inline_style_parser_1.default)(style);
|
|
9900
|
-
const hasIterator = typeof iterator === "function";
|
|
9901
|
-
declarations.forEach((declaration) => {
|
|
9902
|
-
if (declaration.type !== "declaration") {
|
|
9903
|
-
return;
|
|
9904
|
-
}
|
|
9905
|
-
const { property, value } = declaration;
|
|
9906
|
-
if (hasIterator) {
|
|
9907
|
-
iterator(property, value, declaration);
|
|
9908
|
-
} else if (value) {
|
|
9909
|
-
styleObject = styleObject || {};
|
|
9910
|
-
styleObject[property] = value;
|
|
9911
|
-
}
|
|
9912
|
-
});
|
|
9913
|
-
return styleObject;
|
|
9914
|
-
}
|
|
9915
|
-
return cjs$2;
|
|
9916
|
-
}
|
|
9917
|
-
var utilities = {};
|
|
9918
|
-
var hasRequiredUtilities$1;
|
|
9919
|
-
function requireUtilities$1() {
|
|
9920
|
-
if (hasRequiredUtilities$1) return utilities;
|
|
9921
|
-
hasRequiredUtilities$1 = 1;
|
|
9922
|
-
Object.defineProperty(utilities, "__esModule", { value: true });
|
|
9923
|
-
utilities.camelCase = void 0;
|
|
9924
|
-
var CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9_-]+$/;
|
|
9925
|
-
var HYPHEN_REGEX = /-([a-z])/g;
|
|
9926
|
-
var NO_HYPHEN_REGEX = /^[^-]+$/;
|
|
9927
|
-
var VENDOR_PREFIX_REGEX = /^-(webkit|moz|ms|o|khtml)-/;
|
|
9928
|
-
var MS_VENDOR_PREFIX_REGEX = /^-(ms)-/;
|
|
9929
|
-
var skipCamelCase = function(property) {
|
|
9930
|
-
return !property || NO_HYPHEN_REGEX.test(property) || CUSTOM_PROPERTY_REGEX.test(property);
|
|
9931
|
-
};
|
|
9932
|
-
var capitalize = function(match, character) {
|
|
9933
|
-
return character.toUpperCase();
|
|
9934
|
-
};
|
|
9935
|
-
var trimHyphen = function(match, prefix) {
|
|
9936
|
-
return "".concat(prefix, "-");
|
|
9937
|
-
};
|
|
9938
|
-
var camelCase = function(property, options) {
|
|
9939
|
-
if (options === void 0) {
|
|
9940
|
-
options = {};
|
|
9941
|
-
}
|
|
9942
|
-
if (skipCamelCase(property)) {
|
|
9943
|
-
return property;
|
|
9944
|
-
}
|
|
9945
|
-
property = property.toLowerCase();
|
|
9946
|
-
if (options.reactCompat) {
|
|
9947
|
-
property = property.replace(MS_VENDOR_PREFIX_REGEX, trimHyphen);
|
|
9948
|
-
} else {
|
|
9949
|
-
property = property.replace(VENDOR_PREFIX_REGEX, trimHyphen);
|
|
9950
|
-
}
|
|
9951
|
-
return property.replace(HYPHEN_REGEX, capitalize);
|
|
9952
|
-
};
|
|
9953
|
-
utilities.camelCase = camelCase;
|
|
9954
|
-
return utilities;
|
|
9955
|
-
}
|
|
9956
|
-
var cjs;
|
|
9957
|
-
var hasRequiredCjs;
|
|
9958
|
-
function requireCjs() {
|
|
9959
|
-
if (hasRequiredCjs) return cjs;
|
|
9960
|
-
hasRequiredCjs = 1;
|
|
9961
|
-
var __importDefault = cjs && cjs.__importDefault || function(mod) {
|
|
9962
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
9963
|
-
};
|
|
9964
|
-
var style_to_object_1 = __importDefault(requireCjs$1());
|
|
9965
|
-
var utilities_1 = requireUtilities$1();
|
|
9966
|
-
function StyleToJS(style, options) {
|
|
9967
|
-
var output = {};
|
|
9968
|
-
if (!style || typeof style !== "string") {
|
|
9969
|
-
return output;
|
|
9970
|
-
}
|
|
9971
|
-
(0, style_to_object_1.default)(style, function(property, value) {
|
|
9972
|
-
if (property && value) {
|
|
9973
|
-
output[(0, utilities_1.camelCase)(property, options)] = value;
|
|
9974
|
-
}
|
|
9975
|
-
});
|
|
9976
|
-
return output;
|
|
9977
|
-
}
|
|
9978
|
-
StyleToJS.default = StyleToJS;
|
|
9979
|
-
cjs = StyleToJS;
|
|
9980
|
-
return cjs;
|
|
9981
|
-
}
|
|
9982
|
-
var hasRequiredUtilities;
|
|
9983
|
-
function requireUtilities() {
|
|
9984
|
-
if (hasRequiredUtilities) return utilities$1;
|
|
9985
|
-
hasRequiredUtilities = 1;
|
|
9986
|
-
(function(exports2) {
|
|
9987
|
-
var __importDefault = utilities$1 && utilities$1.__importDefault || function(mod) {
|
|
9988
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
9989
|
-
};
|
|
9990
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
9991
|
-
exports2.returnFirstArg = exports2.canTextBeChildOfNode = exports2.ELEMENTS_WITH_NO_TEXT_CHILDREN = exports2.PRESERVE_CUSTOM_ATTRIBUTES = void 0;
|
|
9992
|
-
exports2.isCustomComponent = isCustomComponent;
|
|
9993
|
-
exports2.setStyleProp = setStyleProp;
|
|
9994
|
-
const react_1 = require$$0__default.default;
|
|
9995
|
-
const style_to_js_1 = __importDefault(requireCjs());
|
|
9996
|
-
const RESERVED_SVG_MATHML_ELEMENTS = /* @__PURE__ */ new Set([
|
|
9997
|
-
"annotation-xml",
|
|
9998
|
-
"color-profile",
|
|
9999
|
-
"font-face",
|
|
10000
|
-
"font-face-src",
|
|
10001
|
-
"font-face-uri",
|
|
10002
|
-
"font-face-format",
|
|
10003
|
-
"font-face-name",
|
|
10004
|
-
"missing-glyph"
|
|
10005
|
-
]);
|
|
10006
|
-
function isCustomComponent(tagName, props) {
|
|
10007
|
-
if (!tagName.includes("-")) {
|
|
10008
|
-
return Boolean(props && typeof props.is === "string");
|
|
10009
|
-
}
|
|
10010
|
-
if (RESERVED_SVG_MATHML_ELEMENTS.has(tagName)) {
|
|
10011
|
-
return false;
|
|
10012
|
-
}
|
|
10013
|
-
return true;
|
|
10014
|
-
}
|
|
10015
|
-
const styleOptions = {
|
|
10016
|
-
reactCompat: true
|
|
10017
|
-
};
|
|
10018
|
-
function setStyleProp(style, props) {
|
|
10019
|
-
if (typeof style !== "string") {
|
|
10020
|
-
return;
|
|
10021
|
-
}
|
|
10022
|
-
if (!style.trim()) {
|
|
10023
|
-
props.style = {};
|
|
10024
|
-
return;
|
|
10025
|
-
}
|
|
10026
|
-
try {
|
|
10027
|
-
props.style = (0, style_to_js_1.default)(style, styleOptions);
|
|
10028
|
-
} catch (error) {
|
|
10029
|
-
props.style = {};
|
|
10030
|
-
}
|
|
10031
|
-
}
|
|
10032
|
-
exports2.PRESERVE_CUSTOM_ATTRIBUTES = Number(react_1.version.split(".")[0]) >= 16;
|
|
10033
|
-
exports2.ELEMENTS_WITH_NO_TEXT_CHILDREN = /* @__PURE__ */ new Set([
|
|
10034
|
-
"tr",
|
|
10035
|
-
"tbody",
|
|
10036
|
-
"thead",
|
|
10037
|
-
"tfoot",
|
|
10038
|
-
"colgroup",
|
|
10039
|
-
"table",
|
|
10040
|
-
"head",
|
|
10041
|
-
"html",
|
|
10042
|
-
"frameset"
|
|
10043
|
-
]);
|
|
10044
|
-
const canTextBeChildOfNode = (node) => !exports2.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(node.name);
|
|
10045
|
-
exports2.canTextBeChildOfNode = canTextBeChildOfNode;
|
|
10046
|
-
const returnFirstArg = (arg) => arg;
|
|
10047
|
-
exports2.returnFirstArg = returnFirstArg;
|
|
10048
|
-
})(utilities$1);
|
|
10049
|
-
return utilities$1;
|
|
10050
|
-
}
|
|
10051
|
-
var hasRequiredAttributesToProps;
|
|
10052
|
-
function requireAttributesToProps() {
|
|
10053
|
-
if (hasRequiredAttributesToProps) return attributesToProps;
|
|
10054
|
-
hasRequiredAttributesToProps = 1;
|
|
10055
|
-
Object.defineProperty(attributesToProps, "__esModule", { value: true });
|
|
10056
|
-
attributesToProps.default = attributesToProps$1;
|
|
10057
|
-
const react_property_1 = requireLib$1();
|
|
10058
|
-
const utilities_1 = requireUtilities();
|
|
10059
|
-
const UNCONTROLLED_COMPONENT_ATTRIBUTES = ["checked", "value"];
|
|
10060
|
-
const UNCONTROLLED_COMPONENT_NAMES = ["input", "select", "textarea"];
|
|
10061
|
-
const valueOnlyInputs = {
|
|
10062
|
-
reset: true,
|
|
10063
|
-
submit: true
|
|
10064
|
-
};
|
|
10065
|
-
function attributesToProps$1(attributes = {}, nodeName) {
|
|
10066
|
-
const props = {};
|
|
10067
|
-
const isInputValueOnly = Boolean(attributes.type && valueOnlyInputs[attributes.type]);
|
|
10068
|
-
for (const attributeName in attributes) {
|
|
10069
|
-
const attributeValue = attributes[attributeName];
|
|
10070
|
-
if ((0, react_property_1.isCustomAttribute)(attributeName)) {
|
|
10071
|
-
props[attributeName] = attributeValue;
|
|
10072
|
-
continue;
|
|
10073
|
-
}
|
|
10074
|
-
const attributeNameLowerCased = attributeName.toLowerCase();
|
|
10075
|
-
let propName = getPropName(attributeNameLowerCased);
|
|
10076
|
-
if (propName) {
|
|
10077
|
-
const propertyInfo = (0, react_property_1.getPropertyInfo)(propName);
|
|
10078
|
-
if (UNCONTROLLED_COMPONENT_ATTRIBUTES.includes(propName) && UNCONTROLLED_COMPONENT_NAMES.includes(nodeName) && !isInputValueOnly) {
|
|
10079
|
-
propName = getPropName("default" + attributeNameLowerCased);
|
|
10080
|
-
}
|
|
10081
|
-
props[propName] = attributeValue;
|
|
10082
|
-
switch (propertyInfo === null || propertyInfo === void 0 ? void 0 : propertyInfo.type) {
|
|
10083
|
-
case react_property_1.BOOLEAN:
|
|
10084
|
-
props[propName] = true;
|
|
10085
|
-
break;
|
|
10086
|
-
case react_property_1.OVERLOADED_BOOLEAN:
|
|
10087
|
-
if (attributeValue === "") {
|
|
10088
|
-
props[propName] = true;
|
|
10089
|
-
}
|
|
10090
|
-
break;
|
|
10091
|
-
}
|
|
10092
|
-
continue;
|
|
10093
|
-
}
|
|
10094
|
-
if (utilities_1.PRESERVE_CUSTOM_ATTRIBUTES) {
|
|
10095
|
-
props[attributeName] = attributeValue;
|
|
10096
|
-
}
|
|
10097
|
-
}
|
|
10098
|
-
(0, utilities_1.setStyleProp)(attributes.style, props);
|
|
10099
|
-
return props;
|
|
10100
|
-
}
|
|
10101
|
-
function getPropName(attributeName) {
|
|
10102
|
-
return react_property_1.possibleStandardNames[attributeName];
|
|
10103
|
-
}
|
|
10104
|
-
return attributesToProps;
|
|
10105
|
-
}
|
|
10106
|
-
var domToReact = {};
|
|
10107
|
-
var hasRequiredDomToReact;
|
|
10108
|
-
function requireDomToReact() {
|
|
10109
|
-
if (hasRequiredDomToReact) return domToReact;
|
|
10110
|
-
hasRequiredDomToReact = 1;
|
|
10111
|
-
var __importDefault = domToReact && domToReact.__importDefault || function(mod) {
|
|
10112
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
10113
|
-
};
|
|
10114
|
-
Object.defineProperty(domToReact, "__esModule", { value: true });
|
|
10115
|
-
domToReact.default = domToReact$1;
|
|
10116
|
-
const react_1 = require$$0__default.default;
|
|
10117
|
-
const attributes_to_props_1 = __importDefault(requireAttributesToProps());
|
|
10118
|
-
const utilities_1 = requireUtilities();
|
|
10119
|
-
const React = {
|
|
10120
|
-
cloneElement: react_1.cloneElement,
|
|
10121
|
-
createElement: react_1.createElement,
|
|
10122
|
-
isValidElement: react_1.isValidElement
|
|
10123
|
-
};
|
|
10124
|
-
function domToReact$1(nodes, options = {}) {
|
|
10125
|
-
var _a, _b, _c, _d, _e;
|
|
10126
|
-
const reactElements = [];
|
|
10127
|
-
const hasReplace = typeof options.replace === "function";
|
|
10128
|
-
const transform2 = (_a = options.transform) !== null && _a !== void 0 ? _a : utilities_1.returnFirstArg;
|
|
10129
|
-
const { cloneElement, createElement, isValidElement } = (_b = options.library) !== null && _b !== void 0 ? _b : React;
|
|
10130
|
-
const nodesLength = nodes.length;
|
|
10131
|
-
for (let index = 0; index < nodesLength; index++) {
|
|
10132
|
-
const node = nodes[index];
|
|
10133
|
-
if (hasReplace) {
|
|
10134
|
-
let replaceElement = (_c = options.replace) === null || _c === void 0 ? void 0 : _c.call(options, node, index);
|
|
10135
|
-
if (isValidElement(replaceElement)) {
|
|
10136
|
-
if (nodesLength > 1) {
|
|
10137
|
-
replaceElement = cloneElement(replaceElement, {
|
|
10138
|
-
key: (_d = replaceElement.key) !== null && _d !== void 0 ? _d : index
|
|
10139
|
-
});
|
|
10140
|
-
}
|
|
10141
|
-
reactElements.push(transform2(replaceElement, node, index));
|
|
10142
|
-
continue;
|
|
10143
|
-
}
|
|
10144
|
-
}
|
|
10145
|
-
if (node.type === "text") {
|
|
10146
|
-
const isWhitespace = !node.data.trim().length;
|
|
10147
|
-
if (isWhitespace && node.parent && !(0, utilities_1.canTextBeChildOfNode)(node.parent)) {
|
|
10148
|
-
continue;
|
|
10149
|
-
}
|
|
10150
|
-
if (options.trim && isWhitespace) {
|
|
10151
|
-
continue;
|
|
10152
|
-
}
|
|
10153
|
-
reactElements.push(transform2(node.data, node, index));
|
|
10154
|
-
continue;
|
|
10155
|
-
}
|
|
10156
|
-
const element = node;
|
|
10157
|
-
let props = {};
|
|
10158
|
-
if (skipAttributesToProps(element)) {
|
|
10159
|
-
(0, utilities_1.setStyleProp)(element.attribs.style, element.attribs);
|
|
10160
|
-
props = element.attribs;
|
|
10161
|
-
} else if (element.attribs) {
|
|
10162
|
-
props = (0, attributes_to_props_1.default)(element.attribs, element.name);
|
|
10163
|
-
}
|
|
10164
|
-
let children;
|
|
10165
|
-
switch (node.type) {
|
|
10166
|
-
case "script":
|
|
10167
|
-
case "style":
|
|
10168
|
-
if (node.children[0]) {
|
|
10169
|
-
props.dangerouslySetInnerHTML = {
|
|
10170
|
-
__html: node.children[0].data
|
|
10171
|
-
};
|
|
10172
|
-
}
|
|
10173
|
-
break;
|
|
10174
|
-
case "tag":
|
|
10175
|
-
if (node.name === "textarea" && node.children[0]) {
|
|
10176
|
-
props.defaultValue = node.children[0].data;
|
|
10177
|
-
} else if ((_e = node.children) === null || _e === void 0 ? void 0 : _e.length) {
|
|
10178
|
-
children = domToReact$1(node.children, options);
|
|
10179
|
-
}
|
|
10180
|
-
break;
|
|
10181
|
-
// skip all other cases (e.g., comment)
|
|
10182
|
-
default:
|
|
10183
|
-
continue;
|
|
10184
|
-
}
|
|
10185
|
-
if (nodesLength > 1) {
|
|
10186
|
-
props.key = index;
|
|
10187
|
-
}
|
|
10188
|
-
reactElements.push(transform2(createElement(node.name, props, children), node, index));
|
|
10189
|
-
}
|
|
10190
|
-
return reactElements.length === 1 ? reactElements[0] : reactElements;
|
|
10191
|
-
}
|
|
10192
|
-
function skipAttributesToProps(node) {
|
|
10193
|
-
return utilities_1.PRESERVE_CUSTOM_ATTRIBUTES && node.type === "tag" && (0, utilities_1.isCustomComponent)(node.name, node.attribs);
|
|
10194
|
-
}
|
|
10195
|
-
return domToReact;
|
|
10196
|
-
}
|
|
10197
|
-
var ElementType;
|
|
10198
|
-
(function(ElementType2) {
|
|
10199
|
-
ElementType2["Root"] = "root";
|
|
10200
|
-
ElementType2["Text"] = "text";
|
|
10201
|
-
ElementType2["Directive"] = "directive";
|
|
10202
|
-
ElementType2["Comment"] = "comment";
|
|
10203
|
-
ElementType2["Script"] = "script";
|
|
10204
|
-
ElementType2["Style"] = "style";
|
|
10205
|
-
ElementType2["Tag"] = "tag";
|
|
10206
|
-
ElementType2["CDATA"] = "cdata";
|
|
10207
|
-
ElementType2["Doctype"] = "doctype";
|
|
10208
|
-
})(ElementType || (ElementType = {}));
|
|
10209
|
-
function isTag$1(element) {
|
|
10210
|
-
return element.type === ElementType.Tag || element.type === ElementType.Script || element.type === ElementType.Style;
|
|
10211
|
-
}
|
|
10212
|
-
ElementType.Root;
|
|
10213
|
-
ElementType.Text;
|
|
10214
|
-
ElementType.Directive;
|
|
10215
|
-
ElementType.Comment;
|
|
10216
|
-
ElementType.Script;
|
|
10217
|
-
ElementType.Style;
|
|
10218
|
-
ElementType.Tag;
|
|
10219
|
-
ElementType.CDATA;
|
|
10220
|
-
ElementType.Doctype;
|
|
10221
|
-
class Node {
|
|
10222
|
-
constructor() {
|
|
10223
|
-
/** Parent of the node */
|
|
10224
|
-
__publicField(this, "parent", null);
|
|
10225
|
-
/** Previous sibling */
|
|
10226
|
-
__publicField(this, "prev", null);
|
|
10227
|
-
/** Next sibling */
|
|
10228
|
-
__publicField(this, "next", null);
|
|
10229
|
-
/** The start index of the node. Requires `withStartIndices` on the handler to be `true. */
|
|
10230
|
-
__publicField(this, "startIndex", null);
|
|
10231
|
-
/** The end index of the node. Requires `withEndIndices` on the handler to be `true. */
|
|
10232
|
-
__publicField(this, "endIndex", null);
|
|
10233
|
-
}
|
|
10234
|
-
// Read-write aliases for properties
|
|
10235
|
-
/**
|
|
10236
|
-
* Same as {@link parent}.
|
|
10237
|
-
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
|
10238
|
-
*/
|
|
10239
|
-
get parentNode() {
|
|
10240
|
-
return this.parent;
|
|
10241
|
-
}
|
|
10242
|
-
set parentNode(parent) {
|
|
10243
|
-
this.parent = parent;
|
|
10244
|
-
}
|
|
10245
|
-
/**
|
|
10246
|
-
* Same as {@link prev}.
|
|
10247
|
-
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
|
10248
|
-
*/
|
|
10249
|
-
get previousSibling() {
|
|
10250
|
-
return this.prev;
|
|
10251
|
-
}
|
|
10252
|
-
set previousSibling(previous) {
|
|
10253
|
-
this.prev = previous;
|
|
10254
|
-
}
|
|
10255
|
-
/**
|
|
10256
|
-
* Same as {@link next}.
|
|
10257
|
-
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
|
10258
|
-
*/
|
|
10259
|
-
get nextSibling() {
|
|
10260
|
-
return this.next;
|
|
10261
|
-
}
|
|
10262
|
-
set nextSibling(next) {
|
|
10263
|
-
this.next = next;
|
|
10264
|
-
}
|
|
10265
|
-
/**
|
|
10266
|
-
* Clone this node, and optionally its children.
|
|
10267
|
-
* @param recursive Clone child nodes as well.
|
|
10268
|
-
* @returns A clone of the node.
|
|
10269
|
-
*/
|
|
10270
|
-
cloneNode(recursive = false) {
|
|
10271
|
-
return cloneNode(this, recursive);
|
|
10272
|
-
}
|
|
10273
|
-
}
|
|
10274
|
-
class DataNode extends Node {
|
|
10275
|
-
/**
|
|
10276
|
-
* @param data The content of the data node
|
|
10277
|
-
*/
|
|
10278
|
-
constructor(data) {
|
|
10279
|
-
super();
|
|
10280
|
-
__publicField(this, "data");
|
|
10281
|
-
this.data = data;
|
|
10282
|
-
}
|
|
10283
|
-
/**
|
|
10284
|
-
* Same as {@link data}.
|
|
10285
|
-
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
|
10286
|
-
*/
|
|
10287
|
-
get nodeValue() {
|
|
10288
|
-
return this.data;
|
|
10289
|
-
}
|
|
10290
|
-
set nodeValue(data) {
|
|
10291
|
-
this.data = data;
|
|
10292
|
-
}
|
|
10293
|
-
}
|
|
10294
|
-
class Text extends DataNode {
|
|
10295
|
-
constructor() {
|
|
10296
|
-
super(...arguments);
|
|
10297
|
-
__publicField(this, "type", ElementType.Text);
|
|
10298
|
-
}
|
|
10299
|
-
get nodeType() {
|
|
10300
|
-
return 3;
|
|
10301
|
-
}
|
|
10302
|
-
}
|
|
10303
|
-
class Comment extends DataNode {
|
|
10304
|
-
constructor() {
|
|
10305
|
-
super(...arguments);
|
|
10306
|
-
__publicField(this, "type", ElementType.Comment);
|
|
10307
|
-
}
|
|
10308
|
-
get nodeType() {
|
|
10309
|
-
return 8;
|
|
10310
|
-
}
|
|
10311
|
-
}
|
|
10312
|
-
class ProcessingInstruction extends DataNode {
|
|
10313
|
-
constructor(name, data) {
|
|
10314
|
-
super(data);
|
|
10315
|
-
__publicField(this, "type", ElementType.Directive);
|
|
10316
|
-
__publicField(this, "name");
|
|
10317
|
-
/** If this is a doctype, the document type name (parse5 only). */
|
|
10318
|
-
__publicField(this, "x-name");
|
|
10319
|
-
/** If this is a doctype, the document type public identifier (parse5 only). */
|
|
10320
|
-
__publicField(this, "x-publicId");
|
|
10321
|
-
/** If this is a doctype, the document type system identifier (parse5 only). */
|
|
10322
|
-
__publicField(this, "x-systemId");
|
|
10323
|
-
this.name = name;
|
|
10324
|
-
}
|
|
10325
|
-
get nodeType() {
|
|
10326
|
-
return 1;
|
|
10327
|
-
}
|
|
10328
|
-
}
|
|
10329
|
-
class NodeWithChildren extends Node {
|
|
10330
|
-
/**
|
|
10331
|
-
* @param children Children of the node. Only certain node types can have children.
|
|
10332
|
-
*/
|
|
10333
|
-
constructor(children) {
|
|
10334
|
-
super();
|
|
10335
|
-
__publicField(this, "children");
|
|
10336
|
-
this.children = children;
|
|
10337
|
-
}
|
|
10338
|
-
// Aliases
|
|
10339
|
-
/** First child of the node. */
|
|
10340
|
-
get firstChild() {
|
|
10341
|
-
return this.children[0] ?? null;
|
|
10342
|
-
}
|
|
10343
|
-
/** Last child of the node. */
|
|
10344
|
-
get lastChild() {
|
|
10345
|
-
return this.children.length > 0 ? this.children[this.children.length - 1] : null;
|
|
10346
|
-
}
|
|
10347
|
-
/**
|
|
10348
|
-
* Same as {@link children}.
|
|
10349
|
-
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
|
10350
|
-
*/
|
|
10351
|
-
get childNodes() {
|
|
10352
|
-
return this.children;
|
|
10353
|
-
}
|
|
10354
|
-
set childNodes(children) {
|
|
10355
|
-
this.children = children;
|
|
10356
|
-
}
|
|
10357
|
-
}
|
|
10358
|
-
class CDATA extends NodeWithChildren {
|
|
10359
|
-
constructor() {
|
|
10360
|
-
super(...arguments);
|
|
10361
|
-
__publicField(this, "type", ElementType.CDATA);
|
|
10362
|
-
}
|
|
10363
|
-
get nodeType() {
|
|
10364
|
-
return 4;
|
|
10365
|
-
}
|
|
10366
|
-
}
|
|
10367
|
-
class Document extends NodeWithChildren {
|
|
10368
|
-
constructor() {
|
|
10369
|
-
super(...arguments);
|
|
10370
|
-
__publicField(this, "type", ElementType.Root);
|
|
10371
|
-
}
|
|
10372
|
-
get nodeType() {
|
|
10373
|
-
return 9;
|
|
10374
|
-
}
|
|
10375
|
-
}
|
|
10376
|
-
class Element extends NodeWithChildren {
|
|
10377
|
-
/**
|
|
10378
|
-
* @param name Name of the tag, eg. `div`, `span`.
|
|
10379
|
-
* @param attribs Object mapping attribute names to attribute values.
|
|
10380
|
-
* @param children Children of the node.
|
|
10381
|
-
* @param type Node type used for the new node instance.
|
|
10382
|
-
*/
|
|
10383
|
-
constructor(name, attribs, children = [], type = name === "script" ? ElementType.Script : name === "style" ? ElementType.Style : ElementType.Tag) {
|
|
10384
|
-
super(children);
|
|
10385
|
-
__publicField(this, "name");
|
|
10386
|
-
__publicField(this, "attribs");
|
|
10387
|
-
__publicField(this, "type");
|
|
10388
|
-
/** Element namespace (parse5 only). */
|
|
10389
|
-
__publicField(this, "namespace");
|
|
10390
|
-
/** Element attribute namespaces (parse5 only). */
|
|
10391
|
-
__publicField(this, "x-attribsNamespace");
|
|
10392
|
-
/** Element attribute namespace-related prefixes (parse5 only). */
|
|
10393
|
-
__publicField(this, "x-attribsPrefix");
|
|
10394
|
-
this.name = name;
|
|
10395
|
-
this.attribs = attribs;
|
|
10396
|
-
this.type = type;
|
|
10397
|
-
}
|
|
10398
|
-
get nodeType() {
|
|
10399
|
-
return 1;
|
|
10400
|
-
}
|
|
10401
|
-
// DOM Level 1 aliases
|
|
10402
|
-
/**
|
|
10403
|
-
* Same as {@link name}.
|
|
10404
|
-
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
|
10405
|
-
*/
|
|
10406
|
-
get tagName() {
|
|
10407
|
-
return this.name;
|
|
10408
|
-
}
|
|
10409
|
-
set tagName(name) {
|
|
10410
|
-
this.name = name;
|
|
10411
|
-
}
|
|
10412
|
-
get attributes() {
|
|
10413
|
-
return Object.keys(this.attribs).map((name) => {
|
|
10414
|
-
var _a, _b;
|
|
10415
|
-
return {
|
|
10416
|
-
name,
|
|
10417
|
-
value: this.attribs[name],
|
|
10418
|
-
namespace: (_a = this["x-attribsNamespace"]) == null ? void 0 : _a[name],
|
|
10419
|
-
prefix: (_b = this["x-attribsPrefix"]) == null ? void 0 : _b[name]
|
|
10420
|
-
};
|
|
10421
|
-
});
|
|
10422
|
-
}
|
|
10423
|
-
}
|
|
10424
|
-
function isTag(node) {
|
|
10425
|
-
return isTag$1(node);
|
|
10426
|
-
}
|
|
10427
|
-
function isCDATA(node) {
|
|
10428
|
-
return node.type === ElementType.CDATA;
|
|
10429
|
-
}
|
|
10430
|
-
function isText(node) {
|
|
10431
|
-
return node.type === ElementType.Text;
|
|
10432
|
-
}
|
|
10433
|
-
function isComment(node) {
|
|
10434
|
-
return node.type === ElementType.Comment;
|
|
10435
|
-
}
|
|
10436
|
-
function isDirective(node) {
|
|
10437
|
-
return node.type === ElementType.Directive;
|
|
10438
|
-
}
|
|
10439
|
-
function isDocument(node) {
|
|
10440
|
-
return node.type === ElementType.Root;
|
|
10441
|
-
}
|
|
10442
|
-
function hasChildren(node) {
|
|
10443
|
-
return Object.hasOwn(node, "children");
|
|
10444
|
-
}
|
|
10445
|
-
function cloneNode(node, recursive = false) {
|
|
10446
|
-
let result;
|
|
10447
|
-
if (isText(node)) {
|
|
10448
|
-
result = new Text(node.data);
|
|
10449
|
-
} else if (isComment(node)) {
|
|
10450
|
-
result = new Comment(node.data);
|
|
10451
|
-
} else if (isTag(node)) {
|
|
10452
|
-
const children = recursive ? cloneChildren(node.children) : [];
|
|
10453
|
-
const clone2 = new Element(node.name, { ...node.attribs }, children);
|
|
10454
|
-
for (const child of children) {
|
|
10455
|
-
child.parent = clone2;
|
|
10456
|
-
}
|
|
10457
|
-
if (node.namespace != null) {
|
|
10458
|
-
clone2.namespace = node.namespace;
|
|
10459
|
-
}
|
|
10460
|
-
if (node["x-attribsNamespace"]) {
|
|
10461
|
-
clone2["x-attribsNamespace"] = { ...node["x-attribsNamespace"] };
|
|
10462
|
-
}
|
|
10463
|
-
if (node["x-attribsPrefix"]) {
|
|
10464
|
-
clone2["x-attribsPrefix"] = { ...node["x-attribsPrefix"] };
|
|
10465
|
-
}
|
|
10466
|
-
result = clone2;
|
|
10467
|
-
} else if (isCDATA(node)) {
|
|
10468
|
-
const children = recursive ? cloneChildren(node.children) : [];
|
|
10469
|
-
const clone2 = new CDATA(children);
|
|
10470
|
-
for (const child of children) {
|
|
10471
|
-
child.parent = clone2;
|
|
10472
|
-
}
|
|
10473
|
-
result = clone2;
|
|
10474
|
-
} else if (isDocument(node)) {
|
|
10475
|
-
const children = recursive ? cloneChildren(node.children) : [];
|
|
10476
|
-
const clone2 = new Document(children);
|
|
10477
|
-
for (const child of children) {
|
|
10478
|
-
child.parent = clone2;
|
|
10479
|
-
}
|
|
10480
|
-
if (node["x-mode"]) {
|
|
10481
|
-
clone2["x-mode"] = node["x-mode"];
|
|
10482
|
-
}
|
|
10483
|
-
result = clone2;
|
|
10484
|
-
} else if (isDirective(node)) {
|
|
10485
|
-
const instruction = new ProcessingInstruction(node.name, node.data);
|
|
10486
|
-
if (node["x-name"] != null) {
|
|
10487
|
-
instruction["x-name"] = node["x-name"];
|
|
10488
|
-
instruction["x-publicId"] = node["x-publicId"];
|
|
10489
|
-
instruction["x-systemId"] = node["x-systemId"];
|
|
10490
|
-
}
|
|
10491
|
-
result = instruction;
|
|
10492
|
-
} else {
|
|
10493
|
-
throw new Error(`Not implemented yet: ${node.type}`);
|
|
10494
|
-
}
|
|
10495
|
-
result.startIndex = node.startIndex;
|
|
10496
|
-
result.endIndex = node.endIndex;
|
|
10497
|
-
if (node.sourceCodeLocation != null) {
|
|
10498
|
-
result.sourceCodeLocation = node.sourceCodeLocation;
|
|
10499
|
-
}
|
|
10500
|
-
return result;
|
|
10501
|
-
}
|
|
10502
|
-
function cloneChildren(childs) {
|
|
10503
|
-
const children = childs.map((child) => cloneNode(child, true));
|
|
10504
|
-
for (let index = 1; index < children.length; index++) {
|
|
10505
|
-
children[index].prev = children[index - 1];
|
|
10506
|
-
children[index - 1].next = children[index];
|
|
10507
|
-
}
|
|
10508
|
-
return children;
|
|
10509
|
-
}
|
|
10510
|
-
const defaultOptions = {
|
|
10511
|
-
withStartIndices: false,
|
|
10512
|
-
withEndIndices: false,
|
|
10513
|
-
xmlMode: false
|
|
10514
|
-
};
|
|
10515
|
-
class DomHandler {
|
|
10516
|
-
/**
|
|
10517
|
-
* @param callback Called once parsing has completed.
|
|
10518
|
-
* @param options Settings for the handler.
|
|
10519
|
-
* @param elementCB Callback whenever a tag is closed.
|
|
10520
|
-
*/
|
|
10521
|
-
constructor(callback, options, elementCB) {
|
|
10522
|
-
/** The elements of the DOM */
|
|
10523
|
-
__publicField(this, "dom", []);
|
|
10524
|
-
/** The root element for the DOM */
|
|
10525
|
-
__publicField(this, "root", new Document(this.dom));
|
|
10526
|
-
/** Called once parsing has completed. */
|
|
10527
|
-
__publicField(this, "callback");
|
|
10528
|
-
/** Settings for the handler. */
|
|
10529
|
-
__publicField(this, "options");
|
|
10530
|
-
/** Callback whenever a tag is closed. */
|
|
10531
|
-
__publicField(this, "elementCB");
|
|
10532
|
-
/** Indicated whether parsing has been completed. */
|
|
10533
|
-
__publicField(this, "done", false);
|
|
10534
|
-
/** Stack of open tags. */
|
|
10535
|
-
__publicField(this, "tagStack", [this.root]);
|
|
10536
|
-
/** A data node that is still being written to. */
|
|
10537
|
-
__publicField(this, "lastNode", null);
|
|
10538
|
-
/** Reference to the parser instance. Used for location information. */
|
|
10539
|
-
__publicField(this, "parser", null);
|
|
10540
|
-
if (typeof options === "function") {
|
|
10541
|
-
elementCB = options;
|
|
10542
|
-
options = defaultOptions;
|
|
10543
|
-
}
|
|
10544
|
-
if (typeof callback === "object") {
|
|
10545
|
-
options = callback;
|
|
10546
|
-
callback = void 0;
|
|
10547
|
-
}
|
|
10548
|
-
this.callback = callback ?? null;
|
|
10549
|
-
this.options = options ?? defaultOptions;
|
|
10550
|
-
this.elementCB = elementCB ?? null;
|
|
10551
|
-
}
|
|
10552
|
-
onparserinit(parser) {
|
|
10553
|
-
this.parser = parser;
|
|
10554
|
-
}
|
|
10555
|
-
// Resets the handler back to starting state
|
|
10556
|
-
onreset() {
|
|
10557
|
-
this.dom = [];
|
|
10558
|
-
this.root = new Document(this.dom);
|
|
10559
|
-
this.done = false;
|
|
10560
|
-
this.tagStack = [this.root];
|
|
10561
|
-
this.lastNode = null;
|
|
10562
|
-
this.parser = null;
|
|
10563
|
-
}
|
|
10564
|
-
// Signals the handler that parsing is done
|
|
10565
|
-
onend() {
|
|
10566
|
-
if (this.done)
|
|
10567
|
-
return;
|
|
10568
|
-
this.done = true;
|
|
10569
|
-
this.parser = null;
|
|
10570
|
-
this.handleCallback(null);
|
|
10571
|
-
}
|
|
10572
|
-
onerror(error) {
|
|
10573
|
-
this.handleCallback(error);
|
|
10574
|
-
}
|
|
10575
|
-
onclosetag() {
|
|
10576
|
-
this.lastNode = null;
|
|
10577
|
-
const element = this.tagStack.pop();
|
|
10578
|
-
if (this.options.withEndIndices && this.parser) {
|
|
10579
|
-
element.endIndex = this.parser.endIndex;
|
|
10580
|
-
}
|
|
10581
|
-
if (this.elementCB)
|
|
10582
|
-
this.elementCB(element);
|
|
10583
|
-
}
|
|
10584
|
-
onopentag(name, attribs) {
|
|
10585
|
-
const type = this.options.xmlMode ? ElementType.Tag : void 0;
|
|
10586
|
-
const element = new Element(name, attribs, void 0, type);
|
|
10587
|
-
this.addNode(element);
|
|
10588
|
-
this.tagStack.push(element);
|
|
10589
|
-
}
|
|
10590
|
-
ontext(data) {
|
|
10591
|
-
const { lastNode } = this;
|
|
10592
|
-
if (lastNode && lastNode.type === ElementType.Text) {
|
|
10593
|
-
lastNode.data += data;
|
|
10594
|
-
if (this.options.withEndIndices && this.parser) {
|
|
10595
|
-
lastNode.endIndex = this.parser.endIndex;
|
|
10596
|
-
}
|
|
10597
|
-
} else {
|
|
10598
|
-
const node = new Text(data);
|
|
10599
|
-
this.addNode(node);
|
|
10600
|
-
this.lastNode = node;
|
|
10601
|
-
}
|
|
10602
|
-
}
|
|
10603
|
-
oncomment(data) {
|
|
10604
|
-
if (this.lastNode && this.lastNode.type === ElementType.Comment) {
|
|
10605
|
-
this.lastNode.data += data;
|
|
10606
|
-
return;
|
|
10607
|
-
}
|
|
10608
|
-
const node = new Comment(data);
|
|
10609
|
-
this.addNode(node);
|
|
10610
|
-
this.lastNode = node;
|
|
10611
|
-
}
|
|
10612
|
-
oncommentend() {
|
|
10613
|
-
this.lastNode = null;
|
|
10614
|
-
}
|
|
10615
|
-
oncdatastart() {
|
|
10616
|
-
const text2 = new Text("");
|
|
10617
|
-
const node = new CDATA([text2]);
|
|
10618
|
-
this.addNode(node);
|
|
10619
|
-
text2.parent = node;
|
|
10620
|
-
this.lastNode = text2;
|
|
10621
|
-
}
|
|
10622
|
-
oncdataend() {
|
|
10623
|
-
this.lastNode = null;
|
|
10624
|
-
}
|
|
10625
|
-
onprocessinginstruction(name, data) {
|
|
10626
|
-
const node = new ProcessingInstruction(name, data);
|
|
10627
|
-
this.addNode(node);
|
|
10628
|
-
}
|
|
10629
|
-
handleCallback(error) {
|
|
10630
|
-
if (typeof this.callback === "function") {
|
|
10631
|
-
this.callback(error, this.dom);
|
|
10632
|
-
} else if (error) {
|
|
10633
|
-
throw error;
|
|
10634
|
-
}
|
|
10635
|
-
}
|
|
10636
|
-
addNode(node) {
|
|
10637
|
-
const parent = this.tagStack[this.tagStack.length - 1];
|
|
10638
|
-
const previousSibling = parent.children[parent.children.length - 1];
|
|
10639
|
-
if (this.options.withStartIndices && this.parser) {
|
|
10640
|
-
node.startIndex = this.parser.startIndex;
|
|
10641
|
-
}
|
|
10642
|
-
if (this.options.withEndIndices && this.parser) {
|
|
10643
|
-
node.endIndex = this.parser.endIndex;
|
|
10644
|
-
}
|
|
10645
|
-
parent.children.push(node);
|
|
10646
|
-
if (previousSibling) {
|
|
10647
|
-
node.prev = previousSibling;
|
|
10648
|
-
previousSibling.next = node;
|
|
10649
|
-
}
|
|
10650
|
-
node.parent = parent;
|
|
10651
|
-
this.lastNode = null;
|
|
10652
|
-
}
|
|
10653
|
-
}
|
|
10654
|
-
const dist = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
10655
|
-
__proto__: null,
|
|
10656
|
-
CDATA,
|
|
10657
|
-
Comment,
|
|
10658
|
-
DataNode,
|
|
10659
|
-
Document,
|
|
10660
|
-
DomHandler,
|
|
10661
|
-
Element,
|
|
10662
|
-
Node,
|
|
10663
|
-
NodeWithChildren,
|
|
10664
|
-
ProcessingInstruction,
|
|
10665
|
-
Text,
|
|
10666
|
-
cloneNode,
|
|
10667
|
-
default: DomHandler,
|
|
10668
|
-
hasChildren,
|
|
10669
|
-
isCDATA,
|
|
10670
|
-
isComment,
|
|
10671
|
-
isDirective,
|
|
10672
|
-
isDocument,
|
|
10673
|
-
isTag,
|
|
10674
|
-
isText
|
|
10675
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
10676
|
-
const require$$3 = /* @__PURE__ */ getAugmentedNamespace(dist);
|
|
10677
|
-
var hasRequiredLib;
|
|
10678
|
-
function requireLib() {
|
|
10679
|
-
if (hasRequiredLib) return lib$1;
|
|
10680
|
-
hasRequiredLib = 1;
|
|
10681
|
-
(function(exports2) {
|
|
10682
|
-
var __importDefault = lib$1 && lib$1.__importDefault || function(mod) {
|
|
10683
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
10684
|
-
};
|
|
10685
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
10686
|
-
exports2.htmlToDOM = exports2.domToReact = exports2.attributesToProps = exports2.Text = exports2.ProcessingInstruction = exports2.Element = exports2.Comment = void 0;
|
|
10687
|
-
exports2.default = HTMLReactParser2;
|
|
10688
|
-
const html_dom_parser_1 = __importDefault(requireHtmlToDom());
|
|
10689
|
-
exports2.htmlToDOM = html_dom_parser_1.default;
|
|
10690
|
-
const attributes_to_props_1 = __importDefault(requireAttributesToProps());
|
|
10691
|
-
exports2.attributesToProps = attributes_to_props_1.default;
|
|
10692
|
-
const dom_to_react_1 = __importDefault(requireDomToReact());
|
|
10693
|
-
exports2.domToReact = dom_to_react_1.default;
|
|
10694
|
-
var domhandler_1 = require$$3;
|
|
10695
|
-
Object.defineProperty(exports2, "Comment", { enumerable: true, get: function() {
|
|
10696
|
-
return domhandler_1.Comment;
|
|
10697
|
-
} });
|
|
10698
|
-
Object.defineProperty(exports2, "Element", { enumerable: true, get: function() {
|
|
10699
|
-
return domhandler_1.Element;
|
|
10700
|
-
} });
|
|
10701
|
-
Object.defineProperty(exports2, "ProcessingInstruction", { enumerable: true, get: function() {
|
|
10702
|
-
return domhandler_1.ProcessingInstruction;
|
|
10703
|
-
} });
|
|
10704
|
-
Object.defineProperty(exports2, "Text", { enumerable: true, get: function() {
|
|
10705
|
-
return domhandler_1.Text;
|
|
10706
|
-
} });
|
|
10707
|
-
const domParserOptions = { lowerCaseAttributeNames: false };
|
|
10708
|
-
function HTMLReactParser2(html2, options) {
|
|
10709
|
-
var _a;
|
|
10710
|
-
if (typeof html2 !== "string") {
|
|
10711
|
-
throw new TypeError("First argument must be a string");
|
|
10712
|
-
}
|
|
10713
|
-
if (!html2) {
|
|
10714
|
-
return [];
|
|
10715
|
-
}
|
|
10716
|
-
const htmlToDOMOptions = Object.assign(Object.assign({}, (_a = options === null || options === void 0 ? void 0 : options.htmlparser2) !== null && _a !== void 0 ? _a : domParserOptions), { trustedTypePolicy: options === null || options === void 0 ? void 0 : options.trustedTypePolicy });
|
|
10717
|
-
return (0, dom_to_react_1.default)((0, html_dom_parser_1.default)(html2, htmlToDOMOptions), options);
|
|
10718
|
-
}
|
|
10719
|
-
})(lib$1);
|
|
10720
|
-
return lib$1;
|
|
10721
|
-
}
|
|
10722
|
-
var libExports = requireLib();
|
|
10723
|
-
const HTMLReactParser = /* @__PURE__ */ getDefaultExportFromCjs(libExports);
|
|
10724
|
-
const parse = HTMLReactParser.default || HTMLReactParser;
|
|
10725
|
-
const HtmlContent = ({ html: html2, className }) => {
|
|
10726
|
-
const cleanHTML = browser_default.sanitize(html2);
|
|
10727
|
-
const parsedHTML = parse(cleanHTML);
|
|
10728
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("[&>p]:min-h-5", className), children: parsedHTML });
|
|
10729
|
-
};
|
|
10730
7106
|
const Container = ({
|
|
10731
7107
|
children,
|
|
10732
7108
|
className,
|
|
@@ -10746,7 +7122,6 @@ const Container = ({
|
|
|
10746
7122
|
exports.BasePicture = BasePicture;
|
|
10747
7123
|
exports.CITY_MASK = CITY_MASK;
|
|
10748
7124
|
exports.Container = Container;
|
|
10749
|
-
exports.HtmlContent = HtmlContent;
|
|
10750
7125
|
exports.THEME = THEME;
|
|
10751
7126
|
exports.TIME = TIME;
|
|
10752
7127
|
exports.Video = Video;
|