@incodetech/web 2.0.1-rc.0 → 2.1.0-rc.0
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/ae-signature/ae-signature.es.js +15 -13
- package/dist/ae-signature/styles.css +3 -17
- package/dist/ae-signature/styles2.css +15 -5
- package/dist/aligndevicelottie-DY_bX_p8.js +12769 -0
- package/dist/antifraud/antifraud.es.js +23 -16
- package/dist/authentication/authentication.es.js +42 -27
- package/dist/autoFocusTitle-BzkUiELM.js +29 -0
- package/dist/{back-horizontal-hint-B8Brxh3U.js → back-horizontal-hint-D_8LptLm.js} +26 -26
- package/dist/back-tutorial-vb1MxlrT.js +14597 -0
- package/dist/{back-vertical-hint-BBo36dxn.js → back-vertical-hint-C1evxxq2.js} +27 -27
- package/dist/backdevicelottie-HypPqBz7.js +16690 -0
- package/dist/base.css +1258 -104
- package/dist/blurdevicelottie-CBXtBFiJ.js +15951 -0
- package/dist/bottomSheet-F1GJfQx_.js +39 -0
- package/dist/browser-ponyfill-CLLvZCVg.js +441 -0
- package/dist/button-CM_hgyIP.js +35 -0
- package/dist/checkbox-BoeLHKgp.js +96 -0
- package/dist/consent/consent.es.js +89 -73
- package/dist/consent/styles.css +35 -22
- package/dist/countrySelector-mSWyHSy4.js +60 -0
- package/dist/cpf-ocr/cpf-ocr.es.js +2 -0
- package/dist/cpfOcr-MtpRztkG.js +92 -0
- package/dist/cpfOcr-jJkYCfsX.js +2 -0
- package/dist/cross-document-data-match/cross-document-data-match.es.js +20 -16
- package/dist/curp-validation/curp-validation.es.js +247 -203
- package/dist/customFields-DXXt9HGM.js +140 -0
- package/dist/customWatchlist-DsW04UF6.js +36 -0
- package/dist/dateInputComposed-C_mh4XBg.js +69 -0
- package/dist/dateInputComposed-Cy6a7ymh.js +1 -0
- package/dist/defineProperty-mefzVtTv.js +39 -0
- package/dist/document-capture/document-capture.es.js +2 -0
- package/dist/document-capture/styles.css +2 -5
- package/dist/documentCapture-8ypBJehw.js +2 -0
- package/dist/documentCapture-BDV_921m.js +880 -0
- package/dist/dropdownComposed-CEWBSdGl.js +1 -0
- package/dist/dropdownComposed-_fgAlo_C.js +380 -0
- package/dist/dynamic-forms/styles.css +25 -13
- package/dist/dynamicForms-DyfnsS7E.js +352 -0
- package/dist/ekyb/ekyb.es.js +2 -2
- package/dist/ekyb/styles.css +2 -0
- package/dist/ekybModule-CIPGmCvD.js +279 -0
- package/dist/ekybModule-DFoYpheB.js +2 -0
- package/dist/ekyc/ekyc.es.js +2 -2
- package/dist/ekyc/styles.css +9 -7
- package/dist/ekycModule-BGzwgjl1.js +2 -0
- package/dist/ekycModule-BuTaC5ct.js +257 -0
- package/dist/electronic-signature/electronic-signature.es.js +2 -2
- package/dist/electronic-signature-B-Q7M0wK.js +430 -0
- package/dist/email/email.es.js +199 -66
- package/dist/emailInput-KZmhjOdZ.js +39 -0
- package/dist/errorIcon-DJRZpd8j.js +26 -0
- package/dist/expiredId-Q1t6aVpk.js +85 -0
- package/dist/extensibility-Cs3KQQdC.js +3070 -0
- package/dist/extensibility.es.js +26 -25
- package/dist/face-match/face-match.es.js +2 -2
- package/dist/face-match/styles.css +0 -4
- package/dist/faceMatch--RDHJe4t.js +343 -0
- package/dist/faceMatch-yEKPYaym.js +2 -0
- package/dist/field-comparison/field-comparison.es.js +2 -0
- package/dist/field-comparison/styles.css +16 -0
- package/dist/fieldComparison-CAF86bTC.js +88 -0
- package/dist/fieldComparison-D0an7T_g.js +2 -0
- package/dist/fiscal-qr/fiscal-qr.es.js +224 -0
- package/dist/fiscal-qr/styles.css +71 -0
- package/dist/{flip-animation-CgwRsEmK.js → flip-animation-BGRvygw9.js} +4221 -4221
- package/dist/flow/flow.es.js +619 -484
- package/dist/flow/styles.css +378 -418
- package/dist/{front-horizontal-hint-DGGGi8e1.js → front-horizontal-hint-Uf5bHCsd.js} +70 -70
- package/dist/{front-vertical-hint-CNr5mE6Q.js → front-vertical-hint-DdWNA45v.js} +81 -81
- package/dist/frontdevicelottie-CLqitJhG.js +17314 -0
- package/dist/geolocation/geolocation.es.js +486 -395
- package/dist/glaredevicelottie-BS04U6Fc.js +14478 -0
- package/dist/governmentValidation/governmentValidation.es.js +166 -93
- package/dist/governmentValidation/styles.css +0 -17
- package/dist/homeScreen-BZnIEDrV.js +264 -0
- package/dist/hooks-Da_yP_Dr.js +149 -0
- package/dist/i18n-CoCO2ZuN.js +2971 -0
- package/dist/icons-Dbs9ZfYM.js +360 -0
- package/dist/id/id.es.js +583 -414
- package/dist/id/styles.css +59 -43
- package/dist/id-laser-h-DX8UbVNH.js +467 -0
- package/dist/id-laser-v-DhnHdjlB.js +490 -0
- package/dist/id-tutorial-lj4iKtYT.js +13165 -0
- package/dist/id-verification/id-verification.es.js +21 -17
- package/dist/idOcr-CjGbb4dB.js +123 -0
- package/dist/identity-reuse/identity-reuse.es.js +311 -182
- package/dist/identity-reuse/styles.css +134 -80
- package/dist/incode-logo-57XFniXU.js +4 -0
- package/dist/incodeComponent-wfnHlnXx.js +63 -0
- package/dist/incodeModule-BUDoTwT9.js +13 -0
- package/dist/index.es.js +16 -13
- package/dist/inputComposed-BEn7_nZd.js +1 -0
- package/dist/inputComposed-CQ4AsvZg.js +99 -0
- package/dist/loadingIcon-B0ysgiNq.js +148 -0
- package/dist/lottie_light-Dp9Bz3mf.js +9031 -0
- package/dist/mandatoryConsent-r0PQHmv-.js +107 -0
- package/dist/modal-nTSaG7nB.js +139 -0
- package/dist/modal.hooks-D2xhIuHA.js +195 -0
- package/dist/numberedStep-CEtwZqLp.js +13 -0
- package/dist/optionAccessibleLabel-CnA-mNAU.js +202 -0
- package/dist/otpInput-_JmtVwa0.js +195 -0
- package/dist/page-DxGQj7Gk.js +71 -0
- package/dist/{passport-horizontal-hint-Bgquwtac.js → passport-horizontal-hint-Bbm2mvSn.js} +55 -55
- package/dist/{passport-tutorial-DwRwtPVX.js → passport-tutorial-zT1ZoA-D.js} +7096 -7084
- package/dist/{passport-vertical-hint-BT1D5BrW.js → passport-vertical-hint-DJbCtBiM.js} +49 -49
- package/dist/pdf-BZA70WbM.js +22398 -0
- package/dist/pdfViewer-BK-yVIve.js +114 -0
- package/dist/phone/phone.es.js +214 -70
- package/dist/phoneInputComposed-DjNdsmPE.js +12142 -0
- package/dist/processing-BM-wT-1W.js +8 -0
- package/dist/qe-signature/qe-signature.es.js +15 -13
- package/dist/radioGroupComposed-BNuaopVr.js +215 -0
- package/dist/redirect-to-mobile/redirect-to-mobile.es.js +2774 -0
- package/dist/redirect-to-mobile/styles.css +19 -269
- package/dist/registerIncodeElement-77NGCDsy.js +11 -0
- package/dist/requiredLabelHint-DEadtiwx.js +17 -0
- package/dist/richText-Cf9aMOCk.js +3153 -0
- package/dist/rolldown-runtime--E5BIlTp.js +33 -0
- package/dist/selfie/selfie.es.js +54 -37
- package/dist/selfie/styles.css +0 -4
- package/dist/selfieTutorial-CtruLyO2.js +2689 -0
- package/dist/signature/signature.es.js +778 -405
- package/dist/snackbar-CxepGC3e.js +16 -0
- package/dist/spinner-B6RxGFrI.js +1 -0
- package/dist/spinner-D8a_2LvW.js +42 -0
- package/dist/statusPage-DMYPUwRZ.js +28 -0
- package/dist/successIcon-BAyDPT7I.js +30 -0
- package/dist/tabs-C8npVBbk.js +103 -0
- package/dist/themes/dark.css +5 -0
- package/dist/themes/light.css +4 -0
- package/dist/transitionSpinner-DRRz-NV8.js +26 -0
- package/dist/{tutorial-9vHAHvMK.js → tutorial-D1qaY2Tm.js} +1105 -856
- package/dist/types/ae-signature.d.ts +4 -1
- package/dist/types/antifraud.d.ts +9 -3
- package/dist/types/authentication.d.ts +4 -1
- package/dist/types/consent.d.ts +4 -1
- package/dist/types/cpf-ocr.d.ts +12 -0
- package/dist/types/cross-document-data-match.d.ts +4 -1
- package/dist/types/curp-validation.d.ts +9 -3
- package/dist/types/document-capture.d.ts +37 -0
- package/dist/types/ekyb.d.ts +4 -1
- package/dist/types/ekyc.d.ts +4 -1
- package/dist/types/electronic-signature.d.ts +4 -1
- package/dist/types/email.d.ts +4 -1
- package/dist/types/extensibility.d.ts +40 -15
- package/dist/types/face-match.d.ts +4 -1
- package/dist/types/field-comparison.d.ts +38 -0
- package/dist/types/fiscal-qr.d.ts +43 -0
- package/dist/types/flow.d.ts +5 -2
- package/dist/types/geolocation.d.ts +4 -1
- package/dist/types/governmentValidation.d.ts +4 -1
- package/dist/types/id-verification.d.ts +4 -1
- package/dist/types/id.d.ts +4 -1
- package/dist/types/identity-reuse.d.ts +4 -1
- package/dist/types/index.d.ts +20 -2
- package/dist/types/phone.d.ts +4 -1
- package/dist/types/qe-signature.d.ts +4 -1
- package/dist/types/redirect-to-mobile.d.ts +17 -0
- package/dist/types/selfie.d.ts +4 -1
- package/dist/types/signature.d.ts +4 -1
- package/dist/types/watchlist.d.ts +4 -1
- package/dist/types/workflow.d.ts +55 -11
- package/dist/typography-YLgHHuao.js +45 -0
- package/dist/uiConfig-D2_wawvr.js +25 -0
- package/dist/useModuleLoader-CeJ2jL25.js +672 -0
- package/dist/vendor-preact-DThS2ZQ_.js +955 -0
- package/dist/verificationResult-Do5SpZ6X.js +64 -0
- package/dist/verifiedByIncode-DjXOdCml.js +103 -0
- package/dist/watchlist/watchlist.es.js +31 -28
- package/dist/watchlistForBusiness-BFFXC9d-.js +80 -0
- package/dist/workflow/styles.css +449 -427
- package/dist/workflow/workflow.es.js +268 -182
- package/package.json +32 -10
- package/dist/aligndevicelottie-DoV8xKjh.js +0 -12757
- package/dist/autoFocusTitle-QexamZ4i.js +0 -16
- package/dist/back-tutorial-1NOQobGO.js +0 -14585
- package/dist/backdevicelottie-C_ceuqY7.js +0 -16678
- package/dist/blurdevicelottie-UO14Y0WC.js +0 -15939
- package/dist/bottomSheet-DE_8TFEC.js +0 -31
- package/dist/browser-ponyfill-jOkuz57z.js +0 -299
- package/dist/button-DcCUEn2n.js +0 -24
- package/dist/checkbox-Cl57ltq_.js +0 -85
- package/dist/countrySelector-CE-JgIsv.js +0 -58
- package/dist/cpfOcr-D_tbwbvh.js +0 -78
- package/dist/customFields-CW38fQUv.js +0 -127
- package/dist/customWatchlist-D9_yjEQd.js +0 -33
- package/dist/dateInputComposed-BpAGsjN6.js +0 -55
- package/dist/dateInputComposed-DU3o6PAV.js +0 -1
- package/dist/defineProperty-Dh8nSJpJ.js +0 -39
- package/dist/documentCapture-xX-JT7ZY.js +0 -763
- package/dist/dropdownComposed-DFRBG22E.js +0 -284
- package/dist/dropdownComposed-DwTzc2YU.js +0 -1
- package/dist/dynamicForms-CJP1Ia6Q.js +0 -262
- package/dist/ekybModule-BSs7mndb.js +0 -280
- package/dist/ekybModule-D9M3E2Gm.js +0 -2
- package/dist/ekycModule-CU9pt5YN.js +0 -246
- package/dist/ekycModule-CZw9cLno.js +0 -2
- package/dist/electronic-signature-COYXjGdd.js +0 -410
- package/dist/emailInput-DppGf9pv.js +0 -37
- package/dist/expiredId-BnmzE8T3.js +0 -70
- package/dist/extensibility-CzEJfRwo.js +0 -2586
- package/dist/faceMatch-B8j0g0Yo.js +0 -2
- package/dist/faceMatch-BV8UD7tj.js +0 -201
- package/dist/frontdevicelottie-Bu6f9fDE.js +0 -17302
- package/dist/glaredevicelottie-B10axYs_.js +0 -14466
- package/dist/homeScreen-DnP1jw9A.js +0 -227
- package/dist/hooks-BVnGysT7.js +0 -80
- package/dist/i18n-9s4OSqwi.js +0 -2010
- package/dist/icons-Cc7zwchP.js +0 -310
- package/dist/id-laser-h-mBAzHVOK.js +0 -467
- package/dist/id-laser-v-CrFg4bcJ.js +0 -483
- package/dist/id-tutorial-BCr42Pnn.js +0 -13153
- package/dist/idOcr-CCjfWQvH.js +0 -94
- package/dist/incode-logo-DX016usY.js +0 -4
- package/dist/incodeComponent-C1o4M0ZK.js +0 -50
- package/dist/incodeModule-BqCjVgEI.js +0 -18
- package/dist/inputComposed-APSw8C7o.js +0 -89
- package/dist/inputComposed-XYrarFxS.js +0 -1
- package/dist/loadingIcon-BN5YRQUb.js +0 -104
- package/dist/mandatoryConsent-DssKMC3v.js +0 -100
- package/dist/modal-NMxsQHAO.js +0 -135
- package/dist/modal.hooks-CAjcIFZK.js +0 -126
- package/dist/numberedStep-CT-alrK5.js +0 -11
- package/dist/optionAccessibleLabel-CzEeX3Q4.js +0 -140
- package/dist/otpInput-DqRA_egd.js +0 -145
- package/dist/page-C1yT4DLb.js +0 -69
- package/dist/pdf-BurGZ08w.js +0 -14967
- package/dist/pdfViewer-BGBNL1Ea.js +0 -63
- package/dist/phoneInputComposed-bvWhGLFZ.js +0 -11206
- package/dist/processing-G_y3o32b.js +0 -6
- package/dist/radioGroupComposed-BbmvxmD2.js +0 -177
- package/dist/redirectToMobile-C3k1gloW.js +0 -1514
- package/dist/requiredLabelHint-BLwgqozE.js +0 -13
- package/dist/richText-DbJ5sl2n.js +0 -1973
- package/dist/rolldown-runtime-CYMK-g2i.js +0 -20
- package/dist/selfieTutorial-BgrlUMXP.js +0 -2677
- package/dist/snackbar-BDp8x7Cv.js +0 -14
- package/dist/spinner-B4dcie2T.js +0 -1
- package/dist/spinner-CKnjVHxw.js +0 -39
- package/dist/statusPage-CUI7ApcU.js +0 -28
- package/dist/successIcon-DbILeIz_.js +0 -28
- package/dist/tabs-DaPyP71c.js +0 -78
- package/dist/transitionSpinner-PIEPU2Vx.js +0 -17
- package/dist/types/cpf-ocr/styles.d.ts +0 -1
- package/dist/types/document-capture/styles.d.ts +0 -1
- package/dist/types/redirect-to-mobile/styles.d.ts +0 -1
- package/dist/typography-CxjaknHN.js +0 -28
- package/dist/uiConfig-CwpQ-IM6.js +0 -20
- package/dist/useModuleLoader-BFiVA41N.js +0 -432
- package/dist/vendor-preact-D6SntenC.js +0 -958
- package/dist/verificationResult-BrVbUJ4U.js +0 -97
- package/dist/verifiedByIncode-ChZBpqNy.js +0 -101
- package/dist/watchlistForBusiness-BcSNtHCV.js +0 -77
|
@@ -0,0 +1,3153 @@
|
|
|
1
|
+
import { t as preact_markup_module_default, v as u } from "./vendor-preact-DThS2ZQ_.js";
|
|
2
|
+
import { t as _defineProperty } from "./defineProperty-mefzVtTv.js";
|
|
3
|
+
//#region ../../node_modules/.pnpm/dompurify@3.3.3/node_modules/dompurify/dist/purify.es.mjs
|
|
4
|
+
/*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */
|
|
5
|
+
var { entries, setPrototypeOf, isFrozen, getPrototypeOf, getOwnPropertyDescriptor } = Object;
|
|
6
|
+
var { freeze, seal, create } = Object;
|
|
7
|
+
var { apply, construct } = typeof Reflect !== "undefined" && Reflect;
|
|
8
|
+
if (!freeze) freeze = function freeze(x) {
|
|
9
|
+
return x;
|
|
10
|
+
};
|
|
11
|
+
if (!seal) seal = function seal(x) {
|
|
12
|
+
return x;
|
|
13
|
+
};
|
|
14
|
+
if (!apply) apply = function apply(func, thisArg) {
|
|
15
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) args[_key - 2] = arguments[_key];
|
|
16
|
+
return func.apply(thisArg, args);
|
|
17
|
+
};
|
|
18
|
+
if (!construct) construct = function construct(Func) {
|
|
19
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) args[_key2 - 1] = arguments[_key2];
|
|
20
|
+
return new Func(...args);
|
|
21
|
+
};
|
|
22
|
+
var arrayForEach = unapply(Array.prototype.forEach);
|
|
23
|
+
var arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
|
|
24
|
+
var arrayPop = unapply(Array.prototype.pop);
|
|
25
|
+
var arrayPush = unapply(Array.prototype.push);
|
|
26
|
+
var arraySplice = unapply(Array.prototype.splice);
|
|
27
|
+
var stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
28
|
+
var stringToString = unapply(String.prototype.toString);
|
|
29
|
+
var stringMatch = unapply(String.prototype.match);
|
|
30
|
+
var stringReplace = unapply(String.prototype.replace);
|
|
31
|
+
var stringIndexOf = unapply(String.prototype.indexOf);
|
|
32
|
+
var stringTrim = unapply(String.prototype.trim);
|
|
33
|
+
var objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
|
|
34
|
+
var regExpTest = unapply(RegExp.prototype.test);
|
|
35
|
+
var typeErrorCreate = unconstruct(TypeError);
|
|
36
|
+
/**
|
|
37
|
+
* Creates a new function that calls the given function with a specified thisArg and arguments.
|
|
38
|
+
*
|
|
39
|
+
* @param func - The function to be wrapped and called.
|
|
40
|
+
* @returns A new function that calls the given function with a specified thisArg and arguments.
|
|
41
|
+
*/
|
|
42
|
+
function unapply(func) {
|
|
43
|
+
return function(thisArg) {
|
|
44
|
+
if (thisArg instanceof RegExp) thisArg.lastIndex = 0;
|
|
45
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) args[_key3 - 1] = arguments[_key3];
|
|
46
|
+
return apply(func, thisArg, args);
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Creates a new function that constructs an instance of the given constructor function with the provided arguments.
|
|
51
|
+
*
|
|
52
|
+
* @param func - The constructor function to be wrapped and called.
|
|
53
|
+
* @returns A new function that constructs an instance of the given constructor function with the provided arguments.
|
|
54
|
+
*/
|
|
55
|
+
function unconstruct(Func) {
|
|
56
|
+
return function() {
|
|
57
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) args[_key4] = arguments[_key4];
|
|
58
|
+
return construct(Func, args);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Add properties to a lookup table
|
|
63
|
+
*
|
|
64
|
+
* @param set - The set to which elements will be added.
|
|
65
|
+
* @param array - The array containing elements to be added to the set.
|
|
66
|
+
* @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.
|
|
67
|
+
* @returns The modified set with added elements.
|
|
68
|
+
*/
|
|
69
|
+
function addToSet(set, array) {
|
|
70
|
+
let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
|
|
71
|
+
if (setPrototypeOf) setPrototypeOf(set, null);
|
|
72
|
+
let l = array.length;
|
|
73
|
+
while (l--) {
|
|
74
|
+
let element = array[l];
|
|
75
|
+
if (typeof element === "string") {
|
|
76
|
+
const lcElement = transformCaseFunc(element);
|
|
77
|
+
if (lcElement !== element) {
|
|
78
|
+
if (!isFrozen(array)) array[l] = lcElement;
|
|
79
|
+
element = lcElement;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
set[element] = true;
|
|
83
|
+
}
|
|
84
|
+
return set;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Clean up an array to harden against CSPP
|
|
88
|
+
*
|
|
89
|
+
* @param array - The array to be cleaned.
|
|
90
|
+
* @returns The cleaned version of the array
|
|
91
|
+
*/
|
|
92
|
+
function cleanArray(array) {
|
|
93
|
+
for (let index = 0; index < array.length; index++) if (!objectHasOwnProperty(array, index)) array[index] = null;
|
|
94
|
+
return array;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Shallow clone an object
|
|
98
|
+
*
|
|
99
|
+
* @param object - The object to be cloned.
|
|
100
|
+
* @returns A new object that copies the original.
|
|
101
|
+
*/
|
|
102
|
+
function clone(object) {
|
|
103
|
+
const newObject = create(null);
|
|
104
|
+
for (const [property, value] of entries(object)) if (objectHasOwnProperty(object, property)) if (Array.isArray(value)) newObject[property] = cleanArray(value);
|
|
105
|
+
else if (value && typeof value === "object" && value.constructor === Object) newObject[property] = clone(value);
|
|
106
|
+
else newObject[property] = value;
|
|
107
|
+
return newObject;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* This method automatically checks if the prop is function or getter and behaves accordingly.
|
|
111
|
+
*
|
|
112
|
+
* @param object - The object to look up the getter function in its prototype chain.
|
|
113
|
+
* @param prop - The property name for which to find the getter function.
|
|
114
|
+
* @returns The getter function found in the prototype chain or a fallback function.
|
|
115
|
+
*/
|
|
116
|
+
function lookupGetter(object, prop) {
|
|
117
|
+
while (object !== null) {
|
|
118
|
+
const desc = getOwnPropertyDescriptor(object, prop);
|
|
119
|
+
if (desc) {
|
|
120
|
+
if (desc.get) return unapply(desc.get);
|
|
121
|
+
if (typeof desc.value === "function") return unapply(desc.value);
|
|
122
|
+
}
|
|
123
|
+
object = getPrototypeOf(object);
|
|
124
|
+
}
|
|
125
|
+
function fallbackValue() {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
return fallbackValue;
|
|
129
|
+
}
|
|
130
|
+
var html$1 = freeze([
|
|
131
|
+
"a",
|
|
132
|
+
"abbr",
|
|
133
|
+
"acronym",
|
|
134
|
+
"address",
|
|
135
|
+
"area",
|
|
136
|
+
"article",
|
|
137
|
+
"aside",
|
|
138
|
+
"audio",
|
|
139
|
+
"b",
|
|
140
|
+
"bdi",
|
|
141
|
+
"bdo",
|
|
142
|
+
"big",
|
|
143
|
+
"blink",
|
|
144
|
+
"blockquote",
|
|
145
|
+
"body",
|
|
146
|
+
"br",
|
|
147
|
+
"button",
|
|
148
|
+
"canvas",
|
|
149
|
+
"caption",
|
|
150
|
+
"center",
|
|
151
|
+
"cite",
|
|
152
|
+
"code",
|
|
153
|
+
"col",
|
|
154
|
+
"colgroup",
|
|
155
|
+
"content",
|
|
156
|
+
"data",
|
|
157
|
+
"datalist",
|
|
158
|
+
"dd",
|
|
159
|
+
"decorator",
|
|
160
|
+
"del",
|
|
161
|
+
"details",
|
|
162
|
+
"dfn",
|
|
163
|
+
"dialog",
|
|
164
|
+
"dir",
|
|
165
|
+
"div",
|
|
166
|
+
"dl",
|
|
167
|
+
"dt",
|
|
168
|
+
"element",
|
|
169
|
+
"em",
|
|
170
|
+
"fieldset",
|
|
171
|
+
"figcaption",
|
|
172
|
+
"figure",
|
|
173
|
+
"font",
|
|
174
|
+
"footer",
|
|
175
|
+
"form",
|
|
176
|
+
"h1",
|
|
177
|
+
"h2",
|
|
178
|
+
"h3",
|
|
179
|
+
"h4",
|
|
180
|
+
"h5",
|
|
181
|
+
"h6",
|
|
182
|
+
"head",
|
|
183
|
+
"header",
|
|
184
|
+
"hgroup",
|
|
185
|
+
"hr",
|
|
186
|
+
"html",
|
|
187
|
+
"i",
|
|
188
|
+
"img",
|
|
189
|
+
"input",
|
|
190
|
+
"ins",
|
|
191
|
+
"kbd",
|
|
192
|
+
"label",
|
|
193
|
+
"legend",
|
|
194
|
+
"li",
|
|
195
|
+
"main",
|
|
196
|
+
"map",
|
|
197
|
+
"mark",
|
|
198
|
+
"marquee",
|
|
199
|
+
"menu",
|
|
200
|
+
"menuitem",
|
|
201
|
+
"meter",
|
|
202
|
+
"nav",
|
|
203
|
+
"nobr",
|
|
204
|
+
"ol",
|
|
205
|
+
"optgroup",
|
|
206
|
+
"option",
|
|
207
|
+
"output",
|
|
208
|
+
"p",
|
|
209
|
+
"picture",
|
|
210
|
+
"pre",
|
|
211
|
+
"progress",
|
|
212
|
+
"q",
|
|
213
|
+
"rp",
|
|
214
|
+
"rt",
|
|
215
|
+
"ruby",
|
|
216
|
+
"s",
|
|
217
|
+
"samp",
|
|
218
|
+
"search",
|
|
219
|
+
"section",
|
|
220
|
+
"select",
|
|
221
|
+
"shadow",
|
|
222
|
+
"slot",
|
|
223
|
+
"small",
|
|
224
|
+
"source",
|
|
225
|
+
"spacer",
|
|
226
|
+
"span",
|
|
227
|
+
"strike",
|
|
228
|
+
"strong",
|
|
229
|
+
"style",
|
|
230
|
+
"sub",
|
|
231
|
+
"summary",
|
|
232
|
+
"sup",
|
|
233
|
+
"table",
|
|
234
|
+
"tbody",
|
|
235
|
+
"td",
|
|
236
|
+
"template",
|
|
237
|
+
"textarea",
|
|
238
|
+
"tfoot",
|
|
239
|
+
"th",
|
|
240
|
+
"thead",
|
|
241
|
+
"time",
|
|
242
|
+
"tr",
|
|
243
|
+
"track",
|
|
244
|
+
"tt",
|
|
245
|
+
"u",
|
|
246
|
+
"ul",
|
|
247
|
+
"var",
|
|
248
|
+
"video",
|
|
249
|
+
"wbr"
|
|
250
|
+
]);
|
|
251
|
+
var svg$1 = freeze([
|
|
252
|
+
"svg",
|
|
253
|
+
"a",
|
|
254
|
+
"altglyph",
|
|
255
|
+
"altglyphdef",
|
|
256
|
+
"altglyphitem",
|
|
257
|
+
"animatecolor",
|
|
258
|
+
"animatemotion",
|
|
259
|
+
"animatetransform",
|
|
260
|
+
"circle",
|
|
261
|
+
"clippath",
|
|
262
|
+
"defs",
|
|
263
|
+
"desc",
|
|
264
|
+
"ellipse",
|
|
265
|
+
"enterkeyhint",
|
|
266
|
+
"exportparts",
|
|
267
|
+
"filter",
|
|
268
|
+
"font",
|
|
269
|
+
"g",
|
|
270
|
+
"glyph",
|
|
271
|
+
"glyphref",
|
|
272
|
+
"hkern",
|
|
273
|
+
"image",
|
|
274
|
+
"inputmode",
|
|
275
|
+
"line",
|
|
276
|
+
"lineargradient",
|
|
277
|
+
"marker",
|
|
278
|
+
"mask",
|
|
279
|
+
"metadata",
|
|
280
|
+
"mpath",
|
|
281
|
+
"part",
|
|
282
|
+
"path",
|
|
283
|
+
"pattern",
|
|
284
|
+
"polygon",
|
|
285
|
+
"polyline",
|
|
286
|
+
"radialgradient",
|
|
287
|
+
"rect",
|
|
288
|
+
"stop",
|
|
289
|
+
"style",
|
|
290
|
+
"switch",
|
|
291
|
+
"symbol",
|
|
292
|
+
"text",
|
|
293
|
+
"textpath",
|
|
294
|
+
"title",
|
|
295
|
+
"tref",
|
|
296
|
+
"tspan",
|
|
297
|
+
"view",
|
|
298
|
+
"vkern"
|
|
299
|
+
]);
|
|
300
|
+
var svgFilters = freeze([
|
|
301
|
+
"feBlend",
|
|
302
|
+
"feColorMatrix",
|
|
303
|
+
"feComponentTransfer",
|
|
304
|
+
"feComposite",
|
|
305
|
+
"feConvolveMatrix",
|
|
306
|
+
"feDiffuseLighting",
|
|
307
|
+
"feDisplacementMap",
|
|
308
|
+
"feDistantLight",
|
|
309
|
+
"feDropShadow",
|
|
310
|
+
"feFlood",
|
|
311
|
+
"feFuncA",
|
|
312
|
+
"feFuncB",
|
|
313
|
+
"feFuncG",
|
|
314
|
+
"feFuncR",
|
|
315
|
+
"feGaussianBlur",
|
|
316
|
+
"feImage",
|
|
317
|
+
"feMerge",
|
|
318
|
+
"feMergeNode",
|
|
319
|
+
"feMorphology",
|
|
320
|
+
"feOffset",
|
|
321
|
+
"fePointLight",
|
|
322
|
+
"feSpecularLighting",
|
|
323
|
+
"feSpotLight",
|
|
324
|
+
"feTile",
|
|
325
|
+
"feTurbulence"
|
|
326
|
+
]);
|
|
327
|
+
var svgDisallowed = freeze([
|
|
328
|
+
"animate",
|
|
329
|
+
"color-profile",
|
|
330
|
+
"cursor",
|
|
331
|
+
"discard",
|
|
332
|
+
"font-face",
|
|
333
|
+
"font-face-format",
|
|
334
|
+
"font-face-name",
|
|
335
|
+
"font-face-src",
|
|
336
|
+
"font-face-uri",
|
|
337
|
+
"foreignobject",
|
|
338
|
+
"hatch",
|
|
339
|
+
"hatchpath",
|
|
340
|
+
"mesh",
|
|
341
|
+
"meshgradient",
|
|
342
|
+
"meshpatch",
|
|
343
|
+
"meshrow",
|
|
344
|
+
"missing-glyph",
|
|
345
|
+
"script",
|
|
346
|
+
"set",
|
|
347
|
+
"solidcolor",
|
|
348
|
+
"unknown",
|
|
349
|
+
"use"
|
|
350
|
+
]);
|
|
351
|
+
var mathMl$1 = freeze([
|
|
352
|
+
"math",
|
|
353
|
+
"menclose",
|
|
354
|
+
"merror",
|
|
355
|
+
"mfenced",
|
|
356
|
+
"mfrac",
|
|
357
|
+
"mglyph",
|
|
358
|
+
"mi",
|
|
359
|
+
"mlabeledtr",
|
|
360
|
+
"mmultiscripts",
|
|
361
|
+
"mn",
|
|
362
|
+
"mo",
|
|
363
|
+
"mover",
|
|
364
|
+
"mpadded",
|
|
365
|
+
"mphantom",
|
|
366
|
+
"mroot",
|
|
367
|
+
"mrow",
|
|
368
|
+
"ms",
|
|
369
|
+
"mspace",
|
|
370
|
+
"msqrt",
|
|
371
|
+
"mstyle",
|
|
372
|
+
"msub",
|
|
373
|
+
"msup",
|
|
374
|
+
"msubsup",
|
|
375
|
+
"mtable",
|
|
376
|
+
"mtd",
|
|
377
|
+
"mtext",
|
|
378
|
+
"mtr",
|
|
379
|
+
"munder",
|
|
380
|
+
"munderover",
|
|
381
|
+
"mprescripts"
|
|
382
|
+
]);
|
|
383
|
+
var mathMlDisallowed = freeze([
|
|
384
|
+
"maction",
|
|
385
|
+
"maligngroup",
|
|
386
|
+
"malignmark",
|
|
387
|
+
"mlongdiv",
|
|
388
|
+
"mscarries",
|
|
389
|
+
"mscarry",
|
|
390
|
+
"msgroup",
|
|
391
|
+
"mstack",
|
|
392
|
+
"msline",
|
|
393
|
+
"msrow",
|
|
394
|
+
"semantics",
|
|
395
|
+
"annotation",
|
|
396
|
+
"annotation-xml",
|
|
397
|
+
"mprescripts",
|
|
398
|
+
"none"
|
|
399
|
+
]);
|
|
400
|
+
var text = freeze(["#text"]);
|
|
401
|
+
var html = freeze([
|
|
402
|
+
"accept",
|
|
403
|
+
"action",
|
|
404
|
+
"align",
|
|
405
|
+
"alt",
|
|
406
|
+
"autocapitalize",
|
|
407
|
+
"autocomplete",
|
|
408
|
+
"autopictureinpicture",
|
|
409
|
+
"autoplay",
|
|
410
|
+
"background",
|
|
411
|
+
"bgcolor",
|
|
412
|
+
"border",
|
|
413
|
+
"capture",
|
|
414
|
+
"cellpadding",
|
|
415
|
+
"cellspacing",
|
|
416
|
+
"checked",
|
|
417
|
+
"cite",
|
|
418
|
+
"class",
|
|
419
|
+
"clear",
|
|
420
|
+
"color",
|
|
421
|
+
"cols",
|
|
422
|
+
"colspan",
|
|
423
|
+
"controls",
|
|
424
|
+
"controlslist",
|
|
425
|
+
"coords",
|
|
426
|
+
"crossorigin",
|
|
427
|
+
"datetime",
|
|
428
|
+
"decoding",
|
|
429
|
+
"default",
|
|
430
|
+
"dir",
|
|
431
|
+
"disabled",
|
|
432
|
+
"disablepictureinpicture",
|
|
433
|
+
"disableremoteplayback",
|
|
434
|
+
"download",
|
|
435
|
+
"draggable",
|
|
436
|
+
"enctype",
|
|
437
|
+
"enterkeyhint",
|
|
438
|
+
"exportparts",
|
|
439
|
+
"face",
|
|
440
|
+
"for",
|
|
441
|
+
"headers",
|
|
442
|
+
"height",
|
|
443
|
+
"hidden",
|
|
444
|
+
"high",
|
|
445
|
+
"href",
|
|
446
|
+
"hreflang",
|
|
447
|
+
"id",
|
|
448
|
+
"inert",
|
|
449
|
+
"inputmode",
|
|
450
|
+
"integrity",
|
|
451
|
+
"ismap",
|
|
452
|
+
"kind",
|
|
453
|
+
"label",
|
|
454
|
+
"lang",
|
|
455
|
+
"list",
|
|
456
|
+
"loading",
|
|
457
|
+
"loop",
|
|
458
|
+
"low",
|
|
459
|
+
"max",
|
|
460
|
+
"maxlength",
|
|
461
|
+
"media",
|
|
462
|
+
"method",
|
|
463
|
+
"min",
|
|
464
|
+
"minlength",
|
|
465
|
+
"multiple",
|
|
466
|
+
"muted",
|
|
467
|
+
"name",
|
|
468
|
+
"nonce",
|
|
469
|
+
"noshade",
|
|
470
|
+
"novalidate",
|
|
471
|
+
"nowrap",
|
|
472
|
+
"open",
|
|
473
|
+
"optimum",
|
|
474
|
+
"part",
|
|
475
|
+
"pattern",
|
|
476
|
+
"placeholder",
|
|
477
|
+
"playsinline",
|
|
478
|
+
"popover",
|
|
479
|
+
"popovertarget",
|
|
480
|
+
"popovertargetaction",
|
|
481
|
+
"poster",
|
|
482
|
+
"preload",
|
|
483
|
+
"pubdate",
|
|
484
|
+
"radiogroup",
|
|
485
|
+
"readonly",
|
|
486
|
+
"rel",
|
|
487
|
+
"required",
|
|
488
|
+
"rev",
|
|
489
|
+
"reversed",
|
|
490
|
+
"role",
|
|
491
|
+
"rows",
|
|
492
|
+
"rowspan",
|
|
493
|
+
"spellcheck",
|
|
494
|
+
"scope",
|
|
495
|
+
"selected",
|
|
496
|
+
"shape",
|
|
497
|
+
"size",
|
|
498
|
+
"sizes",
|
|
499
|
+
"slot",
|
|
500
|
+
"span",
|
|
501
|
+
"srclang",
|
|
502
|
+
"start",
|
|
503
|
+
"src",
|
|
504
|
+
"srcset",
|
|
505
|
+
"step",
|
|
506
|
+
"style",
|
|
507
|
+
"summary",
|
|
508
|
+
"tabindex",
|
|
509
|
+
"title",
|
|
510
|
+
"translate",
|
|
511
|
+
"type",
|
|
512
|
+
"usemap",
|
|
513
|
+
"valign",
|
|
514
|
+
"value",
|
|
515
|
+
"width",
|
|
516
|
+
"wrap",
|
|
517
|
+
"xmlns",
|
|
518
|
+
"slot"
|
|
519
|
+
]);
|
|
520
|
+
var svg = freeze([
|
|
521
|
+
"accent-height",
|
|
522
|
+
"accumulate",
|
|
523
|
+
"additive",
|
|
524
|
+
"alignment-baseline",
|
|
525
|
+
"amplitude",
|
|
526
|
+
"ascent",
|
|
527
|
+
"attributename",
|
|
528
|
+
"attributetype",
|
|
529
|
+
"azimuth",
|
|
530
|
+
"basefrequency",
|
|
531
|
+
"baseline-shift",
|
|
532
|
+
"begin",
|
|
533
|
+
"bias",
|
|
534
|
+
"by",
|
|
535
|
+
"class",
|
|
536
|
+
"clip",
|
|
537
|
+
"clippathunits",
|
|
538
|
+
"clip-path",
|
|
539
|
+
"clip-rule",
|
|
540
|
+
"color",
|
|
541
|
+
"color-interpolation",
|
|
542
|
+
"color-interpolation-filters",
|
|
543
|
+
"color-profile",
|
|
544
|
+
"color-rendering",
|
|
545
|
+
"cx",
|
|
546
|
+
"cy",
|
|
547
|
+
"d",
|
|
548
|
+
"dx",
|
|
549
|
+
"dy",
|
|
550
|
+
"diffuseconstant",
|
|
551
|
+
"direction",
|
|
552
|
+
"display",
|
|
553
|
+
"divisor",
|
|
554
|
+
"dur",
|
|
555
|
+
"edgemode",
|
|
556
|
+
"elevation",
|
|
557
|
+
"end",
|
|
558
|
+
"exponent",
|
|
559
|
+
"fill",
|
|
560
|
+
"fill-opacity",
|
|
561
|
+
"fill-rule",
|
|
562
|
+
"filter",
|
|
563
|
+
"filterunits",
|
|
564
|
+
"flood-color",
|
|
565
|
+
"flood-opacity",
|
|
566
|
+
"font-family",
|
|
567
|
+
"font-size",
|
|
568
|
+
"font-size-adjust",
|
|
569
|
+
"font-stretch",
|
|
570
|
+
"font-style",
|
|
571
|
+
"font-variant",
|
|
572
|
+
"font-weight",
|
|
573
|
+
"fx",
|
|
574
|
+
"fy",
|
|
575
|
+
"g1",
|
|
576
|
+
"g2",
|
|
577
|
+
"glyph-name",
|
|
578
|
+
"glyphref",
|
|
579
|
+
"gradientunits",
|
|
580
|
+
"gradienttransform",
|
|
581
|
+
"height",
|
|
582
|
+
"href",
|
|
583
|
+
"id",
|
|
584
|
+
"image-rendering",
|
|
585
|
+
"in",
|
|
586
|
+
"in2",
|
|
587
|
+
"intercept",
|
|
588
|
+
"k",
|
|
589
|
+
"k1",
|
|
590
|
+
"k2",
|
|
591
|
+
"k3",
|
|
592
|
+
"k4",
|
|
593
|
+
"kerning",
|
|
594
|
+
"keypoints",
|
|
595
|
+
"keysplines",
|
|
596
|
+
"keytimes",
|
|
597
|
+
"lang",
|
|
598
|
+
"lengthadjust",
|
|
599
|
+
"letter-spacing",
|
|
600
|
+
"kernelmatrix",
|
|
601
|
+
"kernelunitlength",
|
|
602
|
+
"lighting-color",
|
|
603
|
+
"local",
|
|
604
|
+
"marker-end",
|
|
605
|
+
"marker-mid",
|
|
606
|
+
"marker-start",
|
|
607
|
+
"markerheight",
|
|
608
|
+
"markerunits",
|
|
609
|
+
"markerwidth",
|
|
610
|
+
"maskcontentunits",
|
|
611
|
+
"maskunits",
|
|
612
|
+
"max",
|
|
613
|
+
"mask",
|
|
614
|
+
"mask-type",
|
|
615
|
+
"media",
|
|
616
|
+
"method",
|
|
617
|
+
"mode",
|
|
618
|
+
"min",
|
|
619
|
+
"name",
|
|
620
|
+
"numoctaves",
|
|
621
|
+
"offset",
|
|
622
|
+
"operator",
|
|
623
|
+
"opacity",
|
|
624
|
+
"order",
|
|
625
|
+
"orient",
|
|
626
|
+
"orientation",
|
|
627
|
+
"origin",
|
|
628
|
+
"overflow",
|
|
629
|
+
"paint-order",
|
|
630
|
+
"path",
|
|
631
|
+
"pathlength",
|
|
632
|
+
"patterncontentunits",
|
|
633
|
+
"patterntransform",
|
|
634
|
+
"patternunits",
|
|
635
|
+
"points",
|
|
636
|
+
"preservealpha",
|
|
637
|
+
"preserveaspectratio",
|
|
638
|
+
"primitiveunits",
|
|
639
|
+
"r",
|
|
640
|
+
"rx",
|
|
641
|
+
"ry",
|
|
642
|
+
"radius",
|
|
643
|
+
"refx",
|
|
644
|
+
"refy",
|
|
645
|
+
"repeatcount",
|
|
646
|
+
"repeatdur",
|
|
647
|
+
"restart",
|
|
648
|
+
"result",
|
|
649
|
+
"rotate",
|
|
650
|
+
"scale",
|
|
651
|
+
"seed",
|
|
652
|
+
"shape-rendering",
|
|
653
|
+
"slope",
|
|
654
|
+
"specularconstant",
|
|
655
|
+
"specularexponent",
|
|
656
|
+
"spreadmethod",
|
|
657
|
+
"startoffset",
|
|
658
|
+
"stddeviation",
|
|
659
|
+
"stitchtiles",
|
|
660
|
+
"stop-color",
|
|
661
|
+
"stop-opacity",
|
|
662
|
+
"stroke-dasharray",
|
|
663
|
+
"stroke-dashoffset",
|
|
664
|
+
"stroke-linecap",
|
|
665
|
+
"stroke-linejoin",
|
|
666
|
+
"stroke-miterlimit",
|
|
667
|
+
"stroke-opacity",
|
|
668
|
+
"stroke",
|
|
669
|
+
"stroke-width",
|
|
670
|
+
"style",
|
|
671
|
+
"surfacescale",
|
|
672
|
+
"systemlanguage",
|
|
673
|
+
"tabindex",
|
|
674
|
+
"tablevalues",
|
|
675
|
+
"targetx",
|
|
676
|
+
"targety",
|
|
677
|
+
"transform",
|
|
678
|
+
"transform-origin",
|
|
679
|
+
"text-anchor",
|
|
680
|
+
"text-decoration",
|
|
681
|
+
"text-rendering",
|
|
682
|
+
"textlength",
|
|
683
|
+
"type",
|
|
684
|
+
"u1",
|
|
685
|
+
"u2",
|
|
686
|
+
"unicode",
|
|
687
|
+
"values",
|
|
688
|
+
"viewbox",
|
|
689
|
+
"visibility",
|
|
690
|
+
"version",
|
|
691
|
+
"vert-adv-y",
|
|
692
|
+
"vert-origin-x",
|
|
693
|
+
"vert-origin-y",
|
|
694
|
+
"width",
|
|
695
|
+
"word-spacing",
|
|
696
|
+
"wrap",
|
|
697
|
+
"writing-mode",
|
|
698
|
+
"xchannelselector",
|
|
699
|
+
"ychannelselector",
|
|
700
|
+
"x",
|
|
701
|
+
"x1",
|
|
702
|
+
"x2",
|
|
703
|
+
"xmlns",
|
|
704
|
+
"y",
|
|
705
|
+
"y1",
|
|
706
|
+
"y2",
|
|
707
|
+
"z",
|
|
708
|
+
"zoomandpan"
|
|
709
|
+
]);
|
|
710
|
+
var mathMl = freeze([
|
|
711
|
+
"accent",
|
|
712
|
+
"accentunder",
|
|
713
|
+
"align",
|
|
714
|
+
"bevelled",
|
|
715
|
+
"close",
|
|
716
|
+
"columnsalign",
|
|
717
|
+
"columnlines",
|
|
718
|
+
"columnspan",
|
|
719
|
+
"denomalign",
|
|
720
|
+
"depth",
|
|
721
|
+
"dir",
|
|
722
|
+
"display",
|
|
723
|
+
"displaystyle",
|
|
724
|
+
"encoding",
|
|
725
|
+
"fence",
|
|
726
|
+
"frame",
|
|
727
|
+
"height",
|
|
728
|
+
"href",
|
|
729
|
+
"id",
|
|
730
|
+
"largeop",
|
|
731
|
+
"length",
|
|
732
|
+
"linethickness",
|
|
733
|
+
"lspace",
|
|
734
|
+
"lquote",
|
|
735
|
+
"mathbackground",
|
|
736
|
+
"mathcolor",
|
|
737
|
+
"mathsize",
|
|
738
|
+
"mathvariant",
|
|
739
|
+
"maxsize",
|
|
740
|
+
"minsize",
|
|
741
|
+
"movablelimits",
|
|
742
|
+
"notation",
|
|
743
|
+
"numalign",
|
|
744
|
+
"open",
|
|
745
|
+
"rowalign",
|
|
746
|
+
"rowlines",
|
|
747
|
+
"rowspacing",
|
|
748
|
+
"rowspan",
|
|
749
|
+
"rspace",
|
|
750
|
+
"rquote",
|
|
751
|
+
"scriptlevel",
|
|
752
|
+
"scriptminsize",
|
|
753
|
+
"scriptsizemultiplier",
|
|
754
|
+
"selection",
|
|
755
|
+
"separator",
|
|
756
|
+
"separators",
|
|
757
|
+
"stretchy",
|
|
758
|
+
"subscriptshift",
|
|
759
|
+
"supscriptshift",
|
|
760
|
+
"symmetric",
|
|
761
|
+
"voffset",
|
|
762
|
+
"width",
|
|
763
|
+
"xmlns"
|
|
764
|
+
]);
|
|
765
|
+
var xml = freeze([
|
|
766
|
+
"xlink:href",
|
|
767
|
+
"xml:id",
|
|
768
|
+
"xlink:title",
|
|
769
|
+
"xml:space",
|
|
770
|
+
"xmlns:xlink"
|
|
771
|
+
]);
|
|
772
|
+
var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm);
|
|
773
|
+
var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
|
|
774
|
+
var TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm);
|
|
775
|
+
var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
|
|
776
|
+
var ARIA_ATTR = seal(/^aria-[\-\w]+$/);
|
|
777
|
+
var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i);
|
|
778
|
+
var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
|
|
779
|
+
var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g);
|
|
780
|
+
var DOCTYPE_NAME = seal(/^html$/i);
|
|
781
|
+
var CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
782
|
+
var EXPRESSIONS = /* @__PURE__ */ Object.freeze({
|
|
783
|
+
__proto__: null,
|
|
784
|
+
ARIA_ATTR,
|
|
785
|
+
ATTR_WHITESPACE,
|
|
786
|
+
CUSTOM_ELEMENT,
|
|
787
|
+
DATA_ATTR,
|
|
788
|
+
DOCTYPE_NAME,
|
|
789
|
+
ERB_EXPR,
|
|
790
|
+
IS_ALLOWED_URI,
|
|
791
|
+
IS_SCRIPT_OR_DATA,
|
|
792
|
+
MUSTACHE_EXPR,
|
|
793
|
+
TMPLIT_EXPR
|
|
794
|
+
});
|
|
795
|
+
var NODE_TYPE = {
|
|
796
|
+
element: 1,
|
|
797
|
+
attribute: 2,
|
|
798
|
+
text: 3,
|
|
799
|
+
cdataSection: 4,
|
|
800
|
+
entityReference: 5,
|
|
801
|
+
entityNode: 6,
|
|
802
|
+
progressingInstruction: 7,
|
|
803
|
+
comment: 8,
|
|
804
|
+
document: 9,
|
|
805
|
+
documentType: 10,
|
|
806
|
+
documentFragment: 11,
|
|
807
|
+
notation: 12
|
|
808
|
+
};
|
|
809
|
+
var getGlobal = function getGlobal() {
|
|
810
|
+
return typeof window === "undefined" ? null : window;
|
|
811
|
+
};
|
|
812
|
+
/**
|
|
813
|
+
* Creates a no-op policy for internal use only.
|
|
814
|
+
* Don't export this function outside this module!
|
|
815
|
+
* @param trustedTypes The policy factory.
|
|
816
|
+
* @param purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
|
|
817
|
+
* @return The policy created (or null, if Trusted Types
|
|
818
|
+
* are not supported or creating the policy failed).
|
|
819
|
+
*/
|
|
820
|
+
var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
|
|
821
|
+
if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") return null;
|
|
822
|
+
let suffix = null;
|
|
823
|
+
const ATTR_NAME = "data-tt-policy-suffix";
|
|
824
|
+
if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) suffix = purifyHostElement.getAttribute(ATTR_NAME);
|
|
825
|
+
const policyName = "dompurify" + (suffix ? "#" + suffix : "");
|
|
826
|
+
try {
|
|
827
|
+
return trustedTypes.createPolicy(policyName, {
|
|
828
|
+
createHTML(html) {
|
|
829
|
+
return html;
|
|
830
|
+
},
|
|
831
|
+
createScriptURL(scriptUrl) {
|
|
832
|
+
return scriptUrl;
|
|
833
|
+
}
|
|
834
|
+
});
|
|
835
|
+
} catch (_) {
|
|
836
|
+
console.warn("TrustedTypes policy " + policyName + " could not be created.");
|
|
837
|
+
return null;
|
|
838
|
+
}
|
|
839
|
+
};
|
|
840
|
+
var _createHooksMap = function _createHooksMap() {
|
|
841
|
+
return {
|
|
842
|
+
afterSanitizeAttributes: [],
|
|
843
|
+
afterSanitizeElements: [],
|
|
844
|
+
afterSanitizeShadowDOM: [],
|
|
845
|
+
beforeSanitizeAttributes: [],
|
|
846
|
+
beforeSanitizeElements: [],
|
|
847
|
+
beforeSanitizeShadowDOM: [],
|
|
848
|
+
uponSanitizeAttribute: [],
|
|
849
|
+
uponSanitizeElement: [],
|
|
850
|
+
uponSanitizeShadowNode: []
|
|
851
|
+
};
|
|
852
|
+
};
|
|
853
|
+
function createDOMPurify() {
|
|
854
|
+
let window = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
|
|
855
|
+
const DOMPurify = (root) => createDOMPurify(root);
|
|
856
|
+
DOMPurify.version = "3.3.3";
|
|
857
|
+
DOMPurify.removed = [];
|
|
858
|
+
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
859
|
+
DOMPurify.isSupported = false;
|
|
860
|
+
return DOMPurify;
|
|
861
|
+
}
|
|
862
|
+
let { document } = window;
|
|
863
|
+
const originalDocument = document;
|
|
864
|
+
const currentScript = originalDocument.currentScript;
|
|
865
|
+
const { DocumentFragment, HTMLTemplateElement, Node, Element, NodeFilter, NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap, HTMLFormElement, DOMParser, trustedTypes } = window;
|
|
866
|
+
const ElementPrototype = Element.prototype;
|
|
867
|
+
const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
|
|
868
|
+
const remove = lookupGetter(ElementPrototype, "remove");
|
|
869
|
+
const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
|
|
870
|
+
const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
|
|
871
|
+
const getParentNode = lookupGetter(ElementPrototype, "parentNode");
|
|
872
|
+
if (typeof HTMLTemplateElement === "function") {
|
|
873
|
+
const template = document.createElement("template");
|
|
874
|
+
if (template.content && template.content.ownerDocument) document = template.content.ownerDocument;
|
|
875
|
+
}
|
|
876
|
+
let trustedTypesPolicy;
|
|
877
|
+
let emptyHTML = "";
|
|
878
|
+
const { implementation, createNodeIterator, createDocumentFragment, getElementsByTagName } = document;
|
|
879
|
+
const { importNode } = originalDocument;
|
|
880
|
+
let hooks = _createHooksMap();
|
|
881
|
+
/**
|
|
882
|
+
* Expose whether this browser supports running the full DOMPurify.
|
|
883
|
+
*/
|
|
884
|
+
DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
|
|
885
|
+
const { MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR, DATA_ATTR, ARIA_ATTR, IS_SCRIPT_OR_DATA, ATTR_WHITESPACE, CUSTOM_ELEMENT } = EXPRESSIONS;
|
|
886
|
+
let { IS_ALLOWED_URI: IS_ALLOWED_URI$1 } = EXPRESSIONS;
|
|
887
|
+
/**
|
|
888
|
+
* We consider the elements and attributes below to be safe. Ideally
|
|
889
|
+
* don't add any new ones but feel free to remove unwanted ones.
|
|
890
|
+
*/
|
|
891
|
+
let ALLOWED_TAGS = null;
|
|
892
|
+
const DEFAULT_ALLOWED_TAGS = addToSet({}, [
|
|
893
|
+
...html$1,
|
|
894
|
+
...svg$1,
|
|
895
|
+
...svgFilters,
|
|
896
|
+
...mathMl$1,
|
|
897
|
+
...text
|
|
898
|
+
]);
|
|
899
|
+
let ALLOWED_ATTR = null;
|
|
900
|
+
const DEFAULT_ALLOWED_ATTR = addToSet({}, [
|
|
901
|
+
...html,
|
|
902
|
+
...svg,
|
|
903
|
+
...mathMl,
|
|
904
|
+
...xml
|
|
905
|
+
]);
|
|
906
|
+
let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
|
|
907
|
+
tagNameCheck: {
|
|
908
|
+
writable: true,
|
|
909
|
+
configurable: false,
|
|
910
|
+
enumerable: true,
|
|
911
|
+
value: null
|
|
912
|
+
},
|
|
913
|
+
attributeNameCheck: {
|
|
914
|
+
writable: true,
|
|
915
|
+
configurable: false,
|
|
916
|
+
enumerable: true,
|
|
917
|
+
value: null
|
|
918
|
+
},
|
|
919
|
+
allowCustomizedBuiltInElements: {
|
|
920
|
+
writable: true,
|
|
921
|
+
configurable: false,
|
|
922
|
+
enumerable: true,
|
|
923
|
+
value: false
|
|
924
|
+
}
|
|
925
|
+
}));
|
|
926
|
+
let FORBID_TAGS = null;
|
|
927
|
+
let FORBID_ATTR = null;
|
|
928
|
+
const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
|
|
929
|
+
tagCheck: {
|
|
930
|
+
writable: true,
|
|
931
|
+
configurable: false,
|
|
932
|
+
enumerable: true,
|
|
933
|
+
value: null
|
|
934
|
+
},
|
|
935
|
+
attributeCheck: {
|
|
936
|
+
writable: true,
|
|
937
|
+
configurable: false,
|
|
938
|
+
enumerable: true,
|
|
939
|
+
value: null
|
|
940
|
+
}
|
|
941
|
+
}));
|
|
942
|
+
let ALLOW_ARIA_ATTR = true;
|
|
943
|
+
let ALLOW_DATA_ATTR = true;
|
|
944
|
+
let ALLOW_UNKNOWN_PROTOCOLS = false;
|
|
945
|
+
let ALLOW_SELF_CLOSE_IN_ATTR = true;
|
|
946
|
+
let SAFE_FOR_TEMPLATES = false;
|
|
947
|
+
let SAFE_FOR_XML = true;
|
|
948
|
+
let WHOLE_DOCUMENT = false;
|
|
949
|
+
let SET_CONFIG = false;
|
|
950
|
+
let FORCE_BODY = false;
|
|
951
|
+
let RETURN_DOM = false;
|
|
952
|
+
let RETURN_DOM_FRAGMENT = false;
|
|
953
|
+
let RETURN_TRUSTED_TYPE = false;
|
|
954
|
+
let SANITIZE_DOM = true;
|
|
955
|
+
let SANITIZE_NAMED_PROPS = false;
|
|
956
|
+
const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
|
|
957
|
+
let KEEP_CONTENT = true;
|
|
958
|
+
let IN_PLACE = false;
|
|
959
|
+
let USE_PROFILES = {};
|
|
960
|
+
let FORBID_CONTENTS = null;
|
|
961
|
+
const DEFAULT_FORBID_CONTENTS = addToSet({}, [
|
|
962
|
+
"annotation-xml",
|
|
963
|
+
"audio",
|
|
964
|
+
"colgroup",
|
|
965
|
+
"desc",
|
|
966
|
+
"foreignobject",
|
|
967
|
+
"head",
|
|
968
|
+
"iframe",
|
|
969
|
+
"math",
|
|
970
|
+
"mi",
|
|
971
|
+
"mn",
|
|
972
|
+
"mo",
|
|
973
|
+
"ms",
|
|
974
|
+
"mtext",
|
|
975
|
+
"noembed",
|
|
976
|
+
"noframes",
|
|
977
|
+
"noscript",
|
|
978
|
+
"plaintext",
|
|
979
|
+
"script",
|
|
980
|
+
"style",
|
|
981
|
+
"svg",
|
|
982
|
+
"template",
|
|
983
|
+
"thead",
|
|
984
|
+
"title",
|
|
985
|
+
"video",
|
|
986
|
+
"xmp"
|
|
987
|
+
]);
|
|
988
|
+
let DATA_URI_TAGS = null;
|
|
989
|
+
const DEFAULT_DATA_URI_TAGS = addToSet({}, [
|
|
990
|
+
"audio",
|
|
991
|
+
"video",
|
|
992
|
+
"img",
|
|
993
|
+
"source",
|
|
994
|
+
"image",
|
|
995
|
+
"track"
|
|
996
|
+
]);
|
|
997
|
+
let URI_SAFE_ATTRIBUTES = null;
|
|
998
|
+
const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, [
|
|
999
|
+
"alt",
|
|
1000
|
+
"class",
|
|
1001
|
+
"for",
|
|
1002
|
+
"id",
|
|
1003
|
+
"label",
|
|
1004
|
+
"name",
|
|
1005
|
+
"pattern",
|
|
1006
|
+
"placeholder",
|
|
1007
|
+
"role",
|
|
1008
|
+
"summary",
|
|
1009
|
+
"title",
|
|
1010
|
+
"value",
|
|
1011
|
+
"style",
|
|
1012
|
+
"xmlns"
|
|
1013
|
+
]);
|
|
1014
|
+
const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
|
|
1015
|
+
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
1016
|
+
const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
|
1017
|
+
let NAMESPACE = HTML_NAMESPACE;
|
|
1018
|
+
let IS_EMPTY_INPUT = false;
|
|
1019
|
+
let ALLOWED_NAMESPACES = null;
|
|
1020
|
+
const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [
|
|
1021
|
+
MATHML_NAMESPACE,
|
|
1022
|
+
SVG_NAMESPACE,
|
|
1023
|
+
HTML_NAMESPACE
|
|
1024
|
+
], stringToString);
|
|
1025
|
+
let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, [
|
|
1026
|
+
"mi",
|
|
1027
|
+
"mo",
|
|
1028
|
+
"mn",
|
|
1029
|
+
"ms",
|
|
1030
|
+
"mtext"
|
|
1031
|
+
]);
|
|
1032
|
+
let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]);
|
|
1033
|
+
const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [
|
|
1034
|
+
"title",
|
|
1035
|
+
"style",
|
|
1036
|
+
"font",
|
|
1037
|
+
"a",
|
|
1038
|
+
"script"
|
|
1039
|
+
]);
|
|
1040
|
+
let PARSER_MEDIA_TYPE = null;
|
|
1041
|
+
const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
|
|
1042
|
+
const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
|
|
1043
|
+
let transformCaseFunc = null;
|
|
1044
|
+
let CONFIG = null;
|
|
1045
|
+
const formElement = document.createElement("form");
|
|
1046
|
+
const isRegexOrFunction = function isRegexOrFunction(testValue) {
|
|
1047
|
+
return testValue instanceof RegExp || testValue instanceof Function;
|
|
1048
|
+
};
|
|
1049
|
+
/**
|
|
1050
|
+
* _parseConfig
|
|
1051
|
+
*
|
|
1052
|
+
* @param cfg optional config literal
|
|
1053
|
+
*/
|
|
1054
|
+
const _parseConfig = function _parseConfig() {
|
|
1055
|
+
let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1056
|
+
if (CONFIG && CONFIG === cfg) return;
|
|
1057
|
+
if (!cfg || typeof cfg !== "object") cfg = {};
|
|
1058
|
+
cfg = clone(cfg);
|
|
1059
|
+
PARSER_MEDIA_TYPE = SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
|
|
1060
|
+
transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
|
|
1061
|
+
ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
|
|
1062
|
+
ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
|
|
1063
|
+
ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
|
|
1064
|
+
URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
|
|
1065
|
+
DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
|
|
1066
|
+
FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
|
|
1067
|
+
FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
|
|
1068
|
+
FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
|
|
1069
|
+
USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES : false;
|
|
1070
|
+
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
|
|
1071
|
+
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
|
|
1072
|
+
ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
|
|
1073
|
+
ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
|
|
1074
|
+
SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
|
|
1075
|
+
SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
|
|
1076
|
+
WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
|
|
1077
|
+
RETURN_DOM = cfg.RETURN_DOM || false;
|
|
1078
|
+
RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
|
|
1079
|
+
RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
|
|
1080
|
+
FORCE_BODY = cfg.FORCE_BODY || false;
|
|
1081
|
+
SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
|
|
1082
|
+
SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
|
|
1083
|
+
KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
|
|
1084
|
+
IN_PLACE = cfg.IN_PLACE || false;
|
|
1085
|
+
IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
|
|
1086
|
+
NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
|
|
1087
|
+
MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
|
|
1088
|
+
HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
|
|
1089
|
+
CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
|
|
1090
|
+
if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
|
|
1091
|
+
if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
|
|
1092
|
+
if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
|
|
1093
|
+
if (SAFE_FOR_TEMPLATES) ALLOW_DATA_ATTR = false;
|
|
1094
|
+
if (RETURN_DOM_FRAGMENT) RETURN_DOM = true;
|
|
1095
|
+
if (USE_PROFILES) {
|
|
1096
|
+
ALLOWED_TAGS = addToSet({}, text);
|
|
1097
|
+
ALLOWED_ATTR = create(null);
|
|
1098
|
+
if (USE_PROFILES.html === true) {
|
|
1099
|
+
addToSet(ALLOWED_TAGS, html$1);
|
|
1100
|
+
addToSet(ALLOWED_ATTR, html);
|
|
1101
|
+
}
|
|
1102
|
+
if (USE_PROFILES.svg === true) {
|
|
1103
|
+
addToSet(ALLOWED_TAGS, svg$1);
|
|
1104
|
+
addToSet(ALLOWED_ATTR, svg);
|
|
1105
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
1106
|
+
}
|
|
1107
|
+
if (USE_PROFILES.svgFilters === true) {
|
|
1108
|
+
addToSet(ALLOWED_TAGS, svgFilters);
|
|
1109
|
+
addToSet(ALLOWED_ATTR, svg);
|
|
1110
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
1111
|
+
}
|
|
1112
|
+
if (USE_PROFILES.mathMl === true) {
|
|
1113
|
+
addToSet(ALLOWED_TAGS, mathMl$1);
|
|
1114
|
+
addToSet(ALLOWED_ATTR, mathMl);
|
|
1115
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
if (!objectHasOwnProperty(cfg, "ADD_TAGS")) EXTRA_ELEMENT_HANDLING.tagCheck = null;
|
|
1119
|
+
if (!objectHasOwnProperty(cfg, "ADD_ATTR")) EXTRA_ELEMENT_HANDLING.attributeCheck = null;
|
|
1120
|
+
if (cfg.ADD_TAGS) if (typeof cfg.ADD_TAGS === "function") EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
|
|
1121
|
+
else {
|
|
1122
|
+
if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
|
1123
|
+
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
|
|
1124
|
+
}
|
|
1125
|
+
if (cfg.ADD_ATTR) if (typeof cfg.ADD_ATTR === "function") EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
|
|
1126
|
+
else {
|
|
1127
|
+
if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
1128
|
+
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
|
1129
|
+
}
|
|
1130
|
+
if (cfg.ADD_URI_SAFE_ATTR) addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
|
|
1131
|
+
if (cfg.FORBID_CONTENTS) {
|
|
1132
|
+
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
1133
|
+
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
|
|
1134
|
+
}
|
|
1135
|
+
if (cfg.ADD_FORBID_CONTENTS) {
|
|
1136
|
+
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
1137
|
+
addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
|
|
1138
|
+
}
|
|
1139
|
+
if (KEEP_CONTENT) ALLOWED_TAGS["#text"] = true;
|
|
1140
|
+
if (WHOLE_DOCUMENT) addToSet(ALLOWED_TAGS, [
|
|
1141
|
+
"html",
|
|
1142
|
+
"head",
|
|
1143
|
+
"body"
|
|
1144
|
+
]);
|
|
1145
|
+
if (ALLOWED_TAGS.table) {
|
|
1146
|
+
addToSet(ALLOWED_TAGS, ["tbody"]);
|
|
1147
|
+
delete FORBID_TAGS.tbody;
|
|
1148
|
+
}
|
|
1149
|
+
if (cfg.TRUSTED_TYPES_POLICY) {
|
|
1150
|
+
if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
|
|
1151
|
+
if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
|
|
1152
|
+
trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
|
|
1153
|
+
emptyHTML = trustedTypesPolicy.createHTML("");
|
|
1154
|
+
} else {
|
|
1155
|
+
if (trustedTypesPolicy === void 0) trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
|
|
1156
|
+
if (trustedTypesPolicy !== null && typeof emptyHTML === "string") emptyHTML = trustedTypesPolicy.createHTML("");
|
|
1157
|
+
}
|
|
1158
|
+
if (freeze) freeze(cfg);
|
|
1159
|
+
CONFIG = cfg;
|
|
1160
|
+
};
|
|
1161
|
+
const ALL_SVG_TAGS = addToSet({}, [
|
|
1162
|
+
...svg$1,
|
|
1163
|
+
...svgFilters,
|
|
1164
|
+
...svgDisallowed
|
|
1165
|
+
]);
|
|
1166
|
+
const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
|
|
1167
|
+
/**
|
|
1168
|
+
* @param element a DOM element whose namespace is being checked
|
|
1169
|
+
* @returns Return false if the element has a
|
|
1170
|
+
* namespace that a spec-compliant parser would never
|
|
1171
|
+
* return. Return true otherwise.
|
|
1172
|
+
*/
|
|
1173
|
+
const _checkValidNamespace = function _checkValidNamespace(element) {
|
|
1174
|
+
let parent = getParentNode(element);
|
|
1175
|
+
if (!parent || !parent.tagName) parent = {
|
|
1176
|
+
namespaceURI: NAMESPACE,
|
|
1177
|
+
tagName: "template"
|
|
1178
|
+
};
|
|
1179
|
+
const tagName = stringToLowerCase(element.tagName);
|
|
1180
|
+
const parentTagName = stringToLowerCase(parent.tagName);
|
|
1181
|
+
if (!ALLOWED_NAMESPACES[element.namespaceURI]) return false;
|
|
1182
|
+
if (element.namespaceURI === SVG_NAMESPACE) {
|
|
1183
|
+
if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "svg";
|
|
1184
|
+
if (parent.namespaceURI === MATHML_NAMESPACE) return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
|
|
1185
|
+
return Boolean(ALL_SVG_TAGS[tagName]);
|
|
1186
|
+
}
|
|
1187
|
+
if (element.namespaceURI === MATHML_NAMESPACE) {
|
|
1188
|
+
if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "math";
|
|
1189
|
+
if (parent.namespaceURI === SVG_NAMESPACE) return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
|
|
1190
|
+
return Boolean(ALL_MATHML_TAGS[tagName]);
|
|
1191
|
+
}
|
|
1192
|
+
if (element.namespaceURI === HTML_NAMESPACE) {
|
|
1193
|
+
if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) return false;
|
|
1194
|
+
if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) return false;
|
|
1195
|
+
return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
|
|
1196
|
+
}
|
|
1197
|
+
if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) return true;
|
|
1198
|
+
return false;
|
|
1199
|
+
};
|
|
1200
|
+
/**
|
|
1201
|
+
* _forceRemove
|
|
1202
|
+
*
|
|
1203
|
+
* @param node a DOM node
|
|
1204
|
+
*/
|
|
1205
|
+
const _forceRemove = function _forceRemove(node) {
|
|
1206
|
+
arrayPush(DOMPurify.removed, { element: node });
|
|
1207
|
+
try {
|
|
1208
|
+
getParentNode(node).removeChild(node);
|
|
1209
|
+
} catch (_) {
|
|
1210
|
+
remove(node);
|
|
1211
|
+
}
|
|
1212
|
+
};
|
|
1213
|
+
/**
|
|
1214
|
+
* _removeAttribute
|
|
1215
|
+
*
|
|
1216
|
+
* @param name an Attribute name
|
|
1217
|
+
* @param element a DOM node
|
|
1218
|
+
*/
|
|
1219
|
+
const _removeAttribute = function _removeAttribute(name, element) {
|
|
1220
|
+
try {
|
|
1221
|
+
arrayPush(DOMPurify.removed, {
|
|
1222
|
+
attribute: element.getAttributeNode(name),
|
|
1223
|
+
from: element
|
|
1224
|
+
});
|
|
1225
|
+
} catch (_) {
|
|
1226
|
+
arrayPush(DOMPurify.removed, {
|
|
1227
|
+
attribute: null,
|
|
1228
|
+
from: element
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
element.removeAttribute(name);
|
|
1232
|
+
if (name === "is") if (RETURN_DOM || RETURN_DOM_FRAGMENT) try {
|
|
1233
|
+
_forceRemove(element);
|
|
1234
|
+
} catch (_) {}
|
|
1235
|
+
else try {
|
|
1236
|
+
element.setAttribute(name, "");
|
|
1237
|
+
} catch (_) {}
|
|
1238
|
+
};
|
|
1239
|
+
/**
|
|
1240
|
+
* _initDocument
|
|
1241
|
+
*
|
|
1242
|
+
* @param dirty - a string of dirty markup
|
|
1243
|
+
* @return a DOM, filled with the dirty markup
|
|
1244
|
+
*/
|
|
1245
|
+
const _initDocument = function _initDocument(dirty) {
|
|
1246
|
+
let doc = null;
|
|
1247
|
+
let leadingWhitespace = null;
|
|
1248
|
+
if (FORCE_BODY) dirty = "<remove></remove>" + dirty;
|
|
1249
|
+
else {
|
|
1250
|
+
const matches = stringMatch(dirty, /^[\r\n\t ]+/);
|
|
1251
|
+
leadingWhitespace = matches && matches[0];
|
|
1252
|
+
}
|
|
1253
|
+
if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) dirty = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + dirty + "</body></html>";
|
|
1254
|
+
const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
|
1255
|
+
if (NAMESPACE === HTML_NAMESPACE) try {
|
|
1256
|
+
doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
|
|
1257
|
+
} catch (_) {}
|
|
1258
|
+
if (!doc || !doc.documentElement) {
|
|
1259
|
+
doc = implementation.createDocument(NAMESPACE, "template", null);
|
|
1260
|
+
try {
|
|
1261
|
+
doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
|
|
1262
|
+
} catch (_) {}
|
|
1263
|
+
}
|
|
1264
|
+
const body = doc.body || doc.documentElement;
|
|
1265
|
+
if (dirty && leadingWhitespace) body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
|
|
1266
|
+
if (NAMESPACE === HTML_NAMESPACE) return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
|
|
1267
|
+
return WHOLE_DOCUMENT ? doc.documentElement : body;
|
|
1268
|
+
};
|
|
1269
|
+
/**
|
|
1270
|
+
* Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
|
|
1271
|
+
*
|
|
1272
|
+
* @param root The root element or node to start traversing on.
|
|
1273
|
+
* @return The created NodeIterator
|
|
1274
|
+
*/
|
|
1275
|
+
const _createNodeIterator = function _createNodeIterator(root) {
|
|
1276
|
+
return createNodeIterator.call(root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
|
|
1277
|
+
};
|
|
1278
|
+
/**
|
|
1279
|
+
* _isClobbered
|
|
1280
|
+
*
|
|
1281
|
+
* @param element element to check for clobbering attacks
|
|
1282
|
+
* @return true if clobbered, false if safe
|
|
1283
|
+
*/
|
|
1284
|
+
const _isClobbered = function _isClobbered(element) {
|
|
1285
|
+
return element instanceof HTMLFormElement && (typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function");
|
|
1286
|
+
};
|
|
1287
|
+
/**
|
|
1288
|
+
* Checks whether the given object is a DOM node.
|
|
1289
|
+
*
|
|
1290
|
+
* @param value object to check whether it's a DOM node
|
|
1291
|
+
* @return true is object is a DOM node
|
|
1292
|
+
*/
|
|
1293
|
+
const _isNode = function _isNode(value) {
|
|
1294
|
+
return typeof Node === "function" && value instanceof Node;
|
|
1295
|
+
};
|
|
1296
|
+
function _executeHooks(hooks, currentNode, data) {
|
|
1297
|
+
arrayForEach(hooks, (hook) => {
|
|
1298
|
+
hook.call(DOMPurify, currentNode, data, CONFIG);
|
|
1299
|
+
});
|
|
1300
|
+
}
|
|
1301
|
+
/**
|
|
1302
|
+
* _sanitizeElements
|
|
1303
|
+
*
|
|
1304
|
+
* @protect nodeName
|
|
1305
|
+
* @protect textContent
|
|
1306
|
+
* @protect removeChild
|
|
1307
|
+
* @param currentNode to check for permission to exist
|
|
1308
|
+
* @return true if node was killed, false if left alive
|
|
1309
|
+
*/
|
|
1310
|
+
const _sanitizeElements = function _sanitizeElements(currentNode) {
|
|
1311
|
+
let content = null;
|
|
1312
|
+
_executeHooks(hooks.beforeSanitizeElements, currentNode, null);
|
|
1313
|
+
if (_isClobbered(currentNode)) {
|
|
1314
|
+
_forceRemove(currentNode);
|
|
1315
|
+
return true;
|
|
1316
|
+
}
|
|
1317
|
+
const tagName = transformCaseFunc(currentNode.nodeName);
|
|
1318
|
+
_executeHooks(hooks.uponSanitizeElement, currentNode, {
|
|
1319
|
+
tagName,
|
|
1320
|
+
allowedTags: ALLOWED_TAGS
|
|
1321
|
+
});
|
|
1322
|
+
if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
|
|
1323
|
+
_forceRemove(currentNode);
|
|
1324
|
+
return true;
|
|
1325
|
+
}
|
|
1326
|
+
if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
|
|
1327
|
+
_forceRemove(currentNode);
|
|
1328
|
+
return true;
|
|
1329
|
+
}
|
|
1330
|
+
if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
|
|
1331
|
+
_forceRemove(currentNode);
|
|
1332
|
+
return true;
|
|
1333
|
+
}
|
|
1334
|
+
if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) {
|
|
1335
|
+
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
|
|
1336
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
|
|
1337
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
|
|
1338
|
+
}
|
|
1339
|
+
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
|
1340
|
+
const parentNode = getParentNode(currentNode) || currentNode.parentNode;
|
|
1341
|
+
const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
|
|
1342
|
+
if (childNodes && parentNode) {
|
|
1343
|
+
const childCount = childNodes.length;
|
|
1344
|
+
for (let i = childCount - 1; i >= 0; --i) {
|
|
1345
|
+
const childClone = cloneNode(childNodes[i], true);
|
|
1346
|
+
childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
|
|
1347
|
+
parentNode.insertBefore(childClone, getNextSibling(currentNode));
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
_forceRemove(currentNode);
|
|
1352
|
+
return true;
|
|
1353
|
+
}
|
|
1354
|
+
if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
|
|
1355
|
+
_forceRemove(currentNode);
|
|
1356
|
+
return true;
|
|
1357
|
+
}
|
|
1358
|
+
if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
|
|
1359
|
+
_forceRemove(currentNode);
|
|
1360
|
+
return true;
|
|
1361
|
+
}
|
|
1362
|
+
if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
|
|
1363
|
+
content = currentNode.textContent;
|
|
1364
|
+
arrayForEach([
|
|
1365
|
+
MUSTACHE_EXPR,
|
|
1366
|
+
ERB_EXPR,
|
|
1367
|
+
TMPLIT_EXPR
|
|
1368
|
+
], (expr) => {
|
|
1369
|
+
content = stringReplace(content, expr, " ");
|
|
1370
|
+
});
|
|
1371
|
+
if (currentNode.textContent !== content) {
|
|
1372
|
+
arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() });
|
|
1373
|
+
currentNode.textContent = content;
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
_executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
|
1377
|
+
return false;
|
|
1378
|
+
};
|
|
1379
|
+
/**
|
|
1380
|
+
* _isValidAttribute
|
|
1381
|
+
*
|
|
1382
|
+
* @param lcTag Lowercase tag name of containing element.
|
|
1383
|
+
* @param lcName Lowercase attribute name.
|
|
1384
|
+
* @param value Attribute value.
|
|
1385
|
+
* @return Returns true if `value` is valid, otherwise false.
|
|
1386
|
+
*/
|
|
1387
|
+
const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
|
|
1388
|
+
if (FORBID_ATTR[lcName]) return false;
|
|
1389
|
+
if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document || value in formElement)) return false;
|
|
1390
|
+
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName));
|
|
1391
|
+
else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName));
|
|
1392
|
+
else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag));
|
|
1393
|
+
else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) if (_isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) || 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)));
|
|
1394
|
+
else return false;
|
|
1395
|
+
else if (URI_SAFE_ATTRIBUTES[lcName]);
|
|
1396
|
+
else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, "")));
|
|
1397
|
+
else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]);
|
|
1398
|
+
else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, "")));
|
|
1399
|
+
else if (value) return false;
|
|
1400
|
+
return true;
|
|
1401
|
+
};
|
|
1402
|
+
/**
|
|
1403
|
+
* _isBasicCustomElement
|
|
1404
|
+
* checks if at least one dash is included in tagName, and it's not the first char
|
|
1405
|
+
* for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
|
|
1406
|
+
*
|
|
1407
|
+
* @param tagName name of the tag of the node to sanitize
|
|
1408
|
+
* @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
|
|
1409
|
+
*/
|
|
1410
|
+
const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
|
|
1411
|
+
return tagName !== "annotation-xml" && stringMatch(tagName, CUSTOM_ELEMENT);
|
|
1412
|
+
};
|
|
1413
|
+
/**
|
|
1414
|
+
* _sanitizeAttributes
|
|
1415
|
+
*
|
|
1416
|
+
* @protect attributes
|
|
1417
|
+
* @protect nodeName
|
|
1418
|
+
* @protect removeAttribute
|
|
1419
|
+
* @protect setAttribute
|
|
1420
|
+
*
|
|
1421
|
+
* @param currentNode to sanitize
|
|
1422
|
+
*/
|
|
1423
|
+
const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
|
|
1424
|
+
_executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
|
|
1425
|
+
const { attributes } = currentNode;
|
|
1426
|
+
if (!attributes || _isClobbered(currentNode)) return;
|
|
1427
|
+
const hookEvent = {
|
|
1428
|
+
attrName: "",
|
|
1429
|
+
attrValue: "",
|
|
1430
|
+
keepAttr: true,
|
|
1431
|
+
allowedAttributes: ALLOWED_ATTR,
|
|
1432
|
+
forceKeepAttr: void 0
|
|
1433
|
+
};
|
|
1434
|
+
let l = attributes.length;
|
|
1435
|
+
while (l--) {
|
|
1436
|
+
const { name, namespaceURI, value: attrValue } = attributes[l];
|
|
1437
|
+
const lcName = transformCaseFunc(name);
|
|
1438
|
+
const initValue = attrValue;
|
|
1439
|
+
let value = name === "value" ? initValue : stringTrim(initValue);
|
|
1440
|
+
hookEvent.attrName = lcName;
|
|
1441
|
+
hookEvent.attrValue = value;
|
|
1442
|
+
hookEvent.keepAttr = true;
|
|
1443
|
+
hookEvent.forceKeepAttr = void 0;
|
|
1444
|
+
_executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
|
|
1445
|
+
value = hookEvent.attrValue;
|
|
1446
|
+
if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name")) {
|
|
1447
|
+
_removeAttribute(name, currentNode);
|
|
1448
|
+
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
1449
|
+
}
|
|
1450
|
+
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
|
|
1451
|
+
_removeAttribute(name, currentNode);
|
|
1452
|
+
continue;
|
|
1453
|
+
}
|
|
1454
|
+
if (lcName === "attributename" && stringMatch(value, "href")) {
|
|
1455
|
+
_removeAttribute(name, currentNode);
|
|
1456
|
+
continue;
|
|
1457
|
+
}
|
|
1458
|
+
if (hookEvent.forceKeepAttr) continue;
|
|
1459
|
+
if (!hookEvent.keepAttr) {
|
|
1460
|
+
_removeAttribute(name, currentNode);
|
|
1461
|
+
continue;
|
|
1462
|
+
}
|
|
1463
|
+
if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
|
|
1464
|
+
_removeAttribute(name, currentNode);
|
|
1465
|
+
continue;
|
|
1466
|
+
}
|
|
1467
|
+
if (SAFE_FOR_TEMPLATES) arrayForEach([
|
|
1468
|
+
MUSTACHE_EXPR,
|
|
1469
|
+
ERB_EXPR,
|
|
1470
|
+
TMPLIT_EXPR
|
|
1471
|
+
], (expr) => {
|
|
1472
|
+
value = stringReplace(value, expr, " ");
|
|
1473
|
+
});
|
|
1474
|
+
const lcTag = transformCaseFunc(currentNode.nodeName);
|
|
1475
|
+
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
1476
|
+
_removeAttribute(name, currentNode);
|
|
1477
|
+
continue;
|
|
1478
|
+
}
|
|
1479
|
+
if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") if (namespaceURI);
|
|
1480
|
+
else switch (trustedTypes.getAttributeType(lcTag, lcName)) {
|
|
1481
|
+
case "TrustedHTML":
|
|
1482
|
+
value = trustedTypesPolicy.createHTML(value);
|
|
1483
|
+
break;
|
|
1484
|
+
case "TrustedScriptURL":
|
|
1485
|
+
value = trustedTypesPolicy.createScriptURL(value);
|
|
1486
|
+
break;
|
|
1487
|
+
}
|
|
1488
|
+
if (value !== initValue) try {
|
|
1489
|
+
if (namespaceURI) currentNode.setAttributeNS(namespaceURI, name, value);
|
|
1490
|
+
else currentNode.setAttribute(name, value);
|
|
1491
|
+
if (_isClobbered(currentNode)) _forceRemove(currentNode);
|
|
1492
|
+
else arrayPop(DOMPurify.removed);
|
|
1493
|
+
} catch (_) {
|
|
1494
|
+
_removeAttribute(name, currentNode);
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
_executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
|
|
1498
|
+
};
|
|
1499
|
+
/**
|
|
1500
|
+
* _sanitizeShadowDOM
|
|
1501
|
+
*
|
|
1502
|
+
* @param fragment to iterate over recursively
|
|
1503
|
+
*/
|
|
1504
|
+
const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
|
|
1505
|
+
let shadowNode = null;
|
|
1506
|
+
const shadowIterator = _createNodeIterator(fragment);
|
|
1507
|
+
_executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
|
|
1508
|
+
while (shadowNode = shadowIterator.nextNode()) {
|
|
1509
|
+
_executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
|
|
1510
|
+
_sanitizeElements(shadowNode);
|
|
1511
|
+
_sanitizeAttributes(shadowNode);
|
|
1512
|
+
if (shadowNode.content instanceof DocumentFragment) _sanitizeShadowDOM(shadowNode.content);
|
|
1513
|
+
}
|
|
1514
|
+
_executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
|
|
1515
|
+
};
|
|
1516
|
+
DOMPurify.sanitize = function(dirty) {
|
|
1517
|
+
let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1518
|
+
let body = null;
|
|
1519
|
+
let importedNode = null;
|
|
1520
|
+
let currentNode = null;
|
|
1521
|
+
let returnNode = null;
|
|
1522
|
+
IS_EMPTY_INPUT = !dirty;
|
|
1523
|
+
if (IS_EMPTY_INPUT) dirty = "<!-->";
|
|
1524
|
+
if (typeof dirty !== "string" && !_isNode(dirty)) if (typeof dirty.toString === "function") {
|
|
1525
|
+
dirty = dirty.toString();
|
|
1526
|
+
if (typeof dirty !== "string") throw typeErrorCreate("dirty is not a string, aborting");
|
|
1527
|
+
} else throw typeErrorCreate("toString is not a function");
|
|
1528
|
+
if (!DOMPurify.isSupported) return dirty;
|
|
1529
|
+
if (!SET_CONFIG) _parseConfig(cfg);
|
|
1530
|
+
DOMPurify.removed = [];
|
|
1531
|
+
if (typeof dirty === "string") IN_PLACE = false;
|
|
1532
|
+
if (IN_PLACE) {
|
|
1533
|
+
if (dirty.nodeName) {
|
|
1534
|
+
const tagName = transformCaseFunc(dirty.nodeName);
|
|
1535
|
+
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
|
|
1536
|
+
}
|
|
1537
|
+
} else if (dirty instanceof Node) {
|
|
1538
|
+
body = _initDocument("<!---->");
|
|
1539
|
+
importedNode = body.ownerDocument.importNode(dirty, true);
|
|
1540
|
+
if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") body = importedNode;
|
|
1541
|
+
else if (importedNode.nodeName === "HTML") body = importedNode;
|
|
1542
|
+
else body.appendChild(importedNode);
|
|
1543
|
+
} else {
|
|
1544
|
+
if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && dirty.indexOf("<") === -1) return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
|
1545
|
+
body = _initDocument(dirty);
|
|
1546
|
+
if (!body) return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
|
|
1547
|
+
}
|
|
1548
|
+
if (body && FORCE_BODY) _forceRemove(body.firstChild);
|
|
1549
|
+
const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
|
|
1550
|
+
while (currentNode = nodeIterator.nextNode()) {
|
|
1551
|
+
_sanitizeElements(currentNode);
|
|
1552
|
+
_sanitizeAttributes(currentNode);
|
|
1553
|
+
if (currentNode.content instanceof DocumentFragment) _sanitizeShadowDOM(currentNode.content);
|
|
1554
|
+
}
|
|
1555
|
+
if (IN_PLACE) return dirty;
|
|
1556
|
+
if (RETURN_DOM) {
|
|
1557
|
+
if (RETURN_DOM_FRAGMENT) {
|
|
1558
|
+
returnNode = createDocumentFragment.call(body.ownerDocument);
|
|
1559
|
+
while (body.firstChild) returnNode.appendChild(body.firstChild);
|
|
1560
|
+
} else returnNode = body;
|
|
1561
|
+
if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) returnNode = importNode.call(originalDocument, returnNode, true);
|
|
1562
|
+
return returnNode;
|
|
1563
|
+
}
|
|
1564
|
+
let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
|
|
1565
|
+
if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
|
|
1566
|
+
if (SAFE_FOR_TEMPLATES) arrayForEach([
|
|
1567
|
+
MUSTACHE_EXPR,
|
|
1568
|
+
ERB_EXPR,
|
|
1569
|
+
TMPLIT_EXPR
|
|
1570
|
+
], (expr) => {
|
|
1571
|
+
serializedHTML = stringReplace(serializedHTML, expr, " ");
|
|
1572
|
+
});
|
|
1573
|
+
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
|
|
1574
|
+
};
|
|
1575
|
+
DOMPurify.setConfig = function() {
|
|
1576
|
+
_parseConfig(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {});
|
|
1577
|
+
SET_CONFIG = true;
|
|
1578
|
+
};
|
|
1579
|
+
DOMPurify.clearConfig = function() {
|
|
1580
|
+
CONFIG = null;
|
|
1581
|
+
SET_CONFIG = false;
|
|
1582
|
+
};
|
|
1583
|
+
DOMPurify.isValidAttribute = function(tag, attr, value) {
|
|
1584
|
+
if (!CONFIG) _parseConfig({});
|
|
1585
|
+
return _isValidAttribute(transformCaseFunc(tag), transformCaseFunc(attr), value);
|
|
1586
|
+
};
|
|
1587
|
+
DOMPurify.addHook = function(entryPoint, hookFunction) {
|
|
1588
|
+
if (typeof hookFunction !== "function") return;
|
|
1589
|
+
arrayPush(hooks[entryPoint], hookFunction);
|
|
1590
|
+
};
|
|
1591
|
+
DOMPurify.removeHook = function(entryPoint, hookFunction) {
|
|
1592
|
+
if (hookFunction !== void 0) {
|
|
1593
|
+
const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
|
|
1594
|
+
return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0];
|
|
1595
|
+
}
|
|
1596
|
+
return arrayPop(hooks[entryPoint]);
|
|
1597
|
+
};
|
|
1598
|
+
DOMPurify.removeHooks = function(entryPoint) {
|
|
1599
|
+
hooks[entryPoint] = [];
|
|
1600
|
+
};
|
|
1601
|
+
DOMPurify.removeAllHooks = function() {
|
|
1602
|
+
hooks = _createHooksMap();
|
|
1603
|
+
};
|
|
1604
|
+
return DOMPurify;
|
|
1605
|
+
}
|
|
1606
|
+
var purify = createDOMPurify();
|
|
1607
|
+
//#endregion
|
|
1608
|
+
//#region ../../node_modules/.pnpm/marked@17.0.5/node_modules/marked/lib/marked.esm.js
|
|
1609
|
+
var _Class;
|
|
1610
|
+
/**
|
|
1611
|
+
* marked v17.0.5 - a markdown parser
|
|
1612
|
+
* Copyright (c) 2018-2026, MarkedJS. (MIT License)
|
|
1613
|
+
* Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|
|
1614
|
+
* https://github.com/markedjs/marked
|
|
1615
|
+
*/
|
|
1616
|
+
/**
|
|
1617
|
+
* DO NOT EDIT THIS FILE
|
|
1618
|
+
* The code in this file is generated from files in ./src/
|
|
1619
|
+
*/
|
|
1620
|
+
function M() {
|
|
1621
|
+
return {
|
|
1622
|
+
async: !1,
|
|
1623
|
+
breaks: !1,
|
|
1624
|
+
extensions: null,
|
|
1625
|
+
gfm: !0,
|
|
1626
|
+
hooks: null,
|
|
1627
|
+
pedantic: !1,
|
|
1628
|
+
renderer: null,
|
|
1629
|
+
silent: !1,
|
|
1630
|
+
tokenizer: null,
|
|
1631
|
+
walkTokens: null
|
|
1632
|
+
};
|
|
1633
|
+
}
|
|
1634
|
+
var T = M();
|
|
1635
|
+
function G(u) {
|
|
1636
|
+
T = u;
|
|
1637
|
+
}
|
|
1638
|
+
var _ = { exec: () => null };
|
|
1639
|
+
function k(u, e = "") {
|
|
1640
|
+
let t = typeof u == "string" ? u : u.source, n = {
|
|
1641
|
+
replace: (r, i) => {
|
|
1642
|
+
let s = typeof i == "string" ? i : i.source;
|
|
1643
|
+
return s = s.replace(m.caret, "$1"), t = t.replace(r, s), n;
|
|
1644
|
+
},
|
|
1645
|
+
getRegex: () => new RegExp(t, e)
|
|
1646
|
+
};
|
|
1647
|
+
return n;
|
|
1648
|
+
}
|
|
1649
|
+
var be = (() => {
|
|
1650
|
+
try {
|
|
1651
|
+
return true;
|
|
1652
|
+
} catch {
|
|
1653
|
+
return !1;
|
|
1654
|
+
}
|
|
1655
|
+
})(), m = {
|
|
1656
|
+
codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
|
|
1657
|
+
outputLinkReplace: /\\([\[\]])/g,
|
|
1658
|
+
indentCodeCompensation: /^(\s+)(?:```)/,
|
|
1659
|
+
beginningSpace: /^\s+/,
|
|
1660
|
+
endingHash: /#$/,
|
|
1661
|
+
startingSpaceChar: /^ /,
|
|
1662
|
+
endingSpaceChar: / $/,
|
|
1663
|
+
nonSpaceChar: /[^ ]/,
|
|
1664
|
+
newLineCharGlobal: /\n/g,
|
|
1665
|
+
tabCharGlobal: /\t/g,
|
|
1666
|
+
multipleSpaceGlobal: /\s+/g,
|
|
1667
|
+
blankLine: /^[ \t]*$/,
|
|
1668
|
+
doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
|
|
1669
|
+
blockquoteStart: /^ {0,3}>/,
|
|
1670
|
+
blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
|
|
1671
|
+
blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
|
|
1672
|
+
listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
|
|
1673
|
+
listIsTask: /^\[[ xX]\] +\S/,
|
|
1674
|
+
listReplaceTask: /^\[[ xX]\] +/,
|
|
1675
|
+
listTaskCheckbox: /\[[ xX]\]/,
|
|
1676
|
+
anyLine: /\n.*\n/,
|
|
1677
|
+
hrefBrackets: /^<(.*)>$/,
|
|
1678
|
+
tableDelimiter: /[:|]/,
|
|
1679
|
+
tableAlignChars: /^\||\| *$/g,
|
|
1680
|
+
tableRowBlankLine: /\n[ \t]*$/,
|
|
1681
|
+
tableAlignRight: /^ *-+: *$/,
|
|
1682
|
+
tableAlignCenter: /^ *:-+: *$/,
|
|
1683
|
+
tableAlignLeft: /^ *:-+ *$/,
|
|
1684
|
+
startATag: /^<a /i,
|
|
1685
|
+
endATag: /^<\/a>/i,
|
|
1686
|
+
startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
|
|
1687
|
+
endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
|
|
1688
|
+
startAngleBracket: /^</,
|
|
1689
|
+
endAngleBracket: />$/,
|
|
1690
|
+
pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
|
|
1691
|
+
unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
|
|
1692
|
+
escapeTest: /[&<>"']/,
|
|
1693
|
+
escapeReplace: /[&<>"']/g,
|
|
1694
|
+
escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
|
|
1695
|
+
escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
|
|
1696
|
+
caret: /(^|[^\[])\^/g,
|
|
1697
|
+
percentDecode: /%25/g,
|
|
1698
|
+
findPipe: /\|/g,
|
|
1699
|
+
splitPipe: / \|/,
|
|
1700
|
+
slashPipe: /\\\|/g,
|
|
1701
|
+
carriageReturn: /\r\n|\r/g,
|
|
1702
|
+
spaceLine: /^ +$/gm,
|
|
1703
|
+
notSpaceStart: /^\S*/,
|
|
1704
|
+
endingNewline: /\n$/,
|
|
1705
|
+
listItemRegex: (u) => new RegExp(`^( {0,3}${u})((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
1706
|
+
nextBulletRegex: (u) => new RegExp(`^ {0,${Math.min(3, u - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
1707
|
+
hrRegex: (u) => new RegExp(`^ {0,${Math.min(3, u - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
|
|
1708
|
+
fencesBeginRegex: (u) => new RegExp(`^ {0,${Math.min(3, u - 1)}}(?:\`\`\`|~~~)`),
|
|
1709
|
+
headingBeginRegex: (u) => new RegExp(`^ {0,${Math.min(3, u - 1)}}#`),
|
|
1710
|
+
htmlBeginRegex: (u) => new RegExp(`^ {0,${Math.min(3, u - 1)}}<(?:[a-z].*>|!--)`, "i"),
|
|
1711
|
+
blockquoteBeginRegex: (u) => new RegExp(`^ {0,${Math.min(3, u - 1)}}>`)
|
|
1712
|
+
}, Re = /^(?:[ \t]*(?:\n|$))+/, Te = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Oe = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, C = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, we = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Q = / {0,3}(?:[*+-]|\d{1,9}[.)])/, se = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, ie = k(se).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), ye = k(se).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), j = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Pe = /^[^\n]+/, F = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Se = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", F).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), $e = k(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Q).getRegex(), v = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, _e = k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", U).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), oe = k(j).replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), K = {
|
|
1713
|
+
blockquote: k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", oe).getRegex(),
|
|
1714
|
+
code: Te,
|
|
1715
|
+
def: Se,
|
|
1716
|
+
fences: Oe,
|
|
1717
|
+
heading: we,
|
|
1718
|
+
hr: C,
|
|
1719
|
+
html: _e,
|
|
1720
|
+
lheading: ie,
|
|
1721
|
+
list: $e,
|
|
1722
|
+
newline: Re,
|
|
1723
|
+
paragraph: oe,
|
|
1724
|
+
table: _,
|
|
1725
|
+
text: Pe
|
|
1726
|
+
}, ne = k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), Me = {
|
|
1727
|
+
...K,
|
|
1728
|
+
lheading: ye,
|
|
1729
|
+
table: ne,
|
|
1730
|
+
paragraph: k(j).replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ne).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex()
|
|
1731
|
+
}, ze = {
|
|
1732
|
+
...K,
|
|
1733
|
+
html: k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", U).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
|
|
1734
|
+
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
1735
|
+
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
1736
|
+
fences: _,
|
|
1737
|
+
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
1738
|
+
paragraph: k(j).replace("hr", C).replace("heading", ` *#{1,6} *[^
|
|
1739
|
+
]`).replace("lheading", ie).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
1740
|
+
}, Ee = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ie = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ae = /^( {2,}|\\)\n(?!\s*$)/, Ae = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, z = /[\p{P}\p{S}]/u, H = /[\s\p{P}\p{S}]/u, W = /[^\s\p{P}\p{S}]/u, Ce = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, H).getRegex(), le = /(?!~)[\p{P}\p{S}]/u, Be = /(?!~)[\s\p{P}\p{S}]/u, De = /(?:[^\s\p{P}\p{S}]|~)/u, qe = k(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", be ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), ue = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, ve = k(ue, "u").replace(/punct/g, z).getRegex(), He = k(ue, "u").replace(/punct/g, le).getRegex(), pe = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ze = k(pe, "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H).replace(/punct/g, z).getRegex(), Ge = k(pe, "gu").replace(/notPunctSpace/g, De).replace(/punctSpace/g, Be).replace(/punct/g, le).getRegex(), Ne = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H).replace(/punct/g, z).getRegex(), Qe = k(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, z).getRegex(), Fe = k("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, H).replace(/punct/g, z).getRegex(), Ue = k(/\\(punct)/, "gu").replace(/punct/g, z).getRegex(), Ke = k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), We = k(U).replace("(?:-->|$)", "-->").getRegex(), Xe = k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", We).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Je = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ce = k(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", F).getRegex(), he = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", F).getRegex(), Ve = k("reflink|nolink(?!\\()", "g").replace("reflink", ce).replace("nolink", he).getRegex(), re = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, X = {
|
|
1741
|
+
_backpedal: _,
|
|
1742
|
+
anyPunctuation: Ue,
|
|
1743
|
+
autolink: Ke,
|
|
1744
|
+
blockSkip: qe,
|
|
1745
|
+
br: ae,
|
|
1746
|
+
code: Ie,
|
|
1747
|
+
del: _,
|
|
1748
|
+
delLDelim: _,
|
|
1749
|
+
delRDelim: _,
|
|
1750
|
+
emStrongLDelim: ve,
|
|
1751
|
+
emStrongRDelimAst: Ze,
|
|
1752
|
+
emStrongRDelimUnd: Ne,
|
|
1753
|
+
escape: Ee,
|
|
1754
|
+
link: Je,
|
|
1755
|
+
nolink: he,
|
|
1756
|
+
punctuation: Ce,
|
|
1757
|
+
reflink: ce,
|
|
1758
|
+
reflinkSearch: Ve,
|
|
1759
|
+
tag: Xe,
|
|
1760
|
+
text: Ae,
|
|
1761
|
+
url: _
|
|
1762
|
+
}, Ye = {
|
|
1763
|
+
...X,
|
|
1764
|
+
link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(),
|
|
1765
|
+
reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex()
|
|
1766
|
+
}, N = {
|
|
1767
|
+
...X,
|
|
1768
|
+
emStrongRDelimAst: Ge,
|
|
1769
|
+
emStrongLDelim: He,
|
|
1770
|
+
delLDelim: Qe,
|
|
1771
|
+
delRDelim: Fe,
|
|
1772
|
+
url: k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", re).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
1773
|
+
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
1774
|
+
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
1775
|
+
text: k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", re).getRegex()
|
|
1776
|
+
}, et = {
|
|
1777
|
+
...N,
|
|
1778
|
+
br: k(ae).replace("{2,}", "*").getRegex(),
|
|
1779
|
+
text: k(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
1780
|
+
}, B = {
|
|
1781
|
+
normal: K,
|
|
1782
|
+
gfm: Me,
|
|
1783
|
+
pedantic: ze
|
|
1784
|
+
}, E = {
|
|
1785
|
+
normal: X,
|
|
1786
|
+
gfm: N,
|
|
1787
|
+
breaks: et,
|
|
1788
|
+
pedantic: Ye
|
|
1789
|
+
};
|
|
1790
|
+
var tt = {
|
|
1791
|
+
"&": "&",
|
|
1792
|
+
"<": "<",
|
|
1793
|
+
">": ">",
|
|
1794
|
+
"\"": """,
|
|
1795
|
+
"'": "'"
|
|
1796
|
+
}, ke = (u) => tt[u];
|
|
1797
|
+
function O(u, e) {
|
|
1798
|
+
if (e) {
|
|
1799
|
+
if (m.escapeTest.test(u)) return u.replace(m.escapeReplace, ke);
|
|
1800
|
+
} else if (m.escapeTestNoEncode.test(u)) return u.replace(m.escapeReplaceNoEncode, ke);
|
|
1801
|
+
return u;
|
|
1802
|
+
}
|
|
1803
|
+
function J(u) {
|
|
1804
|
+
try {
|
|
1805
|
+
u = encodeURI(u).replace(m.percentDecode, "%");
|
|
1806
|
+
} catch {
|
|
1807
|
+
return null;
|
|
1808
|
+
}
|
|
1809
|
+
return u;
|
|
1810
|
+
}
|
|
1811
|
+
function V(u, e) {
|
|
1812
|
+
let n = u.replace(m.findPipe, (i, s, a) => {
|
|
1813
|
+
let o = !1, l = s;
|
|
1814
|
+
for (; --l >= 0 && a[l] === "\\";) o = !o;
|
|
1815
|
+
return o ? "|" : " |";
|
|
1816
|
+
}).split(m.splitPipe), r = 0;
|
|
1817
|
+
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e) if (n.length > e) n.splice(e);
|
|
1818
|
+
else for (; n.length < e;) n.push("");
|
|
1819
|
+
for (; r < n.length; r++) n[r] = n[r].trim().replace(m.slashPipe, "|");
|
|
1820
|
+
return n;
|
|
1821
|
+
}
|
|
1822
|
+
function I(u, e, t) {
|
|
1823
|
+
let n = u.length;
|
|
1824
|
+
if (n === 0) return "";
|
|
1825
|
+
let r = 0;
|
|
1826
|
+
for (; r < n;) {
|
|
1827
|
+
let i = u.charAt(n - r - 1);
|
|
1828
|
+
if (i === e && !t) r++;
|
|
1829
|
+
else if (i !== e && t) r++;
|
|
1830
|
+
else break;
|
|
1831
|
+
}
|
|
1832
|
+
return u.slice(0, n - r);
|
|
1833
|
+
}
|
|
1834
|
+
function de(u, e) {
|
|
1835
|
+
if (u.indexOf(e[1]) === -1) return -1;
|
|
1836
|
+
let t = 0;
|
|
1837
|
+
for (let n = 0; n < u.length; n++) if (u[n] === "\\") n++;
|
|
1838
|
+
else if (u[n] === e[0]) t++;
|
|
1839
|
+
else if (u[n] === e[1] && (t--, t < 0)) return n;
|
|
1840
|
+
return t > 0 ? -2 : -1;
|
|
1841
|
+
}
|
|
1842
|
+
function ge(u, e = 0) {
|
|
1843
|
+
let t = e, n = "";
|
|
1844
|
+
for (let r of u) if (r === " ") {
|
|
1845
|
+
let i = 4 - t % 4;
|
|
1846
|
+
n += " ".repeat(i), t += i;
|
|
1847
|
+
} else n += r, t++;
|
|
1848
|
+
return n;
|
|
1849
|
+
}
|
|
1850
|
+
function fe(u, e, t, n, r) {
|
|
1851
|
+
let i = e.href, s = e.title || null, a = u[1].replace(r.other.outputLinkReplace, "$1");
|
|
1852
|
+
n.state.inLink = !0;
|
|
1853
|
+
let o = {
|
|
1854
|
+
type: u[0].charAt(0) === "!" ? "image" : "link",
|
|
1855
|
+
raw: t,
|
|
1856
|
+
href: i,
|
|
1857
|
+
title: s,
|
|
1858
|
+
text: a,
|
|
1859
|
+
tokens: n.inlineTokens(a)
|
|
1860
|
+
};
|
|
1861
|
+
return n.state.inLink = !1, o;
|
|
1862
|
+
}
|
|
1863
|
+
function nt(u, e, t) {
|
|
1864
|
+
let n = u.match(t.other.indentCodeCompensation);
|
|
1865
|
+
if (n === null) return e;
|
|
1866
|
+
let r = n[1];
|
|
1867
|
+
return e.split(`
|
|
1868
|
+
`).map((i) => {
|
|
1869
|
+
let s = i.match(t.other.beginningSpace);
|
|
1870
|
+
if (s === null) return i;
|
|
1871
|
+
let [a] = s;
|
|
1872
|
+
return a.length >= r.length ? i.slice(r.length) : i;
|
|
1873
|
+
}).join(`
|
|
1874
|
+
`);
|
|
1875
|
+
}
|
|
1876
|
+
var w = class {
|
|
1877
|
+
constructor(e) {
|
|
1878
|
+
_defineProperty(this, "options", void 0);
|
|
1879
|
+
_defineProperty(this, "rules", void 0);
|
|
1880
|
+
_defineProperty(this, "lexer", void 0);
|
|
1881
|
+
this.options = e || T;
|
|
1882
|
+
}
|
|
1883
|
+
space(e) {
|
|
1884
|
+
let t = this.rules.block.newline.exec(e);
|
|
1885
|
+
if (t && t[0].length > 0) return {
|
|
1886
|
+
type: "space",
|
|
1887
|
+
raw: t[0]
|
|
1888
|
+
};
|
|
1889
|
+
}
|
|
1890
|
+
code(e) {
|
|
1891
|
+
let t = this.rules.block.code.exec(e);
|
|
1892
|
+
if (t) {
|
|
1893
|
+
let n = t[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
1894
|
+
return {
|
|
1895
|
+
type: "code",
|
|
1896
|
+
raw: t[0],
|
|
1897
|
+
codeBlockStyle: "indented",
|
|
1898
|
+
text: this.options.pedantic ? n : I(n, `
|
|
1899
|
+
`)
|
|
1900
|
+
};
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
fences(e) {
|
|
1904
|
+
let t = this.rules.block.fences.exec(e);
|
|
1905
|
+
if (t) {
|
|
1906
|
+
let n = t[0], r = nt(n, t[3] || "", this.rules);
|
|
1907
|
+
return {
|
|
1908
|
+
type: "code",
|
|
1909
|
+
raw: n,
|
|
1910
|
+
lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
|
|
1911
|
+
text: r
|
|
1912
|
+
};
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
heading(e) {
|
|
1916
|
+
let t = this.rules.block.heading.exec(e);
|
|
1917
|
+
if (t) {
|
|
1918
|
+
let n = t[2].trim();
|
|
1919
|
+
if (this.rules.other.endingHash.test(n)) {
|
|
1920
|
+
let r = I(n, "#");
|
|
1921
|
+
(this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (n = r.trim());
|
|
1922
|
+
}
|
|
1923
|
+
return {
|
|
1924
|
+
type: "heading",
|
|
1925
|
+
raw: t[0],
|
|
1926
|
+
depth: t[1].length,
|
|
1927
|
+
text: n,
|
|
1928
|
+
tokens: this.lexer.inline(n)
|
|
1929
|
+
};
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
hr(e) {
|
|
1933
|
+
let t = this.rules.block.hr.exec(e);
|
|
1934
|
+
if (t) return {
|
|
1935
|
+
type: "hr",
|
|
1936
|
+
raw: I(t[0], `
|
|
1937
|
+
`)
|
|
1938
|
+
};
|
|
1939
|
+
}
|
|
1940
|
+
blockquote(e) {
|
|
1941
|
+
let t = this.rules.block.blockquote.exec(e);
|
|
1942
|
+
if (t) {
|
|
1943
|
+
let n = I(t[0], `
|
|
1944
|
+
`).split(`
|
|
1945
|
+
`), r = "", i = "", s = [];
|
|
1946
|
+
for (; n.length > 0;) {
|
|
1947
|
+
let a = !1, o = [], l;
|
|
1948
|
+
for (l = 0; l < n.length; l++) if (this.rules.other.blockquoteStart.test(n[l])) o.push(n[l]), a = !0;
|
|
1949
|
+
else if (!a) o.push(n[l]);
|
|
1950
|
+
else break;
|
|
1951
|
+
n = n.slice(l);
|
|
1952
|
+
let p = o.join(`
|
|
1953
|
+
`), c = p.replace(this.rules.other.blockquoteSetextReplace, `
|
|
1954
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
1955
|
+
r = r ? `${r}
|
|
1956
|
+
${p}` : p, i = i ? `${i}
|
|
1957
|
+
${c}` : c;
|
|
1958
|
+
let d = this.lexer.state.top;
|
|
1959
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(c, s, !0), this.lexer.state.top = d, n.length === 0) break;
|
|
1960
|
+
let h = s.at(-1);
|
|
1961
|
+
if (h?.type === "code") break;
|
|
1962
|
+
if (h?.type === "blockquote") {
|
|
1963
|
+
let R = h, f = R.raw + `
|
|
1964
|
+
` + n.join(`
|
|
1965
|
+
`), S = this.blockquote(f);
|
|
1966
|
+
s[s.length - 1] = S, r = r.substring(0, r.length - R.raw.length) + S.raw, i = i.substring(0, i.length - R.text.length) + S.text;
|
|
1967
|
+
break;
|
|
1968
|
+
} else if (h?.type === "list") {
|
|
1969
|
+
let R = h, f = R.raw + `
|
|
1970
|
+
` + n.join(`
|
|
1971
|
+
`), S = this.list(f);
|
|
1972
|
+
s[s.length - 1] = S, r = r.substring(0, r.length - h.raw.length) + S.raw, i = i.substring(0, i.length - R.raw.length) + S.raw, n = f.substring(s.at(-1).raw.length).split(`
|
|
1973
|
+
`);
|
|
1974
|
+
continue;
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
return {
|
|
1978
|
+
type: "blockquote",
|
|
1979
|
+
raw: r,
|
|
1980
|
+
tokens: s,
|
|
1981
|
+
text: i
|
|
1982
|
+
};
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
list(e) {
|
|
1986
|
+
let t = this.rules.block.list.exec(e);
|
|
1987
|
+
if (t) {
|
|
1988
|
+
let n = t[1].trim(), r = n.length > 1, i = {
|
|
1989
|
+
type: "list",
|
|
1990
|
+
raw: "",
|
|
1991
|
+
ordered: r,
|
|
1992
|
+
start: r ? +n.slice(0, -1) : "",
|
|
1993
|
+
loose: !1,
|
|
1994
|
+
items: []
|
|
1995
|
+
};
|
|
1996
|
+
n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
|
|
1997
|
+
let s = this.rules.other.listItemRegex(n), a = !1;
|
|
1998
|
+
for (; e;) {
|
|
1999
|
+
let l = !1, p = "", c = "";
|
|
2000
|
+
if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
2001
|
+
p = t[0], e = e.substring(p.length);
|
|
2002
|
+
let d = ge(t[2].split(`
|
|
2003
|
+
`, 1)[0], t[1].length), h = e.split(`
|
|
2004
|
+
`, 1)[0], R = !d.trim(), f = 0;
|
|
2005
|
+
if (this.options.pedantic ? (f = 2, c = d.trimStart()) : R ? f = t[1].length + 1 : (f = d.search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, c = d.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (p += h + `
|
|
2006
|
+
`, e = e.substring(h.length + 1), l = !0), !l) {
|
|
2007
|
+
let S = this.rules.other.nextBulletRegex(f), Y = this.rules.other.hrRegex(f), ee = this.rules.other.fencesBeginRegex(f), te = this.rules.other.headingBeginRegex(f), me = this.rules.other.htmlBeginRegex(f), xe = this.rules.other.blockquoteBeginRegex(f);
|
|
2008
|
+
for (; e;) {
|
|
2009
|
+
let Z = e.split(`
|
|
2010
|
+
`, 1)[0], A;
|
|
2011
|
+
if (h = Z, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), A = h) : A = h.replace(this.rules.other.tabCharGlobal, " "), ee.test(h) || te.test(h) || me.test(h) || xe.test(h) || S.test(h) || Y.test(h)) break;
|
|
2012
|
+
if (A.search(this.rules.other.nonSpaceChar) >= f || !h.trim()) c += `
|
|
2013
|
+
` + A.slice(f);
|
|
2014
|
+
else {
|
|
2015
|
+
if (R || d.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || ee.test(d) || te.test(d) || Y.test(d)) break;
|
|
2016
|
+
c += `
|
|
2017
|
+
` + h;
|
|
2018
|
+
}
|
|
2019
|
+
R = !h.trim(), p += Z + `
|
|
2020
|
+
`, e = e.substring(Z.length + 1), d = A.slice(f);
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
i.loose || (a ? i.loose = !0 : this.rules.other.doubleBlankLine.test(p) && (a = !0)), i.items.push({
|
|
2024
|
+
type: "list_item",
|
|
2025
|
+
raw: p,
|
|
2026
|
+
task: !!this.options.gfm && this.rules.other.listIsTask.test(c),
|
|
2027
|
+
loose: !1,
|
|
2028
|
+
text: c,
|
|
2029
|
+
tokens: []
|
|
2030
|
+
}), i.raw += p;
|
|
2031
|
+
}
|
|
2032
|
+
let o = i.items.at(-1);
|
|
2033
|
+
if (o) o.raw = o.raw.trimEnd(), o.text = o.text.trimEnd();
|
|
2034
|
+
else return;
|
|
2035
|
+
i.raw = i.raw.trimEnd();
|
|
2036
|
+
for (let l of i.items) {
|
|
2037
|
+
if (this.lexer.state.top = !1, l.tokens = this.lexer.blockTokens(l.text, []), l.task) {
|
|
2038
|
+
if (l.text = l.text.replace(this.rules.other.listReplaceTask, ""), l.tokens[0]?.type === "text" || l.tokens[0]?.type === "paragraph") {
|
|
2039
|
+
l.tokens[0].raw = l.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), l.tokens[0].text = l.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
|
|
2040
|
+
for (let c = this.lexer.inlineQueue.length - 1; c >= 0; c--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[c].src)) {
|
|
2041
|
+
this.lexer.inlineQueue[c].src = this.lexer.inlineQueue[c].src.replace(this.rules.other.listReplaceTask, "");
|
|
2042
|
+
break;
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
let p = this.rules.other.listTaskCheckbox.exec(l.raw);
|
|
2046
|
+
if (p) {
|
|
2047
|
+
let c = {
|
|
2048
|
+
type: "checkbox",
|
|
2049
|
+
raw: p[0] + " ",
|
|
2050
|
+
checked: p[0] !== "[ ]"
|
|
2051
|
+
};
|
|
2052
|
+
l.checked = c.checked, i.loose ? l.tokens[0] && ["paragraph", "text"].includes(l.tokens[0].type) && "tokens" in l.tokens[0] && l.tokens[0].tokens ? (l.tokens[0].raw = c.raw + l.tokens[0].raw, l.tokens[0].text = c.raw + l.tokens[0].text, l.tokens[0].tokens.unshift(c)) : l.tokens.unshift({
|
|
2053
|
+
type: "paragraph",
|
|
2054
|
+
raw: c.raw,
|
|
2055
|
+
text: c.raw,
|
|
2056
|
+
tokens: [c]
|
|
2057
|
+
}) : l.tokens.unshift(c);
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
if (!i.loose) {
|
|
2061
|
+
let p = l.tokens.filter((d) => d.type === "space");
|
|
2062
|
+
i.loose = p.length > 0 && p.some((d) => this.rules.other.anyLine.test(d.raw));
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
if (i.loose) for (let l of i.items) {
|
|
2066
|
+
l.loose = !0;
|
|
2067
|
+
for (let p of l.tokens) p.type === "text" && (p.type = "paragraph");
|
|
2068
|
+
}
|
|
2069
|
+
return i;
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
html(e) {
|
|
2073
|
+
let t = this.rules.block.html.exec(e);
|
|
2074
|
+
if (t) return {
|
|
2075
|
+
type: "html",
|
|
2076
|
+
block: !0,
|
|
2077
|
+
raw: t[0],
|
|
2078
|
+
pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
|
|
2079
|
+
text: t[0]
|
|
2080
|
+
};
|
|
2081
|
+
}
|
|
2082
|
+
def(e) {
|
|
2083
|
+
let t = this.rules.block.def.exec(e);
|
|
2084
|
+
if (t) {
|
|
2085
|
+
let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), r = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
2086
|
+
return {
|
|
2087
|
+
type: "def",
|
|
2088
|
+
tag: n,
|
|
2089
|
+
raw: t[0],
|
|
2090
|
+
href: r,
|
|
2091
|
+
title: i
|
|
2092
|
+
};
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
table(e) {
|
|
2096
|
+
let t = this.rules.block.table.exec(e);
|
|
2097
|
+
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
2098
|
+
let n = V(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
2099
|
+
`) : [], s = {
|
|
2100
|
+
type: "table",
|
|
2101
|
+
raw: t[0],
|
|
2102
|
+
header: [],
|
|
2103
|
+
align: [],
|
|
2104
|
+
rows: []
|
|
2105
|
+
};
|
|
2106
|
+
if (n.length === r.length) {
|
|
2107
|
+
for (let a of r) this.rules.other.tableAlignRight.test(a) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(a) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(a) ? s.align.push("left") : s.align.push(null);
|
|
2108
|
+
for (let a = 0; a < n.length; a++) s.header.push({
|
|
2109
|
+
text: n[a],
|
|
2110
|
+
tokens: this.lexer.inline(n[a]),
|
|
2111
|
+
header: !0,
|
|
2112
|
+
align: s.align[a]
|
|
2113
|
+
});
|
|
2114
|
+
for (let a of i) s.rows.push(V(a, s.header.length).map((o, l) => ({
|
|
2115
|
+
text: o,
|
|
2116
|
+
tokens: this.lexer.inline(o),
|
|
2117
|
+
header: !1,
|
|
2118
|
+
align: s.align[l]
|
|
2119
|
+
})));
|
|
2120
|
+
return s;
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
lheading(e) {
|
|
2124
|
+
let t = this.rules.block.lheading.exec(e);
|
|
2125
|
+
if (t) {
|
|
2126
|
+
let n = t[1].trim();
|
|
2127
|
+
return {
|
|
2128
|
+
type: "heading",
|
|
2129
|
+
raw: t[0],
|
|
2130
|
+
depth: t[2].charAt(0) === "=" ? 1 : 2,
|
|
2131
|
+
text: n,
|
|
2132
|
+
tokens: this.lexer.inline(n)
|
|
2133
|
+
};
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
paragraph(e) {
|
|
2137
|
+
let t = this.rules.block.paragraph.exec(e);
|
|
2138
|
+
if (t) {
|
|
2139
|
+
let n = t[1].charAt(t[1].length - 1) === `
|
|
2140
|
+
` ? t[1].slice(0, -1) : t[1];
|
|
2141
|
+
return {
|
|
2142
|
+
type: "paragraph",
|
|
2143
|
+
raw: t[0],
|
|
2144
|
+
text: n,
|
|
2145
|
+
tokens: this.lexer.inline(n)
|
|
2146
|
+
};
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
text(e) {
|
|
2150
|
+
let t = this.rules.block.text.exec(e);
|
|
2151
|
+
if (t) return {
|
|
2152
|
+
type: "text",
|
|
2153
|
+
raw: t[0],
|
|
2154
|
+
text: t[0],
|
|
2155
|
+
tokens: this.lexer.inline(t[0])
|
|
2156
|
+
};
|
|
2157
|
+
}
|
|
2158
|
+
escape(e) {
|
|
2159
|
+
let t = this.rules.inline.escape.exec(e);
|
|
2160
|
+
if (t) return {
|
|
2161
|
+
type: "escape",
|
|
2162
|
+
raw: t[0],
|
|
2163
|
+
text: t[1]
|
|
2164
|
+
};
|
|
2165
|
+
}
|
|
2166
|
+
tag(e) {
|
|
2167
|
+
let t = this.rules.inline.tag.exec(e);
|
|
2168
|
+
if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
|
|
2169
|
+
type: "html",
|
|
2170
|
+
raw: t[0],
|
|
2171
|
+
inLink: this.lexer.state.inLink,
|
|
2172
|
+
inRawBlock: this.lexer.state.inRawBlock,
|
|
2173
|
+
block: !1,
|
|
2174
|
+
text: t[0]
|
|
2175
|
+
};
|
|
2176
|
+
}
|
|
2177
|
+
link(e) {
|
|
2178
|
+
let t = this.rules.inline.link.exec(e);
|
|
2179
|
+
if (t) {
|
|
2180
|
+
let n = t[2].trim();
|
|
2181
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
2182
|
+
if (!this.rules.other.endAngleBracket.test(n)) return;
|
|
2183
|
+
let s = I(n.slice(0, -1), "\\");
|
|
2184
|
+
if ((n.length - s.length) % 2 === 0) return;
|
|
2185
|
+
} else {
|
|
2186
|
+
let s = de(t[2], "()");
|
|
2187
|
+
if (s === -2) return;
|
|
2188
|
+
if (s > -1) {
|
|
2189
|
+
let o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
|
|
2190
|
+
t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, o).trim(), t[3] = "";
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
let r = t[2], i = "";
|
|
2194
|
+
if (this.options.pedantic) {
|
|
2195
|
+
let s = this.rules.other.pedanticHrefTitle.exec(r);
|
|
2196
|
+
s && (r = s[1], i = s[3]);
|
|
2197
|
+
} else i = t[3] ? t[3].slice(1, -1) : "";
|
|
2198
|
+
return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)), fe(t, {
|
|
2199
|
+
href: r && r.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
2200
|
+
title: i && i.replace(this.rules.inline.anyPunctuation, "$1")
|
|
2201
|
+
}, t[0], this.lexer, this.rules);
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
reflink(e, t) {
|
|
2205
|
+
let n;
|
|
2206
|
+
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
2207
|
+
let i = t[(n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " ").toLowerCase()];
|
|
2208
|
+
if (!i) {
|
|
2209
|
+
let s = n[0].charAt(0);
|
|
2210
|
+
return {
|
|
2211
|
+
type: "text",
|
|
2212
|
+
raw: s,
|
|
2213
|
+
text: s
|
|
2214
|
+
};
|
|
2215
|
+
}
|
|
2216
|
+
return fe(n, i, n[0], this.lexer, this.rules);
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
emStrong(e, t, n = "") {
|
|
2220
|
+
let r = this.rules.inline.emStrongLDelim.exec(e);
|
|
2221
|
+
if (!r || !r[1] && !r[2] && !r[3] && !r[4] || r[4] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
|
|
2222
|
+
if (!(r[1] || r[3] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
2223
|
+
let s = [...r[0]].length - 1, a, o, l = s, p = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
2224
|
+
for (c.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = c.exec(t)) != null;) {
|
|
2225
|
+
if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a) continue;
|
|
2226
|
+
if (o = [...a].length, r[3] || r[4]) {
|
|
2227
|
+
l += o;
|
|
2228
|
+
continue;
|
|
2229
|
+
} else if ((r[5] || r[6]) && s % 3 && !((s + o) % 3)) {
|
|
2230
|
+
p += o;
|
|
2231
|
+
continue;
|
|
2232
|
+
}
|
|
2233
|
+
if (l -= o, l > 0) continue;
|
|
2234
|
+
o = Math.min(o, o + l + p);
|
|
2235
|
+
let d = [...r[0]][0].length, h = e.slice(0, s + r.index + d + o);
|
|
2236
|
+
if (Math.min(s, o) % 2) {
|
|
2237
|
+
let f = h.slice(1, -1);
|
|
2238
|
+
return {
|
|
2239
|
+
type: "em",
|
|
2240
|
+
raw: h,
|
|
2241
|
+
text: f,
|
|
2242
|
+
tokens: this.lexer.inlineTokens(f)
|
|
2243
|
+
};
|
|
2244
|
+
}
|
|
2245
|
+
let R = h.slice(2, -2);
|
|
2246
|
+
return {
|
|
2247
|
+
type: "strong",
|
|
2248
|
+
raw: h,
|
|
2249
|
+
text: R,
|
|
2250
|
+
tokens: this.lexer.inlineTokens(R)
|
|
2251
|
+
};
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
codespan(e) {
|
|
2256
|
+
let t = this.rules.inline.code.exec(e);
|
|
2257
|
+
if (t) {
|
|
2258
|
+
let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), r = this.rules.other.nonSpaceChar.test(n), i = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
|
|
2259
|
+
return r && i && (n = n.substring(1, n.length - 1)), {
|
|
2260
|
+
type: "codespan",
|
|
2261
|
+
raw: t[0],
|
|
2262
|
+
text: n
|
|
2263
|
+
};
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
br(e) {
|
|
2267
|
+
let t = this.rules.inline.br.exec(e);
|
|
2268
|
+
if (t) return {
|
|
2269
|
+
type: "br",
|
|
2270
|
+
raw: t[0]
|
|
2271
|
+
};
|
|
2272
|
+
}
|
|
2273
|
+
del(e, t, n = "") {
|
|
2274
|
+
let r = this.rules.inline.delLDelim.exec(e);
|
|
2275
|
+
if (!r) return;
|
|
2276
|
+
if (!(r[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
2277
|
+
let s = [...r[0]].length - 1, a, o, l = s, p = this.rules.inline.delRDelim;
|
|
2278
|
+
for (p.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = p.exec(t)) != null;) {
|
|
2279
|
+
if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a || (o = [...a].length, o !== s)) continue;
|
|
2280
|
+
if (r[3] || r[4]) {
|
|
2281
|
+
l += o;
|
|
2282
|
+
continue;
|
|
2283
|
+
}
|
|
2284
|
+
if (l -= o, l > 0) continue;
|
|
2285
|
+
o = Math.min(o, o + l);
|
|
2286
|
+
let c = [...r[0]][0].length, d = e.slice(0, s + r.index + c + o), h = d.slice(s, -s);
|
|
2287
|
+
return {
|
|
2288
|
+
type: "del",
|
|
2289
|
+
raw: d,
|
|
2290
|
+
text: h,
|
|
2291
|
+
tokens: this.lexer.inlineTokens(h)
|
|
2292
|
+
};
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
autolink(e) {
|
|
2297
|
+
let t = this.rules.inline.autolink.exec(e);
|
|
2298
|
+
if (t) {
|
|
2299
|
+
let n, r;
|
|
2300
|
+
return t[2] === "@" ? (n = t[1], r = "mailto:" + n) : (n = t[1], r = n), {
|
|
2301
|
+
type: "link",
|
|
2302
|
+
raw: t[0],
|
|
2303
|
+
text: n,
|
|
2304
|
+
href: r,
|
|
2305
|
+
tokens: [{
|
|
2306
|
+
type: "text",
|
|
2307
|
+
raw: n,
|
|
2308
|
+
text: n
|
|
2309
|
+
}]
|
|
2310
|
+
};
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
url(e) {
|
|
2314
|
+
let t;
|
|
2315
|
+
if (t = this.rules.inline.url.exec(e)) {
|
|
2316
|
+
let n, r;
|
|
2317
|
+
if (t[2] === "@") n = t[0], r = "mailto:" + n;
|
|
2318
|
+
else {
|
|
2319
|
+
let i;
|
|
2320
|
+
do
|
|
2321
|
+
i = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
|
|
2322
|
+
while (i !== t[0]);
|
|
2323
|
+
n = t[0], t[1] === "www." ? r = "http://" + t[0] : r = t[0];
|
|
2324
|
+
}
|
|
2325
|
+
return {
|
|
2326
|
+
type: "link",
|
|
2327
|
+
raw: t[0],
|
|
2328
|
+
text: n,
|
|
2329
|
+
href: r,
|
|
2330
|
+
tokens: [{
|
|
2331
|
+
type: "text",
|
|
2332
|
+
raw: n,
|
|
2333
|
+
text: n
|
|
2334
|
+
}]
|
|
2335
|
+
};
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2338
|
+
inlineText(e) {
|
|
2339
|
+
let t = this.rules.inline.text.exec(e);
|
|
2340
|
+
if (t) {
|
|
2341
|
+
let n = this.lexer.state.inRawBlock;
|
|
2342
|
+
return {
|
|
2343
|
+
type: "text",
|
|
2344
|
+
raw: t[0],
|
|
2345
|
+
text: t[0],
|
|
2346
|
+
escaped: n
|
|
2347
|
+
};
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
};
|
|
2351
|
+
var x = class u {
|
|
2352
|
+
constructor(e) {
|
|
2353
|
+
_defineProperty(this, "tokens", void 0);
|
|
2354
|
+
_defineProperty(this, "options", void 0);
|
|
2355
|
+
_defineProperty(this, "state", void 0);
|
|
2356
|
+
_defineProperty(this, "inlineQueue", void 0);
|
|
2357
|
+
_defineProperty(this, "tokenizer", void 0);
|
|
2358
|
+
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new w(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
2359
|
+
inLink: !1,
|
|
2360
|
+
inRawBlock: !1,
|
|
2361
|
+
top: !0
|
|
2362
|
+
};
|
|
2363
|
+
let t = {
|
|
2364
|
+
other: m,
|
|
2365
|
+
block: B.normal,
|
|
2366
|
+
inline: E.normal
|
|
2367
|
+
};
|
|
2368
|
+
this.options.pedantic ? (t.block = B.pedantic, t.inline = E.pedantic) : this.options.gfm && (t.block = B.gfm, this.options.breaks ? t.inline = E.breaks : t.inline = E.gfm), this.tokenizer.rules = t;
|
|
2369
|
+
}
|
|
2370
|
+
static get rules() {
|
|
2371
|
+
return {
|
|
2372
|
+
block: B,
|
|
2373
|
+
inline: E
|
|
2374
|
+
};
|
|
2375
|
+
}
|
|
2376
|
+
static lex(e, t) {
|
|
2377
|
+
return new u(t).lex(e);
|
|
2378
|
+
}
|
|
2379
|
+
static lexInline(e, t) {
|
|
2380
|
+
return new u(t).inlineTokens(e);
|
|
2381
|
+
}
|
|
2382
|
+
lex(e) {
|
|
2383
|
+
e = e.replace(m.carriageReturn, `
|
|
2384
|
+
`), this.blockTokens(e, this.tokens);
|
|
2385
|
+
for (let t = 0; t < this.inlineQueue.length; t++) {
|
|
2386
|
+
let n = this.inlineQueue[t];
|
|
2387
|
+
this.inlineTokens(n.src, n.tokens);
|
|
2388
|
+
}
|
|
2389
|
+
return this.inlineQueue = [], this.tokens;
|
|
2390
|
+
}
|
|
2391
|
+
blockTokens(e, t = [], n = !1) {
|
|
2392
|
+
for (this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, "")); e;) {
|
|
2393
|
+
let r;
|
|
2394
|
+
if (this.options.extensions?.block?.some((s) => (r = s.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1)) continue;
|
|
2395
|
+
if (r = this.tokenizer.space(e)) {
|
|
2396
|
+
e = e.substring(r.raw.length);
|
|
2397
|
+
let s = t.at(-1);
|
|
2398
|
+
r.raw.length === 1 && s !== void 0 ? s.raw += `
|
|
2399
|
+
` : t.push(r);
|
|
2400
|
+
continue;
|
|
2401
|
+
}
|
|
2402
|
+
if (r = this.tokenizer.code(e)) {
|
|
2403
|
+
e = e.substring(r.raw.length);
|
|
2404
|
+
let s = t.at(-1);
|
|
2405
|
+
s?.type === "paragraph" || s?.type === "text" ? (s.raw += (s.raw.endsWith(`
|
|
2406
|
+
`) ? "" : `
|
|
2407
|
+
`) + r.raw, s.text += `
|
|
2408
|
+
` + r.text, this.inlineQueue.at(-1).src = s.text) : t.push(r);
|
|
2409
|
+
continue;
|
|
2410
|
+
}
|
|
2411
|
+
if (r = this.tokenizer.fences(e)) {
|
|
2412
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2413
|
+
continue;
|
|
2414
|
+
}
|
|
2415
|
+
if (r = this.tokenizer.heading(e)) {
|
|
2416
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2417
|
+
continue;
|
|
2418
|
+
}
|
|
2419
|
+
if (r = this.tokenizer.hr(e)) {
|
|
2420
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2421
|
+
continue;
|
|
2422
|
+
}
|
|
2423
|
+
if (r = this.tokenizer.blockquote(e)) {
|
|
2424
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2425
|
+
continue;
|
|
2426
|
+
}
|
|
2427
|
+
if (r = this.tokenizer.list(e)) {
|
|
2428
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2429
|
+
continue;
|
|
2430
|
+
}
|
|
2431
|
+
if (r = this.tokenizer.html(e)) {
|
|
2432
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2433
|
+
continue;
|
|
2434
|
+
}
|
|
2435
|
+
if (r = this.tokenizer.def(e)) {
|
|
2436
|
+
e = e.substring(r.raw.length);
|
|
2437
|
+
let s = t.at(-1);
|
|
2438
|
+
s?.type === "paragraph" || s?.type === "text" ? (s.raw += (s.raw.endsWith(`
|
|
2439
|
+
`) ? "" : `
|
|
2440
|
+
`) + r.raw, s.text += `
|
|
2441
|
+
` + r.raw, this.inlineQueue.at(-1).src = s.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = {
|
|
2442
|
+
href: r.href,
|
|
2443
|
+
title: r.title
|
|
2444
|
+
}, t.push(r));
|
|
2445
|
+
continue;
|
|
2446
|
+
}
|
|
2447
|
+
if (r = this.tokenizer.table(e)) {
|
|
2448
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2449
|
+
continue;
|
|
2450
|
+
}
|
|
2451
|
+
if (r = this.tokenizer.lheading(e)) {
|
|
2452
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
2453
|
+
continue;
|
|
2454
|
+
}
|
|
2455
|
+
let i = e;
|
|
2456
|
+
if (this.options.extensions?.startBlock) {
|
|
2457
|
+
let s = Infinity, a = e.slice(1), o;
|
|
2458
|
+
this.options.extensions.startBlock.forEach((l) => {
|
|
2459
|
+
o = l.call({ lexer: this }, a), typeof o == "number" && o >= 0 && (s = Math.min(s, o));
|
|
2460
|
+
}), s < Infinity && s >= 0 && (i = e.substring(0, s + 1));
|
|
2461
|
+
}
|
|
2462
|
+
if (this.state.top && (r = this.tokenizer.paragraph(i))) {
|
|
2463
|
+
let s = t.at(-1);
|
|
2464
|
+
n && s?.type === "paragraph" ? (s.raw += (s.raw.endsWith(`
|
|
2465
|
+
`) ? "" : `
|
|
2466
|
+
`) + r.raw, s.text += `
|
|
2467
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
|
|
2468
|
+
continue;
|
|
2469
|
+
}
|
|
2470
|
+
if (r = this.tokenizer.text(e)) {
|
|
2471
|
+
e = e.substring(r.raw.length);
|
|
2472
|
+
let s = t.at(-1);
|
|
2473
|
+
s?.type === "text" ? (s.raw += (s.raw.endsWith(`
|
|
2474
|
+
`) ? "" : `
|
|
2475
|
+
`) + r.raw, s.text += `
|
|
2476
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r);
|
|
2477
|
+
continue;
|
|
2478
|
+
}
|
|
2479
|
+
if (e) {
|
|
2480
|
+
let s = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
2481
|
+
if (this.options.silent) {
|
|
2482
|
+
console.error(s);
|
|
2483
|
+
break;
|
|
2484
|
+
} else throw new Error(s);
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
return this.state.top = !0, t;
|
|
2488
|
+
}
|
|
2489
|
+
inline(e, t = []) {
|
|
2490
|
+
return this.inlineQueue.push({
|
|
2491
|
+
src: e,
|
|
2492
|
+
tokens: t
|
|
2493
|
+
}), t;
|
|
2494
|
+
}
|
|
2495
|
+
inlineTokens(e, t = []) {
|
|
2496
|
+
this.tokenizer.lexer = this;
|
|
2497
|
+
let n = e, r = null;
|
|
2498
|
+
if (this.tokens.links) {
|
|
2499
|
+
let o = Object.keys(this.tokens.links);
|
|
2500
|
+
if (o.length > 0) for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null;) o.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
2501
|
+
}
|
|
2502
|
+
for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null;) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
2503
|
+
let i;
|
|
2504
|
+
for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) != null;) i = r[2] ? r[2].length : 0, n = n.slice(0, r.index + i) + "[" + "a".repeat(r[0].length - i - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
2505
|
+
n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
|
|
2506
|
+
let s = !1, a = "";
|
|
2507
|
+
for (; e;) {
|
|
2508
|
+
s || (a = ""), s = !1;
|
|
2509
|
+
let o;
|
|
2510
|
+
if (this.options.extensions?.inline?.some((p) => (o = p.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), !0) : !1)) continue;
|
|
2511
|
+
if (o = this.tokenizer.escape(e)) {
|
|
2512
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
2513
|
+
continue;
|
|
2514
|
+
}
|
|
2515
|
+
if (o = this.tokenizer.tag(e)) {
|
|
2516
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
2517
|
+
continue;
|
|
2518
|
+
}
|
|
2519
|
+
if (o = this.tokenizer.link(e)) {
|
|
2520
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
2521
|
+
continue;
|
|
2522
|
+
}
|
|
2523
|
+
if (o = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
2524
|
+
e = e.substring(o.raw.length);
|
|
2525
|
+
let p = t.at(-1);
|
|
2526
|
+
o.type === "text" && p?.type === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
|
|
2527
|
+
continue;
|
|
2528
|
+
}
|
|
2529
|
+
if (o = this.tokenizer.emStrong(e, n, a)) {
|
|
2530
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
2531
|
+
continue;
|
|
2532
|
+
}
|
|
2533
|
+
if (o = this.tokenizer.codespan(e)) {
|
|
2534
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
2535
|
+
continue;
|
|
2536
|
+
}
|
|
2537
|
+
if (o = this.tokenizer.br(e)) {
|
|
2538
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
2539
|
+
continue;
|
|
2540
|
+
}
|
|
2541
|
+
if (o = this.tokenizer.del(e, n, a)) {
|
|
2542
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
2543
|
+
continue;
|
|
2544
|
+
}
|
|
2545
|
+
if (o = this.tokenizer.autolink(e)) {
|
|
2546
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
2547
|
+
continue;
|
|
2548
|
+
}
|
|
2549
|
+
if (!this.state.inLink && (o = this.tokenizer.url(e))) {
|
|
2550
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
2551
|
+
continue;
|
|
2552
|
+
}
|
|
2553
|
+
let l = e;
|
|
2554
|
+
if (this.options.extensions?.startInline) {
|
|
2555
|
+
let p = Infinity, c = e.slice(1), d;
|
|
2556
|
+
this.options.extensions.startInline.forEach((h) => {
|
|
2557
|
+
d = h.call({ lexer: this }, c), typeof d == "number" && d >= 0 && (p = Math.min(p, d));
|
|
2558
|
+
}), p < Infinity && p >= 0 && (l = e.substring(0, p + 1));
|
|
2559
|
+
}
|
|
2560
|
+
if (o = this.tokenizer.inlineText(l)) {
|
|
2561
|
+
e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (a = o.raw.slice(-1)), s = !0;
|
|
2562
|
+
let p = t.at(-1);
|
|
2563
|
+
p?.type === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
|
|
2564
|
+
continue;
|
|
2565
|
+
}
|
|
2566
|
+
if (e) {
|
|
2567
|
+
let p = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
2568
|
+
if (this.options.silent) {
|
|
2569
|
+
console.error(p);
|
|
2570
|
+
break;
|
|
2571
|
+
} else throw new Error(p);
|
|
2572
|
+
}
|
|
2573
|
+
}
|
|
2574
|
+
return t;
|
|
2575
|
+
}
|
|
2576
|
+
};
|
|
2577
|
+
var y = class {
|
|
2578
|
+
constructor(e) {
|
|
2579
|
+
_defineProperty(this, "options", void 0);
|
|
2580
|
+
_defineProperty(this, "parser", void 0);
|
|
2581
|
+
this.options = e || T;
|
|
2582
|
+
}
|
|
2583
|
+
space(e) {
|
|
2584
|
+
return "";
|
|
2585
|
+
}
|
|
2586
|
+
code({ text: e, lang: t, escaped: n }) {
|
|
2587
|
+
let r = (t || "").match(m.notSpaceStart)?.[0], i = e.replace(m.endingNewline, "") + `
|
|
2588
|
+
`;
|
|
2589
|
+
return r ? "<pre><code class=\"language-" + O(r) + "\">" + (n ? i : O(i, !0)) + `</code></pre>
|
|
2590
|
+
` : "<pre><code>" + (n ? i : O(i, !0)) + `</code></pre>
|
|
2591
|
+
`;
|
|
2592
|
+
}
|
|
2593
|
+
blockquote({ tokens: e }) {
|
|
2594
|
+
return `<blockquote>
|
|
2595
|
+
${this.parser.parse(e)}</blockquote>
|
|
2596
|
+
`;
|
|
2597
|
+
}
|
|
2598
|
+
html({ text: e }) {
|
|
2599
|
+
return e;
|
|
2600
|
+
}
|
|
2601
|
+
def(e) {
|
|
2602
|
+
return "";
|
|
2603
|
+
}
|
|
2604
|
+
heading({ tokens: e, depth: t }) {
|
|
2605
|
+
return `<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
2606
|
+
`;
|
|
2607
|
+
}
|
|
2608
|
+
hr(e) {
|
|
2609
|
+
return `<hr>
|
|
2610
|
+
`;
|
|
2611
|
+
}
|
|
2612
|
+
list(e) {
|
|
2613
|
+
let t = e.ordered, n = e.start, r = "";
|
|
2614
|
+
for (let a = 0; a < e.items.length; a++) {
|
|
2615
|
+
let o = e.items[a];
|
|
2616
|
+
r += this.listitem(o);
|
|
2617
|
+
}
|
|
2618
|
+
let i = t ? "ol" : "ul", s = t && n !== 1 ? " start=\"" + n + "\"" : "";
|
|
2619
|
+
return "<" + i + s + `>
|
|
2620
|
+
` + r + "</" + i + `>
|
|
2621
|
+
`;
|
|
2622
|
+
}
|
|
2623
|
+
listitem(e) {
|
|
2624
|
+
return `<li>${this.parser.parse(e.tokens)}</li>
|
|
2625
|
+
`;
|
|
2626
|
+
}
|
|
2627
|
+
checkbox({ checked: e }) {
|
|
2628
|
+
return "<input " + (e ? "checked=\"\" " : "") + "disabled=\"\" type=\"checkbox\"> ";
|
|
2629
|
+
}
|
|
2630
|
+
paragraph({ tokens: e }) {
|
|
2631
|
+
return `<p>${this.parser.parseInline(e)}</p>
|
|
2632
|
+
`;
|
|
2633
|
+
}
|
|
2634
|
+
table(e) {
|
|
2635
|
+
let t = "", n = "";
|
|
2636
|
+
for (let i = 0; i < e.header.length; i++) n += this.tablecell(e.header[i]);
|
|
2637
|
+
t += this.tablerow({ text: n });
|
|
2638
|
+
let r = "";
|
|
2639
|
+
for (let i = 0; i < e.rows.length; i++) {
|
|
2640
|
+
let s = e.rows[i];
|
|
2641
|
+
n = "";
|
|
2642
|
+
for (let a = 0; a < s.length; a++) n += this.tablecell(s[a]);
|
|
2643
|
+
r += this.tablerow({ text: n });
|
|
2644
|
+
}
|
|
2645
|
+
return r && (r = `<tbody>${r}</tbody>`), `<table>
|
|
2646
|
+
<thead>
|
|
2647
|
+
` + t + `</thead>
|
|
2648
|
+
` + r + `</table>
|
|
2649
|
+
`;
|
|
2650
|
+
}
|
|
2651
|
+
tablerow({ text: e }) {
|
|
2652
|
+
return `<tr>
|
|
2653
|
+
${e}</tr>
|
|
2654
|
+
`;
|
|
2655
|
+
}
|
|
2656
|
+
tablecell(e) {
|
|
2657
|
+
let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
|
|
2658
|
+
return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
|
|
2659
|
+
`;
|
|
2660
|
+
}
|
|
2661
|
+
strong({ tokens: e }) {
|
|
2662
|
+
return `<strong>${this.parser.parseInline(e)}</strong>`;
|
|
2663
|
+
}
|
|
2664
|
+
em({ tokens: e }) {
|
|
2665
|
+
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
2666
|
+
}
|
|
2667
|
+
codespan({ text: e }) {
|
|
2668
|
+
return `<code>${O(e, !0)}</code>`;
|
|
2669
|
+
}
|
|
2670
|
+
br(e) {
|
|
2671
|
+
return "<br>";
|
|
2672
|
+
}
|
|
2673
|
+
del({ tokens: e }) {
|
|
2674
|
+
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
2675
|
+
}
|
|
2676
|
+
link({ href: e, title: t, tokens: n }) {
|
|
2677
|
+
let r = this.parser.parseInline(n), i = J(e);
|
|
2678
|
+
if (i === null) return r;
|
|
2679
|
+
e = i;
|
|
2680
|
+
let s = "<a href=\"" + e + "\"";
|
|
2681
|
+
return t && (s += " title=\"" + O(t) + "\""), s += ">" + r + "</a>", s;
|
|
2682
|
+
}
|
|
2683
|
+
image({ href: e, title: t, text: n, tokens: r }) {
|
|
2684
|
+
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
2685
|
+
let i = J(e);
|
|
2686
|
+
if (i === null) return O(n);
|
|
2687
|
+
e = i;
|
|
2688
|
+
let s = `<img src="${e}" alt="${O(n)}"`;
|
|
2689
|
+
return t && (s += ` title="${O(t)}"`), s += ">", s;
|
|
2690
|
+
}
|
|
2691
|
+
text(e) {
|
|
2692
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : O(e.text);
|
|
2693
|
+
}
|
|
2694
|
+
};
|
|
2695
|
+
var $ = class {
|
|
2696
|
+
strong({ text: e }) {
|
|
2697
|
+
return e;
|
|
2698
|
+
}
|
|
2699
|
+
em({ text: e }) {
|
|
2700
|
+
return e;
|
|
2701
|
+
}
|
|
2702
|
+
codespan({ text: e }) {
|
|
2703
|
+
return e;
|
|
2704
|
+
}
|
|
2705
|
+
del({ text: e }) {
|
|
2706
|
+
return e;
|
|
2707
|
+
}
|
|
2708
|
+
html({ text: e }) {
|
|
2709
|
+
return e;
|
|
2710
|
+
}
|
|
2711
|
+
text({ text: e }) {
|
|
2712
|
+
return e;
|
|
2713
|
+
}
|
|
2714
|
+
link({ text: e }) {
|
|
2715
|
+
return "" + e;
|
|
2716
|
+
}
|
|
2717
|
+
image({ text: e }) {
|
|
2718
|
+
return "" + e;
|
|
2719
|
+
}
|
|
2720
|
+
br() {
|
|
2721
|
+
return "";
|
|
2722
|
+
}
|
|
2723
|
+
checkbox({ raw: e }) {
|
|
2724
|
+
return e;
|
|
2725
|
+
}
|
|
2726
|
+
};
|
|
2727
|
+
var b = class u {
|
|
2728
|
+
constructor(e) {
|
|
2729
|
+
_defineProperty(this, "options", void 0);
|
|
2730
|
+
_defineProperty(this, "renderer", void 0);
|
|
2731
|
+
_defineProperty(this, "textRenderer", void 0);
|
|
2732
|
+
this.options = e || T, this.options.renderer = this.options.renderer || new y(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new $();
|
|
2733
|
+
}
|
|
2734
|
+
static parse(e, t) {
|
|
2735
|
+
return new u(t).parse(e);
|
|
2736
|
+
}
|
|
2737
|
+
static parseInline(e, t) {
|
|
2738
|
+
return new u(t).parseInline(e);
|
|
2739
|
+
}
|
|
2740
|
+
parse(e) {
|
|
2741
|
+
this.renderer.parser = this;
|
|
2742
|
+
let t = "";
|
|
2743
|
+
for (let n = 0; n < e.length; n++) {
|
|
2744
|
+
let r = e[n];
|
|
2745
|
+
if (this.options.extensions?.renderers?.[r.type]) {
|
|
2746
|
+
let s = r, a = this.options.extensions.renderers[s.type].call({ parser: this }, s);
|
|
2747
|
+
if (a !== !1 || ![
|
|
2748
|
+
"space",
|
|
2749
|
+
"hr",
|
|
2750
|
+
"heading",
|
|
2751
|
+
"code",
|
|
2752
|
+
"table",
|
|
2753
|
+
"blockquote",
|
|
2754
|
+
"list",
|
|
2755
|
+
"html",
|
|
2756
|
+
"def",
|
|
2757
|
+
"paragraph",
|
|
2758
|
+
"text"
|
|
2759
|
+
].includes(s.type)) {
|
|
2760
|
+
t += a || "";
|
|
2761
|
+
continue;
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2764
|
+
let i = r;
|
|
2765
|
+
switch (i.type) {
|
|
2766
|
+
case "space":
|
|
2767
|
+
t += this.renderer.space(i);
|
|
2768
|
+
break;
|
|
2769
|
+
case "hr":
|
|
2770
|
+
t += this.renderer.hr(i);
|
|
2771
|
+
break;
|
|
2772
|
+
case "heading":
|
|
2773
|
+
t += this.renderer.heading(i);
|
|
2774
|
+
break;
|
|
2775
|
+
case "code":
|
|
2776
|
+
t += this.renderer.code(i);
|
|
2777
|
+
break;
|
|
2778
|
+
case "table":
|
|
2779
|
+
t += this.renderer.table(i);
|
|
2780
|
+
break;
|
|
2781
|
+
case "blockquote":
|
|
2782
|
+
t += this.renderer.blockquote(i);
|
|
2783
|
+
break;
|
|
2784
|
+
case "list":
|
|
2785
|
+
t += this.renderer.list(i);
|
|
2786
|
+
break;
|
|
2787
|
+
case "checkbox":
|
|
2788
|
+
t += this.renderer.checkbox(i);
|
|
2789
|
+
break;
|
|
2790
|
+
case "html":
|
|
2791
|
+
t += this.renderer.html(i);
|
|
2792
|
+
break;
|
|
2793
|
+
case "def":
|
|
2794
|
+
t += this.renderer.def(i);
|
|
2795
|
+
break;
|
|
2796
|
+
case "paragraph":
|
|
2797
|
+
t += this.renderer.paragraph(i);
|
|
2798
|
+
break;
|
|
2799
|
+
case "text":
|
|
2800
|
+
t += this.renderer.text(i);
|
|
2801
|
+
break;
|
|
2802
|
+
default: {
|
|
2803
|
+
let s = "Token with \"" + i.type + "\" type was not found.";
|
|
2804
|
+
if (this.options.silent) return console.error(s), "";
|
|
2805
|
+
throw new Error(s);
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
return t;
|
|
2810
|
+
}
|
|
2811
|
+
parseInline(e, t = this.renderer) {
|
|
2812
|
+
this.renderer.parser = this;
|
|
2813
|
+
let n = "";
|
|
2814
|
+
for (let r = 0; r < e.length; r++) {
|
|
2815
|
+
let i = e[r];
|
|
2816
|
+
if (this.options.extensions?.renderers?.[i.type]) {
|
|
2817
|
+
let a = this.options.extensions.renderers[i.type].call({ parser: this }, i);
|
|
2818
|
+
if (a !== !1 || ![
|
|
2819
|
+
"escape",
|
|
2820
|
+
"html",
|
|
2821
|
+
"link",
|
|
2822
|
+
"image",
|
|
2823
|
+
"strong",
|
|
2824
|
+
"em",
|
|
2825
|
+
"codespan",
|
|
2826
|
+
"br",
|
|
2827
|
+
"del",
|
|
2828
|
+
"text"
|
|
2829
|
+
].includes(i.type)) {
|
|
2830
|
+
n += a || "";
|
|
2831
|
+
continue;
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
let s = i;
|
|
2835
|
+
switch (s.type) {
|
|
2836
|
+
case "escape":
|
|
2837
|
+
n += t.text(s);
|
|
2838
|
+
break;
|
|
2839
|
+
case "html":
|
|
2840
|
+
n += t.html(s);
|
|
2841
|
+
break;
|
|
2842
|
+
case "link":
|
|
2843
|
+
n += t.link(s);
|
|
2844
|
+
break;
|
|
2845
|
+
case "image":
|
|
2846
|
+
n += t.image(s);
|
|
2847
|
+
break;
|
|
2848
|
+
case "checkbox":
|
|
2849
|
+
n += t.checkbox(s);
|
|
2850
|
+
break;
|
|
2851
|
+
case "strong":
|
|
2852
|
+
n += t.strong(s);
|
|
2853
|
+
break;
|
|
2854
|
+
case "em":
|
|
2855
|
+
n += t.em(s);
|
|
2856
|
+
break;
|
|
2857
|
+
case "codespan":
|
|
2858
|
+
n += t.codespan(s);
|
|
2859
|
+
break;
|
|
2860
|
+
case "br":
|
|
2861
|
+
n += t.br(s);
|
|
2862
|
+
break;
|
|
2863
|
+
case "del":
|
|
2864
|
+
n += t.del(s);
|
|
2865
|
+
break;
|
|
2866
|
+
case "text":
|
|
2867
|
+
n += t.text(s);
|
|
2868
|
+
break;
|
|
2869
|
+
default: {
|
|
2870
|
+
let a = "Token with \"" + s.type + "\" type was not found.";
|
|
2871
|
+
if (this.options.silent) return console.error(a), "";
|
|
2872
|
+
throw new Error(a);
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
}
|
|
2876
|
+
return n;
|
|
2877
|
+
}
|
|
2878
|
+
};
|
|
2879
|
+
var P = (_Class = class {
|
|
2880
|
+
constructor(e) {
|
|
2881
|
+
_defineProperty(this, "options", void 0);
|
|
2882
|
+
_defineProperty(this, "block", void 0);
|
|
2883
|
+
this.options = e || T;
|
|
2884
|
+
}
|
|
2885
|
+
preprocess(e) {
|
|
2886
|
+
return e;
|
|
2887
|
+
}
|
|
2888
|
+
postprocess(e) {
|
|
2889
|
+
return e;
|
|
2890
|
+
}
|
|
2891
|
+
processAllTokens(e) {
|
|
2892
|
+
return e;
|
|
2893
|
+
}
|
|
2894
|
+
emStrongMask(e) {
|
|
2895
|
+
return e;
|
|
2896
|
+
}
|
|
2897
|
+
provideLexer() {
|
|
2898
|
+
return this.block ? x.lex : x.lexInline;
|
|
2899
|
+
}
|
|
2900
|
+
provideParser() {
|
|
2901
|
+
return this.block ? b.parse : b.parseInline;
|
|
2902
|
+
}
|
|
2903
|
+
}, _defineProperty(_Class, "passThroughHooks", new Set([
|
|
2904
|
+
"preprocess",
|
|
2905
|
+
"postprocess",
|
|
2906
|
+
"processAllTokens",
|
|
2907
|
+
"emStrongMask"
|
|
2908
|
+
])), _defineProperty(_Class, "passThroughHooksRespectAsync", new Set([
|
|
2909
|
+
"preprocess",
|
|
2910
|
+
"postprocess",
|
|
2911
|
+
"processAllTokens"
|
|
2912
|
+
])), _Class);
|
|
2913
|
+
var D = class {
|
|
2914
|
+
constructor(...e) {
|
|
2915
|
+
_defineProperty(this, "defaults", M());
|
|
2916
|
+
_defineProperty(this, "options", this.setOptions);
|
|
2917
|
+
_defineProperty(this, "parse", this.parseMarkdown(!0));
|
|
2918
|
+
_defineProperty(this, "parseInline", this.parseMarkdown(!1));
|
|
2919
|
+
_defineProperty(this, "Parser", b);
|
|
2920
|
+
_defineProperty(this, "Renderer", y);
|
|
2921
|
+
_defineProperty(this, "TextRenderer", $);
|
|
2922
|
+
_defineProperty(this, "Lexer", x);
|
|
2923
|
+
_defineProperty(this, "Tokenizer", w);
|
|
2924
|
+
_defineProperty(this, "Hooks", P);
|
|
2925
|
+
this.use(...e);
|
|
2926
|
+
}
|
|
2927
|
+
walkTokens(e, t) {
|
|
2928
|
+
let n = [];
|
|
2929
|
+
for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
|
|
2930
|
+
case "table": {
|
|
2931
|
+
let i = r;
|
|
2932
|
+
for (let s of i.header) n = n.concat(this.walkTokens(s.tokens, t));
|
|
2933
|
+
for (let s of i.rows) for (let a of s) n = n.concat(this.walkTokens(a.tokens, t));
|
|
2934
|
+
break;
|
|
2935
|
+
}
|
|
2936
|
+
case "list": {
|
|
2937
|
+
let i = r;
|
|
2938
|
+
n = n.concat(this.walkTokens(i.items, t));
|
|
2939
|
+
break;
|
|
2940
|
+
}
|
|
2941
|
+
default: {
|
|
2942
|
+
let i = r;
|
|
2943
|
+
this.defaults.extensions?.childTokens?.[i.type] ? this.defaults.extensions.childTokens[i.type].forEach((s) => {
|
|
2944
|
+
let a = i[s].flat(Infinity);
|
|
2945
|
+
n = n.concat(this.walkTokens(a, t));
|
|
2946
|
+
}) : i.tokens && (n = n.concat(this.walkTokens(i.tokens, t)));
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2949
|
+
return n;
|
|
2950
|
+
}
|
|
2951
|
+
use(...e) {
|
|
2952
|
+
let t = this.defaults.extensions || {
|
|
2953
|
+
renderers: {},
|
|
2954
|
+
childTokens: {}
|
|
2955
|
+
};
|
|
2956
|
+
return e.forEach((n) => {
|
|
2957
|
+
let r = { ...n };
|
|
2958
|
+
if (r.async = this.defaults.async || r.async || !1, n.extensions && (n.extensions.forEach((i) => {
|
|
2959
|
+
if (!i.name) throw new Error("extension name required");
|
|
2960
|
+
if ("renderer" in i) {
|
|
2961
|
+
let s = t.renderers[i.name];
|
|
2962
|
+
s ? t.renderers[i.name] = function(...a) {
|
|
2963
|
+
let o = i.renderer.apply(this, a);
|
|
2964
|
+
return o === !1 && (o = s.apply(this, a)), o;
|
|
2965
|
+
} : t.renderers[i.name] = i.renderer;
|
|
2966
|
+
}
|
|
2967
|
+
if ("tokenizer" in i) {
|
|
2968
|
+
if (!i.level || i.level !== "block" && i.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
2969
|
+
let s = t[i.level];
|
|
2970
|
+
s ? s.unshift(i.tokenizer) : t[i.level] = [i.tokenizer], i.start && (i.level === "block" ? t.startBlock ? t.startBlock.push(i.start) : t.startBlock = [i.start] : i.level === "inline" && (t.startInline ? t.startInline.push(i.start) : t.startInline = [i.start]));
|
|
2971
|
+
}
|
|
2972
|
+
"childTokens" in i && i.childTokens && (t.childTokens[i.name] = i.childTokens);
|
|
2973
|
+
}), r.extensions = t), n.renderer) {
|
|
2974
|
+
let i = this.defaults.renderer || new y(this.defaults);
|
|
2975
|
+
for (let s in n.renderer) {
|
|
2976
|
+
if (!(s in i)) throw new Error(`renderer '${s}' does not exist`);
|
|
2977
|
+
if (["options", "parser"].includes(s)) continue;
|
|
2978
|
+
let a = s, o = n.renderer[a], l = i[a];
|
|
2979
|
+
i[a] = (...p) => {
|
|
2980
|
+
let c = o.apply(i, p);
|
|
2981
|
+
return c === !1 && (c = l.apply(i, p)), c || "";
|
|
2982
|
+
};
|
|
2983
|
+
}
|
|
2984
|
+
r.renderer = i;
|
|
2985
|
+
}
|
|
2986
|
+
if (n.tokenizer) {
|
|
2987
|
+
let i = this.defaults.tokenizer || new w(this.defaults);
|
|
2988
|
+
for (let s in n.tokenizer) {
|
|
2989
|
+
if (!(s in i)) throw new Error(`tokenizer '${s}' does not exist`);
|
|
2990
|
+
if ([
|
|
2991
|
+
"options",
|
|
2992
|
+
"rules",
|
|
2993
|
+
"lexer"
|
|
2994
|
+
].includes(s)) continue;
|
|
2995
|
+
let a = s, o = n.tokenizer[a], l = i[a];
|
|
2996
|
+
i[a] = (...p) => {
|
|
2997
|
+
let c = o.apply(i, p);
|
|
2998
|
+
return c === !1 && (c = l.apply(i, p)), c;
|
|
2999
|
+
};
|
|
3000
|
+
}
|
|
3001
|
+
r.tokenizer = i;
|
|
3002
|
+
}
|
|
3003
|
+
if (n.hooks) {
|
|
3004
|
+
let i = this.defaults.hooks || new P();
|
|
3005
|
+
for (let s in n.hooks) {
|
|
3006
|
+
if (!(s in i)) throw new Error(`hook '${s}' does not exist`);
|
|
3007
|
+
if (["options", "block"].includes(s)) continue;
|
|
3008
|
+
let a = s, o = n.hooks[a], l = i[a];
|
|
3009
|
+
P.passThroughHooks.has(s) ? i[a] = (p) => {
|
|
3010
|
+
if (this.defaults.async && P.passThroughHooksRespectAsync.has(s)) return (async () => {
|
|
3011
|
+
let d = await o.call(i, p);
|
|
3012
|
+
return l.call(i, d);
|
|
3013
|
+
})();
|
|
3014
|
+
let c = o.call(i, p);
|
|
3015
|
+
return l.call(i, c);
|
|
3016
|
+
} : i[a] = (...p) => {
|
|
3017
|
+
if (this.defaults.async) return (async () => {
|
|
3018
|
+
let d = await o.apply(i, p);
|
|
3019
|
+
return d === !1 && (d = await l.apply(i, p)), d;
|
|
3020
|
+
})();
|
|
3021
|
+
let c = o.apply(i, p);
|
|
3022
|
+
return c === !1 && (c = l.apply(i, p)), c;
|
|
3023
|
+
};
|
|
3024
|
+
}
|
|
3025
|
+
r.hooks = i;
|
|
3026
|
+
}
|
|
3027
|
+
if (n.walkTokens) {
|
|
3028
|
+
let i = this.defaults.walkTokens, s = n.walkTokens;
|
|
3029
|
+
r.walkTokens = function(a) {
|
|
3030
|
+
let o = [];
|
|
3031
|
+
return o.push(s.call(this, a)), i && (o = o.concat(i.call(this, a))), o;
|
|
3032
|
+
};
|
|
3033
|
+
}
|
|
3034
|
+
this.defaults = {
|
|
3035
|
+
...this.defaults,
|
|
3036
|
+
...r
|
|
3037
|
+
};
|
|
3038
|
+
}), this;
|
|
3039
|
+
}
|
|
3040
|
+
setOptions(e) {
|
|
3041
|
+
return this.defaults = {
|
|
3042
|
+
...this.defaults,
|
|
3043
|
+
...e
|
|
3044
|
+
}, this;
|
|
3045
|
+
}
|
|
3046
|
+
lexer(e, t) {
|
|
3047
|
+
return x.lex(e, t ?? this.defaults);
|
|
3048
|
+
}
|
|
3049
|
+
parser(e, t) {
|
|
3050
|
+
return b.parse(e, t ?? this.defaults);
|
|
3051
|
+
}
|
|
3052
|
+
parseMarkdown(e) {
|
|
3053
|
+
return (n, r) => {
|
|
3054
|
+
let i = { ...r }, s = {
|
|
3055
|
+
...this.defaults,
|
|
3056
|
+
...i
|
|
3057
|
+
}, a = this.onError(!!s.silent, !!s.async);
|
|
3058
|
+
if (this.defaults.async === !0 && i.async === !1) return a(/* @__PURE__ */ new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
3059
|
+
if (typeof n > "u" || n === null) return a(/* @__PURE__ */ new Error("marked(): input parameter is undefined or null"));
|
|
3060
|
+
if (typeof n != "string") return a(/* @__PURE__ */ new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
3061
|
+
if (s.hooks && (s.hooks.options = s, s.hooks.block = e), s.async) return (async () => {
|
|
3062
|
+
let o = s.hooks ? await s.hooks.preprocess(n) : n, p = await (s.hooks ? await s.hooks.provideLexer() : e ? x.lex : x.lexInline)(o, s), c = s.hooks ? await s.hooks.processAllTokens(p) : p;
|
|
3063
|
+
s.walkTokens && await Promise.all(this.walkTokens(c, s.walkTokens));
|
|
3064
|
+
let h = await (s.hooks ? await s.hooks.provideParser() : e ? b.parse : b.parseInline)(c, s);
|
|
3065
|
+
return s.hooks ? await s.hooks.postprocess(h) : h;
|
|
3066
|
+
})().catch(a);
|
|
3067
|
+
try {
|
|
3068
|
+
s.hooks && (n = s.hooks.preprocess(n));
|
|
3069
|
+
let l = (s.hooks ? s.hooks.provideLexer() : e ? x.lex : x.lexInline)(n, s);
|
|
3070
|
+
s.hooks && (l = s.hooks.processAllTokens(l)), s.walkTokens && this.walkTokens(l, s.walkTokens);
|
|
3071
|
+
let c = (s.hooks ? s.hooks.provideParser() : e ? b.parse : b.parseInline)(l, s);
|
|
3072
|
+
return s.hooks && (c = s.hooks.postprocess(c)), c;
|
|
3073
|
+
} catch (o) {
|
|
3074
|
+
return a(o);
|
|
3075
|
+
}
|
|
3076
|
+
};
|
|
3077
|
+
}
|
|
3078
|
+
onError(e, t) {
|
|
3079
|
+
return (n) => {
|
|
3080
|
+
if (n.message += `
|
|
3081
|
+
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
3082
|
+
let r = "<p>An error occurred:</p><pre>" + O(n.message + "", !0) + "</pre>";
|
|
3083
|
+
return t ? Promise.resolve(r) : r;
|
|
3084
|
+
}
|
|
3085
|
+
if (t) return Promise.reject(n);
|
|
3086
|
+
throw n;
|
|
3087
|
+
};
|
|
3088
|
+
}
|
|
3089
|
+
};
|
|
3090
|
+
var L = new D();
|
|
3091
|
+
function g(u, e) {
|
|
3092
|
+
return L.parse(u, e);
|
|
3093
|
+
}
|
|
3094
|
+
g.options = g.setOptions = function(u) {
|
|
3095
|
+
return L.setOptions(u), g.defaults = L.defaults, G(g.defaults), g;
|
|
3096
|
+
};
|
|
3097
|
+
g.getDefaults = M;
|
|
3098
|
+
g.defaults = T;
|
|
3099
|
+
g.use = function(...u) {
|
|
3100
|
+
return L.use(...u), g.defaults = L.defaults, G(g.defaults), g;
|
|
3101
|
+
};
|
|
3102
|
+
g.walkTokens = function(u, e) {
|
|
3103
|
+
return L.walkTokens(u, e);
|
|
3104
|
+
};
|
|
3105
|
+
g.parseInline = L.parseInline;
|
|
3106
|
+
g.Parser = b;
|
|
3107
|
+
g.parser = b.parse;
|
|
3108
|
+
g.Renderer = y;
|
|
3109
|
+
g.TextRenderer = $;
|
|
3110
|
+
g.Lexer = x;
|
|
3111
|
+
g.lexer = x.lex;
|
|
3112
|
+
g.Tokenizer = w;
|
|
3113
|
+
g.Hooks = P;
|
|
3114
|
+
g.parse = g;
|
|
3115
|
+
g.options;
|
|
3116
|
+
g.setOptions;
|
|
3117
|
+
g.use;
|
|
3118
|
+
g.walkTokens;
|
|
3119
|
+
g.parseInline;
|
|
3120
|
+
b.parse;
|
|
3121
|
+
x.lex;
|
|
3122
|
+
//#endregion
|
|
3123
|
+
//#region src/shared/richText/richText.tsx
|
|
3124
|
+
function normalizeAnchorSpacing(content) {
|
|
3125
|
+
return content.replace(/([^\s>])(<a\b)/gu, "$1\xA0$2").replace(/(<\/a>)([\p{L}\p{N}])/gu, "$1\xA0$2");
|
|
3126
|
+
}
|
|
3127
|
+
function decorateAnchors(content) {
|
|
3128
|
+
const doc = new DOMParser().parseFromString(content, "text/html");
|
|
3129
|
+
const anchors = Array.from(doc.querySelectorAll("a"));
|
|
3130
|
+
for (const anchor of anchors) {
|
|
3131
|
+
anchor.setAttribute("target", "_blank");
|
|
3132
|
+
anchor.setAttribute("rel", "noopener noreferrer");
|
|
3133
|
+
}
|
|
3134
|
+
return doc.body.innerHTML;
|
|
3135
|
+
}
|
|
3136
|
+
function sanitizeHtml(content, disallowedTags) {
|
|
3137
|
+
const normalizedContent = normalizeAnchorSpacing(content);
|
|
3138
|
+
const parsed = g.parse(normalizedContent);
|
|
3139
|
+
return decorateAnchors(purify.sanitize(parsed, { FORBID_TAGS: disallowedTags }));
|
|
3140
|
+
}
|
|
3141
|
+
function RichText({ content, class: className, disallowedTags = [] }) {
|
|
3142
|
+
if (!content) return null;
|
|
3143
|
+
return /* @__PURE__ */ u("div", {
|
|
3144
|
+
class: className,
|
|
3145
|
+
children: /* @__PURE__ */ u(preact_markup_module_default, {
|
|
3146
|
+
markup: sanitizeHtml(content, disallowedTags),
|
|
3147
|
+
type: "html",
|
|
3148
|
+
trim: false
|
|
3149
|
+
})
|
|
3150
|
+
});
|
|
3151
|
+
}
|
|
3152
|
+
//#endregion
|
|
3153
|
+
export { RichText as t };
|