@dotss/tictoccroc 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +36 -32
- package/dist/parent/b2b/components/TopLogo/TopLogo.d.ts +3 -3
- package/dist/parent/b2b/components/TopLogo/TopLogo.mjs +4 -4
- package/dist/parent/b2b/utils/convertMdToHtml/convertMdToHtml.mjs +645 -1194
- package/dist/parent/notification/components/NotificationCard/NotificationCard.d.ts +19 -0
- package/dist/parent/notification/components/NotificationCard/NotificationCard.mjs +106 -0
- package/dist/parent/notification/components/NotificationCard/index.d.ts +3 -0
- package/dist/parent/notification/components/NotificationCard/index.mjs +4 -0
- package/dist/parent/notification/components/index.d.ts +2 -0
- package/dist/parent/notification/components/index.mjs +4 -0
- package/dist/parent/notification/utils/index.d.ts +1 -0
- package/dist/parent/notification/utils/index.mjs +4 -0
- package/dist/parent/notification/utils/sanitize/sanitize.d.ts +1 -0
- package/dist/parent/notification/utils/sanitize/sanitize.mjs +7 -0
- package/dist/parent/notification/utils/sanitize/sanitize.test.d.ts +1 -0
- package/dist/purify.es-BGaRrCfO.js +553 -0
- package/package.json +2 -2
|
@@ -1,1009 +1,460 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
entries: hn,
|
|
7
|
-
setPrototypeOf: Vt,
|
|
8
|
-
isFrozen: Wn,
|
|
9
|
-
getPrototypeOf: qn,
|
|
10
|
-
getOwnPropertyDescriptor: Zn
|
|
11
|
-
} = Object;
|
|
12
|
-
let {
|
|
13
|
-
freeze: z,
|
|
14
|
-
seal: F,
|
|
15
|
-
create: ht
|
|
16
|
-
} = Object, {
|
|
17
|
-
apply: ft,
|
|
18
|
-
construct: gt
|
|
19
|
-
} = typeof Reflect < "u" && Reflect;
|
|
20
|
-
z || (z = function(e) {
|
|
21
|
-
return e;
|
|
22
|
-
});
|
|
23
|
-
F || (F = function(e) {
|
|
24
|
-
return e;
|
|
25
|
-
});
|
|
26
|
-
ft || (ft = function(e, t) {
|
|
27
|
-
for (var r = arguments.length, s = new Array(r > 2 ? r - 2 : 0), a = 2; a < r; a++)
|
|
28
|
-
s[a - 2] = arguments[a];
|
|
29
|
-
return e.apply(t, s);
|
|
30
|
-
});
|
|
31
|
-
gt || (gt = function(e) {
|
|
32
|
-
for (var t = arguments.length, r = new Array(t > 1 ? t - 1 : 0), s = 1; s < t; s++)
|
|
33
|
-
r[s - 1] = arguments[s];
|
|
34
|
-
return new e(...r);
|
|
35
|
-
});
|
|
36
|
-
const Me = $(Array.prototype.forEach), Yn = $(Array.prototype.lastIndexOf), Kt = $(Array.prototype.pop), xe = $(Array.prototype.push), jn = $(Array.prototype.splice), Ue = $(String.prototype.toLowerCase), lt = $(String.prototype.toString), at = $(String.prototype.match), Te = $(String.prototype.replace), Xn = $(String.prototype.indexOf), Qn = $(String.prototype.trim), B = $(Object.prototype.hasOwnProperty), M = $(RegExp.prototype.test), we = Vn(TypeError);
|
|
37
|
-
function $(n) {
|
|
38
|
-
return function(e) {
|
|
39
|
-
e instanceof RegExp && (e.lastIndex = 0);
|
|
40
|
-
for (var t = arguments.length, r = new Array(t > 1 ? t - 1 : 0), s = 1; s < t; s++)
|
|
41
|
-
r[s - 1] = arguments[s];
|
|
42
|
-
return ft(n, e, r);
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function Vn(n) {
|
|
46
|
-
return function() {
|
|
47
|
-
for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
|
|
48
|
-
t[r] = arguments[r];
|
|
49
|
-
return gt(n, t);
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
function b(n, e) {
|
|
53
|
-
let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Ue;
|
|
54
|
-
Vt && Vt(n, null);
|
|
55
|
-
let r = e.length;
|
|
56
|
-
for (; r--; ) {
|
|
57
|
-
let s = e[r];
|
|
58
|
-
if (typeof s == "string") {
|
|
59
|
-
const a = t(s);
|
|
60
|
-
a !== s && (Wn(e) || (e[r] = a), s = a);
|
|
61
|
-
}
|
|
62
|
-
n[s] = !0;
|
|
63
|
-
}
|
|
64
|
-
return n;
|
|
65
|
-
}
|
|
66
|
-
function Kn(n) {
|
|
67
|
-
for (let e = 0; e < n.length; e++)
|
|
68
|
-
B(n, e) || (n[e] = null);
|
|
69
|
-
return n;
|
|
70
|
-
}
|
|
71
|
-
function Z(n) {
|
|
72
|
-
const e = ht(null);
|
|
73
|
-
for (const [t, r] of hn(n))
|
|
74
|
-
B(n, t) && (Array.isArray(r) ? e[t] = Kn(r) : r && typeof r == "object" && r.constructor === Object ? e[t] = Z(r) : e[t] = r);
|
|
75
|
-
return e;
|
|
76
|
-
}
|
|
77
|
-
function Ae(n, e) {
|
|
78
|
-
for (; n !== null; ) {
|
|
79
|
-
const r = Zn(n, e);
|
|
80
|
-
if (r) {
|
|
81
|
-
if (r.get)
|
|
82
|
-
return $(r.get);
|
|
83
|
-
if (typeof r.value == "function")
|
|
84
|
-
return $(r.value);
|
|
85
|
-
}
|
|
86
|
-
n = qn(n);
|
|
87
|
-
}
|
|
88
|
-
function t() {
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
return t;
|
|
92
|
-
}
|
|
93
|
-
const Jt = 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"]), ot = 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"]), ct = 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"]), Jn = 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"]), ut = 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"]), er = z(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), en = z(["#text"]), tn = 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"]), pt = 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"]), nn = 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"]), ve = z(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), tr = F(/\{\{[\w\W]*|[\w\W]*\}\}/gm), nr = F(/<%[\w\W]*|[\w\W]*%>/gm), rr = F(/\$\{[\w\W]*/gm), sr = F(/^data-[\-\w.\u00B7-\uFFFF]+$/), ir = F(/^aria-[\-\w]+$/), fn = F(
|
|
94
|
-
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
95
|
-
// eslint-disable-line no-useless-escape
|
|
96
|
-
), lr = F(/^(?:\w+script|data):/i), ar = F(
|
|
97
|
-
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
98
|
-
// eslint-disable-line no-control-regex
|
|
99
|
-
), gn = F(/^html$/i), or = F(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
100
|
-
var rn = /* @__PURE__ */ Object.freeze({
|
|
101
|
-
__proto__: null,
|
|
102
|
-
ARIA_ATTR: ir,
|
|
103
|
-
ATTR_WHITESPACE: ar,
|
|
104
|
-
CUSTOM_ELEMENT: or,
|
|
105
|
-
DATA_ATTR: sr,
|
|
106
|
-
DOCTYPE_NAME: gn,
|
|
107
|
-
ERB_EXPR: nr,
|
|
108
|
-
IS_ALLOWED_URI: fn,
|
|
109
|
-
IS_SCRIPT_OR_DATA: lr,
|
|
110
|
-
MUSTACHE_EXPR: tr,
|
|
111
|
-
TMPLIT_EXPR: rr
|
|
112
|
-
});
|
|
113
|
-
const _e = {
|
|
114
|
-
element: 1,
|
|
115
|
-
text: 3,
|
|
116
|
-
// Deprecated
|
|
117
|
-
progressingInstruction: 7,
|
|
118
|
-
comment: 8,
|
|
119
|
-
document: 9
|
|
120
|
-
}, cr = function() {
|
|
121
|
-
return typeof window > "u" ? null : window;
|
|
122
|
-
}, ur = function(e, t) {
|
|
123
|
-
if (typeof e != "object" || typeof e.createPolicy != "function")
|
|
124
|
-
return null;
|
|
125
|
-
let r = null;
|
|
126
|
-
const s = "data-tt-policy-suffix";
|
|
127
|
-
t && t.hasAttribute(s) && (r = t.getAttribute(s));
|
|
128
|
-
const a = "dompurify" + (r ? "#" + r : "");
|
|
129
|
-
try {
|
|
130
|
-
return e.createPolicy(a, {
|
|
131
|
-
createHTML(o) {
|
|
132
|
-
return o;
|
|
133
|
-
},
|
|
134
|
-
createScriptURL(o) {
|
|
135
|
-
return o;
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
} catch {
|
|
139
|
-
return console.warn("TrustedTypes policy " + a + " could not be created."), null;
|
|
140
|
-
}
|
|
141
|
-
}, sn = function() {
|
|
142
|
-
return {
|
|
143
|
-
afterSanitizeAttributes: [],
|
|
144
|
-
afterSanitizeElements: [],
|
|
145
|
-
afterSanitizeShadowDOM: [],
|
|
146
|
-
beforeSanitizeAttributes: [],
|
|
147
|
-
beforeSanitizeElements: [],
|
|
148
|
-
beforeSanitizeShadowDOM: [],
|
|
149
|
-
uponSanitizeAttribute: [],
|
|
150
|
-
uponSanitizeElement: [],
|
|
151
|
-
uponSanitizeShadowNode: []
|
|
152
|
-
};
|
|
153
|
-
};
|
|
154
|
-
function dn() {
|
|
155
|
-
let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : cr();
|
|
156
|
-
const e = (d) => dn(d);
|
|
157
|
-
if (e.version = "3.3.1", e.removed = [], !n || !n.document || n.document.nodeType !== _e.document || !n.Element)
|
|
158
|
-
return e.isSupported = !1, e;
|
|
159
|
-
let {
|
|
160
|
-
document: t
|
|
161
|
-
} = n;
|
|
162
|
-
const r = t, s = r.currentScript, {
|
|
163
|
-
DocumentFragment: a,
|
|
164
|
-
HTMLTemplateElement: o,
|
|
165
|
-
Node: l,
|
|
166
|
-
Element: h,
|
|
167
|
-
NodeFilter: c,
|
|
168
|
-
NamedNodeMap: f = n.NamedNodeMap || n.MozNamedAttrMap,
|
|
169
|
-
HTMLFormElement: k,
|
|
170
|
-
DOMParser: m,
|
|
171
|
-
trustedTypes: p
|
|
172
|
-
} = n, w = h.prototype, x = Ae(w, "cloneNode"), S = Ae(w, "remove"), V = Ae(w, "nextSibling"), le = Ae(w, "childNodes"), K = Ae(w, "parentNode");
|
|
173
|
-
if (typeof o == "function") {
|
|
174
|
-
const d = t.createElement("template");
|
|
175
|
-
d.content && d.content.ownerDocument && (t = d.content.ownerDocument);
|
|
176
|
-
}
|
|
177
|
-
let I, J = "";
|
|
178
|
-
const {
|
|
179
|
-
implementation: ge,
|
|
180
|
-
createNodeIterator: de,
|
|
181
|
-
createDocumentFragment: ee,
|
|
182
|
-
getElementsByTagName: Ln
|
|
183
|
-
} = t, {
|
|
184
|
-
importNode: In
|
|
185
|
-
} = r;
|
|
186
|
-
let P = sn();
|
|
187
|
-
e.isSupported = typeof hn == "function" && typeof K == "function" && ge && ge.createHTMLDocument !== void 0;
|
|
188
|
-
const {
|
|
189
|
-
MUSTACHE_EXPR: qe,
|
|
190
|
-
ERB_EXPR: Ze,
|
|
191
|
-
TMPLIT_EXPR: Ye,
|
|
192
|
-
DATA_ATTR: Dn,
|
|
193
|
-
ARIA_ATTR: Cn,
|
|
194
|
-
IS_SCRIPT_OR_DATA: On,
|
|
195
|
-
ATTR_WHITESPACE: yt,
|
|
196
|
-
CUSTOM_ELEMENT: Nn
|
|
197
|
-
} = rn;
|
|
198
|
-
let {
|
|
199
|
-
IS_ALLOWED_URI: Lt
|
|
200
|
-
} = rn, D = null;
|
|
201
|
-
const It = b({}, [...Jt, ...ot, ...ct, ...ut, ...en]);
|
|
202
|
-
let C = null;
|
|
203
|
-
const Dt = b({}, [...tn, ...pt, ...nn, ...ve]);
|
|
204
|
-
let R = Object.seal(ht(null, {
|
|
205
|
-
tagNameCheck: {
|
|
206
|
-
writable: !0,
|
|
207
|
-
configurable: !1,
|
|
208
|
-
enumerable: !0,
|
|
209
|
-
value: null
|
|
210
|
-
},
|
|
211
|
-
attributeNameCheck: {
|
|
212
|
-
writable: !0,
|
|
213
|
-
configurable: !1,
|
|
214
|
-
enumerable: !0,
|
|
215
|
-
value: null
|
|
216
|
-
},
|
|
217
|
-
allowCustomizedBuiltInElements: {
|
|
218
|
-
writable: !0,
|
|
219
|
-
configurable: !1,
|
|
220
|
-
enumerable: !0,
|
|
221
|
-
value: !1
|
|
222
|
-
}
|
|
223
|
-
})), me = null, je = null;
|
|
224
|
-
const ae = Object.seal(ht(null, {
|
|
225
|
-
tagCheck: {
|
|
226
|
-
writable: !0,
|
|
227
|
-
configurable: !1,
|
|
228
|
-
enumerable: !0,
|
|
229
|
-
value: null
|
|
230
|
-
},
|
|
231
|
-
attributeCheck: {
|
|
232
|
-
writable: !0,
|
|
233
|
-
configurable: !1,
|
|
234
|
-
enumerable: !0,
|
|
235
|
-
value: null
|
|
236
|
-
}
|
|
237
|
-
}));
|
|
238
|
-
let Ct = !0, Xe = !0, Ot = !1, Nt = !0, oe = !1, Le = !0, te = !1, Qe = !1, Ve = !1, ce = !1, Ie = !1, De = !1, Pt = !0, Mt = !1;
|
|
239
|
-
const Pn = "user-content-";
|
|
240
|
-
let Ke = !0, ke = !1, ue = {}, W = null;
|
|
241
|
-
const Je = b({}, ["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"]);
|
|
242
|
-
let vt = null;
|
|
243
|
-
const zt = b({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
244
|
-
let et = null;
|
|
245
|
-
const $t = b({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), Ce = "http://www.w3.org/1998/Math/MathML", Oe = "http://www.w3.org/2000/svg", j = "http://www.w3.org/1999/xhtml";
|
|
246
|
-
let pe = j, tt = !1, nt = null;
|
|
247
|
-
const Mn = b({}, [Ce, Oe, j], lt);
|
|
248
|
-
let Ne = b({}, ["mi", "mo", "mn", "ms", "mtext"]), Pe = b({}, ["annotation-xml"]);
|
|
249
|
-
const vn = b({}, ["title", "style", "font", "a", "script"]);
|
|
250
|
-
let be = null;
|
|
251
|
-
const zn = ["application/xhtml+xml", "text/html"], $n = "text/html";
|
|
252
|
-
let L = null, he = null;
|
|
253
|
-
const Un = t.createElement("form"), Ut = function(i) {
|
|
254
|
-
return i instanceof RegExp || i instanceof Function;
|
|
255
|
-
}, rt = function() {
|
|
256
|
-
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
257
|
-
if (!(he && he === i)) {
|
|
258
|
-
if ((!i || typeof i != "object") && (i = {}), i = Z(i), be = // eslint-disable-next-line unicorn/prefer-includes
|
|
259
|
-
zn.indexOf(i.PARSER_MEDIA_TYPE) === -1 ? $n : i.PARSER_MEDIA_TYPE, L = be === "application/xhtml+xml" ? lt : Ue, D = B(i, "ALLOWED_TAGS") ? b({}, i.ALLOWED_TAGS, L) : It, C = B(i, "ALLOWED_ATTR") ? b({}, i.ALLOWED_ATTR, L) : Dt, nt = B(i, "ALLOWED_NAMESPACES") ? b({}, i.ALLOWED_NAMESPACES, lt) : Mn, et = B(i, "ADD_URI_SAFE_ATTR") ? b(Z($t), i.ADD_URI_SAFE_ATTR, L) : $t, vt = B(i, "ADD_DATA_URI_TAGS") ? b(Z(zt), i.ADD_DATA_URI_TAGS, L) : zt, W = B(i, "FORBID_CONTENTS") ? b({}, i.FORBID_CONTENTS, L) : Je, me = B(i, "FORBID_TAGS") ? b({}, i.FORBID_TAGS, L) : Z({}), je = B(i, "FORBID_ATTR") ? b({}, i.FORBID_ATTR, L) : Z({}), ue = B(i, "USE_PROFILES") ? i.USE_PROFILES : !1, Ct = i.ALLOW_ARIA_ATTR !== !1, Xe = i.ALLOW_DATA_ATTR !== !1, Ot = i.ALLOW_UNKNOWN_PROTOCOLS || !1, Nt = i.ALLOW_SELF_CLOSE_IN_ATTR !== !1, oe = i.SAFE_FOR_TEMPLATES || !1, Le = i.SAFE_FOR_XML !== !1, te = i.WHOLE_DOCUMENT || !1, ce = i.RETURN_DOM || !1, Ie = i.RETURN_DOM_FRAGMENT || !1, De = i.RETURN_TRUSTED_TYPE || !1, Ve = i.FORCE_BODY || !1, Pt = i.SANITIZE_DOM !== !1, Mt = i.SANITIZE_NAMED_PROPS || !1, Ke = i.KEEP_CONTENT !== !1, ke = i.IN_PLACE || !1, Lt = i.ALLOWED_URI_REGEXP || fn, pe = i.NAMESPACE || j, Ne = i.MATHML_TEXT_INTEGRATION_POINTS || Ne, Pe = i.HTML_INTEGRATION_POINTS || Pe, R = i.CUSTOM_ELEMENT_HANDLING || {}, i.CUSTOM_ELEMENT_HANDLING && Ut(i.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (R.tagNameCheck = i.CUSTOM_ELEMENT_HANDLING.tagNameCheck), i.CUSTOM_ELEMENT_HANDLING && Ut(i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (R.attributeNameCheck = i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), i.CUSTOM_ELEMENT_HANDLING && typeof i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (R.allowCustomizedBuiltInElements = i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), oe && (Xe = !1), Ie && (ce = !0), ue && (D = b({}, en), C = [], ue.html === !0 && (b(D, Jt), b(C, tn)), ue.svg === !0 && (b(D, ot), b(C, pt), b(C, ve)), ue.svgFilters === !0 && (b(D, ct), b(C, pt), b(C, ve)), ue.mathMl === !0 && (b(D, ut), b(C, nn), b(C, ve))), i.ADD_TAGS && (typeof i.ADD_TAGS == "function" ? ae.tagCheck = i.ADD_TAGS : (D === It && (D = Z(D)), b(D, i.ADD_TAGS, L))), i.ADD_ATTR && (typeof i.ADD_ATTR == "function" ? ae.attributeCheck = i.ADD_ATTR : (C === Dt && (C = Z(C)), b(C, i.ADD_ATTR, L))), i.ADD_URI_SAFE_ATTR && b(et, i.ADD_URI_SAFE_ATTR, L), i.FORBID_CONTENTS && (W === Je && (W = Z(W)), b(W, i.FORBID_CONTENTS, L)), i.ADD_FORBID_CONTENTS && (W === Je && (W = Z(W)), b(W, i.ADD_FORBID_CONTENTS, L)), Ke && (D["#text"] = !0), te && b(D, ["html", "head", "body"]), D.table && (b(D, ["tbody"]), delete me.tbody), i.TRUSTED_TYPES_POLICY) {
|
|
260
|
-
if (typeof i.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
261
|
-
throw we('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
262
|
-
if (typeof i.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
263
|
-
throw we('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
264
|
-
I = i.TRUSTED_TYPES_POLICY, J = I.createHTML("");
|
|
265
|
-
} else
|
|
266
|
-
I === void 0 && (I = ur(p, s)), I !== null && typeof J == "string" && (J = I.createHTML(""));
|
|
267
|
-
z && z(i), he = i;
|
|
268
|
-
}
|
|
269
|
-
}, Ft = b({}, [...ot, ...ct, ...Jn]), Bt = b({}, [...ut, ...er]), Fn = function(i) {
|
|
270
|
-
let u = K(i);
|
|
271
|
-
(!u || !u.tagName) && (u = {
|
|
272
|
-
namespaceURI: pe,
|
|
273
|
-
tagName: "template"
|
|
274
|
-
});
|
|
275
|
-
const g = Ue(i.tagName), E = Ue(u.tagName);
|
|
276
|
-
return nt[i.namespaceURI] ? i.namespaceURI === Oe ? u.namespaceURI === j ? g === "svg" : u.namespaceURI === Ce ? g === "svg" && (E === "annotation-xml" || Ne[E]) : !!Ft[g] : i.namespaceURI === Ce ? u.namespaceURI === j ? g === "math" : u.namespaceURI === Oe ? g === "math" && Pe[E] : !!Bt[g] : i.namespaceURI === j ? u.namespaceURI === Oe && !Pe[E] || u.namespaceURI === Ce && !Ne[E] ? !1 : !Bt[g] && (vn[g] || !Ft[g]) : !!(be === "application/xhtml+xml" && nt[i.namespaceURI]) : !1;
|
|
277
|
-
}, q = function(i) {
|
|
278
|
-
xe(e.removed, {
|
|
279
|
-
element: i
|
|
280
|
-
});
|
|
281
|
-
try {
|
|
282
|
-
K(i).removeChild(i);
|
|
283
|
-
} catch {
|
|
284
|
-
S(i);
|
|
285
|
-
}
|
|
286
|
-
}, ne = function(i, u) {
|
|
287
|
-
try {
|
|
288
|
-
xe(e.removed, {
|
|
289
|
-
attribute: u.getAttributeNode(i),
|
|
290
|
-
from: u
|
|
291
|
-
});
|
|
292
|
-
} catch {
|
|
293
|
-
xe(e.removed, {
|
|
294
|
-
attribute: null,
|
|
295
|
-
from: u
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
if (u.removeAttribute(i), i === "is")
|
|
299
|
-
if (ce || Ie)
|
|
300
|
-
try {
|
|
301
|
-
q(u);
|
|
302
|
-
} catch {
|
|
303
|
-
}
|
|
304
|
-
else
|
|
305
|
-
try {
|
|
306
|
-
u.setAttribute(i, "");
|
|
307
|
-
} catch {
|
|
308
|
-
}
|
|
309
|
-
}, Ht = function(i) {
|
|
310
|
-
let u = null, g = null;
|
|
311
|
-
if (Ve)
|
|
312
|
-
i = "<remove></remove>" + i;
|
|
313
|
-
else {
|
|
314
|
-
const y = at(i, /^[\r\n\t ]+/);
|
|
315
|
-
g = y && y[0];
|
|
316
|
-
}
|
|
317
|
-
be === "application/xhtml+xml" && pe === j && (i = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + i + "</body></html>");
|
|
318
|
-
const E = I ? I.createHTML(i) : i;
|
|
319
|
-
if (pe === j)
|
|
320
|
-
try {
|
|
321
|
-
u = new m().parseFromString(E, be);
|
|
322
|
-
} catch {
|
|
323
|
-
}
|
|
324
|
-
if (!u || !u.documentElement) {
|
|
325
|
-
u = ge.createDocument(pe, "template", null);
|
|
326
|
-
try {
|
|
327
|
-
u.documentElement.innerHTML = tt ? J : E;
|
|
328
|
-
} catch {
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
const N = u.body || u.documentElement;
|
|
332
|
-
return i && g && N.insertBefore(t.createTextNode(g), N.childNodes[0] || null), pe === j ? Ln.call(u, te ? "html" : "body")[0] : te ? u.documentElement : N;
|
|
333
|
-
}, Gt = function(i) {
|
|
334
|
-
return de.call(
|
|
335
|
-
i.ownerDocument || i,
|
|
336
|
-
i,
|
|
337
|
-
// eslint-disable-next-line no-bitwise
|
|
338
|
-
c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT | c.SHOW_PROCESSING_INSTRUCTION | c.SHOW_CDATA_SECTION,
|
|
339
|
-
null
|
|
340
|
-
);
|
|
341
|
-
}, st = function(i) {
|
|
342
|
-
return i instanceof k && (typeof i.nodeName != "string" || typeof i.textContent != "string" || typeof i.removeChild != "function" || !(i.attributes instanceof f) || typeof i.removeAttribute != "function" || typeof i.setAttribute != "function" || typeof i.namespaceURI != "string" || typeof i.insertBefore != "function" || typeof i.hasChildNodes != "function");
|
|
343
|
-
}, Wt = function(i) {
|
|
344
|
-
return typeof l == "function" && i instanceof l;
|
|
345
|
-
};
|
|
346
|
-
function X(d, i, u) {
|
|
347
|
-
Me(d, (g) => {
|
|
348
|
-
g.call(e, i, u, he);
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
const qt = function(i) {
|
|
352
|
-
let u = null;
|
|
353
|
-
if (X(P.beforeSanitizeElements, i, null), st(i))
|
|
354
|
-
return q(i), !0;
|
|
355
|
-
const g = L(i.nodeName);
|
|
356
|
-
if (X(P.uponSanitizeElement, i, {
|
|
357
|
-
tagName: g,
|
|
358
|
-
allowedTags: D
|
|
359
|
-
}), Le && i.hasChildNodes() && !Wt(i.firstElementChild) && M(/<[/\w!]/g, i.innerHTML) && M(/<[/\w!]/g, i.textContent) || i.nodeType === _e.progressingInstruction || Le && i.nodeType === _e.comment && M(/<[/\w]/g, i.data))
|
|
360
|
-
return q(i), !0;
|
|
361
|
-
if (!(ae.tagCheck instanceof Function && ae.tagCheck(g)) && (!D[g] || me[g])) {
|
|
362
|
-
if (!me[g] && Yt(g) && (R.tagNameCheck instanceof RegExp && M(R.tagNameCheck, g) || R.tagNameCheck instanceof Function && R.tagNameCheck(g)))
|
|
363
|
-
return !1;
|
|
364
|
-
if (Ke && !W[g]) {
|
|
365
|
-
const E = K(i) || i.parentNode, N = le(i) || i.childNodes;
|
|
366
|
-
if (N && E) {
|
|
367
|
-
const y = N.length;
|
|
368
|
-
for (let U = y - 1; U >= 0; --U) {
|
|
369
|
-
const Q = x(N[U], !0);
|
|
370
|
-
Q.__removalCount = (i.__removalCount || 0) + 1, E.insertBefore(Q, V(i));
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
return q(i), !0;
|
|
375
|
-
}
|
|
376
|
-
return i instanceof h && !Fn(i) || (g === "noscript" || g === "noembed" || g === "noframes") && M(/<\/no(script|embed|frames)/i, i.innerHTML) ? (q(i), !0) : (oe && i.nodeType === _e.text && (u = i.textContent, Me([qe, Ze, Ye], (E) => {
|
|
377
|
-
u = Te(u, E, " ");
|
|
378
|
-
}), i.textContent !== u && (xe(e.removed, {
|
|
379
|
-
element: i.cloneNode()
|
|
380
|
-
}), i.textContent = u)), X(P.afterSanitizeElements, i, null), !1);
|
|
381
|
-
}, Zt = function(i, u, g) {
|
|
382
|
-
if (Pt && (u === "id" || u === "name") && (g in t || g in Un))
|
|
383
|
-
return !1;
|
|
384
|
-
if (!(Xe && !je[u] && M(Dn, u))) {
|
|
385
|
-
if (!(Ct && M(Cn, u))) {
|
|
386
|
-
if (!(ae.attributeCheck instanceof Function && ae.attributeCheck(u, i))) {
|
|
387
|
-
if (!C[u] || je[u]) {
|
|
388
|
-
if (
|
|
389
|
-
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
390
|
-
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
391
|
-
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
392
|
-
!(Yt(i) && (R.tagNameCheck instanceof RegExp && M(R.tagNameCheck, i) || R.tagNameCheck instanceof Function && R.tagNameCheck(i)) && (R.attributeNameCheck instanceof RegExp && M(R.attributeNameCheck, u) || R.attributeNameCheck instanceof Function && R.attributeNameCheck(u, i)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
393
|
-
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
394
|
-
u === "is" && R.allowCustomizedBuiltInElements && (R.tagNameCheck instanceof RegExp && M(R.tagNameCheck, g) || R.tagNameCheck instanceof Function && R.tagNameCheck(g)))
|
|
395
|
-
) return !1;
|
|
396
|
-
} else if (!et[u]) {
|
|
397
|
-
if (!M(Lt, Te(g, yt, ""))) {
|
|
398
|
-
if (!((u === "src" || u === "xlink:href" || u === "href") && i !== "script" && Xn(g, "data:") === 0 && vt[i])) {
|
|
399
|
-
if (!(Ot && !M(On, Te(g, yt, "")))) {
|
|
400
|
-
if (g)
|
|
401
|
-
return !1;
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
return !0;
|
|
410
|
-
}, Yt = function(i) {
|
|
411
|
-
return i !== "annotation-xml" && at(i, Nn);
|
|
412
|
-
}, jt = function(i) {
|
|
413
|
-
X(P.beforeSanitizeAttributes, i, null);
|
|
414
|
-
const {
|
|
415
|
-
attributes: u
|
|
416
|
-
} = i;
|
|
417
|
-
if (!u || st(i))
|
|
418
|
-
return;
|
|
419
|
-
const g = {
|
|
420
|
-
attrName: "",
|
|
421
|
-
attrValue: "",
|
|
422
|
-
keepAttr: !0,
|
|
423
|
-
allowedAttributes: C,
|
|
424
|
-
forceKeepAttr: void 0
|
|
425
|
-
};
|
|
426
|
-
let E = u.length;
|
|
427
|
-
for (; E--; ) {
|
|
428
|
-
const N = u[E], {
|
|
429
|
-
name: y,
|
|
430
|
-
namespaceURI: U,
|
|
431
|
-
value: Q
|
|
432
|
-
} = N, fe = L(y), it = Q;
|
|
433
|
-
let O = y === "value" ? it : Qn(it);
|
|
434
|
-
if (g.attrName = fe, g.attrValue = O, g.keepAttr = !0, g.forceKeepAttr = void 0, X(P.uponSanitizeAttribute, i, g), O = g.attrValue, Mt && (fe === "id" || fe === "name") && (ne(y, i), O = Pn + O), Le && M(/((--!?|])>)|<\/(style|title|textarea)/i, O)) {
|
|
435
|
-
ne(y, i);
|
|
436
|
-
continue;
|
|
437
|
-
}
|
|
438
|
-
if (fe === "attributename" && at(O, "href")) {
|
|
439
|
-
ne(y, i);
|
|
440
|
-
continue;
|
|
441
|
-
}
|
|
442
|
-
if (g.forceKeepAttr)
|
|
443
|
-
continue;
|
|
444
|
-
if (!g.keepAttr) {
|
|
445
|
-
ne(y, i);
|
|
446
|
-
continue;
|
|
447
|
-
}
|
|
448
|
-
if (!Nt && M(/\/>/i, O)) {
|
|
449
|
-
ne(y, i);
|
|
450
|
-
continue;
|
|
451
|
-
}
|
|
452
|
-
oe && Me([qe, Ze, Ye], (Qt) => {
|
|
453
|
-
O = Te(O, Qt, " ");
|
|
454
|
-
});
|
|
455
|
-
const Xt = L(i.nodeName);
|
|
456
|
-
if (!Zt(Xt, fe, O)) {
|
|
457
|
-
ne(y, i);
|
|
458
|
-
continue;
|
|
459
|
-
}
|
|
460
|
-
if (I && typeof p == "object" && typeof p.getAttributeType == "function" && !U)
|
|
461
|
-
switch (p.getAttributeType(Xt, fe)) {
|
|
462
|
-
case "TrustedHTML": {
|
|
463
|
-
O = I.createHTML(O);
|
|
464
|
-
break;
|
|
465
|
-
}
|
|
466
|
-
case "TrustedScriptURL": {
|
|
467
|
-
O = I.createScriptURL(O);
|
|
468
|
-
break;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
if (O !== it)
|
|
472
|
-
try {
|
|
473
|
-
U ? i.setAttributeNS(U, y, O) : i.setAttribute(y, O), st(i) ? q(i) : Kt(e.removed);
|
|
474
|
-
} catch {
|
|
475
|
-
ne(y, i);
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
X(P.afterSanitizeAttributes, i, null);
|
|
479
|
-
}, Bn = function d(i) {
|
|
480
|
-
let u = null;
|
|
481
|
-
const g = Gt(i);
|
|
482
|
-
for (X(P.beforeSanitizeShadowDOM, i, null); u = g.nextNode(); )
|
|
483
|
-
X(P.uponSanitizeShadowNode, u, null), qt(u), jt(u), u.content instanceof a && d(u.content);
|
|
484
|
-
X(P.afterSanitizeShadowDOM, i, null);
|
|
485
|
-
};
|
|
486
|
-
return e.sanitize = function(d) {
|
|
487
|
-
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, u = null, g = null, E = null, N = null;
|
|
488
|
-
if (tt = !d, tt && (d = "<!-->"), typeof d != "string" && !Wt(d))
|
|
489
|
-
if (typeof d.toString == "function") {
|
|
490
|
-
if (d = d.toString(), typeof d != "string")
|
|
491
|
-
throw we("dirty is not a string, aborting");
|
|
492
|
-
} else
|
|
493
|
-
throw we("toString is not a function");
|
|
494
|
-
if (!e.isSupported)
|
|
495
|
-
return d;
|
|
496
|
-
if (Qe || rt(i), e.removed = [], typeof d == "string" && (ke = !1), ke) {
|
|
497
|
-
if (d.nodeName) {
|
|
498
|
-
const Q = L(d.nodeName);
|
|
499
|
-
if (!D[Q] || me[Q])
|
|
500
|
-
throw we("root node is forbidden and cannot be sanitized in-place");
|
|
501
|
-
}
|
|
502
|
-
} else if (d instanceof l)
|
|
503
|
-
u = Ht("<!---->"), g = u.ownerDocument.importNode(d, !0), g.nodeType === _e.element && g.nodeName === "BODY" || g.nodeName === "HTML" ? u = g : u.appendChild(g);
|
|
504
|
-
else {
|
|
505
|
-
if (!ce && !oe && !te && // eslint-disable-next-line unicorn/prefer-includes
|
|
506
|
-
d.indexOf("<") === -1)
|
|
507
|
-
return I && De ? I.createHTML(d) : d;
|
|
508
|
-
if (u = Ht(d), !u)
|
|
509
|
-
return ce ? null : De ? J : "";
|
|
510
|
-
}
|
|
511
|
-
u && Ve && q(u.firstChild);
|
|
512
|
-
const y = Gt(ke ? d : u);
|
|
513
|
-
for (; E = y.nextNode(); )
|
|
514
|
-
qt(E), jt(E), E.content instanceof a && Bn(E.content);
|
|
515
|
-
if (ke)
|
|
516
|
-
return d;
|
|
517
|
-
if (ce) {
|
|
518
|
-
if (Ie)
|
|
519
|
-
for (N = ee.call(u.ownerDocument); u.firstChild; )
|
|
520
|
-
N.appendChild(u.firstChild);
|
|
521
|
-
else
|
|
522
|
-
N = u;
|
|
523
|
-
return (C.shadowroot || C.shadowrootmode) && (N = In.call(r, N, !0)), N;
|
|
524
|
-
}
|
|
525
|
-
let U = te ? u.outerHTML : u.innerHTML;
|
|
526
|
-
return te && D["!doctype"] && u.ownerDocument && u.ownerDocument.doctype && u.ownerDocument.doctype.name && M(gn, u.ownerDocument.doctype.name) && (U = "<!DOCTYPE " + u.ownerDocument.doctype.name + `>
|
|
527
|
-
` + U), oe && Me([qe, Ze, Ye], (Q) => {
|
|
528
|
-
U = Te(U, Q, " ");
|
|
529
|
-
}), I && De ? I.createHTML(U) : U;
|
|
530
|
-
}, e.setConfig = function() {
|
|
531
|
-
let d = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
532
|
-
rt(d), Qe = !0;
|
|
533
|
-
}, e.clearConfig = function() {
|
|
534
|
-
he = null, Qe = !1;
|
|
535
|
-
}, e.isValidAttribute = function(d, i, u) {
|
|
536
|
-
he || rt({});
|
|
537
|
-
const g = L(d), E = L(i);
|
|
538
|
-
return Zt(g, E, u);
|
|
539
|
-
}, e.addHook = function(d, i) {
|
|
540
|
-
typeof i == "function" && xe(P[d], i);
|
|
541
|
-
}, e.removeHook = function(d, i) {
|
|
542
|
-
if (i !== void 0) {
|
|
543
|
-
const u = Yn(P[d], i);
|
|
544
|
-
return u === -1 ? void 0 : jn(P[d], u, 1)[0];
|
|
545
|
-
}
|
|
546
|
-
return Kt(P[d]);
|
|
547
|
-
}, e.removeHooks = function(d) {
|
|
548
|
-
P[d] = [];
|
|
549
|
-
}, e.removeAllHooks = function() {
|
|
550
|
-
P = sn();
|
|
551
|
-
}, e;
|
|
552
|
-
}
|
|
553
|
-
var pr = dn();
|
|
554
|
-
function bt() {
|
|
1
|
+
var Se = Object.defineProperty;
|
|
2
|
+
var $e = (r, e, t) => e in r ? Se(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var x = (r, e, t) => $e(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { p as Re } from "../../../../purify.es-BGaRrCfO.js";
|
|
5
|
+
function G() {
|
|
555
6
|
return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
|
|
556
7
|
}
|
|
557
|
-
var
|
|
558
|
-
function
|
|
559
|
-
|
|
8
|
+
var z = G();
|
|
9
|
+
function oe(r) {
|
|
10
|
+
z = r;
|
|
560
11
|
}
|
|
561
|
-
var
|
|
562
|
-
function
|
|
563
|
-
let t = typeof
|
|
564
|
-
let
|
|
565
|
-
return
|
|
12
|
+
var R = { exec: () => null };
|
|
13
|
+
function f(r, e = "") {
|
|
14
|
+
let t = typeof r == "string" ? r : r.source, s = { replace: (n, i) => {
|
|
15
|
+
let a = typeof i == "string" ? i : i.source;
|
|
16
|
+
return a = a.replace(m.caret, "$1"), t = t.replace(n, a), s;
|
|
566
17
|
}, getRegex: () => new RegExp(t, e) };
|
|
567
|
-
return
|
|
18
|
+
return s;
|
|
568
19
|
}
|
|
569
|
-
var
|
|
20
|
+
var Te = (() => {
|
|
570
21
|
try {
|
|
571
22
|
return !!new RegExp("(?<=1)(?<!1)");
|
|
572
23
|
} catch {
|
|
573
24
|
return !1;
|
|
574
25
|
}
|
|
575
|
-
})(),
|
|
576
|
-
]`).replace("lheading",
|
|
577
|
-
function
|
|
26
|
+
})(), m = { 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, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, 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)}}>`) }, ze = /^(?:[ \t]*(?:\n|$))+/, Ae = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, _e = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, B = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Pe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, X = / {0,3}(?:[*+-]|\d{1,9}[.)])/, ce = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, he = f(ce).replace(/bull/g, X).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(), Ie = f(ce).replace(/bull/g, X).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(), F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Le = /^[^\n]+/, W = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Be = f(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", W).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Ce = f(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, X).getRegex(), M = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, qe = f("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", U).replace("tag", M).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), pe = f(F).replace("hr", B).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", M).getRegex(), ve = f(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", pe).getRegex(), J = { blockquote: ve, code: Ae, def: Be, fences: _e, heading: Pe, hr: B, html: qe, lheading: he, list: Ce, newline: ze, paragraph: pe, table: R, text: Le }, re = f("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", B).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", M).getRegex(), Ee = { ...J, lheading: Ie, table: re, paragraph: f(F).replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re).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", M).getRegex() }, Ze = { ...J, html: f(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", U).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: R, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: f(F).replace("hr", B).replace("heading", ` *#{1,6} *[^
|
|
27
|
+
]`).replace("lheading", he).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, De = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Me = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ue = /^( {2,}|\\)\n(?!\s*$)/, Qe = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Q = /[\p{P}\p{S}]/u, K = /[\s\p{P}\p{S}]/u, ge = /[^\s\p{P}\p{S}]/u, He = f(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, K).getRegex(), ke = /(?!~)[\p{P}\p{S}]/u, Ne = /(?!~)[\s\p{P}\p{S}]/u, Oe = /(?:[^\s\p{P}\p{S}]|~)/u, fe = /(?![*_])[\p{P}\p{S}]/u, je = /(?![*_])[\s\p{P}\p{S}]/u, Ge = /(?:[^\s\p{P}\p{S}]|[*_])/u, Xe = f(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Te ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), de = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Fe = f(de, "u").replace(/punct/g, Q).getRegex(), We = f(de, "u").replace(/punct/g, ke).getRegex(), xe = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ue = f(xe, "gu").replace(/notPunctSpace/g, ge).replace(/punctSpace/g, K).replace(/punct/g, Q).getRegex(), Je = f(xe, "gu").replace(/notPunctSpace/g, Oe).replace(/punctSpace/g, Ne).replace(/punct/g, ke).getRegex(), Ke = f("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ge).replace(/punctSpace/g, K).replace(/punct/g, Q).getRegex(), Ve = f(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, fe).getRegex(), Ye = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", et = f(Ye, "gu").replace(/notPunctSpace/g, Ge).replace(/punctSpace/g, je).replace(/punct/g, fe).getRegex(), tt = f(/\\(punct)/, "gu").replace(/punct/g, Q).getRegex(), rt = f(/^<(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(), nt = f(U).replace("(?:-->|$)", "-->").getRegex(), st = f("^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", nt).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), E = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, lt = f(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", E).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), be = f(/^!?\[(label)\]\[(ref)\]/).replace("label", E).replace("ref", W).getRegex(), we = f(/^!?\[(ref)\](?:\[\])?/).replace("ref", W).getRegex(), it = f("reflink|nolink(?!\\()", "g").replace("reflink", be).replace("nolink", we).getRegex(), ne = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, V = { _backpedal: R, anyPunctuation: tt, autolink: rt, blockSkip: Xe, br: ue, code: Me, del: R, delLDelim: R, delRDelim: R, emStrongLDelim: Fe, emStrongRDelimAst: Ue, emStrongRDelimUnd: Ke, escape: De, link: lt, nolink: we, punctuation: He, reflink: be, reflinkSearch: it, tag: st, text: Qe, url: R }, at = { ...V, link: f(/^!?\[(label)\]\((.*?)\)/).replace("label", E).getRegex(), reflink: f(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", E).getRegex() }, N = { ...V, emStrongRDelimAst: Je, emStrongLDelim: We, delLDelim: Ve, delRDelim: et, url: f(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ne).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: f(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ne).getRegex() }, ot = { ...N, br: f(ue).replace("{2,}", "*").getRegex(), text: f(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, q = { normal: J, gfm: Ee, pedantic: Ze }, P = { normal: V, gfm: N, breaks: ot, pedantic: at }, ct = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, se = (r) => ct[r];
|
|
28
|
+
function $(r, e) {
|
|
578
29
|
if (e) {
|
|
579
|
-
if (
|
|
580
|
-
} else if (
|
|
581
|
-
return
|
|
30
|
+
if (m.escapeTest.test(r)) return r.replace(m.escapeReplace, se);
|
|
31
|
+
} else if (m.escapeTestNoEncode.test(r)) return r.replace(m.escapeReplaceNoEncode, se);
|
|
32
|
+
return r;
|
|
582
33
|
}
|
|
583
|
-
function
|
|
34
|
+
function le(r) {
|
|
584
35
|
try {
|
|
585
|
-
|
|
36
|
+
r = encodeURI(r).replace(m.percentDecode, "%");
|
|
586
37
|
} catch {
|
|
587
38
|
return null;
|
|
588
39
|
}
|
|
589
|
-
return n;
|
|
590
|
-
}
|
|
591
|
-
function un(n, e) {
|
|
592
|
-
var a;
|
|
593
|
-
let t = n.replace(v.findPipe, (o, l, h) => {
|
|
594
|
-
let c = !1, f = l;
|
|
595
|
-
for (; --f >= 0 && h[f] === "\\"; ) c = !c;
|
|
596
|
-
return c ? "|" : " |";
|
|
597
|
-
}), r = t.split(v.splitPipe), s = 0;
|
|
598
|
-
if (r[0].trim() || r.shift(), r.length > 0 && !((a = r.at(-1)) != null && a.trim()) && r.pop(), e) if (r.length > e) r.splice(e);
|
|
599
|
-
else for (; r.length < e; ) r.push("");
|
|
600
|
-
for (; s < r.length; s++) r[s] = r[s].trim().replace(v.slashPipe, "|");
|
|
601
40
|
return r;
|
|
602
41
|
}
|
|
603
|
-
function
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
42
|
+
function ie(r, e) {
|
|
43
|
+
var i;
|
|
44
|
+
let t = r.replace(m.findPipe, (a, l, h) => {
|
|
45
|
+
let o = !1, p = l;
|
|
46
|
+
for (; --p >= 0 && h[p] === "\\"; ) o = !o;
|
|
47
|
+
return o ? "|" : " |";
|
|
48
|
+
}), s = t.split(m.splitPipe), n = 0;
|
|
49
|
+
if (s[0].trim() || s.shift(), s.length > 0 && !((i = s.at(-1)) != null && i.trim()) && s.pop(), e) if (s.length > e) s.splice(e);
|
|
50
|
+
else for (; s.length < e; ) s.push("");
|
|
51
|
+
for (; n < s.length; n++) s[n] = s[n].trim().replace(m.slashPipe, "|");
|
|
52
|
+
return s;
|
|
53
|
+
}
|
|
54
|
+
function I(r, e, t) {
|
|
55
|
+
let s = r.length;
|
|
56
|
+
if (s === 0) return "";
|
|
57
|
+
let n = 0;
|
|
58
|
+
for (; n < s && r.charAt(s - n - 1) === e; )
|
|
59
|
+
n++;
|
|
60
|
+
return r.slice(0, s - n);
|
|
610
61
|
}
|
|
611
|
-
function
|
|
612
|
-
if (
|
|
62
|
+
function ht(r, e) {
|
|
63
|
+
if (r.indexOf(e[1]) === -1) return -1;
|
|
613
64
|
let t = 0;
|
|
614
|
-
for (let
|
|
615
|
-
else if (
|
|
616
|
-
else if (
|
|
65
|
+
for (let s = 0; s < r.length; s++) if (r[s] === "\\") s++;
|
|
66
|
+
else if (r[s] === e[0]) t++;
|
|
67
|
+
else if (r[s] === e[1] && (t--, t < 0)) return s;
|
|
617
68
|
return t > 0 ? -2 : -1;
|
|
618
69
|
}
|
|
619
|
-
function
|
|
620
|
-
let t = e,
|
|
621
|
-
for (let
|
|
622
|
-
let
|
|
623
|
-
|
|
624
|
-
} else
|
|
625
|
-
return
|
|
70
|
+
function pt(r, e = 0) {
|
|
71
|
+
let t = e, s = "";
|
|
72
|
+
for (let n of r) if (n === " ") {
|
|
73
|
+
let i = 4 - t % 4;
|
|
74
|
+
s += " ".repeat(i), t += i;
|
|
75
|
+
} else s += n, t++;
|
|
76
|
+
return s;
|
|
626
77
|
}
|
|
627
|
-
function
|
|
628
|
-
let
|
|
629
|
-
|
|
630
|
-
let h = { type:
|
|
631
|
-
return
|
|
78
|
+
function ae(r, e, t, s, n) {
|
|
79
|
+
let i = e.href, a = e.title || null, l = r[1].replace(n.other.outputLinkReplace, "$1");
|
|
80
|
+
s.state.inLink = !0;
|
|
81
|
+
let h = { type: r[0].charAt(0) === "!" ? "image" : "link", raw: t, href: i, title: a, text: l, tokens: s.inlineTokens(l) };
|
|
82
|
+
return s.state.inLink = !1, h;
|
|
632
83
|
}
|
|
633
|
-
function
|
|
634
|
-
let
|
|
635
|
-
if (
|
|
636
|
-
let
|
|
84
|
+
function ut(r, e, t) {
|
|
85
|
+
let s = r.match(t.other.indentCodeCompensation);
|
|
86
|
+
if (s === null) return e;
|
|
87
|
+
let n = s[1];
|
|
637
88
|
return e.split(`
|
|
638
|
-
`).map((
|
|
639
|
-
let
|
|
640
|
-
if (
|
|
641
|
-
let [l] =
|
|
642
|
-
return l.length >=
|
|
89
|
+
`).map((i) => {
|
|
90
|
+
let a = i.match(t.other.beginningSpace);
|
|
91
|
+
if (a === null) return i;
|
|
92
|
+
let [l] = a;
|
|
93
|
+
return l.length >= n.length ? i.slice(n.length) : i;
|
|
643
94
|
}).join(`
|
|
644
95
|
`);
|
|
645
96
|
}
|
|
646
|
-
var
|
|
647
|
-
constructor(
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
this.options =
|
|
652
|
-
}
|
|
653
|
-
space(
|
|
654
|
-
let e = this.rules.block.newline.exec(
|
|
97
|
+
var Z = class {
|
|
98
|
+
constructor(r) {
|
|
99
|
+
x(this, "options");
|
|
100
|
+
x(this, "rules");
|
|
101
|
+
x(this, "lexer");
|
|
102
|
+
this.options = r || z;
|
|
103
|
+
}
|
|
104
|
+
space(r) {
|
|
105
|
+
let e = this.rules.block.newline.exec(r);
|
|
655
106
|
if (e && e[0].length > 0) return { type: "space", raw: e[0] };
|
|
656
107
|
}
|
|
657
|
-
code(
|
|
658
|
-
let e = this.rules.block.code.exec(
|
|
108
|
+
code(r) {
|
|
109
|
+
let e = this.rules.block.code.exec(r);
|
|
659
110
|
if (e) {
|
|
660
111
|
let t = e[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
661
|
-
return { type: "code", raw: e[0], codeBlockStyle: "indented", text: this.options.pedantic ? t :
|
|
112
|
+
return { type: "code", raw: e[0], codeBlockStyle: "indented", text: this.options.pedantic ? t : I(t, `
|
|
662
113
|
`) };
|
|
663
114
|
}
|
|
664
115
|
}
|
|
665
|
-
fences(
|
|
666
|
-
let e = this.rules.block.fences.exec(
|
|
116
|
+
fences(r) {
|
|
117
|
+
let e = this.rules.block.fences.exec(r);
|
|
667
118
|
if (e) {
|
|
668
|
-
let t = e[0],
|
|
669
|
-
return { type: "code", raw: t, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text:
|
|
119
|
+
let t = e[0], s = ut(t, e[3] || "", this.rules);
|
|
120
|
+
return { type: "code", raw: t, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: s };
|
|
670
121
|
}
|
|
671
122
|
}
|
|
672
|
-
heading(
|
|
673
|
-
let e = this.rules.block.heading.exec(
|
|
123
|
+
heading(r) {
|
|
124
|
+
let e = this.rules.block.heading.exec(r);
|
|
674
125
|
if (e) {
|
|
675
126
|
let t = e[2].trim();
|
|
676
127
|
if (this.rules.other.endingHash.test(t)) {
|
|
677
|
-
let
|
|
678
|
-
(this.options.pedantic || !
|
|
128
|
+
let s = I(t, "#");
|
|
129
|
+
(this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (t = s.trim());
|
|
679
130
|
}
|
|
680
131
|
return { type: "heading", raw: e[0], depth: e[1].length, text: t, tokens: this.lexer.inline(t) };
|
|
681
132
|
}
|
|
682
133
|
}
|
|
683
|
-
hr(
|
|
684
|
-
let e = this.rules.block.hr.exec(
|
|
685
|
-
if (e) return { type: "hr", raw:
|
|
134
|
+
hr(r) {
|
|
135
|
+
let e = this.rules.block.hr.exec(r);
|
|
136
|
+
if (e) return { type: "hr", raw: I(e[0], `
|
|
686
137
|
`) };
|
|
687
138
|
}
|
|
688
|
-
blockquote(
|
|
689
|
-
let e = this.rules.block.blockquote.exec(
|
|
139
|
+
blockquote(r) {
|
|
140
|
+
let e = this.rules.block.blockquote.exec(r);
|
|
690
141
|
if (e) {
|
|
691
|
-
let t =
|
|
142
|
+
let t = I(e[0], `
|
|
692
143
|
`).split(`
|
|
693
|
-
`),
|
|
144
|
+
`), s = "", n = "", i = [];
|
|
694
145
|
for (; t.length > 0; ) {
|
|
695
|
-
let
|
|
696
|
-
for (h = 0; h < t.length; h++) if (this.rules.other.blockquoteStart.test(t[h])) l.push(t[h]),
|
|
697
|
-
else if (!
|
|
146
|
+
let a = !1, l = [], h;
|
|
147
|
+
for (h = 0; h < t.length; h++) if (this.rules.other.blockquoteStart.test(t[h])) l.push(t[h]), a = !0;
|
|
148
|
+
else if (!a) l.push(t[h]);
|
|
698
149
|
else break;
|
|
699
150
|
t = t.slice(h);
|
|
700
|
-
let
|
|
701
|
-
`),
|
|
151
|
+
let o = l.join(`
|
|
152
|
+
`), p = o.replace(this.rules.other.blockquoteSetextReplace, `
|
|
702
153
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
703
|
-
|
|
704
|
-
${
|
|
705
|
-
${
|
|
706
|
-
let
|
|
707
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(
|
|
708
|
-
let
|
|
709
|
-
if ((
|
|
710
|
-
if ((
|
|
711
|
-
let
|
|
154
|
+
s = s ? `${s}
|
|
155
|
+
${o}` : o, n = n ? `${n}
|
|
156
|
+
${p}` : p;
|
|
157
|
+
let g = this.lexer.state.top;
|
|
158
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(p, i, !0), this.lexer.state.top = g, t.length === 0) break;
|
|
159
|
+
let u = i.at(-1);
|
|
160
|
+
if ((u == null ? void 0 : u.type) === "code") break;
|
|
161
|
+
if ((u == null ? void 0 : u.type) === "blockquote") {
|
|
162
|
+
let c = u, b = c.raw + `
|
|
712
163
|
` + t.join(`
|
|
713
|
-
`),
|
|
714
|
-
|
|
164
|
+
`), k = this.blockquote(b);
|
|
165
|
+
i[i.length - 1] = k, s = s.substring(0, s.length - c.raw.length) + k.raw, n = n.substring(0, n.length - c.text.length) + k.text;
|
|
715
166
|
break;
|
|
716
|
-
} else if ((
|
|
717
|
-
let
|
|
167
|
+
} else if ((u == null ? void 0 : u.type) === "list") {
|
|
168
|
+
let c = u, b = c.raw + `
|
|
718
169
|
` + t.join(`
|
|
719
|
-
`),
|
|
720
|
-
|
|
170
|
+
`), k = this.list(b);
|
|
171
|
+
i[i.length - 1] = k, s = s.substring(0, s.length - u.raw.length) + k.raw, n = n.substring(0, n.length - c.raw.length) + k.raw, t = b.substring(i.at(-1).raw.length).split(`
|
|
721
172
|
`);
|
|
722
173
|
continue;
|
|
723
174
|
}
|
|
724
175
|
}
|
|
725
|
-
return { type: "blockquote", raw:
|
|
176
|
+
return { type: "blockquote", raw: s, tokens: i, text: n };
|
|
726
177
|
}
|
|
727
178
|
}
|
|
728
|
-
list(
|
|
729
|
-
var t,
|
|
730
|
-
let e = this.rules.block.list.exec(
|
|
179
|
+
list(r) {
|
|
180
|
+
var t, s;
|
|
181
|
+
let e = this.rules.block.list.exec(r);
|
|
731
182
|
if (e) {
|
|
732
|
-
let
|
|
733
|
-
|
|
734
|
-
let l = this.rules.other.listItemRegex(
|
|
735
|
-
for (;
|
|
736
|
-
let
|
|
737
|
-
if (!(e = l.exec(
|
|
738
|
-
|
|
739
|
-
let
|
|
740
|
-
`, 1)[0], e[1].length),
|
|
741
|
-
`, 1)[0],
|
|
742
|
-
if (this.options.pedantic ? (
|
|
743
|
-
`,
|
|
744
|
-
let
|
|
745
|
-
for (;
|
|
746
|
-
let
|
|
747
|
-
`, 1)[0],
|
|
748
|
-
if (
|
|
749
|
-
if (
|
|
750
|
-
` +
|
|
183
|
+
let n = e[1].trim(), i = n.length > 1, a = { type: "list", raw: "", ordered: i, start: i ? +n.slice(0, -1) : "", loose: !1, items: [] };
|
|
184
|
+
n = i ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = i ? n : "[*+-]");
|
|
185
|
+
let l = this.rules.other.listItemRegex(n), h = !1;
|
|
186
|
+
for (; r; ) {
|
|
187
|
+
let p = !1, g = "", u = "";
|
|
188
|
+
if (!(e = l.exec(r)) || this.rules.block.hr.test(r)) break;
|
|
189
|
+
g = e[0], r = r.substring(g.length);
|
|
190
|
+
let c = pt(e[2].split(`
|
|
191
|
+
`, 1)[0], e[1].length), b = r.split(`
|
|
192
|
+
`, 1)[0], k = !c.trim(), w = 0;
|
|
193
|
+
if (this.options.pedantic ? (w = 2, u = c.trimStart()) : k ? w = e[1].length + 1 : (w = c.search(this.rules.other.nonSpaceChar), w = w > 4 ? 1 : w, u = c.slice(w), w += e[1].length), k && this.rules.other.blankLine.test(b) && (g += b + `
|
|
194
|
+
`, r = r.substring(b.length + 1), p = !0), !p) {
|
|
195
|
+
let A = this.rules.other.nextBulletRegex(w), C = this.rules.other.hrRegex(w), ee = this.rules.other.fencesBeginRegex(w), te = this.rules.other.headingBeginRegex(w), me = this.rules.other.htmlBeginRegex(w), ye = this.rules.other.blockquoteBeginRegex(w);
|
|
196
|
+
for (; r; ) {
|
|
197
|
+
let H = r.split(`
|
|
198
|
+
`, 1)[0], _;
|
|
199
|
+
if (b = H, this.options.pedantic ? (b = b.replace(this.rules.other.listReplaceNesting, " "), _ = b) : _ = b.replace(this.rules.other.tabCharGlobal, " "), ee.test(b) || te.test(b) || me.test(b) || ye.test(b) || A.test(b) || C.test(b)) break;
|
|
200
|
+
if (_.search(this.rules.other.nonSpaceChar) >= w || !b.trim()) u += `
|
|
201
|
+
` + _.slice(w);
|
|
751
202
|
else {
|
|
752
|
-
if (
|
|
753
|
-
|
|
754
|
-
` +
|
|
203
|
+
if (k || c.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || ee.test(c) || te.test(c) || C.test(c)) break;
|
|
204
|
+
u += `
|
|
205
|
+
` + b;
|
|
755
206
|
}
|
|
756
|
-
|
|
757
|
-
`,
|
|
207
|
+
k = !b.trim(), g += H + `
|
|
208
|
+
`, r = r.substring(H.length + 1), c = _.slice(w);
|
|
758
209
|
}
|
|
759
210
|
}
|
|
760
|
-
|
|
211
|
+
a.loose || (h ? a.loose = !0 : this.rules.other.doubleBlankLine.test(g) && (h = !0)), a.items.push({ type: "list_item", raw: g, task: !!this.options.gfm && this.rules.other.listIsTask.test(u), loose: !1, text: u, tokens: [] }), a.raw += g;
|
|
761
212
|
}
|
|
762
|
-
let
|
|
763
|
-
if (
|
|
213
|
+
let o = a.items.at(-1);
|
|
214
|
+
if (o) o.raw = o.raw.trimEnd(), o.text = o.text.trimEnd();
|
|
764
215
|
else return;
|
|
765
|
-
|
|
766
|
-
for (let
|
|
767
|
-
if (this.lexer.state.top = !1,
|
|
768
|
-
if (
|
|
769
|
-
|
|
770
|
-
for (let
|
|
771
|
-
this.lexer.inlineQueue[
|
|
216
|
+
a.raw = a.raw.trimEnd();
|
|
217
|
+
for (let p of a.items) {
|
|
218
|
+
if (this.lexer.state.top = !1, p.tokens = this.lexer.blockTokens(p.text, []), p.task) {
|
|
219
|
+
if (p.text = p.text.replace(this.rules.other.listReplaceTask, ""), ((t = p.tokens[0]) == null ? void 0 : t.type) === "text" || ((s = p.tokens[0]) == null ? void 0 : s.type) === "paragraph") {
|
|
220
|
+
p.tokens[0].raw = p.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), p.tokens[0].text = p.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
|
|
221
|
+
for (let u = this.lexer.inlineQueue.length - 1; u >= 0; u--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)) {
|
|
222
|
+
this.lexer.inlineQueue[u].src = this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask, "");
|
|
772
223
|
break;
|
|
773
224
|
}
|
|
774
225
|
}
|
|
775
|
-
let
|
|
776
|
-
if (
|
|
777
|
-
let
|
|
778
|
-
|
|
226
|
+
let g = this.rules.other.listTaskCheckbox.exec(p.raw);
|
|
227
|
+
if (g) {
|
|
228
|
+
let u = { type: "checkbox", raw: g[0] + " ", checked: g[0] !== "[ ]" };
|
|
229
|
+
p.checked = u.checked, a.loose ? p.tokens[0] && ["paragraph", "text"].includes(p.tokens[0].type) && "tokens" in p.tokens[0] && p.tokens[0].tokens ? (p.tokens[0].raw = u.raw + p.tokens[0].raw, p.tokens[0].text = u.raw + p.tokens[0].text, p.tokens[0].tokens.unshift(u)) : p.tokens.unshift({ type: "paragraph", raw: u.raw, text: u.raw, tokens: [u] }) : p.tokens.unshift(u);
|
|
779
230
|
}
|
|
780
231
|
}
|
|
781
|
-
if (!
|
|
782
|
-
let
|
|
783
|
-
|
|
232
|
+
if (!a.loose) {
|
|
233
|
+
let g = p.tokens.filter((c) => c.type === "space"), u = g.length > 0 && g.some((c) => this.rules.other.anyLine.test(c.raw));
|
|
234
|
+
a.loose = u;
|
|
784
235
|
}
|
|
785
236
|
}
|
|
786
|
-
if (
|
|
787
|
-
|
|
788
|
-
for (let
|
|
237
|
+
if (a.loose) for (let p of a.items) {
|
|
238
|
+
p.loose = !0;
|
|
239
|
+
for (let g of p.tokens) g.type === "text" && (g.type = "paragraph");
|
|
789
240
|
}
|
|
790
|
-
return
|
|
241
|
+
return a;
|
|
791
242
|
}
|
|
792
243
|
}
|
|
793
|
-
html(
|
|
794
|
-
let e = this.rules.block.html.exec(
|
|
244
|
+
html(r) {
|
|
245
|
+
let e = this.rules.block.html.exec(r);
|
|
795
246
|
if (e) return { type: "html", block: !0, raw: e[0], pre: e[1] === "pre" || e[1] === "script" || e[1] === "style", text: e[0] };
|
|
796
247
|
}
|
|
797
|
-
def(
|
|
798
|
-
let e = this.rules.block.def.exec(
|
|
248
|
+
def(r) {
|
|
249
|
+
let e = this.rules.block.def.exec(r);
|
|
799
250
|
if (e) {
|
|
800
|
-
let t = e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "),
|
|
801
|
-
return { type: "def", tag: t, raw: e[0], href:
|
|
251
|
+
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];
|
|
252
|
+
return { type: "def", tag: t, raw: e[0], href: s, title: n };
|
|
802
253
|
}
|
|
803
254
|
}
|
|
804
|
-
table(
|
|
805
|
-
var
|
|
806
|
-
let e = this.rules.block.table.exec(
|
|
255
|
+
table(r) {
|
|
256
|
+
var a;
|
|
257
|
+
let e = this.rules.block.table.exec(r);
|
|
807
258
|
if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
|
|
808
|
-
let t =
|
|
809
|
-
`) : [],
|
|
810
|
-
if (t.length ===
|
|
811
|
-
for (let l of
|
|
812
|
-
for (let l = 0; l < t.length; l++)
|
|
813
|
-
for (let l of
|
|
814
|
-
return
|
|
259
|
+
let t = ie(e[1]), s = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), n = (a = e[3]) != null && a.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
260
|
+
`) : [], i = { type: "table", raw: e[0], header: [], align: [], rows: [] };
|
|
261
|
+
if (t.length === s.length) {
|
|
262
|
+
for (let l of s) this.rules.other.tableAlignRight.test(l) ? i.align.push("right") : this.rules.other.tableAlignCenter.test(l) ? i.align.push("center") : this.rules.other.tableAlignLeft.test(l) ? i.align.push("left") : i.align.push(null);
|
|
263
|
+
for (let l = 0; l < t.length; l++) i.header.push({ text: t[l], tokens: this.lexer.inline(t[l]), header: !0, align: i.align[l] });
|
|
264
|
+
for (let l of n) i.rows.push(ie(l, i.header.length).map((h, o) => ({ text: h, tokens: this.lexer.inline(h), header: !1, align: i.align[o] })));
|
|
265
|
+
return i;
|
|
815
266
|
}
|
|
816
267
|
}
|
|
817
|
-
lheading(
|
|
818
|
-
let e = this.rules.block.lheading.exec(
|
|
268
|
+
lheading(r) {
|
|
269
|
+
let e = this.rules.block.lheading.exec(r);
|
|
819
270
|
if (e) return { type: "heading", raw: e[0], depth: e[2].charAt(0) === "=" ? 1 : 2, text: e[1], tokens: this.lexer.inline(e[1]) };
|
|
820
271
|
}
|
|
821
|
-
paragraph(
|
|
822
|
-
let e = this.rules.block.paragraph.exec(
|
|
272
|
+
paragraph(r) {
|
|
273
|
+
let e = this.rules.block.paragraph.exec(r);
|
|
823
274
|
if (e) {
|
|
824
275
|
let t = e[1].charAt(e[1].length - 1) === `
|
|
825
276
|
` ? e[1].slice(0, -1) : e[1];
|
|
826
277
|
return { type: "paragraph", raw: e[0], text: t, tokens: this.lexer.inline(t) };
|
|
827
278
|
}
|
|
828
279
|
}
|
|
829
|
-
text(
|
|
830
|
-
let e = this.rules.block.text.exec(
|
|
280
|
+
text(r) {
|
|
281
|
+
let e = this.rules.block.text.exec(r);
|
|
831
282
|
if (e) return { type: "text", raw: e[0], text: e[0], tokens: this.lexer.inline(e[0]) };
|
|
832
283
|
}
|
|
833
|
-
escape(
|
|
834
|
-
let e = this.rules.inline.escape.exec(
|
|
284
|
+
escape(r) {
|
|
285
|
+
let e = this.rules.inline.escape.exec(r);
|
|
835
286
|
if (e) return { type: "escape", raw: e[0], text: e[1] };
|
|
836
287
|
}
|
|
837
|
-
tag(
|
|
838
|
-
let e = this.rules.inline.tag.exec(
|
|
288
|
+
tag(r) {
|
|
289
|
+
let e = this.rules.inline.tag.exec(r);
|
|
839
290
|
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] };
|
|
840
291
|
}
|
|
841
|
-
link(
|
|
842
|
-
let e = this.rules.inline.link.exec(
|
|
292
|
+
link(r) {
|
|
293
|
+
let e = this.rules.inline.link.exec(r);
|
|
843
294
|
if (e) {
|
|
844
295
|
let t = e[2].trim();
|
|
845
296
|
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(t)) {
|
|
846
297
|
if (!this.rules.other.endAngleBracket.test(t)) return;
|
|
847
|
-
let
|
|
848
|
-
if ((t.length -
|
|
298
|
+
let i = I(t.slice(0, -1), "\\");
|
|
299
|
+
if ((t.length - i.length) % 2 === 0) return;
|
|
849
300
|
} else {
|
|
850
|
-
let
|
|
851
|
-
if (
|
|
852
|
-
if (
|
|
853
|
-
let
|
|
854
|
-
e[2] = e[2].substring(0,
|
|
301
|
+
let i = ht(e[2], "()");
|
|
302
|
+
if (i === -2) return;
|
|
303
|
+
if (i > -1) {
|
|
304
|
+
let a = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + i;
|
|
305
|
+
e[2] = e[2].substring(0, i), e[0] = e[0].substring(0, a).trim(), e[3] = "";
|
|
855
306
|
}
|
|
856
307
|
}
|
|
857
|
-
let
|
|
308
|
+
let s = e[2], n = "";
|
|
858
309
|
if (this.options.pedantic) {
|
|
859
|
-
let
|
|
860
|
-
|
|
861
|
-
} else
|
|
862
|
-
return
|
|
310
|
+
let i = this.rules.other.pedanticHrefTitle.exec(s);
|
|
311
|
+
i && (s = i[1], n = i[3]);
|
|
312
|
+
} else n = e[3] ? e[3].slice(1, -1) : "";
|
|
313
|
+
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)), ae(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);
|
|
863
314
|
}
|
|
864
315
|
}
|
|
865
|
-
reflink(
|
|
316
|
+
reflink(r, e) {
|
|
866
317
|
let t;
|
|
867
|
-
if ((t = this.rules.inline.reflink.exec(
|
|
868
|
-
let
|
|
869
|
-
if (!
|
|
870
|
-
let
|
|
871
|
-
return { type: "text", raw:
|
|
318
|
+
if ((t = this.rules.inline.reflink.exec(r)) || (t = this.rules.inline.nolink.exec(r))) {
|
|
319
|
+
let s = (t[2] || t[1]).replace(this.rules.other.multipleSpaceGlobal, " "), n = e[s.toLowerCase()];
|
|
320
|
+
if (!n) {
|
|
321
|
+
let i = t[0].charAt(0);
|
|
322
|
+
return { type: "text", raw: i, text: i };
|
|
872
323
|
}
|
|
873
|
-
return
|
|
324
|
+
return ae(t, n, t[0], this.lexer, this.rules);
|
|
874
325
|
}
|
|
875
326
|
}
|
|
876
|
-
emStrong(
|
|
877
|
-
let
|
|
878
|
-
if (!(!
|
|
879
|
-
let
|
|
880
|
-
for (
|
|
881
|
-
if (
|
|
882
|
-
if (
|
|
883
|
-
l +=
|
|
327
|
+
emStrong(r, e, t = "") {
|
|
328
|
+
let s = this.rules.inline.emStrongLDelim.exec(r);
|
|
329
|
+
if (!(!s || s[3] && t.match(this.rules.other.unicodeAlphaNumeric)) && (!(s[1] || s[2]) || !t || this.rules.inline.punctuation.exec(t))) {
|
|
330
|
+
let n = [...s[0]].length - 1, i, a, l = n, h = 0, o = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
331
|
+
for (o.lastIndex = 0, e = e.slice(-1 * r.length + n); (s = o.exec(e)) != null; ) {
|
|
332
|
+
if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i) continue;
|
|
333
|
+
if (a = [...i].length, s[3] || s[4]) {
|
|
334
|
+
l += a;
|
|
884
335
|
continue;
|
|
885
|
-
} else if ((
|
|
886
|
-
h +=
|
|
336
|
+
} else if ((s[5] || s[6]) && n % 3 && !((n + a) % 3)) {
|
|
337
|
+
h += a;
|
|
887
338
|
continue;
|
|
888
339
|
}
|
|
889
|
-
if (l -=
|
|
890
|
-
|
|
891
|
-
let
|
|
892
|
-
if (Math.min(
|
|
893
|
-
let
|
|
894
|
-
return { type: "em", raw:
|
|
340
|
+
if (l -= a, l > 0) continue;
|
|
341
|
+
a = Math.min(a, a + l + h);
|
|
342
|
+
let p = [...s[0]][0].length, g = r.slice(0, n + s.index + p + a);
|
|
343
|
+
if (Math.min(n, a) % 2) {
|
|
344
|
+
let c = g.slice(1, -1);
|
|
345
|
+
return { type: "em", raw: g, text: c, tokens: this.lexer.inlineTokens(c) };
|
|
895
346
|
}
|
|
896
|
-
let
|
|
897
|
-
return { type: "strong", raw:
|
|
347
|
+
let u = g.slice(2, -2);
|
|
348
|
+
return { type: "strong", raw: g, text: u, tokens: this.lexer.inlineTokens(u) };
|
|
898
349
|
}
|
|
899
350
|
}
|
|
900
351
|
}
|
|
901
|
-
codespan(
|
|
902
|
-
let e = this.rules.inline.code.exec(
|
|
352
|
+
codespan(r) {
|
|
353
|
+
let e = this.rules.inline.code.exec(r);
|
|
903
354
|
if (e) {
|
|
904
|
-
let t = e[2].replace(this.rules.other.newLineCharGlobal, " "),
|
|
905
|
-
return
|
|
355
|
+
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);
|
|
356
|
+
return s && n && (t = t.substring(1, t.length - 1)), { type: "codespan", raw: e[0], text: t };
|
|
906
357
|
}
|
|
907
358
|
}
|
|
908
|
-
br(
|
|
909
|
-
let e = this.rules.inline.br.exec(
|
|
359
|
+
br(r) {
|
|
360
|
+
let e = this.rules.inline.br.exec(r);
|
|
910
361
|
if (e) return { type: "br", raw: e[0] };
|
|
911
362
|
}
|
|
912
|
-
del(
|
|
913
|
-
let
|
|
914
|
-
if (
|
|
915
|
-
let
|
|
916
|
-
for (h.lastIndex = 0, e = e.slice(-1 *
|
|
917
|
-
if (
|
|
918
|
-
if (
|
|
919
|
-
l +=
|
|
363
|
+
del(r, e, t = "") {
|
|
364
|
+
let s = this.rules.inline.delLDelim.exec(r);
|
|
365
|
+
if (s && (!s[1] || !t || this.rules.inline.punctuation.exec(t))) {
|
|
366
|
+
let n = [...s[0]].length - 1, i, a, l = n, h = this.rules.inline.delRDelim;
|
|
367
|
+
for (h.lastIndex = 0, e = e.slice(-1 * r.length + n); (s = h.exec(e)) != null; ) {
|
|
368
|
+
if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i || (a = [...i].length, a !== n)) continue;
|
|
369
|
+
if (s[3] || s[4]) {
|
|
370
|
+
l += a;
|
|
920
371
|
continue;
|
|
921
372
|
}
|
|
922
|
-
if (l -=
|
|
923
|
-
|
|
924
|
-
let
|
|
925
|
-
return { type: "del", raw:
|
|
373
|
+
if (l -= a, l > 0) continue;
|
|
374
|
+
a = Math.min(a, a + l);
|
|
375
|
+
let o = [...s[0]][0].length, p = r.slice(0, n + s.index + o + a), g = p.slice(n, -n);
|
|
376
|
+
return { type: "del", raw: p, text: g, tokens: this.lexer.inlineTokens(g) };
|
|
926
377
|
}
|
|
927
378
|
}
|
|
928
379
|
}
|
|
929
|
-
autolink(
|
|
930
|
-
let e = this.rules.inline.autolink.exec(
|
|
380
|
+
autolink(r) {
|
|
381
|
+
let e = this.rules.inline.autolink.exec(r);
|
|
931
382
|
if (e) {
|
|
932
|
-
let t,
|
|
933
|
-
return e[2] === "@" ? (t = e[1],
|
|
383
|
+
let t, s;
|
|
384
|
+
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 }] };
|
|
934
385
|
}
|
|
935
386
|
}
|
|
936
|
-
url(
|
|
387
|
+
url(r) {
|
|
937
388
|
var t;
|
|
938
389
|
let e;
|
|
939
|
-
if (e = this.rules.inline.url.exec(
|
|
940
|
-
let
|
|
941
|
-
if (e[2] === "@")
|
|
390
|
+
if (e = this.rules.inline.url.exec(r)) {
|
|
391
|
+
let s, n;
|
|
392
|
+
if (e[2] === "@") s = e[0], n = "mailto:" + s;
|
|
942
393
|
else {
|
|
943
|
-
let
|
|
394
|
+
let i;
|
|
944
395
|
do
|
|
945
|
-
|
|
946
|
-
while (
|
|
947
|
-
|
|
396
|
+
i = e[0], e[0] = ((t = this.rules.inline._backpedal.exec(e[0])) == null ? void 0 : t[0]) ?? "";
|
|
397
|
+
while (i !== e[0]);
|
|
398
|
+
s = e[0], e[1] === "www." ? n = "http://" + e[0] : n = e[0];
|
|
948
399
|
}
|
|
949
|
-
return { type: "link", raw: e[0], text:
|
|
400
|
+
return { type: "link", raw: e[0], text: s, href: n, tokens: [{ type: "text", raw: s, text: s }] };
|
|
950
401
|
}
|
|
951
402
|
}
|
|
952
|
-
inlineText(
|
|
953
|
-
let e = this.rules.inline.text.exec(
|
|
403
|
+
inlineText(r) {
|
|
404
|
+
let e = this.rules.inline.text.exec(r);
|
|
954
405
|
if (e) {
|
|
955
406
|
let t = this.lexer.state.inRawBlock;
|
|
956
407
|
return { type: "text", raw: e[0], text: e[0], escaped: t };
|
|
957
408
|
}
|
|
958
409
|
}
|
|
959
|
-
},
|
|
410
|
+
}, y = class O {
|
|
960
411
|
constructor(e) {
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e ||
|
|
967
|
-
let t = { other:
|
|
968
|
-
this.options.pedantic ? (t.block =
|
|
412
|
+
x(this, "tokens");
|
|
413
|
+
x(this, "options");
|
|
414
|
+
x(this, "state");
|
|
415
|
+
x(this, "inlineQueue");
|
|
416
|
+
x(this, "tokenizer");
|
|
417
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || z, this.options.tokenizer = this.options.tokenizer || new Z(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
|
|
418
|
+
let t = { other: m, block: q.normal, inline: P.normal };
|
|
419
|
+
this.options.pedantic ? (t.block = q.pedantic, t.inline = P.pedantic) : this.options.gfm && (t.block = q.gfm, this.options.breaks ? t.inline = P.breaks : t.inline = P.gfm), this.tokenizer.rules = t;
|
|
969
420
|
}
|
|
970
421
|
static get rules() {
|
|
971
|
-
return { block:
|
|
422
|
+
return { block: q, inline: P };
|
|
972
423
|
}
|
|
973
424
|
static lex(e, t) {
|
|
974
|
-
return new
|
|
425
|
+
return new O(t).lex(e);
|
|
975
426
|
}
|
|
976
427
|
static lexInline(e, t) {
|
|
977
|
-
return new
|
|
428
|
+
return new O(t).inlineTokens(e);
|
|
978
429
|
}
|
|
979
430
|
lex(e) {
|
|
980
|
-
e = e.replace(
|
|
431
|
+
e = e.replace(m.carriageReturn, `
|
|
981
432
|
`), this.blockTokens(e, this.tokens);
|
|
982
433
|
for (let t = 0; t < this.inlineQueue.length; t++) {
|
|
983
|
-
let
|
|
984
|
-
this.inlineTokens(
|
|
434
|
+
let s = this.inlineQueue[t];
|
|
435
|
+
this.inlineTokens(s.src, s.tokens);
|
|
985
436
|
}
|
|
986
437
|
return this.inlineQueue = [], this.tokens;
|
|
987
438
|
}
|
|
988
|
-
blockTokens(e, t = [],
|
|
989
|
-
var
|
|
990
|
-
for (this.options.pedantic && (e = e.replace(
|
|
439
|
+
blockTokens(e, t = [], s = !1) {
|
|
440
|
+
var n, i, a;
|
|
441
|
+
for (this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, "")); e; ) {
|
|
991
442
|
let l;
|
|
992
|
-
if ((
|
|
443
|
+
if ((i = (n = this.options.extensions) == null ? void 0 : n.block) != null && i.some((o) => (l = o.call({ lexer: this }, e, t)) ? (e = e.substring(l.raw.length), t.push(l), !0) : !1)) continue;
|
|
993
444
|
if (l = this.tokenizer.space(e)) {
|
|
994
445
|
e = e.substring(l.raw.length);
|
|
995
|
-
let
|
|
996
|
-
l.raw.length === 1 &&
|
|
446
|
+
let o = t.at(-1);
|
|
447
|
+
l.raw.length === 1 && o !== void 0 ? o.raw += `
|
|
997
448
|
` : t.push(l);
|
|
998
449
|
continue;
|
|
999
450
|
}
|
|
1000
451
|
if (l = this.tokenizer.code(e)) {
|
|
1001
452
|
e = e.substring(l.raw.length);
|
|
1002
|
-
let
|
|
1003
|
-
(
|
|
453
|
+
let o = t.at(-1);
|
|
454
|
+
(o == null ? void 0 : o.type) === "paragraph" || (o == null ? void 0 : o.type) === "text" ? (o.raw += (o.raw.endsWith(`
|
|
1004
455
|
`) ? "" : `
|
|
1005
|
-
`) + l.raw,
|
|
1006
|
-
` + l.text, this.inlineQueue.at(-1).src =
|
|
456
|
+
`) + l.raw, o.text += `
|
|
457
|
+
` + l.text, this.inlineQueue.at(-1).src = o.text) : t.push(l);
|
|
1007
458
|
continue;
|
|
1008
459
|
}
|
|
1009
460
|
if (l = this.tokenizer.fences(e)) {
|
|
@@ -1032,11 +483,11 @@ ${f}` : f;
|
|
|
1032
483
|
}
|
|
1033
484
|
if (l = this.tokenizer.def(e)) {
|
|
1034
485
|
e = e.substring(l.raw.length);
|
|
1035
|
-
let
|
|
1036
|
-
(
|
|
486
|
+
let o = t.at(-1);
|
|
487
|
+
(o == null ? void 0 : o.type) === "paragraph" || (o == null ? void 0 : o.type) === "text" ? (o.raw += (o.raw.endsWith(`
|
|
1037
488
|
`) ? "" : `
|
|
1038
|
-
`) + l.raw,
|
|
1039
|
-
` + l.raw, this.inlineQueue.at(-1).src =
|
|
489
|
+
`) + l.raw, o.text += `
|
|
490
|
+
` + l.raw, this.inlineQueue.at(-1).src = o.text) : this.tokens.links[l.tag] || (this.tokens.links[l.tag] = { href: l.href, title: l.title }, t.push(l));
|
|
1040
491
|
continue;
|
|
1041
492
|
}
|
|
1042
493
|
if (l = this.tokenizer.table(e)) {
|
|
@@ -1048,35 +499,35 @@ ${f}` : f;
|
|
|
1048
499
|
continue;
|
|
1049
500
|
}
|
|
1050
501
|
let h = e;
|
|
1051
|
-
if ((
|
|
1052
|
-
let
|
|
1053
|
-
this.options.extensions.startBlock.forEach((
|
|
1054
|
-
|
|
1055
|
-
}),
|
|
502
|
+
if ((a = this.options.extensions) != null && a.startBlock) {
|
|
503
|
+
let o = 1 / 0, p = e.slice(1), g;
|
|
504
|
+
this.options.extensions.startBlock.forEach((u) => {
|
|
505
|
+
g = u.call({ lexer: this }, p), typeof g == "number" && g >= 0 && (o = Math.min(o, g));
|
|
506
|
+
}), o < 1 / 0 && o >= 0 && (h = e.substring(0, o + 1));
|
|
1056
507
|
}
|
|
1057
508
|
if (this.state.top && (l = this.tokenizer.paragraph(h))) {
|
|
1058
|
-
let
|
|
1059
|
-
|
|
509
|
+
let o = t.at(-1);
|
|
510
|
+
s && (o == null ? void 0 : o.type) === "paragraph" ? (o.raw += (o.raw.endsWith(`
|
|
1060
511
|
`) ? "" : `
|
|
1061
|
-
`) + l.raw,
|
|
1062
|
-
` + l.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src =
|
|
512
|
+
`) + l.raw, o.text += `
|
|
513
|
+
` + l.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t.push(l), s = h.length !== e.length, e = e.substring(l.raw.length);
|
|
1063
514
|
continue;
|
|
1064
515
|
}
|
|
1065
516
|
if (l = this.tokenizer.text(e)) {
|
|
1066
517
|
e = e.substring(l.raw.length);
|
|
1067
|
-
let
|
|
1068
|
-
(
|
|
518
|
+
let o = t.at(-1);
|
|
519
|
+
(o == null ? void 0 : o.type) === "text" ? (o.raw += (o.raw.endsWith(`
|
|
1069
520
|
`) ? "" : `
|
|
1070
|
-
`) + l.raw,
|
|
1071
|
-
` + l.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src =
|
|
521
|
+
`) + l.raw, o.text += `
|
|
522
|
+
` + l.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t.push(l);
|
|
1072
523
|
continue;
|
|
1073
524
|
}
|
|
1074
525
|
if (e) {
|
|
1075
|
-
let
|
|
526
|
+
let o = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
1076
527
|
if (this.options.silent) {
|
|
1077
|
-
console.error(
|
|
528
|
+
console.error(o);
|
|
1078
529
|
break;
|
|
1079
|
-
} else throw new Error(
|
|
530
|
+
} else throw new Error(o);
|
|
1080
531
|
}
|
|
1081
532
|
}
|
|
1082
533
|
return this.state.top = !0, t;
|
|
@@ -1085,261 +536,261 @@ ${f}` : f;
|
|
|
1085
536
|
return this.inlineQueue.push({ src: e, tokens: t }), t;
|
|
1086
537
|
}
|
|
1087
538
|
inlineTokens(e, t = []) {
|
|
1088
|
-
var h,
|
|
1089
|
-
let
|
|
539
|
+
var h, o, p, g, u;
|
|
540
|
+
let s = e, n = null;
|
|
1090
541
|
if (this.tokens.links) {
|
|
1091
|
-
let
|
|
1092
|
-
if (
|
|
542
|
+
let c = Object.keys(this.tokens.links);
|
|
543
|
+
if (c.length > 0) for (; (n = this.tokenizer.rules.inline.reflinkSearch.exec(s)) != null; ) c.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));
|
|
1093
544
|
}
|
|
1094
|
-
for (; (
|
|
1095
|
-
let
|
|
1096
|
-
for (; (
|
|
1097
|
-
|
|
1098
|
-
let
|
|
545
|
+
for (; (n = this.tokenizer.rules.inline.anyPunctuation.exec(s)) != null; ) s = s.slice(0, n.index) + "++" + s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
546
|
+
let i;
|
|
547
|
+
for (; (n = this.tokenizer.rules.inline.blockSkip.exec(s)) != null; ) i = n[2] ? n[2].length : 0, s = s.slice(0, n.index + i) + "[" + "a".repeat(n[0].length - i - 2) + "]" + s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
548
|
+
s = ((o = (h = this.options.hooks) == null ? void 0 : h.emStrongMask) == null ? void 0 : o.call({ lexer: this }, s)) ?? s;
|
|
549
|
+
let a = !1, l = "";
|
|
1099
550
|
for (; e; ) {
|
|
1100
|
-
|
|
1101
|
-
let
|
|
1102
|
-
if ((
|
|
1103
|
-
if (
|
|
1104
|
-
e = e.substring(
|
|
551
|
+
a || (l = ""), a = !1;
|
|
552
|
+
let c;
|
|
553
|
+
if ((g = (p = this.options.extensions) == null ? void 0 : p.inline) != null && g.some((k) => (c = k.call({ lexer: this }, e, t)) ? (e = e.substring(c.raw.length), t.push(c), !0) : !1)) continue;
|
|
554
|
+
if (c = this.tokenizer.escape(e)) {
|
|
555
|
+
e = e.substring(c.raw.length), t.push(c);
|
|
1105
556
|
continue;
|
|
1106
557
|
}
|
|
1107
|
-
if (
|
|
1108
|
-
e = e.substring(
|
|
558
|
+
if (c = this.tokenizer.tag(e)) {
|
|
559
|
+
e = e.substring(c.raw.length), t.push(c);
|
|
1109
560
|
continue;
|
|
1110
561
|
}
|
|
1111
|
-
if (
|
|
1112
|
-
e = e.substring(
|
|
562
|
+
if (c = this.tokenizer.link(e)) {
|
|
563
|
+
e = e.substring(c.raw.length), t.push(c);
|
|
1113
564
|
continue;
|
|
1114
565
|
}
|
|
1115
|
-
if (
|
|
1116
|
-
e = e.substring(
|
|
1117
|
-
let
|
|
1118
|
-
|
|
566
|
+
if (c = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
567
|
+
e = e.substring(c.raw.length);
|
|
568
|
+
let k = t.at(-1);
|
|
569
|
+
c.type === "text" && (k == null ? void 0 : k.type) === "text" ? (k.raw += c.raw, k.text += c.text) : t.push(c);
|
|
1119
570
|
continue;
|
|
1120
571
|
}
|
|
1121
|
-
if (
|
|
1122
|
-
e = e.substring(
|
|
572
|
+
if (c = this.tokenizer.emStrong(e, s, l)) {
|
|
573
|
+
e = e.substring(c.raw.length), t.push(c);
|
|
1123
574
|
continue;
|
|
1124
575
|
}
|
|
1125
|
-
if (
|
|
1126
|
-
e = e.substring(
|
|
576
|
+
if (c = this.tokenizer.codespan(e)) {
|
|
577
|
+
e = e.substring(c.raw.length), t.push(c);
|
|
1127
578
|
continue;
|
|
1128
579
|
}
|
|
1129
|
-
if (
|
|
1130
|
-
e = e.substring(
|
|
580
|
+
if (c = this.tokenizer.br(e)) {
|
|
581
|
+
e = e.substring(c.raw.length), t.push(c);
|
|
1131
582
|
continue;
|
|
1132
583
|
}
|
|
1133
|
-
if (
|
|
1134
|
-
e = e.substring(
|
|
584
|
+
if (c = this.tokenizer.del(e, s, l)) {
|
|
585
|
+
e = e.substring(c.raw.length), t.push(c);
|
|
1135
586
|
continue;
|
|
1136
587
|
}
|
|
1137
|
-
if (
|
|
1138
|
-
e = e.substring(
|
|
588
|
+
if (c = this.tokenizer.autolink(e)) {
|
|
589
|
+
e = e.substring(c.raw.length), t.push(c);
|
|
1139
590
|
continue;
|
|
1140
591
|
}
|
|
1141
|
-
if (!this.state.inLink && (
|
|
1142
|
-
e = e.substring(
|
|
592
|
+
if (!this.state.inLink && (c = this.tokenizer.url(e))) {
|
|
593
|
+
e = e.substring(c.raw.length), t.push(c);
|
|
1143
594
|
continue;
|
|
1144
595
|
}
|
|
1145
|
-
let
|
|
1146
|
-
if ((
|
|
1147
|
-
let
|
|
1148
|
-
this.options.extensions.startInline.forEach((
|
|
1149
|
-
|
|
1150
|
-
}),
|
|
596
|
+
let b = e;
|
|
597
|
+
if ((u = this.options.extensions) != null && u.startInline) {
|
|
598
|
+
let k = 1 / 0, w = e.slice(1), A;
|
|
599
|
+
this.options.extensions.startInline.forEach((C) => {
|
|
600
|
+
A = C.call({ lexer: this }, w), typeof A == "number" && A >= 0 && (k = Math.min(k, A));
|
|
601
|
+
}), k < 1 / 0 && k >= 0 && (b = e.substring(0, k + 1));
|
|
1151
602
|
}
|
|
1152
|
-
if (
|
|
1153
|
-
e = e.substring(
|
|
1154
|
-
let
|
|
1155
|
-
(
|
|
603
|
+
if (c = this.tokenizer.inlineText(b)) {
|
|
604
|
+
e = e.substring(c.raw.length), c.raw.slice(-1) !== "_" && (l = c.raw.slice(-1)), a = !0;
|
|
605
|
+
let k = t.at(-1);
|
|
606
|
+
(k == null ? void 0 : k.type) === "text" ? (k.raw += c.raw, k.text += c.text) : t.push(c);
|
|
1156
607
|
continue;
|
|
1157
608
|
}
|
|
1158
609
|
if (e) {
|
|
1159
|
-
let
|
|
610
|
+
let k = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
1160
611
|
if (this.options.silent) {
|
|
1161
|
-
console.error(
|
|
612
|
+
console.error(k);
|
|
1162
613
|
break;
|
|
1163
|
-
} else throw new Error(
|
|
614
|
+
} else throw new Error(k);
|
|
1164
615
|
}
|
|
1165
616
|
}
|
|
1166
617
|
return t;
|
|
1167
618
|
}
|
|
1168
|
-
},
|
|
1169
|
-
constructor(
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
this.options =
|
|
619
|
+
}, D = class {
|
|
620
|
+
constructor(r) {
|
|
621
|
+
x(this, "options");
|
|
622
|
+
x(this, "parser");
|
|
623
|
+
this.options = r || z;
|
|
1173
624
|
}
|
|
1174
|
-
space(
|
|
625
|
+
space(r) {
|
|
1175
626
|
return "";
|
|
1176
627
|
}
|
|
1177
|
-
code({ text:
|
|
1178
|
-
var
|
|
1179
|
-
let
|
|
628
|
+
code({ text: r, lang: e, escaped: t }) {
|
|
629
|
+
var i;
|
|
630
|
+
let s = (i = (e || "").match(m.notSpaceStart)) == null ? void 0 : i[0], n = r.replace(m.endingNewline, "") + `
|
|
1180
631
|
`;
|
|
1181
|
-
return
|
|
1182
|
-
` : "<pre><code>" + (t ?
|
|
632
|
+
return s ? '<pre><code class="language-' + $(s) + '">' + (t ? n : $(n, !0)) + `</code></pre>
|
|
633
|
+
` : "<pre><code>" + (t ? n : $(n, !0)) + `</code></pre>
|
|
1183
634
|
`;
|
|
1184
635
|
}
|
|
1185
|
-
blockquote({ tokens:
|
|
636
|
+
blockquote({ tokens: r }) {
|
|
1186
637
|
return `<blockquote>
|
|
1187
|
-
${this.parser.parse(
|
|
638
|
+
${this.parser.parse(r)}</blockquote>
|
|
1188
639
|
`;
|
|
1189
640
|
}
|
|
1190
|
-
html({ text:
|
|
1191
|
-
return
|
|
641
|
+
html({ text: r }) {
|
|
642
|
+
return r;
|
|
1192
643
|
}
|
|
1193
|
-
def(
|
|
644
|
+
def(r) {
|
|
1194
645
|
return "";
|
|
1195
646
|
}
|
|
1196
|
-
heading({ tokens:
|
|
1197
|
-
return `<h${e}>${this.parser.parseInline(
|
|
647
|
+
heading({ tokens: r, depth: e }) {
|
|
648
|
+
return `<h${e}>${this.parser.parseInline(r)}</h${e}>
|
|
1198
649
|
`;
|
|
1199
650
|
}
|
|
1200
|
-
hr(
|
|
651
|
+
hr(r) {
|
|
1201
652
|
return `<hr>
|
|
1202
653
|
`;
|
|
1203
654
|
}
|
|
1204
|
-
list(
|
|
1205
|
-
let e =
|
|
1206
|
-
for (let
|
|
1207
|
-
let l =
|
|
1208
|
-
|
|
655
|
+
list(r) {
|
|
656
|
+
let e = r.ordered, t = r.start, s = "";
|
|
657
|
+
for (let a = 0; a < r.items.length; a++) {
|
|
658
|
+
let l = r.items[a];
|
|
659
|
+
s += this.listitem(l);
|
|
1209
660
|
}
|
|
1210
|
-
let
|
|
1211
|
-
return "<" +
|
|
1212
|
-
` +
|
|
661
|
+
let n = e ? "ol" : "ul", i = e && t !== 1 ? ' start="' + t + '"' : "";
|
|
662
|
+
return "<" + n + i + `>
|
|
663
|
+
` + s + "</" + n + `>
|
|
1213
664
|
`;
|
|
1214
665
|
}
|
|
1215
|
-
listitem(
|
|
1216
|
-
return `<li>${this.parser.parse(
|
|
666
|
+
listitem(r) {
|
|
667
|
+
return `<li>${this.parser.parse(r.tokens)}</li>
|
|
1217
668
|
`;
|
|
1218
669
|
}
|
|
1219
|
-
checkbox({ checked:
|
|
1220
|
-
return "<input " + (
|
|
670
|
+
checkbox({ checked: r }) {
|
|
671
|
+
return "<input " + (r ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
|
|
1221
672
|
}
|
|
1222
|
-
paragraph({ tokens:
|
|
1223
|
-
return `<p>${this.parser.parseInline(
|
|
673
|
+
paragraph({ tokens: r }) {
|
|
674
|
+
return `<p>${this.parser.parseInline(r)}</p>
|
|
1224
675
|
`;
|
|
1225
676
|
}
|
|
1226
|
-
table(
|
|
677
|
+
table(r) {
|
|
1227
678
|
let e = "", t = "";
|
|
1228
|
-
for (let
|
|
679
|
+
for (let n = 0; n < r.header.length; n++) t += this.tablecell(r.header[n]);
|
|
1229
680
|
e += this.tablerow({ text: t });
|
|
1230
|
-
let
|
|
1231
|
-
for (let
|
|
1232
|
-
let
|
|
681
|
+
let s = "";
|
|
682
|
+
for (let n = 0; n < r.rows.length; n++) {
|
|
683
|
+
let i = r.rows[n];
|
|
1233
684
|
t = "";
|
|
1234
|
-
for (let
|
|
1235
|
-
|
|
685
|
+
for (let a = 0; a < i.length; a++) t += this.tablecell(i[a]);
|
|
686
|
+
s += this.tablerow({ text: t });
|
|
1236
687
|
}
|
|
1237
|
-
return
|
|
688
|
+
return s && (s = `<tbody>${s}</tbody>`), `<table>
|
|
1238
689
|
<thead>
|
|
1239
690
|
` + e + `</thead>
|
|
1240
|
-
` +
|
|
691
|
+
` + s + `</table>
|
|
1241
692
|
`;
|
|
1242
693
|
}
|
|
1243
|
-
tablerow({ text:
|
|
694
|
+
tablerow({ text: r }) {
|
|
1244
695
|
return `<tr>
|
|
1245
|
-
${
|
|
696
|
+
${r}</tr>
|
|
1246
697
|
`;
|
|
1247
698
|
}
|
|
1248
|
-
tablecell(
|
|
1249
|
-
let e = this.parser.parseInline(
|
|
1250
|
-
return (
|
|
699
|
+
tablecell(r) {
|
|
700
|
+
let e = this.parser.parseInline(r.tokens), t = r.header ? "th" : "td";
|
|
701
|
+
return (r.align ? `<${t} align="${r.align}">` : `<${t}>`) + e + `</${t}>
|
|
1251
702
|
`;
|
|
1252
703
|
}
|
|
1253
|
-
strong({ tokens:
|
|
1254
|
-
return `<strong>${this.parser.parseInline(
|
|
704
|
+
strong({ tokens: r }) {
|
|
705
|
+
return `<strong>${this.parser.parseInline(r)}</strong>`;
|
|
1255
706
|
}
|
|
1256
|
-
em({ tokens:
|
|
1257
|
-
return `<em>${this.parser.parseInline(
|
|
707
|
+
em({ tokens: r }) {
|
|
708
|
+
return `<em>${this.parser.parseInline(r)}</em>`;
|
|
1258
709
|
}
|
|
1259
|
-
codespan({ text:
|
|
1260
|
-
return `<code>${
|
|
710
|
+
codespan({ text: r }) {
|
|
711
|
+
return `<code>${$(r, !0)}</code>`;
|
|
1261
712
|
}
|
|
1262
|
-
br(
|
|
713
|
+
br(r) {
|
|
1263
714
|
return "<br>";
|
|
1264
715
|
}
|
|
1265
|
-
del({ tokens:
|
|
1266
|
-
return `<del>${this.parser.parseInline(
|
|
1267
|
-
}
|
|
1268
|
-
link({ href:
|
|
1269
|
-
let
|
|
1270
|
-
if (
|
|
1271
|
-
|
|
1272
|
-
let
|
|
1273
|
-
return e && (
|
|
1274
|
-
}
|
|
1275
|
-
image({ href:
|
|
1276
|
-
|
|
1277
|
-
let
|
|
1278
|
-
if (
|
|
1279
|
-
|
|
1280
|
-
let
|
|
1281
|
-
return e && (
|
|
1282
|
-
}
|
|
1283
|
-
text(
|
|
1284
|
-
return "tokens" in
|
|
1285
|
-
}
|
|
1286
|
-
},
|
|
1287
|
-
strong({ text:
|
|
1288
|
-
return
|
|
716
|
+
del({ tokens: r }) {
|
|
717
|
+
return `<del>${this.parser.parseInline(r)}</del>`;
|
|
718
|
+
}
|
|
719
|
+
link({ href: r, title: e, tokens: t }) {
|
|
720
|
+
let s = this.parser.parseInline(t), n = le(r);
|
|
721
|
+
if (n === null) return s;
|
|
722
|
+
r = n;
|
|
723
|
+
let i = '<a href="' + r + '"';
|
|
724
|
+
return e && (i += ' title="' + $(e) + '"'), i += ">" + s + "</a>", i;
|
|
725
|
+
}
|
|
726
|
+
image({ href: r, title: e, text: t, tokens: s }) {
|
|
727
|
+
s && (t = this.parser.parseInline(s, this.parser.textRenderer));
|
|
728
|
+
let n = le(r);
|
|
729
|
+
if (n === null) return $(t);
|
|
730
|
+
r = n;
|
|
731
|
+
let i = `<img src="${r}" alt="${$(t)}"`;
|
|
732
|
+
return e && (i += ` title="${$(e)}"`), i += ">", i;
|
|
733
|
+
}
|
|
734
|
+
text(r) {
|
|
735
|
+
return "tokens" in r && r.tokens ? this.parser.parseInline(r.tokens) : "escaped" in r && r.escaped ? r.text : $(r.text);
|
|
736
|
+
}
|
|
737
|
+
}, Y = class {
|
|
738
|
+
strong({ text: r }) {
|
|
739
|
+
return r;
|
|
1289
740
|
}
|
|
1290
|
-
em({ text:
|
|
1291
|
-
return
|
|
741
|
+
em({ text: r }) {
|
|
742
|
+
return r;
|
|
1292
743
|
}
|
|
1293
|
-
codespan({ text:
|
|
1294
|
-
return
|
|
744
|
+
codespan({ text: r }) {
|
|
745
|
+
return r;
|
|
1295
746
|
}
|
|
1296
|
-
del({ text:
|
|
1297
|
-
return
|
|
747
|
+
del({ text: r }) {
|
|
748
|
+
return r;
|
|
1298
749
|
}
|
|
1299
|
-
html({ text:
|
|
1300
|
-
return
|
|
750
|
+
html({ text: r }) {
|
|
751
|
+
return r;
|
|
1301
752
|
}
|
|
1302
|
-
text({ text:
|
|
1303
|
-
return
|
|
753
|
+
text({ text: r }) {
|
|
754
|
+
return r;
|
|
1304
755
|
}
|
|
1305
|
-
link({ text:
|
|
1306
|
-
return "" +
|
|
756
|
+
link({ text: r }) {
|
|
757
|
+
return "" + r;
|
|
1307
758
|
}
|
|
1308
|
-
image({ text:
|
|
1309
|
-
return "" +
|
|
759
|
+
image({ text: r }) {
|
|
760
|
+
return "" + r;
|
|
1310
761
|
}
|
|
1311
762
|
br() {
|
|
1312
763
|
return "";
|
|
1313
764
|
}
|
|
1314
|
-
checkbox({ raw:
|
|
1315
|
-
return
|
|
765
|
+
checkbox({ raw: r }) {
|
|
766
|
+
return r;
|
|
1316
767
|
}
|
|
1317
|
-
},
|
|
768
|
+
}, S = class j {
|
|
1318
769
|
constructor(e) {
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
this.options = e ||
|
|
770
|
+
x(this, "options");
|
|
771
|
+
x(this, "renderer");
|
|
772
|
+
x(this, "textRenderer");
|
|
773
|
+
this.options = e || z, this.options.renderer = this.options.renderer || new D(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new Y();
|
|
1323
774
|
}
|
|
1324
775
|
static parse(e, t) {
|
|
1325
|
-
return new
|
|
776
|
+
return new j(t).parse(e);
|
|
1326
777
|
}
|
|
1327
778
|
static parseInline(e, t) {
|
|
1328
|
-
return new
|
|
779
|
+
return new j(t).parseInline(e);
|
|
1329
780
|
}
|
|
1330
781
|
parse(e) {
|
|
1331
|
-
var
|
|
782
|
+
var s, n;
|
|
1332
783
|
let t = "";
|
|
1333
|
-
for (let
|
|
1334
|
-
let
|
|
1335
|
-
if ((
|
|
1336
|
-
let h =
|
|
1337
|
-
if (
|
|
1338
|
-
t +=
|
|
784
|
+
for (let i = 0; i < e.length; i++) {
|
|
785
|
+
let a = e[i];
|
|
786
|
+
if ((n = (s = this.options.extensions) == null ? void 0 : s.renderers) != null && n[a.type]) {
|
|
787
|
+
let h = a, o = this.options.extensions.renderers[h.type].call({ parser: this }, h);
|
|
788
|
+
if (o !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(h.type)) {
|
|
789
|
+
t += o || "";
|
|
1339
790
|
continue;
|
|
1340
791
|
}
|
|
1341
792
|
}
|
|
1342
|
-
let l =
|
|
793
|
+
let l = a;
|
|
1343
794
|
switch (l.type) {
|
|
1344
795
|
case "space": {
|
|
1345
796
|
t += this.renderer.space(l);
|
|
@@ -1399,294 +850,294 @@ ${n}</tr>
|
|
|
1399
850
|
return t;
|
|
1400
851
|
}
|
|
1401
852
|
parseInline(e, t = this.renderer) {
|
|
1402
|
-
var
|
|
1403
|
-
let
|
|
1404
|
-
for (let
|
|
1405
|
-
let l = e[
|
|
1406
|
-
if ((
|
|
1407
|
-
let
|
|
1408
|
-
if (
|
|
1409
|
-
|
|
853
|
+
var n, i;
|
|
854
|
+
let s = "";
|
|
855
|
+
for (let a = 0; a < e.length; a++) {
|
|
856
|
+
let l = e[a];
|
|
857
|
+
if ((i = (n = this.options.extensions) == null ? void 0 : n.renderers) != null && i[l.type]) {
|
|
858
|
+
let o = this.options.extensions.renderers[l.type].call({ parser: this }, l);
|
|
859
|
+
if (o !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(l.type)) {
|
|
860
|
+
s += o || "";
|
|
1410
861
|
continue;
|
|
1411
862
|
}
|
|
1412
863
|
}
|
|
1413
864
|
let h = l;
|
|
1414
865
|
switch (h.type) {
|
|
1415
866
|
case "escape": {
|
|
1416
|
-
|
|
867
|
+
s += t.text(h);
|
|
1417
868
|
break;
|
|
1418
869
|
}
|
|
1419
870
|
case "html": {
|
|
1420
|
-
|
|
871
|
+
s += t.html(h);
|
|
1421
872
|
break;
|
|
1422
873
|
}
|
|
1423
874
|
case "link": {
|
|
1424
|
-
|
|
875
|
+
s += t.link(h);
|
|
1425
876
|
break;
|
|
1426
877
|
}
|
|
1427
878
|
case "image": {
|
|
1428
|
-
|
|
879
|
+
s += t.image(h);
|
|
1429
880
|
break;
|
|
1430
881
|
}
|
|
1431
882
|
case "checkbox": {
|
|
1432
|
-
|
|
883
|
+
s += t.checkbox(h);
|
|
1433
884
|
break;
|
|
1434
885
|
}
|
|
1435
886
|
case "strong": {
|
|
1436
|
-
|
|
887
|
+
s += t.strong(h);
|
|
1437
888
|
break;
|
|
1438
889
|
}
|
|
1439
890
|
case "em": {
|
|
1440
|
-
|
|
891
|
+
s += t.em(h);
|
|
1441
892
|
break;
|
|
1442
893
|
}
|
|
1443
894
|
case "codespan": {
|
|
1444
|
-
|
|
895
|
+
s += t.codespan(h);
|
|
1445
896
|
break;
|
|
1446
897
|
}
|
|
1447
898
|
case "br": {
|
|
1448
|
-
|
|
899
|
+
s += t.br(h);
|
|
1449
900
|
break;
|
|
1450
901
|
}
|
|
1451
902
|
case "del": {
|
|
1452
|
-
|
|
903
|
+
s += t.del(h);
|
|
1453
904
|
break;
|
|
1454
905
|
}
|
|
1455
906
|
case "text": {
|
|
1456
|
-
|
|
907
|
+
s += t.text(h);
|
|
1457
908
|
break;
|
|
1458
909
|
}
|
|
1459
910
|
default: {
|
|
1460
|
-
let
|
|
1461
|
-
if (this.options.silent) return console.error(
|
|
1462
|
-
throw new Error(
|
|
911
|
+
let o = 'Token with "' + h.type + '" type was not found.';
|
|
912
|
+
if (this.options.silent) return console.error(o), "";
|
|
913
|
+
throw new Error(o);
|
|
1463
914
|
}
|
|
1464
915
|
}
|
|
1465
916
|
}
|
|
1466
|
-
return
|
|
917
|
+
return s;
|
|
1467
918
|
}
|
|
1468
|
-
},
|
|
1469
|
-
constructor(
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
this.options =
|
|
919
|
+
}, v, L = (v = class {
|
|
920
|
+
constructor(r) {
|
|
921
|
+
x(this, "options");
|
|
922
|
+
x(this, "block");
|
|
923
|
+
this.options = r || z;
|
|
1473
924
|
}
|
|
1474
|
-
preprocess(
|
|
1475
|
-
return
|
|
925
|
+
preprocess(r) {
|
|
926
|
+
return r;
|
|
1476
927
|
}
|
|
1477
|
-
postprocess(
|
|
1478
|
-
return
|
|
928
|
+
postprocess(r) {
|
|
929
|
+
return r;
|
|
1479
930
|
}
|
|
1480
|
-
processAllTokens(
|
|
1481
|
-
return
|
|
931
|
+
processAllTokens(r) {
|
|
932
|
+
return r;
|
|
1482
933
|
}
|
|
1483
|
-
emStrongMask(
|
|
1484
|
-
return
|
|
934
|
+
emStrongMask(r) {
|
|
935
|
+
return r;
|
|
1485
936
|
}
|
|
1486
937
|
provideLexer() {
|
|
1487
|
-
return this.block ?
|
|
938
|
+
return this.block ? y.lex : y.lexInline;
|
|
1488
939
|
}
|
|
1489
940
|
provideParser() {
|
|
1490
|
-
return this.block ?
|
|
1491
|
-
}
|
|
1492
|
-
},
|
|
1493
|
-
constructor(...
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
this.use(...
|
|
1505
|
-
}
|
|
1506
|
-
walkTokens(
|
|
1507
|
-
var
|
|
941
|
+
return this.block ? S.parse : S.parseInline;
|
|
942
|
+
}
|
|
943
|
+
}, x(v, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), x(v, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), v), gt = class {
|
|
944
|
+
constructor(...r) {
|
|
945
|
+
x(this, "defaults", G());
|
|
946
|
+
x(this, "options", this.setOptions);
|
|
947
|
+
x(this, "parse", this.parseMarkdown(!0));
|
|
948
|
+
x(this, "parseInline", this.parseMarkdown(!1));
|
|
949
|
+
x(this, "Parser", S);
|
|
950
|
+
x(this, "Renderer", D);
|
|
951
|
+
x(this, "TextRenderer", Y);
|
|
952
|
+
x(this, "Lexer", y);
|
|
953
|
+
x(this, "Tokenizer", Z);
|
|
954
|
+
x(this, "Hooks", L);
|
|
955
|
+
this.use(...r);
|
|
956
|
+
}
|
|
957
|
+
walkTokens(r, e) {
|
|
958
|
+
var s, n;
|
|
1508
959
|
let t = [];
|
|
1509
|
-
for (let
|
|
960
|
+
for (let i of r) switch (t = t.concat(e.call(this, i)), i.type) {
|
|
1510
961
|
case "table": {
|
|
1511
|
-
let
|
|
1512
|
-
for (let l of
|
|
1513
|
-
for (let l of
|
|
962
|
+
let a = i;
|
|
963
|
+
for (let l of a.header) t = t.concat(this.walkTokens(l.tokens, e));
|
|
964
|
+
for (let l of a.rows) for (let h of l) t = t.concat(this.walkTokens(h.tokens, e));
|
|
1514
965
|
break;
|
|
1515
966
|
}
|
|
1516
967
|
case "list": {
|
|
1517
|
-
let
|
|
1518
|
-
t = t.concat(this.walkTokens(
|
|
968
|
+
let a = i;
|
|
969
|
+
t = t.concat(this.walkTokens(a.items, e));
|
|
1519
970
|
break;
|
|
1520
971
|
}
|
|
1521
972
|
default: {
|
|
1522
|
-
let
|
|
1523
|
-
(
|
|
1524
|
-
let h =
|
|
973
|
+
let a = i;
|
|
974
|
+
(n = (s = this.defaults.extensions) == null ? void 0 : s.childTokens) != null && n[a.type] ? this.defaults.extensions.childTokens[a.type].forEach((l) => {
|
|
975
|
+
let h = a[l].flat(1 / 0);
|
|
1525
976
|
t = t.concat(this.walkTokens(h, e));
|
|
1526
|
-
}) :
|
|
977
|
+
}) : a.tokens && (t = t.concat(this.walkTokens(a.tokens, e)));
|
|
1527
978
|
}
|
|
1528
979
|
}
|
|
1529
980
|
return t;
|
|
1530
981
|
}
|
|
1531
|
-
use(...
|
|
982
|
+
use(...r) {
|
|
1532
983
|
let e = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
1533
|
-
return
|
|
1534
|
-
let
|
|
1535
|
-
if (
|
|
1536
|
-
if (!
|
|
1537
|
-
if ("renderer" in
|
|
1538
|
-
let
|
|
1539
|
-
|
|
1540
|
-
let l =
|
|
1541
|
-
return l === !1 && (l =
|
|
1542
|
-
} : e.renderers[
|
|
984
|
+
return r.forEach((t) => {
|
|
985
|
+
let s = { ...t };
|
|
986
|
+
if (s.async = this.defaults.async || s.async || !1, t.extensions && (t.extensions.forEach((n) => {
|
|
987
|
+
if (!n.name) throw new Error("extension name required");
|
|
988
|
+
if ("renderer" in n) {
|
|
989
|
+
let i = e.renderers[n.name];
|
|
990
|
+
i ? e.renderers[n.name] = function(...a) {
|
|
991
|
+
let l = n.renderer.apply(this, a);
|
|
992
|
+
return l === !1 && (l = i.apply(this, a)), l;
|
|
993
|
+
} : e.renderers[n.name] = n.renderer;
|
|
1543
994
|
}
|
|
1544
|
-
if ("tokenizer" in
|
|
1545
|
-
if (!
|
|
1546
|
-
let
|
|
1547
|
-
|
|
995
|
+
if ("tokenizer" in n) {
|
|
996
|
+
if (!n.level || n.level !== "block" && n.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
997
|
+
let i = e[n.level];
|
|
998
|
+
i ? i.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]));
|
|
1548
999
|
}
|
|
1549
|
-
"childTokens" in
|
|
1550
|
-
}),
|
|
1551
|
-
let
|
|
1552
|
-
for (let
|
|
1553
|
-
if (!(
|
|
1554
|
-
if (["options", "parser"].includes(
|
|
1555
|
-
let
|
|
1556
|
-
|
|
1557
|
-
let
|
|
1558
|
-
return
|
|
1000
|
+
"childTokens" in n && n.childTokens && (e.childTokens[n.name] = n.childTokens);
|
|
1001
|
+
}), s.extensions = e), t.renderer) {
|
|
1002
|
+
let n = this.defaults.renderer || new D(this.defaults);
|
|
1003
|
+
for (let i in t.renderer) {
|
|
1004
|
+
if (!(i in n)) throw new Error(`renderer '${i}' does not exist`);
|
|
1005
|
+
if (["options", "parser"].includes(i)) continue;
|
|
1006
|
+
let a = i, l = t.renderer[a], h = n[a];
|
|
1007
|
+
n[a] = (...o) => {
|
|
1008
|
+
let p = l.apply(n, o);
|
|
1009
|
+
return p === !1 && (p = h.apply(n, o)), p || "";
|
|
1559
1010
|
};
|
|
1560
1011
|
}
|
|
1561
|
-
|
|
1012
|
+
s.renderer = n;
|
|
1562
1013
|
}
|
|
1563
1014
|
if (t.tokenizer) {
|
|
1564
|
-
let
|
|
1565
|
-
for (let
|
|
1566
|
-
if (!(
|
|
1567
|
-
if (["options", "rules", "lexer"].includes(
|
|
1568
|
-
let
|
|
1569
|
-
|
|
1570
|
-
let
|
|
1571
|
-
return
|
|
1015
|
+
let n = this.defaults.tokenizer || new Z(this.defaults);
|
|
1016
|
+
for (let i in t.tokenizer) {
|
|
1017
|
+
if (!(i in n)) throw new Error(`tokenizer '${i}' does not exist`);
|
|
1018
|
+
if (["options", "rules", "lexer"].includes(i)) continue;
|
|
1019
|
+
let a = i, l = t.tokenizer[a], h = n[a];
|
|
1020
|
+
n[a] = (...o) => {
|
|
1021
|
+
let p = l.apply(n, o);
|
|
1022
|
+
return p === !1 && (p = h.apply(n, o)), p;
|
|
1572
1023
|
};
|
|
1573
1024
|
}
|
|
1574
|
-
|
|
1025
|
+
s.tokenizer = n;
|
|
1575
1026
|
}
|
|
1576
1027
|
if (t.hooks) {
|
|
1577
|
-
let
|
|
1578
|
-
for (let
|
|
1579
|
-
if (!(
|
|
1580
|
-
if (["options", "block"].includes(
|
|
1581
|
-
let
|
|
1582
|
-
|
|
1583
|
-
if (this.defaults.async &&
|
|
1584
|
-
let
|
|
1585
|
-
return h.call(
|
|
1028
|
+
let n = this.defaults.hooks || new L();
|
|
1029
|
+
for (let i in t.hooks) {
|
|
1030
|
+
if (!(i in n)) throw new Error(`hook '${i}' does not exist`);
|
|
1031
|
+
if (["options", "block"].includes(i)) continue;
|
|
1032
|
+
let a = i, l = t.hooks[a], h = n[a];
|
|
1033
|
+
L.passThroughHooks.has(i) ? n[a] = (o) => {
|
|
1034
|
+
if (this.defaults.async && L.passThroughHooksRespectAsync.has(i)) return (async () => {
|
|
1035
|
+
let g = await l.call(n, o);
|
|
1036
|
+
return h.call(n, g);
|
|
1586
1037
|
})();
|
|
1587
|
-
let
|
|
1588
|
-
return h.call(
|
|
1589
|
-
} :
|
|
1038
|
+
let p = l.call(n, o);
|
|
1039
|
+
return h.call(n, p);
|
|
1040
|
+
} : n[a] = (...o) => {
|
|
1590
1041
|
if (this.defaults.async) return (async () => {
|
|
1591
|
-
let
|
|
1592
|
-
return
|
|
1042
|
+
let g = await l.apply(n, o);
|
|
1043
|
+
return g === !1 && (g = await h.apply(n, o)), g;
|
|
1593
1044
|
})();
|
|
1594
|
-
let
|
|
1595
|
-
return
|
|
1045
|
+
let p = l.apply(n, o);
|
|
1046
|
+
return p === !1 && (p = h.apply(n, o)), p;
|
|
1596
1047
|
};
|
|
1597
1048
|
}
|
|
1598
|
-
|
|
1049
|
+
s.hooks = n;
|
|
1599
1050
|
}
|
|
1600
1051
|
if (t.walkTokens) {
|
|
1601
|
-
let
|
|
1602
|
-
|
|
1052
|
+
let n = this.defaults.walkTokens, i = t.walkTokens;
|
|
1053
|
+
s.walkTokens = function(a) {
|
|
1603
1054
|
let l = [];
|
|
1604
|
-
return l.push(
|
|
1055
|
+
return l.push(i.call(this, a)), n && (l = l.concat(n.call(this, a))), l;
|
|
1605
1056
|
};
|
|
1606
1057
|
}
|
|
1607
|
-
this.defaults = { ...this.defaults, ...
|
|
1058
|
+
this.defaults = { ...this.defaults, ...s };
|
|
1608
1059
|
}), this;
|
|
1609
1060
|
}
|
|
1610
|
-
setOptions(
|
|
1611
|
-
return this.defaults = { ...this.defaults, ...
|
|
1061
|
+
setOptions(r) {
|
|
1062
|
+
return this.defaults = { ...this.defaults, ...r }, this;
|
|
1612
1063
|
}
|
|
1613
|
-
lexer(
|
|
1614
|
-
return
|
|
1064
|
+
lexer(r, e) {
|
|
1065
|
+
return y.lex(r, e ?? this.defaults);
|
|
1615
1066
|
}
|
|
1616
|
-
parser(
|
|
1617
|
-
return
|
|
1067
|
+
parser(r, e) {
|
|
1068
|
+
return S.parse(r, e ?? this.defaults);
|
|
1618
1069
|
}
|
|
1619
|
-
parseMarkdown(
|
|
1070
|
+
parseMarkdown(r) {
|
|
1620
1071
|
return (e, t) => {
|
|
1621
|
-
let
|
|
1622
|
-
if (this.defaults.async === !0 &&
|
|
1623
|
-
if (typeof e > "u" || e === null) return
|
|
1624
|
-
if (typeof e != "string") return
|
|
1625
|
-
if (
|
|
1626
|
-
let
|
|
1627
|
-
|
|
1628
|
-
let
|
|
1629
|
-
return
|
|
1630
|
-
})().catch(
|
|
1072
|
+
let s = { ...t }, n = { ...this.defaults, ...s }, i = this.onError(!!n.silent, !!n.async);
|
|
1073
|
+
if (this.defaults.async === !0 && s.async === !1) return i(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."));
|
|
1074
|
+
if (typeof e > "u" || e === null) return i(new Error("marked(): input parameter is undefined or null"));
|
|
1075
|
+
if (typeof e != "string") return i(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
|
|
1076
|
+
if (n.hooks && (n.hooks.options = n, n.hooks.block = r), n.async) return (async () => {
|
|
1077
|
+
let a = n.hooks ? await n.hooks.preprocess(e) : e, l = await (n.hooks ? await n.hooks.provideLexer() : r ? y.lex : y.lexInline)(a, n), h = n.hooks ? await n.hooks.processAllTokens(l) : l;
|
|
1078
|
+
n.walkTokens && await Promise.all(this.walkTokens(h, n.walkTokens));
|
|
1079
|
+
let o = await (n.hooks ? await n.hooks.provideParser() : r ? S.parse : S.parseInline)(h, n);
|
|
1080
|
+
return n.hooks ? await n.hooks.postprocess(o) : o;
|
|
1081
|
+
})().catch(i);
|
|
1631
1082
|
try {
|
|
1632
|
-
|
|
1633
|
-
let
|
|
1634
|
-
|
|
1635
|
-
let l = (
|
|
1636
|
-
return
|
|
1637
|
-
} catch (
|
|
1638
|
-
return a
|
|
1083
|
+
n.hooks && (e = n.hooks.preprocess(e));
|
|
1084
|
+
let a = (n.hooks ? n.hooks.provideLexer() : r ? y.lex : y.lexInline)(e, n);
|
|
1085
|
+
n.hooks && (a = n.hooks.processAllTokens(a)), n.walkTokens && this.walkTokens(a, n.walkTokens);
|
|
1086
|
+
let l = (n.hooks ? n.hooks.provideParser() : r ? S.parse : S.parseInline)(a, n);
|
|
1087
|
+
return n.hooks && (l = n.hooks.postprocess(l)), l;
|
|
1088
|
+
} catch (a) {
|
|
1089
|
+
return i(a);
|
|
1639
1090
|
}
|
|
1640
1091
|
};
|
|
1641
1092
|
}
|
|
1642
|
-
onError(
|
|
1093
|
+
onError(r, e) {
|
|
1643
1094
|
return (t) => {
|
|
1644
1095
|
if (t.message += `
|
|
1645
|
-
Please report this to https://github.com/markedjs/marked.`,
|
|
1646
|
-
let
|
|
1647
|
-
return e ? Promise.resolve(
|
|
1096
|
+
Please report this to https://github.com/markedjs/marked.`, r) {
|
|
1097
|
+
let s = "<p>An error occurred:</p><pre>" + $(t.message + "", !0) + "</pre>";
|
|
1098
|
+
return e ? Promise.resolve(s) : s;
|
|
1648
1099
|
}
|
|
1649
1100
|
if (e) return Promise.reject(t);
|
|
1650
1101
|
throw t;
|
|
1651
1102
|
};
|
|
1652
1103
|
}
|
|
1653
|
-
},
|
|
1654
|
-
function
|
|
1655
|
-
return
|
|
1104
|
+
}, T = new gt();
|
|
1105
|
+
function d(r, e) {
|
|
1106
|
+
return T.parse(r, e);
|
|
1656
1107
|
}
|
|
1657
|
-
|
|
1658
|
-
return
|
|
1108
|
+
d.options = d.setOptions = function(r) {
|
|
1109
|
+
return T.setOptions(r), d.defaults = T.defaults, oe(d.defaults), d;
|
|
1659
1110
|
};
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
return
|
|
1111
|
+
d.getDefaults = G;
|
|
1112
|
+
d.defaults = z;
|
|
1113
|
+
d.use = function(...r) {
|
|
1114
|
+
return T.use(...r), d.defaults = T.defaults, oe(d.defaults), d;
|
|
1664
1115
|
};
|
|
1665
|
-
|
|
1666
|
-
return
|
|
1116
|
+
d.walkTokens = function(r, e) {
|
|
1117
|
+
return T.walkTokens(r, e);
|
|
1667
1118
|
};
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
function
|
|
1686
|
-
if (!
|
|
1687
|
-
const e =
|
|
1688
|
-
return
|
|
1119
|
+
d.parseInline = T.parseInline;
|
|
1120
|
+
d.Parser = S;
|
|
1121
|
+
d.parser = S.parse;
|
|
1122
|
+
d.Renderer = D;
|
|
1123
|
+
d.TextRenderer = Y;
|
|
1124
|
+
d.Lexer = y;
|
|
1125
|
+
d.lexer = y.lex;
|
|
1126
|
+
d.Tokenizer = Z;
|
|
1127
|
+
d.Hooks = L;
|
|
1128
|
+
d.parse = d;
|
|
1129
|
+
d.options;
|
|
1130
|
+
d.setOptions;
|
|
1131
|
+
d.use;
|
|
1132
|
+
d.walkTokens;
|
|
1133
|
+
d.parseInline;
|
|
1134
|
+
S.parse;
|
|
1135
|
+
y.lex;
|
|
1136
|
+
function dt(r) {
|
|
1137
|
+
if (!r) return "";
|
|
1138
|
+
const e = d.parse(r);
|
|
1139
|
+
return Re.sanitize(e);
|
|
1689
1140
|
}
|
|
1690
1141
|
export {
|
|
1691
|
-
|
|
1142
|
+
dt as default
|
|
1692
1143
|
};
|