1357 lines
60 KiB
Plaintext
1357 lines
60 KiB
Plaintext
import {
|
|
__publicField
|
|
} from "/@fs/D:/dndClaw/agent-console/node_modules/.vite/deps/chunk-V6TY7KAL.js?v=cc68ba0b";
|
|
|
|
// node_modules/marked/lib/marked.esm.js
|
|
function I() {
|
|
return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
|
|
}
|
|
var y = I();
|
|
function W(l3) {
|
|
y = l3;
|
|
}
|
|
var A = { exec: () => null };
|
|
function C(l3) {
|
|
let e = [];
|
|
return (t) => {
|
|
let n = Math.max(0, Math.min(3, t - 1)), s = e[n];
|
|
return s || (s = l3(n), e[n] = s), s;
|
|
};
|
|
}
|
|
function h(l3, e = "") {
|
|
let t = typeof l3 == "string" ? l3 : l3.source, n = { replace: (s, r) => {
|
|
let o = typeof r == "string" ? r : r.source;
|
|
return o = o.replace(x.caret, "$1"), t = t.replace(s, o), n;
|
|
}, getRegex: () => new RegExp(t, e) };
|
|
return n;
|
|
}
|
|
var _e = ((l3 = "") => {
|
|
try {
|
|
return !!new RegExp("(?<=1)(?<!1)" + l3);
|
|
} catch {
|
|
return false;
|
|
}
|
|
})();
|
|
var x = { codeRemoveIndent: /^(?: {0,3}\t| {1,4})/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, endingSpaceTabChar: /[ \t]$/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, leadingSpaceTab: /^[ \t]+/, 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, numericCharacterReference: /&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g, 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: (l3) => new RegExp(`^( {0,3}${l3})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: C((l3) => new RegExp(`^ {0,${l3}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)), hrRegex: C((l3) => new RegExp(`^ {0,${l3}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)), fencesBeginRegex: C((l3) => new RegExp(`^ {0,${l3}}(?:\`\`\`|~~~)`)), headingBeginRegex: C((l3) => new RegExp(`^ {0,${l3}}#`)), htmlBeginRegex: C((l3) => new RegExp(`^ {0,${l3}}(?:</?(?:${N})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`, "i")), blockquoteBeginRegex: C((l3) => new RegExp(`^ {0,${l3}}>`)) };
|
|
var $e = /^(?:[ \t]*(?:\n|$))+/;
|
|
var Le = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
|
|
var ze = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
|
|
var G = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
|
var Ae = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
|
var J = / {0,3}(?:[*+-]|\d{1,9}[.)])/;
|
|
var ce = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
|
|
var he = h(ce).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}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
|
|
var Ee = h(ce).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}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
|
|
var V = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/;
|
|
var Me = /^[^\n]+/;
|
|
var Y = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;
|
|
var Ie = h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Y).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
|
|
var Ce = h(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, J).getRegex();
|
|
var N = "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";
|
|
var ee = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
var Be = h("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", ee).replace("tag", N).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
var de = (l3) => h(V).replace("hr", G).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", l3).replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", N).getRegex();
|
|
var De = de(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/);
|
|
var qe = de(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/);
|
|
var ve = h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", qe).getRegex();
|
|
var te = { blockquote: ve, code: Le, def: Ie, fences: ze, heading: Ae, hr: G, html: Be, lheading: he, list: Ce, newline: $e, paragraph: De, table: A, text: Me };
|
|
var le = h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", G).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", N).getRegex();
|
|
var Ze = { ...te, lheading: Ee, table: le, paragraph: h(V).replace("hr", G).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", le).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", N).getRegex() };
|
|
var He = { ...te, html: h(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", ee).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: A, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: h(V).replace("hr", G).replace("heading", ` *#{1,6} *[^
|
|
]`).replace("lheading", he).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() };
|
|
var Ge = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
|
|
var Ne = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
|
|
var ke = /^( {2,}|\\)\n(?!\s*$)[ \t]*/;
|
|
var Qe = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
|
var $ = /[\p{P}\p{S}]/u;
|
|
var B = /[\s\p{P}\p{S}]/u;
|
|
var Q = /[^\s\p{P}\p{S}]/u;
|
|
var je = h(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, B).getRegex();
|
|
var Fe = /[\p{Pi}\p{Ps}"']/u;
|
|
var ge = /(?!~)[\p{P}\p{S}]/u;
|
|
var Ue = /(?!~)[\s\p{P}\p{S}]/u;
|
|
var Ke = /(?:[^\s\p{P}\p{S}]|~)/u;
|
|
var We = h(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", _e ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex();
|
|
var fe = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/;
|
|
var Xe = h(fe, "u").replace(/punct/g, $).getRegex();
|
|
var Je = h(fe, "u").replace(/punct/g, ge).getRegex();
|
|
var Ve = /^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/;
|
|
var Ye = h(Ve, "u").replace(/openQuote/g, Fe).replace(/punct/g, $).getRegex();
|
|
var me = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
|
|
var et = h(me, "gu").replace(/notPunctSpace/g, Q).replace(/punctSpace/g, B).replace(/punct/g, $).getRegex();
|
|
var tt = h(me, "gu").replace(/notPunctSpace/g, Ke).replace(/punctSpace/g, Ue).replace(/punct/g, ge).getRegex();
|
|
var nt = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)";
|
|
var rt = h(nt, "gu").replace(/notPunctSpace/g, Q).replace(/punctSpace/g, B).replace(/punct/g, $).getRegex();
|
|
var st = h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, Q).replace(/punctSpace/g, B).replace(/punct/g, $).getRegex();
|
|
var it = "^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)";
|
|
var ot = h(it, "gu").replace(/notPunctSpace/g, Q).replace(/punctSpace/g, B).replace(/punct/g, $).getRegex();
|
|
var at = h(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, $).getRegex();
|
|
var lt = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)";
|
|
var ut = h(lt, "gu").replace(/notPunctSpace/g, Q).replace(/punctSpace/g, B).replace(/punct/g, $).getRegex();
|
|
var pt = h(/\\(punct)/, "gu").replace(/punct/g, $).getRegex();
|
|
var ct = h(/^<(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();
|
|
var ht = h(ee).replace("(?:-->|$)", "-->").getRegex();
|
|
var dt = h("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", ht).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
|
|
var xe = /\[(?:\\[\s\S]|[^\[\]\\])*\]/;
|
|
var U = h(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets", xe).getRegex();
|
|
var kt = h(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", U).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
|
|
var gt = h(/^!?\[(label)\]\[(ref)\]/).replace("label", U).replace("ref", Y).getRegex();
|
|
var ft = h(/^!?\[(ref)\](?:\[\])?/).replace("ref", Y).getRegex();
|
|
var ue = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/;
|
|
var mt = h(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets", xe).getRegex();
|
|
var xt = h("reflink|nolink(?!\\()", "g").replace("reflink", h(/^!?\[(label)\]\[(ref)\]/).replace("label", mt).replace("ref", ue).getRegex()).replace("nolink", h(/^!?\[(ref)\](?:\[\])?/).replace("ref", ue).getRegex()).getRegex();
|
|
var pe = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;
|
|
var bt = /[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/;
|
|
var Rt = h(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g, bt).getRegex();
|
|
var ne = { _backpedal: A, anyPunctuation: pt, autolink: ct, blockSkip: We, br: ke, code: Ne, del: A, delLDelim: A, delRDelim: A, emStrongLDelim: Xe, emStrongRDelimAst: et, emStrongRDelimUnd: st, escape: Ge, link: kt, nolink: ft, punctuation: je, reflink: gt, reflinkSearch: xt, tag: dt, text: Qe, url: A };
|
|
var Tt = { ...ne, emStrongLDelim: Ye, emStrongRDelimAst: rt, emStrongRDelimUnd: ot, link: h(/^!?\[(label)\]\((.*?)\)/).replace("label", U).getRegex(), reflink: h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", U).getRegex() };
|
|
var X = { ...ne, emStrongRDelimAst: tt, emStrongLDelim: Je, delLDelim: at, delRDelim: ut, url: h(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol", Rt).replace("protocol", pe).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: h(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol", pe).replace(/emailProtocol/g, /(?:mailto|xmpp):/).getRegex() };
|
|
var Ot = { ...X, br: h(ke).replace("{2,}", "*").getRegex(), text: h(X.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
|
|
var j = { normal: te, gfm: Ze, pedantic: He };
|
|
var D = { normal: ne, gfm: X, breaks: Ot, pedantic: Tt };
|
|
var wt = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" };
|
|
var be = (l3) => wt[l3];
|
|
function O(l3, e) {
|
|
if (e) {
|
|
if (x.escapeTest.test(l3)) return l3.replace(x.escapeReplace, be);
|
|
} else if (x.escapeTestNoEncode.test(l3)) return l3.replace(x.escapeReplaceNoEncode, be);
|
|
return l3;
|
|
}
|
|
function Re(l3) {
|
|
return l3.replace(x.numericCharacterReference, (e, t, n) => {
|
|
let s = t === void 0 ? Number.parseInt(n, 16) : Number.parseInt(t, 10);
|
|
return s === 0 || s > 1114111 || s >= 55296 && s <= 57343 ? "�" : String.fromCodePoint(s);
|
|
});
|
|
}
|
|
function re(l3) {
|
|
try {
|
|
l3 = encodeURI(l3).replace(x.percentDecode, "%");
|
|
} catch {
|
|
return null;
|
|
}
|
|
return l3;
|
|
}
|
|
function se(l3, e) {
|
|
var _a2;
|
|
let t = l3.replace(x.findPipe, (r, o, i) => {
|
|
let u = false, a = o;
|
|
for (; --a >= 0 && i[a] === "\\"; ) u = !u;
|
|
return u ? "|" : " |";
|
|
}), n = t.split(x.splitPipe), s = 0;
|
|
if (n[0].trim() || n.shift(), n.length > 0 && !((_a2 = n.at(-1)) == null ? void 0 : _a2.trim()) && n.pop(), e) if (n.length > e) n.splice(e);
|
|
else for (; n.length < e; ) n.push("");
|
|
for (; s < n.length; s++) n[s] = n[s].trim().replace(x.slashPipe, "|");
|
|
return n;
|
|
}
|
|
function L(l3, e, t) {
|
|
let n = l3.length;
|
|
if (n === 0) return "";
|
|
let s = 0;
|
|
for (; s < n; ) {
|
|
let r = l3.charAt(n - s - 1);
|
|
if (r === e && !t) s++;
|
|
else if (r !== e && t) s++;
|
|
else break;
|
|
}
|
|
return l3.slice(0, n - s);
|
|
}
|
|
function ie(l3) {
|
|
let e = l3.split(`
|
|
`), t = e.length - 1;
|
|
for (; t >= 0 && x.blankLine.test(e[t]); ) t--;
|
|
return e.length - t <= 2 ? l3 : e.slice(0, t + 1).join(`
|
|
`);
|
|
}
|
|
function q(l3) {
|
|
return l3.trim().toLowerCase().toUpperCase().toLowerCase();
|
|
}
|
|
function Te(l3, e) {
|
|
if (l3.indexOf(e[1]) === -1) return -1;
|
|
let t = 0;
|
|
for (let n = 0; n < l3.length; n++) if (l3[n] === "\\") n++;
|
|
else if (l3[n] === e[0]) t++;
|
|
else if (l3[n] === e[1] && (t--, t < 0)) return n;
|
|
return t > 0 ? -2 : -1;
|
|
}
|
|
function oe(l3, e = 0) {
|
|
let t = e, n = "";
|
|
for (let s of l3) if (s === " ") {
|
|
let r = 4 - t % 4;
|
|
n += " ".repeat(r), t += r;
|
|
} else n += s, t++;
|
|
return n;
|
|
}
|
|
function Oe(l3, e, t, n, s) {
|
|
let r = e.href, o = e.title || null, i = l3[1].replace(s.other.outputLinkReplace, "$1"), u = l3[0].charAt(0) === "!";
|
|
n.state.inLink = true;
|
|
let a = n.state.linkEmitted, p = n.state.inRawBlock;
|
|
n.state.linkEmitted = false;
|
|
let c = n.inlineTokens(i), d = n.state.linkEmitted;
|
|
if (n.state.linkEmitted = a, n.state.inLink = false, !u) {
|
|
if (d) {
|
|
n.state.inRawBlock = p;
|
|
return;
|
|
}
|
|
n.state.linkEmitted = true;
|
|
}
|
|
return { type: u ? "image" : "link", raw: t, href: r, title: o, text: i, tokens: c };
|
|
}
|
|
function yt(l3, e, t) {
|
|
let n = l3.match(t.other.indentCodeCompensation);
|
|
if (n === null) return e;
|
|
let s = n[1];
|
|
return e.split(`
|
|
`).map((r) => {
|
|
let o = r.match(t.other.beginningSpace);
|
|
if (o === null) return r;
|
|
let [i] = o;
|
|
return r.slice(Math.min(i.length, s.length));
|
|
}).join(`
|
|
`);
|
|
}
|
|
function we(l3, e, t, n) {
|
|
if (!e.includes("<")) return false;
|
|
for (let s = 0; s < e.length; s++) {
|
|
if (e[s] === "\\") {
|
|
s++;
|
|
continue;
|
|
}
|
|
if (e[s] === "`") {
|
|
let i = n.inline.code.exec(e.slice(s));
|
|
if (i) {
|
|
s += i[0].length - 1;
|
|
continue;
|
|
}
|
|
}
|
|
if (e[s] !== "<") continue;
|
|
let r = l3.slice(t + s), o = n.inline.tag.exec(r) || n.inline.autolink.exec(r);
|
|
if (o) {
|
|
if (o[0].length > e.length - s) return true;
|
|
s += o[0].length - 1;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
var P = class {
|
|
constructor(e) {
|
|
__publicField(this, "options");
|
|
__publicField(this, "rules");
|
|
__publicField(this, "lexer");
|
|
this.options = e || y;
|
|
}
|
|
space(e) {
|
|
let t = this.rules.block.newline.exec(e);
|
|
if (t && t[0].length > 0) return { type: "space", raw: t[0] };
|
|
}
|
|
code(e) {
|
|
let t = this.rules.block.code.exec(e);
|
|
if (t) {
|
|
let n = this.options.pedantic ? t[0] : ie(t[0]), s = n.replace(this.rules.other.codeRemoveIndent, "");
|
|
return { type: "code", raw: n, codeBlockStyle: "indented", text: s };
|
|
}
|
|
}
|
|
fences(e) {
|
|
let t = this.rules.block.fences.exec(e);
|
|
if (t) {
|
|
let n = t[0], s = yt(n, t[3] || "", this.rules);
|
|
return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: s };
|
|
}
|
|
}
|
|
heading(e) {
|
|
let t = this.rules.block.heading.exec(e);
|
|
if (t) {
|
|
let n = t[2].trim();
|
|
if (this.rules.other.endingHash.test(n)) {
|
|
let s = L(n, "#");
|
|
(this.options.pedantic || !s || this.rules.other.endingSpaceTabChar.test(s)) && (n = s.trim());
|
|
}
|
|
return { type: "heading", raw: L(t[0], `
|
|
`), depth: t[1].length, text: n, tokens: this.lexer.inline(n) };
|
|
}
|
|
}
|
|
hr(e) {
|
|
let t = this.rules.block.hr.exec(e);
|
|
if (t) return { type: "hr", raw: L(t[0], `
|
|
`) };
|
|
}
|
|
blockquote(e) {
|
|
let t = this.rules.block.blockquote.exec(e);
|
|
if (t) {
|
|
let n = L(t[0], `
|
|
`).split(`
|
|
`), s = "", r = "", o = [];
|
|
for (; n.length > 0; ) {
|
|
let i = false, u = [], a;
|
|
for (a = 0; a < n.length; a++) if (this.rules.other.blockquoteStart.test(n[a])) u.push(n[a]), i = true;
|
|
else if (!i) u.push(n[a]);
|
|
else break;
|
|
n = n.slice(a);
|
|
let p = u.join(`
|
|
`), c = p.replace(this.rules.other.blockquoteSetextReplace, `
|
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
s = s ? `${s}
|
|
${p}` : p, r = r ? `${r}
|
|
${c}` : c;
|
|
let d = this.lexer.state.top;
|
|
if (this.lexer.state.top = true, this.lexer.blockTokens(c, o, true), this.lexer.state.top = d, n.length === 0) break;
|
|
let m = o.at(-1);
|
|
if ((m == null ? void 0 : m.type) === "code") break;
|
|
if ((m == null ? void 0 : m.type) === "blockquote") {
|
|
let b = m, g = n.join(`
|
|
`), w = b.raw + `
|
|
` + g.replace(this.rules.other.blockquoteSetextReplace2, ""), f = this.blockquote(w);
|
|
o[o.length - 1] = f;
|
|
let M = w.substring(f.raw.length).replace(/^\n/, ""), v = M ? M.split(`
|
|
`).length : 0, Z = v ? n.slice(0, -v) : n;
|
|
Z.length > 0 && (s = `${s}
|
|
${Z.join(`
|
|
`)}`), r = r.substring(0, r.length - b.text.length) + f.text;
|
|
break;
|
|
} else if ((m == null ? void 0 : m.type) === "list") {
|
|
let b = m, g = b.raw + `
|
|
` + n.join(`
|
|
`), w = this.list(g);
|
|
o[o.length - 1] = w, s = s.substring(0, s.length - m.raw.length) + w.raw, r = r.substring(0, r.length - b.raw.length) + w.raw, n = g.substring(o.at(-1).raw.length).split(`
|
|
`);
|
|
continue;
|
|
}
|
|
}
|
|
return { type: "blockquote", raw: s, tokens: o, text: r };
|
|
}
|
|
}
|
|
list(e) {
|
|
let t = this.rules.block.list.exec(e);
|
|
if (t) {
|
|
let n = t[1].trim(), s = n.length > 1, r = { type: "list", raw: "", ordered: s, start: s ? +n.slice(0, -1) : "", loose: false, items: [] };
|
|
n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]");
|
|
let o = this.rules.other.listItemRegex(n), i = false;
|
|
for (; e; ) {
|
|
let a = false, p = "", c = "";
|
|
if (!(t = o.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
p = t[0], e = e.substring(p.length);
|
|
let d = t[2].split(`
|
|
`, 1)[0], m = t[1].length, b = this.options.pedantic ? oe(d, m) : d.replace(this.rules.other.leadingSpaceTab, (M) => oe(M, m)), g = e.split(`
|
|
`, 1)[0], w = !b.trim(), f = 0;
|
|
if (this.options.pedantic ? (f = 2, c = b.trimStart()) : w ? f = m + 1 : (f = b.search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, c = b.slice(f), f += m), w && this.rules.other.blankLine.test(g) && (p += g + `
|
|
`, e = e.substring(g.length + 1), a = true), !a) {
|
|
let M = this.rules.other.nextBulletRegex(f), v = this.rules.other.hrRegex(f), Z = this.rules.other.fencesBeginRegex(f), ae = this.rules.other.headingBeginRegex(f), ye = this.rules.other.htmlBeginRegex(f), Pe = this.rules.other.blockquoteBeginRegex(f);
|
|
for (; e; ) {
|
|
let K = e.split(`
|
|
`, 1)[0], H;
|
|
if (g = K, this.options.pedantic ? (g = g.replace(this.rules.other.listReplaceNesting, " "), H = g) : H = g.replace(this.rules.other.leadingSpaceTab, (Se) => Se.replace(this.rules.other.tabCharGlobal, " ")), Z.test(g) || ae.test(g) || ye.test(g) || Pe.test(g) || M.test(g) || v.test(g)) break;
|
|
if (H.search(this.rules.other.nonSpaceChar) >= f || !g.trim()) c += `
|
|
` + H.slice(f);
|
|
else {
|
|
if (w || b.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || Z.test(b) || ae.test(b) || v.test(b)) break;
|
|
c += `
|
|
` + g;
|
|
}
|
|
w = !g.trim(), p += K + `
|
|
`, e = e.substring(K.length + 1), b = H.slice(f);
|
|
}
|
|
}
|
|
r.loose || (i ? r.loose = true : this.rules.other.doubleBlankLine.test(p) && (i = true)), r.items.push({ type: "list_item", raw: p, task: !!this.options.gfm && this.rules.other.listIsTask.test(c), loose: false, text: c, tokens: [] }), r.raw += p;
|
|
}
|
|
let u = r.items.at(-1);
|
|
if (u) u.raw = u.raw.trimEnd(), u.text = u.text.trimEnd();
|
|
else return;
|
|
r.raw = r.raw.trimEnd();
|
|
for (let a of r.items) if (this.lexer.state.top = false, a.tokens = this.lexer.blockTokens(a.text, []), !r.loose) {
|
|
let p = a.tokens.filter((d) => d.type === "space"), c = p.length > 0 && p.some((d) => this.rules.other.anyLine.test(d.raw));
|
|
r.loose = c;
|
|
}
|
|
for (let a of r.items) {
|
|
let p = a.tokens[0];
|
|
if (a.task && ((p == null ? void 0 : p.type) === "text" || (p == null ? void 0 : p.type) === "paragraph")) {
|
|
a.text = a.text.replace(this.rules.other.listReplaceTask, ""), p.raw = p.raw.replace(this.rules.other.listReplaceTask, ""), p.text = p.text.replace(this.rules.other.listReplaceTask, "");
|
|
for (let d = this.lexer.inlineQueue.length - 1; d >= 0; d--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[d].src)) {
|
|
this.lexer.inlineQueue[d].src = this.lexer.inlineQueue[d].src.replace(this.rules.other.listReplaceTask, "");
|
|
break;
|
|
}
|
|
let c = this.rules.other.listTaskCheckbox.exec(a.raw);
|
|
if (c) {
|
|
let d = { type: "checkbox", raw: c[0] + " ", checked: c[0] !== "[ ]" };
|
|
a.checked = d.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 = d.raw + a.tokens[0].raw, a.tokens[0].text = d.raw + a.tokens[0].text, a.tokens[0].tokens.unshift(d)) : a.tokens.unshift({ type: "paragraph", raw: d.raw, text: d.raw, tokens: [d] }) : a.tokens.unshift(d);
|
|
}
|
|
} else a.task && (a.task = false);
|
|
}
|
|
if (r.loose) for (let a of r.items) {
|
|
a.loose = true;
|
|
for (let p of a.tokens) p.type === "text" && (p.type = "paragraph");
|
|
}
|
|
return r;
|
|
}
|
|
}
|
|
html(e) {
|
|
let t = this.rules.block.html.exec(e);
|
|
if (t) {
|
|
let n = ie(t[0]);
|
|
return { type: "html", block: true, raw: n, pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: n };
|
|
}
|
|
}
|
|
def(e) {
|
|
let t = this.rules.block.def.exec(e);
|
|
if (t) {
|
|
let n = q(t[1]).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];
|
|
return { type: "def", tag: n, raw: L(t[0], `
|
|
`), href: s, title: r };
|
|
}
|
|
}
|
|
table(e) {
|
|
var _a2;
|
|
let t = this.rules.block.table.exec(e);
|
|
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
let n = se(t[1]), s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = ((_a2 = t[3]) == null ? void 0 : _a2.trim()) ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
`) : [], o = { type: "table", raw: L(t[0], `
|
|
`), header: [], align: [], rows: [] };
|
|
if (n.length === s.length) {
|
|
for (let i of s) this.rules.other.tableAlignRight.test(i) ? o.align.push("right") : this.rules.other.tableAlignCenter.test(i) ? o.align.push("center") : this.rules.other.tableAlignLeft.test(i) ? o.align.push("left") : o.align.push(null);
|
|
for (let i = 0; i < n.length; i++) o.header.push({ text: n[i], tokens: this.lexer.inline(n[i]), header: true, align: o.align[i] });
|
|
for (let i of r) o.rows.push(se(i, o.header.length).map((u, a) => ({ text: u, tokens: this.lexer.inline(u), header: false, align: o.align[a] })));
|
|
return o;
|
|
}
|
|
}
|
|
lheading(e) {
|
|
let t = this.rules.block.lheading.exec(e);
|
|
if (t) {
|
|
let n = t[1].trim();
|
|
return { type: "heading", raw: L(t[0], `
|
|
`), depth: t[2].charAt(0) === "=" ? 1 : 2, text: n, tokens: this.lexer.inline(n) };
|
|
}
|
|
}
|
|
paragraph(e) {
|
|
let t = this.rules.block.paragraph.exec(e);
|
|
if (t) {
|
|
let n = t[1].charAt(t[1].length - 1) === `
|
|
` ? t[1].slice(0, -1) : t[1];
|
|
return { type: "paragraph", raw: t[0], text: n, tokens: this.lexer.inline(n) };
|
|
}
|
|
}
|
|
text(e) {
|
|
let t = this.rules.block.text.exec(e);
|
|
if (t) return { type: "text", raw: t[0], text: t[0], tokens: this.lexer.inline(t[0]) };
|
|
}
|
|
escape(e) {
|
|
let t = this.rules.inline.escape.exec(e);
|
|
if (t) return { type: "escape", raw: t[0], text: t[1] };
|
|
}
|
|
tag(e) {
|
|
let t = this.rules.inline.tag.exec(e);
|
|
if (t) 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] };
|
|
}
|
|
link(e) {
|
|
let t = this.rules.inline.link.exec(e);
|
|
if (t) {
|
|
let n = t[0].charAt(0) === "!" ? 2 : 1;
|
|
if (!this.options.pedantic && we(e, t[1], n, this.rules)) return;
|
|
let s = t[2].trim();
|
|
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(s)) {
|
|
if (!this.rules.other.endAngleBracket.test(s)) return;
|
|
let i = L(s.slice(0, -1), "\\");
|
|
if ((s.length - i.length) % 2 === 0) return;
|
|
} else {
|
|
let i = Te(t[2], "()");
|
|
if (i === -2) return;
|
|
if (i > -1) {
|
|
let a = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + i;
|
|
t[2] = t[2].substring(0, i), t[0] = t[0].substring(0, a).trim(), t[3] = "";
|
|
}
|
|
}
|
|
let r = t[2], o = "";
|
|
if (this.options.pedantic) {
|
|
let i = this.rules.other.pedanticHrefTitle.exec(r);
|
|
i && (r = i[1], o = i[3]);
|
|
} else o = t[3] ? t[3].slice(1, -1) : "";
|
|
return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(s) ? r = r.slice(1) : r = r.slice(1, -1)), Oe(t, { href: r && r.replace(this.rules.inline.anyPunctuation, "$1"), title: o && o.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
|
|
}
|
|
}
|
|
reflink(e, t) {
|
|
let n;
|
|
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
let s = n[0].charAt(0) === "!" ? 2 : 1;
|
|
if (!this.options.pedantic && we(e, n[1], s, this.rules)) return;
|
|
let r = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), o = t[q(r)];
|
|
if (!o) {
|
|
let i = n[0].charAt(0);
|
|
return { type: "text", raw: i, text: i };
|
|
}
|
|
return Oe(n, o, n[0], this.lexer, this.rules);
|
|
}
|
|
}
|
|
emStrong(e, t, n = "") {
|
|
let s = this.rules.inline.emStrongLDelim.exec(e);
|
|
if (!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
|
|
if (!(s[1] || s[3] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
let o = [...s[0]].length - 1, i, u, a = o, p = 0, c = s[0][0], d = n === c, m = c === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
for (m.lastIndex = 0, t = t.slice(-1 * e.length + o); (s = m.exec(t)) !== null; ) {
|
|
if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i) continue;
|
|
if (u = [...i].length, s[3] || s[4]) {
|
|
a += u;
|
|
continue;
|
|
} else if (s[5] || s[6]) {
|
|
if (o % 3 && !((o + u) % 3)) {
|
|
p += u;
|
|
continue;
|
|
}
|
|
if (d) break;
|
|
}
|
|
if (a -= u, a > 0) continue;
|
|
u = Math.min(u, u + a + p);
|
|
let b = [...s[0]][0].length, g = e.slice(0, o + s.index + b + u);
|
|
if (Math.min(o, u) % 2) {
|
|
let f = g.slice(1, -1);
|
|
return { type: "em", raw: g, text: f, tokens: this.lexer.inlineTokens(f) };
|
|
}
|
|
let w = g.slice(2, -2);
|
|
return { type: "strong", raw: g, text: w, tokens: this.lexer.inlineTokens(w) };
|
|
}
|
|
}
|
|
}
|
|
codespan(e) {
|
|
let t = this.rules.inline.code.exec(e);
|
|
if (t) {
|
|
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);
|
|
return s && r && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: t[0], text: n };
|
|
}
|
|
}
|
|
br(e) {
|
|
let t = this.rules.inline.br.exec(e);
|
|
if (t) return { type: "br", raw: t[0] };
|
|
}
|
|
del(e, t, n = "") {
|
|
let s = this.rules.inline.delLDelim.exec(e);
|
|
if (!s) return;
|
|
if (!(s[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
let o = [...s[0]].length - 1, i, u, a = o, p = this.rules.inline.delRDelim;
|
|
for (p.lastIndex = 0, t = t.slice(-1 * e.length + o); (s = p.exec(t)) !== null; ) {
|
|
if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i || (u = [...i].length, u !== o)) continue;
|
|
if (s[3] || s[4]) {
|
|
a += u;
|
|
continue;
|
|
}
|
|
if (a -= u, a > 0) continue;
|
|
u = Math.min(u, u + a);
|
|
let c = [...s[0]][0].length, d = e.slice(0, o + s.index + c + u), m = d.slice(o, -o);
|
|
return { type: "del", raw: d, text: m, tokens: this.lexer.inlineTokens(m) };
|
|
}
|
|
}
|
|
}
|
|
autolink(e) {
|
|
let t = this.rules.inline.autolink.exec(e);
|
|
if (t) {
|
|
let n, s;
|
|
return t[2] === "@" ? (n = t[1], s = "mailto:" + n) : (n = t[1], s = n), { type: "link", raw: t[0], text: n, href: s, autolink: true, tokens: [{ type: "text", raw: n, text: n }] };
|
|
}
|
|
}
|
|
url(e) {
|
|
var _a2;
|
|
let t;
|
|
if (t = this.rules.inline.url.exec(e)) {
|
|
let n, s;
|
|
if (t[2] === "@") n = t[0], s = "mailto:" + n;
|
|
else {
|
|
let r;
|
|
do
|
|
r = t[0], t[0] = ((_a2 = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : _a2[0]) ?? "";
|
|
while (r !== t[0]);
|
|
n = t[0], t[1] === "www." ? s = "http://" + t[0] : s = t[0];
|
|
}
|
|
return { type: "link", raw: t[0], text: n, href: s, autolink: true, tokens: [{ type: "text", raw: n, text: n }] };
|
|
}
|
|
}
|
|
inlineText(e) {
|
|
let t = this.rules.inline.text.exec(e);
|
|
if (t) {
|
|
let n = this.lexer.state.inRawBlock;
|
|
return { type: "text", raw: t[0], text: n ? t[0] : Re(t[0]), escaped: n };
|
|
}
|
|
}
|
|
};
|
|
var R = class l {
|
|
constructor(e) {
|
|
__publicField(this, "tokens");
|
|
__publicField(this, "options");
|
|
__publicField(this, "state");
|
|
__publicField(this, "inlineQueue");
|
|
__publicField(this, "tokenizer");
|
|
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || y, this.options.tokenizer = this.options.tokenizer || new P(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, linkEmitted: false, top: true };
|
|
let t = { other: x, block: j.normal, inline: D.normal };
|
|
this.options.pedantic ? (t.block = j.pedantic, t.inline = D.pedantic) : this.options.gfm && (t.block = j.gfm, this.options.breaks ? t.inline = D.breaks : t.inline = D.gfm), this.tokenizer.rules = t;
|
|
}
|
|
static get rules() {
|
|
return { block: j, inline: D };
|
|
}
|
|
static lex(e, t) {
|
|
return new l(t).lex(e);
|
|
}
|
|
static lexInline(e, t) {
|
|
return new l(t).inlineTokens(e);
|
|
}
|
|
lex(e) {
|
|
e = e.replace(x.carriageReturn, `
|
|
`), this.blockTokens(e, this.tokens);
|
|
for (let t = 0; t < this.inlineQueue.length; t++) {
|
|
let n = this.inlineQueue[t];
|
|
this.inlineTokens(n.src, n.tokens);
|
|
}
|
|
return this.inlineQueue = [], this.tokens;
|
|
}
|
|
blockTokens(e, t = [], n = false) {
|
|
var _a2, _b, _c;
|
|
this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(x.tabCharGlobal, " ").replace(x.spaceLine, ""));
|
|
let s = 1 / 0;
|
|
for (; e; ) {
|
|
if (e.length < s) s = e.length;
|
|
else {
|
|
this.infiniteLoopError(e.charCodeAt(0));
|
|
break;
|
|
}
|
|
let r;
|
|
if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.block) == null ? void 0 : _b.some((i) => (r = i.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), true) : false)) continue;
|
|
if (r = this.tokenizer.space(e)) {
|
|
e = e.substring(r.raw.length);
|
|
let i = t.at(-1);
|
|
r.raw.length === 1 && i !== void 0 ? i.raw += `
|
|
` : t.push(r);
|
|
continue;
|
|
}
|
|
if (r = this.tokenizer.code(e)) {
|
|
e = e.substring(r.raw.length);
|
|
let i = t.at(-1);
|
|
(i == null ? void 0 : i.type) === "paragraph" || (i == null ? void 0 : i.type) === "text" ? (i.raw += (i.raw.endsWith(`
|
|
`) ? "" : `
|
|
`) + r.raw, i.text += `
|
|
` + r.text, this.inlineQueue.at(-1).src = i.text) : t.push(r);
|
|
continue;
|
|
}
|
|
if (r = this.tokenizer.fences(e)) {
|
|
e = e.substring(r.raw.length), t.push(r);
|
|
continue;
|
|
}
|
|
if (r = this.tokenizer.heading(e)) {
|
|
e = e.substring(r.raw.length), t.push(r);
|
|
continue;
|
|
}
|
|
if (r = this.tokenizer.hr(e)) {
|
|
e = e.substring(r.raw.length), t.push(r);
|
|
continue;
|
|
}
|
|
if (r = this.tokenizer.blockquote(e)) {
|
|
e = e.substring(r.raw.length), t.push(r);
|
|
continue;
|
|
}
|
|
if (r = this.tokenizer.list(e)) {
|
|
e = e.substring(r.raw.length), t.push(r);
|
|
continue;
|
|
}
|
|
if (r = this.tokenizer.html(e)) {
|
|
e = e.substring(r.raw.length), t.push(r);
|
|
continue;
|
|
}
|
|
if (r = this.tokenizer.def(e)) {
|
|
e = e.substring(r.raw.length);
|
|
let i = t.at(-1);
|
|
(i == null ? void 0 : i.type) === "paragraph" || (i == null ? void 0 : i.type) === "text" ? (i.raw += (i.raw.endsWith(`
|
|
`) ? "" : `
|
|
`) + r.raw, i.text += `
|
|
` + r.raw, this.inlineQueue.at(-1).src = i.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = { href: r.href, title: r.title }, t.push(r));
|
|
continue;
|
|
}
|
|
if (r = this.tokenizer.table(e)) {
|
|
e = e.substring(r.raw.length), t.push(r);
|
|
continue;
|
|
}
|
|
if (r = this.tokenizer.lheading(e)) {
|
|
e = e.substring(r.raw.length), t.push(r);
|
|
continue;
|
|
}
|
|
let o = e;
|
|
if ((_c = this.options.extensions) == null ? void 0 : _c.startBlock) {
|
|
let i = 1 / 0, u = e.slice(1), a;
|
|
this.options.extensions.startBlock.forEach((p) => {
|
|
a = p.call({ lexer: this }, u), typeof a == "number" && a >= 0 && (i = Math.min(i, a));
|
|
}), i < 1 / 0 && i >= 0 && (o = e.substring(0, i + 1));
|
|
}
|
|
if (this.state.top && (r = this.tokenizer.paragraph(o))) {
|
|
let i = t.at(-1);
|
|
n && (i == null ? void 0 : i.type) === "paragraph" ? (i.raw += (i.raw.endsWith(`
|
|
`) ? "" : `
|
|
`) + r.raw, i.text += `
|
|
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = i.text) : t.push(r), n = o.length !== e.length, e = e.substring(r.raw.length);
|
|
continue;
|
|
}
|
|
if (r = this.tokenizer.text(e)) {
|
|
e = e.substring(r.raw.length);
|
|
let i = t.at(-1);
|
|
(i == null ? void 0 : i.type) === "text" ? (i.raw += (i.raw.endsWith(`
|
|
`) ? "" : `
|
|
`) + r.raw, i.text += `
|
|
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = i.text) : t.push(r);
|
|
continue;
|
|
}
|
|
if (e) {
|
|
this.infiniteLoopError(e.charCodeAt(0));
|
|
break;
|
|
}
|
|
}
|
|
return this.state.top = true, t;
|
|
}
|
|
inline(e, t = []) {
|
|
return this.inlineQueue.push({ src: e, tokens: t }), t;
|
|
}
|
|
linkInText(e) {
|
|
if (!e.includes("[")) return false;
|
|
let t = this.tokenizer.rules.inline.link;
|
|
for (let n of e.matchAll(this.tokenizer.rules.inline.blockSkip)) if (t.test(n[0]) && e.charAt(n.index - 1) !== "!") return true;
|
|
for (let n of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)) {
|
|
let s = n[0], r = s.lastIndexOf("[");
|
|
if (!(s.charAt(0) === "!" || !Object.hasOwn(this.tokens.links, q(s.slice(r + 1, -1)))) && !(r > 1 && this.linkInText(s.slice(1, r - 1)))) return true;
|
|
}
|
|
return false;
|
|
}
|
|
inlineTokens(e, t = []) {
|
|
var _a2, _b, _c, _d, _e2;
|
|
this.tokenizer.lexer = this;
|
|
let n = e;
|
|
if (this.tokens.links && e.includes("[")) {
|
|
let i = this.tokenizer.rules.inline.reflinkSearch, u = (a) => {
|
|
let p = a.lastIndexOf("[");
|
|
if (!Object.hasOwn(this.tokens.links, q(a.slice(p + 1, -1)))) return a;
|
|
if (p > 1 && a.charAt(0) !== "!") {
|
|
let c = a.slice(1, p - 1);
|
|
if (this.linkInText(c)) return "[" + c.replace(i, u) + "][" + "a".repeat(a.length - p - 2) + "]";
|
|
}
|
|
return "[" + "a".repeat(a.length - 2) + "]";
|
|
};
|
|
n = n.replace(i, u);
|
|
}
|
|
n = n.replace(this.tokenizer.rules.inline.anyPunctuation, (i) => "+".repeat(i.length)), n = n.replace(this.tokenizer.rules.inline.blockSkip, (i, u, a) => {
|
|
let p = a ? a.length : 0;
|
|
return i.slice(0, p) + "[" + "a".repeat(i.length - p - 2) + "]";
|
|
}), n = ((_b = (_a2 = this.options.hooks) == null ? void 0 : _a2.emStrongMask) == null ? void 0 : _b.call({ lexer: this }, n)) ?? n;
|
|
let s = false, r = "", o = 1 / 0;
|
|
for (; e; ) {
|
|
if (e.length < o) o = e.length;
|
|
else {
|
|
this.infiniteLoopError(e.charCodeAt(0));
|
|
break;
|
|
}
|
|
s || (r = ""), s = false;
|
|
let i;
|
|
if ((_d = (_c = this.options.extensions) == null ? void 0 : _c.inline) == null ? void 0 : _d.some((a) => (i = a.call({ lexer: this }, e, t)) ? (e = e.substring(i.raw.length), t.push(i), true) : false)) continue;
|
|
if (i = this.tokenizer.escape(e)) {
|
|
e = e.substring(i.raw.length), t.push(i);
|
|
continue;
|
|
}
|
|
if (i = this.tokenizer.tag(e)) {
|
|
e = e.substring(i.raw.length), t.push(i);
|
|
continue;
|
|
}
|
|
if (i = this.tokenizer.link(e)) {
|
|
e = e.substring(i.raw.length), t.push(i);
|
|
continue;
|
|
}
|
|
if (i = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
e = e.substring(i.raw.length);
|
|
let a = t.at(-1);
|
|
i.type === "text" && (a == null ? void 0 : a.type) === "text" ? (a.raw += i.raw, a.text += i.text) : t.push(i);
|
|
continue;
|
|
}
|
|
if (i = this.tokenizer.emStrong(e, n, r)) {
|
|
e = e.substring(i.raw.length), t.push(i);
|
|
continue;
|
|
}
|
|
if (i = this.tokenizer.codespan(e)) {
|
|
e = e.substring(i.raw.length), t.push(i);
|
|
continue;
|
|
}
|
|
if (i = this.tokenizer.br(e)) {
|
|
e = e.substring(i.raw.length), t.push(i);
|
|
continue;
|
|
}
|
|
if (i = this.tokenizer.del(e, n, r)) {
|
|
e = e.substring(i.raw.length), t.push(i);
|
|
continue;
|
|
}
|
|
if (i = this.tokenizer.autolink(e)) {
|
|
e = e.substring(i.raw.length), t.push(i);
|
|
continue;
|
|
}
|
|
if (!this.state.inLink && (i = this.tokenizer.url(e))) {
|
|
e = e.substring(i.raw.length), t.push(i);
|
|
continue;
|
|
}
|
|
let u = e;
|
|
if ((_e2 = this.options.extensions) == null ? void 0 : _e2.startInline) {
|
|
let a = 1 / 0, p = e.slice(1), c;
|
|
this.options.extensions.startInline.forEach((d) => {
|
|
c = d.call({ lexer: this }, p), typeof c == "number" && c >= 0 && (a = Math.min(a, c));
|
|
}), a < 1 / 0 && a >= 0 && (u = e.substring(0, a + 1));
|
|
}
|
|
if (i = this.tokenizer.inlineText(u)) {
|
|
e = e.substring(i.raw.length), i.raw.slice(-1) !== "_" && (r = i.raw.slice(-1)), s = true;
|
|
let a = t.at(-1);
|
|
(a == null ? void 0 : a.type) === "text" ? (a.raw += i.raw, a.text += i.text) : t.push(i);
|
|
continue;
|
|
}
|
|
if (e) {
|
|
this.infiniteLoopError(e.charCodeAt(0));
|
|
break;
|
|
}
|
|
}
|
|
return t;
|
|
}
|
|
infiniteLoopError(e) {
|
|
let t = "Infinite loop on byte: " + e;
|
|
if (this.options.silent) console.error(t);
|
|
else throw new Error(t);
|
|
}
|
|
};
|
|
var S = class {
|
|
constructor(e) {
|
|
__publicField(this, "options");
|
|
__publicField(this, "parser");
|
|
this.options = e || y;
|
|
}
|
|
space(e) {
|
|
return "";
|
|
}
|
|
code({ text: e, lang: t, escaped: n }) {
|
|
var _a2;
|
|
let s = (_a2 = (t || "").match(x.notSpaceStart)) == null ? void 0 : _a2[0], r = e ? e.replace(x.endingNewline, "") + `
|
|
` : "";
|
|
return s ? '<pre><code class="language-' + O(s) + '">' + (n ? r : O(r, true)) + `</code></pre>
|
|
` : "<pre><code>" + (n ? r : O(r, true)) + `</code></pre>
|
|
`;
|
|
}
|
|
blockquote({ tokens: e }) {
|
|
return `<blockquote>
|
|
${this.parser.parse(e)}</blockquote>
|
|
`;
|
|
}
|
|
html({ text: e }) {
|
|
return e;
|
|
}
|
|
def(e) {
|
|
return "";
|
|
}
|
|
heading({ tokens: e, depth: t }) {
|
|
return `<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
`;
|
|
}
|
|
hr(e) {
|
|
return `<hr>
|
|
`;
|
|
}
|
|
list(e) {
|
|
let t = e.ordered, n = e.start, s = "";
|
|
for (let i = 0; i < e.items.length; i++) {
|
|
let u = e.items[i];
|
|
s += this.listitem(u);
|
|
}
|
|
let r = t ? "ol" : "ul", o = t && n !== 1 ? ' start="' + n + '"' : "";
|
|
return "<" + r + o + `>
|
|
` + s + "</" + r + `>
|
|
`;
|
|
}
|
|
listitem(e) {
|
|
return `<li>${this.parser.parse(e.tokens)}</li>
|
|
`;
|
|
}
|
|
checkbox({ checked: e }) {
|
|
return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
|
|
}
|
|
paragraph({ tokens: e }) {
|
|
return `<p>${this.parser.parseInline(e)}</p>
|
|
`;
|
|
}
|
|
table(e) {
|
|
let t = "", n = "";
|
|
for (let r = 0; r < e.header.length; r++) n += this.tablecell(e.header[r]);
|
|
t += this.tablerow({ text: n });
|
|
let s = "";
|
|
for (let r = 0; r < e.rows.length; r++) {
|
|
let o = e.rows[r];
|
|
n = "";
|
|
for (let i = 0; i < o.length; i++) n += this.tablecell(o[i]);
|
|
s += this.tablerow({ text: n });
|
|
}
|
|
return s && (s = `<tbody>${s}</tbody>`), `<table>
|
|
<thead>
|
|
` + t + `</thead>
|
|
` + s + `</table>
|
|
`;
|
|
}
|
|
tablerow({ text: e }) {
|
|
return `<tr>
|
|
${e}</tr>
|
|
`;
|
|
}
|
|
tablecell(e) {
|
|
let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
|
|
return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
|
|
`;
|
|
}
|
|
strong({ tokens: e }) {
|
|
return `<strong>${this.parser.parseInline(e)}</strong>`;
|
|
}
|
|
em({ tokens: e }) {
|
|
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
}
|
|
codespan({ text: e }) {
|
|
return `<code>${O(e, true)}</code>`;
|
|
}
|
|
br(e) {
|
|
return "<br>";
|
|
}
|
|
del({ tokens: e }) {
|
|
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
}
|
|
link({ href: e, title: t, text: n, tokens: s, autolink: r }) {
|
|
let o = r ? O(n, true) : this.parser.parseInline(s), i = re(e);
|
|
if (i === null) return o;
|
|
e = O(i, r);
|
|
let u = '<a href="' + e + '"';
|
|
return t && (u += ' title="' + O(t) + '"'), u += ">" + o + "</a>", u;
|
|
}
|
|
image({ href: e, title: t, text: n, tokens: s }) {
|
|
s && (n = this.parser.parseInline(s, this.parser.textRenderer));
|
|
let r = re(e);
|
|
if (r === null) return O(n);
|
|
e = r;
|
|
let o = `<img src="${O(e)}" alt="${O(n)}"`;
|
|
return t && (o += ` title="${O(t)}"`), o += ">", o;
|
|
}
|
|
text(e) {
|
|
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : O(e.text);
|
|
}
|
|
};
|
|
var z = class {
|
|
strong({ text: e }) {
|
|
return e;
|
|
}
|
|
em({ text: e }) {
|
|
return e;
|
|
}
|
|
codespan({ text: e }) {
|
|
return e;
|
|
}
|
|
del({ text: e }) {
|
|
return e;
|
|
}
|
|
html({ text: e }) {
|
|
return e;
|
|
}
|
|
text({ text: e }) {
|
|
return e;
|
|
}
|
|
link({ text: e }) {
|
|
return "" + e;
|
|
}
|
|
image({ text: e }) {
|
|
return "" + e;
|
|
}
|
|
br() {
|
|
return "";
|
|
}
|
|
checkbox({ raw: e }) {
|
|
return e;
|
|
}
|
|
};
|
|
var T = class l2 {
|
|
constructor(e) {
|
|
__publicField(this, "options");
|
|
__publicField(this, "renderer");
|
|
__publicField(this, "textRenderer");
|
|
this.options = e || y, this.options.renderer = this.options.renderer || new S(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new z();
|
|
}
|
|
static parse(e, t) {
|
|
return new l2(t).parse(e);
|
|
}
|
|
static parseInline(e, t) {
|
|
return new l2(t).parseInline(e);
|
|
}
|
|
parse(e) {
|
|
var _a2, _b;
|
|
this.renderer.parser = this;
|
|
let t = "";
|
|
for (let n = 0; n < e.length; n++) {
|
|
let s = e[n];
|
|
if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[s.type]) {
|
|
let o = s, i = this.options.extensions.renderers[o.type].call({ parser: this }, o);
|
|
if (i !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "checkbox", "html", "def", "paragraph", "text"].includes(o.type)) {
|
|
t += i || "";
|
|
continue;
|
|
}
|
|
}
|
|
let r = s;
|
|
switch (r.type) {
|
|
case "space": {
|
|
t += this.renderer.space(r);
|
|
break;
|
|
}
|
|
case "hr": {
|
|
t += this.renderer.hr(r);
|
|
break;
|
|
}
|
|
case "heading": {
|
|
t += this.renderer.heading(r);
|
|
break;
|
|
}
|
|
case "code": {
|
|
t += this.renderer.code(r);
|
|
break;
|
|
}
|
|
case "table": {
|
|
t += this.renderer.table(r);
|
|
break;
|
|
}
|
|
case "blockquote": {
|
|
t += this.renderer.blockquote(r);
|
|
break;
|
|
}
|
|
case "list": {
|
|
t += this.renderer.list(r);
|
|
break;
|
|
}
|
|
case "checkbox": {
|
|
t += this.renderer.checkbox(r);
|
|
break;
|
|
}
|
|
case "html": {
|
|
t += this.renderer.html(r);
|
|
break;
|
|
}
|
|
case "def": {
|
|
t += this.renderer.def(r);
|
|
break;
|
|
}
|
|
case "paragraph": {
|
|
t += this.renderer.paragraph(r);
|
|
break;
|
|
}
|
|
case "text": {
|
|
t += this.renderer.text(r);
|
|
break;
|
|
}
|
|
default: {
|
|
let o = 'Token with "' + r.type + '" type was not found.';
|
|
if (this.options.silent) return console.error(o), "";
|
|
throw new Error(o);
|
|
}
|
|
}
|
|
}
|
|
return t;
|
|
}
|
|
parseInline(e, t = this.renderer) {
|
|
var _a2, _b;
|
|
this.renderer.parser = this;
|
|
let n = "";
|
|
for (let s = 0; s < e.length; s++) {
|
|
let r = e[s];
|
|
if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[r.type]) {
|
|
let i = this.options.extensions.renderers[r.type].call({ parser: this }, r);
|
|
if (i !== false || !["escape", "html", "link", "image", "checkbox", "strong", "em", "codespan", "br", "del", "text"].includes(r.type)) {
|
|
n += i || "";
|
|
continue;
|
|
}
|
|
}
|
|
let o = r;
|
|
switch (o.type) {
|
|
case "escape": {
|
|
n += t.text(o);
|
|
break;
|
|
}
|
|
case "html": {
|
|
n += t.html(o);
|
|
break;
|
|
}
|
|
case "link": {
|
|
n += t.link(o);
|
|
break;
|
|
}
|
|
case "image": {
|
|
n += t.image(o);
|
|
break;
|
|
}
|
|
case "checkbox": {
|
|
n += t.checkbox(o);
|
|
break;
|
|
}
|
|
case "strong": {
|
|
n += t.strong(o);
|
|
break;
|
|
}
|
|
case "em": {
|
|
n += t.em(o);
|
|
break;
|
|
}
|
|
case "codespan": {
|
|
n += t.codespan(o);
|
|
break;
|
|
}
|
|
case "br": {
|
|
n += t.br(o);
|
|
break;
|
|
}
|
|
case "del": {
|
|
n += t.del(o);
|
|
break;
|
|
}
|
|
case "text": {
|
|
n += t.text(o);
|
|
break;
|
|
}
|
|
default: {
|
|
let i = 'Token with "' + o.type + '" type was not found.';
|
|
if (this.options.silent) return console.error(i), "";
|
|
throw new Error(i);
|
|
}
|
|
}
|
|
}
|
|
return n;
|
|
}
|
|
};
|
|
var _a;
|
|
var _ = (_a = class {
|
|
constructor(e) {
|
|
__publicField(this, "options");
|
|
__publicField(this, "block");
|
|
this.options = e || y;
|
|
}
|
|
preprocess(e) {
|
|
return e;
|
|
}
|
|
postprocess(e) {
|
|
return e;
|
|
}
|
|
processAllTokens(e) {
|
|
return e;
|
|
}
|
|
emStrongMask(e) {
|
|
return e;
|
|
}
|
|
provideLexer(e = this.block) {
|
|
return e ? R.lex : R.lexInline;
|
|
}
|
|
provideParser(e = this.block) {
|
|
return e ? T.parse : T.parseInline;
|
|
}
|
|
}, __publicField(_a, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), __publicField(_a, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), _a);
|
|
var F = class {
|
|
constructor(...e) {
|
|
__publicField(this, "defaults", I());
|
|
__publicField(this, "options", this.setOptions);
|
|
__publicField(this, "parse", this.parseMarkdown(true));
|
|
__publicField(this, "parseInline", this.parseMarkdown(false));
|
|
__publicField(this, "Parser", T);
|
|
__publicField(this, "Renderer", S);
|
|
__publicField(this, "TextRenderer", z);
|
|
__publicField(this, "Lexer", R);
|
|
__publicField(this, "Tokenizer", P);
|
|
__publicField(this, "Hooks", _);
|
|
this.use(...e);
|
|
}
|
|
walkTokens(e, t) {
|
|
var _a2, _b;
|
|
let n = [];
|
|
for (let s of e) switch (n = n.concat(t.call(this, s)), s.type) {
|
|
case "table": {
|
|
let r = s;
|
|
for (let o of r.header) n = n.concat(this.walkTokens(o.tokens, t));
|
|
for (let o of r.rows) for (let i of o) n = n.concat(this.walkTokens(i.tokens, t));
|
|
break;
|
|
}
|
|
case "list": {
|
|
let r = s;
|
|
n = n.concat(this.walkTokens(r.items, t));
|
|
break;
|
|
}
|
|
default: {
|
|
let r = s;
|
|
((_b = (_a2 = this.defaults.extensions) == null ? void 0 : _a2.childTokens) == null ? void 0 : _b[r.type]) ? this.defaults.extensions.childTokens[r.type].forEach((o) => {
|
|
let i = r[o].flat(1 / 0);
|
|
n = n.concat(this.walkTokens(i, t));
|
|
}) : r.tokens && (n = n.concat(this.walkTokens(r.tokens, t)));
|
|
}
|
|
}
|
|
return n;
|
|
}
|
|
use(...e) {
|
|
let t = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
return e.forEach((n) => {
|
|
let s = { ...n };
|
|
if (s.async = this.defaults.async || s.async || false, n.extensions && (n.extensions.forEach((r) => {
|
|
if (!r.name) throw new Error("extension name required");
|
|
if ("renderer" in r) {
|
|
let o = t.renderers[r.name];
|
|
o ? t.renderers[r.name] = function(...i) {
|
|
let u = r.renderer.apply(this, i);
|
|
return u === false && (u = o.apply(this, i)), u;
|
|
} : t.renderers[r.name] = r.renderer;
|
|
}
|
|
if ("tokenizer" in r) {
|
|
if (!r.level || r.level !== "block" && r.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
let o = t[r.level];
|
|
o ? o.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]));
|
|
}
|
|
"childTokens" in r && r.childTokens && (t.childTokens[r.name] = r.childTokens);
|
|
}), s.extensions = t), n.renderer) {
|
|
let r = this.defaults.renderer || new S(this.defaults);
|
|
for (let o in n.renderer) {
|
|
if (!(o in r)) throw new Error(`renderer '${o}' does not exist`);
|
|
if (["options", "parser"].includes(o)) continue;
|
|
let i = o, u = n.renderer[i], a = r[i];
|
|
r[i] = (...p) => {
|
|
let c = u.apply(r, p);
|
|
return c === false && (c = a.apply(r, p)), c || "";
|
|
};
|
|
}
|
|
s.renderer = r;
|
|
}
|
|
if (n.tokenizer) {
|
|
let r = this.defaults.tokenizer || new P(this.defaults);
|
|
for (let o in n.tokenizer) {
|
|
if (!(o in r)) throw new Error(`tokenizer '${o}' does not exist`);
|
|
if (["options", "rules", "lexer"].includes(o)) continue;
|
|
let i = o, u = n.tokenizer[i], a = r[i];
|
|
r[i] = (...p) => {
|
|
let c = u.apply(r, p);
|
|
return c === false && (c = a.apply(r, p)), c;
|
|
};
|
|
}
|
|
s.tokenizer = r;
|
|
}
|
|
if (n.hooks) {
|
|
let r = this.defaults.hooks || new _();
|
|
for (let o in n.hooks) {
|
|
if (!(o in r)) throw new Error(`hook '${o}' does not exist`);
|
|
if (["options", "block"].includes(o)) continue;
|
|
let i = o, u = n.hooks[i], a = r[i];
|
|
_.passThroughHooks.has(o) ? r[i] = (p) => {
|
|
if (this.defaults.async && _.passThroughHooksRespectAsync.has(o)) return (async () => {
|
|
let d = await u.call(r, p);
|
|
return a.call(r, d);
|
|
})();
|
|
let c = u.call(r, p);
|
|
return a.call(r, c);
|
|
} : r[i] = (...p) => {
|
|
if (this.defaults.async) return (async () => {
|
|
let d = await u.apply(r, p);
|
|
return d === false && (d = await a.apply(r, p)), d;
|
|
})();
|
|
let c = u.apply(r, p);
|
|
return c === false && (c = a.apply(r, p)), c;
|
|
};
|
|
}
|
|
s.hooks = r;
|
|
}
|
|
if (n.walkTokens) {
|
|
let r = this.defaults.walkTokens, o = n.walkTokens;
|
|
s.walkTokens = function(i) {
|
|
let u = [];
|
|
return u.push(o.call(this, i)), r && (u = u.concat(r.call(this, i))), u;
|
|
};
|
|
}
|
|
this.defaults = { ...this.defaults, ...s };
|
|
}), this;
|
|
}
|
|
setOptions(e) {
|
|
return this.defaults = { ...this.defaults, ...e }, this;
|
|
}
|
|
lexer(e, t) {
|
|
return R.lex(e, t ?? this.defaults);
|
|
}
|
|
parser(e, t) {
|
|
return T.parse(e, t ?? this.defaults);
|
|
}
|
|
parseMarkdown(e) {
|
|
return (n, s) => {
|
|
let r = { ...s }, o = { ...this.defaults, ...r }, i = this.onError(!!o.silent, !!o.async);
|
|
if (this.defaults.async === true && r.async === false) 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."));
|
|
if (typeof n > "u" || n === null) return i(new Error("marked(): input parameter is undefined or null"));
|
|
if (typeof n != "string") return i(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
if (o.hooks && (o.hooks.options = o, o.hooks.block = e), o.async) return (async () => {
|
|
let u = o.hooks ? await o.hooks.preprocess(n) : n, p = await (o.hooks ? await o.hooks.provideLexer(e) : e ? R.lex : R.lexInline)(u, o), c = o.hooks ? await o.hooks.processAllTokens(p) : p;
|
|
o.walkTokens && await Promise.all(this.walkTokens(c, o.walkTokens));
|
|
let m = await (o.hooks ? await o.hooks.provideParser(e) : e ? T.parse : T.parseInline)(c, o);
|
|
return o.hooks ? await o.hooks.postprocess(m) : m;
|
|
})().catch(i);
|
|
try {
|
|
o.hooks && (n = o.hooks.preprocess(n));
|
|
let a = (o.hooks ? o.hooks.provideLexer(e) : e ? R.lex : R.lexInline)(n, o);
|
|
o.hooks && (a = o.hooks.processAllTokens(a)), o.walkTokens && this.walkTokens(a, o.walkTokens);
|
|
let c = (o.hooks ? o.hooks.provideParser(e) : e ? T.parse : T.parseInline)(a, o);
|
|
return o.hooks && (c = o.hooks.postprocess(c)), c;
|
|
} catch (u) {
|
|
return i(u);
|
|
}
|
|
};
|
|
}
|
|
onError(e, t) {
|
|
return (n) => {
|
|
if (n.message += `
|
|
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
let s = "<p>An error occurred:</p><pre>" + O(n.message + "", true) + "</pre>";
|
|
return t ? Promise.resolve(s) : s;
|
|
}
|
|
if (t) return Promise.reject(n);
|
|
throw n;
|
|
};
|
|
}
|
|
};
|
|
var E = new F();
|
|
function k(l3, e) {
|
|
return E.parse(l3, e);
|
|
}
|
|
k.options = k.setOptions = function(l3) {
|
|
return E.setOptions(l3), k.defaults = E.defaults, W(k.defaults), k;
|
|
};
|
|
k.getDefaults = I;
|
|
k.defaults = y;
|
|
function Pt(...l3) {
|
|
return E.use(...l3), k.defaults = E.defaults, W(k.defaults), k;
|
|
}
|
|
k.use = Pt;
|
|
k.walkTokens = function(l3, e) {
|
|
return E.walkTokens(l3, e);
|
|
};
|
|
k.parseInline = E.parseInline;
|
|
k.Parser = T;
|
|
k.parser = T.parse;
|
|
k.Renderer = S;
|
|
k.TextRenderer = z;
|
|
k.Lexer = R;
|
|
k.lexer = R.lex;
|
|
k.Tokenizer = P;
|
|
k.Hooks = _;
|
|
k.parse = k;
|
|
var gn = k.options;
|
|
var fn = k.setOptions;
|
|
var mn = k.walkTokens;
|
|
var xn = k.parseInline;
|
|
var bn = k;
|
|
var Rn = T.parse;
|
|
var Tn = R.lex;
|
|
export {
|
|
_ as Hooks,
|
|
R as Lexer,
|
|
F as Marked,
|
|
T as Parser,
|
|
S as Renderer,
|
|
z as TextRenderer,
|
|
P as Tokenizer,
|
|
y as defaults,
|
|
I as getDefaults,
|
|
Tn as lexer,
|
|
k as marked,
|
|
gn as options,
|
|
bn as parse,
|
|
xn as parseInline,
|
|
Rn as parser,
|
|
fn as setOptions,
|
|
Pt as use,
|
|
mn as walkTokens
|
|
};
|
|
//# sourceMappingURL=marked.js.map
|