@hasna/instructions 0.7.6 → 0.7.7
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/README.md +6 -0
- package/dist/chunks/{apply-xraar7p0.js → apply-33g17x4y.js} +2 -2
- package/dist/chunks/{apply-1cpkx082.js → apply-f9f2sp7y.js} +2 -2
- package/dist/chunks/{index-16j8x10s.js → index-95xa9crj.js} +1369 -36
- package/dist/chunks/{index-src5t3my.js → index-avd1s9kz.js} +1 -1
- package/dist/chunks/{index-x0v4m19f.js → index-c3s70n0a.js} +1 -1
- package/dist/chunks/{index-6qfy0542.js → index-m2mh1xew.js} +1481 -64
- package/dist/chunks/{index-rvb4znxa.js → index-mfrc04ts.js} +2 -2
- package/dist/chunks/{index-ysnp8y58.js → index-wmwrjr19.js} +2 -2
- package/dist/chunks/{local-66fck74w.js → local-7wqy2ywb.js} +1 -1
- package/dist/chunks/{local-jqfx3kbq.js → local-nbck7fs2.js} +1 -1
- package/dist/chunks/{sync-8763n4sc.js → sync-d3be8nk3.js} +3 -3
- package/dist/chunks/{sync-8ca3ew84.js → sync-gzrb11dj.js} +3 -3
- package/dist/cli/index.js +38 -9
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1617 -186
- package/dist/lib/instruction-graph.d.ts.map +1 -1
- package/dist/lib/session-apply.d.ts.map +1 -1
- package/dist/lib/session-refresh.d.ts.map +1 -1
- package/dist/lib/session-render.d.ts +16 -0
- package/dist/lib/session-render.d.ts.map +1 -1
- package/dist/mcp/index.js +8 -7
- package/dist/server/index.js +1352 -25
- package/package.json +2 -1
|
@@ -203,6 +203,1339 @@ ${content.slice(frontmatter.length)}`;
|
|
|
203
203
|
${content}`;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
+
// ../../node_modules/.bun/marked@18.0.5/node_modules/marked/lib/marked.esm.js
|
|
207
|
+
function M() {
|
|
208
|
+
return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
|
|
209
|
+
}
|
|
210
|
+
var T = M();
|
|
211
|
+
function N(l) {
|
|
212
|
+
T = l;
|
|
213
|
+
}
|
|
214
|
+
var _ = { exec: () => null };
|
|
215
|
+
function E(l) {
|
|
216
|
+
let e = [];
|
|
217
|
+
return (t) => {
|
|
218
|
+
let n = Math.max(0, Math.min(3, t - 1)), s = e[n];
|
|
219
|
+
return s || (s = l(n), e[n] = s), s;
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
function d(l, e = "") {
|
|
223
|
+
let t = typeof l == "string" ? l : l.source, n = { replace: (s, r) => {
|
|
224
|
+
let i = typeof r == "string" ? r : r.source;
|
|
225
|
+
return i = i.replace(m.caret, "$1"), t = t.replace(s, i), n;
|
|
226
|
+
}, getRegex: () => new RegExp(t, e) };
|
|
227
|
+
return n;
|
|
228
|
+
}
|
|
229
|
+
var Te = ((l = "") => {
|
|
230
|
+
try {
|
|
231
|
+
return !!new RegExp("(?<=1)(?<!1)" + l);
|
|
232
|
+
} catch {
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
})();
|
|
236
|
+
var 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, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (l) => new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: E((l) => new RegExp(`^ {0,${l}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)), hrRegex: E((l) => new RegExp(`^ {0,${l}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)), fencesBeginRegex: E((l) => new RegExp(`^ {0,${l}}(?:\`\`\`|~~~)`)), headingBeginRegex: E((l) => new RegExp(`^ {0,${l}}#`)), htmlBeginRegex: E((l) => new RegExp(`^ {0,${l}}<(?:[a-z].*>|!--)`, "i")), blockquoteBeginRegex: E((l) => new RegExp(`^ {0,${l}}>`)) };
|
|
237
|
+
var Oe = /^(?:[ \t]*(?:\n|$))+/;
|
|
238
|
+
var we = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
|
|
239
|
+
var ye = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
|
|
240
|
+
var B = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
|
241
|
+
var Pe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
|
242
|
+
var j = / {0,3}(?:[*+-]|\d{1,9}[.)])/;
|
|
243
|
+
var oe = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
|
|
244
|
+
var ae = d(oe).replace(/bull/g, j).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();
|
|
245
|
+
var Se = d(oe).replace(/bull/g, j).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();
|
|
246
|
+
var F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
|
|
247
|
+
var $e = /^[^\n]+/;
|
|
248
|
+
var U = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;
|
|
249
|
+
var Le = d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", U).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
|
|
250
|
+
var _e = d(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, j).getRegex();
|
|
251
|
+
var H = "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";
|
|
252
|
+
var K = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
253
|
+
var ze = d("^ {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[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))", "i").replace("comment", K).replace("tag", H).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
254
|
+
var le = d(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]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex();
|
|
255
|
+
var Me = d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", le).getRegex();
|
|
256
|
+
var W = { blockquote: Me, code: we, def: Le, fences: ye, heading: Pe, hr: B, html: ze, lheading: ae, list: _e, newline: Oe, paragraph: le, table: _, text: $e };
|
|
257
|
+
var se = d("^ *([^\\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}\t)[^\\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", H).getRegex();
|
|
258
|
+
var Ee = { ...W, lheading: Se, table: se, paragraph: d(F).replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", se).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex() };
|
|
259
|
+
var Ie = { ...W, html: d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", K).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: _, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: d(F).replace("hr", B).replace("heading", ` *#{1,6} *[^
|
|
260
|
+
]`).replace("lheading", ae).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() };
|
|
261
|
+
var Ae = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
|
|
262
|
+
var Ce = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
|
|
263
|
+
var ue = /^( {2,}|\\)\n(?!\s*$)/;
|
|
264
|
+
var Be = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
|
265
|
+
var I = /[\p{P}\p{S}]/u;
|
|
266
|
+
var Z = /[\s\p{P}\p{S}]/u;
|
|
267
|
+
var X = /[^\s\p{P}\p{S}]/u;
|
|
268
|
+
var De = d(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Z).getRegex();
|
|
269
|
+
var pe = /(?!~)[\p{P}\p{S}]/u;
|
|
270
|
+
var qe = /(?!~)[\s\p{P}\p{S}]/u;
|
|
271
|
+
var ve = /(?:[^\s\p{P}\p{S}]|~)/u;
|
|
272
|
+
var He = d(/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();
|
|
273
|
+
var ce = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/;
|
|
274
|
+
var Ze = d(ce, "u").replace(/punct/g, I).getRegex();
|
|
275
|
+
var Ge = d(ce, "u").replace(/punct/g, pe).getRegex();
|
|
276
|
+
var he = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
|
|
277
|
+
var Ne = d(he, "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, Z).replace(/punct/g, I).getRegex();
|
|
278
|
+
var Qe = d(he, "gu").replace(/notPunctSpace/g, ve).replace(/punctSpace/g, qe).replace(/punct/g, pe).getRegex();
|
|
279
|
+
var je = d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, Z).replace(/punct/g, I).getRegex();
|
|
280
|
+
var Fe = d(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, I).getRegex();
|
|
281
|
+
var Ue = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)";
|
|
282
|
+
var Ke = d(Ue, "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, Z).replace(/punct/g, I).getRegex();
|
|
283
|
+
var We = d(/\\(punct)/, "gu").replace(/punct/g, I).getRegex();
|
|
284
|
+
var Xe = d(/^<(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();
|
|
285
|
+
var Je = d(K).replace("(?:-->|$)", "-->").getRegex();
|
|
286
|
+
var Ve = d("^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", Je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
|
|
287
|
+
var v = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/;
|
|
288
|
+
var Ye = d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", v).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
|
|
289
|
+
var ke = d(/^!?\[(label)\]\[(ref)\]/).replace("label", v).replace("ref", U).getRegex();
|
|
290
|
+
var de = d(/^!?\[(ref)\](?:\[\])?/).replace("ref", U).getRegex();
|
|
291
|
+
var et = d("reflink|nolink(?!\\()", "g").replace("reflink", ke).replace("nolink", de).getRegex();
|
|
292
|
+
var ie = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;
|
|
293
|
+
var J = { _backpedal: _, anyPunctuation: We, autolink: Xe, blockSkip: He, br: ue, code: Ce, del: _, delLDelim: _, delRDelim: _, emStrongLDelim: Ze, emStrongRDelimAst: Ne, emStrongRDelimUnd: je, escape: Ae, link: Ye, nolink: de, punctuation: De, reflink: ke, reflinkSearch: et, tag: Ve, text: Be, url: _ };
|
|
294
|
+
var tt = { ...J, link: d(/^!?\[(label)\]\((.*?)\)/).replace("label", v).getRegex(), reflink: d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", v).getRegex() };
|
|
295
|
+
var Q = { ...J, emStrongRDelimAst: Qe, emStrongLDelim: Ge, delLDelim: Fe, delRDelim: Ke, url: d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ie).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: d(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ie).getRegex() };
|
|
296
|
+
var nt = { ...Q, br: d(ue).replace("{2,}", "*").getRegex(), text: d(Q.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
|
|
297
|
+
var D = { normal: W, gfm: Ee, pedantic: Ie };
|
|
298
|
+
var A = { normal: J, gfm: Q, breaks: nt, pedantic: tt };
|
|
299
|
+
var rt = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" };
|
|
300
|
+
var ge = (l) => rt[l];
|
|
301
|
+
function O(l, e) {
|
|
302
|
+
if (e) {
|
|
303
|
+
if (m.escapeTest.test(l))
|
|
304
|
+
return l.replace(m.escapeReplace, ge);
|
|
305
|
+
} else if (m.escapeTestNoEncode.test(l))
|
|
306
|
+
return l.replace(m.escapeReplaceNoEncode, ge);
|
|
307
|
+
return l;
|
|
308
|
+
}
|
|
309
|
+
function V(l) {
|
|
310
|
+
try {
|
|
311
|
+
l = encodeURI(l).replace(m.percentDecode, "%");
|
|
312
|
+
} catch {
|
|
313
|
+
return null;
|
|
314
|
+
}
|
|
315
|
+
return l;
|
|
316
|
+
}
|
|
317
|
+
function Y(l, e) {
|
|
318
|
+
let t = l.replace(m.findPipe, (r, i, o) => {
|
|
319
|
+
let u = false, a = i;
|
|
320
|
+
for (;--a >= 0 && o[a] === "\\"; )
|
|
321
|
+
u = !u;
|
|
322
|
+
return u ? "|" : " |";
|
|
323
|
+
}), n = t.split(m.splitPipe), s = 0;
|
|
324
|
+
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e)
|
|
325
|
+
if (n.length > e)
|
|
326
|
+
n.splice(e);
|
|
327
|
+
else
|
|
328
|
+
for (;n.length < e; )
|
|
329
|
+
n.push("");
|
|
330
|
+
for (;s < n.length; s++)
|
|
331
|
+
n[s] = n[s].trim().replace(m.slashPipe, "|");
|
|
332
|
+
return n;
|
|
333
|
+
}
|
|
334
|
+
function $(l, e, t) {
|
|
335
|
+
let n = l.length;
|
|
336
|
+
if (n === 0)
|
|
337
|
+
return "";
|
|
338
|
+
let s = 0;
|
|
339
|
+
for (;s < n; ) {
|
|
340
|
+
let r = l.charAt(n - s - 1);
|
|
341
|
+
if (r === e && !t)
|
|
342
|
+
s++;
|
|
343
|
+
else if (r !== e && t)
|
|
344
|
+
s++;
|
|
345
|
+
else
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
return l.slice(0, n - s);
|
|
349
|
+
}
|
|
350
|
+
function ee(l) {
|
|
351
|
+
let e = l.split(`
|
|
352
|
+
`), t = e.length - 1;
|
|
353
|
+
for (;t >= 0 && m.blankLine.test(e[t]); )
|
|
354
|
+
t--;
|
|
355
|
+
return e.length - t <= 2 ? l : e.slice(0, t + 1).join(`
|
|
356
|
+
`);
|
|
357
|
+
}
|
|
358
|
+
function fe(l, e) {
|
|
359
|
+
if (l.indexOf(e[1]) === -1)
|
|
360
|
+
return -1;
|
|
361
|
+
let t = 0;
|
|
362
|
+
for (let n = 0;n < l.length; n++)
|
|
363
|
+
if (l[n] === "\\")
|
|
364
|
+
n++;
|
|
365
|
+
else if (l[n] === e[0])
|
|
366
|
+
t++;
|
|
367
|
+
else if (l[n] === e[1] && (t--, t < 0))
|
|
368
|
+
return n;
|
|
369
|
+
return t > 0 ? -2 : -1;
|
|
370
|
+
}
|
|
371
|
+
function me(l, e = 0) {
|
|
372
|
+
let t = e, n = "";
|
|
373
|
+
for (let s of l)
|
|
374
|
+
if (s === "\t") {
|
|
375
|
+
let r = 4 - t % 4;
|
|
376
|
+
n += " ".repeat(r), t += r;
|
|
377
|
+
} else
|
|
378
|
+
n += s, t++;
|
|
379
|
+
return n;
|
|
380
|
+
}
|
|
381
|
+
function xe(l, e, t, n, s) {
|
|
382
|
+
let r = e.href, i = e.title || null, o = l[1].replace(s.other.outputLinkReplace, "$1");
|
|
383
|
+
n.state.inLink = true;
|
|
384
|
+
let u = { type: l[0].charAt(0) === "!" ? "image" : "link", raw: t, href: r, title: i, text: o, tokens: n.inlineTokens(o) };
|
|
385
|
+
return n.state.inLink = false, u;
|
|
386
|
+
}
|
|
387
|
+
function st(l, e, t) {
|
|
388
|
+
let n = l.match(t.other.indentCodeCompensation);
|
|
389
|
+
if (n === null)
|
|
390
|
+
return e;
|
|
391
|
+
let s = n[1];
|
|
392
|
+
return e.split(`
|
|
393
|
+
`).map((r) => {
|
|
394
|
+
let i = r.match(t.other.beginningSpace);
|
|
395
|
+
if (i === null)
|
|
396
|
+
return r;
|
|
397
|
+
let [o] = i;
|
|
398
|
+
return o.length >= s.length ? r.slice(s.length) : r;
|
|
399
|
+
}).join(`
|
|
400
|
+
`);
|
|
401
|
+
}
|
|
402
|
+
var w = class {
|
|
403
|
+
options;
|
|
404
|
+
rules;
|
|
405
|
+
lexer;
|
|
406
|
+
constructor(e) {
|
|
407
|
+
this.options = e || T;
|
|
408
|
+
}
|
|
409
|
+
space(e) {
|
|
410
|
+
let t = this.rules.block.newline.exec(e);
|
|
411
|
+
if (t && t[0].length > 0)
|
|
412
|
+
return { type: "space", raw: t[0] };
|
|
413
|
+
}
|
|
414
|
+
code(e) {
|
|
415
|
+
let t = this.rules.block.code.exec(e);
|
|
416
|
+
if (t) {
|
|
417
|
+
let n = this.options.pedantic ? t[0] : ee(t[0]), s = n.replace(this.rules.other.codeRemoveIndent, "");
|
|
418
|
+
return { type: "code", raw: n, codeBlockStyle: "indented", text: s };
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
fences(e) {
|
|
422
|
+
let t = this.rules.block.fences.exec(e);
|
|
423
|
+
if (t) {
|
|
424
|
+
let n = t[0], s = st(n, t[3] || "", this.rules);
|
|
425
|
+
return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: s };
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
heading(e) {
|
|
429
|
+
let t = this.rules.block.heading.exec(e);
|
|
430
|
+
if (t) {
|
|
431
|
+
let n = t[2].trim();
|
|
432
|
+
if (this.rules.other.endingHash.test(n)) {
|
|
433
|
+
let s = $(n, "#");
|
|
434
|
+
(this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (n = s.trim());
|
|
435
|
+
}
|
|
436
|
+
return { type: "heading", raw: $(t[0], `
|
|
437
|
+
`), depth: t[1].length, text: n, tokens: this.lexer.inline(n) };
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
hr(e) {
|
|
441
|
+
let t = this.rules.block.hr.exec(e);
|
|
442
|
+
if (t)
|
|
443
|
+
return { type: "hr", raw: $(t[0], `
|
|
444
|
+
`) };
|
|
445
|
+
}
|
|
446
|
+
blockquote(e) {
|
|
447
|
+
let t = this.rules.block.blockquote.exec(e);
|
|
448
|
+
if (t) {
|
|
449
|
+
let n = $(t[0], `
|
|
450
|
+
`).split(`
|
|
451
|
+
`), s = "", r = "", i = [];
|
|
452
|
+
for (;n.length > 0; ) {
|
|
453
|
+
let o = false, u = [], a;
|
|
454
|
+
for (a = 0;a < n.length; a++)
|
|
455
|
+
if (this.rules.other.blockquoteStart.test(n[a]))
|
|
456
|
+
u.push(n[a]), o = true;
|
|
457
|
+
else if (!o)
|
|
458
|
+
u.push(n[a]);
|
|
459
|
+
else
|
|
460
|
+
break;
|
|
461
|
+
n = n.slice(a);
|
|
462
|
+
let c = u.join(`
|
|
463
|
+
`), p = c.replace(this.rules.other.blockquoteSetextReplace, `
|
|
464
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
465
|
+
s = s ? `${s}
|
|
466
|
+
${c}` : c, r = r ? `${r}
|
|
467
|
+
${p}` : p;
|
|
468
|
+
let k = this.lexer.state.top;
|
|
469
|
+
if (this.lexer.state.top = true, this.lexer.blockTokens(p, i, true), this.lexer.state.top = k, n.length === 0)
|
|
470
|
+
break;
|
|
471
|
+
let h = i.at(-1);
|
|
472
|
+
if (h?.type === "code")
|
|
473
|
+
break;
|
|
474
|
+
if (h?.type === "blockquote") {
|
|
475
|
+
let R = h, f = R.raw + `
|
|
476
|
+
` + n.join(`
|
|
477
|
+
`), S = this.blockquote(f);
|
|
478
|
+
i[i.length - 1] = S, s = s.substring(0, s.length - R.raw.length) + S.raw, r = r.substring(0, r.length - R.text.length) + S.text;
|
|
479
|
+
break;
|
|
480
|
+
} else if (h?.type === "list") {
|
|
481
|
+
let R = h, f = R.raw + `
|
|
482
|
+
` + n.join(`
|
|
483
|
+
`), S = this.list(f);
|
|
484
|
+
i[i.length - 1] = S, s = s.substring(0, s.length - h.raw.length) + S.raw, r = r.substring(0, r.length - R.raw.length) + S.raw, n = f.substring(i.at(-1).raw.length).split(`
|
|
485
|
+
`);
|
|
486
|
+
continue;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
return { type: "blockquote", raw: s, tokens: i, text: r };
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
list(e) {
|
|
493
|
+
let t = this.rules.block.list.exec(e);
|
|
494
|
+
if (t) {
|
|
495
|
+
let n = t[1].trim(), s = n.length > 1, r = { type: "list", raw: "", ordered: s, start: s ? +n.slice(0, -1) : "", loose: false, items: [] };
|
|
496
|
+
n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]");
|
|
497
|
+
let i = this.rules.other.listItemRegex(n), o = false;
|
|
498
|
+
for (;e; ) {
|
|
499
|
+
let a = false, c = "", p = "";
|
|
500
|
+
if (!(t = i.exec(e)) || this.rules.block.hr.test(e))
|
|
501
|
+
break;
|
|
502
|
+
c = t[0], e = e.substring(c.length);
|
|
503
|
+
let k = me(t[2].split(`
|
|
504
|
+
`, 1)[0], t[1].length), h = e.split(`
|
|
505
|
+
`, 1)[0], R = !k.trim(), f = 0;
|
|
506
|
+
if (this.options.pedantic ? (f = 2, p = k.trimStart()) : R ? f = t[1].length + 1 : (f = k.search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, p = k.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (c += h + `
|
|
507
|
+
`, e = e.substring(h.length + 1), a = true), !a) {
|
|
508
|
+
let S = this.rules.other.nextBulletRegex(f), te = this.rules.other.hrRegex(f), ne = this.rules.other.fencesBeginRegex(f), re = this.rules.other.headingBeginRegex(f), be = this.rules.other.htmlBeginRegex(f), Re = this.rules.other.blockquoteBeginRegex(f);
|
|
509
|
+
for (;e; ) {
|
|
510
|
+
let G = e.split(`
|
|
511
|
+
`, 1)[0], C;
|
|
512
|
+
if (h = G, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), C = h) : C = h.replace(this.rules.other.tabCharGlobal, " "), ne.test(h) || re.test(h) || be.test(h) || Re.test(h) || S.test(h) || te.test(h))
|
|
513
|
+
break;
|
|
514
|
+
if (C.search(this.rules.other.nonSpaceChar) >= f || !h.trim())
|
|
515
|
+
p += `
|
|
516
|
+
` + C.slice(f);
|
|
517
|
+
else {
|
|
518
|
+
if (R || k.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || ne.test(k) || re.test(k) || te.test(k))
|
|
519
|
+
break;
|
|
520
|
+
p += `
|
|
521
|
+
` + h;
|
|
522
|
+
}
|
|
523
|
+
R = !h.trim(), c += G + `
|
|
524
|
+
`, e = e.substring(G.length + 1), k = C.slice(f);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
r.loose || (o ? r.loose = true : this.rules.other.doubleBlankLine.test(c) && (o = true)), r.items.push({ type: "list_item", raw: c, task: !!this.options.gfm && this.rules.other.listIsTask.test(p), loose: false, text: p, tokens: [] }), r.raw += c;
|
|
528
|
+
}
|
|
529
|
+
let u = r.items.at(-1);
|
|
530
|
+
if (u)
|
|
531
|
+
u.raw = u.raw.trimEnd(), u.text = u.text.trimEnd();
|
|
532
|
+
else
|
|
533
|
+
return;
|
|
534
|
+
r.raw = r.raw.trimEnd();
|
|
535
|
+
for (let a of r.items) {
|
|
536
|
+
this.lexer.state.top = false, a.tokens = this.lexer.blockTokens(a.text, []);
|
|
537
|
+
let c = a.tokens[0];
|
|
538
|
+
if (a.task && (c?.type === "text" || c?.type === "paragraph")) {
|
|
539
|
+
a.text = a.text.replace(this.rules.other.listReplaceTask, ""), c.raw = c.raw.replace(this.rules.other.listReplaceTask, ""), c.text = c.text.replace(this.rules.other.listReplaceTask, "");
|
|
540
|
+
for (let k = this.lexer.inlineQueue.length - 1;k >= 0; k--)
|
|
541
|
+
if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[k].src)) {
|
|
542
|
+
this.lexer.inlineQueue[k].src = this.lexer.inlineQueue[k].src.replace(this.rules.other.listReplaceTask, "");
|
|
543
|
+
break;
|
|
544
|
+
}
|
|
545
|
+
let p = this.rules.other.listTaskCheckbox.exec(a.raw);
|
|
546
|
+
if (p) {
|
|
547
|
+
let k = { type: "checkbox", raw: p[0] + " ", checked: p[0] !== "[ ]" };
|
|
548
|
+
a.checked = k.checked, r.loose ? a.tokens[0] && ["paragraph", "text"].includes(a.tokens[0].type) && "tokens" in a.tokens[0] && a.tokens[0].tokens ? (a.tokens[0].raw = k.raw + a.tokens[0].raw, a.tokens[0].text = k.raw + a.tokens[0].text, a.tokens[0].tokens.unshift(k)) : a.tokens.unshift({ type: "paragraph", raw: k.raw, text: k.raw, tokens: [k] }) : a.tokens.unshift(k);
|
|
549
|
+
}
|
|
550
|
+
} else
|
|
551
|
+
a.task && (a.task = false);
|
|
552
|
+
if (!r.loose) {
|
|
553
|
+
let p = a.tokens.filter((h) => h.type === "space"), k = p.length > 0 && p.some((h) => this.rules.other.anyLine.test(h.raw));
|
|
554
|
+
r.loose = k;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
if (r.loose)
|
|
558
|
+
for (let a of r.items) {
|
|
559
|
+
a.loose = true;
|
|
560
|
+
for (let c of a.tokens)
|
|
561
|
+
c.type === "text" && (c.type = "paragraph");
|
|
562
|
+
}
|
|
563
|
+
return r;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
html(e) {
|
|
567
|
+
let t = this.rules.block.html.exec(e);
|
|
568
|
+
if (t) {
|
|
569
|
+
let n = ee(t[0]);
|
|
570
|
+
return { type: "html", block: true, raw: n, pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: n };
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
def(e) {
|
|
574
|
+
let t = this.rules.block.def.exec(e);
|
|
575
|
+
if (t) {
|
|
576
|
+
let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), s = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
577
|
+
return { type: "def", tag: n, raw: $(t[0], `
|
|
578
|
+
`), href: s, title: r };
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
table(e) {
|
|
582
|
+
let t = this.rules.block.table.exec(e);
|
|
583
|
+
if (!t || !this.rules.other.tableDelimiter.test(t[2]))
|
|
584
|
+
return;
|
|
585
|
+
let n = Y(t[1]), s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
586
|
+
`) : [], i = { type: "table", raw: $(t[0], `
|
|
587
|
+
`), header: [], align: [], rows: [] };
|
|
588
|
+
if (n.length === s.length) {
|
|
589
|
+
for (let o of s)
|
|
590
|
+
this.rules.other.tableAlignRight.test(o) ? i.align.push("right") : this.rules.other.tableAlignCenter.test(o) ? i.align.push("center") : this.rules.other.tableAlignLeft.test(o) ? i.align.push("left") : i.align.push(null);
|
|
591
|
+
for (let o = 0;o < n.length; o++)
|
|
592
|
+
i.header.push({ text: n[o], tokens: this.lexer.inline(n[o]), header: true, align: i.align[o] });
|
|
593
|
+
for (let o of r)
|
|
594
|
+
i.rows.push(Y(o, i.header.length).map((u, a) => ({ text: u, tokens: this.lexer.inline(u), header: false, align: i.align[a] })));
|
|
595
|
+
return i;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
lheading(e) {
|
|
599
|
+
let t = this.rules.block.lheading.exec(e);
|
|
600
|
+
if (t) {
|
|
601
|
+
let n = t[1].trim();
|
|
602
|
+
return { type: "heading", raw: $(t[0], `
|
|
603
|
+
`), depth: t[2].charAt(0) === "=" ? 1 : 2, text: n, tokens: this.lexer.inline(n) };
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
paragraph(e) {
|
|
607
|
+
let t = this.rules.block.paragraph.exec(e);
|
|
608
|
+
if (t) {
|
|
609
|
+
let n = t[1].charAt(t[1].length - 1) === `
|
|
610
|
+
` ? t[1].slice(0, -1) : t[1];
|
|
611
|
+
return { type: "paragraph", raw: t[0], text: n, tokens: this.lexer.inline(n) };
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
text(e) {
|
|
615
|
+
let t = this.rules.block.text.exec(e);
|
|
616
|
+
if (t)
|
|
617
|
+
return { type: "text", raw: t[0], text: t[0], tokens: this.lexer.inline(t[0]) };
|
|
618
|
+
}
|
|
619
|
+
escape(e) {
|
|
620
|
+
let t = this.rules.inline.escape.exec(e);
|
|
621
|
+
if (t)
|
|
622
|
+
return { type: "escape", raw: t[0], text: t[1] };
|
|
623
|
+
}
|
|
624
|
+
tag(e) {
|
|
625
|
+
let t = this.rules.inline.tag.exec(e);
|
|
626
|
+
if (t)
|
|
627
|
+
return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: t[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: t[0] };
|
|
628
|
+
}
|
|
629
|
+
link(e) {
|
|
630
|
+
let t = this.rules.inline.link.exec(e);
|
|
631
|
+
if (t) {
|
|
632
|
+
let n = t[2].trim();
|
|
633
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
634
|
+
if (!this.rules.other.endAngleBracket.test(n))
|
|
635
|
+
return;
|
|
636
|
+
let i = $(n.slice(0, -1), "\\");
|
|
637
|
+
if ((n.length - i.length) % 2 === 0)
|
|
638
|
+
return;
|
|
639
|
+
} else {
|
|
640
|
+
let i = fe(t[2], "()");
|
|
641
|
+
if (i === -2)
|
|
642
|
+
return;
|
|
643
|
+
if (i > -1) {
|
|
644
|
+
let u = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + i;
|
|
645
|
+
t[2] = t[2].substring(0, i), t[0] = t[0].substring(0, u).trim(), t[3] = "";
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
let s = t[2], r = "";
|
|
649
|
+
if (this.options.pedantic) {
|
|
650
|
+
let i = this.rules.other.pedanticHrefTitle.exec(s);
|
|
651
|
+
i && (s = i[1], r = i[3]);
|
|
652
|
+
} else
|
|
653
|
+
r = t[3] ? t[3].slice(1, -1) : "";
|
|
654
|
+
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? s = s.slice(1) : s = s.slice(1, -1)), xe(t, { href: s && s.replace(this.rules.inline.anyPunctuation, "$1"), title: r && r.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
reflink(e, t) {
|
|
658
|
+
let n;
|
|
659
|
+
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
660
|
+
let s = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), r = t[s.toLowerCase()];
|
|
661
|
+
if (!r) {
|
|
662
|
+
let i = n[0].charAt(0);
|
|
663
|
+
return { type: "text", raw: i, text: i };
|
|
664
|
+
}
|
|
665
|
+
return xe(n, r, n[0], this.lexer, this.rules);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
emStrong(e, t, n = "") {
|
|
669
|
+
let s = this.rules.inline.emStrongLDelim.exec(e);
|
|
670
|
+
if (!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && n.match(this.rules.other.unicodeAlphaNumeric))
|
|
671
|
+
return;
|
|
672
|
+
if (!(s[1] || s[3] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
673
|
+
let i = [...s[0]].length - 1, o, u, a = i, c = 0, p = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
674
|
+
for (p.lastIndex = 0, t = t.slice(-1 * e.length + i);(s = p.exec(t)) !== null; ) {
|
|
675
|
+
if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o)
|
|
676
|
+
continue;
|
|
677
|
+
if (u = [...o].length, s[3] || s[4]) {
|
|
678
|
+
a += u;
|
|
679
|
+
continue;
|
|
680
|
+
} else if ((s[5] || s[6]) && i % 3 && !((i + u) % 3)) {
|
|
681
|
+
c += u;
|
|
682
|
+
continue;
|
|
683
|
+
}
|
|
684
|
+
if (a -= u, a > 0)
|
|
685
|
+
continue;
|
|
686
|
+
u = Math.min(u, u + a + c);
|
|
687
|
+
let k = [...s[0]][0].length, h = e.slice(0, i + s.index + k + u);
|
|
688
|
+
if (Math.min(i, u) % 2) {
|
|
689
|
+
let f = h.slice(1, -1);
|
|
690
|
+
return { type: "em", raw: h, text: f, tokens: this.lexer.inlineTokens(f) };
|
|
691
|
+
}
|
|
692
|
+
let R = h.slice(2, -2);
|
|
693
|
+
return { type: "strong", raw: h, text: R, tokens: this.lexer.inlineTokens(R) };
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
codespan(e) {
|
|
698
|
+
let t = this.rules.inline.code.exec(e);
|
|
699
|
+
if (t) {
|
|
700
|
+
let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), s = this.rules.other.nonSpaceChar.test(n), r = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
|
|
701
|
+
return s && r && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: t[0], text: n };
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
br(e) {
|
|
705
|
+
let t = this.rules.inline.br.exec(e);
|
|
706
|
+
if (t)
|
|
707
|
+
return { type: "br", raw: t[0] };
|
|
708
|
+
}
|
|
709
|
+
del(e, t, n = "") {
|
|
710
|
+
let s = this.rules.inline.delLDelim.exec(e);
|
|
711
|
+
if (!s)
|
|
712
|
+
return;
|
|
713
|
+
if (!(s[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
714
|
+
let i = [...s[0]].length - 1, o, u, a = i, c = this.rules.inline.delRDelim;
|
|
715
|
+
for (c.lastIndex = 0, t = t.slice(-1 * e.length + i);(s = c.exec(t)) !== null; ) {
|
|
716
|
+
if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o || (u = [...o].length, u !== i))
|
|
717
|
+
continue;
|
|
718
|
+
if (s[3] || s[4]) {
|
|
719
|
+
a += u;
|
|
720
|
+
continue;
|
|
721
|
+
}
|
|
722
|
+
if (a -= u, a > 0)
|
|
723
|
+
continue;
|
|
724
|
+
u = Math.min(u, u + a);
|
|
725
|
+
let p = [...s[0]][0].length, k = e.slice(0, i + s.index + p + u), h = k.slice(i, -i);
|
|
726
|
+
return { type: "del", raw: k, text: h, tokens: this.lexer.inlineTokens(h) };
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
autolink(e) {
|
|
731
|
+
let t = this.rules.inline.autolink.exec(e);
|
|
732
|
+
if (t) {
|
|
733
|
+
let n, s;
|
|
734
|
+
return t[2] === "@" ? (n = t[1], s = "mailto:" + n) : (n = t[1], s = n), { type: "link", raw: t[0], text: n, href: s, tokens: [{ type: "text", raw: n, text: n }] };
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
url(e) {
|
|
738
|
+
let t;
|
|
739
|
+
if (t = this.rules.inline.url.exec(e)) {
|
|
740
|
+
let n, s;
|
|
741
|
+
if (t[2] === "@")
|
|
742
|
+
n = t[0], s = "mailto:" + n;
|
|
743
|
+
else {
|
|
744
|
+
let r;
|
|
745
|
+
do
|
|
746
|
+
r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
|
|
747
|
+
while (r !== t[0]);
|
|
748
|
+
n = t[0], t[1] === "www." ? s = "http://" + t[0] : s = t[0];
|
|
749
|
+
}
|
|
750
|
+
return { type: "link", raw: t[0], text: n, href: s, tokens: [{ type: "text", raw: n, text: n }] };
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
inlineText(e) {
|
|
754
|
+
let t = this.rules.inline.text.exec(e);
|
|
755
|
+
if (t) {
|
|
756
|
+
let n = this.lexer.state.inRawBlock;
|
|
757
|
+
return { type: "text", raw: t[0], text: t[0], escaped: n };
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
};
|
|
761
|
+
var x = class l {
|
|
762
|
+
tokens;
|
|
763
|
+
options;
|
|
764
|
+
state;
|
|
765
|
+
inlineQueue;
|
|
766
|
+
tokenizer;
|
|
767
|
+
constructor(e) {
|
|
768
|
+
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new w, this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
|
|
769
|
+
let t = { other: m, block: D.normal, inline: A.normal };
|
|
770
|
+
this.options.pedantic ? (t.block = D.pedantic, t.inline = A.pedantic) : this.options.gfm && (t.block = D.gfm, this.options.breaks ? t.inline = A.breaks : t.inline = A.gfm), this.tokenizer.rules = t;
|
|
771
|
+
}
|
|
772
|
+
static get rules() {
|
|
773
|
+
return { block: D, inline: A };
|
|
774
|
+
}
|
|
775
|
+
static lex(e, t) {
|
|
776
|
+
return new l(t).lex(e);
|
|
777
|
+
}
|
|
778
|
+
static lexInline(e, t) {
|
|
779
|
+
return new l(t).inlineTokens(e);
|
|
780
|
+
}
|
|
781
|
+
lex(e) {
|
|
782
|
+
e = e.replace(m.carriageReturn, `
|
|
783
|
+
`), this.blockTokens(e, this.tokens);
|
|
784
|
+
for (let t = 0;t < this.inlineQueue.length; t++) {
|
|
785
|
+
let n = this.inlineQueue[t];
|
|
786
|
+
this.inlineTokens(n.src, n.tokens);
|
|
787
|
+
}
|
|
788
|
+
return this.inlineQueue = [], this.tokens;
|
|
789
|
+
}
|
|
790
|
+
blockTokens(e, t = [], n = false) {
|
|
791
|
+
this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, ""));
|
|
792
|
+
let s = 1 / 0;
|
|
793
|
+
for (;e; ) {
|
|
794
|
+
if (e.length < s)
|
|
795
|
+
s = e.length;
|
|
796
|
+
else {
|
|
797
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
798
|
+
break;
|
|
799
|
+
}
|
|
800
|
+
let r;
|
|
801
|
+
if (this.options.extensions?.block?.some((o) => (r = o.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), true) : false))
|
|
802
|
+
continue;
|
|
803
|
+
if (r = this.tokenizer.space(e)) {
|
|
804
|
+
e = e.substring(r.raw.length);
|
|
805
|
+
let o = t.at(-1);
|
|
806
|
+
r.raw.length === 1 && o !== undefined ? o.raw += `
|
|
807
|
+
` : t.push(r);
|
|
808
|
+
continue;
|
|
809
|
+
}
|
|
810
|
+
if (r = this.tokenizer.code(e)) {
|
|
811
|
+
e = e.substring(r.raw.length);
|
|
812
|
+
let o = t.at(-1);
|
|
813
|
+
o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`
|
|
814
|
+
`) ? "" : `
|
|
815
|
+
`) + r.raw, o.text += `
|
|
816
|
+
` + r.text, this.inlineQueue.at(-1).src = o.text) : t.push(r);
|
|
817
|
+
continue;
|
|
818
|
+
}
|
|
819
|
+
if (r = this.tokenizer.fences(e)) {
|
|
820
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
821
|
+
continue;
|
|
822
|
+
}
|
|
823
|
+
if (r = this.tokenizer.heading(e)) {
|
|
824
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
825
|
+
continue;
|
|
826
|
+
}
|
|
827
|
+
if (r = this.tokenizer.hr(e)) {
|
|
828
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
829
|
+
continue;
|
|
830
|
+
}
|
|
831
|
+
if (r = this.tokenizer.blockquote(e)) {
|
|
832
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
833
|
+
continue;
|
|
834
|
+
}
|
|
835
|
+
if (r = this.tokenizer.list(e)) {
|
|
836
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
837
|
+
continue;
|
|
838
|
+
}
|
|
839
|
+
if (r = this.tokenizer.html(e)) {
|
|
840
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
841
|
+
continue;
|
|
842
|
+
}
|
|
843
|
+
if (r = this.tokenizer.def(e)) {
|
|
844
|
+
e = e.substring(r.raw.length);
|
|
845
|
+
let o = t.at(-1);
|
|
846
|
+
o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`
|
|
847
|
+
`) ? "" : `
|
|
848
|
+
`) + r.raw, o.text += `
|
|
849
|
+
` + r.raw, this.inlineQueue.at(-1).src = o.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = { href: r.href, title: r.title }, t.push(r));
|
|
850
|
+
continue;
|
|
851
|
+
}
|
|
852
|
+
if (r = this.tokenizer.table(e)) {
|
|
853
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
854
|
+
continue;
|
|
855
|
+
}
|
|
856
|
+
if (r = this.tokenizer.lheading(e)) {
|
|
857
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
858
|
+
continue;
|
|
859
|
+
}
|
|
860
|
+
let i = e;
|
|
861
|
+
if (this.options.extensions?.startBlock) {
|
|
862
|
+
let o = 1 / 0, u = e.slice(1), a;
|
|
863
|
+
this.options.extensions.startBlock.forEach((c) => {
|
|
864
|
+
a = c.call({ lexer: this }, u), typeof a == "number" && a >= 0 && (o = Math.min(o, a));
|
|
865
|
+
}), o < 1 / 0 && o >= 0 && (i = e.substring(0, o + 1));
|
|
866
|
+
}
|
|
867
|
+
if (this.state.top && (r = this.tokenizer.paragraph(i))) {
|
|
868
|
+
let o = t.at(-1);
|
|
869
|
+
n && o?.type === "paragraph" ? (o.raw += (o.raw.endsWith(`
|
|
870
|
+
`) ? "" : `
|
|
871
|
+
`) + r.raw, o.text += `
|
|
872
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
|
|
873
|
+
continue;
|
|
874
|
+
}
|
|
875
|
+
if (r = this.tokenizer.text(e)) {
|
|
876
|
+
e = e.substring(r.raw.length);
|
|
877
|
+
let o = t.at(-1);
|
|
878
|
+
o?.type === "text" ? (o.raw += (o.raw.endsWith(`
|
|
879
|
+
`) ? "" : `
|
|
880
|
+
`) + r.raw, o.text += `
|
|
881
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t.push(r);
|
|
882
|
+
continue;
|
|
883
|
+
}
|
|
884
|
+
if (e) {
|
|
885
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
886
|
+
break;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
return this.state.top = true, t;
|
|
890
|
+
}
|
|
891
|
+
inline(e, t = []) {
|
|
892
|
+
return this.inlineQueue.push({ src: e, tokens: t }), t;
|
|
893
|
+
}
|
|
894
|
+
inlineTokens(e, t = []) {
|
|
895
|
+
this.tokenizer.lexer = this;
|
|
896
|
+
let n = e, s = null;
|
|
897
|
+
if (this.tokens.links) {
|
|
898
|
+
let a = Object.keys(this.tokens.links);
|
|
899
|
+
if (a.length > 0)
|
|
900
|
+
for (;(s = this.tokenizer.rules.inline.reflinkSearch.exec(n)) !== null; )
|
|
901
|
+
a.includes(s[0].slice(s[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, s.index) + "[" + "a".repeat(s[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
902
|
+
}
|
|
903
|
+
for (;(s = this.tokenizer.rules.inline.anyPunctuation.exec(n)) !== null; )
|
|
904
|
+
n = n.slice(0, s.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
905
|
+
let r;
|
|
906
|
+
for (;(s = this.tokenizer.rules.inline.blockSkip.exec(n)) !== null; )
|
|
907
|
+
r = s[2] ? s[2].length : 0, n = n.slice(0, s.index + r) + "[" + "a".repeat(s[0].length - r - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
908
|
+
n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
|
|
909
|
+
let i = false, o = "", u = 1 / 0;
|
|
910
|
+
for (;e; ) {
|
|
911
|
+
if (e.length < u)
|
|
912
|
+
u = e.length;
|
|
913
|
+
else {
|
|
914
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
915
|
+
break;
|
|
916
|
+
}
|
|
917
|
+
i || (o = ""), i = false;
|
|
918
|
+
let a;
|
|
919
|
+
if (this.options.extensions?.inline?.some((p) => (a = p.call({ lexer: this }, e, t)) ? (e = e.substring(a.raw.length), t.push(a), true) : false))
|
|
920
|
+
continue;
|
|
921
|
+
if (a = this.tokenizer.escape(e)) {
|
|
922
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
923
|
+
continue;
|
|
924
|
+
}
|
|
925
|
+
if (a = this.tokenizer.tag(e)) {
|
|
926
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
927
|
+
continue;
|
|
928
|
+
}
|
|
929
|
+
if (a = this.tokenizer.link(e)) {
|
|
930
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
931
|
+
continue;
|
|
932
|
+
}
|
|
933
|
+
if (a = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
934
|
+
e = e.substring(a.raw.length);
|
|
935
|
+
let p = t.at(-1);
|
|
936
|
+
a.type === "text" && p?.type === "text" ? (p.raw += a.raw, p.text += a.text) : t.push(a);
|
|
937
|
+
continue;
|
|
938
|
+
}
|
|
939
|
+
if (a = this.tokenizer.emStrong(e, n, o)) {
|
|
940
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
941
|
+
continue;
|
|
942
|
+
}
|
|
943
|
+
if (a = this.tokenizer.codespan(e)) {
|
|
944
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
945
|
+
continue;
|
|
946
|
+
}
|
|
947
|
+
if (a = this.tokenizer.br(e)) {
|
|
948
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
949
|
+
continue;
|
|
950
|
+
}
|
|
951
|
+
if (a = this.tokenizer.del(e, n, o)) {
|
|
952
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
953
|
+
continue;
|
|
954
|
+
}
|
|
955
|
+
if (a = this.tokenizer.autolink(e)) {
|
|
956
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
957
|
+
continue;
|
|
958
|
+
}
|
|
959
|
+
if (!this.state.inLink && (a = this.tokenizer.url(e))) {
|
|
960
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
961
|
+
continue;
|
|
962
|
+
}
|
|
963
|
+
let c = e;
|
|
964
|
+
if (this.options.extensions?.startInline) {
|
|
965
|
+
let p = 1 / 0, k = e.slice(1), h;
|
|
966
|
+
this.options.extensions.startInline.forEach((R) => {
|
|
967
|
+
h = R.call({ lexer: this }, k), typeof h == "number" && h >= 0 && (p = Math.min(p, h));
|
|
968
|
+
}), p < 1 / 0 && p >= 0 && (c = e.substring(0, p + 1));
|
|
969
|
+
}
|
|
970
|
+
if (a = this.tokenizer.inlineText(c)) {
|
|
971
|
+
e = e.substring(a.raw.length), a.raw.slice(-1) !== "_" && (o = a.raw.slice(-1)), i = true;
|
|
972
|
+
let p = t.at(-1);
|
|
973
|
+
p?.type === "text" ? (p.raw += a.raw, p.text += a.text) : t.push(a);
|
|
974
|
+
continue;
|
|
975
|
+
}
|
|
976
|
+
if (e) {
|
|
977
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
978
|
+
break;
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
return t;
|
|
982
|
+
}
|
|
983
|
+
infiniteLoopError(e) {
|
|
984
|
+
let t = "Infinite loop on byte: " + e;
|
|
985
|
+
if (this.options.silent)
|
|
986
|
+
console.error(t);
|
|
987
|
+
else
|
|
988
|
+
throw new Error(t);
|
|
989
|
+
}
|
|
990
|
+
};
|
|
991
|
+
var y = class {
|
|
992
|
+
options;
|
|
993
|
+
parser;
|
|
994
|
+
constructor(e) {
|
|
995
|
+
this.options = e || T;
|
|
996
|
+
}
|
|
997
|
+
space(e) {
|
|
998
|
+
return "";
|
|
999
|
+
}
|
|
1000
|
+
code({ text: e, lang: t, escaped: n }) {
|
|
1001
|
+
let s = (t || "").match(m.notSpaceStart)?.[0], r = e.replace(m.endingNewline, "") + `
|
|
1002
|
+
`;
|
|
1003
|
+
return s ? '<pre><code class="language-' + O(s) + '">' + (n ? r : O(r, true)) + `</code></pre>
|
|
1004
|
+
` : "<pre><code>" + (n ? r : O(r, true)) + `</code></pre>
|
|
1005
|
+
`;
|
|
1006
|
+
}
|
|
1007
|
+
blockquote({ tokens: e }) {
|
|
1008
|
+
return `<blockquote>
|
|
1009
|
+
${this.parser.parse(e)}</blockquote>
|
|
1010
|
+
`;
|
|
1011
|
+
}
|
|
1012
|
+
html({ text: e }) {
|
|
1013
|
+
return e;
|
|
1014
|
+
}
|
|
1015
|
+
def(e) {
|
|
1016
|
+
return "";
|
|
1017
|
+
}
|
|
1018
|
+
heading({ tokens: e, depth: t }) {
|
|
1019
|
+
return `<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
1020
|
+
`;
|
|
1021
|
+
}
|
|
1022
|
+
hr(e) {
|
|
1023
|
+
return `<hr>
|
|
1024
|
+
`;
|
|
1025
|
+
}
|
|
1026
|
+
list(e) {
|
|
1027
|
+
let { ordered: t, start: n } = e, s = "";
|
|
1028
|
+
for (let o = 0;o < e.items.length; o++) {
|
|
1029
|
+
let u = e.items[o];
|
|
1030
|
+
s += this.listitem(u);
|
|
1031
|
+
}
|
|
1032
|
+
let r = t ? "ol" : "ul", i = t && n !== 1 ? ' start="' + n + '"' : "";
|
|
1033
|
+
return "<" + r + i + `>
|
|
1034
|
+
` + s + "</" + r + `>
|
|
1035
|
+
`;
|
|
1036
|
+
}
|
|
1037
|
+
listitem(e) {
|
|
1038
|
+
return `<li>${this.parser.parse(e.tokens)}</li>
|
|
1039
|
+
`;
|
|
1040
|
+
}
|
|
1041
|
+
checkbox({ checked: e }) {
|
|
1042
|
+
return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
|
|
1043
|
+
}
|
|
1044
|
+
paragraph({ tokens: e }) {
|
|
1045
|
+
return `<p>${this.parser.parseInline(e)}</p>
|
|
1046
|
+
`;
|
|
1047
|
+
}
|
|
1048
|
+
table(e) {
|
|
1049
|
+
let t = "", n = "";
|
|
1050
|
+
for (let r = 0;r < e.header.length; r++)
|
|
1051
|
+
n += this.tablecell(e.header[r]);
|
|
1052
|
+
t += this.tablerow({ text: n });
|
|
1053
|
+
let s = "";
|
|
1054
|
+
for (let r = 0;r < e.rows.length; r++) {
|
|
1055
|
+
let i = e.rows[r];
|
|
1056
|
+
n = "";
|
|
1057
|
+
for (let o = 0;o < i.length; o++)
|
|
1058
|
+
n += this.tablecell(i[o]);
|
|
1059
|
+
s += this.tablerow({ text: n });
|
|
1060
|
+
}
|
|
1061
|
+
return s && (s = `<tbody>${s}</tbody>`), `<table>
|
|
1062
|
+
<thead>
|
|
1063
|
+
` + t + `</thead>
|
|
1064
|
+
` + s + `</table>
|
|
1065
|
+
`;
|
|
1066
|
+
}
|
|
1067
|
+
tablerow({ text: e }) {
|
|
1068
|
+
return `<tr>
|
|
1069
|
+
${e}</tr>
|
|
1070
|
+
`;
|
|
1071
|
+
}
|
|
1072
|
+
tablecell(e) {
|
|
1073
|
+
let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
|
|
1074
|
+
return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
|
|
1075
|
+
`;
|
|
1076
|
+
}
|
|
1077
|
+
strong({ tokens: e }) {
|
|
1078
|
+
return `<strong>${this.parser.parseInline(e)}</strong>`;
|
|
1079
|
+
}
|
|
1080
|
+
em({ tokens: e }) {
|
|
1081
|
+
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
1082
|
+
}
|
|
1083
|
+
codespan({ text: e }) {
|
|
1084
|
+
return `<code>${O(e, true)}</code>`;
|
|
1085
|
+
}
|
|
1086
|
+
br(e) {
|
|
1087
|
+
return "<br>";
|
|
1088
|
+
}
|
|
1089
|
+
del({ tokens: e }) {
|
|
1090
|
+
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
1091
|
+
}
|
|
1092
|
+
link({ href: e, title: t, tokens: n }) {
|
|
1093
|
+
let s = this.parser.parseInline(n), r = V(e);
|
|
1094
|
+
if (r === null)
|
|
1095
|
+
return s;
|
|
1096
|
+
e = r;
|
|
1097
|
+
let i = '<a href="' + e + '"';
|
|
1098
|
+
return t && (i += ' title="' + O(t) + '"'), i += ">" + s + "</a>", i;
|
|
1099
|
+
}
|
|
1100
|
+
image({ href: e, title: t, text: n, tokens: s }) {
|
|
1101
|
+
s && (n = this.parser.parseInline(s, this.parser.textRenderer));
|
|
1102
|
+
let r = V(e);
|
|
1103
|
+
if (r === null)
|
|
1104
|
+
return O(n);
|
|
1105
|
+
e = r;
|
|
1106
|
+
let i = `<img src="${e}" alt="${O(n)}"`;
|
|
1107
|
+
return t && (i += ` title="${O(t)}"`), i += ">", i;
|
|
1108
|
+
}
|
|
1109
|
+
text(e) {
|
|
1110
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : ("escaped" in e) && e.escaped ? e.text : O(e.text);
|
|
1111
|
+
}
|
|
1112
|
+
};
|
|
1113
|
+
var L = class {
|
|
1114
|
+
strong({ text: e }) {
|
|
1115
|
+
return e;
|
|
1116
|
+
}
|
|
1117
|
+
em({ text: e }) {
|
|
1118
|
+
return e;
|
|
1119
|
+
}
|
|
1120
|
+
codespan({ text: e }) {
|
|
1121
|
+
return e;
|
|
1122
|
+
}
|
|
1123
|
+
del({ text: e }) {
|
|
1124
|
+
return e;
|
|
1125
|
+
}
|
|
1126
|
+
html({ text: e }) {
|
|
1127
|
+
return e;
|
|
1128
|
+
}
|
|
1129
|
+
text({ text: e }) {
|
|
1130
|
+
return e;
|
|
1131
|
+
}
|
|
1132
|
+
link({ text: e }) {
|
|
1133
|
+
return "" + e;
|
|
1134
|
+
}
|
|
1135
|
+
image({ text: e }) {
|
|
1136
|
+
return "" + e;
|
|
1137
|
+
}
|
|
1138
|
+
br() {
|
|
1139
|
+
return "";
|
|
1140
|
+
}
|
|
1141
|
+
checkbox({ raw: e }) {
|
|
1142
|
+
return e;
|
|
1143
|
+
}
|
|
1144
|
+
};
|
|
1145
|
+
var b = class l2 {
|
|
1146
|
+
options;
|
|
1147
|
+
renderer;
|
|
1148
|
+
textRenderer;
|
|
1149
|
+
constructor(e) {
|
|
1150
|
+
this.options = e || T, this.options.renderer = this.options.renderer || new y, this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new L;
|
|
1151
|
+
}
|
|
1152
|
+
static parse(e, t) {
|
|
1153
|
+
return new l2(t).parse(e);
|
|
1154
|
+
}
|
|
1155
|
+
static parseInline(e, t) {
|
|
1156
|
+
return new l2(t).parseInline(e);
|
|
1157
|
+
}
|
|
1158
|
+
parse(e) {
|
|
1159
|
+
this.renderer.parser = this;
|
|
1160
|
+
let t = "";
|
|
1161
|
+
for (let n = 0;n < e.length; n++) {
|
|
1162
|
+
let s = e[n];
|
|
1163
|
+
if (this.options.extensions?.renderers?.[s.type]) {
|
|
1164
|
+
let i = s, o = this.options.extensions.renderers[i.type].call({ parser: this }, i);
|
|
1165
|
+
if (o !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(i.type)) {
|
|
1166
|
+
t += o || "";
|
|
1167
|
+
continue;
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
let r = s;
|
|
1171
|
+
switch (r.type) {
|
|
1172
|
+
case "space": {
|
|
1173
|
+
t += this.renderer.space(r);
|
|
1174
|
+
break;
|
|
1175
|
+
}
|
|
1176
|
+
case "hr": {
|
|
1177
|
+
t += this.renderer.hr(r);
|
|
1178
|
+
break;
|
|
1179
|
+
}
|
|
1180
|
+
case "heading": {
|
|
1181
|
+
t += this.renderer.heading(r);
|
|
1182
|
+
break;
|
|
1183
|
+
}
|
|
1184
|
+
case "code": {
|
|
1185
|
+
t += this.renderer.code(r);
|
|
1186
|
+
break;
|
|
1187
|
+
}
|
|
1188
|
+
case "table": {
|
|
1189
|
+
t += this.renderer.table(r);
|
|
1190
|
+
break;
|
|
1191
|
+
}
|
|
1192
|
+
case "blockquote": {
|
|
1193
|
+
t += this.renderer.blockquote(r);
|
|
1194
|
+
break;
|
|
1195
|
+
}
|
|
1196
|
+
case "list": {
|
|
1197
|
+
t += this.renderer.list(r);
|
|
1198
|
+
break;
|
|
1199
|
+
}
|
|
1200
|
+
case "checkbox": {
|
|
1201
|
+
t += this.renderer.checkbox(r);
|
|
1202
|
+
break;
|
|
1203
|
+
}
|
|
1204
|
+
case "html": {
|
|
1205
|
+
t += this.renderer.html(r);
|
|
1206
|
+
break;
|
|
1207
|
+
}
|
|
1208
|
+
case "def": {
|
|
1209
|
+
t += this.renderer.def(r);
|
|
1210
|
+
break;
|
|
1211
|
+
}
|
|
1212
|
+
case "paragraph": {
|
|
1213
|
+
t += this.renderer.paragraph(r);
|
|
1214
|
+
break;
|
|
1215
|
+
}
|
|
1216
|
+
case "text": {
|
|
1217
|
+
t += this.renderer.text(r);
|
|
1218
|
+
break;
|
|
1219
|
+
}
|
|
1220
|
+
default: {
|
|
1221
|
+
let i = 'Token with "' + r.type + '" type was not found.';
|
|
1222
|
+
if (this.options.silent)
|
|
1223
|
+
return console.error(i), "";
|
|
1224
|
+
throw new Error(i);
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
return t;
|
|
1229
|
+
}
|
|
1230
|
+
parseInline(e, t = this.renderer) {
|
|
1231
|
+
this.renderer.parser = this;
|
|
1232
|
+
let n = "";
|
|
1233
|
+
for (let s = 0;s < e.length; s++) {
|
|
1234
|
+
let r = e[s];
|
|
1235
|
+
if (this.options.extensions?.renderers?.[r.type]) {
|
|
1236
|
+
let o = this.options.extensions.renderers[r.type].call({ parser: this }, r);
|
|
1237
|
+
if (o !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(r.type)) {
|
|
1238
|
+
n += o || "";
|
|
1239
|
+
continue;
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
let i = r;
|
|
1243
|
+
switch (i.type) {
|
|
1244
|
+
case "escape": {
|
|
1245
|
+
n += t.text(i);
|
|
1246
|
+
break;
|
|
1247
|
+
}
|
|
1248
|
+
case "html": {
|
|
1249
|
+
n += t.html(i);
|
|
1250
|
+
break;
|
|
1251
|
+
}
|
|
1252
|
+
case "link": {
|
|
1253
|
+
n += t.link(i);
|
|
1254
|
+
break;
|
|
1255
|
+
}
|
|
1256
|
+
case "image": {
|
|
1257
|
+
n += t.image(i);
|
|
1258
|
+
break;
|
|
1259
|
+
}
|
|
1260
|
+
case "checkbox": {
|
|
1261
|
+
n += t.checkbox(i);
|
|
1262
|
+
break;
|
|
1263
|
+
}
|
|
1264
|
+
case "strong": {
|
|
1265
|
+
n += t.strong(i);
|
|
1266
|
+
break;
|
|
1267
|
+
}
|
|
1268
|
+
case "em": {
|
|
1269
|
+
n += t.em(i);
|
|
1270
|
+
break;
|
|
1271
|
+
}
|
|
1272
|
+
case "codespan": {
|
|
1273
|
+
n += t.codespan(i);
|
|
1274
|
+
break;
|
|
1275
|
+
}
|
|
1276
|
+
case "br": {
|
|
1277
|
+
n += t.br(i);
|
|
1278
|
+
break;
|
|
1279
|
+
}
|
|
1280
|
+
case "del": {
|
|
1281
|
+
n += t.del(i);
|
|
1282
|
+
break;
|
|
1283
|
+
}
|
|
1284
|
+
case "text": {
|
|
1285
|
+
n += t.text(i);
|
|
1286
|
+
break;
|
|
1287
|
+
}
|
|
1288
|
+
default: {
|
|
1289
|
+
let o = 'Token with "' + i.type + '" type was not found.';
|
|
1290
|
+
if (this.options.silent)
|
|
1291
|
+
return console.error(o), "";
|
|
1292
|
+
throw new Error(o);
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
return n;
|
|
1297
|
+
}
|
|
1298
|
+
};
|
|
1299
|
+
var P = class {
|
|
1300
|
+
options;
|
|
1301
|
+
block;
|
|
1302
|
+
constructor(e) {
|
|
1303
|
+
this.options = e || T;
|
|
1304
|
+
}
|
|
1305
|
+
static passThroughHooks = new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
|
|
1306
|
+
static passThroughHooksRespectAsync = new Set(["preprocess", "postprocess", "processAllTokens"]);
|
|
1307
|
+
preprocess(e) {
|
|
1308
|
+
return e;
|
|
1309
|
+
}
|
|
1310
|
+
postprocess(e) {
|
|
1311
|
+
return e;
|
|
1312
|
+
}
|
|
1313
|
+
processAllTokens(e) {
|
|
1314
|
+
return e;
|
|
1315
|
+
}
|
|
1316
|
+
emStrongMask(e) {
|
|
1317
|
+
return e;
|
|
1318
|
+
}
|
|
1319
|
+
provideLexer(e = this.block) {
|
|
1320
|
+
return e ? x.lex : x.lexInline;
|
|
1321
|
+
}
|
|
1322
|
+
provideParser(e = this.block) {
|
|
1323
|
+
return e ? b.parse : b.parseInline;
|
|
1324
|
+
}
|
|
1325
|
+
};
|
|
1326
|
+
var q = class {
|
|
1327
|
+
defaults = M();
|
|
1328
|
+
options = this.setOptions;
|
|
1329
|
+
parse = this.parseMarkdown(true);
|
|
1330
|
+
parseInline = this.parseMarkdown(false);
|
|
1331
|
+
Parser = b;
|
|
1332
|
+
Renderer = y;
|
|
1333
|
+
TextRenderer = L;
|
|
1334
|
+
Lexer = x;
|
|
1335
|
+
Tokenizer = w;
|
|
1336
|
+
Hooks = P;
|
|
1337
|
+
constructor(...e) {
|
|
1338
|
+
this.use(...e);
|
|
1339
|
+
}
|
|
1340
|
+
walkTokens(e, t) {
|
|
1341
|
+
let n = [];
|
|
1342
|
+
for (let s of e)
|
|
1343
|
+
switch (n = n.concat(t.call(this, s)), s.type) {
|
|
1344
|
+
case "table": {
|
|
1345
|
+
let r = s;
|
|
1346
|
+
for (let i of r.header)
|
|
1347
|
+
n = n.concat(this.walkTokens(i.tokens, t));
|
|
1348
|
+
for (let i of r.rows)
|
|
1349
|
+
for (let o of i)
|
|
1350
|
+
n = n.concat(this.walkTokens(o.tokens, t));
|
|
1351
|
+
break;
|
|
1352
|
+
}
|
|
1353
|
+
case "list": {
|
|
1354
|
+
let r = s;
|
|
1355
|
+
n = n.concat(this.walkTokens(r.items, t));
|
|
1356
|
+
break;
|
|
1357
|
+
}
|
|
1358
|
+
default: {
|
|
1359
|
+
let r = s;
|
|
1360
|
+
this.defaults.extensions?.childTokens?.[r.type] ? this.defaults.extensions.childTokens[r.type].forEach((i) => {
|
|
1361
|
+
let o = r[i].flat(1 / 0);
|
|
1362
|
+
n = n.concat(this.walkTokens(o, t));
|
|
1363
|
+
}) : r.tokens && (n = n.concat(this.walkTokens(r.tokens, t)));
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
return n;
|
|
1367
|
+
}
|
|
1368
|
+
use(...e) {
|
|
1369
|
+
let t = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
1370
|
+
return e.forEach((n) => {
|
|
1371
|
+
let s = { ...n };
|
|
1372
|
+
if (s.async = this.defaults.async || s.async || false, n.extensions && (n.extensions.forEach((r) => {
|
|
1373
|
+
if (!r.name)
|
|
1374
|
+
throw new Error("extension name required");
|
|
1375
|
+
if ("renderer" in r) {
|
|
1376
|
+
let i = t.renderers[r.name];
|
|
1377
|
+
i ? t.renderers[r.name] = function(...o) {
|
|
1378
|
+
let u = r.renderer.apply(this, o);
|
|
1379
|
+
return u === false && (u = i.apply(this, o)), u;
|
|
1380
|
+
} : t.renderers[r.name] = r.renderer;
|
|
1381
|
+
}
|
|
1382
|
+
if ("tokenizer" in r) {
|
|
1383
|
+
if (!r.level || r.level !== "block" && r.level !== "inline")
|
|
1384
|
+
throw new Error("extension level must be 'block' or 'inline'");
|
|
1385
|
+
let i = t[r.level];
|
|
1386
|
+
i ? i.unshift(r.tokenizer) : t[r.level] = [r.tokenizer], r.start && (r.level === "block" ? t.startBlock ? t.startBlock.push(r.start) : t.startBlock = [r.start] : r.level === "inline" && (t.startInline ? t.startInline.push(r.start) : t.startInline = [r.start]));
|
|
1387
|
+
}
|
|
1388
|
+
"childTokens" in r && r.childTokens && (t.childTokens[r.name] = r.childTokens);
|
|
1389
|
+
}), s.extensions = t), n.renderer) {
|
|
1390
|
+
let r = this.defaults.renderer || new y(this.defaults);
|
|
1391
|
+
for (let i in n.renderer) {
|
|
1392
|
+
if (!(i in r))
|
|
1393
|
+
throw new Error(`renderer '${i}' does not exist`);
|
|
1394
|
+
if (["options", "parser"].includes(i))
|
|
1395
|
+
continue;
|
|
1396
|
+
let o = i, u = n.renderer[o], a = r[o];
|
|
1397
|
+
r[o] = (...c) => {
|
|
1398
|
+
let p = u.apply(r, c);
|
|
1399
|
+
return p === false && (p = a.apply(r, c)), p || "";
|
|
1400
|
+
};
|
|
1401
|
+
}
|
|
1402
|
+
s.renderer = r;
|
|
1403
|
+
}
|
|
1404
|
+
if (n.tokenizer) {
|
|
1405
|
+
let r = this.defaults.tokenizer || new w(this.defaults);
|
|
1406
|
+
for (let i in n.tokenizer) {
|
|
1407
|
+
if (!(i in r))
|
|
1408
|
+
throw new Error(`tokenizer '${i}' does not exist`);
|
|
1409
|
+
if (["options", "rules", "lexer"].includes(i))
|
|
1410
|
+
continue;
|
|
1411
|
+
let o = i, u = n.tokenizer[o], a = r[o];
|
|
1412
|
+
r[o] = (...c) => {
|
|
1413
|
+
let p = u.apply(r, c);
|
|
1414
|
+
return p === false && (p = a.apply(r, c)), p;
|
|
1415
|
+
};
|
|
1416
|
+
}
|
|
1417
|
+
s.tokenizer = r;
|
|
1418
|
+
}
|
|
1419
|
+
if (n.hooks) {
|
|
1420
|
+
let r = this.defaults.hooks || new P;
|
|
1421
|
+
for (let i in n.hooks) {
|
|
1422
|
+
if (!(i in r))
|
|
1423
|
+
throw new Error(`hook '${i}' does not exist`);
|
|
1424
|
+
if (["options", "block"].includes(i))
|
|
1425
|
+
continue;
|
|
1426
|
+
let o = i, u = n.hooks[o], a = r[o];
|
|
1427
|
+
P.passThroughHooks.has(i) ? r[o] = (c) => {
|
|
1428
|
+
if (this.defaults.async && P.passThroughHooksRespectAsync.has(i))
|
|
1429
|
+
return (async () => {
|
|
1430
|
+
let k = await u.call(r, c);
|
|
1431
|
+
return a.call(r, k);
|
|
1432
|
+
})();
|
|
1433
|
+
let p = u.call(r, c);
|
|
1434
|
+
return a.call(r, p);
|
|
1435
|
+
} : r[o] = (...c) => {
|
|
1436
|
+
if (this.defaults.async)
|
|
1437
|
+
return (async () => {
|
|
1438
|
+
let k = await u.apply(r, c);
|
|
1439
|
+
return k === false && (k = await a.apply(r, c)), k;
|
|
1440
|
+
})();
|
|
1441
|
+
let p = u.apply(r, c);
|
|
1442
|
+
return p === false && (p = a.apply(r, c)), p;
|
|
1443
|
+
};
|
|
1444
|
+
}
|
|
1445
|
+
s.hooks = r;
|
|
1446
|
+
}
|
|
1447
|
+
if (n.walkTokens) {
|
|
1448
|
+
let r = this.defaults.walkTokens, i = n.walkTokens;
|
|
1449
|
+
s.walkTokens = function(o) {
|
|
1450
|
+
let u = [];
|
|
1451
|
+
return u.push(i.call(this, o)), r && (u = u.concat(r.call(this, o))), u;
|
|
1452
|
+
};
|
|
1453
|
+
}
|
|
1454
|
+
this.defaults = { ...this.defaults, ...s };
|
|
1455
|
+
}), this;
|
|
1456
|
+
}
|
|
1457
|
+
setOptions(e) {
|
|
1458
|
+
return this.defaults = { ...this.defaults, ...e }, this;
|
|
1459
|
+
}
|
|
1460
|
+
lexer(e, t) {
|
|
1461
|
+
return x.lex(e, t ?? this.defaults);
|
|
1462
|
+
}
|
|
1463
|
+
parser(e, t) {
|
|
1464
|
+
return b.parse(e, t ?? this.defaults);
|
|
1465
|
+
}
|
|
1466
|
+
parseMarkdown(e) {
|
|
1467
|
+
return (n, s) => {
|
|
1468
|
+
let r = { ...s }, i = { ...this.defaults, ...r }, o = this.onError(!!i.silent, !!i.async);
|
|
1469
|
+
if (this.defaults.async === true && r.async === false)
|
|
1470
|
+
return o(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."));
|
|
1471
|
+
if (typeof n > "u" || n === null)
|
|
1472
|
+
return o(new Error("marked(): input parameter is undefined or null"));
|
|
1473
|
+
if (typeof n != "string")
|
|
1474
|
+
return o(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
1475
|
+
if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async)
|
|
1476
|
+
return (async () => {
|
|
1477
|
+
let u = i.hooks ? await i.hooks.preprocess(n) : n, c = await (i.hooks ? await i.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(u, i), p = i.hooks ? await i.hooks.processAllTokens(c) : c;
|
|
1478
|
+
i.walkTokens && await Promise.all(this.walkTokens(p, i.walkTokens));
|
|
1479
|
+
let h = await (i.hooks ? await i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(p, i);
|
|
1480
|
+
return i.hooks ? await i.hooks.postprocess(h) : h;
|
|
1481
|
+
})().catch(o);
|
|
1482
|
+
try {
|
|
1483
|
+
i.hooks && (n = i.hooks.preprocess(n));
|
|
1484
|
+
let a = (i.hooks ? i.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(n, i);
|
|
1485
|
+
i.hooks && (a = i.hooks.processAllTokens(a)), i.walkTokens && this.walkTokens(a, i.walkTokens);
|
|
1486
|
+
let p = (i.hooks ? i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(a, i);
|
|
1487
|
+
return i.hooks && (p = i.hooks.postprocess(p)), p;
|
|
1488
|
+
} catch (u) {
|
|
1489
|
+
return o(u);
|
|
1490
|
+
}
|
|
1491
|
+
};
|
|
1492
|
+
}
|
|
1493
|
+
onError(e, t) {
|
|
1494
|
+
return (n) => {
|
|
1495
|
+
if (n.message += `
|
|
1496
|
+
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
1497
|
+
let s = "<p>An error occurred:</p><pre>" + O(n.message + "", true) + "</pre>";
|
|
1498
|
+
return t ? Promise.resolve(s) : s;
|
|
1499
|
+
}
|
|
1500
|
+
if (t)
|
|
1501
|
+
return Promise.reject(n);
|
|
1502
|
+
throw n;
|
|
1503
|
+
};
|
|
1504
|
+
}
|
|
1505
|
+
};
|
|
1506
|
+
var z = new q;
|
|
1507
|
+
function g(l3, e) {
|
|
1508
|
+
return z.parse(l3, e);
|
|
1509
|
+
}
|
|
1510
|
+
g.options = g.setOptions = function(l3) {
|
|
1511
|
+
return z.setOptions(l3), g.defaults = z.defaults, N(g.defaults), g;
|
|
1512
|
+
};
|
|
1513
|
+
g.getDefaults = M;
|
|
1514
|
+
g.defaults = T;
|
|
1515
|
+
g.use = function(...l3) {
|
|
1516
|
+
return z.use(...l3), g.defaults = z.defaults, N(g.defaults), g;
|
|
1517
|
+
};
|
|
1518
|
+
g.walkTokens = function(l3, e) {
|
|
1519
|
+
return z.walkTokens(l3, e);
|
|
1520
|
+
};
|
|
1521
|
+
g.parseInline = z.parseInline;
|
|
1522
|
+
g.Parser = b;
|
|
1523
|
+
g.parser = b.parse;
|
|
1524
|
+
g.Renderer = y;
|
|
1525
|
+
g.TextRenderer = L;
|
|
1526
|
+
g.Lexer = x;
|
|
1527
|
+
g.lexer = x.lex;
|
|
1528
|
+
g.Tokenizer = w;
|
|
1529
|
+
g.Hooks = P;
|
|
1530
|
+
g.parse = g;
|
|
1531
|
+
var Ft = g.options;
|
|
1532
|
+
var Ut = g.setOptions;
|
|
1533
|
+
var Kt = g.use;
|
|
1534
|
+
var Wt = g.walkTokens;
|
|
1535
|
+
var Xt = g.parseInline;
|
|
1536
|
+
var Vt = b.parse;
|
|
1537
|
+
var Yt = x.lex;
|
|
1538
|
+
|
|
206
1539
|
// src/data/config-store.ts
|
|
207
1540
|
import { randomUUID } from "crypto";
|
|
208
1541
|
|
|
@@ -1691,8 +3024,8 @@ function appendQuery(path, query) {
|
|
|
1691
3024
|
if (value === null || value === undefined)
|
|
1692
3025
|
continue;
|
|
1693
3026
|
if (Array.isArray(value)) {
|
|
1694
|
-
for (const
|
|
1695
|
-
params.append(key, String(
|
|
3027
|
+
for (const v2 of value)
|
|
3028
|
+
params.append(key, String(v2));
|
|
1696
3029
|
} else {
|
|
1697
3030
|
params.append(key, String(value));
|
|
1698
3031
|
}
|
|
@@ -1897,9 +3230,9 @@ function entityPath(resource, id) {
|
|
|
1897
3230
|
return `${resourcePath(resource)}/${encodeURIComponent(String(id))}`;
|
|
1898
3231
|
}
|
|
1899
3232
|
function newIdempotencyKey() {
|
|
1900
|
-
const
|
|
1901
|
-
if (
|
|
1902
|
-
return
|
|
3233
|
+
const g2 = globalThis;
|
|
3234
|
+
if (g2.crypto?.randomUUID)
|
|
3235
|
+
return g2.crypto.randomUUID();
|
|
1903
3236
|
return `idmp_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 12)}`;
|
|
1904
3237
|
}
|
|
1905
3238
|
function extractItems(raw) {
|
|
@@ -2184,7 +3517,7 @@ function isNotFoundHttpError2(err) {
|
|
|
2184
3517
|
var localStoreModulePromise = null;
|
|
2185
3518
|
function localStoreModule() {
|
|
2186
3519
|
if (!localStoreModulePromise)
|
|
2187
|
-
localStoreModulePromise = import("./local-
|
|
3520
|
+
localStoreModulePromise = import("./local-7wqy2ywb.js");
|
|
2188
3521
|
return localStoreModulePromise;
|
|
2189
3522
|
}
|
|
2190
3523
|
|
|
@@ -2992,7 +4325,7 @@ __export(exports_external, {
|
|
|
2992
4325
|
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/util.js
|
|
2993
4326
|
var util;
|
|
2994
4327
|
(function(util2) {
|
|
2995
|
-
util2.assertEqual = (
|
|
4328
|
+
util2.assertEqual = (_2) => {};
|
|
2996
4329
|
function assertIs(_arg) {}
|
|
2997
4330
|
util2.assertIs = assertIs;
|
|
2998
4331
|
function assertNever(_x) {
|
|
@@ -3040,7 +4373,7 @@ var util;
|
|
|
3040
4373
|
return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
|
|
3041
4374
|
}
|
|
3042
4375
|
util2.joinValues = joinValues;
|
|
3043
|
-
util2.jsonStringifyReplacer = (
|
|
4376
|
+
util2.jsonStringifyReplacer = (_2, value) => {
|
|
3044
4377
|
if (typeof value === "bigint") {
|
|
3045
4378
|
return value.toString();
|
|
3046
4379
|
}
|
|
@@ -3366,7 +4699,7 @@ var makeIssue = (params) => {
|
|
|
3366
4699
|
};
|
|
3367
4700
|
}
|
|
3368
4701
|
let errorMessage = "";
|
|
3369
|
-
const maps = errorMaps.filter((
|
|
4702
|
+
const maps = errorMaps.filter((m2) => !!m2).slice().reverse();
|
|
3370
4703
|
for (const map of maps) {
|
|
3371
4704
|
errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
|
|
3372
4705
|
}
|
|
@@ -3388,7 +4721,7 @@ function addIssueToContext(ctx, issueData) {
|
|
|
3388
4721
|
ctx.schemaErrorMap,
|
|
3389
4722
|
overrideMap,
|
|
3390
4723
|
overrideMap === en_default ? undefined : en_default
|
|
3391
|
-
].filter((
|
|
4724
|
+
].filter((x2) => !!x2)
|
|
3392
4725
|
});
|
|
3393
4726
|
ctx.common.issues.push(issue);
|
|
3394
4727
|
}
|
|
@@ -3452,10 +4785,10 @@ var INVALID = Object.freeze({
|
|
|
3452
4785
|
});
|
|
3453
4786
|
var DIRTY = (value) => ({ status: "dirty", value });
|
|
3454
4787
|
var OK = (value) => ({ status: "valid", value });
|
|
3455
|
-
var isAborted = (
|
|
3456
|
-
var isDirty = (
|
|
3457
|
-
var isValid = (
|
|
3458
|
-
var isAsync = (
|
|
4788
|
+
var isAborted = (x2) => x2.status === "aborted";
|
|
4789
|
+
var isDirty = (x2) => x2.status === "dirty";
|
|
4790
|
+
var isValid = (x2) => x2.status === "valid";
|
|
4791
|
+
var isAsync = (x2) => typeof Promise !== "undefined" && x2 instanceof Promise;
|
|
3459
4792
|
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
|
|
3460
4793
|
var errorUtil;
|
|
3461
4794
|
(function(errorUtil2) {
|
|
@@ -5695,17 +7028,17 @@ class ZodDiscriminatedUnion extends ZodType {
|
|
|
5695
7028
|
});
|
|
5696
7029
|
}
|
|
5697
7030
|
}
|
|
5698
|
-
function mergeValues(a,
|
|
7031
|
+
function mergeValues(a, b2) {
|
|
5699
7032
|
const aType = getParsedType(a);
|
|
5700
|
-
const bType = getParsedType(
|
|
5701
|
-
if (a ===
|
|
7033
|
+
const bType = getParsedType(b2);
|
|
7034
|
+
if (a === b2) {
|
|
5702
7035
|
return { valid: true, data: a };
|
|
5703
7036
|
} else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
|
|
5704
|
-
const bKeys = util.objectKeys(
|
|
7037
|
+
const bKeys = util.objectKeys(b2);
|
|
5705
7038
|
const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
5706
|
-
const newObj = { ...a, ...
|
|
7039
|
+
const newObj = { ...a, ...b2 };
|
|
5707
7040
|
for (const key of sharedKeys) {
|
|
5708
|
-
const sharedValue = mergeValues(a[key],
|
|
7041
|
+
const sharedValue = mergeValues(a[key], b2[key]);
|
|
5709
7042
|
if (!sharedValue.valid) {
|
|
5710
7043
|
return { valid: false };
|
|
5711
7044
|
}
|
|
@@ -5713,13 +7046,13 @@ function mergeValues(a, b) {
|
|
|
5713
7046
|
}
|
|
5714
7047
|
return { valid: true, data: newObj };
|
|
5715
7048
|
} else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
|
|
5716
|
-
if (a.length !==
|
|
7049
|
+
if (a.length !== b2.length) {
|
|
5717
7050
|
return { valid: false };
|
|
5718
7051
|
}
|
|
5719
7052
|
const newArray = [];
|
|
5720
7053
|
for (let index = 0;index < a.length; index++) {
|
|
5721
7054
|
const itemA = a[index];
|
|
5722
|
-
const itemB =
|
|
7055
|
+
const itemB = b2[index];
|
|
5723
7056
|
const sharedValue = mergeValues(itemA, itemB);
|
|
5724
7057
|
if (!sharedValue.valid) {
|
|
5725
7058
|
return { valid: false };
|
|
@@ -5727,7 +7060,7 @@ function mergeValues(a, b) {
|
|
|
5727
7060
|
newArray.push(sharedValue.data);
|
|
5728
7061
|
}
|
|
5729
7062
|
return { valid: true, data: newArray };
|
|
5730
|
-
} else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +
|
|
7063
|
+
} else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b2) {
|
|
5731
7064
|
return { valid: true, data: a };
|
|
5732
7065
|
} else {
|
|
5733
7066
|
return { valid: false };
|
|
@@ -5825,7 +7158,7 @@ class ZodTuple extends ZodType {
|
|
|
5825
7158
|
if (!schema)
|
|
5826
7159
|
return null;
|
|
5827
7160
|
return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
|
|
5828
|
-
}).filter((
|
|
7161
|
+
}).filter((x2) => !!x2);
|
|
5829
7162
|
if (ctx.common.async) {
|
|
5830
7163
|
return Promise.all(items).then((results) => {
|
|
5831
7164
|
return ParseStatus.mergeArray(status, results);
|
|
@@ -6082,7 +7415,7 @@ class ZodFunction extends ZodType {
|
|
|
6082
7415
|
return makeIssue({
|
|
6083
7416
|
data: args,
|
|
6084
7417
|
path: ctx.path,
|
|
6085
|
-
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((
|
|
7418
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x2) => !!x2),
|
|
6086
7419
|
issueData: {
|
|
6087
7420
|
code: ZodIssueCode.invalid_arguments,
|
|
6088
7421
|
argumentsError: error
|
|
@@ -6093,7 +7426,7 @@ class ZodFunction extends ZodType {
|
|
|
6093
7426
|
return makeIssue({
|
|
6094
7427
|
data: returns,
|
|
6095
7428
|
path: ctx.path,
|
|
6096
|
-
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((
|
|
7429
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x2) => !!x2),
|
|
6097
7430
|
issueData: {
|
|
6098
7431
|
code: ZodIssueCode.invalid_return_type,
|
|
6099
7432
|
returnTypeError: error
|
|
@@ -6103,29 +7436,29 @@ class ZodFunction extends ZodType {
|
|
|
6103
7436
|
const params = { errorMap: ctx.common.contextualErrorMap };
|
|
6104
7437
|
const fn = ctx.data;
|
|
6105
7438
|
if (this._def.returns instanceof ZodPromise) {
|
|
6106
|
-
const
|
|
7439
|
+
const me2 = this;
|
|
6107
7440
|
return OK(async function(...args) {
|
|
6108
7441
|
const error = new ZodError([]);
|
|
6109
|
-
const parsedArgs = await
|
|
7442
|
+
const parsedArgs = await me2._def.args.parseAsync(args, params).catch((e) => {
|
|
6110
7443
|
error.addIssue(makeArgsIssue(args, e));
|
|
6111
7444
|
throw error;
|
|
6112
7445
|
});
|
|
6113
7446
|
const result = await Reflect.apply(fn, this, parsedArgs);
|
|
6114
|
-
const parsedReturns = await
|
|
7447
|
+
const parsedReturns = await me2._def.returns._def.type.parseAsync(result, params).catch((e) => {
|
|
6115
7448
|
error.addIssue(makeReturnsIssue(result, e));
|
|
6116
7449
|
throw error;
|
|
6117
7450
|
});
|
|
6118
7451
|
return parsedReturns;
|
|
6119
7452
|
});
|
|
6120
7453
|
} else {
|
|
6121
|
-
const
|
|
7454
|
+
const me2 = this;
|
|
6122
7455
|
return OK(function(...args) {
|
|
6123
|
-
const parsedArgs =
|
|
7456
|
+
const parsedArgs = me2._def.args.safeParse(args, params);
|
|
6124
7457
|
if (!parsedArgs.success) {
|
|
6125
7458
|
throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
|
|
6126
7459
|
}
|
|
6127
7460
|
const result = Reflect.apply(fn, this, parsedArgs.data);
|
|
6128
|
-
const parsedReturns =
|
|
7461
|
+
const parsedReturns = me2._def.returns.safeParse(result, params);
|
|
6129
7462
|
if (!parsedReturns.success) {
|
|
6130
7463
|
throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
|
|
6131
7464
|
}
|
|
@@ -6699,10 +8032,10 @@ class ZodPipeline extends ZodType {
|
|
|
6699
8032
|
}
|
|
6700
8033
|
}
|
|
6701
8034
|
}
|
|
6702
|
-
static create(a,
|
|
8035
|
+
static create(a, b2) {
|
|
6703
8036
|
return new ZodPipeline({
|
|
6704
8037
|
in: a,
|
|
6705
|
-
out:
|
|
8038
|
+
out: b2,
|
|
6706
8039
|
typeName: ZodFirstPartyTypeKind.ZodPipeline
|
|
6707
8040
|
});
|
|
6708
8041
|
}
|
|
@@ -7168,8 +8501,8 @@ function adoptResolverStoreHome(resolved, env = process.env) {
|
|
|
7168
8501
|
return existsSync(join4(resolved, "instructions.db"));
|
|
7169
8502
|
}
|
|
7170
8503
|
function exactStoreHome(env = process.env) {
|
|
7171
|
-
const
|
|
7172
|
-
return
|
|
8504
|
+
const v2 = env[HASNA_CONFIGS_HOME_ENV];
|
|
8505
|
+
return v2 && v2.trim() ? v2.trim() : undefined;
|
|
7173
8506
|
}
|
|
7174
8507
|
function getConfigsStoreHome(env = process.env) {
|
|
7175
8508
|
const exact = exactStoreHome(env);
|