mashlib 1.8.7 → 1.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mashlib.js +1850 -97
- package/dist/mashlib.js.map +1 -1
- package/dist/mashlib.min.js +1 -1
- package/dist/mashlib.min.js.LICENSE.txt +2 -0
- package/dist/mashlib.min.js.map +1 -1
- package/package.json +11 -11
package/dist/mashlib.js
CHANGED
|
@@ -5077,7 +5077,10 @@ function removeOidcQueryParam(redirectUrl) {
|
|
|
5077
5077
|
cleanedUrl.searchParams.delete("code");
|
|
5078
5078
|
cleanedUrl.searchParams.delete("state");
|
|
5079
5079
|
cleanedUrl.hash = "";
|
|
5080
|
-
|
|
5080
|
+
if (redirectUrl.includes(`${cleanedUrl.origin}/`)) {
|
|
5081
|
+
return cleanedUrl.href;
|
|
5082
|
+
}
|
|
5083
|
+
return `${cleanedUrl.origin}${cleanedUrl.href.substring(cleanedUrl.origin.length + 1)}`;
|
|
5081
5084
|
}
|
|
5082
5085
|
async function clearOidcPersistentStorage() {
|
|
5083
5086
|
const client = new _inrupt_oidc_client__WEBPACK_IMPORTED_MODULE_0__.OidcClient({
|
|
@@ -5745,7 +5748,7 @@ class IssuerConfigFetcher {
|
|
|
5745
5748
|
}
|
|
5746
5749
|
async fetchConfig(issuer) {
|
|
5747
5750
|
let issuerConfig;
|
|
5748
|
-
const openIdConfigUrl = new URL(exports.WELL_KNOWN_OPENID_CONFIG, issuer).href;
|
|
5751
|
+
const openIdConfigUrl = new URL(exports.WELL_KNOWN_OPENID_CONFIG, issuer.endsWith("/") ? issuer : `${issuer}/`).href;
|
|
5749
5752
|
const issuerConfigRequestBody = await window.fetch(openIdConfigUrl);
|
|
5750
5753
|
try {
|
|
5751
5754
|
issuerConfig = processConfig(await issuerConfigRequestBody.json());
|
|
@@ -5922,12 +5925,6 @@ class AuthCodeRedirectHandler {
|
|
|
5922
5925
|
webId: tokens.webId,
|
|
5923
5926
|
isLoggedIn: "true",
|
|
5924
5927
|
}, { secure: true });
|
|
5925
|
-
url.searchParams.delete("code");
|
|
5926
|
-
await this.storageUtility.setForUser(storedSessionId, {
|
|
5927
|
-
redirectUrl: url.toString(),
|
|
5928
|
-
}, {
|
|
5929
|
-
secure: false,
|
|
5930
|
-
});
|
|
5931
5928
|
const sessionInfo = await this.sessionInfoManager.get(storedSessionId);
|
|
5932
5929
|
if (!sessionInfo) {
|
|
5933
5930
|
throw new Error(`Could not retrieve session: [${storedSessionId}].`);
|
|
@@ -15189,10 +15186,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
15189
15186
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
15190
15187
|
/* harmony export */ });
|
|
15191
15188
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
|
15192
|
-
buildTime: "2023-
|
|
15193
|
-
commit: "
|
|
15189
|
+
buildTime: "2023-03-17T15:32:39Z",
|
|
15190
|
+
commit: "5e5bbf6e7b264c577e90478def4386bb64d81d12",
|
|
15194
15191
|
npmInfo: {
|
|
15195
|
-
mashlib: '1.8.
|
|
15192
|
+
mashlib: '1.8.8',
|
|
15196
15193
|
npm: '8.19.4',
|
|
15197
15194
|
node: '16.19.1',
|
|
15198
15195
|
v8: '9.4.146.26-node.24',
|
|
@@ -25495,6 +25492,1784 @@ if (true) {
|
|
|
25495
25492
|
}
|
|
25496
25493
|
|
|
25497
25494
|
|
|
25495
|
+
/***/ }),
|
|
25496
|
+
|
|
25497
|
+
/***/ "./node_modules/dompurify/dist/purify.js":
|
|
25498
|
+
/*!***********************************************!*\
|
|
25499
|
+
!*** ./node_modules/dompurify/dist/purify.js ***!
|
|
25500
|
+
\***********************************************/
|
|
25501
|
+
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
25502
|
+
|
|
25503
|
+
/* provided dependency */ var console = __webpack_require__(/*! ./node_modules/console-browserify/index.js */ "./node_modules/console-browserify/index.js");
|
|
25504
|
+
/*! @license DOMPurify 3.0.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.1/LICENSE */
|
|
25505
|
+
|
|
25506
|
+
(function (global, factory) {
|
|
25507
|
+
true ? module.exports = factory() :
|
|
25508
|
+
0;
|
|
25509
|
+
})(this, (function () { 'use strict';
|
|
25510
|
+
|
|
25511
|
+
function _typeof(obj) {
|
|
25512
|
+
"@babel/helpers - typeof";
|
|
25513
|
+
|
|
25514
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
25515
|
+
return typeof obj;
|
|
25516
|
+
} : function (obj) {
|
|
25517
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
25518
|
+
}, _typeof(obj);
|
|
25519
|
+
}
|
|
25520
|
+
|
|
25521
|
+
function _setPrototypeOf(o, p) {
|
|
25522
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
25523
|
+
o.__proto__ = p;
|
|
25524
|
+
return o;
|
|
25525
|
+
};
|
|
25526
|
+
|
|
25527
|
+
return _setPrototypeOf(o, p);
|
|
25528
|
+
}
|
|
25529
|
+
|
|
25530
|
+
function _isNativeReflectConstruct() {
|
|
25531
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
25532
|
+
if (Reflect.construct.sham) return false;
|
|
25533
|
+
if (typeof Proxy === "function") return true;
|
|
25534
|
+
|
|
25535
|
+
try {
|
|
25536
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
25537
|
+
return true;
|
|
25538
|
+
} catch (e) {
|
|
25539
|
+
return false;
|
|
25540
|
+
}
|
|
25541
|
+
}
|
|
25542
|
+
|
|
25543
|
+
function _construct(Parent, args, Class) {
|
|
25544
|
+
if (_isNativeReflectConstruct()) {
|
|
25545
|
+
_construct = Reflect.construct;
|
|
25546
|
+
} else {
|
|
25547
|
+
_construct = function _construct(Parent, args, Class) {
|
|
25548
|
+
var a = [null];
|
|
25549
|
+
a.push.apply(a, args);
|
|
25550
|
+
var Constructor = Function.bind.apply(Parent, a);
|
|
25551
|
+
var instance = new Constructor();
|
|
25552
|
+
if (Class) _setPrototypeOf(instance, Class.prototype);
|
|
25553
|
+
return instance;
|
|
25554
|
+
};
|
|
25555
|
+
}
|
|
25556
|
+
|
|
25557
|
+
return _construct.apply(null, arguments);
|
|
25558
|
+
}
|
|
25559
|
+
|
|
25560
|
+
function _slicedToArray(arr, i) {
|
|
25561
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
25562
|
+
}
|
|
25563
|
+
|
|
25564
|
+
function _toConsumableArray(arr) {
|
|
25565
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
25566
|
+
}
|
|
25567
|
+
|
|
25568
|
+
function _arrayWithoutHoles(arr) {
|
|
25569
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
25570
|
+
}
|
|
25571
|
+
|
|
25572
|
+
function _arrayWithHoles(arr) {
|
|
25573
|
+
if (Array.isArray(arr)) return arr;
|
|
25574
|
+
}
|
|
25575
|
+
|
|
25576
|
+
function _iterableToArray(iter) {
|
|
25577
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
25578
|
+
}
|
|
25579
|
+
|
|
25580
|
+
function _iterableToArrayLimit(arr, i) {
|
|
25581
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
25582
|
+
|
|
25583
|
+
if (_i == null) return;
|
|
25584
|
+
var _arr = [];
|
|
25585
|
+
var _n = true;
|
|
25586
|
+
var _d = false;
|
|
25587
|
+
|
|
25588
|
+
var _s, _e;
|
|
25589
|
+
|
|
25590
|
+
try {
|
|
25591
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
25592
|
+
_arr.push(_s.value);
|
|
25593
|
+
|
|
25594
|
+
if (i && _arr.length === i) break;
|
|
25595
|
+
}
|
|
25596
|
+
} catch (err) {
|
|
25597
|
+
_d = true;
|
|
25598
|
+
_e = err;
|
|
25599
|
+
} finally {
|
|
25600
|
+
try {
|
|
25601
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
25602
|
+
} finally {
|
|
25603
|
+
if (_d) throw _e;
|
|
25604
|
+
}
|
|
25605
|
+
}
|
|
25606
|
+
|
|
25607
|
+
return _arr;
|
|
25608
|
+
}
|
|
25609
|
+
|
|
25610
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
25611
|
+
if (!o) return;
|
|
25612
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
25613
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
25614
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
25615
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
25616
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
25617
|
+
}
|
|
25618
|
+
|
|
25619
|
+
function _arrayLikeToArray(arr, len) {
|
|
25620
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
25621
|
+
|
|
25622
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
25623
|
+
|
|
25624
|
+
return arr2;
|
|
25625
|
+
}
|
|
25626
|
+
|
|
25627
|
+
function _nonIterableSpread() {
|
|
25628
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
25629
|
+
}
|
|
25630
|
+
|
|
25631
|
+
function _nonIterableRest() {
|
|
25632
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
25633
|
+
}
|
|
25634
|
+
|
|
25635
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
25636
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
25637
|
+
|
|
25638
|
+
if (!it) {
|
|
25639
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
25640
|
+
if (it) o = it;
|
|
25641
|
+
var i = 0;
|
|
25642
|
+
|
|
25643
|
+
var F = function () {};
|
|
25644
|
+
|
|
25645
|
+
return {
|
|
25646
|
+
s: F,
|
|
25647
|
+
n: function () {
|
|
25648
|
+
if (i >= o.length) return {
|
|
25649
|
+
done: true
|
|
25650
|
+
};
|
|
25651
|
+
return {
|
|
25652
|
+
done: false,
|
|
25653
|
+
value: o[i++]
|
|
25654
|
+
};
|
|
25655
|
+
},
|
|
25656
|
+
e: function (e) {
|
|
25657
|
+
throw e;
|
|
25658
|
+
},
|
|
25659
|
+
f: F
|
|
25660
|
+
};
|
|
25661
|
+
}
|
|
25662
|
+
|
|
25663
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
25664
|
+
}
|
|
25665
|
+
|
|
25666
|
+
var normalCompletion = true,
|
|
25667
|
+
didErr = false,
|
|
25668
|
+
err;
|
|
25669
|
+
return {
|
|
25670
|
+
s: function () {
|
|
25671
|
+
it = it.call(o);
|
|
25672
|
+
},
|
|
25673
|
+
n: function () {
|
|
25674
|
+
var step = it.next();
|
|
25675
|
+
normalCompletion = step.done;
|
|
25676
|
+
return step;
|
|
25677
|
+
},
|
|
25678
|
+
e: function (e) {
|
|
25679
|
+
didErr = true;
|
|
25680
|
+
err = e;
|
|
25681
|
+
},
|
|
25682
|
+
f: function () {
|
|
25683
|
+
try {
|
|
25684
|
+
if (!normalCompletion && it.return != null) it.return();
|
|
25685
|
+
} finally {
|
|
25686
|
+
if (didErr) throw err;
|
|
25687
|
+
}
|
|
25688
|
+
}
|
|
25689
|
+
};
|
|
25690
|
+
}
|
|
25691
|
+
|
|
25692
|
+
var entries = Object.entries,
|
|
25693
|
+
setPrototypeOf = Object.setPrototypeOf,
|
|
25694
|
+
isFrozen = Object.isFrozen,
|
|
25695
|
+
getPrototypeOf = Object.getPrototypeOf,
|
|
25696
|
+
getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
25697
|
+
var freeze = Object.freeze,
|
|
25698
|
+
seal = Object.seal,
|
|
25699
|
+
create = Object.create; // eslint-disable-line import/no-mutable-exports
|
|
25700
|
+
|
|
25701
|
+
var _ref = typeof Reflect !== 'undefined' && Reflect,
|
|
25702
|
+
apply = _ref.apply,
|
|
25703
|
+
construct = _ref.construct;
|
|
25704
|
+
|
|
25705
|
+
if (!apply) {
|
|
25706
|
+
apply = function apply(fun, thisValue, args) {
|
|
25707
|
+
return fun.apply(thisValue, args);
|
|
25708
|
+
};
|
|
25709
|
+
}
|
|
25710
|
+
|
|
25711
|
+
if (!freeze) {
|
|
25712
|
+
freeze = function freeze(x) {
|
|
25713
|
+
return x;
|
|
25714
|
+
};
|
|
25715
|
+
}
|
|
25716
|
+
|
|
25717
|
+
if (!seal) {
|
|
25718
|
+
seal = function seal(x) {
|
|
25719
|
+
return x;
|
|
25720
|
+
};
|
|
25721
|
+
}
|
|
25722
|
+
|
|
25723
|
+
if (!construct) {
|
|
25724
|
+
construct = function construct(Func, args) {
|
|
25725
|
+
return _construct(Func, _toConsumableArray(args));
|
|
25726
|
+
};
|
|
25727
|
+
}
|
|
25728
|
+
|
|
25729
|
+
var arrayForEach = unapply(Array.prototype.forEach);
|
|
25730
|
+
var arrayPop = unapply(Array.prototype.pop);
|
|
25731
|
+
var arrayPush = unapply(Array.prototype.push);
|
|
25732
|
+
var stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
25733
|
+
var stringToString = unapply(String.prototype.toString);
|
|
25734
|
+
var stringMatch = unapply(String.prototype.match);
|
|
25735
|
+
var stringReplace = unapply(String.prototype.replace);
|
|
25736
|
+
var stringIndexOf = unapply(String.prototype.indexOf);
|
|
25737
|
+
var stringTrim = unapply(String.prototype.trim);
|
|
25738
|
+
var regExpTest = unapply(RegExp.prototype.test);
|
|
25739
|
+
var typeErrorCreate = unconstruct(TypeError);
|
|
25740
|
+
function unapply(func) {
|
|
25741
|
+
return function (thisArg) {
|
|
25742
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
25743
|
+
args[_key - 1] = arguments[_key];
|
|
25744
|
+
}
|
|
25745
|
+
|
|
25746
|
+
return apply(func, thisArg, args);
|
|
25747
|
+
};
|
|
25748
|
+
}
|
|
25749
|
+
function unconstruct(func) {
|
|
25750
|
+
return function () {
|
|
25751
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
25752
|
+
args[_key2] = arguments[_key2];
|
|
25753
|
+
}
|
|
25754
|
+
|
|
25755
|
+
return construct(func, args);
|
|
25756
|
+
};
|
|
25757
|
+
}
|
|
25758
|
+
/* Add properties to a lookup table */
|
|
25759
|
+
|
|
25760
|
+
function addToSet(set, array, transformCaseFunc) {
|
|
25761
|
+
transformCaseFunc = transformCaseFunc ? transformCaseFunc : stringToLowerCase;
|
|
25762
|
+
|
|
25763
|
+
if (setPrototypeOf) {
|
|
25764
|
+
// Make 'in' and truthy checks like Boolean(set.constructor)
|
|
25765
|
+
// independent of any properties defined on Object.prototype.
|
|
25766
|
+
// Prevent prototype setters from intercepting set as a this value.
|
|
25767
|
+
setPrototypeOf(set, null);
|
|
25768
|
+
}
|
|
25769
|
+
|
|
25770
|
+
var l = array.length;
|
|
25771
|
+
|
|
25772
|
+
while (l--) {
|
|
25773
|
+
var element = array[l];
|
|
25774
|
+
|
|
25775
|
+
if (typeof element === 'string') {
|
|
25776
|
+
var lcElement = transformCaseFunc(element);
|
|
25777
|
+
|
|
25778
|
+
if (lcElement !== element) {
|
|
25779
|
+
// Config presets (e.g. tags.js, attrs.js) are immutable.
|
|
25780
|
+
if (!isFrozen(array)) {
|
|
25781
|
+
array[l] = lcElement;
|
|
25782
|
+
}
|
|
25783
|
+
|
|
25784
|
+
element = lcElement;
|
|
25785
|
+
}
|
|
25786
|
+
}
|
|
25787
|
+
|
|
25788
|
+
set[element] = true;
|
|
25789
|
+
}
|
|
25790
|
+
|
|
25791
|
+
return set;
|
|
25792
|
+
}
|
|
25793
|
+
/* Shallow clone an object */
|
|
25794
|
+
|
|
25795
|
+
function clone(object) {
|
|
25796
|
+
var newObject = create(null);
|
|
25797
|
+
|
|
25798
|
+
var _iterator = _createForOfIteratorHelper(entries(object)),
|
|
25799
|
+
_step;
|
|
25800
|
+
|
|
25801
|
+
try {
|
|
25802
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
25803
|
+
var _step$value = _slicedToArray(_step.value, 2),
|
|
25804
|
+
property = _step$value[0],
|
|
25805
|
+
value = _step$value[1];
|
|
25806
|
+
|
|
25807
|
+
newObject[property] = value;
|
|
25808
|
+
}
|
|
25809
|
+
} catch (err) {
|
|
25810
|
+
_iterator.e(err);
|
|
25811
|
+
} finally {
|
|
25812
|
+
_iterator.f();
|
|
25813
|
+
}
|
|
25814
|
+
|
|
25815
|
+
return newObject;
|
|
25816
|
+
}
|
|
25817
|
+
/* This method automatically checks if the prop is function
|
|
25818
|
+
* or getter and behaves accordingly. */
|
|
25819
|
+
|
|
25820
|
+
function lookupGetter(object, prop) {
|
|
25821
|
+
while (object !== null) {
|
|
25822
|
+
var desc = getOwnPropertyDescriptor(object, prop);
|
|
25823
|
+
|
|
25824
|
+
if (desc) {
|
|
25825
|
+
if (desc.get) {
|
|
25826
|
+
return unapply(desc.get);
|
|
25827
|
+
}
|
|
25828
|
+
|
|
25829
|
+
if (typeof desc.value === 'function') {
|
|
25830
|
+
return unapply(desc.value);
|
|
25831
|
+
}
|
|
25832
|
+
}
|
|
25833
|
+
|
|
25834
|
+
object = getPrototypeOf(object);
|
|
25835
|
+
}
|
|
25836
|
+
|
|
25837
|
+
function fallbackValue(element) {
|
|
25838
|
+
console.warn('fallback value for', element);
|
|
25839
|
+
return null;
|
|
25840
|
+
}
|
|
25841
|
+
|
|
25842
|
+
return fallbackValue;
|
|
25843
|
+
}
|
|
25844
|
+
|
|
25845
|
+
var html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); // SVG
|
|
25846
|
+
|
|
25847
|
+
var svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
|
|
25848
|
+
var svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']); // List of SVG elements that are disallowed by default.
|
|
25849
|
+
// We still need to know them so that we can do namespace
|
|
25850
|
+
// checks properly in case one wants to add them to
|
|
25851
|
+
// allow-list.
|
|
25852
|
+
|
|
25853
|
+
var svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'fedropshadow', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);
|
|
25854
|
+
var mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover']); // Similarly to SVG, we want to know all MathML elements,
|
|
25855
|
+
// even those that we disallow by default.
|
|
25856
|
+
|
|
25857
|
+
var mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
|
|
25858
|
+
var text = freeze(['#text']);
|
|
25859
|
+
|
|
25860
|
+
var html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']);
|
|
25861
|
+
var svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
|
|
25862
|
+
var mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
|
|
25863
|
+
var xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
|
|
25864
|
+
|
|
25865
|
+
var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
|
|
25866
|
+
|
|
25867
|
+
var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
|
|
25868
|
+
var TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
|
|
25869
|
+
var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
|
|
25870
|
+
|
|
25871
|
+
var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
|
|
25872
|
+
|
|
25873
|
+
var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
|
|
25874
|
+
);
|
|
25875
|
+
var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
|
|
25876
|
+
var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
|
|
25877
|
+
);
|
|
25878
|
+
var DOCTYPE_NAME = seal(/^html$/i);
|
|
25879
|
+
|
|
25880
|
+
var getGlobal = function getGlobal() {
|
|
25881
|
+
return typeof window === 'undefined' ? null : window;
|
|
25882
|
+
};
|
|
25883
|
+
/**
|
|
25884
|
+
* Creates a no-op policy for internal use only.
|
|
25885
|
+
* Don't export this function outside this module!
|
|
25886
|
+
* @param {?TrustedTypePolicyFactory} trustedTypes The policy factory.
|
|
25887
|
+
* @param {Document} document The document object (to determine policy name suffix)
|
|
25888
|
+
* @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types
|
|
25889
|
+
* are not supported).
|
|
25890
|
+
*/
|
|
25891
|
+
|
|
25892
|
+
|
|
25893
|
+
var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) {
|
|
25894
|
+
if (_typeof(trustedTypes) !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
|
|
25895
|
+
return null;
|
|
25896
|
+
} // Allow the callers to control the unique policy name
|
|
25897
|
+
// by adding a data-tt-policy-suffix to the script element with the DOMPurify.
|
|
25898
|
+
// Policy creation with duplicate names throws in Trusted Types.
|
|
25899
|
+
|
|
25900
|
+
|
|
25901
|
+
var suffix = null;
|
|
25902
|
+
var ATTR_NAME = 'data-tt-policy-suffix';
|
|
25903
|
+
|
|
25904
|
+
if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) {
|
|
25905
|
+
suffix = document.currentScript.getAttribute(ATTR_NAME);
|
|
25906
|
+
}
|
|
25907
|
+
|
|
25908
|
+
var policyName = 'dompurify' + (suffix ? '#' + suffix : '');
|
|
25909
|
+
|
|
25910
|
+
try {
|
|
25911
|
+
return trustedTypes.createPolicy(policyName, {
|
|
25912
|
+
createHTML: function createHTML(html) {
|
|
25913
|
+
return html;
|
|
25914
|
+
},
|
|
25915
|
+
createScriptURL: function createScriptURL(scriptUrl) {
|
|
25916
|
+
return scriptUrl;
|
|
25917
|
+
}
|
|
25918
|
+
});
|
|
25919
|
+
} catch (_) {
|
|
25920
|
+
// Policy creation failed (most likely another DOMPurify script has
|
|
25921
|
+
// already run). Skip creating the policy, as this will only cause errors
|
|
25922
|
+
// if TT are enforced.
|
|
25923
|
+
console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
|
|
25924
|
+
return null;
|
|
25925
|
+
}
|
|
25926
|
+
};
|
|
25927
|
+
|
|
25928
|
+
function createDOMPurify() {
|
|
25929
|
+
var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
|
|
25930
|
+
|
|
25931
|
+
var DOMPurify = function DOMPurify(root) {
|
|
25932
|
+
return createDOMPurify(root);
|
|
25933
|
+
};
|
|
25934
|
+
/**
|
|
25935
|
+
* Version label, exposed for easier checks
|
|
25936
|
+
* if DOMPurify is up to date or not
|
|
25937
|
+
*/
|
|
25938
|
+
|
|
25939
|
+
|
|
25940
|
+
DOMPurify.version = '3.0.1';
|
|
25941
|
+
/**
|
|
25942
|
+
* Array of elements that DOMPurify removed during sanitation.
|
|
25943
|
+
* Empty if nothing was removed.
|
|
25944
|
+
*/
|
|
25945
|
+
|
|
25946
|
+
DOMPurify.removed = [];
|
|
25947
|
+
|
|
25948
|
+
if (!window || !window.document || window.document.nodeType !== 9) {
|
|
25949
|
+
// Not running in a browser, provide a factory function
|
|
25950
|
+
// so that you can pass your own Window
|
|
25951
|
+
DOMPurify.isSupported = false;
|
|
25952
|
+
return DOMPurify;
|
|
25953
|
+
}
|
|
25954
|
+
|
|
25955
|
+
var originalDocument = window.document;
|
|
25956
|
+
var document = window.document;
|
|
25957
|
+
var DocumentFragment = window.DocumentFragment,
|
|
25958
|
+
HTMLTemplateElement = window.HTMLTemplateElement,
|
|
25959
|
+
Node = window.Node,
|
|
25960
|
+
Element = window.Element,
|
|
25961
|
+
NodeFilter = window.NodeFilter,
|
|
25962
|
+
_window$NamedNodeMap = window.NamedNodeMap,
|
|
25963
|
+
NamedNodeMap = _window$NamedNodeMap === void 0 ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap,
|
|
25964
|
+
HTMLFormElement = window.HTMLFormElement,
|
|
25965
|
+
DOMParser = window.DOMParser,
|
|
25966
|
+
trustedTypes = window.trustedTypes;
|
|
25967
|
+
var ElementPrototype = Element.prototype;
|
|
25968
|
+
var cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
|
|
25969
|
+
var getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
|
|
25970
|
+
var getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
|
|
25971
|
+
var getParentNode = lookupGetter(ElementPrototype, 'parentNode'); // As per issue #47, the web-components registry is inherited by a
|
|
25972
|
+
// new document created via createHTMLDocument. As per the spec
|
|
25973
|
+
// (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
|
|
25974
|
+
// a new empty registry is used when creating a template contents owner
|
|
25975
|
+
// document, so we use that as our parent document to ensure nothing
|
|
25976
|
+
// is inherited.
|
|
25977
|
+
|
|
25978
|
+
if (typeof HTMLTemplateElement === 'function') {
|
|
25979
|
+
var template = document.createElement('template');
|
|
25980
|
+
|
|
25981
|
+
if (template.content && template.content.ownerDocument) {
|
|
25982
|
+
document = template.content.ownerDocument;
|
|
25983
|
+
}
|
|
25984
|
+
}
|
|
25985
|
+
|
|
25986
|
+
var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument);
|
|
25987
|
+
|
|
25988
|
+
var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML('') : '';
|
|
25989
|
+
var _document = document,
|
|
25990
|
+
implementation = _document.implementation,
|
|
25991
|
+
createNodeIterator = _document.createNodeIterator,
|
|
25992
|
+
createDocumentFragment = _document.createDocumentFragment,
|
|
25993
|
+
getElementsByTagName = _document.getElementsByTagName;
|
|
25994
|
+
var importNode = originalDocument.importNode;
|
|
25995
|
+
var hooks = {};
|
|
25996
|
+
/**
|
|
25997
|
+
* Expose whether this browser supports running the full DOMPurify.
|
|
25998
|
+
*/
|
|
25999
|
+
|
|
26000
|
+
DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && typeof implementation.createHTMLDocument !== 'undefined';
|
|
26001
|
+
var MUSTACHE_EXPR$1 = MUSTACHE_EXPR,
|
|
26002
|
+
ERB_EXPR$1 = ERB_EXPR,
|
|
26003
|
+
TMPLIT_EXPR$1 = TMPLIT_EXPR,
|
|
26004
|
+
DATA_ATTR$1 = DATA_ATTR,
|
|
26005
|
+
ARIA_ATTR$1 = ARIA_ATTR,
|
|
26006
|
+
IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA,
|
|
26007
|
+
ATTR_WHITESPACE$1 = ATTR_WHITESPACE;
|
|
26008
|
+
var IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
|
|
26009
|
+
/**
|
|
26010
|
+
* We consider the elements and attributes below to be safe. Ideally
|
|
26011
|
+
* don't add any new ones but feel free to remove unwanted ones.
|
|
26012
|
+
*/
|
|
26013
|
+
|
|
26014
|
+
/* allowed element names */
|
|
26015
|
+
|
|
26016
|
+
var ALLOWED_TAGS = null;
|
|
26017
|
+
var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(svgFilters), _toConsumableArray(mathMl$1), _toConsumableArray(text)));
|
|
26018
|
+
/* Allowed attribute names */
|
|
26019
|
+
|
|
26020
|
+
var ALLOWED_ATTR = null;
|
|
26021
|
+
var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(mathMl), _toConsumableArray(xml)));
|
|
26022
|
+
/*
|
|
26023
|
+
* Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.
|
|
26024
|
+
* @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
|
|
26025
|
+
* @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
|
|
26026
|
+
* @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
|
|
26027
|
+
*/
|
|
26028
|
+
|
|
26029
|
+
var CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, {
|
|
26030
|
+
tagNameCheck: {
|
|
26031
|
+
writable: true,
|
|
26032
|
+
configurable: false,
|
|
26033
|
+
enumerable: true,
|
|
26034
|
+
value: null
|
|
26035
|
+
},
|
|
26036
|
+
attributeNameCheck: {
|
|
26037
|
+
writable: true,
|
|
26038
|
+
configurable: false,
|
|
26039
|
+
enumerable: true,
|
|
26040
|
+
value: null
|
|
26041
|
+
},
|
|
26042
|
+
allowCustomizedBuiltInElements: {
|
|
26043
|
+
writable: true,
|
|
26044
|
+
configurable: false,
|
|
26045
|
+
enumerable: true,
|
|
26046
|
+
value: false
|
|
26047
|
+
}
|
|
26048
|
+
}));
|
|
26049
|
+
/* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
|
|
26050
|
+
|
|
26051
|
+
var FORBID_TAGS = null;
|
|
26052
|
+
/* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
|
|
26053
|
+
|
|
26054
|
+
var FORBID_ATTR = null;
|
|
26055
|
+
/* Decide if ARIA attributes are okay */
|
|
26056
|
+
|
|
26057
|
+
var ALLOW_ARIA_ATTR = true;
|
|
26058
|
+
/* Decide if custom data attributes are okay */
|
|
26059
|
+
|
|
26060
|
+
var ALLOW_DATA_ATTR = true;
|
|
26061
|
+
/* Decide if unknown protocols are okay */
|
|
26062
|
+
|
|
26063
|
+
var ALLOW_UNKNOWN_PROTOCOLS = false;
|
|
26064
|
+
/* Decide if self-closing tags in attributes are allowed.
|
|
26065
|
+
* Usually removed due to a mXSS issue in jQuery 3.0 */
|
|
26066
|
+
|
|
26067
|
+
var ALLOW_SELF_CLOSE_IN_ATTR = true;
|
|
26068
|
+
/* Output should be safe for common template engines.
|
|
26069
|
+
* This means, DOMPurify removes data attributes, mustaches and ERB
|
|
26070
|
+
*/
|
|
26071
|
+
|
|
26072
|
+
var SAFE_FOR_TEMPLATES = false;
|
|
26073
|
+
/* Decide if document with <html>... should be returned */
|
|
26074
|
+
|
|
26075
|
+
var WHOLE_DOCUMENT = false;
|
|
26076
|
+
/* Track whether config is already set on this instance of DOMPurify. */
|
|
26077
|
+
|
|
26078
|
+
var SET_CONFIG = false;
|
|
26079
|
+
/* Decide if all elements (e.g. style, script) must be children of
|
|
26080
|
+
* document.body. By default, browsers might move them to document.head */
|
|
26081
|
+
|
|
26082
|
+
var FORCE_BODY = false;
|
|
26083
|
+
/* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
|
|
26084
|
+
* string (or a TrustedHTML object if Trusted Types are supported).
|
|
26085
|
+
* If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
|
|
26086
|
+
*/
|
|
26087
|
+
|
|
26088
|
+
var RETURN_DOM = false;
|
|
26089
|
+
/* Decide if a DOM `DocumentFragment` should be returned, instead of a html
|
|
26090
|
+
* string (or a TrustedHTML object if Trusted Types are supported) */
|
|
26091
|
+
|
|
26092
|
+
var RETURN_DOM_FRAGMENT = false;
|
|
26093
|
+
/* Try to return a Trusted Type object instead of a string, return a string in
|
|
26094
|
+
* case Trusted Types are not supported */
|
|
26095
|
+
|
|
26096
|
+
var RETURN_TRUSTED_TYPE = false;
|
|
26097
|
+
/* Output should be free from DOM clobbering attacks?
|
|
26098
|
+
* This sanitizes markups named with colliding, clobberable built-in DOM APIs.
|
|
26099
|
+
*/
|
|
26100
|
+
|
|
26101
|
+
var SANITIZE_DOM = true;
|
|
26102
|
+
/* Achieve full DOM Clobbering protection by isolating the namespace of named
|
|
26103
|
+
* properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
|
|
26104
|
+
*
|
|
26105
|
+
* HTML/DOM spec rules that enable DOM Clobbering:
|
|
26106
|
+
* - Named Access on Window (§7.3.3)
|
|
26107
|
+
* - DOM Tree Accessors (§3.1.5)
|
|
26108
|
+
* - Form Element Parent-Child Relations (§4.10.3)
|
|
26109
|
+
* - Iframe srcdoc / Nested WindowProxies (§4.8.5)
|
|
26110
|
+
* - HTMLCollection (§4.2.10.2)
|
|
26111
|
+
*
|
|
26112
|
+
* Namespace isolation is implemented by prefixing `id` and `name` attributes
|
|
26113
|
+
* with a constant string, i.e., `user-content-`
|
|
26114
|
+
*/
|
|
26115
|
+
|
|
26116
|
+
var SANITIZE_NAMED_PROPS = false;
|
|
26117
|
+
var SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
|
|
26118
|
+
/* Keep element content when removing element? */
|
|
26119
|
+
|
|
26120
|
+
var KEEP_CONTENT = true;
|
|
26121
|
+
/* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
|
|
26122
|
+
* of importing it into a new Document and returning a sanitized copy */
|
|
26123
|
+
|
|
26124
|
+
var IN_PLACE = false;
|
|
26125
|
+
/* Allow usage of profiles like html, svg and mathMl */
|
|
26126
|
+
|
|
26127
|
+
var USE_PROFILES = {};
|
|
26128
|
+
/* Tags to ignore content of when KEEP_CONTENT is true */
|
|
26129
|
+
|
|
26130
|
+
var FORBID_CONTENTS = null;
|
|
26131
|
+
var DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
|
|
26132
|
+
/* Tags that are safe for data: URIs */
|
|
26133
|
+
|
|
26134
|
+
var DATA_URI_TAGS = null;
|
|
26135
|
+
var DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
|
|
26136
|
+
/* Attributes safe for values like "javascript:" */
|
|
26137
|
+
|
|
26138
|
+
var URI_SAFE_ATTRIBUTES = null;
|
|
26139
|
+
var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
|
|
26140
|
+
var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
|
|
26141
|
+
var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
26142
|
+
var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
|
|
26143
|
+
/* Document namespace */
|
|
26144
|
+
|
|
26145
|
+
var NAMESPACE = HTML_NAMESPACE;
|
|
26146
|
+
var IS_EMPTY_INPUT = false;
|
|
26147
|
+
/* Allowed XHTML+XML namespaces */
|
|
26148
|
+
|
|
26149
|
+
var ALLOWED_NAMESPACES = null;
|
|
26150
|
+
var DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
|
|
26151
|
+
/* Parsing of strict XHTML documents */
|
|
26152
|
+
|
|
26153
|
+
var PARSER_MEDIA_TYPE;
|
|
26154
|
+
var SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
|
|
26155
|
+
var DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
|
|
26156
|
+
var transformCaseFunc;
|
|
26157
|
+
/* Keep a reference to config to pass to hooks */
|
|
26158
|
+
|
|
26159
|
+
var CONFIG = null;
|
|
26160
|
+
/* Ideally, do not touch anything below this line */
|
|
26161
|
+
|
|
26162
|
+
/* ______________________________________________ */
|
|
26163
|
+
|
|
26164
|
+
var formElement = document.createElement('form');
|
|
26165
|
+
|
|
26166
|
+
var isRegexOrFunction = function isRegexOrFunction(testValue) {
|
|
26167
|
+
return testValue instanceof RegExp || testValue instanceof Function;
|
|
26168
|
+
};
|
|
26169
|
+
/**
|
|
26170
|
+
* _parseConfig
|
|
26171
|
+
*
|
|
26172
|
+
* @param {Object} cfg optional config literal
|
|
26173
|
+
*/
|
|
26174
|
+
// eslint-disable-next-line complexity
|
|
26175
|
+
|
|
26176
|
+
|
|
26177
|
+
var _parseConfig = function _parseConfig(cfg) {
|
|
26178
|
+
if (CONFIG && CONFIG === cfg) {
|
|
26179
|
+
return;
|
|
26180
|
+
}
|
|
26181
|
+
/* Shield configuration object from tampering */
|
|
26182
|
+
|
|
26183
|
+
|
|
26184
|
+
if (!cfg || _typeof(cfg) !== 'object') {
|
|
26185
|
+
cfg = {};
|
|
26186
|
+
}
|
|
26187
|
+
/* Shield configuration object from prototype pollution */
|
|
26188
|
+
|
|
26189
|
+
|
|
26190
|
+
cfg = clone(cfg);
|
|
26191
|
+
PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
|
|
26192
|
+
SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
|
|
26193
|
+
|
|
26194
|
+
transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
|
|
26195
|
+
/* Set configuration parameters */
|
|
26196
|
+
|
|
26197
|
+
ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
|
|
26198
|
+
ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
|
|
26199
|
+
ALLOWED_NAMESPACES = 'ALLOWED_NAMESPACES' in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
|
|
26200
|
+
URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent
|
|
26201
|
+
cfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent
|
|
26202
|
+
transformCaseFunc // eslint-disable-line indent
|
|
26203
|
+
) // eslint-disable-line indent
|
|
26204
|
+
: DEFAULT_URI_SAFE_ATTRIBUTES;
|
|
26205
|
+
DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent
|
|
26206
|
+
cfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent
|
|
26207
|
+
transformCaseFunc // eslint-disable-line indent
|
|
26208
|
+
) // eslint-disable-line indent
|
|
26209
|
+
: DEFAULT_DATA_URI_TAGS;
|
|
26210
|
+
FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
|
|
26211
|
+
FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
|
|
26212
|
+
FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
|
|
26213
|
+
USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;
|
|
26214
|
+
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
|
|
26215
|
+
|
|
26216
|
+
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
|
|
26217
|
+
|
|
26218
|
+
ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
|
|
26219
|
+
|
|
26220
|
+
ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true
|
|
26221
|
+
|
|
26222
|
+
SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
|
|
26223
|
+
|
|
26224
|
+
WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
|
|
26225
|
+
|
|
26226
|
+
RETURN_DOM = cfg.RETURN_DOM || false; // Default false
|
|
26227
|
+
|
|
26228
|
+
RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
|
|
26229
|
+
|
|
26230
|
+
RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
|
|
26231
|
+
|
|
26232
|
+
FORCE_BODY = cfg.FORCE_BODY || false; // Default false
|
|
26233
|
+
|
|
26234
|
+
SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
|
|
26235
|
+
|
|
26236
|
+
SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
|
|
26237
|
+
|
|
26238
|
+
KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
|
|
26239
|
+
|
|
26240
|
+
IN_PLACE = cfg.IN_PLACE || false; // Default false
|
|
26241
|
+
|
|
26242
|
+
IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$1;
|
|
26243
|
+
NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
|
|
26244
|
+
CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
|
|
26245
|
+
|
|
26246
|
+
if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
|
|
26247
|
+
CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
|
|
26248
|
+
}
|
|
26249
|
+
|
|
26250
|
+
if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
|
|
26251
|
+
CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
|
|
26252
|
+
}
|
|
26253
|
+
|
|
26254
|
+
if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {
|
|
26255
|
+
CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
|
|
26256
|
+
}
|
|
26257
|
+
|
|
26258
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
26259
|
+
ALLOW_DATA_ATTR = false;
|
|
26260
|
+
}
|
|
26261
|
+
|
|
26262
|
+
if (RETURN_DOM_FRAGMENT) {
|
|
26263
|
+
RETURN_DOM = true;
|
|
26264
|
+
}
|
|
26265
|
+
/* Parse profile info */
|
|
26266
|
+
|
|
26267
|
+
|
|
26268
|
+
if (USE_PROFILES) {
|
|
26269
|
+
ALLOWED_TAGS = addToSet({}, _toConsumableArray(text));
|
|
26270
|
+
ALLOWED_ATTR = [];
|
|
26271
|
+
|
|
26272
|
+
if (USE_PROFILES.html === true) {
|
|
26273
|
+
addToSet(ALLOWED_TAGS, html$1);
|
|
26274
|
+
addToSet(ALLOWED_ATTR, html);
|
|
26275
|
+
}
|
|
26276
|
+
|
|
26277
|
+
if (USE_PROFILES.svg === true) {
|
|
26278
|
+
addToSet(ALLOWED_TAGS, svg$1);
|
|
26279
|
+
addToSet(ALLOWED_ATTR, svg);
|
|
26280
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
26281
|
+
}
|
|
26282
|
+
|
|
26283
|
+
if (USE_PROFILES.svgFilters === true) {
|
|
26284
|
+
addToSet(ALLOWED_TAGS, svgFilters);
|
|
26285
|
+
addToSet(ALLOWED_ATTR, svg);
|
|
26286
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
26287
|
+
}
|
|
26288
|
+
|
|
26289
|
+
if (USE_PROFILES.mathMl === true) {
|
|
26290
|
+
addToSet(ALLOWED_TAGS, mathMl$1);
|
|
26291
|
+
addToSet(ALLOWED_ATTR, mathMl);
|
|
26292
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
26293
|
+
}
|
|
26294
|
+
}
|
|
26295
|
+
/* Merge configuration parameters */
|
|
26296
|
+
|
|
26297
|
+
|
|
26298
|
+
if (cfg.ADD_TAGS) {
|
|
26299
|
+
if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
|
|
26300
|
+
ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
|
26301
|
+
}
|
|
26302
|
+
|
|
26303
|
+
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
|
|
26304
|
+
}
|
|
26305
|
+
|
|
26306
|
+
if (cfg.ADD_ATTR) {
|
|
26307
|
+
if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
|
|
26308
|
+
ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
26309
|
+
}
|
|
26310
|
+
|
|
26311
|
+
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
|
26312
|
+
}
|
|
26313
|
+
|
|
26314
|
+
if (cfg.ADD_URI_SAFE_ATTR) {
|
|
26315
|
+
addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
|
|
26316
|
+
}
|
|
26317
|
+
|
|
26318
|
+
if (cfg.FORBID_CONTENTS) {
|
|
26319
|
+
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
|
|
26320
|
+
FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
26321
|
+
}
|
|
26322
|
+
|
|
26323
|
+
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
|
|
26324
|
+
}
|
|
26325
|
+
/* Add #text in case KEEP_CONTENT is set to true */
|
|
26326
|
+
|
|
26327
|
+
|
|
26328
|
+
if (KEEP_CONTENT) {
|
|
26329
|
+
ALLOWED_TAGS['#text'] = true;
|
|
26330
|
+
}
|
|
26331
|
+
/* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
|
|
26332
|
+
|
|
26333
|
+
|
|
26334
|
+
if (WHOLE_DOCUMENT) {
|
|
26335
|
+
addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
|
|
26336
|
+
}
|
|
26337
|
+
/* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
|
|
26338
|
+
|
|
26339
|
+
|
|
26340
|
+
if (ALLOWED_TAGS.table) {
|
|
26341
|
+
addToSet(ALLOWED_TAGS, ['tbody']);
|
|
26342
|
+
delete FORBID_TAGS.tbody;
|
|
26343
|
+
} // Prevent further manipulation of configuration.
|
|
26344
|
+
// Not available in IE8, Safari 5, etc.
|
|
26345
|
+
|
|
26346
|
+
|
|
26347
|
+
if (freeze) {
|
|
26348
|
+
freeze(cfg);
|
|
26349
|
+
}
|
|
26350
|
+
|
|
26351
|
+
CONFIG = cfg;
|
|
26352
|
+
};
|
|
26353
|
+
|
|
26354
|
+
var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
|
|
26355
|
+
var HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); // Certain elements are allowed in both SVG and HTML
|
|
26356
|
+
// namespace. We need to specify them explicitly
|
|
26357
|
+
// so that they don't get erroneously deleted from
|
|
26358
|
+
// HTML namespace.
|
|
26359
|
+
|
|
26360
|
+
var COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
|
|
26361
|
+
/* Keep track of all possible SVG and MathML tags
|
|
26362
|
+
* so that we can perform the namespace checks
|
|
26363
|
+
* correctly. */
|
|
26364
|
+
|
|
26365
|
+
var ALL_SVG_TAGS = addToSet({}, svg$1);
|
|
26366
|
+
addToSet(ALL_SVG_TAGS, svgFilters);
|
|
26367
|
+
addToSet(ALL_SVG_TAGS, svgDisallowed);
|
|
26368
|
+
var ALL_MATHML_TAGS = addToSet({}, mathMl$1);
|
|
26369
|
+
addToSet(ALL_MATHML_TAGS, mathMlDisallowed);
|
|
26370
|
+
/**
|
|
26371
|
+
*
|
|
26372
|
+
*
|
|
26373
|
+
* @param {Element} element a DOM element whose namespace is being checked
|
|
26374
|
+
* @returns {boolean} Return false if the element has a
|
|
26375
|
+
* namespace that a spec-compliant parser would never
|
|
26376
|
+
* return. Return true otherwise.
|
|
26377
|
+
*/
|
|
26378
|
+
|
|
26379
|
+
var _checkValidNamespace = function _checkValidNamespace(element) {
|
|
26380
|
+
var parent = getParentNode(element); // In JSDOM, if we're inside shadow DOM, then parentNode
|
|
26381
|
+
// can be null. We just simulate parent in this case.
|
|
26382
|
+
|
|
26383
|
+
if (!parent || !parent.tagName) {
|
|
26384
|
+
parent = {
|
|
26385
|
+
namespaceURI: NAMESPACE,
|
|
26386
|
+
tagName: 'template'
|
|
26387
|
+
};
|
|
26388
|
+
}
|
|
26389
|
+
|
|
26390
|
+
var tagName = stringToLowerCase(element.tagName);
|
|
26391
|
+
var parentTagName = stringToLowerCase(parent.tagName);
|
|
26392
|
+
|
|
26393
|
+
if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
|
|
26394
|
+
return false;
|
|
26395
|
+
}
|
|
26396
|
+
|
|
26397
|
+
if (element.namespaceURI === SVG_NAMESPACE) {
|
|
26398
|
+
// The only way to switch from HTML namespace to SVG
|
|
26399
|
+
// is via <svg>. If it happens via any other tag, then
|
|
26400
|
+
// it should be killed.
|
|
26401
|
+
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
26402
|
+
return tagName === 'svg';
|
|
26403
|
+
} // The only way to switch from MathML to SVG is via`
|
|
26404
|
+
// svg if parent is either <annotation-xml> or MathML
|
|
26405
|
+
// text integration points.
|
|
26406
|
+
|
|
26407
|
+
|
|
26408
|
+
if (parent.namespaceURI === MATHML_NAMESPACE) {
|
|
26409
|
+
return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
|
|
26410
|
+
} // We only allow elements that are defined in SVG
|
|
26411
|
+
// spec. All others are disallowed in SVG namespace.
|
|
26412
|
+
|
|
26413
|
+
|
|
26414
|
+
return Boolean(ALL_SVG_TAGS[tagName]);
|
|
26415
|
+
}
|
|
26416
|
+
|
|
26417
|
+
if (element.namespaceURI === MATHML_NAMESPACE) {
|
|
26418
|
+
// The only way to switch from HTML namespace to MathML
|
|
26419
|
+
// is via <math>. If it happens via any other tag, then
|
|
26420
|
+
// it should be killed.
|
|
26421
|
+
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
26422
|
+
return tagName === 'math';
|
|
26423
|
+
} // The only way to switch from SVG to MathML is via
|
|
26424
|
+
// <math> and HTML integration points
|
|
26425
|
+
|
|
26426
|
+
|
|
26427
|
+
if (parent.namespaceURI === SVG_NAMESPACE) {
|
|
26428
|
+
return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
|
|
26429
|
+
} // We only allow elements that are defined in MathML
|
|
26430
|
+
// spec. All others are disallowed in MathML namespace.
|
|
26431
|
+
|
|
26432
|
+
|
|
26433
|
+
return Boolean(ALL_MATHML_TAGS[tagName]);
|
|
26434
|
+
}
|
|
26435
|
+
|
|
26436
|
+
if (element.namespaceURI === HTML_NAMESPACE) {
|
|
26437
|
+
// The only way to switch from SVG to HTML is via
|
|
26438
|
+
// HTML integration points, and from MathML to HTML
|
|
26439
|
+
// is via MathML text integration points
|
|
26440
|
+
if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
|
|
26441
|
+
return false;
|
|
26442
|
+
}
|
|
26443
|
+
|
|
26444
|
+
if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
|
|
26445
|
+
return false;
|
|
26446
|
+
} // We disallow tags that are specific for MathML
|
|
26447
|
+
// or SVG and should never appear in HTML namespace
|
|
26448
|
+
|
|
26449
|
+
|
|
26450
|
+
return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
|
|
26451
|
+
} // For XHTML and XML documents that support custom namespaces
|
|
26452
|
+
|
|
26453
|
+
|
|
26454
|
+
if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
|
|
26455
|
+
return true;
|
|
26456
|
+
} // The code should never reach this place (this means
|
|
26457
|
+
// that the element somehow got namespace that is not
|
|
26458
|
+
// HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
|
|
26459
|
+
// Return false just in case.
|
|
26460
|
+
|
|
26461
|
+
|
|
26462
|
+
return false;
|
|
26463
|
+
};
|
|
26464
|
+
/**
|
|
26465
|
+
* _forceRemove
|
|
26466
|
+
*
|
|
26467
|
+
* @param {Node} node a DOM node
|
|
26468
|
+
*/
|
|
26469
|
+
|
|
26470
|
+
|
|
26471
|
+
var _forceRemove = function _forceRemove(node) {
|
|
26472
|
+
arrayPush(DOMPurify.removed, {
|
|
26473
|
+
element: node
|
|
26474
|
+
});
|
|
26475
|
+
|
|
26476
|
+
try {
|
|
26477
|
+
// eslint-disable-next-line unicorn/prefer-dom-node-remove
|
|
26478
|
+
node.parentNode.removeChild(node);
|
|
26479
|
+
} catch (_) {
|
|
26480
|
+
node.remove();
|
|
26481
|
+
}
|
|
26482
|
+
};
|
|
26483
|
+
/**
|
|
26484
|
+
* _removeAttribute
|
|
26485
|
+
*
|
|
26486
|
+
* @param {String} name an Attribute name
|
|
26487
|
+
* @param {Node} node a DOM node
|
|
26488
|
+
*/
|
|
26489
|
+
|
|
26490
|
+
|
|
26491
|
+
var _removeAttribute = function _removeAttribute(name, node) {
|
|
26492
|
+
try {
|
|
26493
|
+
arrayPush(DOMPurify.removed, {
|
|
26494
|
+
attribute: node.getAttributeNode(name),
|
|
26495
|
+
from: node
|
|
26496
|
+
});
|
|
26497
|
+
} catch (_) {
|
|
26498
|
+
arrayPush(DOMPurify.removed, {
|
|
26499
|
+
attribute: null,
|
|
26500
|
+
from: node
|
|
26501
|
+
});
|
|
26502
|
+
}
|
|
26503
|
+
|
|
26504
|
+
node.removeAttribute(name); // We void attribute values for unremovable "is"" attributes
|
|
26505
|
+
|
|
26506
|
+
if (name === 'is' && !ALLOWED_ATTR[name]) {
|
|
26507
|
+
if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
|
|
26508
|
+
try {
|
|
26509
|
+
_forceRemove(node);
|
|
26510
|
+
} catch (_) {}
|
|
26511
|
+
} else {
|
|
26512
|
+
try {
|
|
26513
|
+
node.setAttribute(name, '');
|
|
26514
|
+
} catch (_) {}
|
|
26515
|
+
}
|
|
26516
|
+
}
|
|
26517
|
+
};
|
|
26518
|
+
/**
|
|
26519
|
+
* _initDocument
|
|
26520
|
+
*
|
|
26521
|
+
* @param {String} dirty a string of dirty markup
|
|
26522
|
+
* @return {Document} a DOM, filled with the dirty markup
|
|
26523
|
+
*/
|
|
26524
|
+
|
|
26525
|
+
|
|
26526
|
+
var _initDocument = function _initDocument(dirty) {
|
|
26527
|
+
/* Create a HTML document */
|
|
26528
|
+
var doc;
|
|
26529
|
+
var leadingWhitespace;
|
|
26530
|
+
|
|
26531
|
+
if (FORCE_BODY) {
|
|
26532
|
+
dirty = '<remove></remove>' + dirty;
|
|
26533
|
+
} else {
|
|
26534
|
+
/* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
|
|
26535
|
+
var matches = stringMatch(dirty, /^[\r\n\t ]+/);
|
|
26536
|
+
leadingWhitespace = matches && matches[0];
|
|
26537
|
+
}
|
|
26538
|
+
|
|
26539
|
+
if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
|
|
26540
|
+
// Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
|
|
26541
|
+
dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
|
|
26542
|
+
}
|
|
26543
|
+
|
|
26544
|
+
var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
|
26545
|
+
/*
|
|
26546
|
+
* Use the DOMParser API by default, fallback later if needs be
|
|
26547
|
+
* DOMParser not work for svg when has multiple root element.
|
|
26548
|
+
*/
|
|
26549
|
+
|
|
26550
|
+
if (NAMESPACE === HTML_NAMESPACE) {
|
|
26551
|
+
try {
|
|
26552
|
+
doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
|
|
26553
|
+
} catch (_) {}
|
|
26554
|
+
}
|
|
26555
|
+
/* Use createHTMLDocument in case DOMParser is not available */
|
|
26556
|
+
|
|
26557
|
+
|
|
26558
|
+
if (!doc || !doc.documentElement) {
|
|
26559
|
+
doc = implementation.createDocument(NAMESPACE, 'template', null);
|
|
26560
|
+
|
|
26561
|
+
try {
|
|
26562
|
+
doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
|
|
26563
|
+
} catch (_) {// Syntax error if dirtyPayload is invalid xml
|
|
26564
|
+
}
|
|
26565
|
+
}
|
|
26566
|
+
|
|
26567
|
+
var body = doc.body || doc.documentElement;
|
|
26568
|
+
|
|
26569
|
+
if (dirty && leadingWhitespace) {
|
|
26570
|
+
body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
|
|
26571
|
+
}
|
|
26572
|
+
/* Work on whole document or just its body */
|
|
26573
|
+
|
|
26574
|
+
|
|
26575
|
+
if (NAMESPACE === HTML_NAMESPACE) {
|
|
26576
|
+
return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
|
|
26577
|
+
}
|
|
26578
|
+
|
|
26579
|
+
return WHOLE_DOCUMENT ? doc.documentElement : body;
|
|
26580
|
+
};
|
|
26581
|
+
/**
|
|
26582
|
+
* _createIterator
|
|
26583
|
+
*
|
|
26584
|
+
* @param {Document} root document/fragment to create iterator for
|
|
26585
|
+
* @return {Iterator} iterator instance
|
|
26586
|
+
*/
|
|
26587
|
+
|
|
26588
|
+
|
|
26589
|
+
var _createIterator = function _createIterator(root) {
|
|
26590
|
+
return createNodeIterator.call(root.ownerDocument || root, root, // eslint-disable-next-line no-bitwise
|
|
26591
|
+
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false);
|
|
26592
|
+
};
|
|
26593
|
+
/**
|
|
26594
|
+
* _isClobbered
|
|
26595
|
+
*
|
|
26596
|
+
* @param {Node} elm element to check for clobbering attacks
|
|
26597
|
+
* @return {Boolean} true if clobbered, false if safe
|
|
26598
|
+
*/
|
|
26599
|
+
|
|
26600
|
+
|
|
26601
|
+
var _isClobbered = function _isClobbered(elm) {
|
|
26602
|
+
return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');
|
|
26603
|
+
};
|
|
26604
|
+
/**
|
|
26605
|
+
* _isNode
|
|
26606
|
+
*
|
|
26607
|
+
* @param {Node} obj object to check whether it's a DOM node
|
|
26608
|
+
* @return {Boolean} true is object is a DOM node
|
|
26609
|
+
*/
|
|
26610
|
+
|
|
26611
|
+
|
|
26612
|
+
var _isNode = function _isNode(object) {
|
|
26613
|
+
return _typeof(Node) === 'object' ? object instanceof Node : object && _typeof(object) === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string';
|
|
26614
|
+
};
|
|
26615
|
+
/**
|
|
26616
|
+
* _executeHook
|
|
26617
|
+
* Execute user configurable hooks
|
|
26618
|
+
*
|
|
26619
|
+
* @param {String} entryPoint Name of the hook's entry point
|
|
26620
|
+
* @param {Node} currentNode node to work on with the hook
|
|
26621
|
+
* @param {Object} data additional hook parameters
|
|
26622
|
+
*/
|
|
26623
|
+
|
|
26624
|
+
|
|
26625
|
+
var _executeHook = function _executeHook(entryPoint, currentNode, data) {
|
|
26626
|
+
if (!hooks[entryPoint]) {
|
|
26627
|
+
return;
|
|
26628
|
+
}
|
|
26629
|
+
|
|
26630
|
+
arrayForEach(hooks[entryPoint], function (hook) {
|
|
26631
|
+
hook.call(DOMPurify, currentNode, data, CONFIG);
|
|
26632
|
+
});
|
|
26633
|
+
};
|
|
26634
|
+
/**
|
|
26635
|
+
* _sanitizeElements
|
|
26636
|
+
*
|
|
26637
|
+
* @protect nodeName
|
|
26638
|
+
* @protect textContent
|
|
26639
|
+
* @protect removeChild
|
|
26640
|
+
*
|
|
26641
|
+
* @param {Node} currentNode to check for permission to exist
|
|
26642
|
+
* @return {Boolean} true if node was killed, false if left alive
|
|
26643
|
+
*/
|
|
26644
|
+
|
|
26645
|
+
|
|
26646
|
+
var _sanitizeElements = function _sanitizeElements(currentNode) {
|
|
26647
|
+
var content;
|
|
26648
|
+
/* Execute a hook if present */
|
|
26649
|
+
|
|
26650
|
+
_executeHook('beforeSanitizeElements', currentNode, null);
|
|
26651
|
+
/* Check if element is clobbered or can clobber */
|
|
26652
|
+
|
|
26653
|
+
|
|
26654
|
+
if (_isClobbered(currentNode)) {
|
|
26655
|
+
_forceRemove(currentNode);
|
|
26656
|
+
|
|
26657
|
+
return true;
|
|
26658
|
+
}
|
|
26659
|
+
/* Now let's check the element's type and name */
|
|
26660
|
+
|
|
26661
|
+
|
|
26662
|
+
var tagName = transformCaseFunc(currentNode.nodeName);
|
|
26663
|
+
/* Execute a hook if present */
|
|
26664
|
+
|
|
26665
|
+
_executeHook('uponSanitizeElement', currentNode, {
|
|
26666
|
+
tagName: tagName,
|
|
26667
|
+
allowedTags: ALLOWED_TAGS
|
|
26668
|
+
});
|
|
26669
|
+
/* Detect mXSS attempts abusing namespace confusion */
|
|
26670
|
+
|
|
26671
|
+
|
|
26672
|
+
if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
|
|
26673
|
+
_forceRemove(currentNode);
|
|
26674
|
+
|
|
26675
|
+
return true;
|
|
26676
|
+
}
|
|
26677
|
+
/* Remove element if anything forbids its presence */
|
|
26678
|
+
|
|
26679
|
+
|
|
26680
|
+
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
26681
|
+
/* Check if we have a custom element to handle */
|
|
26682
|
+
if (!FORBID_TAGS[tagName] && _basicCustomElementTest(tagName)) {
|
|
26683
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
|
|
26684
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
|
|
26685
|
+
}
|
|
26686
|
+
/* Keep content except for bad-listed elements */
|
|
26687
|
+
|
|
26688
|
+
|
|
26689
|
+
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
|
26690
|
+
var parentNode = getParentNode(currentNode) || currentNode.parentNode;
|
|
26691
|
+
var childNodes = getChildNodes(currentNode) || currentNode.childNodes;
|
|
26692
|
+
|
|
26693
|
+
if (childNodes && parentNode) {
|
|
26694
|
+
var childCount = childNodes.length;
|
|
26695
|
+
|
|
26696
|
+
for (var i = childCount - 1; i >= 0; --i) {
|
|
26697
|
+
parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));
|
|
26698
|
+
}
|
|
26699
|
+
}
|
|
26700
|
+
}
|
|
26701
|
+
|
|
26702
|
+
_forceRemove(currentNode);
|
|
26703
|
+
|
|
26704
|
+
return true;
|
|
26705
|
+
}
|
|
26706
|
+
/* Check whether element has a valid namespace */
|
|
26707
|
+
|
|
26708
|
+
|
|
26709
|
+
if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
|
|
26710
|
+
_forceRemove(currentNode);
|
|
26711
|
+
|
|
26712
|
+
return true;
|
|
26713
|
+
}
|
|
26714
|
+
/* Make sure that older browsers don't get noscript mXSS */
|
|
26715
|
+
|
|
26716
|
+
|
|
26717
|
+
if ((tagName === 'noscript' || tagName === 'noembed') && regExpTest(/<\/no(script|embed)/i, currentNode.innerHTML)) {
|
|
26718
|
+
_forceRemove(currentNode);
|
|
26719
|
+
|
|
26720
|
+
return true;
|
|
26721
|
+
}
|
|
26722
|
+
/* Sanitize element content to be template-safe */
|
|
26723
|
+
|
|
26724
|
+
|
|
26725
|
+
if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
|
|
26726
|
+
/* Get the element's text content */
|
|
26727
|
+
content = currentNode.textContent;
|
|
26728
|
+
content = stringReplace(content, MUSTACHE_EXPR$1, ' ');
|
|
26729
|
+
content = stringReplace(content, ERB_EXPR$1, ' ');
|
|
26730
|
+
content = stringReplace(content, TMPLIT_EXPR$1, ' ');
|
|
26731
|
+
|
|
26732
|
+
if (currentNode.textContent !== content) {
|
|
26733
|
+
arrayPush(DOMPurify.removed, {
|
|
26734
|
+
element: currentNode.cloneNode()
|
|
26735
|
+
});
|
|
26736
|
+
currentNode.textContent = content;
|
|
26737
|
+
}
|
|
26738
|
+
}
|
|
26739
|
+
/* Execute a hook if present */
|
|
26740
|
+
|
|
26741
|
+
|
|
26742
|
+
_executeHook('afterSanitizeElements', currentNode, null);
|
|
26743
|
+
|
|
26744
|
+
return false;
|
|
26745
|
+
};
|
|
26746
|
+
/**
|
|
26747
|
+
* _isValidAttribute
|
|
26748
|
+
*
|
|
26749
|
+
* @param {string} lcTag Lowercase tag name of containing element.
|
|
26750
|
+
* @param {string} lcName Lowercase attribute name.
|
|
26751
|
+
* @param {string} value Attribute value.
|
|
26752
|
+
* @return {Boolean} Returns true if `value` is valid, otherwise false.
|
|
26753
|
+
*/
|
|
26754
|
+
// eslint-disable-next-line complexity
|
|
26755
|
+
|
|
26756
|
+
|
|
26757
|
+
var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
|
|
26758
|
+
/* Make sure attribute cannot clobber */
|
|
26759
|
+
if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
|
|
26760
|
+
return false;
|
|
26761
|
+
}
|
|
26762
|
+
/* Allow valid data-* attributes: At least one character after "-"
|
|
26763
|
+
(https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
|
|
26764
|
+
XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
|
|
26765
|
+
We don't need to check the value; it's always URI safe. */
|
|
26766
|
+
|
|
26767
|
+
|
|
26768
|
+
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR$1, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
|
|
26769
|
+
if ( // First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
26770
|
+
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
26771
|
+
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
26772
|
+
_basicCustomElementTest(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
26773
|
+
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
26774
|
+
lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {
|
|
26775
|
+
return false;
|
|
26776
|
+
}
|
|
26777
|
+
/* Check value is safe. First, is attr inert? If so, is safe */
|
|
26778
|
+
|
|
26779
|
+
} else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ''))) ; else if (!value) ; else {
|
|
26780
|
+
return false;
|
|
26781
|
+
}
|
|
26782
|
+
|
|
26783
|
+
return true;
|
|
26784
|
+
};
|
|
26785
|
+
/**
|
|
26786
|
+
* _basicCustomElementCheck
|
|
26787
|
+
* checks if at least one dash is included in tagName, and it's not the first char
|
|
26788
|
+
* for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
|
|
26789
|
+
* @param {string} tagName name of the tag of the node to sanitize
|
|
26790
|
+
*/
|
|
26791
|
+
|
|
26792
|
+
|
|
26793
|
+
var _basicCustomElementTest = function _basicCustomElementTest(tagName) {
|
|
26794
|
+
return tagName.indexOf('-') > 0;
|
|
26795
|
+
};
|
|
26796
|
+
/**
|
|
26797
|
+
* _sanitizeAttributes
|
|
26798
|
+
*
|
|
26799
|
+
* @protect attributes
|
|
26800
|
+
* @protect nodeName
|
|
26801
|
+
* @protect removeAttribute
|
|
26802
|
+
* @protect setAttribute
|
|
26803
|
+
*
|
|
26804
|
+
* @param {Node} currentNode to sanitize
|
|
26805
|
+
*/
|
|
26806
|
+
|
|
26807
|
+
|
|
26808
|
+
var _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
|
|
26809
|
+
var attr;
|
|
26810
|
+
var value;
|
|
26811
|
+
var lcName;
|
|
26812
|
+
var l;
|
|
26813
|
+
/* Execute a hook if present */
|
|
26814
|
+
|
|
26815
|
+
_executeHook('beforeSanitizeAttributes', currentNode, null);
|
|
26816
|
+
|
|
26817
|
+
var attributes = currentNode.attributes;
|
|
26818
|
+
/* Check if we have attributes; if not we might have a text node */
|
|
26819
|
+
|
|
26820
|
+
if (!attributes) {
|
|
26821
|
+
return;
|
|
26822
|
+
}
|
|
26823
|
+
|
|
26824
|
+
var hookEvent = {
|
|
26825
|
+
attrName: '',
|
|
26826
|
+
attrValue: '',
|
|
26827
|
+
keepAttr: true,
|
|
26828
|
+
allowedAttributes: ALLOWED_ATTR
|
|
26829
|
+
};
|
|
26830
|
+
l = attributes.length;
|
|
26831
|
+
/* Go backwards over all attributes; safely remove bad ones */
|
|
26832
|
+
|
|
26833
|
+
while (l--) {
|
|
26834
|
+
attr = attributes[l];
|
|
26835
|
+
var _attr = attr,
|
|
26836
|
+
name = _attr.name,
|
|
26837
|
+
namespaceURI = _attr.namespaceURI;
|
|
26838
|
+
value = name === 'value' ? attr.value : stringTrim(attr.value);
|
|
26839
|
+
lcName = transformCaseFunc(name);
|
|
26840
|
+
/* Execute a hook if present */
|
|
26841
|
+
|
|
26842
|
+
hookEvent.attrName = lcName;
|
|
26843
|
+
hookEvent.attrValue = value;
|
|
26844
|
+
hookEvent.keepAttr = true;
|
|
26845
|
+
hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
|
|
26846
|
+
|
|
26847
|
+
_executeHook('uponSanitizeAttribute', currentNode, hookEvent);
|
|
26848
|
+
|
|
26849
|
+
value = hookEvent.attrValue;
|
|
26850
|
+
/* Did the hooks approve of the attribute? */
|
|
26851
|
+
|
|
26852
|
+
if (hookEvent.forceKeepAttr) {
|
|
26853
|
+
continue;
|
|
26854
|
+
}
|
|
26855
|
+
/* Remove attribute */
|
|
26856
|
+
|
|
26857
|
+
|
|
26858
|
+
_removeAttribute(name, currentNode);
|
|
26859
|
+
/* Did the hooks approve of the attribute? */
|
|
26860
|
+
|
|
26861
|
+
|
|
26862
|
+
if (!hookEvent.keepAttr) {
|
|
26863
|
+
continue;
|
|
26864
|
+
}
|
|
26865
|
+
/* Work around a security issue in jQuery 3.0 */
|
|
26866
|
+
|
|
26867
|
+
|
|
26868
|
+
if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
|
|
26869
|
+
_removeAttribute(name, currentNode);
|
|
26870
|
+
|
|
26871
|
+
continue;
|
|
26872
|
+
}
|
|
26873
|
+
/* Sanitize attribute content to be template-safe */
|
|
26874
|
+
|
|
26875
|
+
|
|
26876
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
26877
|
+
value = stringReplace(value, MUSTACHE_EXPR$1, ' ');
|
|
26878
|
+
value = stringReplace(value, ERB_EXPR$1, ' ');
|
|
26879
|
+
value = stringReplace(value, TMPLIT_EXPR$1, ' ');
|
|
26880
|
+
}
|
|
26881
|
+
/* Is `value` valid for this attribute? */
|
|
26882
|
+
|
|
26883
|
+
|
|
26884
|
+
var lcTag = transformCaseFunc(currentNode.nodeName);
|
|
26885
|
+
|
|
26886
|
+
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
26887
|
+
continue;
|
|
26888
|
+
}
|
|
26889
|
+
/* Full DOM Clobbering protection via namespace isolation,
|
|
26890
|
+
* Prefix id and name attributes with `user-content-`
|
|
26891
|
+
*/
|
|
26892
|
+
|
|
26893
|
+
|
|
26894
|
+
if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
|
|
26895
|
+
// Remove the attribute with this value
|
|
26896
|
+
_removeAttribute(name, currentNode); // Prefix the value and later re-create the attribute with the sanitized value
|
|
26897
|
+
|
|
26898
|
+
|
|
26899
|
+
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
26900
|
+
}
|
|
26901
|
+
/* Handle attributes that require Trusted Types */
|
|
26902
|
+
|
|
26903
|
+
|
|
26904
|
+
if (trustedTypesPolicy && _typeof(trustedTypes) === 'object' && typeof trustedTypes.getAttributeType === 'function') {
|
|
26905
|
+
if (namespaceURI) ; else {
|
|
26906
|
+
switch (trustedTypes.getAttributeType(lcTag, lcName)) {
|
|
26907
|
+
case 'TrustedHTML':
|
|
26908
|
+
value = trustedTypesPolicy.createHTML(value);
|
|
26909
|
+
break;
|
|
26910
|
+
|
|
26911
|
+
case 'TrustedScriptURL':
|
|
26912
|
+
value = trustedTypesPolicy.createScriptURL(value);
|
|
26913
|
+
break;
|
|
26914
|
+
}
|
|
26915
|
+
}
|
|
26916
|
+
}
|
|
26917
|
+
/* Handle invalid data-* attribute set by try-catching it */
|
|
26918
|
+
|
|
26919
|
+
|
|
26920
|
+
try {
|
|
26921
|
+
if (namespaceURI) {
|
|
26922
|
+
currentNode.setAttributeNS(namespaceURI, name, value);
|
|
26923
|
+
} else {
|
|
26924
|
+
/* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
|
|
26925
|
+
currentNode.setAttribute(name, value);
|
|
26926
|
+
}
|
|
26927
|
+
|
|
26928
|
+
arrayPop(DOMPurify.removed);
|
|
26929
|
+
} catch (_) {}
|
|
26930
|
+
}
|
|
26931
|
+
/* Execute a hook if present */
|
|
26932
|
+
|
|
26933
|
+
|
|
26934
|
+
_executeHook('afterSanitizeAttributes', currentNode, null);
|
|
26935
|
+
};
|
|
26936
|
+
/**
|
|
26937
|
+
* _sanitizeShadowDOM
|
|
26938
|
+
*
|
|
26939
|
+
* @param {DocumentFragment} fragment to iterate over recursively
|
|
26940
|
+
*/
|
|
26941
|
+
|
|
26942
|
+
|
|
26943
|
+
var _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
|
|
26944
|
+
var shadowNode;
|
|
26945
|
+
|
|
26946
|
+
var shadowIterator = _createIterator(fragment);
|
|
26947
|
+
/* Execute a hook if present */
|
|
26948
|
+
|
|
26949
|
+
|
|
26950
|
+
_executeHook('beforeSanitizeShadowDOM', fragment, null);
|
|
26951
|
+
|
|
26952
|
+
while (shadowNode = shadowIterator.nextNode()) {
|
|
26953
|
+
/* Execute a hook if present */
|
|
26954
|
+
_executeHook('uponSanitizeShadowNode', shadowNode, null);
|
|
26955
|
+
/* Sanitize tags and elements */
|
|
26956
|
+
|
|
26957
|
+
|
|
26958
|
+
if (_sanitizeElements(shadowNode)) {
|
|
26959
|
+
continue;
|
|
26960
|
+
}
|
|
26961
|
+
/* Deep shadow DOM detected */
|
|
26962
|
+
|
|
26963
|
+
|
|
26964
|
+
if (shadowNode.content instanceof DocumentFragment) {
|
|
26965
|
+
_sanitizeShadowDOM(shadowNode.content);
|
|
26966
|
+
}
|
|
26967
|
+
/* Check attributes, sanitize if necessary */
|
|
26968
|
+
|
|
26969
|
+
|
|
26970
|
+
_sanitizeAttributes(shadowNode);
|
|
26971
|
+
}
|
|
26972
|
+
/* Execute a hook if present */
|
|
26973
|
+
|
|
26974
|
+
|
|
26975
|
+
_executeHook('afterSanitizeShadowDOM', fragment, null);
|
|
26976
|
+
};
|
|
26977
|
+
/**
|
|
26978
|
+
* Sanitize
|
|
26979
|
+
* Public method providing core sanitation functionality
|
|
26980
|
+
*
|
|
26981
|
+
* @param {String|Node} dirty string or DOM node
|
|
26982
|
+
* @param {Object} configuration object
|
|
26983
|
+
*/
|
|
26984
|
+
// eslint-disable-next-line complexity
|
|
26985
|
+
|
|
26986
|
+
|
|
26987
|
+
DOMPurify.sanitize = function (dirty) {
|
|
26988
|
+
var cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
26989
|
+
var body;
|
|
26990
|
+
var importedNode;
|
|
26991
|
+
var currentNode;
|
|
26992
|
+
var returnNode;
|
|
26993
|
+
/* Make sure we have a string to sanitize.
|
|
26994
|
+
DO NOT return early, as this will return the wrong type if
|
|
26995
|
+
the user has requested a DOM object rather than a string */
|
|
26996
|
+
|
|
26997
|
+
IS_EMPTY_INPUT = !dirty;
|
|
26998
|
+
|
|
26999
|
+
if (IS_EMPTY_INPUT) {
|
|
27000
|
+
dirty = '<!-->';
|
|
27001
|
+
}
|
|
27002
|
+
/* Stringify, in case dirty is an object */
|
|
27003
|
+
|
|
27004
|
+
|
|
27005
|
+
if (typeof dirty !== 'string' && !_isNode(dirty)) {
|
|
27006
|
+
// eslint-disable-next-line no-negated-condition
|
|
27007
|
+
if (typeof dirty.toString !== 'function') {
|
|
27008
|
+
throw typeErrorCreate('toString is not a function');
|
|
27009
|
+
} else {
|
|
27010
|
+
dirty = dirty.toString();
|
|
27011
|
+
|
|
27012
|
+
if (typeof dirty !== 'string') {
|
|
27013
|
+
throw typeErrorCreate('dirty is not a string, aborting');
|
|
27014
|
+
}
|
|
27015
|
+
}
|
|
27016
|
+
}
|
|
27017
|
+
/* Return dirty HTML if DOMPurify cannot run */
|
|
27018
|
+
|
|
27019
|
+
|
|
27020
|
+
if (!DOMPurify.isSupported) {
|
|
27021
|
+
return dirty;
|
|
27022
|
+
}
|
|
27023
|
+
/* Assign config vars */
|
|
27024
|
+
|
|
27025
|
+
|
|
27026
|
+
if (!SET_CONFIG) {
|
|
27027
|
+
_parseConfig(cfg);
|
|
27028
|
+
}
|
|
27029
|
+
/* Clean up removed elements */
|
|
27030
|
+
|
|
27031
|
+
|
|
27032
|
+
DOMPurify.removed = [];
|
|
27033
|
+
/* Check if dirty is correctly typed for IN_PLACE */
|
|
27034
|
+
|
|
27035
|
+
if (typeof dirty === 'string') {
|
|
27036
|
+
IN_PLACE = false;
|
|
27037
|
+
}
|
|
27038
|
+
|
|
27039
|
+
if (IN_PLACE) {
|
|
27040
|
+
/* Do some early pre-sanitization to avoid unsafe root nodes */
|
|
27041
|
+
if (dirty.nodeName) {
|
|
27042
|
+
var tagName = transformCaseFunc(dirty.nodeName);
|
|
27043
|
+
|
|
27044
|
+
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
27045
|
+
throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
|
|
27046
|
+
}
|
|
27047
|
+
}
|
|
27048
|
+
} else if (dirty instanceof Node) {
|
|
27049
|
+
/* If dirty is a DOM element, append to an empty document to avoid
|
|
27050
|
+
elements being stripped by the parser */
|
|
27051
|
+
body = _initDocument('<!---->');
|
|
27052
|
+
importedNode = body.ownerDocument.importNode(dirty, true);
|
|
27053
|
+
|
|
27054
|
+
if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {
|
|
27055
|
+
/* Node is already a body, use as is */
|
|
27056
|
+
body = importedNode;
|
|
27057
|
+
} else if (importedNode.nodeName === 'HTML') {
|
|
27058
|
+
body = importedNode;
|
|
27059
|
+
} else {
|
|
27060
|
+
// eslint-disable-next-line unicorn/prefer-dom-node-append
|
|
27061
|
+
body.appendChild(importedNode);
|
|
27062
|
+
}
|
|
27063
|
+
} else {
|
|
27064
|
+
/* Exit directly if we have nothing to do */
|
|
27065
|
+
if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
|
|
27066
|
+
dirty.indexOf('<') === -1) {
|
|
27067
|
+
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
|
27068
|
+
}
|
|
27069
|
+
/* Initialize the document to work on */
|
|
27070
|
+
|
|
27071
|
+
|
|
27072
|
+
body = _initDocument(dirty);
|
|
27073
|
+
/* Check we have a DOM node from the data */
|
|
27074
|
+
|
|
27075
|
+
if (!body) {
|
|
27076
|
+
return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
|
|
27077
|
+
}
|
|
27078
|
+
}
|
|
27079
|
+
/* Remove first element node (ours) if FORCE_BODY is set */
|
|
27080
|
+
|
|
27081
|
+
|
|
27082
|
+
if (body && FORCE_BODY) {
|
|
27083
|
+
_forceRemove(body.firstChild);
|
|
27084
|
+
}
|
|
27085
|
+
/* Get node iterator */
|
|
27086
|
+
|
|
27087
|
+
|
|
27088
|
+
var nodeIterator = _createIterator(IN_PLACE ? dirty : body);
|
|
27089
|
+
/* Now start iterating over the created document */
|
|
27090
|
+
|
|
27091
|
+
|
|
27092
|
+
while (currentNode = nodeIterator.nextNode()) {
|
|
27093
|
+
/* Sanitize tags and elements */
|
|
27094
|
+
if (_sanitizeElements(currentNode)) {
|
|
27095
|
+
continue;
|
|
27096
|
+
}
|
|
27097
|
+
/* Shadow DOM detected, sanitize it */
|
|
27098
|
+
|
|
27099
|
+
|
|
27100
|
+
if (currentNode.content instanceof DocumentFragment) {
|
|
27101
|
+
_sanitizeShadowDOM(currentNode.content);
|
|
27102
|
+
}
|
|
27103
|
+
/* Check attributes, sanitize if necessary */
|
|
27104
|
+
|
|
27105
|
+
|
|
27106
|
+
_sanitizeAttributes(currentNode);
|
|
27107
|
+
}
|
|
27108
|
+
/* If we sanitized `dirty` in-place, return it. */
|
|
27109
|
+
|
|
27110
|
+
|
|
27111
|
+
if (IN_PLACE) {
|
|
27112
|
+
return dirty;
|
|
27113
|
+
}
|
|
27114
|
+
/* Return sanitized string or DOM */
|
|
27115
|
+
|
|
27116
|
+
|
|
27117
|
+
if (RETURN_DOM) {
|
|
27118
|
+
if (RETURN_DOM_FRAGMENT) {
|
|
27119
|
+
returnNode = createDocumentFragment.call(body.ownerDocument);
|
|
27120
|
+
|
|
27121
|
+
while (body.firstChild) {
|
|
27122
|
+
// eslint-disable-next-line unicorn/prefer-dom-node-append
|
|
27123
|
+
returnNode.appendChild(body.firstChild);
|
|
27124
|
+
}
|
|
27125
|
+
} else {
|
|
27126
|
+
returnNode = body;
|
|
27127
|
+
}
|
|
27128
|
+
|
|
27129
|
+
if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmod) {
|
|
27130
|
+
/*
|
|
27131
|
+
AdoptNode() is not used because internal state is not reset
|
|
27132
|
+
(e.g. the past names map of a HTMLFormElement), this is safe
|
|
27133
|
+
in theory but we would rather not risk another attack vector.
|
|
27134
|
+
The state that is cloned by importNode() is explicitly defined
|
|
27135
|
+
by the specs.
|
|
27136
|
+
*/
|
|
27137
|
+
returnNode = importNode.call(originalDocument, returnNode, true);
|
|
27138
|
+
}
|
|
27139
|
+
|
|
27140
|
+
return returnNode;
|
|
27141
|
+
}
|
|
27142
|
+
|
|
27143
|
+
var serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
|
|
27144
|
+
/* Serialize doctype if allowed */
|
|
27145
|
+
|
|
27146
|
+
if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
|
|
27147
|
+
serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
|
|
27148
|
+
}
|
|
27149
|
+
/* Sanitize final string template-safe */
|
|
27150
|
+
|
|
27151
|
+
|
|
27152
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
27153
|
+
serializedHTML = stringReplace(serializedHTML, MUSTACHE_EXPR$1, ' ');
|
|
27154
|
+
serializedHTML = stringReplace(serializedHTML, ERB_EXPR$1, ' ');
|
|
27155
|
+
serializedHTML = stringReplace(serializedHTML, TMPLIT_EXPR$1, ' ');
|
|
27156
|
+
}
|
|
27157
|
+
|
|
27158
|
+
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
|
|
27159
|
+
};
|
|
27160
|
+
/**
|
|
27161
|
+
* Public method to set the configuration once
|
|
27162
|
+
* setConfig
|
|
27163
|
+
*
|
|
27164
|
+
* @param {Object} cfg configuration object
|
|
27165
|
+
*/
|
|
27166
|
+
|
|
27167
|
+
|
|
27168
|
+
DOMPurify.setConfig = function (cfg) {
|
|
27169
|
+
_parseConfig(cfg);
|
|
27170
|
+
|
|
27171
|
+
SET_CONFIG = true;
|
|
27172
|
+
};
|
|
27173
|
+
/**
|
|
27174
|
+
* Public method to remove the configuration
|
|
27175
|
+
* clearConfig
|
|
27176
|
+
*
|
|
27177
|
+
*/
|
|
27178
|
+
|
|
27179
|
+
|
|
27180
|
+
DOMPurify.clearConfig = function () {
|
|
27181
|
+
CONFIG = null;
|
|
27182
|
+
SET_CONFIG = false;
|
|
27183
|
+
};
|
|
27184
|
+
/**
|
|
27185
|
+
* Public method to check if an attribute value is valid.
|
|
27186
|
+
* Uses last set config, if any. Otherwise, uses config defaults.
|
|
27187
|
+
* isValidAttribute
|
|
27188
|
+
*
|
|
27189
|
+
* @param {string} tag Tag name of containing element.
|
|
27190
|
+
* @param {string} attr Attribute name.
|
|
27191
|
+
* @param {string} value Attribute value.
|
|
27192
|
+
* @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
|
|
27193
|
+
*/
|
|
27194
|
+
|
|
27195
|
+
|
|
27196
|
+
DOMPurify.isValidAttribute = function (tag, attr, value) {
|
|
27197
|
+
/* Initialize shared config vars if necessary. */
|
|
27198
|
+
if (!CONFIG) {
|
|
27199
|
+
_parseConfig({});
|
|
27200
|
+
}
|
|
27201
|
+
|
|
27202
|
+
var lcTag = transformCaseFunc(tag);
|
|
27203
|
+
var lcName = transformCaseFunc(attr);
|
|
27204
|
+
return _isValidAttribute(lcTag, lcName, value);
|
|
27205
|
+
};
|
|
27206
|
+
/**
|
|
27207
|
+
* AddHook
|
|
27208
|
+
* Public method to add DOMPurify hooks
|
|
27209
|
+
*
|
|
27210
|
+
* @param {String} entryPoint entry point for the hook to add
|
|
27211
|
+
* @param {Function} hookFunction function to execute
|
|
27212
|
+
*/
|
|
27213
|
+
|
|
27214
|
+
|
|
27215
|
+
DOMPurify.addHook = function (entryPoint, hookFunction) {
|
|
27216
|
+
if (typeof hookFunction !== 'function') {
|
|
27217
|
+
return;
|
|
27218
|
+
}
|
|
27219
|
+
|
|
27220
|
+
hooks[entryPoint] = hooks[entryPoint] || [];
|
|
27221
|
+
arrayPush(hooks[entryPoint], hookFunction);
|
|
27222
|
+
};
|
|
27223
|
+
/**
|
|
27224
|
+
* RemoveHook
|
|
27225
|
+
* Public method to remove a DOMPurify hook at a given entryPoint
|
|
27226
|
+
* (pops it from the stack of hooks if more are present)
|
|
27227
|
+
*
|
|
27228
|
+
* @param {String} entryPoint entry point for the hook to remove
|
|
27229
|
+
* @return {Function} removed(popped) hook
|
|
27230
|
+
*/
|
|
27231
|
+
|
|
27232
|
+
|
|
27233
|
+
DOMPurify.removeHook = function (entryPoint) {
|
|
27234
|
+
if (hooks[entryPoint]) {
|
|
27235
|
+
return arrayPop(hooks[entryPoint]);
|
|
27236
|
+
}
|
|
27237
|
+
};
|
|
27238
|
+
/**
|
|
27239
|
+
* RemoveHooks
|
|
27240
|
+
* Public method to remove all DOMPurify hooks at a given entryPoint
|
|
27241
|
+
*
|
|
27242
|
+
* @param {String} entryPoint entry point for the hooks to remove
|
|
27243
|
+
*/
|
|
27244
|
+
|
|
27245
|
+
|
|
27246
|
+
DOMPurify.removeHooks = function (entryPoint) {
|
|
27247
|
+
if (hooks[entryPoint]) {
|
|
27248
|
+
hooks[entryPoint] = [];
|
|
27249
|
+
}
|
|
27250
|
+
};
|
|
27251
|
+
/**
|
|
27252
|
+
* RemoveAllHooks
|
|
27253
|
+
* Public method to remove all DOMPurify hooks
|
|
27254
|
+
*
|
|
27255
|
+
*/
|
|
27256
|
+
|
|
27257
|
+
|
|
27258
|
+
DOMPurify.removeAllHooks = function () {
|
|
27259
|
+
hooks = {};
|
|
27260
|
+
};
|
|
27261
|
+
|
|
27262
|
+
return DOMPurify;
|
|
27263
|
+
}
|
|
27264
|
+
|
|
27265
|
+
var purify = createDOMPurify();
|
|
27266
|
+
|
|
27267
|
+
return purify;
|
|
27268
|
+
|
|
27269
|
+
}));
|
|
27270
|
+
//# sourceMappingURL=purify.js.map
|
|
27271
|
+
|
|
27272
|
+
|
|
25498
27273
|
/***/ }),
|
|
25499
27274
|
|
|
25500
27275
|
/***/ "./node_modules/encode-utf8/index.js":
|
|
@@ -54787,7 +56562,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
54787
56562
|
/* harmony import */ var _class_order__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./class-order */ "./node_modules/rdflib/esm/class-order.js");
|
|
54788
56563
|
/* harmony import */ var _node_internal__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./node-internal */ "./node_modules/rdflib/esm/node-internal.js");
|
|
54789
56564
|
/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./types */ "./node_modules/rdflib/esm/types.js");
|
|
54790
|
-
/* provided dependency */ var console = __webpack_require__(/*! ./node_modules/console-browserify/index.js */ "./node_modules/console-browserify/index.js");
|
|
54791
56565
|
|
|
54792
56566
|
|
|
54793
56567
|
|
|
@@ -54883,7 +56657,6 @@ var BlankNode = /*#__PURE__*/function (_Node) {
|
|
|
54883
56657
|
function getId(id) {
|
|
54884
56658
|
if (id) {
|
|
54885
56659
|
if (typeof id !== 'string') {
|
|
54886
|
-
console.log('Bad blank id:', id);
|
|
54887
56660
|
throw new Error('Bad id argument to new blank node: ' + id);
|
|
54888
56661
|
}
|
|
54889
56662
|
if (id.includes('#')) {
|
|
@@ -56511,7 +58284,7 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
56511
58284
|
size: 0,
|
|
56512
58285
|
timeout: 0
|
|
56513
58286
|
};
|
|
56514
|
-
console.log('Fetcher: <' + actualProxyURI + '> Non-HTTP fetch exception: ' + error)
|
|
58287
|
+
// console.log('Fetcher: <' + actualProxyURI + '> Non-HTTP fetch exception: ' + error)
|
|
56515
58288
|
return _this5.handleError(dummyResponse, docuri, options); // possible credentials retry
|
|
56516
58289
|
// return this.failFetch(options, 'fetch failed: ' + error, 999, dummyResponse) // Fake status code: fetch exception
|
|
56517
58290
|
|
|
@@ -56572,25 +58345,21 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
56572
58345
|
if (fetchResponse.ok) {
|
|
56573
58346
|
userCallback(true, 'OK', fetchResponse);
|
|
56574
58347
|
} else {
|
|
56575
|
-
// console.log('@@@ fetcher.js Should not take this path !!!!!!!!!!!!')
|
|
56576
58348
|
var oops = 'HTTP error: Status ' + fetchResponse.status + ' (' + fetchResponse.statusText + ')';
|
|
56577
58349
|
if (fetchResponse.responseText) {
|
|
56578
58350
|
oops += ' ' + fetchResponse.responseText; // not in 404, dns error, nock failure
|
|
56579
58351
|
}
|
|
56580
58352
|
|
|
56581
|
-
console.log(oops + ' fetching ' + uri);
|
|
56582
58353
|
userCallback(false, oops, fetchResponse);
|
|
56583
58354
|
}
|
|
56584
58355
|
} else {
|
|
56585
58356
|
var _oops = '@@ nowOrWhenFetched: no response object!';
|
|
56586
|
-
console.log(_oops);
|
|
56587
58357
|
userCallback(false, _oops);
|
|
56588
58358
|
}
|
|
56589
58359
|
}
|
|
56590
58360
|
}, function (err) {
|
|
56591
58361
|
var message = err.message || err.statusText;
|
|
56592
58362
|
message = 'Failed to load <' + uri + '> ' + message;
|
|
56593
|
-
console.log(message);
|
|
56594
58363
|
if (err.response && err.response.status) {
|
|
56595
58364
|
message += ' status: ' + err.response.status;
|
|
56596
58365
|
}
|
|
@@ -56829,45 +58598,42 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
56829
58598
|
return fetcher.load(doc);
|
|
56830
58599
|
case 6:
|
|
56831
58600
|
response = _context2.sent;
|
|
56832
|
-
_context2.next =
|
|
58601
|
+
_context2.next = 26;
|
|
56833
58602
|
break;
|
|
56834
58603
|
case 9:
|
|
56835
58604
|
_context2.prev = 9;
|
|
56836
58605
|
_context2.t0 = _context2["catch"](3);
|
|
56837
58606
|
if (!(_context2.t0.response.status === 404)) {
|
|
56838
|
-
_context2.next =
|
|
58607
|
+
_context2.next = 25;
|
|
56839
58608
|
break;
|
|
56840
58609
|
}
|
|
56841
|
-
|
|
56842
|
-
_context2.
|
|
56843
|
-
_context2.next = 16;
|
|
58610
|
+
_context2.prev = 12;
|
|
58611
|
+
_context2.next = 15;
|
|
56844
58612
|
return fetcher.webOperation('PUT', doc.value, {
|
|
56845
58613
|
data: data,
|
|
56846
58614
|
contentType: contentType
|
|
56847
58615
|
});
|
|
56848
|
-
case
|
|
58616
|
+
case 15:
|
|
56849
58617
|
response = _context2.sent;
|
|
56850
|
-
_context2.next =
|
|
58618
|
+
_context2.next = 21;
|
|
56851
58619
|
break;
|
|
56852
|
-
case
|
|
56853
|
-
_context2.prev =
|
|
56854
|
-
_context2.t1 = _context2["catch"](
|
|
56855
|
-
console.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context2.t1);
|
|
58620
|
+
case 18:
|
|
58621
|
+
_context2.prev = 18;
|
|
58622
|
+
_context2.t1 = _context2["catch"](12);
|
|
56856
58623
|
throw _context2.t1;
|
|
56857
|
-
case
|
|
58624
|
+
case 21:
|
|
56858
58625
|
delete fetcher.requested[doc.value]; // delete cached 404 error
|
|
56859
58626
|
// console.log('createIfNotExists doc created ok ' + doc)
|
|
56860
58627
|
return _context2.abrupt("return", response);
|
|
56861
|
-
case
|
|
56862
|
-
console.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context2.t0);
|
|
58628
|
+
case 25:
|
|
56863
58629
|
throw _context2.t0;
|
|
56864
|
-
case
|
|
58630
|
+
case 26:
|
|
56865
58631
|
return _context2.abrupt("return", response);
|
|
56866
|
-
case
|
|
58632
|
+
case 27:
|
|
56867
58633
|
case "end":
|
|
56868
58634
|
return _context2.stop();
|
|
56869
58635
|
}
|
|
56870
|
-
}, _callee2, this, [[3, 9], [
|
|
58636
|
+
}, _callee2, this, [[3, 9], [12, 18]]);
|
|
56871
58637
|
}));
|
|
56872
58638
|
function createIfNotExists(_x4) {
|
|
56873
58639
|
return _createIfNotExists.apply(this, arguments);
|
|
@@ -57176,7 +58942,8 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
57176
58942
|
}, {
|
|
57177
58943
|
key: "retryNoCredentials",
|
|
57178
58944
|
value: function retryNoCredentials(docuri, options) {
|
|
57179
|
-
console.log('Fetcher: CORS: RETRYING with NO CREDENTIALS for ' + options.resource)
|
|
58945
|
+
// console.log('Fetcher: CORS: RETRYING with NO CREDENTIALS for ' + options.resource)
|
|
58946
|
+
|
|
57180
58947
|
options.retriedWithNoCredentials = true; // protect against being called twice
|
|
57181
58948
|
|
|
57182
58949
|
delete this.requested[docuri]; // forget the original request happened
|
|
@@ -57221,7 +58988,7 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
57221
58988
|
// Now attempt retry via proxy
|
|
57222
58989
|
var proxyUri = Fetcher.crossSiteProxy(docuri);
|
|
57223
58990
|
if (proxyUri && !options.proxyUsed) {
|
|
57224
|
-
console.log('web: Direct failed so trying proxy ' + proxyUri)
|
|
58991
|
+
// console.log('web: Direct failed so trying proxy ' + proxyUri)
|
|
57225
58992
|
return this.redirectToProxy(proxyUri, options);
|
|
57226
58993
|
}
|
|
57227
58994
|
}
|
|
@@ -57294,7 +59061,7 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
57294
59061
|
|
|
57295
59062
|
// Check for masked errors (CORS, etc)
|
|
57296
59063
|
if (response.status === 0) {
|
|
57297
|
-
console.log('Masked error - status 0 for ' + docuri)
|
|
59064
|
+
// console.log('Masked error - status 0 for ' + docuri)
|
|
57298
59065
|
return this.handleError(response, docuri, options);
|
|
57299
59066
|
}
|
|
57300
59067
|
if (response.status >= 400) {
|
|
@@ -57627,7 +59394,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
57627
59394
|
/* harmony import */ var _variable__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./variable */ "./node_modules/rdflib/esm/variable.js");
|
|
57628
59395
|
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./utils */ "./node_modules/rdflib/esm/utils.js");
|
|
57629
59396
|
/* harmony import */ var _named_node__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./named-node */ "./node_modules/rdflib/esm/named-node.js");
|
|
57630
|
-
/* provided dependency */ var console = __webpack_require__(/*! ./node_modules/console-browserify/index.js */ "./node_modules/console-browserify/index.js");
|
|
57631
59397
|
|
|
57632
59398
|
|
|
57633
59399
|
|
|
@@ -58182,7 +59948,6 @@ var Formula = /*#__PURE__*/function (_Node) {
|
|
|
58182
59948
|
while (todo.length) {
|
|
58183
59949
|
follow(todo.shift());
|
|
58184
59950
|
}
|
|
58185
|
-
// console.log('' + result.length + ' statements about ' + subject)
|
|
58186
59951
|
return result;
|
|
58187
59952
|
}
|
|
58188
59953
|
|
|
@@ -58339,10 +60104,10 @@ var Formula = /*#__PURE__*/function (_Node) {
|
|
|
58339
60104
|
var statementsCopy = this.statements.map(function (ea) {
|
|
58340
60105
|
return ea.substitute(bindings);
|
|
58341
60106
|
});
|
|
58342
|
-
console.log('Formula subs statmnts:' + statementsCopy)
|
|
60107
|
+
// console.log('Formula subs statmnts:' + statementsCopy)
|
|
58343
60108
|
var y = new Formula();
|
|
58344
60109
|
y.addAll(statementsCopy);
|
|
58345
|
-
console.log('indexed-form subs formula:' + y)
|
|
60110
|
+
// console.log('indexed-form subs formula:' + y)
|
|
58346
60111
|
return y;
|
|
58347
60112
|
}
|
|
58348
60113
|
}, {
|
|
@@ -61117,7 +62882,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
61117
62882
|
/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
|
|
61118
62883
|
/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/esm/createClass.js");
|
|
61119
62884
|
/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js");
|
|
61120
|
-
/* provided dependency */ var console = __webpack_require__(/*! ./node_modules/console-browserify/index.js */ "./node_modules/console-browserify/index.js");
|
|
61121
62885
|
|
|
61122
62886
|
|
|
61123
62887
|
|
|
@@ -61155,7 +62919,6 @@ var Node = /*#__PURE__*/function () {
|
|
|
61155
62919
|
(0,_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(Node, [{
|
|
61156
62920
|
key: "substitute",
|
|
61157
62921
|
value: function substitute(bindings) {
|
|
61158
|
-
console.log('@@@ node substitute' + this);
|
|
61159
62922
|
return this;
|
|
61160
62923
|
}
|
|
61161
62924
|
|
|
@@ -65491,7 +67254,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
65491
67254
|
/* harmony import */ var _node_internal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./node-internal */ "./node_modules/rdflib/esm/node-internal.js");
|
|
65492
67255
|
/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./types */ "./node_modules/rdflib/esm/types.js");
|
|
65493
67256
|
/* harmony import */ var _default_graph__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./default-graph */ "./node_modules/rdflib/esm/default-graph.js");
|
|
65494
|
-
/* provided dependency */ var console = __webpack_require__(/*! ./node_modules/console-browserify/index.js */ "./node_modules/console-browserify/index.js");
|
|
65495
67257
|
|
|
65496
67258
|
|
|
65497
67259
|
|
|
@@ -65570,7 +67332,7 @@ var Statement = /*#__PURE__*/function () {
|
|
|
65570
67332
|
key: "substitute",
|
|
65571
67333
|
value: function substitute(bindings) {
|
|
65572
67334
|
var y = new Statement(this.subject.substitute(bindings), this.predicate.substitute(bindings), this.object.substitute(bindings), (0,_default_graph__WEBPACK_IMPORTED_MODULE_3__.isDefaultGraph)(this.graph) ? this.graph : this.graph.substitute(bindings)); // 2016
|
|
65573
|
-
console.log('@@@ statement substitute:' + y)
|
|
67335
|
+
// console.log('@@@ statement substitute:' + y)
|
|
65574
67336
|
return y;
|
|
65575
67337
|
}
|
|
65576
67338
|
|
|
@@ -100447,7 +102209,7 @@ var SolidAuthnLogic = /** @class */ (function () {
|
|
|
100447
102209
|
*/
|
|
100448
102210
|
SolidAuthnLogic.prototype.checkUser = function (setUserCallback) {
|
|
100449
102211
|
return __awaiter(this, void 0, void 0, function () {
|
|
100450
|
-
var preLoginRedirectHash, postLoginRedirectHash, curUrl, me, webId;
|
|
102212
|
+
var preLoginRedirectHash, redirectUrl, postLoginRedirectHash, curUrl, me, webId;
|
|
100451
102213
|
return __generator(this, function (_a) {
|
|
100452
102214
|
switch (_a.label) {
|
|
100453
102215
|
case 0:
|
|
@@ -100459,20 +102221,16 @@ var SolidAuthnLogic = /** @class */ (function () {
|
|
|
100459
102221
|
if (document.location.toString() !== url)
|
|
100460
102222
|
history.replaceState(null, '', url);
|
|
100461
102223
|
});
|
|
100462
|
-
|
|
100463
|
-
|
|
100464
|
-
*/
|
|
102224
|
+
redirectUrl = new URL(window.location.href);
|
|
102225
|
+
redirectUrl.hash = '';
|
|
100465
102226
|
return [4 /*yield*/, this.session
|
|
100466
102227
|
.handleIncomingRedirect({
|
|
100467
102228
|
restorePreviousSession: true,
|
|
100468
|
-
url:
|
|
102229
|
+
url: redirectUrl.href
|
|
100469
102230
|
})
|
|
100470
102231
|
// Check to see if a hash was stored in local storage
|
|
100471
102232
|
];
|
|
100472
102233
|
case 1:
|
|
100473
|
-
/**
|
|
100474
|
-
* Handle a successful authentication redirect
|
|
100475
|
-
*/
|
|
100476
102234
|
_a.sent();
|
|
100477
102235
|
postLoginRedirectHash = window.localStorage.getItem('preLoginRedirectHash');
|
|
100478
102236
|
if (postLoginRedirectHash) {
|
|
@@ -104408,6 +106166,7 @@ exports["default"] = _default;
|
|
|
104408
106166
|
/* provided dependency */ var console = __webpack_require__(/*! ./node_modules/console-browserify/index.js */ "./node_modules/console-browserify/index.js");
|
|
104409
106167
|
|
|
104410
106168
|
|
|
106169
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
104411
106170
|
Object.defineProperty(exports, "__esModule", ({
|
|
104412
106171
|
value: true
|
|
104413
106172
|
}));
|
|
@@ -104415,6 +106174,9 @@ exports["default"] = void 0;
|
|
|
104415
106174
|
var _solidUi = __webpack_require__(/*! solid-ui */ "./node_modules/solid-ui/lib/index.js");
|
|
104416
106175
|
var _rdflib = __webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js");
|
|
104417
106176
|
var _marked = __webpack_require__(/*! marked */ "./node_modules/marked/lib/marked.cjs");
|
|
106177
|
+
var DOMPurify = _interopRequireWildcard(__webpack_require__(/*! dompurify */ "./node_modules/dompurify/dist/purify.js"));
|
|
106178
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
106179
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
104418
106180
|
/* Human-readable Pane
|
|
104419
106181
|
**
|
|
104420
106182
|
** This outline pane contains the document contents for an HTML document
|
|
@@ -104470,7 +106232,7 @@ var humanReadablePane = {
|
|
|
104470
106232
|
var cts = kb.fetcher.getHeader(subject.doc(), 'content-type');
|
|
104471
106233
|
var ct = cts ? cts[0] : null;
|
|
104472
106234
|
if (ct) {
|
|
104473
|
-
console.log('humanReadablePane: c-t:' + ct)
|
|
106235
|
+
// console.log('humanReadablePane: c-t:' + ct)
|
|
104474
106236
|
} else {
|
|
104475
106237
|
console.log('humanReadablePane: unknown content-type?');
|
|
104476
106238
|
}
|
|
@@ -104486,7 +106248,8 @@ var humanReadablePane = {
|
|
|
104486
106248
|
var markdownText = response.responseText;
|
|
104487
106249
|
var lines = Math.min(30, markdownText.split(/\n/).length + 5);
|
|
104488
106250
|
var res = _marked.marked.parse(markdownText);
|
|
104489
|
-
|
|
106251
|
+
var clean = DOMPurify.sanitize(res);
|
|
106252
|
+
frame.innerHTML = clean;
|
|
104490
106253
|
frame.setAttribute('class', 'doc');
|
|
104491
106254
|
frame.setAttribute('style', "border: 1px solid; padding: 1em; height: ".concat(lines, "em; width: 800px; resize: both; overflow: auto;"));
|
|
104492
106255
|
});
|
|
@@ -114203,10 +115966,10 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
114203
115966
|
}));
|
|
114204
115967
|
exports["default"] = void 0;
|
|
114205
115968
|
var _default = {
|
|
114206
|
-
buildTime: "2023-
|
|
114207
|
-
commit: "
|
|
115969
|
+
buildTime: "2023-03-17T15:26:14Z",
|
|
115970
|
+
commit: "32b73b7d09660ebf8ec1fed046cd06e9b07beabe",
|
|
114208
115971
|
npmInfo: {
|
|
114209
|
-
'solid-panes': '3.5.
|
|
115972
|
+
'solid-panes': '3.5.32',
|
|
114210
115973
|
npm: '8.19.4',
|
|
114211
115974
|
node: '16.19.1',
|
|
114212
115975
|
v8: '9.4.146.26-node.24',
|
|
@@ -121437,7 +123200,7 @@ function renderSignInPopup(dom) {
|
|
|
121437
123200
|
issuerPopupBoxTopMenu.appendChild(issuerPopupBoxCloseButton);
|
|
121438
123201
|
var loginToIssuer = /*#__PURE__*/function () {
|
|
121439
123202
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(issuerUri) {
|
|
121440
|
-
var preLoginRedirectHash;
|
|
123203
|
+
var preLoginRedirectHash, locationUrl;
|
|
121441
123204
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
121442
123205
|
while (1) switch (_context.prev = _context.next) {
|
|
121443
123206
|
case 0:
|
|
@@ -121449,23 +123212,25 @@ function renderSignInPopup(dom) {
|
|
|
121449
123212
|
}
|
|
121450
123213
|
window.localStorage.setItem('loginIssuer', issuerUri);
|
|
121451
123214
|
// Login
|
|
121452
|
-
|
|
123215
|
+
locationUrl = new URL(window.location.href);
|
|
123216
|
+
locationUrl.hash = ''; // remove hash part
|
|
123217
|
+
_context.next = 8;
|
|
121453
123218
|
return _solidLogic.authSession.login({
|
|
121454
|
-
redirectUrl:
|
|
123219
|
+
redirectUrl: locationUrl.href,
|
|
121455
123220
|
oidcIssuer: issuerUri
|
|
121456
123221
|
});
|
|
121457
|
-
case 6:
|
|
121458
|
-
_context.next = 11;
|
|
121459
|
-
break;
|
|
121460
123222
|
case 8:
|
|
121461
|
-
_context.
|
|
123223
|
+
_context.next = 13;
|
|
123224
|
+
break;
|
|
123225
|
+
case 10:
|
|
123226
|
+
_context.prev = 10;
|
|
121462
123227
|
_context.t0 = _context["catch"](0);
|
|
121463
123228
|
(0, _log.alert)(_context.t0.message);
|
|
121464
|
-
case
|
|
123229
|
+
case 13:
|
|
121465
123230
|
case "end":
|
|
121466
123231
|
return _context.stop();
|
|
121467
123232
|
}
|
|
121468
|
-
}, _callee, null, [[0,
|
|
123233
|
+
}, _callee, null, [[0, 10]]);
|
|
121469
123234
|
}));
|
|
121470
123235
|
return function loginToIssuer(_x11) {
|
|
121471
123236
|
return _ref.apply(this, arguments);
|
|
@@ -127402,10 +129167,10 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
127402
129167
|
}));
|
|
127403
129168
|
exports.versionInfo = void 0;
|
|
127404
129169
|
var versionInfo = {
|
|
127405
|
-
buildTime: '2023-
|
|
127406
|
-
commit: '
|
|
129170
|
+
buildTime: '2023-03-17T10:43:05Z',
|
|
129171
|
+
commit: '5b3471ff0bc08942d334b9bc9a6992adcb5cdb6b',
|
|
127407
129172
|
npmInfo: {
|
|
127408
|
-
'solid-ui': '2.4.
|
|
129173
|
+
'solid-ui': '2.4.27',
|
|
127409
129174
|
npm: '8.19.4',
|
|
127410
129175
|
node: '16.19.1',
|
|
127411
129176
|
v8: '9.4.146.26-node.24',
|
|
@@ -145629,33 +147394,21 @@ class RemoteJWKSet extends _local_js__WEBPACK_IMPORTED_MODULE_3__.LocalJWKSet {
|
|
|
145629
147394
|
}
|
|
145630
147395
|
async reload() {
|
|
145631
147396
|
if (this._pendingFetch && (0,_runtime_env_js__WEBPACK_IMPORTED_MODULE_1__.isCloudflareWorkers)()) {
|
|
145632
|
-
|
|
145633
|
-
const isDone = () => {
|
|
145634
|
-
if (this._pendingFetch === undefined) {
|
|
145635
|
-
resolve();
|
|
145636
|
-
}
|
|
145637
|
-
else {
|
|
145638
|
-
setTimeout(isDone, 5);
|
|
145639
|
-
}
|
|
145640
|
-
};
|
|
145641
|
-
isDone();
|
|
145642
|
-
});
|
|
145643
|
-
}
|
|
145644
|
-
if (!this._pendingFetch) {
|
|
145645
|
-
this._pendingFetch = (0,_runtime_fetch_jwks_js__WEBPACK_IMPORTED_MODULE_0__["default"])(this._url, this._timeoutDuration, this._options)
|
|
145646
|
-
.then((json) => {
|
|
145647
|
-
if (!(0,_local_js__WEBPACK_IMPORTED_MODULE_3__.isJWKSLike)(json)) {
|
|
145648
|
-
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWKSInvalid('JSON Web Key Set malformed');
|
|
145649
|
-
}
|
|
145650
|
-
this._jwks = { keys: json.keys };
|
|
145651
|
-
this._jwksTimestamp = Date.now();
|
|
145652
|
-
this._pendingFetch = undefined;
|
|
145653
|
-
})
|
|
145654
|
-
.catch((err) => {
|
|
145655
|
-
this._pendingFetch = undefined;
|
|
145656
|
-
throw err;
|
|
145657
|
-
});
|
|
147397
|
+
this._pendingFetch = undefined;
|
|
145658
147398
|
}
|
|
147399
|
+
this._pendingFetch || (this._pendingFetch = (0,_runtime_fetch_jwks_js__WEBPACK_IMPORTED_MODULE_0__["default"])(this._url, this._timeoutDuration, this._options)
|
|
147400
|
+
.then((json) => {
|
|
147401
|
+
if (!(0,_local_js__WEBPACK_IMPORTED_MODULE_3__.isJWKSLike)(json)) {
|
|
147402
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWKSInvalid('JSON Web Key Set malformed');
|
|
147403
|
+
}
|
|
147404
|
+
this._jwks = { keys: json.keys };
|
|
147405
|
+
this._jwksTimestamp = Date.now();
|
|
147406
|
+
this._pendingFetch = undefined;
|
|
147407
|
+
})
|
|
147408
|
+
.catch((err) => {
|
|
147409
|
+
this._pendingFetch = undefined;
|
|
147410
|
+
throw err;
|
|
147411
|
+
}));
|
|
145659
147412
|
await this._pendingFetch;
|
|
145660
147413
|
}
|
|
145661
147414
|
}
|