@pie-element/venn-classification 0.1.2 → 0.1.3-next.20261007021359
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/author/index.js +3003 -343
- package/dist/author/index.js.map +1 -1
- package/dist/browser/VennClassification-CabX77pV.js +5298 -0
- package/dist/browser/VennClassification-CabX77pV.js.map +1 -0
- package/dist/browser/author/index.js +503 -503
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/delivery/index.js +1 -1
- package/dist/browser/editor-runtime/VennClassification-CabX77pV.js +5298 -0
- package/dist/browser/editor-runtime/VennClassification-CabX77pV.js.map +1 -0
- package/dist/browser/editor-runtime/author/index.js +515 -515
- package/dist/browser/editor-runtime/author/index.js.map +1 -1
- package/dist/browser/editor-runtime/delivery/index.js +1 -1
- package/dist/browser/editor-runtime/{mathjax-D2JHb_R_-CnSar24F.js → mathjax-BKrHE4xs-DKFuLcoG.js} +3901 -3864
- package/dist/browser/editor-runtime/mathjax-BKrHE4xs-DKFuLcoG.js.map +1 -0
- package/dist/browser/{mathjax-D2JHb_R_-CnSar24F.js → mathjax-BKrHE4xs-DKFuLcoG.js} +3901 -3864
- package/dist/browser/mathjax-BKrHE4xs-DKFuLcoG.js.map +1 -0
- package/dist/delivery/index.js +2945 -285
- package/dist/delivery/index.js.map +1 -1
- package/dist/index.iife.js +23 -21
- package/package.json +4 -3
- package/dist/browser/VennClassification-DklXKmLP.js +0 -4241
- package/dist/browser/VennClassification-DklXKmLP.js.map +0 -1
- package/dist/browser/editor-runtime/VennClassification-DklXKmLP.js +0 -4241
- package/dist/browser/editor-runtime/VennClassification-DklXKmLP.js.map +0 -1
- package/dist/browser/editor-runtime/mathjax-D2JHb_R_-CnSar24F.js.map +0 -1
- package/dist/browser/mathjax-D2JHb_R_-CnSar24F.js.map +0 -1
package/dist/delivery/index.js
CHANGED
|
@@ -4485,7 +4485,7 @@ function link(state, prev, next) {
|
|
|
4485
4485
|
* @param {boolean} [skip_warning]
|
|
4486
4486
|
* @returns {void}
|
|
4487
4487
|
*/
|
|
4488
|
-
function html(node, get_value, is_controlled = false, svg = false, mathml = false, skip_warning = false) {
|
|
4488
|
+
function html$2(node, get_value, is_controlled = false, svg = false, mathml = false, skip_warning = false) {
|
|
4489
4489
|
var anchor = node;
|
|
4490
4490
|
/** @type {string | TrustedHTML} */
|
|
4491
4491
|
var value = "";
|
|
@@ -5416,121 +5416,2754 @@ function create_custom_element(Component, props_definition, slots, exports, shad
|
|
|
5416
5416
|
return Class;
|
|
5417
5417
|
}
|
|
5418
5418
|
//#endregion
|
|
5419
|
+
//#region ../../../node_modules/.bun/dompurify@3.4.16/node_modules/dompurify/dist/purify.es.mjs
|
|
5420
|
+
/*! @license DOMPurify 3.4.16 | (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.16/LICENSE */
|
|
5421
|
+
function _OverloadYield(e, d) {
|
|
5422
|
+
this.v = e, this.k = d;
|
|
5423
|
+
}
|
|
5424
|
+
function _arrayLikeToArray(r, a) {
|
|
5425
|
+
(null == a || a > r.length) && (a = r.length);
|
|
5426
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
5427
|
+
return n;
|
|
5428
|
+
}
|
|
5429
|
+
function _arrayWithHoles(r) {
|
|
5430
|
+
if (Array.isArray(r)) return r;
|
|
5431
|
+
}
|
|
5432
|
+
function _iterableToArrayLimit(r, l) {
|
|
5433
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
5434
|
+
if (null != t) {
|
|
5435
|
+
var e, n, i, u, a = [], f = !0, o = !1;
|
|
5436
|
+
try {
|
|
5437
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
5438
|
+
if (Object(t) !== t) return;
|
|
5439
|
+
f = !1;
|
|
5440
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
5441
|
+
} catch (r) {
|
|
5442
|
+
o = !0, n = r;
|
|
5443
|
+
} finally {
|
|
5444
|
+
try {
|
|
5445
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
5446
|
+
} finally {
|
|
5447
|
+
if (o) throw n;
|
|
5448
|
+
}
|
|
5449
|
+
}
|
|
5450
|
+
return a;
|
|
5451
|
+
}
|
|
5452
|
+
}
|
|
5453
|
+
function _nonIterableRest() {
|
|
5454
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
5455
|
+
}
|
|
5456
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
5457
|
+
function _slicedToArray(r, e) {
|
|
5458
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
5459
|
+
}
|
|
5460
|
+
function _unsupportedIterableToArray(r, a) {
|
|
5461
|
+
if (r) {
|
|
5462
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
5463
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
5464
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
5465
|
+
}
|
|
5466
|
+
}
|
|
5467
|
+
function AsyncGenerator(e) {
|
|
5468
|
+
var t, n;
|
|
5469
|
+
function resume(t, n) {
|
|
5470
|
+
try {
|
|
5471
|
+
var r = e[t](n), o = r.value, u = o instanceof _OverloadYield;
|
|
5472
|
+
Promise.resolve(u ? o.v : o).then(function(n) {
|
|
5473
|
+
if (u) {
|
|
5474
|
+
var i = "return" === t && o.k ? t : "next";
|
|
5475
|
+
if (!o.k || n.done) return resume(i, n);
|
|
5476
|
+
n = e[i](n).value;
|
|
5477
|
+
}
|
|
5478
|
+
settle(!!r.done, n);
|
|
5479
|
+
}, function(e) {
|
|
5480
|
+
resume("throw", e);
|
|
5481
|
+
});
|
|
5482
|
+
} catch (e) {
|
|
5483
|
+
settle(2, e);
|
|
5484
|
+
}
|
|
5485
|
+
}
|
|
5486
|
+
function settle(e, r) {
|
|
5487
|
+
2 === e ? t.reject(r) : t.resolve({
|
|
5488
|
+
value: r,
|
|
5489
|
+
done: e
|
|
5490
|
+
}), (t = t.next) ? resume(t.key, t.arg) : n = null;
|
|
5491
|
+
}
|
|
5492
|
+
this._invoke = function(e, r) {
|
|
5493
|
+
return new Promise(function(o, u) {
|
|
5494
|
+
var i = {
|
|
5495
|
+
key: e,
|
|
5496
|
+
arg: r,
|
|
5497
|
+
resolve: o,
|
|
5498
|
+
reject: u,
|
|
5499
|
+
next: null
|
|
5500
|
+
};
|
|
5501
|
+
n ? n = n.next = i : (t = n = i, resume(e, r));
|
|
5502
|
+
});
|
|
5503
|
+
}, "function" != typeof e.return && (this.return = void 0);
|
|
5504
|
+
}
|
|
5505
|
+
AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function() {
|
|
5506
|
+
return this;
|
|
5507
|
+
}, AsyncGenerator.prototype.next = function(e) {
|
|
5508
|
+
return this._invoke("next", e);
|
|
5509
|
+
}, AsyncGenerator.prototype.throw = function(e) {
|
|
5510
|
+
return this._invoke("throw", e);
|
|
5511
|
+
}, AsyncGenerator.prototype.return = function(e) {
|
|
5512
|
+
return this._invoke("return", e);
|
|
5513
|
+
};
|
|
5514
|
+
var entries = Object.entries;
|
|
5515
|
+
var setPrototypeOf = Object.setPrototypeOf;
|
|
5516
|
+
var isFrozen = Object.isFrozen;
|
|
5517
|
+
var getPrototypeOf = Object.getPrototypeOf;
|
|
5518
|
+
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
5519
|
+
var freeze = Object.freeze;
|
|
5520
|
+
var seal = Object.seal;
|
|
5521
|
+
var create = Object.create;
|
|
5522
|
+
var _ref = typeof Reflect !== "undefined" && Reflect;
|
|
5523
|
+
var apply = _ref.apply;
|
|
5524
|
+
var construct = _ref.construct;
|
|
5525
|
+
if (!freeze) freeze = function freeze(x) {
|
|
5526
|
+
return x;
|
|
5527
|
+
};
|
|
5528
|
+
if (!seal) seal = function seal(x) {
|
|
5529
|
+
return x;
|
|
5530
|
+
};
|
|
5531
|
+
if (!apply) apply = function apply(func, thisArg) {
|
|
5532
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) args[_key - 2] = arguments[_key];
|
|
5533
|
+
return func.apply(thisArg, args);
|
|
5534
|
+
};
|
|
5535
|
+
if (!construct) construct = function construct(Func) {
|
|
5536
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) args[_key2 - 1] = arguments[_key2];
|
|
5537
|
+
return new Func(...args);
|
|
5538
|
+
};
|
|
5539
|
+
var arrayForEach = unapply(Array.prototype.forEach);
|
|
5540
|
+
Array.prototype.indexOf;
|
|
5541
|
+
var arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
|
|
5542
|
+
var arrayPop = unapply(Array.prototype.pop);
|
|
5543
|
+
var arrayPush = unapply(Array.prototype.push);
|
|
5544
|
+
Array.prototype.slice;
|
|
5545
|
+
var arraySplice = unapply(Array.prototype.splice);
|
|
5546
|
+
var arrayIsArray = Array.isArray;
|
|
5547
|
+
var stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
5548
|
+
var stringToString = unapply(String.prototype.toString);
|
|
5549
|
+
var stringMatch = unapply(String.prototype.match);
|
|
5550
|
+
var stringReplace = unapply(String.prototype.replace);
|
|
5551
|
+
var stringIndexOf = unapply(String.prototype.indexOf);
|
|
5552
|
+
var stringTrim = unapply(String.prototype.trim);
|
|
5553
|
+
var numberToString = unapply(Number.prototype.toString);
|
|
5554
|
+
var booleanToString = unapply(Boolean.prototype.toString);
|
|
5555
|
+
var bigintToString = typeof BigInt === "undefined" ? null : unapply(BigInt.prototype.toString);
|
|
5556
|
+
var symbolToString = typeof Symbol === "undefined" ? null : unapply(Symbol.prototype.toString);
|
|
5557
|
+
var objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
|
|
5558
|
+
var objectToString = unapply(Object.prototype.toString);
|
|
5559
|
+
var regExpTest = unapply(RegExp.prototype.test);
|
|
5560
|
+
var typeErrorCreate = unconstruct(TypeError);
|
|
5561
|
+
/**
|
|
5562
|
+
* Creates a new function that calls the given function with a specified thisArg and arguments.
|
|
5563
|
+
*
|
|
5564
|
+
* @param func - The function to be wrapped and called.
|
|
5565
|
+
* @returns A new function that calls the given function with a specified thisArg and arguments.
|
|
5566
|
+
*/
|
|
5567
|
+
function unapply(func) {
|
|
5568
|
+
return function(thisArg) {
|
|
5569
|
+
if (thisArg instanceof RegExp) thisArg.lastIndex = 0;
|
|
5570
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) args[_key3 - 1] = arguments[_key3];
|
|
5571
|
+
return apply(func, thisArg, args);
|
|
5572
|
+
};
|
|
5573
|
+
}
|
|
5574
|
+
/**
|
|
5575
|
+
* Creates a new function that constructs an instance of the given constructor function with the provided arguments.
|
|
5576
|
+
*
|
|
5577
|
+
* @param func - The constructor function to be wrapped and called.
|
|
5578
|
+
* @returns A new function that constructs an instance of the given constructor function with the provided arguments.
|
|
5579
|
+
*/
|
|
5580
|
+
function unconstruct(Func) {
|
|
5581
|
+
return function() {
|
|
5582
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) args[_key4] = arguments[_key4];
|
|
5583
|
+
return construct(Func, args);
|
|
5584
|
+
};
|
|
5585
|
+
}
|
|
5586
|
+
/**
|
|
5587
|
+
* Add properties to a lookup table
|
|
5588
|
+
*
|
|
5589
|
+
* @param set - The set to which elements will be added.
|
|
5590
|
+
* @param array - The array containing elements to be added to the set.
|
|
5591
|
+
* @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.
|
|
5592
|
+
* @returns The modified set with added elements.
|
|
5593
|
+
*/
|
|
5594
|
+
function addToSet(set, array) {
|
|
5595
|
+
let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
|
|
5596
|
+
if (setPrototypeOf) setPrototypeOf(set, null);
|
|
5597
|
+
if (!arrayIsArray(array)) return set;
|
|
5598
|
+
let l = array.length;
|
|
5599
|
+
while (l--) {
|
|
5600
|
+
let element = array[l];
|
|
5601
|
+
if (typeof element === "string") {
|
|
5602
|
+
const lcElement = transformCaseFunc(element);
|
|
5603
|
+
if (lcElement !== element) {
|
|
5604
|
+
if (!isFrozen(array)) array[l] = lcElement;
|
|
5605
|
+
element = lcElement;
|
|
5606
|
+
}
|
|
5607
|
+
}
|
|
5608
|
+
set[element] = true;
|
|
5609
|
+
}
|
|
5610
|
+
return set;
|
|
5611
|
+
}
|
|
5612
|
+
/**
|
|
5613
|
+
* Clean up an array to harden against CSPP
|
|
5614
|
+
*
|
|
5615
|
+
* @param array - The array to be cleaned.
|
|
5616
|
+
* @returns The cleaned version of the array
|
|
5617
|
+
*/
|
|
5618
|
+
function cleanArray(array) {
|
|
5619
|
+
for (let index = 0; index < array.length; index++) if (!objectHasOwnProperty(array, index)) array[index] = null;
|
|
5620
|
+
return array;
|
|
5621
|
+
}
|
|
5622
|
+
/**
|
|
5623
|
+
* Shallow clone an object
|
|
5624
|
+
*
|
|
5625
|
+
* @param object - The object to be cloned.
|
|
5626
|
+
* @returns A new object that copies the original.
|
|
5627
|
+
*/
|
|
5628
|
+
function clone(object) {
|
|
5629
|
+
const newObject = create(null);
|
|
5630
|
+
for (const _ref2 of entries(object)) {
|
|
5631
|
+
var _ref3 = _slicedToArray(_ref2, 2);
|
|
5632
|
+
const property = _ref3[0];
|
|
5633
|
+
const value = _ref3[1];
|
|
5634
|
+
if (objectHasOwnProperty(object, property)) if (arrayIsArray(value)) newObject[property] = cleanArray(value);
|
|
5635
|
+
else if (value && typeof value === "object" && value.constructor === Object) newObject[property] = clone(value);
|
|
5636
|
+
else newObject[property] = value;
|
|
5637
|
+
}
|
|
5638
|
+
return newObject;
|
|
5639
|
+
}
|
|
5640
|
+
/**
|
|
5641
|
+
* Convert non-node values into strings without depending on direct property access.
|
|
5642
|
+
*
|
|
5643
|
+
* @param value - The value to stringify.
|
|
5644
|
+
* @returns A string representation of the provided value.
|
|
5645
|
+
*/
|
|
5646
|
+
function stringifyValue(value) {
|
|
5647
|
+
switch (typeof value) {
|
|
5648
|
+
case "string": return value;
|
|
5649
|
+
case "number": return numberToString(value);
|
|
5650
|
+
case "boolean": return booleanToString(value);
|
|
5651
|
+
case "bigint": return bigintToString ? bigintToString(value) : "0";
|
|
5652
|
+
case "symbol": return symbolToString ? symbolToString(value) : "Symbol()";
|
|
5653
|
+
case "undefined": return objectToString(value);
|
|
5654
|
+
case "function":
|
|
5655
|
+
case "object": {
|
|
5656
|
+
if (value === null) return objectToString(value);
|
|
5657
|
+
const valueAsRecord = value;
|
|
5658
|
+
const valueToString = lookupGetter(valueAsRecord, "toString");
|
|
5659
|
+
if (typeof valueToString === "function") {
|
|
5660
|
+
const stringified = valueToString(valueAsRecord);
|
|
5661
|
+
return typeof stringified === "string" ? stringified : objectToString(stringified);
|
|
5662
|
+
}
|
|
5663
|
+
return objectToString(value);
|
|
5664
|
+
}
|
|
5665
|
+
default: return objectToString(value);
|
|
5666
|
+
}
|
|
5667
|
+
}
|
|
5668
|
+
/**
|
|
5669
|
+
* This method automatically checks if the prop is function or getter and behaves accordingly.
|
|
5670
|
+
*
|
|
5671
|
+
* @param object - The object to look up the getter function in its prototype chain.
|
|
5672
|
+
* @param prop - The property name for which to find the getter function.
|
|
5673
|
+
* @returns The getter function found in the prototype chain or a fallback function.
|
|
5674
|
+
*/
|
|
5675
|
+
function lookupGetter(object, prop) {
|
|
5676
|
+
while (object !== null) {
|
|
5677
|
+
const desc = getOwnPropertyDescriptor(object, prop);
|
|
5678
|
+
if (desc) {
|
|
5679
|
+
if (desc.get) return unapply(desc.get);
|
|
5680
|
+
if (typeof desc.value === "function") return unapply(desc.value);
|
|
5681
|
+
}
|
|
5682
|
+
object = getPrototypeOf(object);
|
|
5683
|
+
}
|
|
5684
|
+
function fallbackValue() {
|
|
5685
|
+
return null;
|
|
5686
|
+
}
|
|
5687
|
+
return fallbackValue;
|
|
5688
|
+
}
|
|
5689
|
+
function isRegex(value) {
|
|
5690
|
+
try {
|
|
5691
|
+
regExpTest(value, "");
|
|
5692
|
+
return true;
|
|
5693
|
+
} catch (_unused) {
|
|
5694
|
+
return false;
|
|
5695
|
+
}
|
|
5696
|
+
}
|
|
5697
|
+
var html$1 = freeze([
|
|
5698
|
+
"a",
|
|
5699
|
+
"abbr",
|
|
5700
|
+
"acronym",
|
|
5701
|
+
"address",
|
|
5702
|
+
"area",
|
|
5703
|
+
"article",
|
|
5704
|
+
"aside",
|
|
5705
|
+
"audio",
|
|
5706
|
+
"b",
|
|
5707
|
+
"bdi",
|
|
5708
|
+
"bdo",
|
|
5709
|
+
"big",
|
|
5710
|
+
"blink",
|
|
5711
|
+
"blockquote",
|
|
5712
|
+
"body",
|
|
5713
|
+
"br",
|
|
5714
|
+
"button",
|
|
5715
|
+
"canvas",
|
|
5716
|
+
"caption",
|
|
5717
|
+
"center",
|
|
5718
|
+
"cite",
|
|
5719
|
+
"code",
|
|
5720
|
+
"col",
|
|
5721
|
+
"colgroup",
|
|
5722
|
+
"content",
|
|
5723
|
+
"data",
|
|
5724
|
+
"datalist",
|
|
5725
|
+
"dd",
|
|
5726
|
+
"decorator",
|
|
5727
|
+
"del",
|
|
5728
|
+
"details",
|
|
5729
|
+
"dfn",
|
|
5730
|
+
"dialog",
|
|
5731
|
+
"dir",
|
|
5732
|
+
"div",
|
|
5733
|
+
"dl",
|
|
5734
|
+
"dt",
|
|
5735
|
+
"element",
|
|
5736
|
+
"em",
|
|
5737
|
+
"fieldset",
|
|
5738
|
+
"figcaption",
|
|
5739
|
+
"figure",
|
|
5740
|
+
"font",
|
|
5741
|
+
"footer",
|
|
5742
|
+
"form",
|
|
5743
|
+
"h1",
|
|
5744
|
+
"h2",
|
|
5745
|
+
"h3",
|
|
5746
|
+
"h4",
|
|
5747
|
+
"h5",
|
|
5748
|
+
"h6",
|
|
5749
|
+
"head",
|
|
5750
|
+
"header",
|
|
5751
|
+
"hgroup",
|
|
5752
|
+
"hr",
|
|
5753
|
+
"html",
|
|
5754
|
+
"i",
|
|
5755
|
+
"img",
|
|
5756
|
+
"input",
|
|
5757
|
+
"ins",
|
|
5758
|
+
"kbd",
|
|
5759
|
+
"label",
|
|
5760
|
+
"legend",
|
|
5761
|
+
"li",
|
|
5762
|
+
"main",
|
|
5763
|
+
"map",
|
|
5764
|
+
"mark",
|
|
5765
|
+
"marquee",
|
|
5766
|
+
"menu",
|
|
5767
|
+
"menuitem",
|
|
5768
|
+
"meter",
|
|
5769
|
+
"nav",
|
|
5770
|
+
"nobr",
|
|
5771
|
+
"ol",
|
|
5772
|
+
"optgroup",
|
|
5773
|
+
"option",
|
|
5774
|
+
"output",
|
|
5775
|
+
"p",
|
|
5776
|
+
"picture",
|
|
5777
|
+
"pre",
|
|
5778
|
+
"progress",
|
|
5779
|
+
"q",
|
|
5780
|
+
"rp",
|
|
5781
|
+
"rt",
|
|
5782
|
+
"ruby",
|
|
5783
|
+
"s",
|
|
5784
|
+
"samp",
|
|
5785
|
+
"search",
|
|
5786
|
+
"section",
|
|
5787
|
+
"select",
|
|
5788
|
+
"shadow",
|
|
5789
|
+
"slot",
|
|
5790
|
+
"small",
|
|
5791
|
+
"source",
|
|
5792
|
+
"spacer",
|
|
5793
|
+
"span",
|
|
5794
|
+
"strike",
|
|
5795
|
+
"strong",
|
|
5796
|
+
"style",
|
|
5797
|
+
"sub",
|
|
5798
|
+
"summary",
|
|
5799
|
+
"sup",
|
|
5800
|
+
"table",
|
|
5801
|
+
"tbody",
|
|
5802
|
+
"td",
|
|
5803
|
+
"template",
|
|
5804
|
+
"textarea",
|
|
5805
|
+
"tfoot",
|
|
5806
|
+
"th",
|
|
5807
|
+
"thead",
|
|
5808
|
+
"time",
|
|
5809
|
+
"tr",
|
|
5810
|
+
"track",
|
|
5811
|
+
"tt",
|
|
5812
|
+
"u",
|
|
5813
|
+
"ul",
|
|
5814
|
+
"var",
|
|
5815
|
+
"video",
|
|
5816
|
+
"wbr"
|
|
5817
|
+
]);
|
|
5818
|
+
var svg$1 = freeze([
|
|
5819
|
+
"svg",
|
|
5820
|
+
"a",
|
|
5821
|
+
"altglyph",
|
|
5822
|
+
"altglyphdef",
|
|
5823
|
+
"altglyphitem",
|
|
5824
|
+
"animatecolor",
|
|
5825
|
+
"animatemotion",
|
|
5826
|
+
"animatetransform",
|
|
5827
|
+
"circle",
|
|
5828
|
+
"clippath",
|
|
5829
|
+
"defs",
|
|
5830
|
+
"desc",
|
|
5831
|
+
"ellipse",
|
|
5832
|
+
"enterkeyhint",
|
|
5833
|
+
"exportparts",
|
|
5834
|
+
"filter",
|
|
5835
|
+
"font",
|
|
5836
|
+
"g",
|
|
5837
|
+
"glyph",
|
|
5838
|
+
"glyphref",
|
|
5839
|
+
"hkern",
|
|
5840
|
+
"image",
|
|
5841
|
+
"inputmode",
|
|
5842
|
+
"line",
|
|
5843
|
+
"lineargradient",
|
|
5844
|
+
"marker",
|
|
5845
|
+
"mask",
|
|
5846
|
+
"metadata",
|
|
5847
|
+
"mpath",
|
|
5848
|
+
"part",
|
|
5849
|
+
"path",
|
|
5850
|
+
"pattern",
|
|
5851
|
+
"polygon",
|
|
5852
|
+
"polyline",
|
|
5853
|
+
"radialgradient",
|
|
5854
|
+
"rect",
|
|
5855
|
+
"stop",
|
|
5856
|
+
"style",
|
|
5857
|
+
"switch",
|
|
5858
|
+
"symbol",
|
|
5859
|
+
"text",
|
|
5860
|
+
"textpath",
|
|
5861
|
+
"title",
|
|
5862
|
+
"tref",
|
|
5863
|
+
"tspan",
|
|
5864
|
+
"view",
|
|
5865
|
+
"vkern"
|
|
5866
|
+
]);
|
|
5867
|
+
var svgFilters = freeze([
|
|
5868
|
+
"feBlend",
|
|
5869
|
+
"feColorMatrix",
|
|
5870
|
+
"feComponentTransfer",
|
|
5871
|
+
"feComposite",
|
|
5872
|
+
"feConvolveMatrix",
|
|
5873
|
+
"feDiffuseLighting",
|
|
5874
|
+
"feDisplacementMap",
|
|
5875
|
+
"feDistantLight",
|
|
5876
|
+
"feDropShadow",
|
|
5877
|
+
"feFlood",
|
|
5878
|
+
"feFuncA",
|
|
5879
|
+
"feFuncB",
|
|
5880
|
+
"feFuncG",
|
|
5881
|
+
"feFuncR",
|
|
5882
|
+
"feGaussianBlur",
|
|
5883
|
+
"feImage",
|
|
5884
|
+
"feMerge",
|
|
5885
|
+
"feMergeNode",
|
|
5886
|
+
"feMorphology",
|
|
5887
|
+
"feOffset",
|
|
5888
|
+
"fePointLight",
|
|
5889
|
+
"feSpecularLighting",
|
|
5890
|
+
"feSpotLight",
|
|
5891
|
+
"feTile",
|
|
5892
|
+
"feTurbulence"
|
|
5893
|
+
]);
|
|
5894
|
+
var svgDisallowed = freeze([
|
|
5895
|
+
"animate",
|
|
5896
|
+
"color-profile",
|
|
5897
|
+
"cursor",
|
|
5898
|
+
"discard",
|
|
5899
|
+
"font-face",
|
|
5900
|
+
"font-face-format",
|
|
5901
|
+
"font-face-name",
|
|
5902
|
+
"font-face-src",
|
|
5903
|
+
"font-face-uri",
|
|
5904
|
+
"foreignobject",
|
|
5905
|
+
"hatch",
|
|
5906
|
+
"hatchpath",
|
|
5907
|
+
"mesh",
|
|
5908
|
+
"meshgradient",
|
|
5909
|
+
"meshpatch",
|
|
5910
|
+
"meshrow",
|
|
5911
|
+
"missing-glyph",
|
|
5912
|
+
"script",
|
|
5913
|
+
"set",
|
|
5914
|
+
"solidcolor",
|
|
5915
|
+
"unknown",
|
|
5916
|
+
"use"
|
|
5917
|
+
]);
|
|
5918
|
+
var mathMl$1 = freeze([
|
|
5919
|
+
"math",
|
|
5920
|
+
"menclose",
|
|
5921
|
+
"merror",
|
|
5922
|
+
"mfenced",
|
|
5923
|
+
"mfrac",
|
|
5924
|
+
"mglyph",
|
|
5925
|
+
"mi",
|
|
5926
|
+
"mlabeledtr",
|
|
5927
|
+
"mmultiscripts",
|
|
5928
|
+
"mn",
|
|
5929
|
+
"mo",
|
|
5930
|
+
"mover",
|
|
5931
|
+
"mpadded",
|
|
5932
|
+
"mphantom",
|
|
5933
|
+
"mroot",
|
|
5934
|
+
"mrow",
|
|
5935
|
+
"ms",
|
|
5936
|
+
"mspace",
|
|
5937
|
+
"msqrt",
|
|
5938
|
+
"mstyle",
|
|
5939
|
+
"msub",
|
|
5940
|
+
"msup",
|
|
5941
|
+
"msubsup",
|
|
5942
|
+
"mtable",
|
|
5943
|
+
"mtd",
|
|
5944
|
+
"mtext",
|
|
5945
|
+
"mtr",
|
|
5946
|
+
"munder",
|
|
5947
|
+
"munderover",
|
|
5948
|
+
"mprescripts"
|
|
5949
|
+
]);
|
|
5950
|
+
var mathMlDisallowed = freeze([
|
|
5951
|
+
"maction",
|
|
5952
|
+
"maligngroup",
|
|
5953
|
+
"malignmark",
|
|
5954
|
+
"mlongdiv",
|
|
5955
|
+
"mscarries",
|
|
5956
|
+
"mscarry",
|
|
5957
|
+
"msgroup",
|
|
5958
|
+
"mstack",
|
|
5959
|
+
"msline",
|
|
5960
|
+
"msrow",
|
|
5961
|
+
"semantics",
|
|
5962
|
+
"annotation",
|
|
5963
|
+
"annotation-xml",
|
|
5964
|
+
"mprescripts",
|
|
5965
|
+
"none"
|
|
5966
|
+
]);
|
|
5967
|
+
var text = freeze(["#text"]);
|
|
5968
|
+
var html = freeze([
|
|
5969
|
+
"accept",
|
|
5970
|
+
"action",
|
|
5971
|
+
"align",
|
|
5972
|
+
"alt",
|
|
5973
|
+
"autocapitalize",
|
|
5974
|
+
"autocomplete",
|
|
5975
|
+
"autopictureinpicture",
|
|
5976
|
+
"autoplay",
|
|
5977
|
+
"background",
|
|
5978
|
+
"bgcolor",
|
|
5979
|
+
"border",
|
|
5980
|
+
"capture",
|
|
5981
|
+
"cellpadding",
|
|
5982
|
+
"cellspacing",
|
|
5983
|
+
"checked",
|
|
5984
|
+
"cite",
|
|
5985
|
+
"class",
|
|
5986
|
+
"clear",
|
|
5987
|
+
"color",
|
|
5988
|
+
"cols",
|
|
5989
|
+
"colspan",
|
|
5990
|
+
"command",
|
|
5991
|
+
"commandfor",
|
|
5992
|
+
"controls",
|
|
5993
|
+
"controlslist",
|
|
5994
|
+
"coords",
|
|
5995
|
+
"crossorigin",
|
|
5996
|
+
"datetime",
|
|
5997
|
+
"decoding",
|
|
5998
|
+
"default",
|
|
5999
|
+
"dir",
|
|
6000
|
+
"disabled",
|
|
6001
|
+
"disablepictureinpicture",
|
|
6002
|
+
"disableremoteplayback",
|
|
6003
|
+
"download",
|
|
6004
|
+
"draggable",
|
|
6005
|
+
"enctype",
|
|
6006
|
+
"enterkeyhint",
|
|
6007
|
+
"exportparts",
|
|
6008
|
+
"face",
|
|
6009
|
+
"for",
|
|
6010
|
+
"headers",
|
|
6011
|
+
"height",
|
|
6012
|
+
"hidden",
|
|
6013
|
+
"high",
|
|
6014
|
+
"href",
|
|
6015
|
+
"hreflang",
|
|
6016
|
+
"id",
|
|
6017
|
+
"inert",
|
|
6018
|
+
"inputmode",
|
|
6019
|
+
"integrity",
|
|
6020
|
+
"ismap",
|
|
6021
|
+
"kind",
|
|
6022
|
+
"label",
|
|
6023
|
+
"lang",
|
|
6024
|
+
"list",
|
|
6025
|
+
"loading",
|
|
6026
|
+
"loop",
|
|
6027
|
+
"low",
|
|
6028
|
+
"max",
|
|
6029
|
+
"maxlength",
|
|
6030
|
+
"media",
|
|
6031
|
+
"method",
|
|
6032
|
+
"min",
|
|
6033
|
+
"minlength",
|
|
6034
|
+
"multiple",
|
|
6035
|
+
"muted",
|
|
6036
|
+
"name",
|
|
6037
|
+
"nonce",
|
|
6038
|
+
"noshade",
|
|
6039
|
+
"novalidate",
|
|
6040
|
+
"nowrap",
|
|
6041
|
+
"open",
|
|
6042
|
+
"optimum",
|
|
6043
|
+
"part",
|
|
6044
|
+
"pattern",
|
|
6045
|
+
"placeholder",
|
|
6046
|
+
"playsinline",
|
|
6047
|
+
"popover",
|
|
6048
|
+
"popovertarget",
|
|
6049
|
+
"popovertargetaction",
|
|
6050
|
+
"poster",
|
|
6051
|
+
"preload",
|
|
6052
|
+
"pubdate",
|
|
6053
|
+
"radiogroup",
|
|
6054
|
+
"readonly",
|
|
6055
|
+
"rel",
|
|
6056
|
+
"required",
|
|
6057
|
+
"rev",
|
|
6058
|
+
"reversed",
|
|
6059
|
+
"role",
|
|
6060
|
+
"rows",
|
|
6061
|
+
"rowspan",
|
|
6062
|
+
"spellcheck",
|
|
6063
|
+
"scope",
|
|
6064
|
+
"selected",
|
|
6065
|
+
"shape",
|
|
6066
|
+
"size",
|
|
6067
|
+
"sizes",
|
|
6068
|
+
"slot",
|
|
6069
|
+
"span",
|
|
6070
|
+
"srclang",
|
|
6071
|
+
"start",
|
|
6072
|
+
"src",
|
|
6073
|
+
"srcset",
|
|
6074
|
+
"step",
|
|
6075
|
+
"style",
|
|
6076
|
+
"summary",
|
|
6077
|
+
"tabindex",
|
|
6078
|
+
"title",
|
|
6079
|
+
"translate",
|
|
6080
|
+
"type",
|
|
6081
|
+
"usemap",
|
|
6082
|
+
"valign",
|
|
6083
|
+
"value",
|
|
6084
|
+
"width",
|
|
6085
|
+
"wrap",
|
|
6086
|
+
"xmlns"
|
|
6087
|
+
]);
|
|
6088
|
+
var svg = freeze([
|
|
6089
|
+
"accent-height",
|
|
6090
|
+
"accumulate",
|
|
6091
|
+
"additive",
|
|
6092
|
+
"alignment-baseline",
|
|
6093
|
+
"amplitude",
|
|
6094
|
+
"ascent",
|
|
6095
|
+
"attributename",
|
|
6096
|
+
"attributetype",
|
|
6097
|
+
"azimuth",
|
|
6098
|
+
"basefrequency",
|
|
6099
|
+
"baseline-shift",
|
|
6100
|
+
"begin",
|
|
6101
|
+
"bias",
|
|
6102
|
+
"by",
|
|
6103
|
+
"class",
|
|
6104
|
+
"clip",
|
|
6105
|
+
"clippathunits",
|
|
6106
|
+
"clip-path",
|
|
6107
|
+
"clip-rule",
|
|
6108
|
+
"color",
|
|
6109
|
+
"color-interpolation",
|
|
6110
|
+
"color-interpolation-filters",
|
|
6111
|
+
"color-profile",
|
|
6112
|
+
"color-rendering",
|
|
6113
|
+
"cx",
|
|
6114
|
+
"cy",
|
|
6115
|
+
"d",
|
|
6116
|
+
"dx",
|
|
6117
|
+
"dy",
|
|
6118
|
+
"diffuseconstant",
|
|
6119
|
+
"direction",
|
|
6120
|
+
"display",
|
|
6121
|
+
"divisor",
|
|
6122
|
+
"dominant-baseline",
|
|
6123
|
+
"dur",
|
|
6124
|
+
"edgemode",
|
|
6125
|
+
"elevation",
|
|
6126
|
+
"end",
|
|
6127
|
+
"exponent",
|
|
6128
|
+
"fill",
|
|
6129
|
+
"fill-opacity",
|
|
6130
|
+
"fill-rule",
|
|
6131
|
+
"filter",
|
|
6132
|
+
"filterunits",
|
|
6133
|
+
"flood-color",
|
|
6134
|
+
"flood-opacity",
|
|
6135
|
+
"font-family",
|
|
6136
|
+
"font-size",
|
|
6137
|
+
"font-size-adjust",
|
|
6138
|
+
"font-stretch",
|
|
6139
|
+
"font-style",
|
|
6140
|
+
"font-variant",
|
|
6141
|
+
"font-weight",
|
|
6142
|
+
"fx",
|
|
6143
|
+
"fy",
|
|
6144
|
+
"g1",
|
|
6145
|
+
"g2",
|
|
6146
|
+
"glyph-name",
|
|
6147
|
+
"glyphref",
|
|
6148
|
+
"gradientunits",
|
|
6149
|
+
"gradienttransform",
|
|
6150
|
+
"height",
|
|
6151
|
+
"href",
|
|
6152
|
+
"id",
|
|
6153
|
+
"image-rendering",
|
|
6154
|
+
"in",
|
|
6155
|
+
"in2",
|
|
6156
|
+
"intercept",
|
|
6157
|
+
"k",
|
|
6158
|
+
"k1",
|
|
6159
|
+
"k2",
|
|
6160
|
+
"k3",
|
|
6161
|
+
"k4",
|
|
6162
|
+
"kerning",
|
|
6163
|
+
"keypoints",
|
|
6164
|
+
"keysplines",
|
|
6165
|
+
"keytimes",
|
|
6166
|
+
"lang",
|
|
6167
|
+
"lengthadjust",
|
|
6168
|
+
"letter-spacing",
|
|
6169
|
+
"kernelmatrix",
|
|
6170
|
+
"kernelunitlength",
|
|
6171
|
+
"lighting-color",
|
|
6172
|
+
"local",
|
|
6173
|
+
"marker-end",
|
|
6174
|
+
"marker-mid",
|
|
6175
|
+
"marker-start",
|
|
6176
|
+
"markerheight",
|
|
6177
|
+
"markerunits",
|
|
6178
|
+
"markerwidth",
|
|
6179
|
+
"maskcontentunits",
|
|
6180
|
+
"maskunits",
|
|
6181
|
+
"max",
|
|
6182
|
+
"mask",
|
|
6183
|
+
"mask-type",
|
|
6184
|
+
"media",
|
|
6185
|
+
"method",
|
|
6186
|
+
"mode",
|
|
6187
|
+
"min",
|
|
6188
|
+
"name",
|
|
6189
|
+
"numoctaves",
|
|
6190
|
+
"offset",
|
|
6191
|
+
"operator",
|
|
6192
|
+
"opacity",
|
|
6193
|
+
"order",
|
|
6194
|
+
"orient",
|
|
6195
|
+
"orientation",
|
|
6196
|
+
"origin",
|
|
6197
|
+
"overflow",
|
|
6198
|
+
"paint-order",
|
|
6199
|
+
"path",
|
|
6200
|
+
"pathlength",
|
|
6201
|
+
"patterncontentunits",
|
|
6202
|
+
"patterntransform",
|
|
6203
|
+
"patternunits",
|
|
6204
|
+
"pointer-events",
|
|
6205
|
+
"points",
|
|
6206
|
+
"preservealpha",
|
|
6207
|
+
"preserveaspectratio",
|
|
6208
|
+
"primitiveunits",
|
|
6209
|
+
"r",
|
|
6210
|
+
"rx",
|
|
6211
|
+
"ry",
|
|
6212
|
+
"radius",
|
|
6213
|
+
"refx",
|
|
6214
|
+
"refy",
|
|
6215
|
+
"repeatcount",
|
|
6216
|
+
"repeatdur",
|
|
6217
|
+
"restart",
|
|
6218
|
+
"result",
|
|
6219
|
+
"rotate",
|
|
6220
|
+
"scale",
|
|
6221
|
+
"seed",
|
|
6222
|
+
"shape-rendering",
|
|
6223
|
+
"slope",
|
|
6224
|
+
"specularconstant",
|
|
6225
|
+
"specularexponent",
|
|
6226
|
+
"spreadmethod",
|
|
6227
|
+
"startoffset",
|
|
6228
|
+
"stddeviation",
|
|
6229
|
+
"stitchtiles",
|
|
6230
|
+
"stop-color",
|
|
6231
|
+
"stop-opacity",
|
|
6232
|
+
"stroke-dasharray",
|
|
6233
|
+
"stroke-dashoffset",
|
|
6234
|
+
"stroke-linecap",
|
|
6235
|
+
"stroke-linejoin",
|
|
6236
|
+
"stroke-miterlimit",
|
|
6237
|
+
"stroke-opacity",
|
|
6238
|
+
"stroke",
|
|
6239
|
+
"stroke-width",
|
|
6240
|
+
"style",
|
|
6241
|
+
"surfacescale",
|
|
6242
|
+
"systemlanguage",
|
|
6243
|
+
"tabindex",
|
|
6244
|
+
"tablevalues",
|
|
6245
|
+
"targetx",
|
|
6246
|
+
"targety",
|
|
6247
|
+
"transform",
|
|
6248
|
+
"transform-origin",
|
|
6249
|
+
"text-anchor",
|
|
6250
|
+
"text-decoration",
|
|
6251
|
+
"text-orientation",
|
|
6252
|
+
"text-rendering",
|
|
6253
|
+
"textlength",
|
|
6254
|
+
"type",
|
|
6255
|
+
"u1",
|
|
6256
|
+
"u2",
|
|
6257
|
+
"unicode",
|
|
6258
|
+
"values",
|
|
6259
|
+
"vector-effect",
|
|
6260
|
+
"viewbox",
|
|
6261
|
+
"visibility",
|
|
6262
|
+
"version",
|
|
6263
|
+
"vert-adv-y",
|
|
6264
|
+
"vert-origin-x",
|
|
6265
|
+
"vert-origin-y",
|
|
6266
|
+
"width",
|
|
6267
|
+
"word-spacing",
|
|
6268
|
+
"wrap",
|
|
6269
|
+
"writing-mode",
|
|
6270
|
+
"xchannelselector",
|
|
6271
|
+
"ychannelselector",
|
|
6272
|
+
"x",
|
|
6273
|
+
"x1",
|
|
6274
|
+
"x2",
|
|
6275
|
+
"xmlns",
|
|
6276
|
+
"y",
|
|
6277
|
+
"y1",
|
|
6278
|
+
"y2",
|
|
6279
|
+
"z",
|
|
6280
|
+
"zoomandpan"
|
|
6281
|
+
]);
|
|
6282
|
+
var mathMl = freeze([
|
|
6283
|
+
"accent",
|
|
6284
|
+
"accentunder",
|
|
6285
|
+
"align",
|
|
6286
|
+
"bevelled",
|
|
6287
|
+
"close",
|
|
6288
|
+
"columnalign",
|
|
6289
|
+
"columnlines",
|
|
6290
|
+
"columnspacing",
|
|
6291
|
+
"columnspan",
|
|
6292
|
+
"denomalign",
|
|
6293
|
+
"depth",
|
|
6294
|
+
"dir",
|
|
6295
|
+
"display",
|
|
6296
|
+
"displaystyle",
|
|
6297
|
+
"encoding",
|
|
6298
|
+
"fence",
|
|
6299
|
+
"frame",
|
|
6300
|
+
"height",
|
|
6301
|
+
"href",
|
|
6302
|
+
"id",
|
|
6303
|
+
"largeop",
|
|
6304
|
+
"length",
|
|
6305
|
+
"linethickness",
|
|
6306
|
+
"lquote",
|
|
6307
|
+
"lspace",
|
|
6308
|
+
"mathbackground",
|
|
6309
|
+
"mathcolor",
|
|
6310
|
+
"mathsize",
|
|
6311
|
+
"mathvariant",
|
|
6312
|
+
"maxsize",
|
|
6313
|
+
"minsize",
|
|
6314
|
+
"movablelimits",
|
|
6315
|
+
"notation",
|
|
6316
|
+
"numalign",
|
|
6317
|
+
"open",
|
|
6318
|
+
"rowalign",
|
|
6319
|
+
"rowlines",
|
|
6320
|
+
"rowspacing",
|
|
6321
|
+
"rowspan",
|
|
6322
|
+
"rspace",
|
|
6323
|
+
"rquote",
|
|
6324
|
+
"scriptlevel",
|
|
6325
|
+
"scriptminsize",
|
|
6326
|
+
"scriptsizemultiplier",
|
|
6327
|
+
"selection",
|
|
6328
|
+
"separator",
|
|
6329
|
+
"separators",
|
|
6330
|
+
"stretchy",
|
|
6331
|
+
"subscriptshift",
|
|
6332
|
+
"supscriptshift",
|
|
6333
|
+
"symmetric",
|
|
6334
|
+
"voffset",
|
|
6335
|
+
"width",
|
|
6336
|
+
"xmlns"
|
|
6337
|
+
]);
|
|
6338
|
+
var xml = freeze([
|
|
6339
|
+
"xlink:href",
|
|
6340
|
+
"xml:id",
|
|
6341
|
+
"xlink:title",
|
|
6342
|
+
"xml:space",
|
|
6343
|
+
"xmlns:xlink"
|
|
6344
|
+
]);
|
|
6345
|
+
var MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
|
|
6346
|
+
var ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
|
|
6347
|
+
var TMPLIT_EXPR = seal(/\${[\w\W]*/g);
|
|
6348
|
+
var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
|
|
6349
|
+
var ARIA_ATTR = seal(/^aria-[\-\w]+$/);
|
|
6350
|
+
var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i);
|
|
6351
|
+
var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
|
|
6352
|
+
var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g);
|
|
6353
|
+
var DOCTYPE_NAME = seal(/^html$/i);
|
|
6354
|
+
var CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
6355
|
+
var ELEMENT_MARKUP_PROBE = seal(/<[/\w!]/g);
|
|
6356
|
+
var COMMENT_MARKUP_PROBE = seal(/<[/\w]/g);
|
|
6357
|
+
var FALLBACK_TAG_CLOSE = seal(/<\/no(script|embed|frames)/i);
|
|
6358
|
+
var SELF_CLOSING_TAG = seal(/\/>/i);
|
|
6359
|
+
var NODE_TYPE = {
|
|
6360
|
+
element: 1,
|
|
6361
|
+
attribute: 2,
|
|
6362
|
+
text: 3,
|
|
6363
|
+
cdataSection: 4,
|
|
6364
|
+
entityReference: 5,
|
|
6365
|
+
entityNode: 6,
|
|
6366
|
+
processingInstruction: 7,
|
|
6367
|
+
comment: 8,
|
|
6368
|
+
document: 9,
|
|
6369
|
+
documentType: 10,
|
|
6370
|
+
documentFragment: 11,
|
|
6371
|
+
notation: 12
|
|
6372
|
+
};
|
|
6373
|
+
var LITERAL_TEXT_ELEMENT_NAMES = [
|
|
6374
|
+
"style",
|
|
6375
|
+
"script",
|
|
6376
|
+
"xmp",
|
|
6377
|
+
"iframe",
|
|
6378
|
+
"noembed",
|
|
6379
|
+
"noframes",
|
|
6380
|
+
"plaintext",
|
|
6381
|
+
"noscript"
|
|
6382
|
+
];
|
|
6383
|
+
var LITERAL_TEXT_ELEMENTS = freeze(addToSet({}, LITERAL_TEXT_ELEMENT_NAMES));
|
|
6384
|
+
var LITERAL_TEXT_CLOSE = function() {
|
|
6385
|
+
const map = {};
|
|
6386
|
+
arrayForEach(LITERAL_TEXT_ELEMENT_NAMES, (name) => {
|
|
6387
|
+
map[name] = seal(new RegExp("</" + name + "(?=[\\t\\n\\f\\r />])", "i"));
|
|
6388
|
+
});
|
|
6389
|
+
return freeze(map);
|
|
6390
|
+
}();
|
|
6391
|
+
var getGlobal = function getGlobal() {
|
|
6392
|
+
return typeof window === "undefined" ? null : window;
|
|
6393
|
+
};
|
|
6394
|
+
/**
|
|
6395
|
+
* Creates a no-op policy for internal use only.
|
|
6396
|
+
* Don't export this function outside this module!
|
|
6397
|
+
* @param trustedTypes The policy factory.
|
|
6398
|
+
* @param purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
|
|
6399
|
+
* @return The policy created (or null, if Trusted Types
|
|
6400
|
+
* are not supported or creating the policy failed).
|
|
6401
|
+
*/
|
|
6402
|
+
var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
|
|
6403
|
+
if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") return null;
|
|
6404
|
+
let suffix = null;
|
|
6405
|
+
const ATTR_NAME = "data-tt-policy-suffix";
|
|
6406
|
+
if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) suffix = purifyHostElement.getAttribute(ATTR_NAME);
|
|
6407
|
+
const policyName = "dompurify" + (suffix ? "#" + suffix : "");
|
|
6408
|
+
try {
|
|
6409
|
+
return trustedTypes.createPolicy(policyName, {
|
|
6410
|
+
createHTML(html) {
|
|
6411
|
+
return html;
|
|
6412
|
+
},
|
|
6413
|
+
createScriptURL(scriptUrl) {
|
|
6414
|
+
return scriptUrl;
|
|
6415
|
+
}
|
|
6416
|
+
});
|
|
6417
|
+
} catch (_) {
|
|
6418
|
+
console.warn("TrustedTypes policy " + policyName + " could not be created.");
|
|
6419
|
+
return null;
|
|
6420
|
+
}
|
|
6421
|
+
};
|
|
6422
|
+
var _createHooksMap = function _createHooksMap() {
|
|
6423
|
+
return {
|
|
6424
|
+
afterSanitizeAttributes: [],
|
|
6425
|
+
afterSanitizeElements: [],
|
|
6426
|
+
afterSanitizeShadowDOM: [],
|
|
6427
|
+
beforeSanitizeAttributes: [],
|
|
6428
|
+
beforeSanitizeElements: [],
|
|
6429
|
+
beforeSanitizeShadowDOM: [],
|
|
6430
|
+
uponSanitizeAttribute: [],
|
|
6431
|
+
uponSanitizeElement: [],
|
|
6432
|
+
uponSanitizeShadowNode: []
|
|
6433
|
+
};
|
|
6434
|
+
};
|
|
6435
|
+
/**
|
|
6436
|
+
* Resolve a set-valued configuration option: a fresh set built from
|
|
6437
|
+
* cfg[key] when it is an own array property (seeded with a clone of
|
|
6438
|
+
* options.base when given, case-normalized via options.transform),
|
|
6439
|
+
* the fallback set otherwise.
|
|
6440
|
+
*
|
|
6441
|
+
* @param cfg the cloned, prototype-free configuration object
|
|
6442
|
+
* @param key the configuration property to read
|
|
6443
|
+
* @param fallback the set to use when the option is absent or not an array
|
|
6444
|
+
* @param options transform and optional base set to merge into
|
|
6445
|
+
* @returns the resolved set
|
|
6446
|
+
*/
|
|
6447
|
+
var _resolveSetOption = function _resolveSetOption(cfg, key, fallback, options) {
|
|
6448
|
+
return objectHasOwnProperty(cfg, key) && arrayIsArray(cfg[key]) ? addToSet(options.base ? clone(options.base) : {}, cfg[key], options.transform) : fallback;
|
|
6449
|
+
};
|
|
6450
|
+
/**
|
|
6451
|
+
* Resolve an object-valued configuration option: a prototype-free clone
|
|
6452
|
+
* of cfg[key] when it is an own, truthy object property, else a fresh
|
|
6453
|
+
* fallback built by makeFallback (fresh on every parse, so a previous
|
|
6454
|
+
* parse can never leak state into the next one).
|
|
6455
|
+
*
|
|
6456
|
+
* @param cfg the cloned, prototype-free configuration object
|
|
6457
|
+
* @param key the configuration property to read
|
|
6458
|
+
* @param makeFallback builds the fallback value when the option is absent
|
|
6459
|
+
* @returns the resolved object
|
|
6460
|
+
*/
|
|
6461
|
+
var _resolveObjectOption = function _resolveObjectOption(cfg, key, makeFallback) {
|
|
6462
|
+
const value = objectHasOwnProperty(cfg, key) ? cfg[key] : void 0;
|
|
6463
|
+
return value && typeof value === "object" ? clone(value) : makeFallback();
|
|
6464
|
+
};
|
|
6465
|
+
function createDOMPurify() {
|
|
6466
|
+
let window = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
|
|
6467
|
+
const DOMPurify = (root) => createDOMPurify(root);
|
|
6468
|
+
DOMPurify.version = "3.4.16";
|
|
6469
|
+
DOMPurify.removed = [];
|
|
6470
|
+
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
6471
|
+
DOMPurify.isSupported = false;
|
|
6472
|
+
return DOMPurify;
|
|
6473
|
+
}
|
|
6474
|
+
let document = window.document;
|
|
6475
|
+
const originalDocument = document;
|
|
6476
|
+
const currentScript = originalDocument.currentScript;
|
|
6477
|
+
window.DocumentFragment;
|
|
6478
|
+
const HTMLTemplateElement = window.HTMLTemplateElement, Node = window.Node, Element = window.Element, NodeFilter = window.NodeFilter;
|
|
6479
|
+
window.NamedNodeMap === void 0 && (window.NamedNodeMap || window.MozNamedAttrMap);
|
|
6480
|
+
window.HTMLFormElement;
|
|
6481
|
+
const DOMParser = window.DOMParser, trustedTypes = window.trustedTypes;
|
|
6482
|
+
const ElementPrototype = Element.prototype;
|
|
6483
|
+
const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
|
|
6484
|
+
const remove = lookupGetter(ElementPrototype, "remove");
|
|
6485
|
+
const removeAttributeNode = lookupGetter(ElementPrototype, "removeAttributeNode");
|
|
6486
|
+
const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
|
|
6487
|
+
const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
|
|
6488
|
+
const getParentNode = lookupGetter(ElementPrototype, "parentNode");
|
|
6489
|
+
const getShadowRoot = lookupGetter(ElementPrototype, "shadowRoot");
|
|
6490
|
+
const getAttributes = lookupGetter(ElementPrototype, "attributes");
|
|
6491
|
+
const getNodeType = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeType") : null;
|
|
6492
|
+
const getNodeName = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeName") : null;
|
|
6493
|
+
const getOwnerDocument = Node && Node.prototype ? lookupGetter(Node.prototype, "ownerDocument") : null;
|
|
6494
|
+
const _readNodeType = function _readNodeType(node) {
|
|
6495
|
+
return getNodeType ? getNodeType(node) : node.nodeType;
|
|
6496
|
+
};
|
|
6497
|
+
const _readNodeName = function _readNodeName(node) {
|
|
6498
|
+
return getNodeName ? getNodeName(node) : node.nodeName;
|
|
6499
|
+
};
|
|
6500
|
+
if (typeof HTMLTemplateElement === "function") {
|
|
6501
|
+
const template = document.createElement("template");
|
|
6502
|
+
if (template.content && template.content.ownerDocument) document = template.content.ownerDocument;
|
|
6503
|
+
}
|
|
6504
|
+
let trustedTypesPolicy;
|
|
6505
|
+
let emptyHTML = "";
|
|
6506
|
+
let defaultTrustedTypesPolicy;
|
|
6507
|
+
let defaultTrustedTypesPolicyResolved = false;
|
|
6508
|
+
let IN_TRUSTED_TYPES_POLICY = 0;
|
|
6509
|
+
const _assertNotInTrustedTypesPolicy = function _assertNotInTrustedTypesPolicy() {
|
|
6510
|
+
if (IN_TRUSTED_TYPES_POLICY > 0) throw typeErrorCreate("A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the \"DOMPurify and Trusted Types\" section of the README.");
|
|
6511
|
+
};
|
|
6512
|
+
const _createTrustedHTML = function _createTrustedHTML(html) {
|
|
6513
|
+
_assertNotInTrustedTypesPolicy();
|
|
6514
|
+
IN_TRUSTED_TYPES_POLICY++;
|
|
6515
|
+
try {
|
|
6516
|
+
return trustedTypesPolicy.createHTML(html);
|
|
6517
|
+
} finally {
|
|
6518
|
+
IN_TRUSTED_TYPES_POLICY--;
|
|
6519
|
+
}
|
|
6520
|
+
};
|
|
6521
|
+
const _createTrustedScriptURL = function _createTrustedScriptURL(scriptUrl) {
|
|
6522
|
+
_assertNotInTrustedTypesPolicy();
|
|
6523
|
+
IN_TRUSTED_TYPES_POLICY++;
|
|
6524
|
+
try {
|
|
6525
|
+
return trustedTypesPolicy.createScriptURL(scriptUrl);
|
|
6526
|
+
} finally {
|
|
6527
|
+
IN_TRUSTED_TYPES_POLICY--;
|
|
6528
|
+
}
|
|
6529
|
+
};
|
|
6530
|
+
const _getDefaultTrustedTypesPolicy = function _getDefaultTrustedTypesPolicy() {
|
|
6531
|
+
if (!defaultTrustedTypesPolicyResolved) {
|
|
6532
|
+
defaultTrustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
|
|
6533
|
+
defaultTrustedTypesPolicyResolved = true;
|
|
6534
|
+
}
|
|
6535
|
+
return defaultTrustedTypesPolicy;
|
|
6536
|
+
};
|
|
6537
|
+
const _document = document, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName;
|
|
6538
|
+
const importNode = originalDocument.importNode;
|
|
6539
|
+
let hooks = _createHooksMap();
|
|
6540
|
+
/**
|
|
6541
|
+
* Expose whether this browser supports running the full DOMPurify.
|
|
6542
|
+
*/
|
|
6543
|
+
DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
|
|
6544
|
+
const MUSTACHE_EXPR$1 = MUSTACHE_EXPR, ERB_EXPR$1 = ERB_EXPR, TMPLIT_EXPR$1 = TMPLIT_EXPR, DATA_ATTR$1 = DATA_ATTR, ARIA_ATTR$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$1 = ATTR_WHITESPACE, CUSTOM_ELEMENT$1 = CUSTOM_ELEMENT;
|
|
6545
|
+
let IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
|
|
6546
|
+
/**
|
|
6547
|
+
* We consider the elements and attributes below to be safe. Ideally
|
|
6548
|
+
* don't add any new ones but feel free to remove unwanted ones.
|
|
6549
|
+
*/
|
|
6550
|
+
let ALLOWED_TAGS = null;
|
|
6551
|
+
const DEFAULT_ALLOWED_TAGS = addToSet({}, [
|
|
6552
|
+
...html$1,
|
|
6553
|
+
...svg$1,
|
|
6554
|
+
...svgFilters,
|
|
6555
|
+
...mathMl$1,
|
|
6556
|
+
...text
|
|
6557
|
+
]);
|
|
6558
|
+
let ALLOWED_ATTR = null;
|
|
6559
|
+
const DEFAULT_ALLOWED_ATTR = addToSet({}, [
|
|
6560
|
+
...html,
|
|
6561
|
+
...svg,
|
|
6562
|
+
...mathMl,
|
|
6563
|
+
...xml
|
|
6564
|
+
]);
|
|
6565
|
+
let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
|
|
6566
|
+
tagNameCheck: {
|
|
6567
|
+
writable: true,
|
|
6568
|
+
configurable: false,
|
|
6569
|
+
enumerable: true,
|
|
6570
|
+
value: null
|
|
6571
|
+
},
|
|
6572
|
+
attributeNameCheck: {
|
|
6573
|
+
writable: true,
|
|
6574
|
+
configurable: false,
|
|
6575
|
+
enumerable: true,
|
|
6576
|
+
value: null
|
|
6577
|
+
},
|
|
6578
|
+
allowCustomizedBuiltInElements: {
|
|
6579
|
+
writable: true,
|
|
6580
|
+
configurable: false,
|
|
6581
|
+
enumerable: true,
|
|
6582
|
+
value: false
|
|
6583
|
+
}
|
|
6584
|
+
}));
|
|
6585
|
+
let FORBID_TAGS = null;
|
|
6586
|
+
let FORBID_ATTR = null;
|
|
6587
|
+
const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
|
|
6588
|
+
tagCheck: {
|
|
6589
|
+
writable: true,
|
|
6590
|
+
configurable: false,
|
|
6591
|
+
enumerable: true,
|
|
6592
|
+
value: null
|
|
6593
|
+
},
|
|
6594
|
+
attributeCheck: {
|
|
6595
|
+
writable: true,
|
|
6596
|
+
configurable: false,
|
|
6597
|
+
enumerable: true,
|
|
6598
|
+
value: null
|
|
6599
|
+
}
|
|
6600
|
+
}));
|
|
6601
|
+
let ALLOW_ARIA_ATTR = true;
|
|
6602
|
+
let ALLOW_DATA_ATTR = true;
|
|
6603
|
+
let ALLOW_UNKNOWN_PROTOCOLS = false;
|
|
6604
|
+
let ALLOW_SELF_CLOSE_IN_ATTR = true;
|
|
6605
|
+
let SAFE_FOR_TEMPLATES = false;
|
|
6606
|
+
let SAFE_FOR_XML = true;
|
|
6607
|
+
let WHOLE_DOCUMENT = false;
|
|
6608
|
+
let SET_CONFIG = false;
|
|
6609
|
+
let SET_CONFIG_ALLOWED_TAGS = null;
|
|
6610
|
+
let SET_CONFIG_ALLOWED_ATTR = null;
|
|
6611
|
+
let FORCE_BODY = false;
|
|
6612
|
+
let RETURN_DOM = false;
|
|
6613
|
+
let RETURN_DOM_FRAGMENT = false;
|
|
6614
|
+
let RETURN_TRUSTED_TYPE = false;
|
|
6615
|
+
let SANITIZE_DOM = true;
|
|
6616
|
+
let SANITIZE_NAMED_PROPS = false;
|
|
6617
|
+
const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
|
|
6618
|
+
let KEEP_CONTENT = true;
|
|
6619
|
+
let IN_PLACE = false;
|
|
6620
|
+
let USE_PROFILES = {};
|
|
6621
|
+
let FORBID_CONTENTS = null;
|
|
6622
|
+
const DEFAULT_FORBID_CONTENTS = addToSet({}, [
|
|
6623
|
+
"annotation-xml",
|
|
6624
|
+
"audio",
|
|
6625
|
+
"colgroup",
|
|
6626
|
+
"desc",
|
|
6627
|
+
"foreignobject",
|
|
6628
|
+
"head",
|
|
6629
|
+
"iframe",
|
|
6630
|
+
"math",
|
|
6631
|
+
"mi",
|
|
6632
|
+
"mn",
|
|
6633
|
+
"mo",
|
|
6634
|
+
"ms",
|
|
6635
|
+
"mtext",
|
|
6636
|
+
"noembed",
|
|
6637
|
+
"noframes",
|
|
6638
|
+
"noscript",
|
|
6639
|
+
"plaintext",
|
|
6640
|
+
"script",
|
|
6641
|
+
"selectedcontent",
|
|
6642
|
+
"style",
|
|
6643
|
+
"svg",
|
|
6644
|
+
"template",
|
|
6645
|
+
"thead",
|
|
6646
|
+
"title",
|
|
6647
|
+
"video",
|
|
6648
|
+
"xmp"
|
|
6649
|
+
]);
|
|
6650
|
+
let DATA_URI_TAGS = null;
|
|
6651
|
+
const DEFAULT_DATA_URI_TAGS = addToSet({}, [
|
|
6652
|
+
"audio",
|
|
6653
|
+
"video",
|
|
6654
|
+
"img",
|
|
6655
|
+
"source",
|
|
6656
|
+
"image",
|
|
6657
|
+
"track"
|
|
6658
|
+
]);
|
|
6659
|
+
let URI_SAFE_ATTRIBUTES = null;
|
|
6660
|
+
const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, [
|
|
6661
|
+
"alt",
|
|
6662
|
+
"class",
|
|
6663
|
+
"for",
|
|
6664
|
+
"id",
|
|
6665
|
+
"label",
|
|
6666
|
+
"name",
|
|
6667
|
+
"pattern",
|
|
6668
|
+
"placeholder",
|
|
6669
|
+
"role",
|
|
6670
|
+
"summary",
|
|
6671
|
+
"title",
|
|
6672
|
+
"value",
|
|
6673
|
+
"style",
|
|
6674
|
+
"xmlns"
|
|
6675
|
+
]);
|
|
6676
|
+
const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
|
|
6677
|
+
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
6678
|
+
const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
|
6679
|
+
let NAMESPACE = HTML_NAMESPACE;
|
|
6680
|
+
let IS_EMPTY_INPUT = false;
|
|
6681
|
+
let ALLOWED_NAMESPACES = null;
|
|
6682
|
+
const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [
|
|
6683
|
+
MATHML_NAMESPACE,
|
|
6684
|
+
SVG_NAMESPACE,
|
|
6685
|
+
HTML_NAMESPACE
|
|
6686
|
+
], stringToString);
|
|
6687
|
+
const DEFAULT_MATHML_TEXT_INTEGRATION_POINTS = freeze([
|
|
6688
|
+
"mi",
|
|
6689
|
+
"mo",
|
|
6690
|
+
"mn",
|
|
6691
|
+
"ms",
|
|
6692
|
+
"mtext"
|
|
6693
|
+
]);
|
|
6694
|
+
let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
|
|
6695
|
+
const DEFAULT_HTML_INTEGRATION_POINTS = freeze(["annotation-xml"]);
|
|
6696
|
+
let HTML_INTEGRATION_POINTS = addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
|
|
6697
|
+
const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [
|
|
6698
|
+
"title",
|
|
6699
|
+
"style",
|
|
6700
|
+
"font",
|
|
6701
|
+
"a",
|
|
6702
|
+
"script"
|
|
6703
|
+
]);
|
|
6704
|
+
let PARSER_MEDIA_TYPE = null;
|
|
6705
|
+
const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
|
|
6706
|
+
const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
|
|
6707
|
+
let transformCaseFunc = null;
|
|
6708
|
+
let CONFIG = null;
|
|
6709
|
+
const formElement = document.createElement("form");
|
|
6710
|
+
const isRegexOrFunction = function isRegexOrFunction(testValue) {
|
|
6711
|
+
return testValue instanceof RegExp || testValue instanceof Function;
|
|
6712
|
+
};
|
|
6713
|
+
/**
|
|
6714
|
+
* _parseConfig
|
|
6715
|
+
*
|
|
6716
|
+
* @param cfg optional config literal
|
|
6717
|
+
*/
|
|
6718
|
+
const _parseConfig = function _parseConfig() {
|
|
6719
|
+
let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
6720
|
+
if (CONFIG && CONFIG === cfg) return;
|
|
6721
|
+
if (!cfg || typeof cfg !== "object") cfg = {};
|
|
6722
|
+
cfg = clone(cfg);
|
|
6723
|
+
PARSER_MEDIA_TYPE = SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
|
|
6724
|
+
transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
|
|
6725
|
+
ALLOWED_TAGS = _resolveSetOption(cfg, "ALLOWED_TAGS", DEFAULT_ALLOWED_TAGS, { transform: transformCaseFunc });
|
|
6726
|
+
ALLOWED_ATTR = _resolveSetOption(cfg, "ALLOWED_ATTR", DEFAULT_ALLOWED_ATTR, { transform: transformCaseFunc });
|
|
6727
|
+
ALLOWED_NAMESPACES = _resolveSetOption(cfg, "ALLOWED_NAMESPACES", DEFAULT_ALLOWED_NAMESPACES, { transform: stringToString });
|
|
6728
|
+
URI_SAFE_ATTRIBUTES = _resolveSetOption(cfg, "ADD_URI_SAFE_ATTR", DEFAULT_URI_SAFE_ATTRIBUTES, {
|
|
6729
|
+
transform: transformCaseFunc,
|
|
6730
|
+
base: DEFAULT_URI_SAFE_ATTRIBUTES
|
|
6731
|
+
});
|
|
6732
|
+
DATA_URI_TAGS = _resolveSetOption(cfg, "ADD_DATA_URI_TAGS", DEFAULT_DATA_URI_TAGS, {
|
|
6733
|
+
transform: transformCaseFunc,
|
|
6734
|
+
base: DEFAULT_DATA_URI_TAGS
|
|
6735
|
+
});
|
|
6736
|
+
FORBID_CONTENTS = _resolveSetOption(cfg, "FORBID_CONTENTS", DEFAULT_FORBID_CONTENTS, { transform: transformCaseFunc });
|
|
6737
|
+
FORBID_TAGS = _resolveSetOption(cfg, "FORBID_TAGS", clone({}), { transform: transformCaseFunc });
|
|
6738
|
+
FORBID_ATTR = _resolveSetOption(cfg, "FORBID_ATTR", clone({}), { transform: transformCaseFunc });
|
|
6739
|
+
USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
|
|
6740
|
+
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
|
|
6741
|
+
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
|
|
6742
|
+
ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
|
|
6743
|
+
ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
|
|
6744
|
+
SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
|
|
6745
|
+
SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
|
|
6746
|
+
WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
|
|
6747
|
+
RETURN_DOM = cfg.RETURN_DOM || false;
|
|
6748
|
+
RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
|
|
6749
|
+
RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
|
|
6750
|
+
FORCE_BODY = cfg.FORCE_BODY || false;
|
|
6751
|
+
SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
|
|
6752
|
+
SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
|
|
6753
|
+
KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
|
|
6754
|
+
IN_PLACE = cfg.IN_PLACE || false;
|
|
6755
|
+
IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
|
|
6756
|
+
NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
|
|
6757
|
+
MATHML_TEXT_INTEGRATION_POINTS = _resolveObjectOption(cfg, "MATHML_TEXT_INTEGRATION_POINTS", () => addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS));
|
|
6758
|
+
HTML_INTEGRATION_POINTS = _resolveObjectOption(cfg, "HTML_INTEGRATION_POINTS", () => addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS));
|
|
6759
|
+
const customElementHandling = _resolveObjectOption(cfg, "CUSTOM_ELEMENT_HANDLING", () => create(null));
|
|
6760
|
+
CUSTOM_ELEMENT_HANDLING = create(null);
|
|
6761
|
+
if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
|
|
6762
|
+
if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
|
|
6763
|
+
if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
|
|
6764
|
+
seal(CUSTOM_ELEMENT_HANDLING);
|
|
6765
|
+
if (SAFE_FOR_TEMPLATES) ALLOW_DATA_ATTR = false;
|
|
6766
|
+
if (RETURN_DOM_FRAGMENT) RETURN_DOM = true;
|
|
6767
|
+
if (USE_PROFILES) {
|
|
6768
|
+
ALLOWED_TAGS = addToSet({}, text);
|
|
6769
|
+
ALLOWED_ATTR = create(null);
|
|
6770
|
+
if (USE_PROFILES.html === true) {
|
|
6771
|
+
addToSet(ALLOWED_TAGS, html$1);
|
|
6772
|
+
addToSet(ALLOWED_ATTR, html);
|
|
6773
|
+
}
|
|
6774
|
+
if (USE_PROFILES.svg === true) {
|
|
6775
|
+
addToSet(ALLOWED_TAGS, svg$1);
|
|
6776
|
+
addToSet(ALLOWED_ATTR, svg);
|
|
6777
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
6778
|
+
}
|
|
6779
|
+
if (USE_PROFILES.svgFilters === true) {
|
|
6780
|
+
addToSet(ALLOWED_TAGS, svgFilters);
|
|
6781
|
+
addToSet(ALLOWED_ATTR, svg);
|
|
6782
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
6783
|
+
}
|
|
6784
|
+
if (USE_PROFILES.mathMl === true) {
|
|
6785
|
+
addToSet(ALLOWED_TAGS, mathMl$1);
|
|
6786
|
+
addToSet(ALLOWED_ATTR, mathMl);
|
|
6787
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
6788
|
+
}
|
|
6789
|
+
}
|
|
6790
|
+
EXTRA_ELEMENT_HANDLING.tagCheck = null;
|
|
6791
|
+
EXTRA_ELEMENT_HANDLING.attributeCheck = null;
|
|
6792
|
+
if (objectHasOwnProperty(cfg, "ADD_TAGS")) {
|
|
6793
|
+
if (typeof cfg.ADD_TAGS === "function") EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
|
|
6794
|
+
else if (arrayIsArray(cfg.ADD_TAGS)) {
|
|
6795
|
+
if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
|
6796
|
+
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
|
|
6797
|
+
}
|
|
6798
|
+
}
|
|
6799
|
+
if (objectHasOwnProperty(cfg, "ADD_ATTR")) {
|
|
6800
|
+
if (typeof cfg.ADD_ATTR === "function") EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
|
|
6801
|
+
else if (arrayIsArray(cfg.ADD_ATTR)) {
|
|
6802
|
+
if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
6803
|
+
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
|
6804
|
+
}
|
|
6805
|
+
}
|
|
6806
|
+
if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
|
|
6807
|
+
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
6808
|
+
addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
|
|
6809
|
+
}
|
|
6810
|
+
if (KEEP_CONTENT) ALLOWED_TAGS["#text"] = true;
|
|
6811
|
+
if (WHOLE_DOCUMENT) addToSet(ALLOWED_TAGS, [
|
|
6812
|
+
"html",
|
|
6813
|
+
"head",
|
|
6814
|
+
"body"
|
|
6815
|
+
]);
|
|
6816
|
+
if (ALLOWED_TAGS.table) {
|
|
6817
|
+
addToSet(ALLOWED_TAGS, ["tbody"]);
|
|
6818
|
+
delete FORBID_TAGS.tbody;
|
|
6819
|
+
}
|
|
6820
|
+
if (cfg.TRUSTED_TYPES_POLICY) {
|
|
6821
|
+
if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
|
|
6822
|
+
if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
|
|
6823
|
+
const previousTrustedTypesPolicy = trustedTypesPolicy;
|
|
6824
|
+
trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
|
|
6825
|
+
try {
|
|
6826
|
+
emptyHTML = _createTrustedHTML("");
|
|
6827
|
+
} catch (error) {
|
|
6828
|
+
trustedTypesPolicy = previousTrustedTypesPolicy;
|
|
6829
|
+
throw error;
|
|
6830
|
+
}
|
|
6831
|
+
} else if (cfg.TRUSTED_TYPES_POLICY === null) {
|
|
6832
|
+
trustedTypesPolicy = void 0;
|
|
6833
|
+
emptyHTML = "";
|
|
6834
|
+
} else {
|
|
6835
|
+
if (trustedTypesPolicy === void 0) trustedTypesPolicy = _getDefaultTrustedTypesPolicy();
|
|
6836
|
+
if (trustedTypesPolicy && typeof emptyHTML === "string") emptyHTML = _createTrustedHTML("");
|
|
6837
|
+
}
|
|
6838
|
+
if (freeze) freeze(cfg);
|
|
6839
|
+
CONFIG = cfg;
|
|
6840
|
+
};
|
|
6841
|
+
const ALL_SVG_TAGS = addToSet({}, [
|
|
6842
|
+
...svg$1,
|
|
6843
|
+
...svgFilters,
|
|
6844
|
+
...svgDisallowed
|
|
6845
|
+
]);
|
|
6846
|
+
const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
|
|
6847
|
+
/**
|
|
6848
|
+
* Namespace rules for an element in the SVG namespace.
|
|
6849
|
+
*
|
|
6850
|
+
* @param tagName the element's lowercase tag name
|
|
6851
|
+
* @param parent the (possibly simulated) parent node
|
|
6852
|
+
* @param parentTagName the parent's lowercase tag name
|
|
6853
|
+
* @returns true if a spec-compliant parser could produce this element
|
|
6854
|
+
*/
|
|
6855
|
+
const _checkSvgNamespace = function _checkSvgNamespace(tagName, parent, parentTagName) {
|
|
6856
|
+
if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "svg";
|
|
6857
|
+
if (parent.namespaceURI === MATHML_NAMESPACE) return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
|
|
6858
|
+
return Boolean(ALL_SVG_TAGS[tagName]);
|
|
6859
|
+
};
|
|
6860
|
+
/**
|
|
6861
|
+
* Namespace rules for an element in the MathML namespace.
|
|
6862
|
+
*
|
|
6863
|
+
* @param tagName the element's lowercase tag name
|
|
6864
|
+
* @param parent the (possibly simulated) parent node
|
|
6865
|
+
* @param parentTagName the parent's lowercase tag name
|
|
6866
|
+
* @returns true if a spec-compliant parser could produce this element
|
|
6867
|
+
*/
|
|
6868
|
+
const _checkMathMlNamespace = function _checkMathMlNamespace(tagName, parent, parentTagName) {
|
|
6869
|
+
if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "math";
|
|
6870
|
+
if (parent.namespaceURI === SVG_NAMESPACE) return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
|
|
6871
|
+
return Boolean(ALL_MATHML_TAGS[tagName]);
|
|
6872
|
+
};
|
|
6873
|
+
/**
|
|
6874
|
+
* Namespace rules for an element in the HTML namespace.
|
|
6875
|
+
*
|
|
6876
|
+
* @param tagName the element's lowercase tag name
|
|
6877
|
+
* @param parent the (possibly simulated) parent node
|
|
6878
|
+
* @param parentTagName the parent's lowercase tag name
|
|
6879
|
+
* @returns true if a spec-compliant parser could produce this element
|
|
6880
|
+
*/
|
|
6881
|
+
const _checkHtmlNamespace = function _checkHtmlNamespace(tagName, parent, parentTagName) {
|
|
6882
|
+
if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) return false;
|
|
6883
|
+
if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) return false;
|
|
6884
|
+
return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
|
|
6885
|
+
};
|
|
6886
|
+
/**
|
|
6887
|
+
* @param element a DOM element whose namespace is being checked
|
|
6888
|
+
* @returns Return false if the element has a
|
|
6889
|
+
* namespace that a spec-compliant parser would never
|
|
6890
|
+
* return. Return true otherwise.
|
|
6891
|
+
*/
|
|
6892
|
+
const _checkValidNamespace = function _checkValidNamespace(element) {
|
|
6893
|
+
let parent = getParentNode(element);
|
|
6894
|
+
if (!parent || !parent.tagName) parent = {
|
|
6895
|
+
namespaceURI: NAMESPACE,
|
|
6896
|
+
tagName: "template"
|
|
6897
|
+
};
|
|
6898
|
+
const tagName = stringToLowerCase(element.tagName);
|
|
6899
|
+
const parentTagName = stringToLowerCase(parent.tagName);
|
|
6900
|
+
if (!ALLOWED_NAMESPACES[element.namespaceURI]) return false;
|
|
6901
|
+
if (element.namespaceURI === SVG_NAMESPACE) return _checkSvgNamespace(tagName, parent, parentTagName);
|
|
6902
|
+
if (element.namespaceURI === MATHML_NAMESPACE) return _checkMathMlNamespace(tagName, parent, parentTagName);
|
|
6903
|
+
if (element.namespaceURI === HTML_NAMESPACE) return _checkHtmlNamespace(tagName, parent, parentTagName);
|
|
6904
|
+
if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) return true;
|
|
6905
|
+
return false;
|
|
6906
|
+
};
|
|
6907
|
+
/**
|
|
6908
|
+
* _forceRemove
|
|
6909
|
+
*
|
|
6910
|
+
* @param node a DOM node
|
|
6911
|
+
*/
|
|
6912
|
+
const _forceRemove = function _forceRemove(node) {
|
|
6913
|
+
arrayPush(DOMPurify.removed, { element: node });
|
|
6914
|
+
try {
|
|
6915
|
+
getParentNode(node).removeChild(node);
|
|
6916
|
+
} catch (_) {
|
|
6917
|
+
remove(node);
|
|
6918
|
+
if (!getParentNode(node)) throw typeErrorCreate("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
|
|
6919
|
+
}
|
|
6920
|
+
};
|
|
6921
|
+
/**
|
|
6922
|
+
* _stripAttributeNode
|
|
6923
|
+
*
|
|
6924
|
+
* Remove a single Attr node case/namespace-exactly on an attribute-teardown
|
|
6925
|
+
* path. Name-based removeAttribute() ASCII-lowercases its lookup key for an
|
|
6926
|
+
* HTML element in an HTML document and so silently misses a case-preserved
|
|
6927
|
+
* handler (e.g. `ONERROR` off an XML/XHTML import) - the same defect
|
|
6928
|
+
* _removeAttribute() was fixed for, which a name-based call would reintroduce
|
|
6929
|
+
* on these IN_PLACE teardown paths. Unlike _removeAttribute this does not
|
|
6930
|
+
* record into DOMPurify.removed: the neutralize passes intentionally do not
|
|
6931
|
+
* book-keep. A clobbered/detached node falls back to best-effort name-based
|
|
6932
|
+
* removal.
|
|
6933
|
+
*
|
|
6934
|
+
* @param element the element to strip the attribute from
|
|
6935
|
+
* @param attribute the Attr node to remove
|
|
6936
|
+
* @param name the attribute's name, for the fallback path
|
|
6937
|
+
*/
|
|
6938
|
+
const _stripAttributeNode = function _stripAttributeNode(element, attribute, name) {
|
|
6939
|
+
try {
|
|
6940
|
+
removeAttributeNode(element, attribute);
|
|
6941
|
+
} catch (_) {
|
|
6942
|
+
try {
|
|
6943
|
+
element.removeAttribute(name);
|
|
6944
|
+
} catch (_) {}
|
|
6945
|
+
}
|
|
6946
|
+
};
|
|
6947
|
+
/**
|
|
6948
|
+
* _neutralizeRoot
|
|
6949
|
+
*
|
|
6950
|
+
* Fail-closed teardown of an in-place root after the sanitize walk aborts
|
|
6951
|
+
* (campaign-3 F2). An internal throw mid-walk — e.g. a page-registered
|
|
6952
|
+
* custom element's reaction detaches a node so `_forceRemove`'s deliberate
|
|
6953
|
+
* parentless guard throws, or any other re-entrant engine mutation — would
|
|
6954
|
+
* otherwise leave the caller's *live* tree half-sanitized, with everything
|
|
6955
|
+
* after the abort point still carrying its handlers. There is no safe way
|
|
6956
|
+
* to resume the walk (the tree mutated under us), so we strip the root bare:
|
|
6957
|
+
* remove every child and every attribute, then let the caller's catch see
|
|
6958
|
+
* the original error. Clobber-safe (cached `remove`/`childNodes`/`attributes`
|
|
6959
|
+
* getters; the root was already clobber-pre-flighted at the IN_PLACE entry).
|
|
6960
|
+
*
|
|
6961
|
+
* @param root the in-place root to empty
|
|
6962
|
+
*/
|
|
6963
|
+
const _neutralizeRoot = function _neutralizeRoot(root) {
|
|
6964
|
+
_neutralizeSubtree(root);
|
|
6965
|
+
const childNodes = getChildNodes(root);
|
|
6966
|
+
if (childNodes) {
|
|
6967
|
+
const snapshot = [];
|
|
6968
|
+
arrayForEach(childNodes, (child) => {
|
|
6969
|
+
arrayPush(snapshot, child);
|
|
6970
|
+
});
|
|
6971
|
+
arrayForEach(snapshot, (child) => {
|
|
6972
|
+
try {
|
|
6973
|
+
remove(child);
|
|
6974
|
+
} catch (_) {}
|
|
6975
|
+
});
|
|
6976
|
+
}
|
|
6977
|
+
const attributes = getAttributes(root);
|
|
6978
|
+
if (attributes) for (let i = attributes.length - 1; i >= 0; --i) {
|
|
6979
|
+
const attribute = attributes[i];
|
|
6980
|
+
const name = attribute && attribute.name;
|
|
6981
|
+
if (typeof name === "string") _stripAttributeNode(root, attribute, name);
|
|
6982
|
+
}
|
|
6983
|
+
};
|
|
6984
|
+
/**
|
|
6985
|
+
* _removeAttribute
|
|
6986
|
+
*
|
|
6987
|
+
* Name-based getAttributeNode()/removeAttribute() ASCII-lowercase their
|
|
6988
|
+
* lookup key for HTML elements in an HTML document, so they silently miss an
|
|
6989
|
+
* attribute whose stored qualified name still contains uppercase ASCII
|
|
6990
|
+
* letters. That happens when the node came from a case-preserving source
|
|
6991
|
+
* (an XML/XHTML document imported via importNode(), or createAttributeNS()),
|
|
6992
|
+
* where e.g. `ONERROR` survives the walk: the policy check lowercases to
|
|
6993
|
+
* `onerror` and rejects it, but `removeAttribute('ONERROR')` looks up
|
|
6994
|
+
* `onerror` and finds nothing. Remove the exact Attr node instead, which is
|
|
6995
|
+
* case- and namespace-exact, and fall back to name-based removal only when
|
|
6996
|
+
* the caller could not supply the node.
|
|
6997
|
+
*
|
|
6998
|
+
* @param name an Attribute name
|
|
6999
|
+
* @param element a DOM node
|
|
7000
|
+
* @param attr the exact Attr node to remove, when the caller has it
|
|
7001
|
+
*/
|
|
7002
|
+
const _removeAttribute = function _removeAttribute(name, element, attr) {
|
|
7003
|
+
if (!attr) try {
|
|
7004
|
+
attr = element.getAttributeNode(name);
|
|
7005
|
+
} catch (_) {
|
|
7006
|
+
attr = null;
|
|
7007
|
+
}
|
|
7008
|
+
arrayPush(DOMPurify.removed, {
|
|
7009
|
+
attribute: attr || null,
|
|
7010
|
+
from: element
|
|
7011
|
+
});
|
|
7012
|
+
try {
|
|
7013
|
+
if (attr) removeAttributeNode(element, attr);
|
|
7014
|
+
else element.removeAttribute(name);
|
|
7015
|
+
} catch (_) {
|
|
7016
|
+
try {
|
|
7017
|
+
element.removeAttribute(name);
|
|
7018
|
+
} catch (_) {}
|
|
7019
|
+
}
|
|
7020
|
+
if (name === "is") if (RETURN_DOM || RETURN_DOM_FRAGMENT) try {
|
|
7021
|
+
_forceRemove(element);
|
|
7022
|
+
} catch (_) {}
|
|
7023
|
+
else try {
|
|
7024
|
+
element.setAttribute(name, "");
|
|
7025
|
+
} catch (_) {}
|
|
7026
|
+
};
|
|
7027
|
+
/**
|
|
7028
|
+
* _stripDisallowedAttributes
|
|
7029
|
+
*
|
|
7030
|
+
* Removes every attribute the active configuration does not allow from a
|
|
7031
|
+
* single element, using the same allowlist as the main attribute pass (so
|
|
7032
|
+
* `on*` handlers go, but no `/^on/` blocklist is introduced). Used only to
|
|
7033
|
+
* neutralise nodes that are being discarded from an in-place tree.
|
|
7034
|
+
*
|
|
7035
|
+
* @param element the element to strip
|
|
7036
|
+
*/
|
|
7037
|
+
const _stripDisallowedAttributes = function _stripDisallowedAttributes(element) {
|
|
7038
|
+
const attributes = getAttributes(element);
|
|
7039
|
+
if (!attributes) return;
|
|
7040
|
+
for (let i = attributes.length - 1; i >= 0; --i) {
|
|
7041
|
+
const attribute = attributes[i];
|
|
7042
|
+
const name = attribute && attribute.name;
|
|
7043
|
+
if (typeof name !== "string" || ALLOWED_ATTR[transformCaseFunc(name)]) continue;
|
|
7044
|
+
_stripAttributeNode(element, attribute, name);
|
|
7045
|
+
}
|
|
7046
|
+
};
|
|
7047
|
+
/**
|
|
7048
|
+
* _neutralizeSubtree
|
|
7049
|
+
*
|
|
7050
|
+
* Completes the audit-5 F1 fix across every removal path. The KEEP_CONTENT
|
|
7051
|
+
* move-hoist neutralises only disallowed-tag removals; clobber, mXSS-canary,
|
|
7052
|
+
* namespace, comment, processing-instruction and KEEP_CONTENT:false removals
|
|
7053
|
+
* all drop their subtree wholesale via `_forceRemove`. On the IN_PLACE path
|
|
7054
|
+
* those dropped nodes are detached from the caller's LIVE tree but a
|
|
7055
|
+
* handler-bearing original among them (an `<img onerror>`/`<video>` that was
|
|
7056
|
+
* loading) keeps its queued resource event, which fires in page scope after
|
|
7057
|
+
* sanitize returns. This walks a removed subtree and strips every attribute
|
|
7058
|
+
* the active configuration does not allow — so `on*` handlers are cancelled
|
|
7059
|
+
* through the SAME allowlist that governs kept nodes, not a separate `/^on/`
|
|
7060
|
+
* blocklist. Run synchronously before sanitize returns, i.e. before any
|
|
7061
|
+
* queued event can fire. Hook-free by design: these nodes leave the output,
|
|
7062
|
+
* so firing attribute hooks for them would be surprising. Clobber-safe reads;
|
|
7063
|
+
* a doomed clobbered node may shadow `removeAttribute` (its own attributes are
|
|
7064
|
+
* irrelevant — it is discarded — while its non-clobbered descendants, e.g.
|
|
7065
|
+
* the `<img>`, are reached and scrubbed).
|
|
7066
|
+
*
|
|
7067
|
+
* @param root the root of a removed subtree to neutralise
|
|
7068
|
+
*/
|
|
7069
|
+
const _neutralizeSubtree = function _neutralizeSubtree(root) {
|
|
7070
|
+
const stack = [root];
|
|
7071
|
+
while (stack.length > 0) {
|
|
7072
|
+
const node = stack.pop();
|
|
7073
|
+
if (_readNodeType(node) === NODE_TYPE.element) _stripDisallowedAttributes(node);
|
|
7074
|
+
const childNodes = getChildNodes(node);
|
|
7075
|
+
if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push(childNodes[i]);
|
|
7076
|
+
}
|
|
7077
|
+
};
|
|
7078
|
+
/**
|
|
7079
|
+
* _neutralizePatchLinkage
|
|
7080
|
+
*
|
|
7081
|
+
* IN_PLACE entry pre-pass (declarative-partial-updates / streaming
|
|
7082
|
+
* hardening, https://github.com/WICG/declarative-partial-updates).
|
|
7083
|
+
*
|
|
7084
|
+
* The main walk strips patch linkage (`for`/`patchsrc`) and removes range
|
|
7085
|
+
* markers (PIs / markup comments) node-by-node, in document order, AS it
|
|
7086
|
+
* reaches each node. On a live in-place root that leaves a window: from the
|
|
7087
|
+
* moment the root is connected until the walk arrives at a given node, that
|
|
7088
|
+
* node's linkage is live. A patch applied on connection/stream can fire as
|
|
7089
|
+
* a microtask during the walk and inject or teleport an unsanitized DOM
|
|
7090
|
+
* range into a region the iterator has already passed and will not revisit,
|
|
7091
|
+
* so the post-return "tree is sanitized" contract is violated. Sweep the
|
|
7092
|
+
* whole tree once up front and sever every linkage before the walk begins,
|
|
7093
|
+
* closing that window.
|
|
7094
|
+
*
|
|
7095
|
+
* This CANNOT undo a patch that already fired before sanitize ran — that is
|
|
7096
|
+
* the irreducible "do not IN_PLACE a live-connected attacker tree" caveat —
|
|
7097
|
+
* but it closes everything from sanitize-start onward. Gated on SAFE_FOR_XML
|
|
7098
|
+
* to group with the rest of the declarative-partial-updates handling and
|
|
7099
|
+
* stay overridable, consistent with the codebase.
|
|
7100
|
+
*
|
|
7101
|
+
* Clobber-safe traversal (cached childNodes getter); per-node try/catch so a
|
|
7102
|
+
* clobbered root cannot defeat the sweep of its non-clobbered descendants.
|
|
7103
|
+
*
|
|
7104
|
+
* NOTE (pending real-Chrome confirmation, see test/declarative-patch-probe
|
|
7105
|
+
* .html Q1): this mirrors the existing policy of keeping `for` on
|
|
7106
|
+
* <label>/<output>. If the shipping feature can drive a patch through a
|
|
7107
|
+
* surviving `for`-on-label/output + `id` pair, this pre-pass and the
|
|
7108
|
+
* attribute check at _isBasicCustomElement's caller must additionally drop
|
|
7109
|
+
* that pair on the IN_PLACE path. Left as-is until the taxonomy is verified.
|
|
7110
|
+
*
|
|
7111
|
+
* @param root the in-place root to sweep
|
|
7112
|
+
*/
|
|
7113
|
+
/**
|
|
7114
|
+
* Central policy for declarative-partial-updates patch-linkage attributes,
|
|
7115
|
+
* shared by the _neutralizePatchLinkage pre-pass and _isValidAttribute so
|
|
7116
|
+
* the two sites cannot drift: `patchsrc` always links, `for` links
|
|
7117
|
+
* everywhere except on <label>/<output>, and the whole policy is gated on
|
|
7118
|
+
* SAFE_FOR_XML (see the rationale block in _isValidAttribute).
|
|
7119
|
+
*
|
|
7120
|
+
* @param lcName the transformCaseFunc'd attribute name
|
|
7121
|
+
* @param lcTag the transformCaseFunc'd tag name of the carrying element
|
|
7122
|
+
* @return true if the attribute is patch linkage and must be dropped
|
|
7123
|
+
*/
|
|
7124
|
+
const _isPatchLinkageAttribute = function _isPatchLinkageAttribute(lcName, lcTag) {
|
|
7125
|
+
if (!SAFE_FOR_XML) return false;
|
|
7126
|
+
if (lcName === "patchsrc") return true;
|
|
7127
|
+
return lcName === "for" && lcTag !== "label" && lcTag !== "output";
|
|
7128
|
+
};
|
|
7129
|
+
const _neutralizePatchLinkage = function _neutralizePatchLinkage(root) {
|
|
7130
|
+
if (!SAFE_FOR_XML) return;
|
|
7131
|
+
const stack = [root];
|
|
7132
|
+
while (stack.length > 0) {
|
|
7133
|
+
const node = stack.pop();
|
|
7134
|
+
const nodeType = _readNodeType(node);
|
|
7135
|
+
if (nodeType === NODE_TYPE.processingInstruction || nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, node.data)) {
|
|
7136
|
+
try {
|
|
7137
|
+
remove(node);
|
|
7138
|
+
} catch (_) {}
|
|
7139
|
+
continue;
|
|
7140
|
+
}
|
|
7141
|
+
if (nodeType === NODE_TYPE.element) {
|
|
7142
|
+
const element = node;
|
|
7143
|
+
const lcTag = transformCaseFunc(_readNodeName(node));
|
|
7144
|
+
try {
|
|
7145
|
+
if (element.hasAttribute && element.hasAttribute("patchsrc")) element.removeAttribute("patchsrc");
|
|
7146
|
+
if (element.hasAttribute && element.hasAttribute("for") && _isPatchLinkageAttribute("for", lcTag)) element.removeAttribute("for");
|
|
7147
|
+
} catch (_) {}
|
|
7148
|
+
}
|
|
7149
|
+
const childNodes = getChildNodes(node);
|
|
7150
|
+
if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push(childNodes[i]);
|
|
7151
|
+
}
|
|
7152
|
+
};
|
|
7153
|
+
/**
|
|
7154
|
+
* _initDocument
|
|
7155
|
+
*
|
|
7156
|
+
* @param dirty - a string of dirty markup
|
|
7157
|
+
* @return a DOM, filled with the dirty markup
|
|
7158
|
+
*/
|
|
7159
|
+
const _initDocument = function _initDocument(dirty) {
|
|
7160
|
+
let doc = null;
|
|
7161
|
+
let leadingWhitespace = null;
|
|
7162
|
+
if (FORCE_BODY) dirty = "<remove></remove>" + dirty;
|
|
7163
|
+
else {
|
|
7164
|
+
const matches = stringMatch(dirty, /^[\r\n\t ]+/);
|
|
7165
|
+
leadingWhitespace = matches && matches[0];
|
|
7166
|
+
}
|
|
7167
|
+
if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) dirty = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + dirty + "</body></html>";
|
|
7168
|
+
const dirtyPayload = trustedTypesPolicy ? _createTrustedHTML(dirty) : dirty;
|
|
7169
|
+
if (NAMESPACE === HTML_NAMESPACE) try {
|
|
7170
|
+
doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
|
|
7171
|
+
} catch (_) {}
|
|
7172
|
+
if (!doc || !doc.documentElement) {
|
|
7173
|
+
doc = implementation.createDocument(NAMESPACE, "template", null);
|
|
7174
|
+
try {
|
|
7175
|
+
doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
|
|
7176
|
+
} catch (_) {}
|
|
7177
|
+
}
|
|
7178
|
+
const body = doc.body || doc.documentElement;
|
|
7179
|
+
if (dirty && leadingWhitespace) body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
|
|
7180
|
+
if (NAMESPACE === HTML_NAMESPACE) return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
|
|
7181
|
+
return WHOLE_DOCUMENT ? doc.documentElement : body;
|
|
7182
|
+
};
|
|
7183
|
+
/**
|
|
7184
|
+
* Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
|
|
7185
|
+
*
|
|
7186
|
+
* @param root The root element or node to start traversing on.
|
|
7187
|
+
* @return The created NodeIterator
|
|
7188
|
+
*/
|
|
7189
|
+
const _createNodeIterator = function _createNodeIterator(root) {
|
|
7190
|
+
const doc = getOwnerDocument ? getOwnerDocument(root) : root.ownerDocument;
|
|
7191
|
+
return createNodeIterator.call(doc || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
|
|
7192
|
+
};
|
|
7193
|
+
/**
|
|
7194
|
+
* Replace template expression syntax (mustache, ERB, template
|
|
7195
|
+
* literal) with a space; shared by all SAFE_FOR_TEMPLATES scrub
|
|
7196
|
+
* sites. Order matters: mustache, then ERB, then template literal.
|
|
7197
|
+
*
|
|
7198
|
+
* @param value the string to scrub
|
|
7199
|
+
* @returns the scrubbed string
|
|
7200
|
+
*/
|
|
7201
|
+
const _stripTemplateExpressions = function _stripTemplateExpressions(value) {
|
|
7202
|
+
value = stringReplace(value, MUSTACHE_EXPR$1, " ");
|
|
7203
|
+
value = stringReplace(value, ERB_EXPR$1, " ");
|
|
7204
|
+
value = stringReplace(value, TMPLIT_EXPR$1, " ");
|
|
7205
|
+
return value;
|
|
7206
|
+
};
|
|
7207
|
+
/**
|
|
7208
|
+
* Strip template-engine expressions ({{...}}, ${...}, <%...%>) from the
|
|
7209
|
+
* character data of an element subtree. Used as the final safety net for
|
|
7210
|
+
* SAFE_FOR_TEMPLATES on every DOM-returning code path so that expressions
|
|
7211
|
+
* which only form after text-node normalization (e.g. fragments split across
|
|
7212
|
+
* stripped elements) cannot survive into a template-evaluating framework.
|
|
7213
|
+
*
|
|
7214
|
+
* Walks text/comment/CDATA/processing-instruction nodes and mutates `.data`
|
|
7215
|
+
* in place rather than round-tripping through innerHTML. This preserves
|
|
7216
|
+
* descendant node references (important for IN_PLACE callers), avoids a
|
|
7217
|
+
* serialize/reparse cycle, and reads literal character data — which means
|
|
7218
|
+
* `<%...%>` in text content matches the ERB regex against its real bytes
|
|
7219
|
+
* instead of the HTML-entity-escaped form innerHTML would produce.
|
|
7220
|
+
*
|
|
7221
|
+
* Attribute values are not visited here; SAFE_FOR_TEMPLATES handling for
|
|
7222
|
+
* attributes is performed during the per-node `_sanitizeAttributes` pass.
|
|
7223
|
+
*
|
|
7224
|
+
* @param node The root element whose character data should be scrubbed.
|
|
7225
|
+
*/
|
|
7226
|
+
const _scrubTemplateExpressions2 = function _scrubTemplateExpressions(node) {
|
|
7227
|
+
var _node$querySelectorAl;
|
|
7228
|
+
node.normalize();
|
|
7229
|
+
const doc = getOwnerDocument ? getOwnerDocument(node) : node.ownerDocument;
|
|
7230
|
+
const walker = createNodeIterator.call(doc || node, node, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_PROCESSING_INSTRUCTION, null);
|
|
7231
|
+
let currentNode = walker.nextNode();
|
|
7232
|
+
while (currentNode) {
|
|
7233
|
+
currentNode.data = _stripTemplateExpressions(currentNode.data);
|
|
7234
|
+
currentNode = walker.nextNode();
|
|
7235
|
+
}
|
|
7236
|
+
const templates = (_node$querySelectorAl = node.querySelectorAll) === null || _node$querySelectorAl === void 0 ? void 0 : _node$querySelectorAl.call(node, "template");
|
|
7237
|
+
if (templates) arrayForEach(templates, (tmpl) => {
|
|
7238
|
+
if (_isDocumentFragment(tmpl.content)) _scrubTemplateExpressions2(tmpl.content);
|
|
7239
|
+
});
|
|
7240
|
+
};
|
|
7241
|
+
/**
|
|
7242
|
+
* _isClobbered
|
|
7243
|
+
*
|
|
7244
|
+
* Detect DOM-clobbering on HTMLFormElement nodes. Form is the only HTML
|
|
7245
|
+
* interface with [LegacyOverrideBuiltIns]; a descendant element with a
|
|
7246
|
+
* `name` attribute matching a prototype property shadows that property
|
|
7247
|
+
* on direct reads. We use this check at the IN_PLACE entry-point and
|
|
7248
|
+
* during attribute sanitization to refuse clobbered forms.
|
|
7249
|
+
*
|
|
7250
|
+
* @param element element to check for clobbering attacks
|
|
7251
|
+
* @return true if clobbered, false if safe
|
|
7252
|
+
*/
|
|
7253
|
+
const _isClobbered = function _isClobbered(element) {
|
|
7254
|
+
const realTagName = getNodeName ? getNodeName(element) : null;
|
|
7255
|
+
if (typeof realTagName !== "string") return false;
|
|
7256
|
+
if (transformCaseFunc(realTagName) !== "form") return false;
|
|
7257
|
+
return typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || element.attributes !== getAttributes(element) || typeof element.removeAttribute !== "function" || typeof element.removeAttributeNode !== "function" || typeof element.getAttributeNode !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function" || element.nodeType !== getNodeType(element) || element.childNodes !== getChildNodes(element);
|
|
7258
|
+
};
|
|
7259
|
+
/**
|
|
7260
|
+
* Checks whether the given value is a DocumentFragment from any realm.
|
|
7261
|
+
*
|
|
7262
|
+
* The realm-independent replacement reads `nodeType` through the cached
|
|
7263
|
+
* Node.prototype getter and compares to the DOCUMENT_FRAGMENT_NODE
|
|
7264
|
+
* constant (11). nodeType is a numeric value resolved from the node's
|
|
7265
|
+
* internal slot, identical across realms for the same kind of node.
|
|
7266
|
+
*
|
|
7267
|
+
* @param value object to check
|
|
7268
|
+
* @return true if value is a DocumentFragment-shaped node from any realm
|
|
7269
|
+
*/
|
|
7270
|
+
const _isDocumentFragment = function _isDocumentFragment(value) {
|
|
7271
|
+
if (!getNodeType || typeof value !== "object" || value === null) return false;
|
|
7272
|
+
try {
|
|
7273
|
+
return getNodeType(value) === NODE_TYPE.documentFragment;
|
|
7274
|
+
} catch (_) {
|
|
7275
|
+
return false;
|
|
7276
|
+
}
|
|
7277
|
+
};
|
|
7278
|
+
/**
|
|
7279
|
+
* Checks whether the given object is a DOM node, including nodes that
|
|
7280
|
+
* originate from a different window/realm (e.g. an iframe's
|
|
7281
|
+
* contentDocument). The previous `value instanceof Node` check was
|
|
7282
|
+
* realm-bound: nodes from a different window failed it, causing
|
|
7283
|
+
* sanitize() to silently stringify them and reset IN_PLACE to false,
|
|
7284
|
+
* returning the original node unsanitized. See GHSA-4w3q-35jp-p934.
|
|
7285
|
+
*
|
|
7286
|
+
* @param value object to check whether it's a DOM node
|
|
7287
|
+
* @return true if value is a DOM node from any realm
|
|
7288
|
+
*/
|
|
7289
|
+
const _isNode = function _isNode(value) {
|
|
7290
|
+
if (!getNodeType || typeof value !== "object" || value === null) return false;
|
|
7291
|
+
try {
|
|
7292
|
+
return typeof getNodeType(value) === "number";
|
|
7293
|
+
} catch (_) {
|
|
7294
|
+
return false;
|
|
7295
|
+
}
|
|
7296
|
+
};
|
|
7297
|
+
function _executeHooks(hooks, currentNode, data) {
|
|
7298
|
+
if (hooks.length === 0) return;
|
|
7299
|
+
arrayForEach(hooks, (hook) => {
|
|
7300
|
+
hook.call(DOMPurify, currentNode, data, CONFIG);
|
|
7301
|
+
});
|
|
7302
|
+
}
|
|
7303
|
+
/**
|
|
7304
|
+
* Structural-threat checks that condemn a node regardless of the
|
|
7305
|
+
* allowlists: mXSS via namespace confusion, risky CSS construction,
|
|
7306
|
+
* processing instructions, markup-bearing comments. Pure predicate;
|
|
7307
|
+
* the caller removes. Check order is load-bearing.
|
|
7308
|
+
*
|
|
7309
|
+
* @param currentNode the node to inspect
|
|
7310
|
+
* @param tagName the node's transformCaseFunc'd tag name
|
|
7311
|
+
* @return true if the node must be removed
|
|
7312
|
+
*/
|
|
7313
|
+
const _isUnsafeNode = function _isUnsafeNode(currentNode, tagName) {
|
|
7314
|
+
if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML)) return true;
|
|
7315
|
+
if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && LITERAL_TEXT_ELEMENTS[tagName] && (_isNode(currentNode.firstElementChild) || typeof currentNode.textContent === "string" && regExpTest(LITERAL_TEXT_CLOSE[tagName], currentNode.textContent))) return true;
|
|
7316
|
+
if (currentNode.nodeType === NODE_TYPE.processingInstruction) return true;
|
|
7317
|
+
if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, currentNode.data)) return true;
|
|
7318
|
+
return false;
|
|
7319
|
+
};
|
|
7320
|
+
/**
|
|
7321
|
+
* Evaluate a CUSTOM_ELEMENT_HANDLING check (a RegExp or a predicate
|
|
7322
|
+
* function, per the validation in _parseConfig) against a name.
|
|
7323
|
+
* Additional arguments are forwarded to predicate functions - the
|
|
7324
|
+
* attributeNameCheck predicate receives the tag name as its second
|
|
7325
|
+
* argument. A null/absent check never matches.
|
|
7326
|
+
*
|
|
7327
|
+
* @param check the configured tagNameCheck / attributeNameCheck value
|
|
7328
|
+
* @param name the name to test
|
|
7329
|
+
* @param args extra arguments forwarded to a predicate function
|
|
7330
|
+
* @return true if the check matches the name
|
|
7331
|
+
*/
|
|
7332
|
+
const _matchesNameCheck = function _matchesNameCheck(check, name) {
|
|
7333
|
+
if (check instanceof RegExp) return regExpTest(check, name);
|
|
7334
|
+
if (check instanceof Function) {
|
|
7335
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) args[_key - 2] = arguments[_key];
|
|
7336
|
+
return Boolean(check(name, ...args));
|
|
7337
|
+
}
|
|
7338
|
+
return false;
|
|
7339
|
+
};
|
|
7340
|
+
/**
|
|
7341
|
+
* Handle a node whose tag is forbidden or not allowlisted: keep
|
|
7342
|
+
* allowed custom elements (false return exits _sanitizeElements
|
|
7343
|
+
* early - the namespace and fallback-tag removal checks are
|
|
7344
|
+
* intentionally skipped for kept custom elements), else hoist
|
|
7345
|
+
* content per KEEP_CONTENT and remove.
|
|
7346
|
+
*
|
|
7347
|
+
* A kept custom element is the ONLY case in which this function
|
|
7348
|
+
* returns false, so the caller uses that return value to run the
|
|
7349
|
+
* afterSanitizeElements hook on the kept element and keep the
|
|
7350
|
+
* element-hook lifecycle consistent with normal allowlisted
|
|
7351
|
+
* elements (GHSA-c2j3-45gr-mqc4).
|
|
7352
|
+
*
|
|
7353
|
+
* @param currentNode the disallowed node
|
|
7354
|
+
* @param tagName the node's transformCaseFunc'd tag name
|
|
7355
|
+
* @return true if the node was removed, false if kept
|
|
7356
|
+
*/
|
|
7357
|
+
const _sanitizeDisallowedNode = function _sanitizeDisallowedNode(currentNode, tagName, root) {
|
|
7358
|
+
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
|
|
7359
|
+
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
|
7360
|
+
const parentNode = getParentNode(currentNode);
|
|
7361
|
+
const childNodes = getChildNodes(currentNode);
|
|
7362
|
+
if (childNodes && parentNode) {
|
|
7363
|
+
const childCount = childNodes.length;
|
|
7364
|
+
for (let i = childCount - 1; i >= 0; --i) {
|
|
7365
|
+
const hoisted = currentNode === root ? cloneNode(childNodes[i], true) : childNodes[i];
|
|
7366
|
+
parentNode.insertBefore(hoisted, getNextSibling(currentNode));
|
|
7367
|
+
}
|
|
7368
|
+
}
|
|
7369
|
+
}
|
|
7370
|
+
_forceRemove(currentNode);
|
|
7371
|
+
return true;
|
|
7372
|
+
};
|
|
7373
|
+
/**
|
|
7374
|
+
* Fork a hook-mutable allowlist off its shared binding the first time a
|
|
7375
|
+
* (possibly lazily-installed) uponSanitize* hook is about to see it, so the
|
|
7376
|
+
* hook cannot widen the per-instance default or the setConfig binding by
|
|
7377
|
+
* reference and leak past the call. Returns the set unchanged once it is
|
|
7378
|
+
* already call-local, so repeated calls across elements are idempotent.
|
|
7379
|
+
*
|
|
7380
|
+
* @param hookList the uponSanitize* hook array for this event
|
|
7381
|
+
* @param set the current ALLOWED_TAGS / ALLOWED_ATTR binding
|
|
7382
|
+
* @param defaultSet the per-instance DEFAULT_ALLOWED_* constant
|
|
7383
|
+
* @param setConfigSet the captured setConfig() binding, or null
|
|
7384
|
+
* @return a call-local clone if a hook is present and set is still shared,
|
|
7385
|
+
* else set unchanged
|
|
7386
|
+
*/
|
|
7387
|
+
const _forkSharedAllowlist = function _forkSharedAllowlist(hookList, set, defaultSet, setConfigSet) {
|
|
7388
|
+
if (hookList.length === 0) return set;
|
|
7389
|
+
return set === defaultSet || set === setConfigSet ? clone(set) : set;
|
|
7390
|
+
};
|
|
7391
|
+
/**
|
|
7392
|
+
* Shared guard for a node that a hook has detached from the walk tree,
|
|
7393
|
+
* used after each element-hook site in _sanitizeElements. Detaching is a
|
|
7394
|
+
* long-standing user pattern (issue #469; draw.io-style foreignObject
|
|
7395
|
+
* filtering). Per the cached, unclobberable parentNode getter the node is
|
|
7396
|
+
* genuinely out of the tree, so it can reach neither the serialized
|
|
7397
|
+
* output nor an IN_PLACE live tree; treat it as removed and stop
|
|
7398
|
+
* processing it. Without this guard, the unsafe-node / namespace checks
|
|
7399
|
+
* would call _forceRemove on a parentless node and hit the REPORT-3
|
|
7400
|
+
* fail-closed throw — which exists for nodes DOMPurify wants gone but
|
|
7401
|
+
* *cannot* detach (clobbered / parentless roots), the opposite of a node
|
|
7402
|
+
* that is already safely gone. The walk root is exempt: a detached
|
|
7403
|
+
* IN_PLACE root is legitimate input and must still be fully sanitized,
|
|
7404
|
+
* and a kill-decision on it must keep hitting the REPORT-3 throw.
|
|
7405
|
+
*
|
|
7406
|
+
* Nodes detached by hooks stay the hook's responsibility for placement:
|
|
7407
|
+
* they are not recorded in DOMPurify.removed, so the post-walk IN_PLACE
|
|
7408
|
+
* pass (which iterates DOMPurify.removed) does not reach them. But a
|
|
7409
|
+
* hook-detached subtree can still hold a queued resource-event handler -
|
|
7410
|
+
* e.g. an <img onload> that began loading when the caller built the live
|
|
7411
|
+
* tree - which fires in page scope after sanitize returns even though the
|
|
7412
|
+
* handler never reached the returned tree. That is the audit-5 F1 hazard,
|
|
7413
|
+
* and the documented node.remove() hook pattern walks straight into it.
|
|
7414
|
+
* So on the IN_PLACE path we neutralize the detached subtree inline,
|
|
7415
|
+
* stripping its non-allow-listed attributes before returning, exactly as
|
|
7416
|
+
* the post-walk pass does for _forceRemove'd subtrees.
|
|
7417
|
+
*
|
|
7418
|
+
* @param currentNode the node a hook may have detached
|
|
7419
|
+
* @param root the current walk root
|
|
7420
|
+
* @return true if the node is detached and now handled, false otherwise
|
|
7421
|
+
*/
|
|
7422
|
+
const _handleHookDetachedNode = function _handleHookDetachedNode(currentNode, root) {
|
|
7423
|
+
if (currentNode === root || getParentNode(currentNode) !== null) return false;
|
|
7424
|
+
if (IN_PLACE) _neutralizeSubtree(currentNode);
|
|
7425
|
+
return true;
|
|
7426
|
+
};
|
|
7427
|
+
/**
|
|
7428
|
+
* _sanitizeElements
|
|
7429
|
+
*
|
|
7430
|
+
* @protect nodeName
|
|
7431
|
+
* @protect textContent
|
|
7432
|
+
* @protect removeChild
|
|
7433
|
+
* @param currentNode to check for permission to exist
|
|
7434
|
+
* @return true if node was killed, false if left alive
|
|
7435
|
+
*/
|
|
7436
|
+
const _sanitizeElements = function _sanitizeElements(currentNode, root) {
|
|
7437
|
+
_executeHooks(hooks.beforeSanitizeElements, currentNode, null);
|
|
7438
|
+
if (_handleHookDetachedNode(currentNode, root)) return true;
|
|
7439
|
+
if (_isClobbered(currentNode)) {
|
|
7440
|
+
_forceRemove(currentNode);
|
|
7441
|
+
return true;
|
|
7442
|
+
}
|
|
7443
|
+
const tagName = transformCaseFunc(_readNodeName(currentNode));
|
|
7444
|
+
ALLOWED_TAGS = _forkSharedAllowlist(hooks.uponSanitizeElement, ALLOWED_TAGS, DEFAULT_ALLOWED_TAGS, SET_CONFIG_ALLOWED_TAGS);
|
|
7445
|
+
_executeHooks(hooks.uponSanitizeElement, currentNode, {
|
|
7446
|
+
tagName,
|
|
7447
|
+
allowedTags: ALLOWED_TAGS
|
|
7448
|
+
});
|
|
7449
|
+
if (_handleHookDetachedNode(currentNode, root)) return true;
|
|
7450
|
+
if (_isUnsafeNode(currentNode, tagName)) {
|
|
7451
|
+
_forceRemove(currentNode);
|
|
7452
|
+
return true;
|
|
7453
|
+
}
|
|
7454
|
+
if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
|
|
7455
|
+
const removed = _sanitizeDisallowedNode(currentNode, tagName, root);
|
|
7456
|
+
if (removed === false) {
|
|
7457
|
+
_executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
|
7458
|
+
if (_handleHookDetachedNode(currentNode, root)) return true;
|
|
7459
|
+
}
|
|
7460
|
+
return removed;
|
|
7461
|
+
}
|
|
7462
|
+
if (_readNodeType(currentNode) === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
|
|
7463
|
+
_forceRemove(currentNode);
|
|
7464
|
+
return true;
|
|
7465
|
+
}
|
|
7466
|
+
if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(FALLBACK_TAG_CLOSE, currentNode.innerHTML)) {
|
|
7467
|
+
_forceRemove(currentNode);
|
|
7468
|
+
return true;
|
|
7469
|
+
}
|
|
7470
|
+
if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
|
|
7471
|
+
const content = _stripTemplateExpressions(currentNode.textContent);
|
|
7472
|
+
if (currentNode.textContent !== content) {
|
|
7473
|
+
arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() });
|
|
7474
|
+
currentNode.textContent = content;
|
|
7475
|
+
}
|
|
7476
|
+
}
|
|
7477
|
+
_executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
|
7478
|
+
return _handleHookDetachedNode(currentNode, root);
|
|
7479
|
+
};
|
|
7480
|
+
/**
|
|
7481
|
+
* _isValidAttribute
|
|
7482
|
+
*
|
|
7483
|
+
* @param lcTag Lowercase tag name of containing element.
|
|
7484
|
+
* @param lcName Lowercase attribute name.
|
|
7485
|
+
* @param value Attribute value.
|
|
7486
|
+
* @return Returns true if `value` is valid, otherwise false.
|
|
7487
|
+
*/
|
|
7488
|
+
const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
|
|
7489
|
+
if (FORBID_ATTR[lcName]) return false;
|
|
7490
|
+
if (_isPatchLinkageAttribute(lcName, lcTag)) return false;
|
|
7491
|
+
if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document || value in formElement)) return false;
|
|
7492
|
+
const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
|
|
7493
|
+
if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$1, lcName)) return true;
|
|
7494
|
+
if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) return true;
|
|
7495
|
+
if (!nameIsPermitted) return _isBasicCustomElement(lcTag) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName, lcTag) || lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value);
|
|
7496
|
+
if (URI_SAFE_ATTRIBUTES[lcName]) return true;
|
|
7497
|
+
if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) return true;
|
|
7498
|
+
if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) return true;
|
|
7499
|
+
if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) return true;
|
|
7500
|
+
return !value;
|
|
7501
|
+
};
|
|
7502
|
+
const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, [
|
|
7503
|
+
"annotation-xml",
|
|
7504
|
+
"color-profile",
|
|
7505
|
+
"font-face",
|
|
7506
|
+
"font-face-format",
|
|
7507
|
+
"font-face-name",
|
|
7508
|
+
"font-face-src",
|
|
7509
|
+
"font-face-uri",
|
|
7510
|
+
"missing-glyph"
|
|
7511
|
+
]);
|
|
7512
|
+
/**
|
|
7513
|
+
* _isBasicCustomElement
|
|
7514
|
+
* checks if at least one dash is included in tagName, and it's not the first char
|
|
7515
|
+
* for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
|
|
7516
|
+
*
|
|
7517
|
+
* @param tagName name of the tag of the node to sanitize
|
|
7518
|
+
* @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
|
|
7519
|
+
*/
|
|
7520
|
+
const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
|
|
7521
|
+
return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName);
|
|
7522
|
+
};
|
|
7523
|
+
/**
|
|
7524
|
+
* Wrap an attribute value in the matching Trusted Types object when
|
|
7525
|
+
* the active policy requires it. Namespaced attributes pass through
|
|
7526
|
+
* unchanged (no TT support yet, see
|
|
7527
|
+
* https://bugs.chromium.org/p/chromium/issues/detail?id=1305293).
|
|
7528
|
+
*
|
|
7529
|
+
* @param lcTag lowercase tag name of the containing element
|
|
7530
|
+
* @param lcName lowercase attribute name
|
|
7531
|
+
* @param namespaceURI the attribute's namespace, if any
|
|
7532
|
+
* @param value the attribute value to wrap
|
|
7533
|
+
* @return the value, wrapped when Trusted Types demand it
|
|
7534
|
+
*/
|
|
7535
|
+
const _applyTrustedTypesToAttribute = function _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value) {
|
|
7536
|
+
if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function" && !namespaceURI) switch (trustedTypes.getAttributeType(lcTag, lcName)) {
|
|
7537
|
+
case "TrustedHTML": return _createTrustedHTML(value);
|
|
7538
|
+
case "TrustedScriptURL": return _createTrustedScriptURL(value);
|
|
7539
|
+
}
|
|
7540
|
+
return value;
|
|
7541
|
+
};
|
|
7542
|
+
/**
|
|
7543
|
+
* Write a modified attribute value back onto the element. On
|
|
7544
|
+
* success, re-probe for clobbering introduced by the new value and
|
|
7545
|
+
* remove the element when found; otherwise, when this writeback is the
|
|
7546
|
+
* recreate half of the SANITIZE_NAMED_PROPS remove-and-recreate, pop the
|
|
7547
|
+
* removal entry that path recorded so it does not show as removed. On
|
|
7548
|
+
* failure, remove the attribute instead.
|
|
7549
|
+
*
|
|
7550
|
+
* Returns true only on a clean write (the value was set and the new value
|
|
7551
|
+
* introduced no clobbering). The caller uses that, together with its own
|
|
7552
|
+
* knowledge of whether this attribute pushed a DOMPurify.removed record, to
|
|
7553
|
+
* decide whether to pop that record. The pop must happen ONLY for the
|
|
7554
|
+
* named-prop remove-and-recreate; popping on any other value change (trim,
|
|
7555
|
+
* template scrubbing, Trusted Types) would consume an unrelated _forceRemove
|
|
7556
|
+
* subtree-cleanup record and let that detached subtree keep a live event
|
|
7557
|
+
* handler through the IN_PLACE neutralization pass (SO-001).
|
|
7558
|
+
*
|
|
7559
|
+
* @param currentNode the element carrying the attribute
|
|
7560
|
+
* @param name the attribute name as present on the element
|
|
7561
|
+
* @param namespaceURI the attribute's namespace, if any
|
|
7562
|
+
* @param value the new attribute value
|
|
7563
|
+
* @return true if the value was written without introducing clobbering
|
|
7564
|
+
*/
|
|
7565
|
+
const _setAttributeValue = function _setAttributeValue(currentNode, name, namespaceURI, value) {
|
|
7566
|
+
try {
|
|
7567
|
+
if (namespaceURI) currentNode.setAttributeNS(namespaceURI, name, value);
|
|
7568
|
+
else currentNode.setAttribute(name, value);
|
|
7569
|
+
if (_isClobbered(currentNode)) {
|
|
7570
|
+
_forceRemove(currentNode);
|
|
7571
|
+
return false;
|
|
7572
|
+
}
|
|
7573
|
+
return true;
|
|
7574
|
+
} catch (_) {
|
|
7575
|
+
_removeAttribute(name, currentNode);
|
|
7576
|
+
return false;
|
|
7577
|
+
}
|
|
7578
|
+
};
|
|
7579
|
+
/**
|
|
7580
|
+
* _sanitizeAttributes
|
|
7581
|
+
*
|
|
7582
|
+
* @protect attributes
|
|
7583
|
+
* @protect nodeName
|
|
7584
|
+
* @protect removeAttribute
|
|
7585
|
+
* @protect setAttribute
|
|
7586
|
+
*
|
|
7587
|
+
* @param currentNode to sanitize
|
|
7588
|
+
* @param root the current walk root
|
|
7589
|
+
*/
|
|
7590
|
+
const _sanitizeAttributes = function _sanitizeAttributes(currentNode, root) {
|
|
7591
|
+
_executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
|
|
7592
|
+
if (_handleHookDetachedNode(currentNode, root)) return;
|
|
7593
|
+
const attributes = currentNode.attributes;
|
|
7594
|
+
if (!attributes || _isClobbered(currentNode)) return;
|
|
7595
|
+
ALLOWED_ATTR = _forkSharedAllowlist(hooks.uponSanitizeAttribute, ALLOWED_ATTR, DEFAULT_ALLOWED_ATTR, SET_CONFIG_ALLOWED_ATTR);
|
|
7596
|
+
const hookEvent = {
|
|
7597
|
+
attrName: "",
|
|
7598
|
+
attrValue: "",
|
|
7599
|
+
keepAttr: true,
|
|
7600
|
+
allowedAttributes: ALLOWED_ATTR,
|
|
7601
|
+
forceKeepAttr: void 0
|
|
7602
|
+
};
|
|
7603
|
+
let l = attributes.length;
|
|
7604
|
+
const lcTag = transformCaseFunc(currentNode.nodeName);
|
|
7605
|
+
while (l--) {
|
|
7606
|
+
const attr = attributes[l];
|
|
7607
|
+
const name = attr.name, namespaceURI = attr.namespaceURI, attrValue = attr.value;
|
|
7608
|
+
const lcName = transformCaseFunc(name);
|
|
7609
|
+
const initValue = attrValue;
|
|
7610
|
+
let value = name === "value" ? initValue : stringTrim(initValue);
|
|
7611
|
+
let recreatedNamedProp = false;
|
|
7612
|
+
hookEvent.attrName = lcName;
|
|
7613
|
+
hookEvent.attrValue = value;
|
|
7614
|
+
hookEvent.keepAttr = true;
|
|
7615
|
+
hookEvent.forceKeepAttr = void 0;
|
|
7616
|
+
_executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
|
|
7617
|
+
value = hookEvent.attrValue;
|
|
7618
|
+
if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
|
|
7619
|
+
_removeAttribute(name, currentNode, attr);
|
|
7620
|
+
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
7621
|
+
recreatedNamedProp = true;
|
|
7622
|
+
}
|
|
7623
|
+
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
|
|
7624
|
+
_removeAttribute(name, currentNode, attr);
|
|
7625
|
+
continue;
|
|
7626
|
+
}
|
|
7627
|
+
if (lcName === "attributename" && stringMatch(value, "href")) {
|
|
7628
|
+
_removeAttribute(name, currentNode, attr);
|
|
7629
|
+
continue;
|
|
7630
|
+
}
|
|
7631
|
+
if (hookEvent.forceKeepAttr) continue;
|
|
7632
|
+
if (!hookEvent.keepAttr) {
|
|
7633
|
+
_removeAttribute(name, currentNode, attr);
|
|
7634
|
+
continue;
|
|
7635
|
+
}
|
|
7636
|
+
if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(SELF_CLOSING_TAG, value)) {
|
|
7637
|
+
_removeAttribute(name, currentNode, attr);
|
|
7638
|
+
continue;
|
|
7639
|
+
}
|
|
7640
|
+
if (SAFE_FOR_TEMPLATES) value = _stripTemplateExpressions(value);
|
|
7641
|
+
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
7642
|
+
_removeAttribute(name, currentNode, attr);
|
|
7643
|
+
continue;
|
|
7644
|
+
}
|
|
7645
|
+
value = _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value);
|
|
7646
|
+
if (value !== initValue) {
|
|
7647
|
+
if (_setAttributeValue(currentNode, name, namespaceURI, value) && recreatedNamedProp) arrayPop(DOMPurify.removed);
|
|
7648
|
+
}
|
|
7649
|
+
}
|
|
7650
|
+
_executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
|
|
7651
|
+
_handleHookDetachedNode(currentNode, root);
|
|
7652
|
+
};
|
|
7653
|
+
/**
|
|
7654
|
+
* _sanitizeShadowDOM
|
|
7655
|
+
*
|
|
7656
|
+
* @param fragment to iterate over recursively
|
|
7657
|
+
*/
|
|
7658
|
+
const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
|
|
7659
|
+
let shadowNode = null;
|
|
7660
|
+
const shadowIterator = _createNodeIterator(fragment);
|
|
7661
|
+
_executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
|
|
7662
|
+
while (shadowNode = shadowIterator.nextNode()) {
|
|
7663
|
+
_executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
|
|
7664
|
+
_sanitizeElements(shadowNode, fragment);
|
|
7665
|
+
_sanitizeAttributes(shadowNode, fragment);
|
|
7666
|
+
if (_isDocumentFragment(shadowNode.content)) _sanitizeShadowDOM2(shadowNode.content);
|
|
7667
|
+
if (_readNodeType(shadowNode) === NODE_TYPE.element) {
|
|
7668
|
+
const innerSr = getShadowRoot(shadowNode);
|
|
7669
|
+
if (_isDocumentFragment(innerSr)) {
|
|
7670
|
+
_sanitizeAttachedShadowRoots(innerSr);
|
|
7671
|
+
_sanitizeShadowDOM2(innerSr);
|
|
7672
|
+
}
|
|
7673
|
+
}
|
|
7674
|
+
}
|
|
7675
|
+
_executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
|
|
7676
|
+
};
|
|
7677
|
+
/**
|
|
7678
|
+
* _sanitizeAttachedShadowRoots
|
|
7679
|
+
*
|
|
7680
|
+
* Walks `root` and feeds every attached shadow root we encounter into
|
|
7681
|
+
* the existing _sanitizeShadowDOM pipeline. The default node iterator
|
|
7682
|
+
* does not descend into shadow trees, so nodes inside an attached
|
|
7683
|
+
* shadow root would otherwise be skipped entirely.
|
|
7684
|
+
*
|
|
7685
|
+
* Two real input paths put attached shadow roots in front of us:
|
|
7686
|
+
* 1. IN_PLACE on a DOM node that already has shadow roots attached.
|
|
7687
|
+
* 2. DOM-node input where importNode(dirty, true) deep-clones the
|
|
7688
|
+
* shadow root because it was created with `clonable: true`.
|
|
7689
|
+
*
|
|
7690
|
+
* This pass runs once, up front, so the main iteration loop (and the
|
|
7691
|
+
* existing _sanitizeShadowDOM template-content recursion) stay
|
|
7692
|
+
* untouched — string-input paths are not affected.
|
|
7693
|
+
*
|
|
7694
|
+
* @param root the subtree root to walk for attached shadow roots
|
|
7695
|
+
*/
|
|
7696
|
+
const _sanitizeAttachedShadowRoots = function _sanitizeAttachedShadowRoots(root) {
|
|
7697
|
+
const stack = [{
|
|
7698
|
+
node: root,
|
|
7699
|
+
shadow: null
|
|
7700
|
+
}];
|
|
7701
|
+
while (stack.length > 0) {
|
|
7702
|
+
const item = stack.pop();
|
|
7703
|
+
if (item.shadow) {
|
|
7704
|
+
_sanitizeShadowDOM2(item.shadow);
|
|
7705
|
+
continue;
|
|
7706
|
+
}
|
|
7707
|
+
const node = item.node;
|
|
7708
|
+
const isElement = _readNodeType(node) === NODE_TYPE.element;
|
|
7709
|
+
const childNodes = getChildNodes(node);
|
|
7710
|
+
if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push({
|
|
7711
|
+
node: childNodes[i],
|
|
7712
|
+
shadow: null
|
|
7713
|
+
});
|
|
7714
|
+
if (isElement) {
|
|
7715
|
+
const rootName = getNodeName ? getNodeName(node) : null;
|
|
7716
|
+
if (typeof rootName === "string" && transformCaseFunc(rootName) === "template") {
|
|
7717
|
+
const content = node.content;
|
|
7718
|
+
if (_isDocumentFragment(content)) stack.push({
|
|
7719
|
+
node: content,
|
|
7720
|
+
shadow: null
|
|
7721
|
+
});
|
|
7722
|
+
}
|
|
7723
|
+
}
|
|
7724
|
+
if (isElement) {
|
|
7725
|
+
const sr = getShadowRoot(node);
|
|
7726
|
+
if (_isDocumentFragment(sr)) stack.push({
|
|
7727
|
+
node: null,
|
|
7728
|
+
shadow: sr
|
|
7729
|
+
}, {
|
|
7730
|
+
node: sr,
|
|
7731
|
+
shadow: null
|
|
7732
|
+
});
|
|
7733
|
+
}
|
|
7734
|
+
}
|
|
7735
|
+
};
|
|
7736
|
+
DOMPurify.sanitize = function(dirty) {
|
|
7737
|
+
let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
7738
|
+
let body = null;
|
|
7739
|
+
let importedNode = null;
|
|
7740
|
+
let currentNode = null;
|
|
7741
|
+
let returnNode = null;
|
|
7742
|
+
IS_EMPTY_INPUT = !dirty;
|
|
7743
|
+
if (IS_EMPTY_INPUT) dirty = "<!-->";
|
|
7744
|
+
if (typeof dirty !== "string" && !_isNode(dirty)) {
|
|
7745
|
+
dirty = stringifyValue(dirty);
|
|
7746
|
+
if (typeof dirty !== "string") throw typeErrorCreate("dirty is not a string, aborting");
|
|
7747
|
+
}
|
|
7748
|
+
if (!DOMPurify.isSupported) return dirty;
|
|
7749
|
+
if (SET_CONFIG) {
|
|
7750
|
+
ALLOWED_TAGS = SET_CONFIG_ALLOWED_TAGS;
|
|
7751
|
+
ALLOWED_ATTR = SET_CONFIG_ALLOWED_ATTR;
|
|
7752
|
+
} else _parseConfig(cfg);
|
|
7753
|
+
if (hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0) ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
|
7754
|
+
if (hooks.uponSanitizeAttribute.length > 0) ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
7755
|
+
DOMPurify.removed = [];
|
|
7756
|
+
const inPlace = IN_PLACE && typeof dirty !== "string" && _isNode(dirty);
|
|
7757
|
+
if (inPlace) {
|
|
7758
|
+
_neutralizePatchLinkage(dirty);
|
|
7759
|
+
const nn = _readNodeName(dirty);
|
|
7760
|
+
if (typeof nn === "string") {
|
|
7761
|
+
const tagName = transformCaseFunc(nn);
|
|
7762
|
+
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
7763
|
+
_neutralizeRoot(dirty);
|
|
7764
|
+
throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
|
|
7765
|
+
}
|
|
7766
|
+
}
|
|
7767
|
+
if (_isClobbered(dirty)) {
|
|
7768
|
+
_neutralizeRoot(dirty);
|
|
7769
|
+
throw typeErrorCreate("root node is clobbered and cannot be sanitized in-place");
|
|
7770
|
+
}
|
|
7771
|
+
try {
|
|
7772
|
+
_sanitizeAttachedShadowRoots(dirty);
|
|
7773
|
+
} catch (error) {
|
|
7774
|
+
_neutralizeRoot(dirty);
|
|
7775
|
+
throw error;
|
|
7776
|
+
}
|
|
7777
|
+
} else if (_isNode(dirty)) {
|
|
7778
|
+
body = _initDocument("<!---->");
|
|
7779
|
+
importedNode = body.ownerDocument.importNode(dirty, true);
|
|
7780
|
+
if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") body = importedNode;
|
|
7781
|
+
else if (importedNode.nodeName === "HTML") body = importedNode;
|
|
7782
|
+
else body.appendChild(importedNode);
|
|
7783
|
+
_sanitizeAttachedShadowRoots(body);
|
|
7784
|
+
} else {
|
|
7785
|
+
if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && dirty.indexOf("<") === -1) return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(dirty) : dirty;
|
|
7786
|
+
body = _initDocument(dirty);
|
|
7787
|
+
if (!body) return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
|
|
7788
|
+
}
|
|
7789
|
+
if (body && FORCE_BODY) _forceRemove(body.firstChild);
|
|
7790
|
+
const walkRoot = inPlace ? dirty : body;
|
|
7791
|
+
try {
|
|
7792
|
+
const nodeIterator = _createNodeIterator(walkRoot);
|
|
7793
|
+
while (currentNode = nodeIterator.nextNode()) {
|
|
7794
|
+
_sanitizeElements(currentNode, walkRoot);
|
|
7795
|
+
_sanitizeAttributes(currentNode, walkRoot);
|
|
7796
|
+
if (_isDocumentFragment(currentNode.content)) _sanitizeShadowDOM2(currentNode.content);
|
|
7797
|
+
}
|
|
7798
|
+
} catch (error) {
|
|
7799
|
+
if (inPlace) {
|
|
7800
|
+
_neutralizeRoot(dirty);
|
|
7801
|
+
arrayForEach(DOMPurify.removed, (entry) => {
|
|
7802
|
+
if (entry.element) _neutralizeSubtree(entry.element);
|
|
7803
|
+
});
|
|
7804
|
+
}
|
|
7805
|
+
throw error;
|
|
7806
|
+
}
|
|
7807
|
+
if (inPlace) {
|
|
7808
|
+
let rootWasRemoved = false;
|
|
7809
|
+
arrayForEach(DOMPurify.removed, (entry) => {
|
|
7810
|
+
if (entry.element) {
|
|
7811
|
+
if (entry.element === dirty) rootWasRemoved = true;
|
|
7812
|
+
_neutralizeSubtree(entry.element);
|
|
7813
|
+
}
|
|
7814
|
+
});
|
|
7815
|
+
if (rootWasRemoved) throw typeErrorCreate("a node selected for removal could not be safely returned; refusing to sanitize in place");
|
|
7816
|
+
if (SAFE_FOR_TEMPLATES) _scrubTemplateExpressions2(dirty);
|
|
7817
|
+
return dirty;
|
|
7818
|
+
}
|
|
7819
|
+
if (RETURN_DOM) {
|
|
7820
|
+
if (SAFE_FOR_TEMPLATES) _scrubTemplateExpressions2(body);
|
|
7821
|
+
if (RETURN_DOM_FRAGMENT) {
|
|
7822
|
+
returnNode = createDocumentFragment.call(body.ownerDocument);
|
|
7823
|
+
while (body.firstChild) returnNode.appendChild(body.firstChild);
|
|
7824
|
+
} else returnNode = body;
|
|
7825
|
+
if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) returnNode = importNode.call(originalDocument, returnNode, true);
|
|
7826
|
+
return returnNode;
|
|
7827
|
+
}
|
|
7828
|
+
let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
|
|
7829
|
+
if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
|
|
7830
|
+
if (SAFE_FOR_TEMPLATES) serializedHTML = _stripTemplateExpressions(serializedHTML);
|
|
7831
|
+
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(serializedHTML) : serializedHTML;
|
|
7832
|
+
};
|
|
7833
|
+
DOMPurify.setConfig = function() {
|
|
7834
|
+
let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
7835
|
+
_parseConfig(cfg);
|
|
7836
|
+
SET_CONFIG = true;
|
|
7837
|
+
SET_CONFIG_ALLOWED_TAGS = ALLOWED_TAGS;
|
|
7838
|
+
SET_CONFIG_ALLOWED_ATTR = ALLOWED_ATTR;
|
|
7839
|
+
};
|
|
7840
|
+
DOMPurify.clearConfig = function() {
|
|
7841
|
+
CONFIG = null;
|
|
7842
|
+
SET_CONFIG = false;
|
|
7843
|
+
SET_CONFIG_ALLOWED_TAGS = null;
|
|
7844
|
+
SET_CONFIG_ALLOWED_ATTR = null;
|
|
7845
|
+
trustedTypesPolicy = defaultTrustedTypesPolicy;
|
|
7846
|
+
emptyHTML = "";
|
|
7847
|
+
};
|
|
7848
|
+
DOMPurify.isValidAttribute = function(tag, attr, value) {
|
|
7849
|
+
if (!CONFIG) _parseConfig({});
|
|
7850
|
+
const lcTag = transformCaseFunc(tag);
|
|
7851
|
+
const lcName = transformCaseFunc(attr);
|
|
7852
|
+
return _isValidAttribute(lcTag, lcName, value);
|
|
7853
|
+
};
|
|
7854
|
+
DOMPurify.addHook = function(entryPoint, hookFunction) {
|
|
7855
|
+
if (typeof hookFunction !== "function") return;
|
|
7856
|
+
if (!objectHasOwnProperty(hooks, entryPoint)) return;
|
|
7857
|
+
arrayPush(hooks[entryPoint], hookFunction);
|
|
7858
|
+
};
|
|
7859
|
+
DOMPurify.removeHook = function(entryPoint, hookFunction) {
|
|
7860
|
+
if (!objectHasOwnProperty(hooks, entryPoint)) return;
|
|
7861
|
+
if (hookFunction !== void 0) {
|
|
7862
|
+
const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
|
|
7863
|
+
return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0];
|
|
7864
|
+
}
|
|
7865
|
+
return arrayPop(hooks[entryPoint]);
|
|
7866
|
+
};
|
|
7867
|
+
DOMPurify.removeHooks = function(entryPoint) {
|
|
7868
|
+
if (!objectHasOwnProperty(hooks, entryPoint)) return;
|
|
7869
|
+
hooks[entryPoint] = [];
|
|
7870
|
+
};
|
|
7871
|
+
DOMPurify.removeAllHooks = function() {
|
|
7872
|
+
hooks = _createHooksMap();
|
|
7873
|
+
};
|
|
7874
|
+
return DOMPurify;
|
|
7875
|
+
}
|
|
7876
|
+
var purify_default = createDOMPurify();
|
|
7877
|
+
//#endregion
|
|
7878
|
+
//#region ../../shared/utils/dist/index.js
|
|
7879
|
+
var f$1 = [
|
|
7880
|
+
"script",
|
|
7881
|
+
"embed",
|
|
7882
|
+
"base",
|
|
7883
|
+
"form",
|
|
7884
|
+
"meta",
|
|
7885
|
+
"link",
|
|
7886
|
+
"style",
|
|
7887
|
+
"foreignobject"
|
|
7888
|
+
];
|
|
7889
|
+
var p$1 = [
|
|
7890
|
+
"onerror",
|
|
7891
|
+
"onload",
|
|
7892
|
+
"onclick",
|
|
7893
|
+
"onmouseover",
|
|
7894
|
+
"onmouseout",
|
|
7895
|
+
"onmouseenter",
|
|
7896
|
+
"onmouseleave",
|
|
7897
|
+
"onfocus",
|
|
7898
|
+
"onblur",
|
|
7899
|
+
"onkeydown",
|
|
7900
|
+
"onkeyup",
|
|
7901
|
+
"onkeypress",
|
|
7902
|
+
"onsubmit",
|
|
7903
|
+
"onchange",
|
|
7904
|
+
"onbeforeunload",
|
|
7905
|
+
"formaction",
|
|
7906
|
+
"xlink:href"
|
|
7907
|
+
];
|
|
7908
|
+
var m$1 = /* @__PURE__ */ new Set([
|
|
7909
|
+
"iframe",
|
|
7910
|
+
"object",
|
|
7911
|
+
"semantics",
|
|
7912
|
+
"annotation",
|
|
7913
|
+
"none"
|
|
7914
|
+
]);
|
|
7915
|
+
var h$1 = /^[a-z_][\w.-]*:[a-z][\w.-]*$/;
|
|
7916
|
+
var g$1 = {
|
|
7917
|
+
ADD_TAGS: (e) => m$1.has(e) || h$1.test(e),
|
|
7918
|
+
ADD_ATTR: [
|
|
7919
|
+
"alignment",
|
|
7920
|
+
"target",
|
|
7921
|
+
"allow",
|
|
7922
|
+
"allowfullscreen",
|
|
7923
|
+
"frameborder",
|
|
7924
|
+
"scrolling",
|
|
7925
|
+
"data"
|
|
7926
|
+
],
|
|
7927
|
+
FORBID_TAGS: f$1,
|
|
7928
|
+
FORBID_ATTR: p$1,
|
|
7929
|
+
ALLOW_UNKNOWN_PROTOCOLS: !1,
|
|
7930
|
+
RETURN_TRUSTED_TYPE: !1
|
|
7931
|
+
};
|
|
7932
|
+
var _$1 = 1e6;
|
|
7933
|
+
var v$1 = /* @__PURE__ */ new Map();
|
|
7934
|
+
var y$1 = 0;
|
|
7935
|
+
function b$1(t) {
|
|
7936
|
+
if (t == null || t === "" || !purify_default.isSupported) return "";
|
|
7937
|
+
let n = typeof t == "string" ? t : String(t), r = v$1.get(n);
|
|
7938
|
+
if (r !== void 0) return r;
|
|
7939
|
+
let i = String(purify_default.sanitize(n, g$1)), a = n.length + i.length;
|
|
7940
|
+
if (a > _$1) return i;
|
|
7941
|
+
for (let [e, t] of v$1) {
|
|
7942
|
+
if (y$1 + a <= _$1) break;
|
|
7943
|
+
v$1.delete(e), y$1 -= e.length + t.length;
|
|
7944
|
+
}
|
|
7945
|
+
return v$1.set(n, i), y$1 += a, i;
|
|
7946
|
+
}
|
|
7947
|
+
//#endregion
|
|
5419
7948
|
//#region ../../shared/math-rendering-mathjax/dist/index.js
|
|
5420
|
-
var e$3 = "
|
|
5421
|
-
var t$3 = "pie-
|
|
5422
|
-
var n =
|
|
5423
|
-
|
|
7949
|
+
var e$3 = "4.1.3";
|
|
7950
|
+
var t$3 = "https://github.com/pie-framework/pie-elements-ng/blob/develop/docs/MATH-RENDERING.md#assets";
|
|
7951
|
+
var n = "@pie-lib/math-rendering@2";
|
|
7952
|
+
var r$2 = ["nemeth", "euro"];
|
|
7953
|
+
var i = `mathjax@${e$3}/sre`;
|
|
7954
|
+
var a = /^[^@]+@[^@]+$/;
|
|
7955
|
+
function o(e) {
|
|
7956
|
+
if (!e) return;
|
|
7957
|
+
let t;
|
|
7958
|
+
try {
|
|
7959
|
+
t = new URL(e);
|
|
7960
|
+
} catch {
|
|
7961
|
+
return;
|
|
7962
|
+
}
|
|
7963
|
+
if (t.origin === "null") return;
|
|
7964
|
+
let n = t.pathname.split("/");
|
|
7965
|
+
for (let e = n.length - 1; e > 0; e--) {
|
|
7966
|
+
let r = n[e];
|
|
7967
|
+
if (r === "node_modules") return;
|
|
7968
|
+
if (!a.test(r)) continue;
|
|
7969
|
+
let i = n[e - 1]?.startsWith("@") ? e - 1 : e;
|
|
7970
|
+
return t.origin + n.slice(0, i).join("/");
|
|
7971
|
+
}
|
|
7972
|
+
}
|
|
7973
|
+
function s$1() {
|
|
7974
|
+
let e = globalThis[n]?.opts;
|
|
7975
|
+
return e && typeof e == "object" ? e : {};
|
|
7976
|
+
}
|
|
7977
|
+
function c$1(e) {
|
|
7978
|
+
if (typeof e != "string" || !e) return;
|
|
7979
|
+
let t = typeof document > "u" ? void 0 : document.baseURI;
|
|
7980
|
+
try {
|
|
7981
|
+
return new URL(e, t).href.replace(/\/+$/, "");
|
|
7982
|
+
} catch {
|
|
7983
|
+
return;
|
|
7984
|
+
}
|
|
7985
|
+
}
|
|
7986
|
+
function l(e) {
|
|
7987
|
+
if (!e || typeof e != "object") return;
|
|
7988
|
+
let t = /* @__PURE__ */ new Map();
|
|
7989
|
+
for (let [n, r] of Object.entries(e)) {
|
|
7990
|
+
let e = c$1(r);
|
|
7991
|
+
e && t.set(n, e);
|
|
7992
|
+
}
|
|
7993
|
+
return t.size ? t : void 0;
|
|
7994
|
+
}
|
|
7995
|
+
function u(e) {
|
|
7996
|
+
if (Array.isArray(e)) return new Map(e.filter((e) => typeof e == "string").map((e) => [e, void 0]));
|
|
7997
|
+
if (e && typeof e == "object") return new Map(Object.entries(e).map(([e, t]) => [e, typeof t == "string" ? t : void 0]));
|
|
7998
|
+
}
|
|
7999
|
+
function d(e, t) {
|
|
8000
|
+
let n = s$1(), r = c$1(e.assetRoot ?? n.assetRoot) ?? o(t);
|
|
8001
|
+
return {
|
|
8002
|
+
root: r,
|
|
8003
|
+
speechPath: c$1(e.speechPath ?? n.speechPath) ?? (r ? `${r}/${i}` : void 0),
|
|
8004
|
+
speechLocales: u(e.speechLocales ?? n.speechLocales),
|
|
8005
|
+
urls: l(e.assetUrls ?? n.assetUrls)
|
|
8006
|
+
};
|
|
8007
|
+
}
|
|
8008
|
+
function f(e, t) {
|
|
8009
|
+
if (!(!e || !t)) {
|
|
8010
|
+
for (let n of [...e.keys()]) !t.has(n) && !r$2.includes(n) && e.delete(n);
|
|
8011
|
+
for (let [n, r] of t) (r || !e.has(n)) && e.set(n, r ?? n);
|
|
8012
|
+
}
|
|
8013
|
+
}
|
|
8014
|
+
function p(e) {
|
|
8015
|
+
if (!(!e || e.has("en"))) return [...e.keys()].find((e) => !r$2.includes(e));
|
|
8016
|
+
}
|
|
8017
|
+
var h = {
|
|
8018
|
+
untypeset: "no MathJax loads, so math stays untypeset",
|
|
8019
|
+
"no-web-fonts": "math renders without web fonts",
|
|
8020
|
+
"no-web-fonts-or-speech": "math renders without web fonts and speech"
|
|
8021
|
+
};
|
|
8022
|
+
var g = Symbol.for("@pie-element/shared-math-rendering-mathjax/no-assets");
|
|
8023
|
+
function _(e) {
|
|
8024
|
+
let r = globalThis;
|
|
8025
|
+
r[g] ?? (r[g] = []);
|
|
8026
|
+
let i = r[g];
|
|
8027
|
+
if (i.includes(e)) return;
|
|
8028
|
+
i.push(e);
|
|
8029
|
+
let a = `[math-rendering] No asset root for MathJax: ${h[e]}. Set window['${n}'].opts.assetRoot to an npm root. See ${t$3}`;
|
|
8030
|
+
e === "untypeset" ? console.error(a) : console.warn(a), !(typeof window > "u") && window.dispatchEvent(new CustomEvent("pie-mathjax-no-asset-root", { detail: {
|
|
8031
|
+
effect: e,
|
|
8032
|
+
message: a,
|
|
8033
|
+
docsUrl: t$3
|
|
8034
|
+
} }));
|
|
8035
|
+
}
|
|
8036
|
+
var v = "https://github.com/pie-framework/pie-players/blob/develop/docs/item-player/loading-strategies.md#one-mathjax-version-per-page";
|
|
8037
|
+
var y = "pie-mathjax-version-conflict";
|
|
8038
|
+
var b = Symbol.for("@pie-element/shared-math-rendering-mathjax/unsupported-page");
|
|
8039
|
+
function x(e, t) {
|
|
5424
8040
|
if (typeof window > "u") return;
|
|
5425
|
-
let
|
|
5426
|
-
|
|
8041
|
+
let n = globalThis;
|
|
8042
|
+
n[b] ?? (n[b] = {
|
|
5427
8043
|
logged: !1,
|
|
5428
8044
|
conditions: []
|
|
5429
8045
|
});
|
|
5430
|
-
let
|
|
5431
|
-
if (
|
|
5432
|
-
|
|
5433
|
-
let
|
|
5434
|
-
|
|
5435
|
-
condition:
|
|
5436
|
-
message:
|
|
5437
|
-
docsUrl:
|
|
8046
|
+
let r = n[b];
|
|
8047
|
+
if (r.conditions.includes(e)) return;
|
|
8048
|
+
r.conditions.push(e);
|
|
8049
|
+
let i = `[math-rendering] Unsupported page (${e}): ${t}. PIE supports one MathJax major version per page; with MathJax 3 and 4 on one page, math rendering is best effort and may break. See ${v}`;
|
|
8050
|
+
r.logged || (r.logged = !0, console.error(i)), window.dispatchEvent(new CustomEvent(y, { detail: {
|
|
8051
|
+
condition: e,
|
|
8052
|
+
message: i,
|
|
8053
|
+
docsUrl: v
|
|
5438
8054
|
} }));
|
|
5439
8055
|
}
|
|
5440
|
-
function
|
|
8056
|
+
function ee() {
|
|
5441
8057
|
let e = window.MathJax?.version;
|
|
5442
8058
|
return typeof e == "string" && e.startsWith("3.") ? e : void 0;
|
|
5443
8059
|
}
|
|
5444
|
-
function
|
|
8060
|
+
function S() {
|
|
5445
8061
|
return window.MathJax;
|
|
5446
8062
|
}
|
|
5447
|
-
function
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
8063
|
+
function te(t, { root: n, speechPath: r }) {
|
|
8064
|
+
n && (t.loader = {
|
|
8065
|
+
...t.loader,
|
|
8066
|
+
paths: {
|
|
8067
|
+
fonts: `${n}/@mathjax`,
|
|
8068
|
+
"mathjax-newcm": `${n}/@mathjax/mathjax-newcm-font@${e$3}`,
|
|
8069
|
+
"mathjax-mhchem-extension": `${n}/@mathjax/mathjax-mhchem-font-extension@${e$3}`
|
|
8070
|
+
}
|
|
8071
|
+
}), r && (t.options = {
|
|
8072
|
+
...t.options,
|
|
8073
|
+
worker: {
|
|
8074
|
+
path: r,
|
|
8075
|
+
maps: `${r}/mathmaps`
|
|
8076
|
+
}
|
|
5452
8077
|
});
|
|
5453
8078
|
}
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
8079
|
+
function ne(e, t) {
|
|
8080
|
+
let n = t.srcUrl || (t.root ? `${t.root}/mathjax@4.1.3/tex-mml-chtml.js` : void 0);
|
|
8081
|
+
return n ? (te(e, t), new Promise((t, r) => {
|
|
8082
|
+
window.MathJax = e;
|
|
8083
|
+
let i = document.createElement("script");
|
|
8084
|
+
i.src = n, i.async = !0, i.onload = () => t(!0), i.onerror = () => r(/* @__PURE__ */ Error("Failed to load MathJax")), document.head.appendChild(i);
|
|
8085
|
+
})) : (_("untypeset"), Promise.resolve(!1));
|
|
8086
|
+
}
|
|
8087
|
+
var re = globalThis;
|
|
8088
|
+
var C = "PIE-MJX-CHTML-styles";
|
|
8089
|
+
var ie = ["MJX-CHTML-styles", "MJX-SVG-styles"];
|
|
8090
|
+
var ae = ee;
|
|
8091
|
+
var w = "http://www.w3.org/1998/Math/MathML";
|
|
8092
|
+
var oe = /^([a-z_][\w.-]*):math$/;
|
|
8093
|
+
var se = /^[a-z][a-z0-9-]*$/;
|
|
8094
|
+
function ce(e) {
|
|
5462
8095
|
for (let t of e.querySelectorAll("*")) {
|
|
5463
|
-
let n =
|
|
5464
|
-
!n || !e.contains(t) || t.closest("mjx-container") || t.replaceWith(
|
|
8096
|
+
let n = oe.exec(t.tagName.toLowerCase())?.[1];
|
|
8097
|
+
!n || !e.contains(t) || t.closest("mjx-container") || t.replaceWith(T(t, `${n}:`));
|
|
5465
8098
|
}
|
|
5466
8099
|
}
|
|
5467
|
-
function
|
|
8100
|
+
function T(e, t) {
|
|
5468
8101
|
let n = e.tagName.toLowerCase().slice(t.length);
|
|
5469
|
-
if (!
|
|
5470
|
-
let r = e.ownerDocument.createElementNS(
|
|
8102
|
+
if (!se.test(n)) return e;
|
|
8103
|
+
let r = e.ownerDocument.createElementNS(w, n);
|
|
5471
8104
|
for (let t of e.attributes) r.setAttribute(t.name, t.value);
|
|
5472
8105
|
for (let n of [...e.childNodes]) {
|
|
5473
8106
|
let e = n instanceof Element && n.tagName.toLowerCase().startsWith(t);
|
|
5474
|
-
r.appendChild(e ?
|
|
8107
|
+
r.appendChild(e ? T(n, t) : n);
|
|
5475
8108
|
}
|
|
5476
8109
|
return r;
|
|
5477
8110
|
}
|
|
5478
|
-
var
|
|
8111
|
+
var le = /* @__PURE__ */ new Set([
|
|
5479
8112
|
"updiagonalstrike",
|
|
5480
8113
|
"downdiagonalstrike",
|
|
5481
8114
|
"verticalstrike",
|
|
5482
8115
|
"horizontalstrike"
|
|
5483
8116
|
]);
|
|
5484
|
-
var
|
|
8117
|
+
var ue = {
|
|
5485
8118
|
thin: "0.035em",
|
|
5486
8119
|
medium: "0.07em",
|
|
5487
8120
|
thick: "0.14em"
|
|
5488
8121
|
};
|
|
5489
|
-
var
|
|
8122
|
+
var de = {
|
|
5490
8123
|
tight: "0em",
|
|
5491
8124
|
medium: "0.1em",
|
|
5492
8125
|
loose: "0.2em"
|
|
5493
8126
|
};
|
|
5494
|
-
var
|
|
5495
|
-
var
|
|
5496
|
-
var
|
|
5497
|
-
var
|
|
8127
|
+
var fe = /^(\d+(\.\d*)?|\.\d+)(em|ex|px|pt|pc|in|cm|mm)$/;
|
|
8128
|
+
var pe = /^(#[0-9a-f]{3,8}|[a-z]+)$/i;
|
|
8129
|
+
var me = /^(\d+(\.\d*)?|\.\d+)$/;
|
|
8130
|
+
var he = /* @__PURE__ */ new Set([
|
|
5498
8131
|
"mn",
|
|
5499
8132
|
"mo",
|
|
5500
8133
|
"mi",
|
|
5501
8134
|
"mtext"
|
|
5502
8135
|
]);
|
|
5503
|
-
var
|
|
8136
|
+
var ge = /* @__PURE__ */ new Set([
|
|
5504
8137
|
"stackalign",
|
|
5505
8138
|
"charalign",
|
|
5506
8139
|
"charspacing",
|
|
5507
8140
|
"longdivstyle"
|
|
5508
8141
|
]);
|
|
5509
|
-
function
|
|
5510
|
-
let i = e.createElementNS(
|
|
8142
|
+
function E(e, t, n = [], r = {}) {
|
|
8143
|
+
let i = e.createElementNS(w, t);
|
|
5511
8144
|
for (let [e, t] of Object.entries(r)) i.setAttribute(e, t);
|
|
5512
8145
|
for (let e of n) e && i.appendChild(e);
|
|
5513
8146
|
return i;
|
|
5514
8147
|
}
|
|
5515
|
-
function
|
|
5516
|
-
let n =
|
|
8148
|
+
function D(e, t) {
|
|
8149
|
+
let n = E(e.document, "mo");
|
|
5517
8150
|
return n.textContent = t, n;
|
|
5518
8151
|
}
|
|
5519
|
-
function
|
|
5520
|
-
let t =
|
|
5521
|
-
return t.textContent = "0",
|
|
8152
|
+
function O(e) {
|
|
8153
|
+
let t = E(e.document, "mn");
|
|
8154
|
+
return t.textContent = "0", E(e.document, "mphantom", [t]);
|
|
5522
8155
|
}
|
|
5523
|
-
function
|
|
8156
|
+
function k(e, t) {
|
|
5524
8157
|
return e.getAttribute(t)?.trim().toLowerCase() || void 0;
|
|
5525
8158
|
}
|
|
5526
|
-
function
|
|
8159
|
+
function A(e, t) {
|
|
5527
8160
|
let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
|
|
5528
8161
|
return Number.isFinite(n) ? n : 0;
|
|
5529
8162
|
}
|
|
5530
|
-
function
|
|
8163
|
+
function j(e) {
|
|
5531
8164
|
return e.localName === "none" || e.localName === "mrow" && e.children.length === 0 && !e.textContent?.trim();
|
|
5532
8165
|
}
|
|
5533
|
-
function
|
|
8166
|
+
function M(e, t, n = e) {
|
|
5534
8167
|
switch (t) {
|
|
5535
8168
|
case "left": return 0;
|
|
5536
8169
|
case "center": return Math.floor(e / 2);
|
|
@@ -5538,14 +8171,14 @@ function E(e, t, n = e) {
|
|
|
5538
8171
|
default: return n;
|
|
5539
8172
|
}
|
|
5540
8173
|
}
|
|
5541
|
-
function
|
|
8174
|
+
function N(e, t, n) {
|
|
5542
8175
|
let r = [], i, a, o = (e, t) => {
|
|
5543
8176
|
let s = (e) => t.reduceRight((e, t) => {
|
|
5544
8177
|
let n = t.cloneNode(!1);
|
|
5545
8178
|
return n.appendChild(e), n;
|
|
5546
8179
|
}, e);
|
|
5547
8180
|
if (e.localName === "mstyle") for (let n of [...e.children]) o(n, [...t, e]);
|
|
5548
|
-
else if (
|
|
8181
|
+
else if (j(e)) r.push(null);
|
|
5549
8182
|
else if (e.localName === "mn" && e.children.length === 0) {
|
|
5550
8183
|
let t = [...(e.textContent ?? "").trim()];
|
|
5551
8184
|
for (let a of t) {
|
|
@@ -5554,28 +8187,28 @@ function D(e, t, n) {
|
|
|
5554
8187
|
t.textContent = a, r.push(s(t));
|
|
5555
8188
|
}
|
|
5556
8189
|
t.length && (a ?? (a = r.length));
|
|
5557
|
-
} else
|
|
8190
|
+
} else he.has(e.localName) && e.textContent?.trim() === n.decimalPoint && (i ?? (i = r.length)), r.push(s(e));
|
|
5558
8191
|
};
|
|
5559
8192
|
for (let t of e) o(t, []);
|
|
5560
8193
|
return {
|
|
5561
8194
|
kind: "digits",
|
|
5562
8195
|
cells: r,
|
|
5563
|
-
anchor:
|
|
8196
|
+
anchor: M(r.length, n.stackAlign, i ?? a),
|
|
5564
8197
|
position: t
|
|
5565
8198
|
};
|
|
5566
8199
|
}
|
|
5567
|
-
function
|
|
5568
|
-
return (e ?? "").toLowerCase().split(/\s+/).filter((e) =>
|
|
8200
|
+
function _e$1(e) {
|
|
8201
|
+
return (e ?? "").toLowerCase().split(/\s+/).filter((e) => le.has(e));
|
|
5569
8202
|
}
|
|
5570
|
-
function
|
|
5571
|
-
let n = [...e.children].filter((e) => !
|
|
5572
|
-
return n.length <= 1 ? n[0] ?? null :
|
|
8203
|
+
function ve(e, t) {
|
|
8204
|
+
let n = [...e.children].filter((e) => !j(e));
|
|
8205
|
+
return n.length <= 1 ? n[0] ?? null : E(t.document, "mrow", n);
|
|
5573
8206
|
}
|
|
5574
|
-
function
|
|
5575
|
-
let r =
|
|
5576
|
-
content:
|
|
5577
|
-
location:
|
|
5578
|
-
crossout: e.hasAttribute("crossout") ?
|
|
8207
|
+
function ye(e, t, n) {
|
|
8208
|
+
let r = k(e, "location") ?? "n", i = _e$1(e.getAttribute("crossout")), a = [...e.children].map((e) => j(e) ? null : e.localName === "mscarry" ? {
|
|
8209
|
+
content: ve(e, n),
|
|
8210
|
+
location: k(e, "location") ?? r,
|
|
8211
|
+
crossout: e.hasAttribute("crossout") ? _e$1(e.getAttribute("crossout")) : i
|
|
5579
8212
|
} : {
|
|
5580
8213
|
content: e,
|
|
5581
8214
|
location: r,
|
|
@@ -5584,60 +8217,60 @@ function ae(e, t, n) {
|
|
|
5584
8217
|
return {
|
|
5585
8218
|
kind: "carries",
|
|
5586
8219
|
carries: a,
|
|
5587
|
-
anchor:
|
|
8220
|
+
anchor: M(a.length, n.stackAlign),
|
|
5588
8221
|
position: t,
|
|
5589
|
-
scale:
|
|
8222
|
+
scale: me.test(o) ? o : "0.6"
|
|
5590
8223
|
};
|
|
5591
8224
|
}
|
|
5592
|
-
function
|
|
5593
|
-
let t =
|
|
5594
|
-
return `${n} solid ${
|
|
8225
|
+
function be(e) {
|
|
8226
|
+
let t = k(e, "mslinethickness") ?? "medium", n = ue[t] ?? (fe.test(t) ? t : "0.07em"), r = e.getAttribute("mathcolor")?.trim() ?? "";
|
|
8227
|
+
return `${n} solid ${pe.test(r) ? r : "currentColor"}`;
|
|
5595
8228
|
}
|
|
5596
|
-
function
|
|
5597
|
-
let r = Math.max(0,
|
|
8229
|
+
function xe(e, t, n) {
|
|
8230
|
+
let r = Math.max(0, A(e, "length"));
|
|
5598
8231
|
return {
|
|
5599
8232
|
kind: "line",
|
|
5600
8233
|
length: r,
|
|
5601
|
-
anchor:
|
|
8234
|
+
anchor: M(r, n.stackAlign),
|
|
5602
8235
|
position: t,
|
|
5603
|
-
border:
|
|
8236
|
+
border: be(e)
|
|
5604
8237
|
};
|
|
5605
8238
|
}
|
|
5606
|
-
function
|
|
8239
|
+
function P(e, t, n, r, i) {
|
|
5607
8240
|
e.forEach((e, a) => {
|
|
5608
|
-
let o = t + a * n +
|
|
8241
|
+
let o = t + a * n + A(e, "position");
|
|
5609
8242
|
switch (e.localName) {
|
|
5610
8243
|
case "msgroup":
|
|
5611
|
-
|
|
8244
|
+
P([...e.children], o, A(e, "shift"), r, i);
|
|
5612
8245
|
break;
|
|
5613
8246
|
case "msline":
|
|
5614
|
-
i.push(
|
|
8247
|
+
i.push(xe(e, o, r));
|
|
5615
8248
|
break;
|
|
5616
8249
|
case "mscarries":
|
|
5617
|
-
i.push(
|
|
8250
|
+
i.push(ye(e, o, r));
|
|
5618
8251
|
break;
|
|
5619
8252
|
case "msrow":
|
|
5620
8253
|
case "mrow":
|
|
5621
|
-
i.push(
|
|
8254
|
+
i.push(N([...e.children], o, r));
|
|
5622
8255
|
break;
|
|
5623
|
-
default: i.push(
|
|
8256
|
+
default: i.push(N([e], o, r));
|
|
5624
8257
|
}
|
|
5625
8258
|
});
|
|
5626
8259
|
}
|
|
5627
|
-
function
|
|
8260
|
+
function F(e) {
|
|
5628
8261
|
return -e.anchor - e.position;
|
|
5629
8262
|
}
|
|
5630
|
-
function
|
|
8263
|
+
function I(e) {
|
|
5631
8264
|
return e.kind === "digits" ? e.cells.length : e.kind === "carries" ? e.carries.length : e.length;
|
|
5632
8265
|
}
|
|
5633
|
-
function
|
|
5634
|
-
return
|
|
8266
|
+
function L(e) {
|
|
8267
|
+
return F(e) + I(e) - 1;
|
|
5635
8268
|
}
|
|
5636
|
-
function
|
|
5637
|
-
let i = (e) =>
|
|
8269
|
+
function Se(e, t, n, r) {
|
|
8270
|
+
let i = (e) => E(r.document, "mpadded", [t], {
|
|
5638
8271
|
width: "0",
|
|
5639
8272
|
...e ? { lspace: e } : {}
|
|
5640
|
-
}), a = (e, t) =>
|
|
8273
|
+
}), a = (e, t) => E(r.document, e, t);
|
|
5641
8274
|
switch (n) {
|
|
5642
8275
|
case "s": return a("munder", [e, i("-0.5width")]);
|
|
5643
8276
|
case "ne": return a("msup", [e, i()]);
|
|
@@ -5659,49 +8292,49 @@ function ce(e, t, n, r) {
|
|
|
5659
8292
|
default: return a("mover", [e, i("-0.5width")]);
|
|
5660
8293
|
}
|
|
5661
8294
|
}
|
|
5662
|
-
function
|
|
5663
|
-
let r =
|
|
8295
|
+
function Ce(e, t, n) {
|
|
8296
|
+
let r = E(n.document, "menclose", [e], {
|
|
5664
8297
|
notation: t.join(" "),
|
|
5665
8298
|
"data-padding": "0.1em",
|
|
5666
8299
|
"data-thickness": "0.067em"
|
|
5667
8300
|
}), i = t.some((e) => e.endsWith("diagonalstrike")) ? .167 : t.includes("horizontalstrike") ? .1 : 0;
|
|
5668
|
-
return i ?
|
|
8301
|
+
return i ? E(n.document, "mpadded", [r], {
|
|
5669
8302
|
lspace: `-${i}em`,
|
|
5670
8303
|
width: `-${2 * i}em`
|
|
5671
8304
|
}) : r;
|
|
5672
8305
|
}
|
|
5673
|
-
function
|
|
5674
|
-
let a = e && t.crossout.length ?
|
|
8306
|
+
function we(e, t, n, r, i) {
|
|
8307
|
+
let a = e && t.crossout.length ? Ce(e, t.crossout, i) : e;
|
|
5675
8308
|
if (!t.content) return a;
|
|
5676
|
-
let o =
|
|
5677
|
-
return
|
|
8309
|
+
let o = E(i.document, "mstyle", [t.content], { scriptsizemultiplier: r });
|
|
8310
|
+
return Se(a ?? O(i), o, n, i);
|
|
5678
8311
|
}
|
|
5679
|
-
function
|
|
5680
|
-
return e.carries[t -
|
|
8312
|
+
function R(e, t) {
|
|
8313
|
+
return e.carries[t - F(e)] ?? null;
|
|
5681
8314
|
}
|
|
5682
|
-
function
|
|
8315
|
+
function Te(e, t, n, r) {
|
|
5683
8316
|
let i = e.content;
|
|
5684
8317
|
n.forEach((e, a) => {
|
|
5685
|
-
let o = n.length - 1 - a, s = n[o], c =
|
|
8318
|
+
let o = n.length - 1 - a, s = n[o], c = R(s, t), l = n.slice(0, o).some((e) => R(e, t));
|
|
5686
8319
|
if (!c && !l) return;
|
|
5687
8320
|
let u = c ?? {
|
|
5688
|
-
content:
|
|
8321
|
+
content: O(r),
|
|
5689
8322
|
location: "n",
|
|
5690
8323
|
crossout: []
|
|
5691
8324
|
}, d = a === 0 ? u.location : "n";
|
|
5692
|
-
i =
|
|
8325
|
+
i = we(i, u, d, s.scale, r);
|
|
5693
8326
|
}), e.content = i;
|
|
5694
8327
|
}
|
|
5695
|
-
function
|
|
5696
|
-
let n = e.filter((e) =>
|
|
8328
|
+
function z(e, t) {
|
|
8329
|
+
let n = e.filter((e) => I(e) > 0), r = Math.min(0, ...n.map(F)), i = Math.max(r, ...n.map(L)) - r + 1, a = -r, o = [], s = /* @__PURE__ */ new Map(), c = () => Array.from({ length: i }, () => ({
|
|
5697
8330
|
content: null,
|
|
5698
8331
|
borders: {}
|
|
5699
|
-
})), l = (e) => e.length === 0 ? Array.from({ length: i }, (e, t) => t) : Array.from({ length: e.length }, (t, n) => a +
|
|
8332
|
+
})), l = (e) => e.length === 0 ? Array.from({ length: i }, (e, t) => t) : Array.from({ length: e.length }, (t, n) => a + F(e) + n), u = [], d = [], f = (e) => {
|
|
5700
8333
|
let n = c();
|
|
5701
8334
|
e.cells.forEach((t, r) => {
|
|
5702
|
-
n[a +
|
|
8335
|
+
n[a + F(e) + r].content = t;
|
|
5703
8336
|
}), u.length && n.forEach((e, n) => {
|
|
5704
|
-
|
|
8337
|
+
Te(e, n - a, u, t);
|
|
5705
8338
|
});
|
|
5706
8339
|
for (let e of d) for (let t of l(e)) n[t].borders.top = e.border;
|
|
5707
8340
|
u = [], d = [], s.set(e, o.length), o.push(n);
|
|
@@ -5721,44 +8354,44 @@ function P(e, t) {
|
|
|
5721
8354
|
origin: a
|
|
5722
8355
|
};
|
|
5723
8356
|
}
|
|
5724
|
-
function
|
|
5725
|
-
let r =
|
|
8357
|
+
function B(e, { rows: t }, n) {
|
|
8358
|
+
let r = E(n.document, "mtable", t.map((e) => E(n.document, "mtr", e.map((e) => {
|
|
5726
8359
|
let t = Object.entries(e.borders).map(([e, t]) => `border-${e}:${t}`).join(";");
|
|
5727
|
-
return
|
|
8360
|
+
return E(n.document, "mtd", [e.content], {
|
|
5728
8361
|
...t ? { style: t } : {},
|
|
5729
8362
|
...e.align ? { columnalign: e.align } : {}
|
|
5730
8363
|
});
|
|
5731
8364
|
}))));
|
|
5732
|
-
for (let { name: t, value: n } of [...e.attributes])
|
|
5733
|
-
let i =
|
|
5734
|
-
return r.setAttribute("columnspacing",
|
|
8365
|
+
for (let { name: t, value: n } of [...e.attributes]) ge.has(t) || r.setAttribute(t, n);
|
|
8366
|
+
let i = k(e, "charspacing") ?? "medium", a = k(e, "charalign");
|
|
8367
|
+
return r.setAttribute("columnspacing", de[i] ?? (fe.test(i) ? i : de.medium)), r.setAttribute("columnalign", a === "left" || a === "center" ? a : "right"), r.setAttribute("rowspacing", "0"), r.setAttribute("align", e.getAttribute("align") ?? "baseline"), r;
|
|
5735
8368
|
}
|
|
5736
|
-
function
|
|
8369
|
+
function V(e) {
|
|
5737
8370
|
return {
|
|
5738
8371
|
document: e.ownerDocument,
|
|
5739
|
-
stackAlign:
|
|
8372
|
+
stackAlign: k(e, "stackalign") ?? "decimalpoint",
|
|
5740
8373
|
decimalPoint: e.closest("[decimalpoint]")?.getAttribute("decimalpoint")?.trim().charAt(0) || "."
|
|
5741
8374
|
};
|
|
5742
8375
|
}
|
|
5743
|
-
function
|
|
5744
|
-
let t =
|
|
5745
|
-
return
|
|
8376
|
+
function Ee(e) {
|
|
8377
|
+
let t = V(e), n = [];
|
|
8378
|
+
return P([...e.children], 0, 0, t, n), B(e, z(n, t), t);
|
|
5746
8379
|
}
|
|
5747
|
-
function
|
|
8380
|
+
function H(e, t, n, r, i, a) {
|
|
5748
8381
|
for (let o = n; o <= r; o++) e[t][o].borders[i] = a;
|
|
5749
8382
|
}
|
|
5750
|
-
function
|
|
5751
|
-
let n =
|
|
5752
|
-
return n.setAttribute("minsize", "1.2em"), [
|
|
8383
|
+
function De(e, t) {
|
|
8384
|
+
let n = D(t, ")");
|
|
8385
|
+
return n.setAttribute("minsize", "1.2em"), [E(t.document, "mrow", [e, E(t.document, "mspace", [], { width: "0.2em" })]), E(t.document, "mpadded", [n], {
|
|
5753
8386
|
voffset: "0.1em",
|
|
5754
8387
|
lspace: "-0.15em",
|
|
5755
8388
|
depth: "-0.2em",
|
|
5756
8389
|
height: "-0.2em"
|
|
5757
8390
|
})];
|
|
5758
8391
|
}
|
|
5759
|
-
function
|
|
5760
|
-
let t =
|
|
5761
|
-
|
|
8392
|
+
function Oe(e) {
|
|
8393
|
+
let t = V(e), [n, r, ...i] = [...e.children], a = n && !j(n) ? n : null, o = r && !j(r) ? r : null, s = k(e, "longdivstyle") ?? "lefttop", c = be(e), l = [];
|
|
8394
|
+
P(i, 0, 0, t, l);
|
|
5762
8395
|
let u = l.find((e) => e.kind === "digits");
|
|
5763
8396
|
u || (u = {
|
|
5764
8397
|
kind: "digits",
|
|
@@ -5770,51 +8403,51 @@ function me(e) {
|
|
|
5770
8403
|
u.cells.unshift(...e), u.anchor += e.length;
|
|
5771
8404
|
}, p = (...e) => {
|
|
5772
8405
|
let n = e.flatMap((e) => e ? e.localName === "mrow" ? [...e.children] : [e] : []);
|
|
5773
|
-
u.cells.push(...
|
|
8406
|
+
u.cells.push(...N(n, 0, t).cells);
|
|
5774
8407
|
};
|
|
5775
8408
|
switch (s) {
|
|
5776
8409
|
case "left/\\right":
|
|
5777
|
-
f(a,
|
|
8410
|
+
f(a, D(t, "/")), p(D(t, "\\"), o);
|
|
5778
8411
|
break;
|
|
5779
8412
|
case "left)(right":
|
|
5780
|
-
f(a,
|
|
8413
|
+
f(a, D(t, ")")), p(D(t, "("), o);
|
|
5781
8414
|
break;
|
|
5782
8415
|
case ":right=right":
|
|
5783
|
-
p(
|
|
8416
|
+
p(D(t, ":"), a, D(t, "="), o);
|
|
5784
8417
|
break;
|
|
5785
8418
|
case "righttop":
|
|
5786
8419
|
case "stackedleftlinetop":
|
|
5787
8420
|
case "lefttop":
|
|
5788
|
-
o &&
|
|
8421
|
+
o && P([o], 0, 0, t, d), l.splice(l.indexOf(u), 0, ...d), s === "righttop" ? p(a) : s === "stackedleftlinetop" ? f(a) : f(...De(a, t));
|
|
5789
8422
|
break;
|
|
5790
8423
|
}
|
|
5791
|
-
let m =
|
|
8424
|
+
let m = z(l, t), h = m.rows, g = m.rowOf.get(u) ?? 0, _ = (e) => m.origin + F(u) + e, v = Math.max(_(u.cells.length - 1), ...d.map((e) => m.origin + L(e)));
|
|
5792
8425
|
switch (s) {
|
|
5793
8426
|
case "left/\\right":
|
|
5794
8427
|
case "left)(right":
|
|
5795
8428
|
case ":right=right": break;
|
|
5796
8429
|
case "righttop": {
|
|
5797
8430
|
let e = h[g][_(u.cells.length - 1)];
|
|
5798
|
-
e.borders.left = c, e.borders.bottom = c,
|
|
8431
|
+
e.borders.left = c, e.borders.bottom = c, H(h, g, _(0), _(u.cells.length - 1), "top", c);
|
|
5799
8432
|
break;
|
|
5800
8433
|
}
|
|
5801
8434
|
case "stackedleftlinetop": {
|
|
5802
8435
|
let e = h[g][_(0)];
|
|
5803
|
-
e.borders.right = c, e.borders.bottom = c,
|
|
8436
|
+
e.borders.right = c, e.borders.bottom = c, H(h, g, _(1), v, "top", c);
|
|
5804
8437
|
break;
|
|
5805
8438
|
}
|
|
5806
8439
|
case "stackedrightright":
|
|
5807
8440
|
case "mediumstackedrightright":
|
|
5808
8441
|
case "shortstackedrightright":
|
|
5809
8442
|
case "stackedleftleft":
|
|
5810
|
-
|
|
8443
|
+
ke(h, g, s, a, o, c, t);
|
|
5811
8444
|
break;
|
|
5812
|
-
default:
|
|
8445
|
+
default: H(h, g, _(1), v, "top", c);
|
|
5813
8446
|
}
|
|
5814
|
-
return
|
|
8447
|
+
return B(e, m, t);
|
|
5815
8448
|
}
|
|
5816
|
-
function
|
|
5817
|
-
let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e &&
|
|
8449
|
+
function ke(e, t, n, r, i, a, o) {
|
|
8450
|
+
let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e && E(o.document, "mpadded", [e], {
|
|
5818
8451
|
lspace: "0.2em",
|
|
5819
8452
|
width: "+0.4em"
|
|
5820
8453
|
});
|
|
@@ -5833,134 +8466,153 @@ function he(e, t, n, r, i, a, o) {
|
|
|
5833
8466
|
}) : o === t + 1 ? (u.content = l(i), n !== "shortstackedrightright" && (u.borders[c] = a)) : o > t + 1 && (n === "stackedrightright" || s) && (u.borders[c] = a), s ? e.unshift(u) : e.push(u);
|
|
5834
8467
|
});
|
|
5835
8468
|
}
|
|
5836
|
-
function
|
|
5837
|
-
for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) !t.closest("math") || t.closest("mjx-container") || t.replaceWith(t.localName === "mstack" ?
|
|
8469
|
+
function Ae(e) {
|
|
8470
|
+
for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) !t.closest("math") || t.closest("mjx-container") || t.replaceWith(t.localName === "mstack" ? Ee(t) : Oe(t));
|
|
5838
8471
|
}
|
|
5839
|
-
var
|
|
5840
|
-
var
|
|
5841
|
-
var
|
|
5842
|
-
var
|
|
5843
|
-
var
|
|
5844
|
-
var
|
|
5845
|
-
var
|
|
8472
|
+
var je = "PIE-MJX-explorer-styles";
|
|
8473
|
+
var U = "var(--pie-text, black)";
|
|
8474
|
+
var Me = "var(--pie-background, #ffffff)";
|
|
8475
|
+
var Ne = "var(--pie-border-dark, #66686A)";
|
|
8476
|
+
var W = "var(--pie-focus-outline, var(--pie-button-focus-outline, var(--pie-focus-checked-border, #1565C0)))";
|
|
8477
|
+
var G = `color-mix(in srgb, ${W} 15%, transparent)`;
|
|
8478
|
+
var Pe = `
|
|
5846
8479
|
:root mjx-container [data-sre-highlight-1]:not([data-mjx-collapsed], rect) {
|
|
5847
|
-
color: ${
|
|
5848
|
-
fill: ${
|
|
8480
|
+
color: ${U} !important;
|
|
8481
|
+
fill: ${U} !important;
|
|
5849
8482
|
}
|
|
5850
8483
|
:root mjx-container:not([data-mjx-clone-container]) [data-sre-highlight-1]:not([data-sre-enclosed], rect) {
|
|
5851
|
-
background-color: ${
|
|
8484
|
+
background-color: ${G} !important;
|
|
5852
8485
|
}
|
|
5853
8486
|
:root mjx-container rect[data-sre-highlight-1]:not([data-sre-enclosed]) {
|
|
5854
|
-
fill: ${
|
|
8487
|
+
fill: ${G} !important;
|
|
5855
8488
|
}
|
|
5856
8489
|
:root mjx-container .mjx-selected {
|
|
5857
|
-
outline: 2px solid ${
|
|
8490
|
+
outline: 2px solid ${W} !important;
|
|
5858
8491
|
}
|
|
5859
8492
|
:root mjx-container [data-sre-highlight-2] {
|
|
5860
|
-
color: ${
|
|
8493
|
+
color: ${U} !important;
|
|
5861
8494
|
background-color: transparent !important;
|
|
5862
|
-
fill: ${
|
|
5863
|
-
outline: 2px dashed ${
|
|
8495
|
+
fill: ${U} !important;
|
|
8496
|
+
outline: 2px dashed ${W} !important;
|
|
5864
8497
|
}
|
|
5865
8498
|
:root mjx-container rect[data-sre-highlight-2] {
|
|
5866
8499
|
fill: transparent !important;
|
|
5867
|
-
stroke: ${
|
|
8500
|
+
stroke: ${W} !important;
|
|
5868
8501
|
stroke-width: 2px !important;
|
|
5869
8502
|
vector-effect: non-scaling-stroke;
|
|
5870
8503
|
}
|
|
5871
8504
|
:root .MJX_LiveRegion, :root .MJX_HoverRegion, :root .MJX_ToolTip {
|
|
5872
|
-
color: ${
|
|
5873
|
-
background-color: ${
|
|
5874
|
-
border-color: ${
|
|
8505
|
+
color: ${U} !important;
|
|
8506
|
+
background-color: ${Me} !important;
|
|
8507
|
+
border-color: ${Ne} !important;
|
|
5875
8508
|
}
|
|
5876
8509
|
:root .MJX_LiveRegion > div, :root .MJX_HoverRegion > div {
|
|
5877
|
-
color: ${
|
|
5878
|
-
background-color: ${
|
|
8510
|
+
color: ${U} !important;
|
|
8511
|
+
background-color: ${G} !important;
|
|
5879
8512
|
}
|
|
5880
8513
|
`;
|
|
5881
|
-
function
|
|
8514
|
+
function Fe(e = document) {
|
|
5882
8515
|
if (e.getElementById("PIE-MJX-explorer-styles")) return;
|
|
5883
8516
|
let t = e.createElement("style");
|
|
5884
|
-
t.id =
|
|
8517
|
+
t.id = je, t.textContent = Pe, e.head.appendChild(t);
|
|
5885
8518
|
}
|
|
5886
|
-
var
|
|
5887
|
-
|
|
8519
|
+
var K = Symbol.for("@pie-element/shared-math-rendering-mathjax/speech-worker-failed");
|
|
8520
|
+
function Ie() {
|
|
8521
|
+
let e = globalThis;
|
|
8522
|
+
e[K] || (e[K] = !0, console.warn(`[math-rendering] MathJax's speech worker did not start, so speech, braille and the explorer are off. A content security policy must allow blob: workers, and scripts and fetches from the asset root. See ${t$3}`));
|
|
8523
|
+
}
|
|
8524
|
+
function Le(e) {
|
|
8525
|
+
let t = e.webworker;
|
|
8526
|
+
if (!t || t.ready) return;
|
|
8527
|
+
e.options ?? (e.options = {});
|
|
8528
|
+
let n = e.options;
|
|
8529
|
+
n.enableSpeech = !1, n.enableBraille = !1, n.speechError = () => {}, t.Post = () => Promise.reject(/* @__PURE__ */ Error("The speech worker did not start")), t.Terminate(), Ie();
|
|
8530
|
+
}
|
|
8531
|
+
function Re(e) {
|
|
8532
|
+
let t = e?.adaptor, n = t?.createWorker;
|
|
8533
|
+
!e || !t || !n || (t.createWorker = async (r, i) => {
|
|
8534
|
+
let a = await n.call(t, r, i);
|
|
8535
|
+
return a.addEventListener("error", () => Le(e), { once: !0 }), a;
|
|
8536
|
+
});
|
|
8537
|
+
}
|
|
8538
|
+
`${i}`;
|
|
8539
|
+
var ze = {
|
|
5888
8540
|
parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
|
|
5889
8541
|
overarc: "\\overparen",
|
|
5890
8542
|
napprox: "\\not\\approx",
|
|
5891
8543
|
longdiv: "\\enclose{longdiv}",
|
|
5892
8544
|
abs: ["\\left|#1\\right|", 1]
|
|
5893
8545
|
};
|
|
5894
|
-
var
|
|
5895
|
-
var
|
|
5896
|
-
var
|
|
5897
|
-
var
|
|
5898
|
-
var
|
|
8546
|
+
var Be = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)";
|
|
8547
|
+
var Ve = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/;
|
|
8548
|
+
var He = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/;
|
|
8549
|
+
var Ue = /\\embed\{newLine\}\[\]/g;
|
|
8550
|
+
var We = [
|
|
5899
8551
|
["$$", "$$"],
|
|
5900
8552
|
["$", "$"],
|
|
5901
8553
|
["\\[", "\\]"],
|
|
5902
8554
|
["\\(", "\\)"]
|
|
5903
8555
|
];
|
|
5904
|
-
var
|
|
5905
|
-
var
|
|
5906
|
-
var
|
|
5907
|
-
var
|
|
5908
|
-
var
|
|
8556
|
+
var q = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading");
|
|
8557
|
+
var Ge = "MJX-CHTML-styles";
|
|
8558
|
+
var Ke = "PIE-MJX-SVG-styles";
|
|
8559
|
+
var J = "PIE-MathJax-Menu-Settings";
|
|
8560
|
+
var qe = { "mjx-container[overflow=\"linebreak\"][display]": {
|
|
5909
8561
|
overflow: "auto clip",
|
|
5910
8562
|
"min-width": "initial !important"
|
|
5911
8563
|
} };
|
|
5912
|
-
var
|
|
5913
|
-
var
|
|
5914
|
-
function
|
|
8564
|
+
var Je = 200;
|
|
8565
|
+
var Ye = 201;
|
|
8566
|
+
function Y(e) {
|
|
5915
8567
|
let t = [...e.matches("mjx-container") ? [e] : [], ...e.querySelectorAll("mjx-container")];
|
|
5916
8568
|
for (let e of t) for (let t of [e, ...e.querySelectorAll("[data-latex],[data-latex-item]")]) t.removeAttribute("data-latex"), t.removeAttribute("data-latex-item");
|
|
5917
8569
|
}
|
|
5918
|
-
function
|
|
5919
|
-
for (let [t, n] of
|
|
8570
|
+
function X(e) {
|
|
8571
|
+
for (let [t, n] of We) if (e.startsWith(t) && e.endsWith(n)) return e.substring(t.length, e.length - n.length);
|
|
5920
8572
|
return e;
|
|
5921
8573
|
}
|
|
5922
|
-
function
|
|
5923
|
-
return
|
|
8574
|
+
function Xe(e) {
|
|
8575
|
+
return X(e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e);
|
|
5924
8576
|
}
|
|
5925
|
-
var
|
|
5926
|
-
var
|
|
5927
|
-
function
|
|
5928
|
-
let n = e.closest(`.${
|
|
5929
|
-
return n !== null && t.contains(n) && !n.classList.contains(
|
|
8577
|
+
var Ze = "mathjax_ignore";
|
|
8578
|
+
var Qe = "mathjax_process";
|
|
8579
|
+
function $e(e, t) {
|
|
8580
|
+
let n = e.closest(`.${Ze}, .${Qe}`);
|
|
8581
|
+
return n !== null && t.contains(n) && !n.classList.contains(Qe);
|
|
5930
8582
|
}
|
|
5931
|
-
function
|
|
8583
|
+
function et(e) {
|
|
5932
8584
|
for (let t of e.querySelectorAll("[data-latex]")) {
|
|
5933
|
-
if (t.dataset.mathHandled || t.closest("mjx-container") ||
|
|
8585
|
+
if (t.dataset.mathHandled || t.closest("mjx-container") || $e(t, e)) continue;
|
|
5934
8586
|
let n = t.textContent;
|
|
5935
|
-
n && (t.textContent = `\\(${
|
|
8587
|
+
n && (t.textContent = `\\(${Xe(n)}\\)`.replace(Ue, "\\newline "), t.dataset.mathHandled = "true");
|
|
5936
8588
|
}
|
|
5937
8589
|
}
|
|
5938
|
-
function
|
|
8590
|
+
function tt(e) {
|
|
5939
8591
|
for (let t of e.querySelectorAll("math")) t.closest("mjx-container") || t.setAttribute("displaystyle", "true");
|
|
5940
8592
|
}
|
|
5941
|
-
function
|
|
8593
|
+
function nt(e, t) {
|
|
5942
8594
|
for (let t of e.querySelectorAll("math")) if (!t.closest("mjx-assistive-mml")) return !0;
|
|
5943
|
-
return (t ?
|
|
8595
|
+
return (t ? He : Ve).test(e.textContent ?? "");
|
|
5944
8596
|
}
|
|
5945
|
-
function
|
|
8597
|
+
function rt(e) {
|
|
5946
8598
|
return new Promise((t, n) => {
|
|
5947
|
-
let { useSingleDollar: r = !1, accessibility: i = !0, loadFonts:
|
|
8599
|
+
let { useSingleDollar: r = !1, accessibility: i = !0, loadFonts: a = !0, srcUrl: o } = e, s = d(e, import.meta.url), c = {
|
|
5948
8600
|
loader: {
|
|
5949
8601
|
load: i ? ["a11y/assistive-mml"] : [],
|
|
5950
8602
|
failed: (e) => n(e),
|
|
5951
8603
|
"output/svg": { ready: (e) => {
|
|
5952
|
-
let t =
|
|
5953
|
-
return
|
|
8604
|
+
let t = S();
|
|
8605
|
+
return it(t) && at(t), e;
|
|
5954
8606
|
} }
|
|
5955
8607
|
},
|
|
5956
8608
|
startup: {
|
|
5957
8609
|
typeset: !1,
|
|
5958
8610
|
ready: () => {
|
|
5959
|
-
let e =
|
|
5960
|
-
i && (
|
|
8611
|
+
let e = S(), r = e?.startup, i = it(e);
|
|
8612
|
+
i && (at(e), ot(e, s.speechLocales), f(e?._?.a11y?.sre_ts?.locales, s.speechLocales)), r?.defaultReady?.(), i && (st(r?.document), r?.document?.addStyles?.(qe), Re(r?.document)), Promise.resolve(r?.promise).then(() => t(), n);
|
|
5961
8613
|
}
|
|
5962
8614
|
},
|
|
5963
|
-
tex: { macros: { ...
|
|
8615
|
+
tex: { macros: { ...ze } },
|
|
5964
8616
|
output: { displayOverflow: "linebreak" },
|
|
5965
8617
|
options: {
|
|
5966
8618
|
enableMenu: i,
|
|
@@ -5972,165 +8624,173 @@ function Be(e) {
|
|
|
5972
8624
|
a11y: { inTabOrder: !1 }
|
|
5973
8625
|
}
|
|
5974
8626
|
};
|
|
5975
|
-
r &&
|
|
8627
|
+
r && c.tex && (console.warn(Be), c.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], c.tex.processEscapes = !0), a || (c.chtml = { fontURL: "" });
|
|
8628
|
+
let l = p(s.speechLocales);
|
|
8629
|
+
l && c.options && (c.options.sre = { locale: l }), ne(c, {
|
|
8630
|
+
...s,
|
|
8631
|
+
srcUrl: o
|
|
8632
|
+
}).then((e) => {
|
|
8633
|
+
e || t();
|
|
8634
|
+
}, n);
|
|
5976
8635
|
});
|
|
5977
8636
|
}
|
|
5978
|
-
function
|
|
8637
|
+
function it(e) {
|
|
5979
8638
|
return !!e?.version?.startsWith("4.");
|
|
5980
8639
|
}
|
|
5981
|
-
function
|
|
8640
|
+
function at(e) {
|
|
5982
8641
|
let t = e?._?.output, n = t?.chtml_ts?.CHTML;
|
|
5983
|
-
n && (n.STYLESHEETID =
|
|
8642
|
+
n && (n.STYLESHEETID = C);
|
|
5984
8643
|
let r = t?.svg_ts?.SVG;
|
|
5985
|
-
r && (r.STYLESHEETID =
|
|
8644
|
+
r && (r.STYLESHEETID = Ke);
|
|
5986
8645
|
}
|
|
5987
|
-
function
|
|
5988
|
-
let
|
|
5989
|
-
if (
|
|
5990
|
-
|
|
8646
|
+
function ot(e, t) {
|
|
8647
|
+
let n = e?._?.ui?.menu?.Menu?.Menu;
|
|
8648
|
+
if (n) {
|
|
8649
|
+
n.MENU_STORAGE = J;
|
|
5991
8650
|
try {
|
|
5992
|
-
let e = localStorage.getItem(
|
|
8651
|
+
let e = localStorage.getItem(J);
|
|
5993
8652
|
if (!e) return;
|
|
5994
|
-
let { assistiveMml:
|
|
5995
|
-
if (
|
|
5996
|
-
Object.keys(
|
|
8653
|
+
let { assistiveMml: n, locale: r, ...i } = JSON.parse(e), a = r === void 0 || !t || t.has(r);
|
|
8654
|
+
if (n === void 0 && a) return;
|
|
8655
|
+
a && r !== void 0 && (i.locale = r), Object.keys(i).length ? localStorage.setItem(J, JSON.stringify(i)) : localStorage.removeItem(J);
|
|
5997
8656
|
} catch {}
|
|
5998
8657
|
}
|
|
5999
8658
|
}
|
|
6000
|
-
function
|
|
8659
|
+
function st(e) {
|
|
6001
8660
|
if (!e) return;
|
|
6002
8661
|
let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
|
|
6003
8662
|
let n = e.typesetRoot;
|
|
6004
|
-
!n || t.has(n) || (
|
|
8663
|
+
!n || t.has(n) || (Y(n), t.add(n));
|
|
6005
8664
|
};
|
|
6006
|
-
e.addRenderAction?.("pie-strip-latex",
|
|
8665
|
+
e.addRenderAction?.("pie-strip-latex", Ye, (e) => {
|
|
6007
8666
|
for (let t of e.math ?? []) n(t);
|
|
6008
8667
|
return !1;
|
|
6009
8668
|
}, (e) => {
|
|
6010
8669
|
let t = e.typesetRoot;
|
|
6011
|
-
return t &&
|
|
8670
|
+
return t && Y(t), !1;
|
|
6012
8671
|
});
|
|
6013
8672
|
let r = e.outputJax?.chtmlStyles;
|
|
6014
|
-
r?.id ===
|
|
8673
|
+
r?.id === Ge && (r.id = C), ut();
|
|
6015
8674
|
}
|
|
6016
|
-
function
|
|
6017
|
-
return e instanceof HTMLStyleElement &&
|
|
8675
|
+
function ct(e) {
|
|
8676
|
+
return e instanceof HTMLStyleElement && ie.includes(e.id);
|
|
6018
8677
|
}
|
|
6019
|
-
function
|
|
6020
|
-
|
|
8678
|
+
function lt(e) {
|
|
8679
|
+
x("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
|
|
6021
8680
|
}
|
|
6022
|
-
function
|
|
6023
|
-
let e = document.head, t = [...e.children].find(
|
|
8681
|
+
function ut() {
|
|
8682
|
+
let e = document.head, t = [...e.children].find(ct);
|
|
6024
8683
|
if (t) {
|
|
6025
|
-
|
|
8684
|
+
lt(t);
|
|
6026
8685
|
return;
|
|
6027
8686
|
}
|
|
6028
8687
|
let n = new MutationObserver((e) => {
|
|
6029
8688
|
for (let t of e) {
|
|
6030
|
-
let e = [...t.addedNodes].find(
|
|
8689
|
+
let e = [...t.addedNodes].find(ct);
|
|
6031
8690
|
if (e) {
|
|
6032
|
-
|
|
8691
|
+
lt(e), n.disconnect();
|
|
6033
8692
|
return;
|
|
6034
8693
|
}
|
|
6035
8694
|
}
|
|
6036
8695
|
});
|
|
6037
8696
|
n.observe(e, { childList: !0 });
|
|
6038
8697
|
}
|
|
6039
|
-
function
|
|
8698
|
+
function dt(e) {
|
|
6040
8699
|
let t = e?.math;
|
|
6041
8700
|
if (!t?.remove) return;
|
|
6042
|
-
let n = [...t].filter((e) => (e.state?.() ?? 0) >=
|
|
8701
|
+
let n = [...t].filter((e) => (e.state?.() ?? 0) >= Je && e.typesetRoot?.isConnected === !1);
|
|
6043
8702
|
if (n.length !== 0) {
|
|
6044
8703
|
for (let e of [...n].reverse()) e.clear?.();
|
|
6045
8704
|
t.remove(...n);
|
|
6046
8705
|
}
|
|
6047
8706
|
}
|
|
6048
|
-
function
|
|
8707
|
+
function ft(e) {
|
|
6049
8708
|
return new Promise((t, n) => {
|
|
6050
8709
|
let r = e.startup ?? {};
|
|
6051
8710
|
e.startup = r;
|
|
6052
8711
|
let i = r.ready;
|
|
6053
8712
|
r.ready = () => {
|
|
6054
|
-
let e =
|
|
8713
|
+
let e = S()?.startup;
|
|
6055
8714
|
i ? i.call(r) : e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => t(), n);
|
|
6056
8715
|
};
|
|
6057
8716
|
});
|
|
6058
8717
|
}
|
|
6059
|
-
function
|
|
6060
|
-
let t =
|
|
6061
|
-
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() :
|
|
8718
|
+
function pt(e) {
|
|
8719
|
+
let t = S();
|
|
8720
|
+
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : ft(t) : rt(e);
|
|
6062
8721
|
}
|
|
6063
|
-
function
|
|
6064
|
-
return
|
|
6065
|
-
|
|
8722
|
+
function mt(e) {
|
|
8723
|
+
return pt(e).then(() => {
|
|
8724
|
+
let e = S();
|
|
8725
|
+
e && typeof e.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
|
|
6066
8726
|
});
|
|
6067
8727
|
}
|
|
6068
|
-
function
|
|
6069
|
-
let t =
|
|
6070
|
-
return n || (n =
|
|
8728
|
+
function ht(e) {
|
|
8729
|
+
let t = re, n = t[q];
|
|
8730
|
+
return n || (n = mt(e), t[q] = n), n;
|
|
6071
8731
|
}
|
|
6072
|
-
function
|
|
8732
|
+
function gt(e = {}) {
|
|
6073
8733
|
let t = e.useSingleDollar ?? !1;
|
|
6074
8734
|
return async (n) => {
|
|
6075
8735
|
if (typeof window > "u") return;
|
|
6076
|
-
let
|
|
6077
|
-
|
|
6078
|
-
let
|
|
6079
|
-
if (!
|
|
6080
|
-
|
|
8736
|
+
let r = ae();
|
|
8737
|
+
r && x("mathjax-3-global", `window.MathJax is MathJax ${r}`), et(n), ce(n), tt(n), Ae(n);
|
|
8738
|
+
let i = ht(e);
|
|
8739
|
+
if (!nt(n, t)) {
|
|
8740
|
+
i.catch(() => {});
|
|
6081
8741
|
return;
|
|
6082
8742
|
}
|
|
6083
|
-
await
|
|
6084
|
-
let
|
|
6085
|
-
if (await
|
|
6086
|
-
|
|
8743
|
+
await i;
|
|
8744
|
+
let a = S();
|
|
8745
|
+
if (await a?.startup?.promise, typeof a?.typesetPromise == "function") {
|
|
8746
|
+
Fe(), dt(a.startup?.document);
|
|
6087
8747
|
try {
|
|
6088
|
-
await
|
|
8748
|
+
await a.typesetPromise([n]);
|
|
6089
8749
|
} catch (e) {
|
|
6090
|
-
throw
|
|
8750
|
+
throw a.typesetClear?.([n]), e;
|
|
6091
8751
|
}
|
|
6092
|
-
|
|
8752
|
+
Y(n);
|
|
6093
8753
|
}
|
|
6094
8754
|
};
|
|
6095
8755
|
}
|
|
6096
|
-
var
|
|
6097
|
-
var
|
|
6098
|
-
var
|
|
6099
|
-
var
|
|
6100
|
-
var
|
|
6101
|
-
var
|
|
6102
|
-
function
|
|
6103
|
-
return !!window[
|
|
8756
|
+
var vt = "@pie-lib/math-rendering";
|
|
8757
|
+
var yt = "@pie-lib/math-rendering@2";
|
|
8758
|
+
var bt = "pie-print";
|
|
8759
|
+
var xt = 50;
|
|
8760
|
+
var St = 1e4;
|
|
8761
|
+
var Ct = null;
|
|
8762
|
+
function wt() {
|
|
8763
|
+
return !!window[yt]?.opts?.useSingleDollar;
|
|
6104
8764
|
}
|
|
6105
|
-
function
|
|
6106
|
-
return
|
|
8765
|
+
function Tt() {
|
|
8766
|
+
return Ct || (Ct = gt({ useSingleDollar: wt() })), Ct;
|
|
6107
8767
|
}
|
|
6108
|
-
function
|
|
8768
|
+
function Z() {
|
|
6109
8769
|
if (typeof window > "u") return null;
|
|
6110
|
-
let e = window[
|
|
8770
|
+
let e = window[vt];
|
|
6111
8771
|
return typeof e?.renderMath == "function" && e.renderMath !== $ ? e : null;
|
|
6112
8772
|
}
|
|
6113
|
-
function
|
|
8773
|
+
function Et(e) {
|
|
6114
8774
|
let t = e;
|
|
6115
8775
|
for (; t;) {
|
|
6116
|
-
if (t instanceof Element && t.localName ===
|
|
8776
|
+
if (t instanceof Element && t.localName === bt) return t;
|
|
6117
8777
|
t = t instanceof ShadowRoot ? t.host : t.parentNode;
|
|
6118
8778
|
}
|
|
6119
8779
|
return null;
|
|
6120
8780
|
}
|
|
6121
|
-
function
|
|
8781
|
+
function Q() {
|
|
6122
8782
|
let e = window.renderMath;
|
|
6123
8783
|
return typeof e == "function" ? e : null;
|
|
6124
8784
|
}
|
|
6125
|
-
async function
|
|
6126
|
-
let t =
|
|
8785
|
+
async function Dt(e) {
|
|
8786
|
+
let t = Et(e);
|
|
6127
8787
|
if (!t) return null;
|
|
6128
|
-
let n =
|
|
8788
|
+
let n = Q();
|
|
6129
8789
|
if (n || t.mathRenderingModuleUrlImported !== !0) return n;
|
|
6130
|
-
let r = Date.now() +
|
|
8790
|
+
let r = Date.now() + St;
|
|
6131
8791
|
for (; Date.now() < r;) {
|
|
6132
|
-
await new Promise((e) => setTimeout(e,
|
|
6133
|
-
let e =
|
|
8792
|
+
await new Promise((e) => setTimeout(e, xt));
|
|
8793
|
+
let e = Q();
|
|
6134
8794
|
if (e) return e;
|
|
6135
8795
|
}
|
|
6136
8796
|
return null;
|
|
@@ -6139,8 +8799,8 @@ var $ = async (e) => {
|
|
|
6139
8799
|
if (typeof window > "u") return;
|
|
6140
8800
|
let t = typeof e == "string", n;
|
|
6141
8801
|
t ? (n = document.createElement("div"), n.innerHTML = e) : n = e || document.body;
|
|
6142
|
-
let r =
|
|
6143
|
-
return r ? await r.renderMath?.(n) : i && i !== $ ? await i(n) : await
|
|
8802
|
+
let r = Z(), i = r || t ? null : await Dt(n);
|
|
8803
|
+
return r ? await r.renderMath?.(n) : i && i !== $ ? await i(n) : await Tt()(n), t ? n.innerHTML : void 0;
|
|
6144
8804
|
};
|
|
6145
8805
|
//#endregion
|
|
6146
8806
|
//#region ../../shared/translator/dist/en.js
|
|
@@ -8978,7 +11638,7 @@ function Tile($$anchor, $$props) {
|
|
|
8978
11638
|
var consequent_1 = ($$anchor) => {
|
|
8979
11639
|
var span_1 = root_1$1();
|
|
8980
11640
|
let classes_2;
|
|
8981
|
-
html(span_1, label, true);
|
|
11641
|
+
html$2(span_1, () => b$1(label()), true);
|
|
8982
11642
|
reset(span_1);
|
|
8983
11643
|
template_effect(() => classes_2 = set_class(span_1, 1, "tile-label svelte-1hgaksk", null, classes_2, { "tile-label-below": get$1(hasImage) }));
|
|
8984
11644
|
append($$anchor, span_1);
|
|
@@ -9167,15 +11827,15 @@ var $$css$1 = {
|
|
|
9167
11827
|
function TeacherInstructions($$anchor, $$props) {
|
|
9168
11828
|
push($$props, true);
|
|
9169
11829
|
append_styles$1($$anchor, $$css$1);
|
|
9170
|
-
let html
|
|
11830
|
+
let html = prop($$props, "html", 7), language = prop($$props, "language", 7);
|
|
9171
11831
|
let expanded = /* @__PURE__ */ state(false);
|
|
9172
11832
|
const panelId = `venn-teacher-instructions-${Math.random().toString(36).slice(2, 10)}`;
|
|
9173
11833
|
var $$exports = {
|
|
9174
11834
|
get html() {
|
|
9175
|
-
return html
|
|
11835
|
+
return html();
|
|
9176
11836
|
},
|
|
9177
11837
|
set html($$value) {
|
|
9178
|
-
html
|
|
11838
|
+
html($$value);
|
|
9179
11839
|
flushSync();
|
|
9180
11840
|
},
|
|
9181
11841
|
get language() {
|
|
@@ -9190,7 +11850,7 @@ function TeacherInstructions($$anchor, $$props) {
|
|
|
9190
11850
|
var button = child(div);
|
|
9191
11851
|
var text = only_child(button, true);
|
|
9192
11852
|
var div_1 = sibling(button, 2);
|
|
9193
|
-
html(div_1,
|
|
11853
|
+
html$2(div_1, () => b$1(html()), true);
|
|
9194
11854
|
reset(div_1);
|
|
9195
11855
|
reset(div);
|
|
9196
11856
|
template_effect(($0) => {
|
|
@@ -10169,7 +12829,7 @@ function VennClassification($$anchor, $$props) {
|
|
|
10169
12829
|
var node_1 = sibling(node, 2);
|
|
10170
12830
|
var consequent_1 = ($$anchor) => {
|
|
10171
12831
|
var div_1 = root();
|
|
10172
|
-
html(div_1, () => get$1(prompt), true);
|
|
12832
|
+
html$2(div_1, () => b$1(get$1(prompt)), true);
|
|
10173
12833
|
reset(div_1);
|
|
10174
12834
|
append($$anchor, div_1);
|
|
10175
12835
|
};
|