@incodetech/web 0.0.0-dev-20260403-eccc51c → 0.0.0-dev-20260407-4677d7f
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/AsYouType-DPWqJvFu.js +2482 -0
- package/dist/addressAutocomplete-t809rK3N.js +108 -0
- package/dist/aligndevicelottie-C9xl1spu.js +12757 -0
- package/dist/antifraud/antifraud.es.js +17 -18
- package/dist/antifraud/styles.css +1 -1
- package/dist/authentication/authentication.es.js +28 -50
- package/dist/back-horizontal-hint-Be3dUGk6.js +137 -0
- package/dist/back-tutorial-BNTyW-1N.js +14584 -0
- package/dist/back-vertical-hint-Bz_rnhd-.js +128 -0
- package/dist/backdevicelottie-DBB1YCtW.js +16678 -0
- package/dist/base.css +327 -67
- package/dist/blurdevicelottie-9WvZCZ6C.js +15939 -0
- package/dist/browser-ponyfill-B4Qc6yfW.js +299 -0
- package/dist/button-DrtZRYJX.js +123 -0
- package/dist/checkbox-kZerHUek.js +85 -0
- package/dist/consent/consent.es.js +82 -89
- package/dist/consent/styles.css +1 -1
- package/dist/countries-y2ydYDhN.js +8323 -0
- package/dist/curp-validation/curp-validation.es.js +271 -313
- package/dist/curp-validation/styles.css +1 -1
- package/dist/dateInputComposed-9zbxhNlX.js +94 -0
- package/dist/dateInputComposed-B36DI9FJ.js +2 -0
- package/dist/defineProperty-brqHEHA_.js +39 -0
- package/dist/document-capture/styles.css +1 -1
- package/dist/documentCapture-CY-g1OUT.js +784 -0
- package/dist/dropdownComposed-CWxUwv7E.js +258 -0
- package/dist/ekyb/ekyb.es.js +2 -0
- package/dist/ekyb/styles.css +1 -1
- package/dist/ekybModule-DGOhCY0S.js +286 -0
- package/dist/ekybModule-mBTq_Apn.js +2 -0
- package/dist/ekyc/ekyc.es.js +2 -0
- package/dist/ekyc/styles.css +1 -1
- package/dist/ekycModule-DZlqb6Bc.js +2 -0
- package/dist/ekycModule-rJxf46TS.js +233 -0
- package/dist/email/email.es.js +110 -154
- package/dist/email/styles.css +1 -1
- package/dist/extensibility-CcUfegWj.js +2248 -0
- package/dist/extensibility.es.js +22 -150
- package/dist/face-match/styles.css +147 -73
- package/dist/faceMatch-K9k9f1HF.js +191 -0
- package/dist/flip-animation-DOJzdXB-.js +6983 -0
- package/dist/flow/flow.es.js +2274 -2613
- package/dist/flow/styles.css +432 -73
- package/dist/formField-BBfAFfVZ.js +100 -0
- package/dist/front-horizontal-hint-aGAhadA2.js +380 -0
- package/dist/front-vertical-hint-DZz1VeNp.js +420 -0
- package/dist/frontdevicelottie-DadDp6be.js +17302 -0
- package/dist/geolocation/geolocation.es.js +852 -832
- package/dist/geolocation/styles.css +1 -1
- package/dist/glaredevicelottie-BfI84cPw.js +14466 -0
- package/dist/governmentValidation/governmentValidation.es.js +100 -106
- package/dist/governmentValidation/styles.css +1 -1
- package/dist/i18n-DZOHbK9q.js +1916 -0
- package/dist/icons-BHbofCgJ.js +245 -0
- package/dist/id/id.es.js +53 -59
- package/dist/id/styles.css +1 -1
- package/dist/id-laser-h-BWyU3VgL.js +467 -0
- package/dist/id-laser-v-JiWXUlv0.js +467 -0
- package/dist/id-tutorial-Cc9xg5_J.js +13152 -0
- package/dist/incodeModule-Bf6yJ8RB.js +18 -0
- package/dist/index.es.js +4 -25
- package/dist/inputComposed-rPAh6ptN.js +77 -0
- package/dist/loadingIcon-BDMR5L6z.js +147 -0
- package/dist/mandatoryConsent-ohmxTqe7.js +101 -0
- package/dist/numberedStep-CQVRixRP.js +11 -0
- package/dist/otpInput-DRZiayDi.js +143 -0
- package/dist/page-M9yWRw73.js +61 -0
- package/dist/passport-horizontal-hint-CFsGs7Dp.js +293 -0
- package/dist/passport-tutorial-z0LN7Hsp.js +11688 -0
- package/dist/passport-vertical-hint-BnCpKWeN.js +267 -0
- package/dist/phone/phone.es.js +87 -121
- package/dist/phone/styles.css +1 -1
- package/dist/phoneInput-C9T_8FJt.js +138 -0
- package/dist/phoneInputComposed-CXTXBQ0B.js +407 -0
- package/dist/processing-yJ5QEgaC.js +15 -0
- package/dist/redirect-to-mobile/styles.css +1 -1
- package/dist/richText-Db0PfpkE.js +1973 -0
- package/dist/rolldown-runtime-CjdbFOpI.js +13 -0
- package/dist/selfie/selfie.es.js +29 -50
- package/dist/selfie/styles.css +170 -66
- package/dist/selfieTutorial-B0MIyPrk.js +2676 -0
- package/dist/setup-Dq2bzNKH.js +15 -0
- package/dist/signature/signature.es.js +557 -707
- package/dist/signature/styles.css +1 -1
- package/dist/spacer-DCljE53A.js +59 -0
- package/dist/spinner-BK2pIUzB.js +41 -0
- package/dist/spinner-DjG-sUzI.js +1 -0
- package/dist/successIcon-AHrfmJvv.js +17 -0
- package/dist/tutorial-C2kSUHWe.js +2781 -0
- package/dist/types/ekyb.d.ts +29 -0
- package/dist/types/ekyc.d.ts +29 -0
- package/dist/types/extensibility.d.ts +3 -5
- package/dist/types/flow.d.ts +1 -1
- package/dist/types/index.d.ts +2 -10
- package/dist/typography-BQrJwR60.js +1 -0
- package/dist/typography-BtyuWjzC.js +29 -0
- package/dist/uiConfig-CwpQ-IM6.js +20 -0
- package/dist/vendor-preact-D6SntenC.js +958 -0
- package/dist/warningIcon-Cvj-ayg1.js +17 -0
- package/package.json +8 -11
- package/dist/AsYouType-D1H_js4X.js +0 -2607
- package/dist/Trans-aTzdT_SA.js +0 -55
- package/dist/addressAutocomplete-C8-wL1j_.js +0 -153
- package/dist/aligndevicelottie-DlQCRPfM.js +0 -29
- package/dist/back-horizontal-hint-CSlf9KI1.js +0 -5
- package/dist/back-tutorial-An9AcMSe.js +0 -29
- package/dist/back-vertical-hint-CNieqiCr.js +0 -5
- package/dist/backdevicelottie-B4NgyWmX.js +0 -29
- package/dist/blurdevicelottie-_BZRug1c.js +0 -29
- package/dist/browser-ponyfill-B6W6hHVY.js +0 -344
- package/dist/button-CE9kRlem.js +0 -184
- package/dist/cameraView-C2X7klNb.js +0 -55
- package/dist/captureOverlay-tCb4R4WE.js +0 -592
- package/dist/checkbox-B5X-mfqq.js +0 -137
- package/dist/chevronDown-DSHaPKbi.js +0 -23
- package/dist/closeIcon-9Hc97omv.js +0 -28
- package/dist/countries-DfLkrF0x.js +0 -616
- package/dist/dateInputComposed-C7PCzh-U.js +0 -173
- package/dist/documentCapture-C0mO-RGE.js +0 -692
- package/dist/dropdownComposed-BpinYlrx.js +0 -367
- package/dist/ekybModule-Dr6LJUg-.js +0 -357
- package/dist/ekycModule-C3mswduI.js +0 -291
- package/dist/errorContent-Cb8nmQAE.js +0 -44
- package/dist/errorIcon-DEARBrGx.js +0 -26
- package/dist/faceMatch-DbDp7D3d.js +0 -237
- package/dist/fileIcon-CCSvS10T.js +0 -52
- package/dist/flip-animation-COR596wy.js +0 -29
- package/dist/flipAnimation-BqV462TA.js +0 -2059
- package/dist/formField-CP6wDdfA.js +0 -106
- package/dist/front-horizontal-hint-lRLKd7vY.js +0 -7
- package/dist/front-vertical-hint-qQoJXRE3.js +0 -7
- package/dist/frontdevicelottie-KhKxT5n9.js +0 -29
- package/dist/glaredevicelottie-DLuIStvb.js +0 -29
- package/dist/id-laser-h-BBV3r3rz.js +0 -29
- package/dist/id-laser-v-BTHJaSfx.js +0 -29
- package/dist/id-tutorial-B-F5Q28m.js +0 -29
- package/dist/incodeModule-C4XIllao.js +0 -96
- package/dist/inputComposed-fUbAGrDy.js +0 -103
- package/dist/instance-BWYzq8dk.js +0 -2163
- package/dist/loadingIcon-DmuPXh70.js +0 -195
- package/dist/mandatoryConsent-5xPI0cor.js +0 -94
- package/dist/manualCaptureButton-BvFmTyJe.js +0 -372
- package/dist/numberedStep-DwUB__mh.js +0 -5
- package/dist/otpInput-BFXhqFRT.js +0 -156
- package/dist/page-SrUl0qtN.js +0 -69
- package/dist/passport-horizontal-hint-BCtpMp1Y.js +0 -5
- package/dist/passport-tutorial-CaYBFTqt.js +0 -29
- package/dist/passport-vertical-hint-GaLnzqHP.js +0 -5
- package/dist/permissions-DT4Fz9MR.js +0 -709
- package/dist/phoneInput-CGr8TxOO.js +0 -158
- package/dist/phoneInputComposed-Cm9O2Jba.js +0 -206
- package/dist/processing-szVOCQwZ.js +0 -19
- package/dist/richText-cspvNz2a.js +0 -1807
- package/dist/selfieTutorial-Dm_p0ke9.js +0 -29
- package/dist/spinner-DygONskw.js +0 -60
- package/dist/successIcon-Bjsdc4lF.js +0 -26
- package/dist/tutorial-Cdz1025D.js +0 -473
- package/dist/types/ekyb/styles.d.ts +0 -1
- package/dist/types/ekyc/styles.d.ts +0 -1
- package/dist/typography-BDACYR5i.js +0 -14
- package/dist/uiConfig-Dnt-2YWB.js +0 -23
- package/dist/useMediaQuery-lJdQBmC2.js +0 -18
- package/dist/vendor-preact-BoMmvSgn.js +0 -694
- package/dist/warningIcon-DQq_MrOB.js +0 -26
|
@@ -1,1807 +0,0 @@
|
|
|
1
|
-
var Zn = Object.defineProperty;
|
|
2
|
-
var jn = (r, e, t) => e in r ? Zn(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
-
var A = (r, e, t) => jn(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { u as an } from "./loadingIcon-DmuPXh70.js";
|
|
5
|
-
import { _ as Yn, x as Xn } from "./vendor-preact-BoMmvSgn.js";
|
|
6
|
-
const {
|
|
7
|
-
entries: yn,
|
|
8
|
-
setPrototypeOf: on,
|
|
9
|
-
isFrozen: Qn,
|
|
10
|
-
getPrototypeOf: Vn,
|
|
11
|
-
getOwnPropertyDescriptor: Kn
|
|
12
|
-
} = Object;
|
|
13
|
-
let {
|
|
14
|
-
freeze: z,
|
|
15
|
-
seal: q,
|
|
16
|
-
create: Ve
|
|
17
|
-
} = Object, {
|
|
18
|
-
apply: _t,
|
|
19
|
-
construct: yt
|
|
20
|
-
} = typeof Reflect < "u" && Reflect;
|
|
21
|
-
z || (z = function(e) {
|
|
22
|
-
return e;
|
|
23
|
-
});
|
|
24
|
-
q || (q = function(e) {
|
|
25
|
-
return e;
|
|
26
|
-
});
|
|
27
|
-
_t || (_t = function(e, t) {
|
|
28
|
-
for (var s = arguments.length, n = new Array(s > 2 ? s - 2 : 0), a = 2; a < s; a++)
|
|
29
|
-
n[a - 2] = arguments[a];
|
|
30
|
-
return e.apply(t, n);
|
|
31
|
-
});
|
|
32
|
-
yt || (yt = function(e) {
|
|
33
|
-
for (var t = arguments.length, s = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
|
|
34
|
-
s[n - 1] = arguments[n];
|
|
35
|
-
return new e(...s);
|
|
36
|
-
});
|
|
37
|
-
const je = $(Array.prototype.forEach), Jn = $(Array.prototype.lastIndexOf), cn = $(Array.prototype.pop), Ce = $(Array.prototype.push), er = $(Array.prototype.splice), Ke = $(String.prototype.toLowerCase), kt = $(String.prototype.toString), bt = $(String.prototype.match), De = $(String.prototype.replace), tr = $(String.prototype.indexOf), nr = $(String.prototype.trim), G = $(Object.prototype.hasOwnProperty), M = $(RegExp.prototype.test), Ie = rr(TypeError);
|
|
38
|
-
function $(r) {
|
|
39
|
-
return function(e) {
|
|
40
|
-
e instanceof RegExp && (e.lastIndex = 0);
|
|
41
|
-
for (var t = arguments.length, s = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
|
|
42
|
-
s[n - 1] = arguments[n];
|
|
43
|
-
return _t(r, e, s);
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function rr(r) {
|
|
47
|
-
return function() {
|
|
48
|
-
for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
|
|
49
|
-
t[s] = arguments[s];
|
|
50
|
-
return yt(r, t);
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function k(r, e) {
|
|
54
|
-
let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Ke;
|
|
55
|
-
on && on(r, null);
|
|
56
|
-
let s = e.length;
|
|
57
|
-
for (; s--; ) {
|
|
58
|
-
let n = e[s];
|
|
59
|
-
if (typeof n == "string") {
|
|
60
|
-
const a = t(n);
|
|
61
|
-
a !== n && (Qn(e) || (e[s] = a), n = a);
|
|
62
|
-
}
|
|
63
|
-
r[n] = !0;
|
|
64
|
-
}
|
|
65
|
-
return r;
|
|
66
|
-
}
|
|
67
|
-
function sr(r) {
|
|
68
|
-
for (let e = 0; e < r.length; e++)
|
|
69
|
-
G(r, e) || (r[e] = null);
|
|
70
|
-
return r;
|
|
71
|
-
}
|
|
72
|
-
function J(r) {
|
|
73
|
-
const e = Ve(null);
|
|
74
|
-
for (const [t, s] of yn(r))
|
|
75
|
-
G(r, t) && (Array.isArray(s) ? e[t] = sr(s) : s && typeof s == "object" && s.constructor === Object ? e[t] = J(s) : e[t] = s);
|
|
76
|
-
return e;
|
|
77
|
-
}
|
|
78
|
-
function Oe(r, e) {
|
|
79
|
-
for (; r !== null; ) {
|
|
80
|
-
const s = Kn(r, e);
|
|
81
|
-
if (s) {
|
|
82
|
-
if (s.get)
|
|
83
|
-
return $(s.get);
|
|
84
|
-
if (typeof s.value == "function")
|
|
85
|
-
return $(s.value);
|
|
86
|
-
}
|
|
87
|
-
r = Vn(r);
|
|
88
|
-
}
|
|
89
|
-
function t() {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
return t;
|
|
93
|
-
}
|
|
94
|
-
const pn = z(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), xt = z(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Tt = z(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), ir = z(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), wt = z(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), lr = z(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), un = z(["#text"]), hn = z(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), At = z(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), fn = z(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Ye = z(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), ar = q(/\{\{[\w\W]*|[\w\W]*\}\}/gm), or = q(/<%[\w\W]*|[\w\W]*%>/gm), cr = q(/\$\{[\w\W]*/gm), pr = q(/^data-[\-\w.\u00B7-\uFFFF]+$/), ur = q(/^aria-[\-\w]+$/), En = q(
|
|
95
|
-
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
96
|
-
// eslint-disable-line no-useless-escape
|
|
97
|
-
), hr = q(/^(?:\w+script|data):/i), fr = q(
|
|
98
|
-
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
99
|
-
// eslint-disable-line no-control-regex
|
|
100
|
-
), Sn = q(/^html$/i), gr = q(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
101
|
-
var gn = /* @__PURE__ */ Object.freeze({
|
|
102
|
-
__proto__: null,
|
|
103
|
-
ARIA_ATTR: ur,
|
|
104
|
-
ATTR_WHITESPACE: fr,
|
|
105
|
-
CUSTOM_ELEMENT: gr,
|
|
106
|
-
DATA_ATTR: pr,
|
|
107
|
-
DOCTYPE_NAME: Sn,
|
|
108
|
-
ERB_EXPR: or,
|
|
109
|
-
IS_ALLOWED_URI: En,
|
|
110
|
-
IS_SCRIPT_OR_DATA: hr,
|
|
111
|
-
MUSTACHE_EXPR: ar,
|
|
112
|
-
TMPLIT_EXPR: cr
|
|
113
|
-
});
|
|
114
|
-
const ve = {
|
|
115
|
-
element: 1,
|
|
116
|
-
text: 3,
|
|
117
|
-
// Deprecated
|
|
118
|
-
progressingInstruction: 7,
|
|
119
|
-
comment: 8,
|
|
120
|
-
document: 9
|
|
121
|
-
}, dr = function() {
|
|
122
|
-
return typeof window > "u" ? null : window;
|
|
123
|
-
}, mr = function(e, t) {
|
|
124
|
-
if (typeof e != "object" || typeof e.createPolicy != "function")
|
|
125
|
-
return null;
|
|
126
|
-
let s = null;
|
|
127
|
-
const n = "data-tt-policy-suffix";
|
|
128
|
-
t && t.hasAttribute(n) && (s = t.getAttribute(n));
|
|
129
|
-
const a = "dompurify" + (s ? "#" + s : "");
|
|
130
|
-
try {
|
|
131
|
-
return e.createPolicy(a, {
|
|
132
|
-
createHTML(l) {
|
|
133
|
-
return l;
|
|
134
|
-
},
|
|
135
|
-
createScriptURL(l) {
|
|
136
|
-
return l;
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
} catch {
|
|
140
|
-
return console.warn("TrustedTypes policy " + a + " could not be created."), null;
|
|
141
|
-
}
|
|
142
|
-
}, dn = function() {
|
|
143
|
-
return {
|
|
144
|
-
afterSanitizeAttributes: [],
|
|
145
|
-
afterSanitizeElements: [],
|
|
146
|
-
afterSanitizeShadowDOM: [],
|
|
147
|
-
beforeSanitizeAttributes: [],
|
|
148
|
-
beforeSanitizeElements: [],
|
|
149
|
-
beforeSanitizeShadowDOM: [],
|
|
150
|
-
uponSanitizeAttribute: [],
|
|
151
|
-
uponSanitizeElement: [],
|
|
152
|
-
uponSanitizeShadowNode: []
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
function Rn() {
|
|
156
|
-
let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : dr();
|
|
157
|
-
const e = (g) => Rn(g);
|
|
158
|
-
if (e.version = "3.3.3", e.removed = [], !r || !r.document || r.document.nodeType !== ve.document || !r.Element)
|
|
159
|
-
return e.isSupported = !1, e;
|
|
160
|
-
let {
|
|
161
|
-
document: t
|
|
162
|
-
} = r;
|
|
163
|
-
const s = t, n = s.currentScript, {
|
|
164
|
-
DocumentFragment: a,
|
|
165
|
-
HTMLTemplateElement: l,
|
|
166
|
-
Node: p,
|
|
167
|
-
Element: o,
|
|
168
|
-
NodeFilter: h,
|
|
169
|
-
NamedNodeMap: u = r.NamedNodeMap || r.MozNamedAttrMap,
|
|
170
|
-
HTMLFormElement: m,
|
|
171
|
-
DOMParser: d,
|
|
172
|
-
trustedTypes: T
|
|
173
|
-
} = r, b = o.prototype, D = Oe(b, "cloneNode"), se = Oe(b, "remove"), Z = Oe(b, "nextSibling"), F = Oe(b, "childNodes"), Q = Oe(b, "parentNode");
|
|
174
|
-
if (typeof l == "function") {
|
|
175
|
-
const g = t.createElement("template");
|
|
176
|
-
g.content && g.content.ownerDocument && (t = g.content.ownerDocument);
|
|
177
|
-
}
|
|
178
|
-
let y, v = "";
|
|
179
|
-
const {
|
|
180
|
-
implementation: j,
|
|
181
|
-
createNodeIterator: ie,
|
|
182
|
-
createDocumentFragment: $e,
|
|
183
|
-
getElementsByTagName: ye
|
|
184
|
-
} = t, {
|
|
185
|
-
importNode: pe
|
|
186
|
-
} = s;
|
|
187
|
-
let E = dn();
|
|
188
|
-
e.isSupported = typeof yn == "function" && typeof Q == "function" && j && j.createHTMLDocument !== void 0;
|
|
189
|
-
const {
|
|
190
|
-
MUSTACHE_EXPR: B,
|
|
191
|
-
ERB_EXPR: le,
|
|
192
|
-
TMPLIT_EXPR: ae,
|
|
193
|
-
DATA_ATTR: Ee,
|
|
194
|
-
ARIA_ATTR: it,
|
|
195
|
-
IS_SCRIPT_OR_DATA: ue,
|
|
196
|
-
ATTR_WHITESPACE: H,
|
|
197
|
-
CUSTOM_ELEMENT: oe
|
|
198
|
-
} = gn;
|
|
199
|
-
let {
|
|
200
|
-
IS_ALLOWED_URI: zt
|
|
201
|
-
} = gn, C = null;
|
|
202
|
-
const $t = k({}, [...pn, ...xt, ...Tt, ...wt, ...un]);
|
|
203
|
-
let I = null;
|
|
204
|
-
const Ut = k({}, [...hn, ...At, ...fn, ...Ye]);
|
|
205
|
-
let S = Object.seal(Ve(null, {
|
|
206
|
-
tagNameCheck: {
|
|
207
|
-
writable: !0,
|
|
208
|
-
configurable: !1,
|
|
209
|
-
enumerable: !0,
|
|
210
|
-
value: null
|
|
211
|
-
},
|
|
212
|
-
attributeNameCheck: {
|
|
213
|
-
writable: !0,
|
|
214
|
-
configurable: !1,
|
|
215
|
-
enumerable: !0,
|
|
216
|
-
value: null
|
|
217
|
-
},
|
|
218
|
-
allowCustomizedBuiltInElements: {
|
|
219
|
-
writable: !0,
|
|
220
|
-
configurable: !1,
|
|
221
|
-
enumerable: !0,
|
|
222
|
-
value: !1
|
|
223
|
-
}
|
|
224
|
-
})), Se = null, Ue = null;
|
|
225
|
-
const ce = Object.seal(Ve(null, {
|
|
226
|
-
tagCheck: {
|
|
227
|
-
writable: !0,
|
|
228
|
-
configurable: !1,
|
|
229
|
-
enumerable: !0,
|
|
230
|
-
value: null
|
|
231
|
-
},
|
|
232
|
-
attributeCheck: {
|
|
233
|
-
writable: !0,
|
|
234
|
-
configurable: !1,
|
|
235
|
-
enumerable: !0,
|
|
236
|
-
value: null
|
|
237
|
-
}
|
|
238
|
-
}));
|
|
239
|
-
let Ft = !0, lt = !0, Bt = !1, Ht = !0, ke = !1, Fe = !0, he = !1, at = !1, ot = !1, be = !1, Be = !1, He = !1, Gt = !0, Wt = !1;
|
|
240
|
-
const $n = "user-content-";
|
|
241
|
-
let ct = !0, Re = !1, xe = {}, V = null;
|
|
242
|
-
const pt = k({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
|
|
243
|
-
let qt = null;
|
|
244
|
-
const Zt = k({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
245
|
-
let ut = null;
|
|
246
|
-
const jt = k({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), Ge = "http://www.w3.org/1998/Math/MathML", We = "http://www.w3.org/2000/svg", te = "http://www.w3.org/1999/xhtml";
|
|
247
|
-
let Te = te, ht = !1, ft = null;
|
|
248
|
-
const Un = k({}, [Ge, We, te], kt);
|
|
249
|
-
let qe = k({}, ["mi", "mo", "mn", "ms", "mtext"]), Ze = k({}, ["annotation-xml"]);
|
|
250
|
-
const Fn = k({}, ["title", "style", "font", "a", "script"]);
|
|
251
|
-
let Le = null;
|
|
252
|
-
const Bn = ["application/xhtml+xml", "text/html"], Hn = "text/html";
|
|
253
|
-
let L = null, we = null;
|
|
254
|
-
const Gn = t.createElement("form"), Yt = function(i) {
|
|
255
|
-
return i instanceof RegExp || i instanceof Function;
|
|
256
|
-
}, gt = function() {
|
|
257
|
-
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
258
|
-
if (!(we && we === i)) {
|
|
259
|
-
if ((!i || typeof i != "object") && (i = {}), i = J(i), Le = // eslint-disable-next-line unicorn/prefer-includes
|
|
260
|
-
Bn.indexOf(i.PARSER_MEDIA_TYPE) === -1 ? Hn : i.PARSER_MEDIA_TYPE, L = Le === "application/xhtml+xml" ? kt : Ke, C = G(i, "ALLOWED_TAGS") ? k({}, i.ALLOWED_TAGS, L) : $t, I = G(i, "ALLOWED_ATTR") ? k({}, i.ALLOWED_ATTR, L) : Ut, ft = G(i, "ALLOWED_NAMESPACES") ? k({}, i.ALLOWED_NAMESPACES, kt) : Un, ut = G(i, "ADD_URI_SAFE_ATTR") ? k(J(jt), i.ADD_URI_SAFE_ATTR, L) : jt, qt = G(i, "ADD_DATA_URI_TAGS") ? k(J(Zt), i.ADD_DATA_URI_TAGS, L) : Zt, V = G(i, "FORBID_CONTENTS") ? k({}, i.FORBID_CONTENTS, L) : pt, Se = G(i, "FORBID_TAGS") ? k({}, i.FORBID_TAGS, L) : J({}), Ue = G(i, "FORBID_ATTR") ? k({}, i.FORBID_ATTR, L) : J({}), xe = G(i, "USE_PROFILES") ? i.USE_PROFILES : !1, Ft = i.ALLOW_ARIA_ATTR !== !1, lt = i.ALLOW_DATA_ATTR !== !1, Bt = i.ALLOW_UNKNOWN_PROTOCOLS || !1, Ht = i.ALLOW_SELF_CLOSE_IN_ATTR !== !1, ke = i.SAFE_FOR_TEMPLATES || !1, Fe = i.SAFE_FOR_XML !== !1, he = i.WHOLE_DOCUMENT || !1, be = i.RETURN_DOM || !1, Be = i.RETURN_DOM_FRAGMENT || !1, He = i.RETURN_TRUSTED_TYPE || !1, ot = i.FORCE_BODY || !1, Gt = i.SANITIZE_DOM !== !1, Wt = i.SANITIZE_NAMED_PROPS || !1, ct = i.KEEP_CONTENT !== !1, Re = i.IN_PLACE || !1, zt = i.ALLOWED_URI_REGEXP || En, Te = i.NAMESPACE || te, qe = i.MATHML_TEXT_INTEGRATION_POINTS || qe, Ze = i.HTML_INTEGRATION_POINTS || Ze, S = i.CUSTOM_ELEMENT_HANDLING || {}, i.CUSTOM_ELEMENT_HANDLING && Yt(i.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (S.tagNameCheck = i.CUSTOM_ELEMENT_HANDLING.tagNameCheck), i.CUSTOM_ELEMENT_HANDLING && Yt(i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (S.attributeNameCheck = i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), i.CUSTOM_ELEMENT_HANDLING && typeof i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (S.allowCustomizedBuiltInElements = i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), ke && (lt = !1), Be && (be = !0), xe && (C = k({}, un), I = Ve(null), xe.html === !0 && (k(C, pn), k(I, hn)), xe.svg === !0 && (k(C, xt), k(I, At), k(I, Ye)), xe.svgFilters === !0 && (k(C, Tt), k(I, At), k(I, Ye)), xe.mathMl === !0 && (k(C, wt), k(I, fn), k(I, Ye))), G(i, "ADD_TAGS") || (ce.tagCheck = null), G(i, "ADD_ATTR") || (ce.attributeCheck = null), i.ADD_TAGS && (typeof i.ADD_TAGS == "function" ? ce.tagCheck = i.ADD_TAGS : (C === $t && (C = J(C)), k(C, i.ADD_TAGS, L))), i.ADD_ATTR && (typeof i.ADD_ATTR == "function" ? ce.attributeCheck = i.ADD_ATTR : (I === Ut && (I = J(I)), k(I, i.ADD_ATTR, L))), i.ADD_URI_SAFE_ATTR && k(ut, i.ADD_URI_SAFE_ATTR, L), i.FORBID_CONTENTS && (V === pt && (V = J(V)), k(V, i.FORBID_CONTENTS, L)), i.ADD_FORBID_CONTENTS && (V === pt && (V = J(V)), k(V, i.ADD_FORBID_CONTENTS, L)), ct && (C["#text"] = !0), he && k(C, ["html", "head", "body"]), C.table && (k(C, ["tbody"]), delete Se.tbody), i.TRUSTED_TYPES_POLICY) {
|
|
261
|
-
if (typeof i.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
262
|
-
throw Ie('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
263
|
-
if (typeof i.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
264
|
-
throw Ie('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
265
|
-
y = i.TRUSTED_TYPES_POLICY, v = y.createHTML("");
|
|
266
|
-
} else
|
|
267
|
-
y === void 0 && (y = mr(T, n)), y !== null && typeof v == "string" && (v = y.createHTML(""));
|
|
268
|
-
z && z(i), we = i;
|
|
269
|
-
}
|
|
270
|
-
}, Xt = k({}, [...xt, ...Tt, ...ir]), Qt = k({}, [...wt, ...lr]), Wn = function(i) {
|
|
271
|
-
let c = Q(i);
|
|
272
|
-
(!c || !c.tagName) && (c = {
|
|
273
|
-
namespaceURI: Te,
|
|
274
|
-
tagName: "template"
|
|
275
|
-
});
|
|
276
|
-
const f = Ke(i.tagName), _ = Ke(c.tagName);
|
|
277
|
-
return ft[i.namespaceURI] ? i.namespaceURI === We ? c.namespaceURI === te ? f === "svg" : c.namespaceURI === Ge ? f === "svg" && (_ === "annotation-xml" || qe[_]) : !!Xt[f] : i.namespaceURI === Ge ? c.namespaceURI === te ? f === "math" : c.namespaceURI === We ? f === "math" && Ze[_] : !!Qt[f] : i.namespaceURI === te ? c.namespaceURI === We && !Ze[_] || c.namespaceURI === Ge && !qe[_] ? !1 : !Qt[f] && (Fn[f] || !Xt[f]) : !!(Le === "application/xhtml+xml" && ft[i.namespaceURI]) : !1;
|
|
278
|
-
}, K = function(i) {
|
|
279
|
-
Ce(e.removed, {
|
|
280
|
-
element: i
|
|
281
|
-
});
|
|
282
|
-
try {
|
|
283
|
-
Q(i).removeChild(i);
|
|
284
|
-
} catch {
|
|
285
|
-
se(i);
|
|
286
|
-
}
|
|
287
|
-
}, fe = function(i, c) {
|
|
288
|
-
try {
|
|
289
|
-
Ce(e.removed, {
|
|
290
|
-
attribute: c.getAttributeNode(i),
|
|
291
|
-
from: c
|
|
292
|
-
});
|
|
293
|
-
} catch {
|
|
294
|
-
Ce(e.removed, {
|
|
295
|
-
attribute: null,
|
|
296
|
-
from: c
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
if (c.removeAttribute(i), i === "is")
|
|
300
|
-
if (be || Be)
|
|
301
|
-
try {
|
|
302
|
-
K(c);
|
|
303
|
-
} catch {
|
|
304
|
-
}
|
|
305
|
-
else
|
|
306
|
-
try {
|
|
307
|
-
c.setAttribute(i, "");
|
|
308
|
-
} catch {
|
|
309
|
-
}
|
|
310
|
-
}, Vt = function(i) {
|
|
311
|
-
let c = null, f = null;
|
|
312
|
-
if (ot)
|
|
313
|
-
i = "<remove></remove>" + i;
|
|
314
|
-
else {
|
|
315
|
-
const R = bt(i, /^[\r\n\t ]+/);
|
|
316
|
-
f = R && R[0];
|
|
317
|
-
}
|
|
318
|
-
Le === "application/xhtml+xml" && Te === te && (i = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + i + "</body></html>");
|
|
319
|
-
const _ = y ? y.createHTML(i) : i;
|
|
320
|
-
if (Te === te)
|
|
321
|
-
try {
|
|
322
|
-
c = new d().parseFromString(_, Le);
|
|
323
|
-
} catch {
|
|
324
|
-
}
|
|
325
|
-
if (!c || !c.documentElement) {
|
|
326
|
-
c = j.createDocument(Te, "template", null);
|
|
327
|
-
try {
|
|
328
|
-
c.documentElement.innerHTML = ht ? v : _;
|
|
329
|
-
} catch {
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
const N = c.body || c.documentElement;
|
|
333
|
-
return i && f && N.insertBefore(t.createTextNode(f), N.childNodes[0] || null), Te === te ? ye.call(c, he ? "html" : "body")[0] : he ? c.documentElement : N;
|
|
334
|
-
}, Kt = function(i) {
|
|
335
|
-
return ie.call(
|
|
336
|
-
i.ownerDocument || i,
|
|
337
|
-
i,
|
|
338
|
-
// eslint-disable-next-line no-bitwise
|
|
339
|
-
h.SHOW_ELEMENT | h.SHOW_COMMENT | h.SHOW_TEXT | h.SHOW_PROCESSING_INSTRUCTION | h.SHOW_CDATA_SECTION,
|
|
340
|
-
null
|
|
341
|
-
);
|
|
342
|
-
}, dt = function(i) {
|
|
343
|
-
return i instanceof m && (typeof i.nodeName != "string" || typeof i.textContent != "string" || typeof i.removeChild != "function" || !(i.attributes instanceof u) || typeof i.removeAttribute != "function" || typeof i.setAttribute != "function" || typeof i.namespaceURI != "string" || typeof i.insertBefore != "function" || typeof i.hasChildNodes != "function");
|
|
344
|
-
}, Jt = function(i) {
|
|
345
|
-
return typeof p == "function" && i instanceof p;
|
|
346
|
-
};
|
|
347
|
-
function ne(g, i, c) {
|
|
348
|
-
je(g, (f) => {
|
|
349
|
-
f.call(e, i, c, we);
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
const en = function(i) {
|
|
353
|
-
let c = null;
|
|
354
|
-
if (ne(E.beforeSanitizeElements, i, null), dt(i))
|
|
355
|
-
return K(i), !0;
|
|
356
|
-
const f = L(i.nodeName);
|
|
357
|
-
if (ne(E.uponSanitizeElement, i, {
|
|
358
|
-
tagName: f,
|
|
359
|
-
allowedTags: C
|
|
360
|
-
}), Fe && i.hasChildNodes() && !Jt(i.firstElementChild) && M(/<[/\w!]/g, i.innerHTML) && M(/<[/\w!]/g, i.textContent) || i.nodeType === ve.progressingInstruction || Fe && i.nodeType === ve.comment && M(/<[/\w]/g, i.data))
|
|
361
|
-
return K(i), !0;
|
|
362
|
-
if (!(ce.tagCheck instanceof Function && ce.tagCheck(f)) && (!C[f] || Se[f])) {
|
|
363
|
-
if (!Se[f] && nn(f) && (S.tagNameCheck instanceof RegExp && M(S.tagNameCheck, f) || S.tagNameCheck instanceof Function && S.tagNameCheck(f)))
|
|
364
|
-
return !1;
|
|
365
|
-
if (ct && !V[f]) {
|
|
366
|
-
const _ = Q(i) || i.parentNode, N = F(i) || i.childNodes;
|
|
367
|
-
if (N && _) {
|
|
368
|
-
const R = N.length;
|
|
369
|
-
for (let U = R - 1; U >= 0; --U) {
|
|
370
|
-
const re = D(N[U], !0);
|
|
371
|
-
re.__removalCount = (i.__removalCount || 0) + 1, _.insertBefore(re, Z(i));
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
return K(i), !0;
|
|
376
|
-
}
|
|
377
|
-
return i instanceof o && !Wn(i) || (f === "noscript" || f === "noembed" || f === "noframes") && M(/<\/no(script|embed|frames)/i, i.innerHTML) ? (K(i), !0) : (ke && i.nodeType === ve.text && (c = i.textContent, je([B, le, ae], (_) => {
|
|
378
|
-
c = De(c, _, " ");
|
|
379
|
-
}), i.textContent !== c && (Ce(e.removed, {
|
|
380
|
-
element: i.cloneNode()
|
|
381
|
-
}), i.textContent = c)), ne(E.afterSanitizeElements, i, null), !1);
|
|
382
|
-
}, tn = function(i, c, f) {
|
|
383
|
-
if (Ue[c] || Gt && (c === "id" || c === "name") && (f in t || f in Gn))
|
|
384
|
-
return !1;
|
|
385
|
-
if (!(lt && !Ue[c] && M(Ee, c))) {
|
|
386
|
-
if (!(Ft && M(it, c))) {
|
|
387
|
-
if (!(ce.attributeCheck instanceof Function && ce.attributeCheck(c, i))) {
|
|
388
|
-
if (!I[c] || Ue[c]) {
|
|
389
|
-
if (
|
|
390
|
-
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
391
|
-
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
392
|
-
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
393
|
-
!(nn(i) && (S.tagNameCheck instanceof RegExp && M(S.tagNameCheck, i) || S.tagNameCheck instanceof Function && S.tagNameCheck(i)) && (S.attributeNameCheck instanceof RegExp && M(S.attributeNameCheck, c) || S.attributeNameCheck instanceof Function && S.attributeNameCheck(c, i)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
394
|
-
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
395
|
-
c === "is" && S.allowCustomizedBuiltInElements && (S.tagNameCheck instanceof RegExp && M(S.tagNameCheck, f) || S.tagNameCheck instanceof Function && S.tagNameCheck(f)))
|
|
396
|
-
) return !1;
|
|
397
|
-
} else if (!ut[c]) {
|
|
398
|
-
if (!M(zt, De(f, H, ""))) {
|
|
399
|
-
if (!((c === "src" || c === "xlink:href" || c === "href") && i !== "script" && tr(f, "data:") === 0 && qt[i])) {
|
|
400
|
-
if (!(Bt && !M(ue, De(f, H, "")))) {
|
|
401
|
-
if (f)
|
|
402
|
-
return !1;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
return !0;
|
|
411
|
-
}, nn = function(i) {
|
|
412
|
-
return i !== "annotation-xml" && bt(i, oe);
|
|
413
|
-
}, rn = function(i) {
|
|
414
|
-
ne(E.beforeSanitizeAttributes, i, null);
|
|
415
|
-
const {
|
|
416
|
-
attributes: c
|
|
417
|
-
} = i;
|
|
418
|
-
if (!c || dt(i))
|
|
419
|
-
return;
|
|
420
|
-
const f = {
|
|
421
|
-
attrName: "",
|
|
422
|
-
attrValue: "",
|
|
423
|
-
keepAttr: !0,
|
|
424
|
-
allowedAttributes: I,
|
|
425
|
-
forceKeepAttr: void 0
|
|
426
|
-
};
|
|
427
|
-
let _ = c.length;
|
|
428
|
-
for (; _--; ) {
|
|
429
|
-
const N = c[_], {
|
|
430
|
-
name: R,
|
|
431
|
-
namespaceURI: U,
|
|
432
|
-
value: re
|
|
433
|
-
} = N, Ae = L(R), mt = re;
|
|
434
|
-
let O = R === "value" ? mt : nr(mt);
|
|
435
|
-
if (f.attrName = Ae, f.attrValue = O, f.keepAttr = !0, f.forceKeepAttr = void 0, ne(E.uponSanitizeAttribute, i, f), O = f.attrValue, Wt && (Ae === "id" || Ae === "name") && (fe(R, i), O = $n + O), Fe && M(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, O)) {
|
|
436
|
-
fe(R, i);
|
|
437
|
-
continue;
|
|
438
|
-
}
|
|
439
|
-
if (Ae === "attributename" && bt(O, "href")) {
|
|
440
|
-
fe(R, i);
|
|
441
|
-
continue;
|
|
442
|
-
}
|
|
443
|
-
if (f.forceKeepAttr)
|
|
444
|
-
continue;
|
|
445
|
-
if (!f.keepAttr) {
|
|
446
|
-
fe(R, i);
|
|
447
|
-
continue;
|
|
448
|
-
}
|
|
449
|
-
if (!Ht && M(/\/>/i, O)) {
|
|
450
|
-
fe(R, i);
|
|
451
|
-
continue;
|
|
452
|
-
}
|
|
453
|
-
ke && je([B, le, ae], (ln) => {
|
|
454
|
-
O = De(O, ln, " ");
|
|
455
|
-
});
|
|
456
|
-
const sn = L(i.nodeName);
|
|
457
|
-
if (!tn(sn, Ae, O)) {
|
|
458
|
-
fe(R, i);
|
|
459
|
-
continue;
|
|
460
|
-
}
|
|
461
|
-
if (y && typeof T == "object" && typeof T.getAttributeType == "function" && !U)
|
|
462
|
-
switch (T.getAttributeType(sn, Ae)) {
|
|
463
|
-
case "TrustedHTML": {
|
|
464
|
-
O = y.createHTML(O);
|
|
465
|
-
break;
|
|
466
|
-
}
|
|
467
|
-
case "TrustedScriptURL": {
|
|
468
|
-
O = y.createScriptURL(O);
|
|
469
|
-
break;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
if (O !== mt)
|
|
473
|
-
try {
|
|
474
|
-
U ? i.setAttributeNS(U, R, O) : i.setAttribute(R, O), dt(i) ? K(i) : cn(e.removed);
|
|
475
|
-
} catch {
|
|
476
|
-
fe(R, i);
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
ne(E.afterSanitizeAttributes, i, null);
|
|
480
|
-
}, qn = function g(i) {
|
|
481
|
-
let c = null;
|
|
482
|
-
const f = Kt(i);
|
|
483
|
-
for (ne(E.beforeSanitizeShadowDOM, i, null); c = f.nextNode(); )
|
|
484
|
-
ne(E.uponSanitizeShadowNode, c, null), en(c), rn(c), c.content instanceof a && g(c.content);
|
|
485
|
-
ne(E.afterSanitizeShadowDOM, i, null);
|
|
486
|
-
};
|
|
487
|
-
return e.sanitize = function(g) {
|
|
488
|
-
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, c = null, f = null, _ = null, N = null;
|
|
489
|
-
if (ht = !g, ht && (g = "<!-->"), typeof g != "string" && !Jt(g))
|
|
490
|
-
if (typeof g.toString == "function") {
|
|
491
|
-
if (g = g.toString(), typeof g != "string")
|
|
492
|
-
throw Ie("dirty is not a string, aborting");
|
|
493
|
-
} else
|
|
494
|
-
throw Ie("toString is not a function");
|
|
495
|
-
if (!e.isSupported)
|
|
496
|
-
return g;
|
|
497
|
-
if (at || gt(i), e.removed = [], typeof g == "string" && (Re = !1), Re) {
|
|
498
|
-
if (g.nodeName) {
|
|
499
|
-
const re = L(g.nodeName);
|
|
500
|
-
if (!C[re] || Se[re])
|
|
501
|
-
throw Ie("root node is forbidden and cannot be sanitized in-place");
|
|
502
|
-
}
|
|
503
|
-
} else if (g instanceof p)
|
|
504
|
-
c = Vt("<!---->"), f = c.ownerDocument.importNode(g, !0), f.nodeType === ve.element && f.nodeName === "BODY" || f.nodeName === "HTML" ? c = f : c.appendChild(f);
|
|
505
|
-
else {
|
|
506
|
-
if (!be && !ke && !he && // eslint-disable-next-line unicorn/prefer-includes
|
|
507
|
-
g.indexOf("<") === -1)
|
|
508
|
-
return y && He ? y.createHTML(g) : g;
|
|
509
|
-
if (c = Vt(g), !c)
|
|
510
|
-
return be ? null : He ? v : "";
|
|
511
|
-
}
|
|
512
|
-
c && ot && K(c.firstChild);
|
|
513
|
-
const R = Kt(Re ? g : c);
|
|
514
|
-
for (; _ = R.nextNode(); )
|
|
515
|
-
en(_), rn(_), _.content instanceof a && qn(_.content);
|
|
516
|
-
if (Re)
|
|
517
|
-
return g;
|
|
518
|
-
if (be) {
|
|
519
|
-
if (Be)
|
|
520
|
-
for (N = $e.call(c.ownerDocument); c.firstChild; )
|
|
521
|
-
N.appendChild(c.firstChild);
|
|
522
|
-
else
|
|
523
|
-
N = c;
|
|
524
|
-
return (I.shadowroot || I.shadowrootmode) && (N = pe.call(s, N, !0)), N;
|
|
525
|
-
}
|
|
526
|
-
let U = he ? c.outerHTML : c.innerHTML;
|
|
527
|
-
return he && C["!doctype"] && c.ownerDocument && c.ownerDocument.doctype && c.ownerDocument.doctype.name && M(Sn, c.ownerDocument.doctype.name) && (U = "<!DOCTYPE " + c.ownerDocument.doctype.name + `>
|
|
528
|
-
` + U), ke && je([B, le, ae], (re) => {
|
|
529
|
-
U = De(U, re, " ");
|
|
530
|
-
}), y && He ? y.createHTML(U) : U;
|
|
531
|
-
}, e.setConfig = function() {
|
|
532
|
-
let g = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
533
|
-
gt(g), at = !0;
|
|
534
|
-
}, e.clearConfig = function() {
|
|
535
|
-
we = null, at = !1;
|
|
536
|
-
}, e.isValidAttribute = function(g, i, c) {
|
|
537
|
-
we || gt({});
|
|
538
|
-
const f = L(g), _ = L(i);
|
|
539
|
-
return tn(f, _, c);
|
|
540
|
-
}, e.addHook = function(g, i) {
|
|
541
|
-
typeof i == "function" && Ce(E[g], i);
|
|
542
|
-
}, e.removeHook = function(g, i) {
|
|
543
|
-
if (i !== void 0) {
|
|
544
|
-
const c = Jn(E[g], i);
|
|
545
|
-
return c === -1 ? void 0 : er(E[g], c, 1)[0];
|
|
546
|
-
}
|
|
547
|
-
return cn(E[g]);
|
|
548
|
-
}, e.removeHooks = function(g) {
|
|
549
|
-
E[g] = [];
|
|
550
|
-
}, e.removeAllHooks = function() {
|
|
551
|
-
E = dn();
|
|
552
|
-
}, e;
|
|
553
|
-
}
|
|
554
|
-
var kr = Rn(), mn, br = {};
|
|
555
|
-
function W(r, e, t) {
|
|
556
|
-
if (r.nodeType === 3) {
|
|
557
|
-
var s = "textContent" in r ? r.textContent : r.nodeValue || "";
|
|
558
|
-
if (W.options.trim !== !1) {
|
|
559
|
-
var n = e === 0 || e === t.length - 1;
|
|
560
|
-
if ((!(s = s.match(/^[\s\n]+$/g) && W.options.trim !== "all" ? " " : s.replace(/(^[\s\n]+|[\s\n]+$)/g, W.options.trim === "all" || n ? "" : " ")) || s === " ") && t.length > 1 && n) return null;
|
|
561
|
-
}
|
|
562
|
-
return s;
|
|
563
|
-
}
|
|
564
|
-
if (r.nodeType !== 1) return null;
|
|
565
|
-
var a = String(r.nodeName).toLowerCase();
|
|
566
|
-
if (a === "script" && !W.options.allowScripts) return null;
|
|
567
|
-
var l, p, o = W.h(a, (function(h) {
|
|
568
|
-
var u = h && h.length;
|
|
569
|
-
if (!u) return null;
|
|
570
|
-
for (var m = {}, d = 0; d < u; d++) {
|
|
571
|
-
var T = h[d], b = T.name, D = T.value;
|
|
572
|
-
b.substring(0, 2) === "on" && W.options.allowEvents && (D = new Function(D)), m[b] = D;
|
|
573
|
-
}
|
|
574
|
-
return m;
|
|
575
|
-
})(r.attributes), (p = (l = r.childNodes) && Array.prototype.map.call(l, W).filter(xr)) && p.length ? p : null);
|
|
576
|
-
return W.visitor && W.visitor(o), o;
|
|
577
|
-
}
|
|
578
|
-
var kn, xr = function(r) {
|
|
579
|
-
return r;
|
|
580
|
-
}, Tr = {};
|
|
581
|
-
function Je(r) {
|
|
582
|
-
var e = (r.type || "").toLowerCase(), t = Je.map;
|
|
583
|
-
t && t.hasOwnProperty(e) ? (r.type = t[e], r.props = Object.keys(r.props || {}).reduce(function(s, n) {
|
|
584
|
-
var a;
|
|
585
|
-
return s[a = n, a.replace(/-(.)/g, function(l, p) {
|
|
586
|
-
return p.toUpperCase();
|
|
587
|
-
})] = r.props[n], s;
|
|
588
|
-
}, {})) : r.type = e.replace(/[^a-z0-9-]/i, "");
|
|
589
|
-
}
|
|
590
|
-
const wr = (function(r) {
|
|
591
|
-
function e() {
|
|
592
|
-
r.apply(this, arguments);
|
|
593
|
-
}
|
|
594
|
-
return r && (e.__proto__ = r), (e.prototype = Object.create(r && r.prototype)).constructor = e, e.setReviver = function(t) {
|
|
595
|
-
kn = t;
|
|
596
|
-
}, e.prototype.shouldComponentUpdate = function(t) {
|
|
597
|
-
var s = this.props;
|
|
598
|
-
return t.wrap !== s.wrap || t.type !== s.type || t.markup !== s.markup;
|
|
599
|
-
}, e.prototype.setComponents = function(t) {
|
|
600
|
-
if (this.map = {}, t) {
|
|
601
|
-
for (var s in t) if (t.hasOwnProperty(s)) {
|
|
602
|
-
var n = s.replace(/([A-Z]+)([A-Z][a-z0-9])|([a-z0-9]+)([A-Z])/g, "$1$3-$2$4").toLowerCase();
|
|
603
|
-
this.map[n] = t[s];
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
}, e.prototype.render = function(t) {
|
|
607
|
-
var s = t.wrap;
|
|
608
|
-
s === void 0 && (s = !0);
|
|
609
|
-
var n, a = t.type, l = t.markup, p = t.components, o = t.reviver, h = t.onError, u = t["allow-scripts"], m = t["allow-events"], d = t.trim, T = (function(F, Q) {
|
|
610
|
-
var y = {};
|
|
611
|
-
for (var v in F) Object.prototype.hasOwnProperty.call(F, v) && Q.indexOf(v) === -1 && (y[v] = F[v]);
|
|
612
|
-
return y;
|
|
613
|
-
})(t, ["wrap", "type", "markup", "components", "reviver", "onError", "allow-scripts", "allow-events", "trim"]), b = o || this.reviver || this.constructor.prototype.reviver || kn || Yn;
|
|
614
|
-
this.setComponents(p);
|
|
615
|
-
var D = { allowScripts: u, allowEvents: m, trim: d };
|
|
616
|
-
try {
|
|
617
|
-
n = (function(F, Q, y, v, j) {
|
|
618
|
-
var ie = (function(pe, E) {
|
|
619
|
-
var B, le, ae, Ee, it = E === "html" ? "text/html" : "application/xml";
|
|
620
|
-
E === "html" ? (Ee = "body", ae = `<!DOCTYPE html>
|
|
621
|
-
<html><body>` + pe + "</body></html>") : (Ee = "xml", ae = `<?xml version="1.0" encoding="UTF-8"?>
|
|
622
|
-
<xml>` + pe + "</xml>");
|
|
623
|
-
try {
|
|
624
|
-
B = new DOMParser().parseFromString(ae, it);
|
|
625
|
-
} catch (oe) {
|
|
626
|
-
le = oe;
|
|
627
|
-
}
|
|
628
|
-
if (B || E !== "html" || ((B = mn || (mn = (function() {
|
|
629
|
-
if (document.implementation && document.implementation.createHTMLDocument) return document.implementation.createHTMLDocument("");
|
|
630
|
-
var oe = document.createElement("iframe");
|
|
631
|
-
return oe.style.cssText = "position:absolute; left:0; top:-999em; width:1px; height:1px; overflow:hidden;", oe.setAttribute("sandbox", "allow-forms"), document.body.appendChild(oe), oe.contentWindow.document;
|
|
632
|
-
})())).open(), B.write(ae), B.close()), B) {
|
|
633
|
-
var ue = B.getElementsByTagName(Ee)[0], H = ue.firstChild;
|
|
634
|
-
return pe && !H && (ue.error = "Document parse failed."), H && String(H.nodeName).toLowerCase() === "parsererror" && (H.removeChild(H.firstChild), H.removeChild(H.lastChild), ue.error = H.textContent || H.nodeValue || le || "Unknown error", ue.removeChild(H)), ue;
|
|
635
|
-
}
|
|
636
|
-
})(F, Q);
|
|
637
|
-
if (ie && ie.error) throw new Error(ie.error);
|
|
638
|
-
var $e = ie && ie.body || ie;
|
|
639
|
-
Je.map = v || Tr;
|
|
640
|
-
var ye = $e && (function(pe, E, B, le) {
|
|
641
|
-
return W.visitor = E, W.h = B, W.options = le || br, W(pe);
|
|
642
|
-
})($e, Je, y, j);
|
|
643
|
-
return Je.map = null, ye && ye.props && ye.props.children || null;
|
|
644
|
-
})(l, a, b, this.map, D);
|
|
645
|
-
} catch (F) {
|
|
646
|
-
h ? h({ error: F }) : typeof console < "u" && console.error && console.error("preact-markup: " + F);
|
|
647
|
-
}
|
|
648
|
-
if (s === !1) return n || null;
|
|
649
|
-
var se = T.hasOwnProperty("className") ? "className" : "class", Z = T[se];
|
|
650
|
-
return Z ? Z.splice ? Z.splice(0, 0, "markup") : typeof Z == "string" ? T[se] += " markup" : typeof Z == "object" && (Z.markup = !0) : T[se] = "markup", b("div", T, n || null);
|
|
651
|
-
}, e;
|
|
652
|
-
})(Xn);
|
|
653
|
-
function Lt() {
|
|
654
|
-
return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
|
|
655
|
-
}
|
|
656
|
-
var me = Lt();
|
|
657
|
-
function Ln(r) {
|
|
658
|
-
me = r;
|
|
659
|
-
}
|
|
660
|
-
var ge = { exec: () => null };
|
|
661
|
-
function x(r, e = "") {
|
|
662
|
-
let t = typeof r == "string" ? r : r.source, s = { replace: (n, a) => {
|
|
663
|
-
let l = typeof a == "string" ? a : a.source;
|
|
664
|
-
return l = l.replace(P.caret, "$1"), t = t.replace(n, l), s;
|
|
665
|
-
}, getRegex: () => new RegExp(t, e) };
|
|
666
|
-
return s;
|
|
667
|
-
}
|
|
668
|
-
var Ar = (() => {
|
|
669
|
-
try {
|
|
670
|
-
return !!new RegExp("(?<=1)(?<!1)");
|
|
671
|
-
} catch {
|
|
672
|
-
return !1;
|
|
673
|
-
}
|
|
674
|
-
})(), P = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (r) => new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}#`), htmlBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}<(?:[a-z].*>|!--)`, "i"), blockquoteBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}>`) }, _r = /^(?:[ \t]*(?:\n|$))+/, yr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Er = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, ze = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Sr = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Ct = / {0,3}(?:[*+-]|\d{1,9}[.)])/, Cn = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, Dn = x(Cn).replace(/bull/g, Ct).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(), Rr = x(Cn).replace(/bull/g, Ct).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(), Dt = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Lr = /^[^\n]+/, It = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Cr = x(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", It).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Dr = x(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Ct).getRegex(), rt = "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", Ot = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Ir = x("^ {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", Ot).replace("tag", rt).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), In = x(Dt).replace("hr", ze).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", rt).getRegex(), Or = x(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", In).getRegex(), vt = { blockquote: Or, code: yr, def: Cr, fences: Er, heading: Sr, hr: ze, html: Ir, lheading: Dn, list: Dr, newline: _r, paragraph: In, table: ge, text: Lr }, bn = x("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", ze).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", rt).getRegex(), vr = { ...vt, lheading: Rr, table: bn, paragraph: x(Dt).replace("hr", ze).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", bn).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", rt).getRegex() }, Nr = { ...vt, html: x(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", Ot).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(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: ge, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: x(Dt).replace("hr", ze).replace("heading", ` *#{1,6} *[^
|
|
675
|
-
]`).replace("lheading", Dn).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Mr = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Pr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, On = /^( {2,}|\\)\n(?!\s*$)/, zr = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, _e = /[\p{P}\p{S}]/u, st = /[\s\p{P}\p{S}]/u, Nt = /[^\s\p{P}\p{S}]/u, $r = x(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, st).getRegex(), vn = /(?!~)[\p{P}\p{S}]/u, Ur = /(?!~)[\s\p{P}\p{S}]/u, Fr = /(?:[^\s\p{P}\p{S}]|~)/u, Br = x(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Ar ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), Nn = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, Hr = x(Nn, "u").replace(/punct/g, _e).getRegex(), Gr = x(Nn, "u").replace(/punct/g, vn).getRegex(), Mn = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Wr = x(Mn, "gu").replace(/notPunctSpace/g, Nt).replace(/punctSpace/g, st).replace(/punct/g, _e).getRegex(), qr = x(Mn, "gu").replace(/notPunctSpace/g, Fr).replace(/punctSpace/g, Ur).replace(/punct/g, vn).getRegex(), Zr = x("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, Nt).replace(/punctSpace/g, st).replace(/punct/g, _e).getRegex(), jr = x(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, _e).getRegex(), Yr = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", Xr = x(Yr, "gu").replace(/notPunctSpace/g, Nt).replace(/punctSpace/g, st).replace(/punct/g, _e).getRegex(), Qr = x(/\\(punct)/, "gu").replace(/punct/g, _e).getRegex(), Vr = x(/^<(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(), Kr = x(Ot).replace("(?:-->|$)", "-->").getRegex(), Jr = x("^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", Kr).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), et = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, es = x(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", et).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Pn = x(/^!?\[(label)\]\[(ref)\]/).replace("label", et).replace("ref", It).getRegex(), zn = x(/^!?\[(ref)\](?:\[\])?/).replace("ref", It).getRegex(), ts = x("reflink|nolink(?!\\()", "g").replace("reflink", Pn).replace("nolink", zn).getRegex(), xn = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, Mt = { _backpedal: ge, anyPunctuation: Qr, autolink: Vr, blockSkip: Br, br: On, code: Pr, del: ge, delLDelim: ge, delRDelim: ge, emStrongLDelim: Hr, emStrongRDelimAst: Wr, emStrongRDelimUnd: Zr, escape: Mr, link: es, nolink: zn, punctuation: $r, reflink: Pn, reflinkSearch: ts, tag: Jr, text: zr, url: ge }, ns = { ...Mt, link: x(/^!?\[(label)\]\((.*?)\)/).replace("label", et).getRegex(), reflink: x(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", et).getRegex() }, Et = { ...Mt, emStrongRDelimAst: qr, emStrongLDelim: Gr, delLDelim: jr, delRDelim: Xr, url: x(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", xn).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: x(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", xn).getRegex() }, rs = { ...Et, br: x(On).replace("{2,}", "*").getRegex(), text: x(Et.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, Xe = { normal: vt, gfm: vr, pedantic: Nr }, Ne = { normal: Mt, gfm: Et, breaks: rs, pedantic: ns }, ss = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, Tn = (r) => ss[r];
|
|
676
|
-
function ee(r, e) {
|
|
677
|
-
if (e) {
|
|
678
|
-
if (P.escapeTest.test(r)) return r.replace(P.escapeReplace, Tn);
|
|
679
|
-
} else if (P.escapeTestNoEncode.test(r)) return r.replace(P.escapeReplaceNoEncode, Tn);
|
|
680
|
-
return r;
|
|
681
|
-
}
|
|
682
|
-
function wn(r) {
|
|
683
|
-
try {
|
|
684
|
-
r = encodeURI(r).replace(P.percentDecode, "%");
|
|
685
|
-
} catch {
|
|
686
|
-
return null;
|
|
687
|
-
}
|
|
688
|
-
return r;
|
|
689
|
-
}
|
|
690
|
-
function An(r, e) {
|
|
691
|
-
let t = r.replace(P.findPipe, (a, l, p) => {
|
|
692
|
-
let o = !1, h = l;
|
|
693
|
-
for (; --h >= 0 && p[h] === "\\"; ) o = !o;
|
|
694
|
-
return o ? "|" : " |";
|
|
695
|
-
}), s = t.split(P.splitPipe), n = 0;
|
|
696
|
-
if (s[0].trim() || s.shift(), s.length > 0 && !s.at(-1)?.trim() && s.pop(), e) if (s.length > e) s.splice(e);
|
|
697
|
-
else for (; s.length < e; ) s.push("");
|
|
698
|
-
for (; n < s.length; n++) s[n] = s[n].trim().replace(P.slashPipe, "|");
|
|
699
|
-
return s;
|
|
700
|
-
}
|
|
701
|
-
function Me(r, e, t) {
|
|
702
|
-
let s = r.length;
|
|
703
|
-
if (s === 0) return "";
|
|
704
|
-
let n = 0;
|
|
705
|
-
for (; n < s && r.charAt(s - n - 1) === e; )
|
|
706
|
-
n++;
|
|
707
|
-
return r.slice(0, s - n);
|
|
708
|
-
}
|
|
709
|
-
function is(r, e) {
|
|
710
|
-
if (r.indexOf(e[1]) === -1) return -1;
|
|
711
|
-
let t = 0;
|
|
712
|
-
for (let s = 0; s < r.length; s++) if (r[s] === "\\") s++;
|
|
713
|
-
else if (r[s] === e[0]) t++;
|
|
714
|
-
else if (r[s] === e[1] && (t--, t < 0)) return s;
|
|
715
|
-
return t > 0 ? -2 : -1;
|
|
716
|
-
}
|
|
717
|
-
function ls(r, e = 0) {
|
|
718
|
-
let t = e, s = "";
|
|
719
|
-
for (let n of r) if (n === " ") {
|
|
720
|
-
let a = 4 - t % 4;
|
|
721
|
-
s += " ".repeat(a), t += a;
|
|
722
|
-
} else s += n, t++;
|
|
723
|
-
return s;
|
|
724
|
-
}
|
|
725
|
-
function _n(r, e, t, s, n) {
|
|
726
|
-
let a = e.href, l = e.title || null, p = r[1].replace(n.other.outputLinkReplace, "$1");
|
|
727
|
-
s.state.inLink = !0;
|
|
728
|
-
let o = { type: r[0].charAt(0) === "!" ? "image" : "link", raw: t, href: a, title: l, text: p, tokens: s.inlineTokens(p) };
|
|
729
|
-
return s.state.inLink = !1, o;
|
|
730
|
-
}
|
|
731
|
-
function as(r, e, t) {
|
|
732
|
-
let s = r.match(t.other.indentCodeCompensation);
|
|
733
|
-
if (s === null) return e;
|
|
734
|
-
let n = s[1];
|
|
735
|
-
return e.split(`
|
|
736
|
-
`).map((a) => {
|
|
737
|
-
let l = a.match(t.other.beginningSpace);
|
|
738
|
-
if (l === null) return a;
|
|
739
|
-
let [p] = l;
|
|
740
|
-
return p.length >= n.length ? a.slice(n.length) : a;
|
|
741
|
-
}).join(`
|
|
742
|
-
`);
|
|
743
|
-
}
|
|
744
|
-
var tt = class {
|
|
745
|
-
constructor(r) {
|
|
746
|
-
A(this, "options");
|
|
747
|
-
A(this, "rules");
|
|
748
|
-
A(this, "lexer");
|
|
749
|
-
this.options = r || me;
|
|
750
|
-
}
|
|
751
|
-
space(r) {
|
|
752
|
-
let e = this.rules.block.newline.exec(r);
|
|
753
|
-
if (e && e[0].length > 0) return { type: "space", raw: e[0] };
|
|
754
|
-
}
|
|
755
|
-
code(r) {
|
|
756
|
-
let e = this.rules.block.code.exec(r);
|
|
757
|
-
if (e) {
|
|
758
|
-
let t = e[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
759
|
-
return { type: "code", raw: e[0], codeBlockStyle: "indented", text: this.options.pedantic ? t : Me(t, `
|
|
760
|
-
`) };
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
fences(r) {
|
|
764
|
-
let e = this.rules.block.fences.exec(r);
|
|
765
|
-
if (e) {
|
|
766
|
-
let t = e[0], s = as(t, e[3] || "", this.rules);
|
|
767
|
-
return { type: "code", raw: t, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: s };
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
heading(r) {
|
|
771
|
-
let e = this.rules.block.heading.exec(r);
|
|
772
|
-
if (e) {
|
|
773
|
-
let t = e[2].trim();
|
|
774
|
-
if (this.rules.other.endingHash.test(t)) {
|
|
775
|
-
let s = Me(t, "#");
|
|
776
|
-
(this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (t = s.trim());
|
|
777
|
-
}
|
|
778
|
-
return { type: "heading", raw: e[0], depth: e[1].length, text: t, tokens: this.lexer.inline(t) };
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
hr(r) {
|
|
782
|
-
let e = this.rules.block.hr.exec(r);
|
|
783
|
-
if (e) return { type: "hr", raw: Me(e[0], `
|
|
784
|
-
`) };
|
|
785
|
-
}
|
|
786
|
-
blockquote(r) {
|
|
787
|
-
let e = this.rules.block.blockquote.exec(r);
|
|
788
|
-
if (e) {
|
|
789
|
-
let t = Me(e[0], `
|
|
790
|
-
`).split(`
|
|
791
|
-
`), s = "", n = "", a = [];
|
|
792
|
-
for (; t.length > 0; ) {
|
|
793
|
-
let l = !1, p = [], o;
|
|
794
|
-
for (o = 0; o < t.length; o++) if (this.rules.other.blockquoteStart.test(t[o])) p.push(t[o]), l = !0;
|
|
795
|
-
else if (!l) p.push(t[o]);
|
|
796
|
-
else break;
|
|
797
|
-
t = t.slice(o);
|
|
798
|
-
let h = p.join(`
|
|
799
|
-
`), u = h.replace(this.rules.other.blockquoteSetextReplace, `
|
|
800
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
801
|
-
s = s ? `${s}
|
|
802
|
-
${h}` : h, n = n ? `${n}
|
|
803
|
-
${u}` : u;
|
|
804
|
-
let m = this.lexer.state.top;
|
|
805
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(u, a, !0), this.lexer.state.top = m, t.length === 0) break;
|
|
806
|
-
let d = a.at(-1);
|
|
807
|
-
if (d?.type === "code") break;
|
|
808
|
-
if (d?.type === "blockquote") {
|
|
809
|
-
let T = d, b = T.raw + `
|
|
810
|
-
` + t.join(`
|
|
811
|
-
`), D = this.blockquote(b);
|
|
812
|
-
a[a.length - 1] = D, s = s.substring(0, s.length - T.raw.length) + D.raw, n = n.substring(0, n.length - T.text.length) + D.text;
|
|
813
|
-
break;
|
|
814
|
-
} else if (d?.type === "list") {
|
|
815
|
-
let T = d, b = T.raw + `
|
|
816
|
-
` + t.join(`
|
|
817
|
-
`), D = this.list(b);
|
|
818
|
-
a[a.length - 1] = D, s = s.substring(0, s.length - d.raw.length) + D.raw, n = n.substring(0, n.length - T.raw.length) + D.raw, t = b.substring(a.at(-1).raw.length).split(`
|
|
819
|
-
`);
|
|
820
|
-
continue;
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
return { type: "blockquote", raw: s, tokens: a, text: n };
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
list(r) {
|
|
827
|
-
let e = this.rules.block.list.exec(r);
|
|
828
|
-
if (e) {
|
|
829
|
-
let t = e[1].trim(), s = t.length > 1, n = { type: "list", raw: "", ordered: s, start: s ? +t.slice(0, -1) : "", loose: !1, items: [] };
|
|
830
|
-
t = s ? `\\d{1,9}\\${t.slice(-1)}` : `\\${t}`, this.options.pedantic && (t = s ? t : "[*+-]");
|
|
831
|
-
let a = this.rules.other.listItemRegex(t), l = !1;
|
|
832
|
-
for (; r; ) {
|
|
833
|
-
let o = !1, h = "", u = "";
|
|
834
|
-
if (!(e = a.exec(r)) || this.rules.block.hr.test(r)) break;
|
|
835
|
-
h = e[0], r = r.substring(h.length);
|
|
836
|
-
let m = ls(e[2].split(`
|
|
837
|
-
`, 1)[0], e[1].length), d = r.split(`
|
|
838
|
-
`, 1)[0], T = !m.trim(), b = 0;
|
|
839
|
-
if (this.options.pedantic ? (b = 2, u = m.trimStart()) : T ? b = e[1].length + 1 : (b = m.search(this.rules.other.nonSpaceChar), b = b > 4 ? 1 : b, u = m.slice(b), b += e[1].length), T && this.rules.other.blankLine.test(d) && (h += d + `
|
|
840
|
-
`, r = r.substring(d.length + 1), o = !0), !o) {
|
|
841
|
-
let D = this.rules.other.nextBulletRegex(b), se = this.rules.other.hrRegex(b), Z = this.rules.other.fencesBeginRegex(b), F = this.rules.other.headingBeginRegex(b), Q = this.rules.other.htmlBeginRegex(b), y = this.rules.other.blockquoteBeginRegex(b);
|
|
842
|
-
for (; r; ) {
|
|
843
|
-
let v = r.split(`
|
|
844
|
-
`, 1)[0], j;
|
|
845
|
-
if (d = v, this.options.pedantic ? (d = d.replace(this.rules.other.listReplaceNesting, " "), j = d) : j = d.replace(this.rules.other.tabCharGlobal, " "), Z.test(d) || F.test(d) || Q.test(d) || y.test(d) || D.test(d) || se.test(d)) break;
|
|
846
|
-
if (j.search(this.rules.other.nonSpaceChar) >= b || !d.trim()) u += `
|
|
847
|
-
` + j.slice(b);
|
|
848
|
-
else {
|
|
849
|
-
if (T || m.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || Z.test(m) || F.test(m) || se.test(m)) break;
|
|
850
|
-
u += `
|
|
851
|
-
` + d;
|
|
852
|
-
}
|
|
853
|
-
T = !d.trim(), h += v + `
|
|
854
|
-
`, r = r.substring(v.length + 1), m = j.slice(b);
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
n.loose || (l ? n.loose = !0 : this.rules.other.doubleBlankLine.test(h) && (l = !0)), n.items.push({ type: "list_item", raw: h, task: !!this.options.gfm && this.rules.other.listIsTask.test(u), loose: !1, text: u, tokens: [] }), n.raw += h;
|
|
858
|
-
}
|
|
859
|
-
let p = n.items.at(-1);
|
|
860
|
-
if (p) p.raw = p.raw.trimEnd(), p.text = p.text.trimEnd();
|
|
861
|
-
else return;
|
|
862
|
-
n.raw = n.raw.trimEnd();
|
|
863
|
-
for (let o of n.items) {
|
|
864
|
-
if (this.lexer.state.top = !1, o.tokens = this.lexer.blockTokens(o.text, []), o.task) {
|
|
865
|
-
if (o.text = o.text.replace(this.rules.other.listReplaceTask, ""), o.tokens[0]?.type === "text" || o.tokens[0]?.type === "paragraph") {
|
|
866
|
-
o.tokens[0].raw = o.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), o.tokens[0].text = o.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
|
|
867
|
-
for (let u = this.lexer.inlineQueue.length - 1; u >= 0; u--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)) {
|
|
868
|
-
this.lexer.inlineQueue[u].src = this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask, "");
|
|
869
|
-
break;
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
let h = this.rules.other.listTaskCheckbox.exec(o.raw);
|
|
873
|
-
if (h) {
|
|
874
|
-
let u = { type: "checkbox", raw: h[0] + " ", checked: h[0] !== "[ ]" };
|
|
875
|
-
o.checked = u.checked, n.loose ? o.tokens[0] && ["paragraph", "text"].includes(o.tokens[0].type) && "tokens" in o.tokens[0] && o.tokens[0].tokens ? (o.tokens[0].raw = u.raw + o.tokens[0].raw, o.tokens[0].text = u.raw + o.tokens[0].text, o.tokens[0].tokens.unshift(u)) : o.tokens.unshift({ type: "paragraph", raw: u.raw, text: u.raw, tokens: [u] }) : o.tokens.unshift(u);
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
if (!n.loose) {
|
|
879
|
-
let h = o.tokens.filter((m) => m.type === "space"), u = h.length > 0 && h.some((m) => this.rules.other.anyLine.test(m.raw));
|
|
880
|
-
n.loose = u;
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
if (n.loose) for (let o of n.items) {
|
|
884
|
-
o.loose = !0;
|
|
885
|
-
for (let h of o.tokens) h.type === "text" && (h.type = "paragraph");
|
|
886
|
-
}
|
|
887
|
-
return n;
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
html(r) {
|
|
891
|
-
let e = this.rules.block.html.exec(r);
|
|
892
|
-
if (e) return { type: "html", block: !0, raw: e[0], pre: e[1] === "pre" || e[1] === "script" || e[1] === "style", text: e[0] };
|
|
893
|
-
}
|
|
894
|
-
def(r) {
|
|
895
|
-
let e = this.rules.block.def.exec(r);
|
|
896
|
-
if (e) {
|
|
897
|
-
let t = e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), s = e[2] ? e[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", n = e[3] ? e[3].substring(1, e[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : e[3];
|
|
898
|
-
return { type: "def", tag: t, raw: e[0], href: s, title: n };
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
table(r) {
|
|
902
|
-
let e = this.rules.block.table.exec(r);
|
|
903
|
-
if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
|
|
904
|
-
let t = An(e[1]), s = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), n = e[3]?.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
905
|
-
`) : [], a = { type: "table", raw: e[0], header: [], align: [], rows: [] };
|
|
906
|
-
if (t.length === s.length) {
|
|
907
|
-
for (let l of s) this.rules.other.tableAlignRight.test(l) ? a.align.push("right") : this.rules.other.tableAlignCenter.test(l) ? a.align.push("center") : this.rules.other.tableAlignLeft.test(l) ? a.align.push("left") : a.align.push(null);
|
|
908
|
-
for (let l = 0; l < t.length; l++) a.header.push({ text: t[l], tokens: this.lexer.inline(t[l]), header: !0, align: a.align[l] });
|
|
909
|
-
for (let l of n) a.rows.push(An(l, a.header.length).map((p, o) => ({ text: p, tokens: this.lexer.inline(p), header: !1, align: a.align[o] })));
|
|
910
|
-
return a;
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
lheading(r) {
|
|
914
|
-
let e = this.rules.block.lheading.exec(r);
|
|
915
|
-
if (e) {
|
|
916
|
-
let t = e[1].trim();
|
|
917
|
-
return { type: "heading", raw: e[0], depth: e[2].charAt(0) === "=" ? 1 : 2, text: t, tokens: this.lexer.inline(t) };
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
paragraph(r) {
|
|
921
|
-
let e = this.rules.block.paragraph.exec(r);
|
|
922
|
-
if (e) {
|
|
923
|
-
let t = e[1].charAt(e[1].length - 1) === `
|
|
924
|
-
` ? e[1].slice(0, -1) : e[1];
|
|
925
|
-
return { type: "paragraph", raw: e[0], text: t, tokens: this.lexer.inline(t) };
|
|
926
|
-
}
|
|
927
|
-
}
|
|
928
|
-
text(r) {
|
|
929
|
-
let e = this.rules.block.text.exec(r);
|
|
930
|
-
if (e) return { type: "text", raw: e[0], text: e[0], tokens: this.lexer.inline(e[0]) };
|
|
931
|
-
}
|
|
932
|
-
escape(r) {
|
|
933
|
-
let e = this.rules.inline.escape.exec(r);
|
|
934
|
-
if (e) return { type: "escape", raw: e[0], text: e[1] };
|
|
935
|
-
}
|
|
936
|
-
tag(r) {
|
|
937
|
-
let e = this.rules.inline.tag.exec(r);
|
|
938
|
-
if (e) return !this.lexer.state.inLink && this.rules.other.startATag.test(e[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(e[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(e[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(e[0]) && (this.lexer.state.inRawBlock = !1), { type: "html", raw: e[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: !1, text: e[0] };
|
|
939
|
-
}
|
|
940
|
-
link(r) {
|
|
941
|
-
let e = this.rules.inline.link.exec(r);
|
|
942
|
-
if (e) {
|
|
943
|
-
let t = e[2].trim();
|
|
944
|
-
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(t)) {
|
|
945
|
-
if (!this.rules.other.endAngleBracket.test(t)) return;
|
|
946
|
-
let a = Me(t.slice(0, -1), "\\");
|
|
947
|
-
if ((t.length - a.length) % 2 === 0) return;
|
|
948
|
-
} else {
|
|
949
|
-
let a = is(e[2], "()");
|
|
950
|
-
if (a === -2) return;
|
|
951
|
-
if (a > -1) {
|
|
952
|
-
let l = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + a;
|
|
953
|
-
e[2] = e[2].substring(0, a), e[0] = e[0].substring(0, l).trim(), e[3] = "";
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
let s = e[2], n = "";
|
|
957
|
-
if (this.options.pedantic) {
|
|
958
|
-
let a = this.rules.other.pedanticHrefTitle.exec(s);
|
|
959
|
-
a && (s = a[1], n = a[3]);
|
|
960
|
-
} else n = e[3] ? e[3].slice(1, -1) : "";
|
|
961
|
-
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(t) ? s = s.slice(1) : s = s.slice(1, -1)), _n(e, { href: s && s.replace(this.rules.inline.anyPunctuation, "$1"), title: n && n.replace(this.rules.inline.anyPunctuation, "$1") }, e[0], this.lexer, this.rules);
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
reflink(r, e) {
|
|
965
|
-
let t;
|
|
966
|
-
if ((t = this.rules.inline.reflink.exec(r)) || (t = this.rules.inline.nolink.exec(r))) {
|
|
967
|
-
let s = (t[2] || t[1]).replace(this.rules.other.multipleSpaceGlobal, " "), n = e[s.toLowerCase()];
|
|
968
|
-
if (!n) {
|
|
969
|
-
let a = t[0].charAt(0);
|
|
970
|
-
return { type: "text", raw: a, text: a };
|
|
971
|
-
}
|
|
972
|
-
return _n(t, n, t[0], this.lexer, this.rules);
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
emStrong(r, e, t = "") {
|
|
976
|
-
let s = this.rules.inline.emStrongLDelim.exec(r);
|
|
977
|
-
if (!(!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && t.match(this.rules.other.unicodeAlphaNumeric)) && (!(s[1] || s[3]) || !t || this.rules.inline.punctuation.exec(t))) {
|
|
978
|
-
let n = [...s[0]].length - 1, a, l, p = n, o = 0, h = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
979
|
-
for (h.lastIndex = 0, e = e.slice(-1 * r.length + n); (s = h.exec(e)) != null; ) {
|
|
980
|
-
if (a = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !a) continue;
|
|
981
|
-
if (l = [...a].length, s[3] || s[4]) {
|
|
982
|
-
p += l;
|
|
983
|
-
continue;
|
|
984
|
-
} else if ((s[5] || s[6]) && n % 3 && !((n + l) % 3)) {
|
|
985
|
-
o += l;
|
|
986
|
-
continue;
|
|
987
|
-
}
|
|
988
|
-
if (p -= l, p > 0) continue;
|
|
989
|
-
l = Math.min(l, l + p + o);
|
|
990
|
-
let u = [...s[0]][0].length, m = r.slice(0, n + s.index + u + l);
|
|
991
|
-
if (Math.min(n, l) % 2) {
|
|
992
|
-
let T = m.slice(1, -1);
|
|
993
|
-
return { type: "em", raw: m, text: T, tokens: this.lexer.inlineTokens(T) };
|
|
994
|
-
}
|
|
995
|
-
let d = m.slice(2, -2);
|
|
996
|
-
return { type: "strong", raw: m, text: d, tokens: this.lexer.inlineTokens(d) };
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
codespan(r) {
|
|
1001
|
-
let e = this.rules.inline.code.exec(r);
|
|
1002
|
-
if (e) {
|
|
1003
|
-
let t = e[2].replace(this.rules.other.newLineCharGlobal, " "), s = this.rules.other.nonSpaceChar.test(t), n = this.rules.other.startingSpaceChar.test(t) && this.rules.other.endingSpaceChar.test(t);
|
|
1004
|
-
return s && n && (t = t.substring(1, t.length - 1)), { type: "codespan", raw: e[0], text: t };
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
br(r) {
|
|
1008
|
-
let e = this.rules.inline.br.exec(r);
|
|
1009
|
-
if (e) return { type: "br", raw: e[0] };
|
|
1010
|
-
}
|
|
1011
|
-
del(r, e, t = "") {
|
|
1012
|
-
let s = this.rules.inline.delLDelim.exec(r);
|
|
1013
|
-
if (s && (!s[1] || !t || this.rules.inline.punctuation.exec(t))) {
|
|
1014
|
-
let n = [...s[0]].length - 1, a, l, p = n, o = this.rules.inline.delRDelim;
|
|
1015
|
-
for (o.lastIndex = 0, e = e.slice(-1 * r.length + n); (s = o.exec(e)) != null; ) {
|
|
1016
|
-
if (a = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !a || (l = [...a].length, l !== n)) continue;
|
|
1017
|
-
if (s[3] || s[4]) {
|
|
1018
|
-
p += l;
|
|
1019
|
-
continue;
|
|
1020
|
-
}
|
|
1021
|
-
if (p -= l, p > 0) continue;
|
|
1022
|
-
l = Math.min(l, l + p);
|
|
1023
|
-
let h = [...s[0]][0].length, u = r.slice(0, n + s.index + h + l), m = u.slice(n, -n);
|
|
1024
|
-
return { type: "del", raw: u, text: m, tokens: this.lexer.inlineTokens(m) };
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
autolink(r) {
|
|
1029
|
-
let e = this.rules.inline.autolink.exec(r);
|
|
1030
|
-
if (e) {
|
|
1031
|
-
let t, s;
|
|
1032
|
-
return e[2] === "@" ? (t = e[1], s = "mailto:" + t) : (t = e[1], s = t), { type: "link", raw: e[0], text: t, href: s, tokens: [{ type: "text", raw: t, text: t }] };
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
url(r) {
|
|
1036
|
-
let e;
|
|
1037
|
-
if (e = this.rules.inline.url.exec(r)) {
|
|
1038
|
-
let t, s;
|
|
1039
|
-
if (e[2] === "@") t = e[0], s = "mailto:" + t;
|
|
1040
|
-
else {
|
|
1041
|
-
let n;
|
|
1042
|
-
do
|
|
1043
|
-
n = e[0], e[0] = this.rules.inline._backpedal.exec(e[0])?.[0] ?? "";
|
|
1044
|
-
while (n !== e[0]);
|
|
1045
|
-
t = e[0], e[1] === "www." ? s = "http://" + e[0] : s = e[0];
|
|
1046
|
-
}
|
|
1047
|
-
return { type: "link", raw: e[0], text: t, href: s, tokens: [{ type: "text", raw: t, text: t }] };
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
inlineText(r) {
|
|
1051
|
-
let e = this.rules.inline.text.exec(r);
|
|
1052
|
-
if (e) {
|
|
1053
|
-
let t = this.lexer.state.inRawBlock;
|
|
1054
|
-
return { type: "text", raw: e[0], text: e[0], escaped: t };
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
}, Y = class St {
|
|
1058
|
-
constructor(e) {
|
|
1059
|
-
A(this, "tokens");
|
|
1060
|
-
A(this, "options");
|
|
1061
|
-
A(this, "state");
|
|
1062
|
-
A(this, "inlineQueue");
|
|
1063
|
-
A(this, "tokenizer");
|
|
1064
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || me, this.options.tokenizer = this.options.tokenizer || new tt(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
|
|
1065
|
-
let t = { other: P, block: Xe.normal, inline: Ne.normal };
|
|
1066
|
-
this.options.pedantic ? (t.block = Xe.pedantic, t.inline = Ne.pedantic) : this.options.gfm && (t.block = Xe.gfm, this.options.breaks ? t.inline = Ne.breaks : t.inline = Ne.gfm), this.tokenizer.rules = t;
|
|
1067
|
-
}
|
|
1068
|
-
static get rules() {
|
|
1069
|
-
return { block: Xe, inline: Ne };
|
|
1070
|
-
}
|
|
1071
|
-
static lex(e, t) {
|
|
1072
|
-
return new St(t).lex(e);
|
|
1073
|
-
}
|
|
1074
|
-
static lexInline(e, t) {
|
|
1075
|
-
return new St(t).inlineTokens(e);
|
|
1076
|
-
}
|
|
1077
|
-
lex(e) {
|
|
1078
|
-
e = e.replace(P.carriageReturn, `
|
|
1079
|
-
`), this.blockTokens(e, this.tokens);
|
|
1080
|
-
for (let t = 0; t < this.inlineQueue.length; t++) {
|
|
1081
|
-
let s = this.inlineQueue[t];
|
|
1082
|
-
this.inlineTokens(s.src, s.tokens);
|
|
1083
|
-
}
|
|
1084
|
-
return this.inlineQueue = [], this.tokens;
|
|
1085
|
-
}
|
|
1086
|
-
blockTokens(e, t = [], s = !1) {
|
|
1087
|
-
for (this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(P.tabCharGlobal, " ").replace(P.spaceLine, "")); e; ) {
|
|
1088
|
-
let n;
|
|
1089
|
-
if (this.options.extensions?.block?.some((l) => (n = l.call({ lexer: this }, e, t)) ? (e = e.substring(n.raw.length), t.push(n), !0) : !1)) continue;
|
|
1090
|
-
if (n = this.tokenizer.space(e)) {
|
|
1091
|
-
e = e.substring(n.raw.length);
|
|
1092
|
-
let l = t.at(-1);
|
|
1093
|
-
n.raw.length === 1 && l !== void 0 ? l.raw += `
|
|
1094
|
-
` : t.push(n);
|
|
1095
|
-
continue;
|
|
1096
|
-
}
|
|
1097
|
-
if (n = this.tokenizer.code(e)) {
|
|
1098
|
-
e = e.substring(n.raw.length);
|
|
1099
|
-
let l = t.at(-1);
|
|
1100
|
-
l?.type === "paragraph" || l?.type === "text" ? (l.raw += (l.raw.endsWith(`
|
|
1101
|
-
`) ? "" : `
|
|
1102
|
-
`) + n.raw, l.text += `
|
|
1103
|
-
` + n.text, this.inlineQueue.at(-1).src = l.text) : t.push(n);
|
|
1104
|
-
continue;
|
|
1105
|
-
}
|
|
1106
|
-
if (n = this.tokenizer.fences(e)) {
|
|
1107
|
-
e = e.substring(n.raw.length), t.push(n);
|
|
1108
|
-
continue;
|
|
1109
|
-
}
|
|
1110
|
-
if (n = this.tokenizer.heading(e)) {
|
|
1111
|
-
e = e.substring(n.raw.length), t.push(n);
|
|
1112
|
-
continue;
|
|
1113
|
-
}
|
|
1114
|
-
if (n = this.tokenizer.hr(e)) {
|
|
1115
|
-
e = e.substring(n.raw.length), t.push(n);
|
|
1116
|
-
continue;
|
|
1117
|
-
}
|
|
1118
|
-
if (n = this.tokenizer.blockquote(e)) {
|
|
1119
|
-
e = e.substring(n.raw.length), t.push(n);
|
|
1120
|
-
continue;
|
|
1121
|
-
}
|
|
1122
|
-
if (n = this.tokenizer.list(e)) {
|
|
1123
|
-
e = e.substring(n.raw.length), t.push(n);
|
|
1124
|
-
continue;
|
|
1125
|
-
}
|
|
1126
|
-
if (n = this.tokenizer.html(e)) {
|
|
1127
|
-
e = e.substring(n.raw.length), t.push(n);
|
|
1128
|
-
continue;
|
|
1129
|
-
}
|
|
1130
|
-
if (n = this.tokenizer.def(e)) {
|
|
1131
|
-
e = e.substring(n.raw.length);
|
|
1132
|
-
let l = t.at(-1);
|
|
1133
|
-
l?.type === "paragraph" || l?.type === "text" ? (l.raw += (l.raw.endsWith(`
|
|
1134
|
-
`) ? "" : `
|
|
1135
|
-
`) + n.raw, l.text += `
|
|
1136
|
-
` + n.raw, this.inlineQueue.at(-1).src = l.text) : this.tokens.links[n.tag] || (this.tokens.links[n.tag] = { href: n.href, title: n.title }, t.push(n));
|
|
1137
|
-
continue;
|
|
1138
|
-
}
|
|
1139
|
-
if (n = this.tokenizer.table(e)) {
|
|
1140
|
-
e = e.substring(n.raw.length), t.push(n);
|
|
1141
|
-
continue;
|
|
1142
|
-
}
|
|
1143
|
-
if (n = this.tokenizer.lheading(e)) {
|
|
1144
|
-
e = e.substring(n.raw.length), t.push(n);
|
|
1145
|
-
continue;
|
|
1146
|
-
}
|
|
1147
|
-
let a = e;
|
|
1148
|
-
if (this.options.extensions?.startBlock) {
|
|
1149
|
-
let l = 1 / 0, p = e.slice(1), o;
|
|
1150
|
-
this.options.extensions.startBlock.forEach((h) => {
|
|
1151
|
-
o = h.call({ lexer: this }, p), typeof o == "number" && o >= 0 && (l = Math.min(l, o));
|
|
1152
|
-
}), l < 1 / 0 && l >= 0 && (a = e.substring(0, l + 1));
|
|
1153
|
-
}
|
|
1154
|
-
if (this.state.top && (n = this.tokenizer.paragraph(a))) {
|
|
1155
|
-
let l = t.at(-1);
|
|
1156
|
-
s && l?.type === "paragraph" ? (l.raw += (l.raw.endsWith(`
|
|
1157
|
-
`) ? "" : `
|
|
1158
|
-
`) + n.raw, l.text += `
|
|
1159
|
-
` + n.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = l.text) : t.push(n), s = a.length !== e.length, e = e.substring(n.raw.length);
|
|
1160
|
-
continue;
|
|
1161
|
-
}
|
|
1162
|
-
if (n = this.tokenizer.text(e)) {
|
|
1163
|
-
e = e.substring(n.raw.length);
|
|
1164
|
-
let l = t.at(-1);
|
|
1165
|
-
l?.type === "text" ? (l.raw += (l.raw.endsWith(`
|
|
1166
|
-
`) ? "" : `
|
|
1167
|
-
`) + n.raw, l.text += `
|
|
1168
|
-
` + n.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = l.text) : t.push(n);
|
|
1169
|
-
continue;
|
|
1170
|
-
}
|
|
1171
|
-
if (e) {
|
|
1172
|
-
let l = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
1173
|
-
if (this.options.silent) {
|
|
1174
|
-
console.error(l);
|
|
1175
|
-
break;
|
|
1176
|
-
} else throw new Error(l);
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
return this.state.top = !0, t;
|
|
1180
|
-
}
|
|
1181
|
-
inline(e, t = []) {
|
|
1182
|
-
return this.inlineQueue.push({ src: e, tokens: t }), t;
|
|
1183
|
-
}
|
|
1184
|
-
inlineTokens(e, t = []) {
|
|
1185
|
-
this.tokenizer.lexer = this;
|
|
1186
|
-
let s = e, n = null;
|
|
1187
|
-
if (this.tokens.links) {
|
|
1188
|
-
let o = Object.keys(this.tokens.links);
|
|
1189
|
-
if (o.length > 0) for (; (n = this.tokenizer.rules.inline.reflinkSearch.exec(s)) != null; ) o.includes(n[0].slice(n[0].lastIndexOf("[") + 1, -1)) && (s = s.slice(0, n.index) + "[" + "a".repeat(n[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
1190
|
-
}
|
|
1191
|
-
for (; (n = this.tokenizer.rules.inline.anyPunctuation.exec(s)) != null; ) s = s.slice(0, n.index) + "++" + s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
1192
|
-
let a;
|
|
1193
|
-
for (; (n = this.tokenizer.rules.inline.blockSkip.exec(s)) != null; ) a = n[2] ? n[2].length : 0, s = s.slice(0, n.index + a) + "[" + "a".repeat(n[0].length - a - 2) + "]" + s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
1194
|
-
s = this.options.hooks?.emStrongMask?.call({ lexer: this }, s) ?? s;
|
|
1195
|
-
let l = !1, p = "";
|
|
1196
|
-
for (; e; ) {
|
|
1197
|
-
l || (p = ""), l = !1;
|
|
1198
|
-
let o;
|
|
1199
|
-
if (this.options.extensions?.inline?.some((u) => (o = u.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), !0) : !1)) continue;
|
|
1200
|
-
if (o = this.tokenizer.escape(e)) {
|
|
1201
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
1202
|
-
continue;
|
|
1203
|
-
}
|
|
1204
|
-
if (o = this.tokenizer.tag(e)) {
|
|
1205
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
1206
|
-
continue;
|
|
1207
|
-
}
|
|
1208
|
-
if (o = this.tokenizer.link(e)) {
|
|
1209
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
1210
|
-
continue;
|
|
1211
|
-
}
|
|
1212
|
-
if (o = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
1213
|
-
e = e.substring(o.raw.length);
|
|
1214
|
-
let u = t.at(-1);
|
|
1215
|
-
o.type === "text" && u?.type === "text" ? (u.raw += o.raw, u.text += o.text) : t.push(o);
|
|
1216
|
-
continue;
|
|
1217
|
-
}
|
|
1218
|
-
if (o = this.tokenizer.emStrong(e, s, p)) {
|
|
1219
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
1220
|
-
continue;
|
|
1221
|
-
}
|
|
1222
|
-
if (o = this.tokenizer.codespan(e)) {
|
|
1223
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
1224
|
-
continue;
|
|
1225
|
-
}
|
|
1226
|
-
if (o = this.tokenizer.br(e)) {
|
|
1227
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
1228
|
-
continue;
|
|
1229
|
-
}
|
|
1230
|
-
if (o = this.tokenizer.del(e, s, p)) {
|
|
1231
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
1232
|
-
continue;
|
|
1233
|
-
}
|
|
1234
|
-
if (o = this.tokenizer.autolink(e)) {
|
|
1235
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
1236
|
-
continue;
|
|
1237
|
-
}
|
|
1238
|
-
if (!this.state.inLink && (o = this.tokenizer.url(e))) {
|
|
1239
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
1240
|
-
continue;
|
|
1241
|
-
}
|
|
1242
|
-
let h = e;
|
|
1243
|
-
if (this.options.extensions?.startInline) {
|
|
1244
|
-
let u = 1 / 0, m = e.slice(1), d;
|
|
1245
|
-
this.options.extensions.startInline.forEach((T) => {
|
|
1246
|
-
d = T.call({ lexer: this }, m), typeof d == "number" && d >= 0 && (u = Math.min(u, d));
|
|
1247
|
-
}), u < 1 / 0 && u >= 0 && (h = e.substring(0, u + 1));
|
|
1248
|
-
}
|
|
1249
|
-
if (o = this.tokenizer.inlineText(h)) {
|
|
1250
|
-
e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (p = o.raw.slice(-1)), l = !0;
|
|
1251
|
-
let u = t.at(-1);
|
|
1252
|
-
u?.type === "text" ? (u.raw += o.raw, u.text += o.text) : t.push(o);
|
|
1253
|
-
continue;
|
|
1254
|
-
}
|
|
1255
|
-
if (e) {
|
|
1256
|
-
let u = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
1257
|
-
if (this.options.silent) {
|
|
1258
|
-
console.error(u);
|
|
1259
|
-
break;
|
|
1260
|
-
} else throw new Error(u);
|
|
1261
|
-
}
|
|
1262
|
-
}
|
|
1263
|
-
return t;
|
|
1264
|
-
}
|
|
1265
|
-
}, nt = class {
|
|
1266
|
-
constructor(r) {
|
|
1267
|
-
A(this, "options");
|
|
1268
|
-
A(this, "parser");
|
|
1269
|
-
this.options = r || me;
|
|
1270
|
-
}
|
|
1271
|
-
space(r) {
|
|
1272
|
-
return "";
|
|
1273
|
-
}
|
|
1274
|
-
code({ text: r, lang: e, escaped: t }) {
|
|
1275
|
-
let s = (e || "").match(P.notSpaceStart)?.[0], n = r.replace(P.endingNewline, "") + `
|
|
1276
|
-
`;
|
|
1277
|
-
return s ? '<pre><code class="language-' + ee(s) + '">' + (t ? n : ee(n, !0)) + `</code></pre>
|
|
1278
|
-
` : "<pre><code>" + (t ? n : ee(n, !0)) + `</code></pre>
|
|
1279
|
-
`;
|
|
1280
|
-
}
|
|
1281
|
-
blockquote({ tokens: r }) {
|
|
1282
|
-
return `<blockquote>
|
|
1283
|
-
${this.parser.parse(r)}</blockquote>
|
|
1284
|
-
`;
|
|
1285
|
-
}
|
|
1286
|
-
html({ text: r }) {
|
|
1287
|
-
return r;
|
|
1288
|
-
}
|
|
1289
|
-
def(r) {
|
|
1290
|
-
return "";
|
|
1291
|
-
}
|
|
1292
|
-
heading({ tokens: r, depth: e }) {
|
|
1293
|
-
return `<h${e}>${this.parser.parseInline(r)}</h${e}>
|
|
1294
|
-
`;
|
|
1295
|
-
}
|
|
1296
|
-
hr(r) {
|
|
1297
|
-
return `<hr>
|
|
1298
|
-
`;
|
|
1299
|
-
}
|
|
1300
|
-
list(r) {
|
|
1301
|
-
let e = r.ordered, t = r.start, s = "";
|
|
1302
|
-
for (let l = 0; l < r.items.length; l++) {
|
|
1303
|
-
let p = r.items[l];
|
|
1304
|
-
s += this.listitem(p);
|
|
1305
|
-
}
|
|
1306
|
-
let n = e ? "ol" : "ul", a = e && t !== 1 ? ' start="' + t + '"' : "";
|
|
1307
|
-
return "<" + n + a + `>
|
|
1308
|
-
` + s + "</" + n + `>
|
|
1309
|
-
`;
|
|
1310
|
-
}
|
|
1311
|
-
listitem(r) {
|
|
1312
|
-
return `<li>${this.parser.parse(r.tokens)}</li>
|
|
1313
|
-
`;
|
|
1314
|
-
}
|
|
1315
|
-
checkbox({ checked: r }) {
|
|
1316
|
-
return "<input " + (r ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
|
|
1317
|
-
}
|
|
1318
|
-
paragraph({ tokens: r }) {
|
|
1319
|
-
return `<p>${this.parser.parseInline(r)}</p>
|
|
1320
|
-
`;
|
|
1321
|
-
}
|
|
1322
|
-
table(r) {
|
|
1323
|
-
let e = "", t = "";
|
|
1324
|
-
for (let n = 0; n < r.header.length; n++) t += this.tablecell(r.header[n]);
|
|
1325
|
-
e += this.tablerow({ text: t });
|
|
1326
|
-
let s = "";
|
|
1327
|
-
for (let n = 0; n < r.rows.length; n++) {
|
|
1328
|
-
let a = r.rows[n];
|
|
1329
|
-
t = "";
|
|
1330
|
-
for (let l = 0; l < a.length; l++) t += this.tablecell(a[l]);
|
|
1331
|
-
s += this.tablerow({ text: t });
|
|
1332
|
-
}
|
|
1333
|
-
return s && (s = `<tbody>${s}</tbody>`), `<table>
|
|
1334
|
-
<thead>
|
|
1335
|
-
` + e + `</thead>
|
|
1336
|
-
` + s + `</table>
|
|
1337
|
-
`;
|
|
1338
|
-
}
|
|
1339
|
-
tablerow({ text: r }) {
|
|
1340
|
-
return `<tr>
|
|
1341
|
-
${r}</tr>
|
|
1342
|
-
`;
|
|
1343
|
-
}
|
|
1344
|
-
tablecell(r) {
|
|
1345
|
-
let e = this.parser.parseInline(r.tokens), t = r.header ? "th" : "td";
|
|
1346
|
-
return (r.align ? `<${t} align="${r.align}">` : `<${t}>`) + e + `</${t}>
|
|
1347
|
-
`;
|
|
1348
|
-
}
|
|
1349
|
-
strong({ tokens: r }) {
|
|
1350
|
-
return `<strong>${this.parser.parseInline(r)}</strong>`;
|
|
1351
|
-
}
|
|
1352
|
-
em({ tokens: r }) {
|
|
1353
|
-
return `<em>${this.parser.parseInline(r)}</em>`;
|
|
1354
|
-
}
|
|
1355
|
-
codespan({ text: r }) {
|
|
1356
|
-
return `<code>${ee(r, !0)}</code>`;
|
|
1357
|
-
}
|
|
1358
|
-
br(r) {
|
|
1359
|
-
return "<br>";
|
|
1360
|
-
}
|
|
1361
|
-
del({ tokens: r }) {
|
|
1362
|
-
return `<del>${this.parser.parseInline(r)}</del>`;
|
|
1363
|
-
}
|
|
1364
|
-
link({ href: r, title: e, tokens: t }) {
|
|
1365
|
-
let s = this.parser.parseInline(t), n = wn(r);
|
|
1366
|
-
if (n === null) return s;
|
|
1367
|
-
r = n;
|
|
1368
|
-
let a = '<a href="' + r + '"';
|
|
1369
|
-
return e && (a += ' title="' + ee(e) + '"'), a += ">" + s + "</a>", a;
|
|
1370
|
-
}
|
|
1371
|
-
image({ href: r, title: e, text: t, tokens: s }) {
|
|
1372
|
-
s && (t = this.parser.parseInline(s, this.parser.textRenderer));
|
|
1373
|
-
let n = wn(r);
|
|
1374
|
-
if (n === null) return ee(t);
|
|
1375
|
-
r = n;
|
|
1376
|
-
let a = `<img src="${r}" alt="${ee(t)}"`;
|
|
1377
|
-
return e && (a += ` title="${ee(e)}"`), a += ">", a;
|
|
1378
|
-
}
|
|
1379
|
-
text(r) {
|
|
1380
|
-
return "tokens" in r && r.tokens ? this.parser.parseInline(r.tokens) : "escaped" in r && r.escaped ? r.text : ee(r.text);
|
|
1381
|
-
}
|
|
1382
|
-
}, Pt = class {
|
|
1383
|
-
strong({ text: r }) {
|
|
1384
|
-
return r;
|
|
1385
|
-
}
|
|
1386
|
-
em({ text: r }) {
|
|
1387
|
-
return r;
|
|
1388
|
-
}
|
|
1389
|
-
codespan({ text: r }) {
|
|
1390
|
-
return r;
|
|
1391
|
-
}
|
|
1392
|
-
del({ text: r }) {
|
|
1393
|
-
return r;
|
|
1394
|
-
}
|
|
1395
|
-
html({ text: r }) {
|
|
1396
|
-
return r;
|
|
1397
|
-
}
|
|
1398
|
-
text({ text: r }) {
|
|
1399
|
-
return r;
|
|
1400
|
-
}
|
|
1401
|
-
link({ text: r }) {
|
|
1402
|
-
return "" + r;
|
|
1403
|
-
}
|
|
1404
|
-
image({ text: r }) {
|
|
1405
|
-
return "" + r;
|
|
1406
|
-
}
|
|
1407
|
-
br() {
|
|
1408
|
-
return "";
|
|
1409
|
-
}
|
|
1410
|
-
checkbox({ raw: r }) {
|
|
1411
|
-
return r;
|
|
1412
|
-
}
|
|
1413
|
-
}, X = class Rt {
|
|
1414
|
-
constructor(e) {
|
|
1415
|
-
A(this, "options");
|
|
1416
|
-
A(this, "renderer");
|
|
1417
|
-
A(this, "textRenderer");
|
|
1418
|
-
this.options = e || me, this.options.renderer = this.options.renderer || new nt(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new Pt();
|
|
1419
|
-
}
|
|
1420
|
-
static parse(e, t) {
|
|
1421
|
-
return new Rt(t).parse(e);
|
|
1422
|
-
}
|
|
1423
|
-
static parseInline(e, t) {
|
|
1424
|
-
return new Rt(t).parseInline(e);
|
|
1425
|
-
}
|
|
1426
|
-
parse(e) {
|
|
1427
|
-
this.renderer.parser = this;
|
|
1428
|
-
let t = "";
|
|
1429
|
-
for (let s = 0; s < e.length; s++) {
|
|
1430
|
-
let n = e[s];
|
|
1431
|
-
if (this.options.extensions?.renderers?.[n.type]) {
|
|
1432
|
-
let l = n, p = this.options.extensions.renderers[l.type].call({ parser: this }, l);
|
|
1433
|
-
if (p !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(l.type)) {
|
|
1434
|
-
t += p || "";
|
|
1435
|
-
continue;
|
|
1436
|
-
}
|
|
1437
|
-
}
|
|
1438
|
-
let a = n;
|
|
1439
|
-
switch (a.type) {
|
|
1440
|
-
case "space": {
|
|
1441
|
-
t += this.renderer.space(a);
|
|
1442
|
-
break;
|
|
1443
|
-
}
|
|
1444
|
-
case "hr": {
|
|
1445
|
-
t += this.renderer.hr(a);
|
|
1446
|
-
break;
|
|
1447
|
-
}
|
|
1448
|
-
case "heading": {
|
|
1449
|
-
t += this.renderer.heading(a);
|
|
1450
|
-
break;
|
|
1451
|
-
}
|
|
1452
|
-
case "code": {
|
|
1453
|
-
t += this.renderer.code(a);
|
|
1454
|
-
break;
|
|
1455
|
-
}
|
|
1456
|
-
case "table": {
|
|
1457
|
-
t += this.renderer.table(a);
|
|
1458
|
-
break;
|
|
1459
|
-
}
|
|
1460
|
-
case "blockquote": {
|
|
1461
|
-
t += this.renderer.blockquote(a);
|
|
1462
|
-
break;
|
|
1463
|
-
}
|
|
1464
|
-
case "list": {
|
|
1465
|
-
t += this.renderer.list(a);
|
|
1466
|
-
break;
|
|
1467
|
-
}
|
|
1468
|
-
case "checkbox": {
|
|
1469
|
-
t += this.renderer.checkbox(a);
|
|
1470
|
-
break;
|
|
1471
|
-
}
|
|
1472
|
-
case "html": {
|
|
1473
|
-
t += this.renderer.html(a);
|
|
1474
|
-
break;
|
|
1475
|
-
}
|
|
1476
|
-
case "def": {
|
|
1477
|
-
t += this.renderer.def(a);
|
|
1478
|
-
break;
|
|
1479
|
-
}
|
|
1480
|
-
case "paragraph": {
|
|
1481
|
-
t += this.renderer.paragraph(a);
|
|
1482
|
-
break;
|
|
1483
|
-
}
|
|
1484
|
-
case "text": {
|
|
1485
|
-
t += this.renderer.text(a);
|
|
1486
|
-
break;
|
|
1487
|
-
}
|
|
1488
|
-
default: {
|
|
1489
|
-
let l = 'Token with "' + a.type + '" type was not found.';
|
|
1490
|
-
if (this.options.silent) return console.error(l), "";
|
|
1491
|
-
throw new Error(l);
|
|
1492
|
-
}
|
|
1493
|
-
}
|
|
1494
|
-
}
|
|
1495
|
-
return t;
|
|
1496
|
-
}
|
|
1497
|
-
parseInline(e, t = this.renderer) {
|
|
1498
|
-
this.renderer.parser = this;
|
|
1499
|
-
let s = "";
|
|
1500
|
-
for (let n = 0; n < e.length; n++) {
|
|
1501
|
-
let a = e[n];
|
|
1502
|
-
if (this.options.extensions?.renderers?.[a.type]) {
|
|
1503
|
-
let p = this.options.extensions.renderers[a.type].call({ parser: this }, a);
|
|
1504
|
-
if (p !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(a.type)) {
|
|
1505
|
-
s += p || "";
|
|
1506
|
-
continue;
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1509
|
-
let l = a;
|
|
1510
|
-
switch (l.type) {
|
|
1511
|
-
case "escape": {
|
|
1512
|
-
s += t.text(l);
|
|
1513
|
-
break;
|
|
1514
|
-
}
|
|
1515
|
-
case "html": {
|
|
1516
|
-
s += t.html(l);
|
|
1517
|
-
break;
|
|
1518
|
-
}
|
|
1519
|
-
case "link": {
|
|
1520
|
-
s += t.link(l);
|
|
1521
|
-
break;
|
|
1522
|
-
}
|
|
1523
|
-
case "image": {
|
|
1524
|
-
s += t.image(l);
|
|
1525
|
-
break;
|
|
1526
|
-
}
|
|
1527
|
-
case "checkbox": {
|
|
1528
|
-
s += t.checkbox(l);
|
|
1529
|
-
break;
|
|
1530
|
-
}
|
|
1531
|
-
case "strong": {
|
|
1532
|
-
s += t.strong(l);
|
|
1533
|
-
break;
|
|
1534
|
-
}
|
|
1535
|
-
case "em": {
|
|
1536
|
-
s += t.em(l);
|
|
1537
|
-
break;
|
|
1538
|
-
}
|
|
1539
|
-
case "codespan": {
|
|
1540
|
-
s += t.codespan(l);
|
|
1541
|
-
break;
|
|
1542
|
-
}
|
|
1543
|
-
case "br": {
|
|
1544
|
-
s += t.br(l);
|
|
1545
|
-
break;
|
|
1546
|
-
}
|
|
1547
|
-
case "del": {
|
|
1548
|
-
s += t.del(l);
|
|
1549
|
-
break;
|
|
1550
|
-
}
|
|
1551
|
-
case "text": {
|
|
1552
|
-
s += t.text(l);
|
|
1553
|
-
break;
|
|
1554
|
-
}
|
|
1555
|
-
default: {
|
|
1556
|
-
let p = 'Token with "' + l.type + '" type was not found.';
|
|
1557
|
-
if (this.options.silent) return console.error(p), "";
|
|
1558
|
-
throw new Error(p);
|
|
1559
|
-
}
|
|
1560
|
-
}
|
|
1561
|
-
}
|
|
1562
|
-
return s;
|
|
1563
|
-
}
|
|
1564
|
-
}, Qe, Pe = (Qe = class {
|
|
1565
|
-
constructor(r) {
|
|
1566
|
-
A(this, "options");
|
|
1567
|
-
A(this, "block");
|
|
1568
|
-
this.options = r || me;
|
|
1569
|
-
}
|
|
1570
|
-
preprocess(r) {
|
|
1571
|
-
return r;
|
|
1572
|
-
}
|
|
1573
|
-
postprocess(r) {
|
|
1574
|
-
return r;
|
|
1575
|
-
}
|
|
1576
|
-
processAllTokens(r) {
|
|
1577
|
-
return r;
|
|
1578
|
-
}
|
|
1579
|
-
emStrongMask(r) {
|
|
1580
|
-
return r;
|
|
1581
|
-
}
|
|
1582
|
-
provideLexer() {
|
|
1583
|
-
return this.block ? Y.lex : Y.lexInline;
|
|
1584
|
-
}
|
|
1585
|
-
provideParser() {
|
|
1586
|
-
return this.block ? X.parse : X.parseInline;
|
|
1587
|
-
}
|
|
1588
|
-
}, A(Qe, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), A(Qe, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), Qe), os = class {
|
|
1589
|
-
constructor(...r) {
|
|
1590
|
-
A(this, "defaults", Lt());
|
|
1591
|
-
A(this, "options", this.setOptions);
|
|
1592
|
-
A(this, "parse", this.parseMarkdown(!0));
|
|
1593
|
-
A(this, "parseInline", this.parseMarkdown(!1));
|
|
1594
|
-
A(this, "Parser", X);
|
|
1595
|
-
A(this, "Renderer", nt);
|
|
1596
|
-
A(this, "TextRenderer", Pt);
|
|
1597
|
-
A(this, "Lexer", Y);
|
|
1598
|
-
A(this, "Tokenizer", tt);
|
|
1599
|
-
A(this, "Hooks", Pe);
|
|
1600
|
-
this.use(...r);
|
|
1601
|
-
}
|
|
1602
|
-
walkTokens(r, e) {
|
|
1603
|
-
let t = [];
|
|
1604
|
-
for (let s of r) switch (t = t.concat(e.call(this, s)), s.type) {
|
|
1605
|
-
case "table": {
|
|
1606
|
-
let n = s;
|
|
1607
|
-
for (let a of n.header) t = t.concat(this.walkTokens(a.tokens, e));
|
|
1608
|
-
for (let a of n.rows) for (let l of a) t = t.concat(this.walkTokens(l.tokens, e));
|
|
1609
|
-
break;
|
|
1610
|
-
}
|
|
1611
|
-
case "list": {
|
|
1612
|
-
let n = s;
|
|
1613
|
-
t = t.concat(this.walkTokens(n.items, e));
|
|
1614
|
-
break;
|
|
1615
|
-
}
|
|
1616
|
-
default: {
|
|
1617
|
-
let n = s;
|
|
1618
|
-
this.defaults.extensions?.childTokens?.[n.type] ? this.defaults.extensions.childTokens[n.type].forEach((a) => {
|
|
1619
|
-
let l = n[a].flat(1 / 0);
|
|
1620
|
-
t = t.concat(this.walkTokens(l, e));
|
|
1621
|
-
}) : n.tokens && (t = t.concat(this.walkTokens(n.tokens, e)));
|
|
1622
|
-
}
|
|
1623
|
-
}
|
|
1624
|
-
return t;
|
|
1625
|
-
}
|
|
1626
|
-
use(...r) {
|
|
1627
|
-
let e = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
1628
|
-
return r.forEach((t) => {
|
|
1629
|
-
let s = { ...t };
|
|
1630
|
-
if (s.async = this.defaults.async || s.async || !1, t.extensions && (t.extensions.forEach((n) => {
|
|
1631
|
-
if (!n.name) throw new Error("extension name required");
|
|
1632
|
-
if ("renderer" in n) {
|
|
1633
|
-
let a = e.renderers[n.name];
|
|
1634
|
-
a ? e.renderers[n.name] = function(...l) {
|
|
1635
|
-
let p = n.renderer.apply(this, l);
|
|
1636
|
-
return p === !1 && (p = a.apply(this, l)), p;
|
|
1637
|
-
} : e.renderers[n.name] = n.renderer;
|
|
1638
|
-
}
|
|
1639
|
-
if ("tokenizer" in n) {
|
|
1640
|
-
if (!n.level || n.level !== "block" && n.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
1641
|
-
let a = e[n.level];
|
|
1642
|
-
a ? a.unshift(n.tokenizer) : e[n.level] = [n.tokenizer], n.start && (n.level === "block" ? e.startBlock ? e.startBlock.push(n.start) : e.startBlock = [n.start] : n.level === "inline" && (e.startInline ? e.startInline.push(n.start) : e.startInline = [n.start]));
|
|
1643
|
-
}
|
|
1644
|
-
"childTokens" in n && n.childTokens && (e.childTokens[n.name] = n.childTokens);
|
|
1645
|
-
}), s.extensions = e), t.renderer) {
|
|
1646
|
-
let n = this.defaults.renderer || new nt(this.defaults);
|
|
1647
|
-
for (let a in t.renderer) {
|
|
1648
|
-
if (!(a in n)) throw new Error(`renderer '${a}' does not exist`);
|
|
1649
|
-
if (["options", "parser"].includes(a)) continue;
|
|
1650
|
-
let l = a, p = t.renderer[l], o = n[l];
|
|
1651
|
-
n[l] = (...h) => {
|
|
1652
|
-
let u = p.apply(n, h);
|
|
1653
|
-
return u === !1 && (u = o.apply(n, h)), u || "";
|
|
1654
|
-
};
|
|
1655
|
-
}
|
|
1656
|
-
s.renderer = n;
|
|
1657
|
-
}
|
|
1658
|
-
if (t.tokenizer) {
|
|
1659
|
-
let n = this.defaults.tokenizer || new tt(this.defaults);
|
|
1660
|
-
for (let a in t.tokenizer) {
|
|
1661
|
-
if (!(a in n)) throw new Error(`tokenizer '${a}' does not exist`);
|
|
1662
|
-
if (["options", "rules", "lexer"].includes(a)) continue;
|
|
1663
|
-
let l = a, p = t.tokenizer[l], o = n[l];
|
|
1664
|
-
n[l] = (...h) => {
|
|
1665
|
-
let u = p.apply(n, h);
|
|
1666
|
-
return u === !1 && (u = o.apply(n, h)), u;
|
|
1667
|
-
};
|
|
1668
|
-
}
|
|
1669
|
-
s.tokenizer = n;
|
|
1670
|
-
}
|
|
1671
|
-
if (t.hooks) {
|
|
1672
|
-
let n = this.defaults.hooks || new Pe();
|
|
1673
|
-
for (let a in t.hooks) {
|
|
1674
|
-
if (!(a in n)) throw new Error(`hook '${a}' does not exist`);
|
|
1675
|
-
if (["options", "block"].includes(a)) continue;
|
|
1676
|
-
let l = a, p = t.hooks[l], o = n[l];
|
|
1677
|
-
Pe.passThroughHooks.has(a) ? n[l] = (h) => {
|
|
1678
|
-
if (this.defaults.async && Pe.passThroughHooksRespectAsync.has(a)) return (async () => {
|
|
1679
|
-
let m = await p.call(n, h);
|
|
1680
|
-
return o.call(n, m);
|
|
1681
|
-
})();
|
|
1682
|
-
let u = p.call(n, h);
|
|
1683
|
-
return o.call(n, u);
|
|
1684
|
-
} : n[l] = (...h) => {
|
|
1685
|
-
if (this.defaults.async) return (async () => {
|
|
1686
|
-
let m = await p.apply(n, h);
|
|
1687
|
-
return m === !1 && (m = await o.apply(n, h)), m;
|
|
1688
|
-
})();
|
|
1689
|
-
let u = p.apply(n, h);
|
|
1690
|
-
return u === !1 && (u = o.apply(n, h)), u;
|
|
1691
|
-
};
|
|
1692
|
-
}
|
|
1693
|
-
s.hooks = n;
|
|
1694
|
-
}
|
|
1695
|
-
if (t.walkTokens) {
|
|
1696
|
-
let n = this.defaults.walkTokens, a = t.walkTokens;
|
|
1697
|
-
s.walkTokens = function(l) {
|
|
1698
|
-
let p = [];
|
|
1699
|
-
return p.push(a.call(this, l)), n && (p = p.concat(n.call(this, l))), p;
|
|
1700
|
-
};
|
|
1701
|
-
}
|
|
1702
|
-
this.defaults = { ...this.defaults, ...s };
|
|
1703
|
-
}), this;
|
|
1704
|
-
}
|
|
1705
|
-
setOptions(r) {
|
|
1706
|
-
return this.defaults = { ...this.defaults, ...r }, this;
|
|
1707
|
-
}
|
|
1708
|
-
lexer(r, e) {
|
|
1709
|
-
return Y.lex(r, e ?? this.defaults);
|
|
1710
|
-
}
|
|
1711
|
-
parser(r, e) {
|
|
1712
|
-
return X.parse(r, e ?? this.defaults);
|
|
1713
|
-
}
|
|
1714
|
-
parseMarkdown(r) {
|
|
1715
|
-
return (e, t) => {
|
|
1716
|
-
let s = { ...t }, n = { ...this.defaults, ...s }, a = this.onError(!!n.silent, !!n.async);
|
|
1717
|
-
if (this.defaults.async === !0 && s.async === !1) return a(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."));
|
|
1718
|
-
if (typeof e > "u" || e === null) return a(new Error("marked(): input parameter is undefined or null"));
|
|
1719
|
-
if (typeof e != "string") return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
|
|
1720
|
-
if (n.hooks && (n.hooks.options = n, n.hooks.block = r), n.async) return (async () => {
|
|
1721
|
-
let l = n.hooks ? await n.hooks.preprocess(e) : e, p = await (n.hooks ? await n.hooks.provideLexer() : r ? Y.lex : Y.lexInline)(l, n), o = n.hooks ? await n.hooks.processAllTokens(p) : p;
|
|
1722
|
-
n.walkTokens && await Promise.all(this.walkTokens(o, n.walkTokens));
|
|
1723
|
-
let h = await (n.hooks ? await n.hooks.provideParser() : r ? X.parse : X.parseInline)(o, n);
|
|
1724
|
-
return n.hooks ? await n.hooks.postprocess(h) : h;
|
|
1725
|
-
})().catch(a);
|
|
1726
|
-
try {
|
|
1727
|
-
n.hooks && (e = n.hooks.preprocess(e));
|
|
1728
|
-
let l = (n.hooks ? n.hooks.provideLexer() : r ? Y.lex : Y.lexInline)(e, n);
|
|
1729
|
-
n.hooks && (l = n.hooks.processAllTokens(l)), n.walkTokens && this.walkTokens(l, n.walkTokens);
|
|
1730
|
-
let p = (n.hooks ? n.hooks.provideParser() : r ? X.parse : X.parseInline)(l, n);
|
|
1731
|
-
return n.hooks && (p = n.hooks.postprocess(p)), p;
|
|
1732
|
-
} catch (l) {
|
|
1733
|
-
return a(l);
|
|
1734
|
-
}
|
|
1735
|
-
};
|
|
1736
|
-
}
|
|
1737
|
-
onError(r, e) {
|
|
1738
|
-
return (t) => {
|
|
1739
|
-
if (t.message += `
|
|
1740
|
-
Please report this to https://github.com/markedjs/marked.`, r) {
|
|
1741
|
-
let s = "<p>An error occurred:</p><pre>" + ee(t.message + "", !0) + "</pre>";
|
|
1742
|
-
return e ? Promise.resolve(s) : s;
|
|
1743
|
-
}
|
|
1744
|
-
if (e) return Promise.reject(t);
|
|
1745
|
-
throw t;
|
|
1746
|
-
};
|
|
1747
|
-
}
|
|
1748
|
-
}, de = new os();
|
|
1749
|
-
function w(r, e) {
|
|
1750
|
-
return de.parse(r, e);
|
|
1751
|
-
}
|
|
1752
|
-
w.options = w.setOptions = function(r) {
|
|
1753
|
-
return de.setOptions(r), w.defaults = de.defaults, Ln(w.defaults), w;
|
|
1754
|
-
};
|
|
1755
|
-
w.getDefaults = Lt;
|
|
1756
|
-
w.defaults = me;
|
|
1757
|
-
w.use = function(...r) {
|
|
1758
|
-
return de.use(...r), w.defaults = de.defaults, Ln(w.defaults), w;
|
|
1759
|
-
};
|
|
1760
|
-
w.walkTokens = function(r, e) {
|
|
1761
|
-
return de.walkTokens(r, e);
|
|
1762
|
-
};
|
|
1763
|
-
w.parseInline = de.parseInline;
|
|
1764
|
-
w.Parser = X;
|
|
1765
|
-
w.parser = X.parse;
|
|
1766
|
-
w.Renderer = nt;
|
|
1767
|
-
w.TextRenderer = Pt;
|
|
1768
|
-
w.Lexer = Y;
|
|
1769
|
-
w.lexer = Y.lex;
|
|
1770
|
-
w.Tokenizer = tt;
|
|
1771
|
-
w.Hooks = Pe;
|
|
1772
|
-
w.parse = w;
|
|
1773
|
-
w.options;
|
|
1774
|
-
w.setOptions;
|
|
1775
|
-
w.use;
|
|
1776
|
-
w.walkTokens;
|
|
1777
|
-
w.parseInline;
|
|
1778
|
-
X.parse;
|
|
1779
|
-
Y.lex;
|
|
1780
|
-
function cs(r) {
|
|
1781
|
-
return r.replace(/([^\s>])(<a\b)/gu, "$1 $2").replace(/(<\/a>)([\p{L}\p{N}])/gu, "$1 $2");
|
|
1782
|
-
}
|
|
1783
|
-
function ps(r) {
|
|
1784
|
-
const t = new DOMParser().parseFromString(r, "text/html"), s = t.querySelectorAll("a");
|
|
1785
|
-
for (const n of s)
|
|
1786
|
-
n.setAttribute("target", "_blank"), n.setAttribute("rel", "noopener noreferrer");
|
|
1787
|
-
return t.body.innerHTML;
|
|
1788
|
-
}
|
|
1789
|
-
function us(r, e) {
|
|
1790
|
-
const t = cs(r), s = w.parse(t), n = kr.sanitize(s, {
|
|
1791
|
-
FORBID_TAGS: e
|
|
1792
|
-
});
|
|
1793
|
-
return ps(n);
|
|
1794
|
-
}
|
|
1795
|
-
function ds({
|
|
1796
|
-
content: r,
|
|
1797
|
-
class: e,
|
|
1798
|
-
disallowedTags: t = []
|
|
1799
|
-
}) {
|
|
1800
|
-
if (!r)
|
|
1801
|
-
return null;
|
|
1802
|
-
const s = us(r, t);
|
|
1803
|
-
return /* @__PURE__ */ an("div", { class: e, children: /* @__PURE__ */ an(wr, { markup: s, type: "html", trim: !1 }) });
|
|
1804
|
-
}
|
|
1805
|
-
export {
|
|
1806
|
-
ds as R
|
|
1807
|
-
};
|