@shgroup/dsh-serenity-hooks 1.25.7 → 1.25.9

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/lib/index.js CHANGED
@@ -9336,6 +9336,1656 @@ function registerGateway(ctx) {
9336
9336
  });
9337
9337
  }
9338
9338
  //#endregion
9339
+ //#region node_modules/.pnpm/marked@18.0.11/node_modules/marked/lib/marked.esm.js
9340
+ /**
9341
+ * marked v18.0.11 - a markdown parser
9342
+ * Copyright (c) 2018-2026, MarkedJS. (MIT License)
9343
+ * Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
9344
+ * https://github.com/markedjs/marked
9345
+ */
9346
+ /**
9347
+ * DO NOT EDIT THIS FILE
9348
+ * The code in this file is generated from files in ./src/
9349
+ */
9350
+ function A() {
9351
+ return {
9352
+ async: !1,
9353
+ breaks: !1,
9354
+ extensions: null,
9355
+ gfm: !0,
9356
+ hooks: null,
9357
+ pedantic: !1,
9358
+ renderer: null,
9359
+ silent: !1,
9360
+ tokenizer: null,
9361
+ walkTokens: null
9362
+ };
9363
+ }
9364
+ var R = A();
9365
+ function j(l) {
9366
+ R = l;
9367
+ }
9368
+ var z$1 = { exec: () => null };
9369
+ function I(l) {
9370
+ let e = [];
9371
+ return (t) => {
9372
+ let n = Math.max(0, Math.min(3, t - 1)), s = e[n];
9373
+ return s || (s = l(n), e[n] = s), s;
9374
+ };
9375
+ }
9376
+ function k(l, e = "") {
9377
+ let t = typeof l == "string" ? l : l.source, n = {
9378
+ replace: (s, r) => {
9379
+ let i = typeof r == "string" ? r : r.source;
9380
+ return i = i.replace(m.caret, "$1"), t = t.replace(s, i), n;
9381
+ },
9382
+ getRegex: () => new RegExp(t, e)
9383
+ };
9384
+ return n;
9385
+ }
9386
+ var Oe = ((l = "") => {
9387
+ try {
9388
+ return !!new RegExp("(?<=1)(?<!1)" + l);
9389
+ } catch {
9390
+ return !1;
9391
+ }
9392
+ })();
9393
+ var m = {
9394
+ codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
9395
+ outputLinkReplace: /\\([\[\]])/g,
9396
+ indentCodeCompensation: /^(\s+)(?:```)/,
9397
+ beginningSpace: /^\s+/,
9398
+ endingHash: /#$/,
9399
+ startingSpaceChar: /^ /,
9400
+ endingSpaceChar: / $/,
9401
+ nonSpaceChar: /[^ ]/,
9402
+ newLineCharGlobal: /\n/g,
9403
+ tabCharGlobal: /\t/g,
9404
+ multipleSpaceGlobal: /\s+/g,
9405
+ blankLine: /^[ \t]*$/,
9406
+ doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
9407
+ blockquoteStart: /^ {0,3}>/,
9408
+ blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
9409
+ blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
9410
+ listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
9411
+ listIsTask: /^\[[ xX]\] +\S/,
9412
+ listReplaceTask: /^\[[ xX]\] +/,
9413
+ listTaskCheckbox: /\[[ xX]\]/,
9414
+ anyLine: /\n.*\n/,
9415
+ hrefBrackets: /^<(.*)>$/,
9416
+ tableDelimiter: /[:|]/,
9417
+ tableAlignChars: /^\||\| *$/g,
9418
+ tableRowBlankLine: /\n[ \t]*$/,
9419
+ tableAlignRight: /^ *-+: *$/,
9420
+ tableAlignCenter: /^ *:-+: *$/,
9421
+ tableAlignLeft: /^ *:-+ *$/,
9422
+ startATag: /^<a /i,
9423
+ endATag: /^<\/a>/i,
9424
+ startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
9425
+ endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
9426
+ startAngleBracket: /^</,
9427
+ endAngleBracket: />$/,
9428
+ pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
9429
+ unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
9430
+ escapeTest: /[&<>"']/,
9431
+ escapeReplace: /[&<>"']/g,
9432
+ escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
9433
+ escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
9434
+ caret: /(^|[^\[])\^/g,
9435
+ percentDecode: /%25/g,
9436
+ findPipe: /\|/g,
9437
+ splitPipe: / \|/,
9438
+ slashPipe: /\\\|/g,
9439
+ carriageReturn: /\r\n|\r/g,
9440
+ spaceLine: /^ +$/gm,
9441
+ notSpaceStart: /^\S*/,
9442
+ endingNewline: /\n$/,
9443
+ listItemRegex: (l) => new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`),
9444
+ nextBulletRegex: I((l) => new RegExp(`^ {0,${l}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),
9445
+ hrRegex: I((l) => new RegExp(`^ {0,${l}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),
9446
+ fencesBeginRegex: I((l) => new RegExp(`^ {0,${l}}(?:\`\`\`|~~~)`)),
9447
+ headingBeginRegex: I((l) => new RegExp(`^ {0,${l}}#`)),
9448
+ htmlBeginRegex: I((l) => new RegExp(`^ {0,${l}}<(?:[a-z].*>|!--)`, "i")),
9449
+ blockquoteBeginRegex: I((l) => new RegExp(`^ {0,${l}}>`))
9450
+ };
9451
+ var Te = /^(?:[ \t]*(?:\n|$))+/;
9452
+ var we = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
9453
+ var ye = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
9454
+ var q = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
9455
+ var Pe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
9456
+ var U = / {0,3}(?:[*+-]|\d{1,9}[.)])/;
9457
+ var oe = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
9458
+ var ae = k(oe).replace(/bull/g, U).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(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
9459
+ var Se = k(oe).replace(/bull/g, U).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(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
9460
+ var K = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/;
9461
+ var _e = /^[^\n]+/;
9462
+ var W = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;
9463
+ var $e = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", W).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
9464
+ var Le = k(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, U).getRegex();
9465
+ var Q = "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";
9466
+ var X = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
9467
+ var Ee = k("^ {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][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", X).replace("tag", Q).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
9468
+ var le = (l) => k(K).replace("hr", q).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", l).replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Q).getRegex();
9469
+ var ze = le(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/);
9470
+ var Me = le(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/);
9471
+ var J = {
9472
+ blockquote: k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", Me).getRegex(),
9473
+ code: we,
9474
+ def: $e,
9475
+ fences: ye,
9476
+ heading: Pe,
9477
+ hr: q,
9478
+ html: Ee,
9479
+ lheading: ae,
9480
+ list: Le,
9481
+ newline: Te,
9482
+ paragraph: ze,
9483
+ table: z$1,
9484
+ text: _e
9485
+ };
9486
+ var se = k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", q).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", Q).getRegex();
9487
+ var Ie = {
9488
+ ...J,
9489
+ lheading: Se,
9490
+ table: se,
9491
+ paragraph: k(K).replace("hr", q).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", se).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", Q).getRegex()
9492
+ };
9493
+ var Ce = {
9494
+ ...J,
9495
+ html: k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", X).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(),
9496
+ def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
9497
+ heading: /^(#{1,6})(.*)(?:\n+|$)/,
9498
+ fences: z$1,
9499
+ lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
9500
+ paragraph: k(K).replace("hr", q).replace("heading", ` *#{1,6} *[^
9501
+ ]`).replace("lheading", ae).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
9502
+ };
9503
+ var Be = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
9504
+ var De = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
9505
+ var ue = /^( {2,}|\\)\n(?!\s*$)/;
9506
+ var qe = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
9507
+ var _ = /[\p{P}\p{S}]/u;
9508
+ var C = /[\s\p{P}\p{S}]/u;
9509
+ var v = /[^\s\p{P}\p{S}]/u;
9510
+ var ve = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, C).getRegex();
9511
+ var He = /[\p{Pi}\p{Ps}"']/u;
9512
+ var pe = /(?!~)[\p{P}\p{S}]/u;
9513
+ var Ze = /(?!~)[\s\p{P}\p{S}]/u;
9514
+ var Ge = /(?:[^\s\p{P}\p{S}]|~)/u;
9515
+ var Qe = k(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Oe ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex();
9516
+ var ce = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/;
9517
+ var Ne = k(ce, "u").replace(/punct/g, _).getRegex();
9518
+ var je = k(ce, "u").replace(/punct/g, pe).getRegex();
9519
+ var Ue = k(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/, "u").replace(/openQuote/g, He).replace(/punct/g, _).getRegex();
9520
+ var he = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
9521
+ var Ke = k(he, "gu").replace(/notPunctSpace/g, v).replace(/punctSpace/g, C).replace(/punct/g, _).getRegex();
9522
+ var We = k(he, "gu").replace(/notPunctSpace/g, Ge).replace(/punctSpace/g, Ze).replace(/punct/g, pe).getRegex();
9523
+ var Je = k("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, v).replace(/punctSpace/g, C).replace(/punct/g, _).getRegex();
9524
+ var Ve = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, v).replace(/punctSpace/g, C).replace(/punct/g, _).getRegex();
9525
+ var et = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, v).replace(/punctSpace/g, C).replace(/punct/g, _).getRegex();
9526
+ var tt = k(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, _).getRegex();
9527
+ var rt = k("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, v).replace(/punctSpace/g, C).replace(/punct/g, _).getRegex();
9528
+ var st = k(/\\(punct)/, "gu").replace(/punct/g, _).getRegex();
9529
+ var it = k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
9530
+ var ot = k(X).replace("(?:-->|$)", "-->").getRegex();
9531
+ var at = k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", ot).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
9532
+ var G = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/;
9533
+ var lt = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", G).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
9534
+ var ke = k(/^!?\[(label)\]\[(ref)\]/).replace("label", G).replace("ref", W).getRegex();
9535
+ var de = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", W).getRegex();
9536
+ var ut = k("reflink|nolink(?!\\()", "g").replace("reflink", ke).replace("nolink", de).getRegex();
9537
+ var ie = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;
9538
+ var V = {
9539
+ _backpedal: z$1,
9540
+ anyPunctuation: st,
9541
+ autolink: it,
9542
+ blockSkip: Qe,
9543
+ br: ue,
9544
+ code: De,
9545
+ del: z$1,
9546
+ delLDelim: z$1,
9547
+ delRDelim: z$1,
9548
+ emStrongLDelim: Ne,
9549
+ emStrongRDelimAst: Ke,
9550
+ emStrongRDelimUnd: Ve,
9551
+ escape: Be,
9552
+ link: lt,
9553
+ nolink: de,
9554
+ punctuation: ve,
9555
+ reflink: ke,
9556
+ reflinkSearch: ut,
9557
+ tag: at,
9558
+ text: qe,
9559
+ url: z$1
9560
+ };
9561
+ var pt = {
9562
+ ...V,
9563
+ emStrongLDelim: Ue,
9564
+ emStrongRDelimAst: Je,
9565
+ emStrongRDelimUnd: et,
9566
+ link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", G).getRegex(),
9567
+ reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", G).getRegex()
9568
+ };
9569
+ var F = {
9570
+ ...V,
9571
+ emStrongRDelimAst: We,
9572
+ emStrongLDelim: je,
9573
+ delLDelim: tt,
9574
+ delRDelim: rt,
9575
+ url: k(/^((?: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(),
9576
+ _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
9577
+ del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
9578
+ text: k(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ie).getRegex()
9579
+ };
9580
+ var ct = {
9581
+ ...F,
9582
+ br: k(ue).replace("{2,}", "*").getRegex(),
9583
+ text: k(F.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
9584
+ };
9585
+ var H = {
9586
+ normal: J,
9587
+ gfm: Ie,
9588
+ pedantic: Ce
9589
+ };
9590
+ var B = {
9591
+ normal: V,
9592
+ gfm: F,
9593
+ breaks: ct,
9594
+ pedantic: pt
9595
+ };
9596
+ var ht = {
9597
+ "&": "&amp;",
9598
+ "<": "&lt;",
9599
+ ">": "&gt;",
9600
+ "\"": "&quot;",
9601
+ "'": "&#39;"
9602
+ };
9603
+ var ge = (l) => ht[l];
9604
+ function T(l, e) {
9605
+ if (e) {
9606
+ if (m.escapeTest.test(l)) return l.replace(m.escapeReplace, ge);
9607
+ } else if (m.escapeTestNoEncode.test(l)) return l.replace(m.escapeReplaceNoEncode, ge);
9608
+ return l;
9609
+ }
9610
+ function Y(l) {
9611
+ try {
9612
+ l = encodeURI(l).replace(m.percentDecode, "%");
9613
+ } catch {
9614
+ return null;
9615
+ }
9616
+ return l;
9617
+ }
9618
+ function ee(l, e) {
9619
+ let n = l.replace(m.findPipe, (r, i, o) => {
9620
+ let u = !1, a = i;
9621
+ for (; --a >= 0 && o[a] === "\\";) u = !u;
9622
+ return u ? "|" : " |";
9623
+ }).split(m.splitPipe), s = 0;
9624
+ if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e) if (n.length > e) n.splice(e);
9625
+ else for (; n.length < e;) n.push("");
9626
+ for (; s < n.length; s++) n[s] = n[s].trim().replace(m.slashPipe, "|");
9627
+ return n;
9628
+ }
9629
+ function $(l, e, t) {
9630
+ let n = l.length;
9631
+ if (n === 0) return "";
9632
+ let s = 0;
9633
+ for (; s < n;) {
9634
+ let r = l.charAt(n - s - 1);
9635
+ if (r === e && !t) s++;
9636
+ else if (r !== e && t) s++;
9637
+ else break;
9638
+ }
9639
+ return l.slice(0, n - s);
9640
+ }
9641
+ function te(l) {
9642
+ let e = l.split(`
9643
+ `), t = e.length - 1;
9644
+ for (; t >= 0 && m.blankLine.test(e[t]);) t--;
9645
+ return e.length - t <= 2 ? l : e.slice(0, t + 1).join(`
9646
+ `);
9647
+ }
9648
+ function fe(l, e) {
9649
+ if (l.indexOf(e[1]) === -1) return -1;
9650
+ let t = 0;
9651
+ for (let n = 0; n < l.length; n++) if (l[n] === "\\") n++;
9652
+ else if (l[n] === e[0]) t++;
9653
+ else if (l[n] === e[1] && (t--, t < 0)) return n;
9654
+ return t > 0 ? -2 : -1;
9655
+ }
9656
+ function me(l, e = 0) {
9657
+ let t = e, n = "";
9658
+ for (let s of l) if (s === " ") {
9659
+ let r = 4 - t % 4;
9660
+ n += " ".repeat(r), t += r;
9661
+ } else n += s, t++;
9662
+ return n;
9663
+ }
9664
+ function xe(l, e, t, n, s) {
9665
+ let r = e.href, i = e.title || null, o = l[1].replace(s.other.outputLinkReplace, "$1"), u = l[0].charAt(0) === "!";
9666
+ n.state.inLink = !0;
9667
+ let a = n.state.linkEmitted, p = n.state.inRawBlock;
9668
+ n.state.linkEmitted = !1;
9669
+ let c = n.inlineTokens(o), h = n.state.linkEmitted;
9670
+ if (n.state.linkEmitted = a, n.state.inLink = !1, !u) {
9671
+ if (h) {
9672
+ n.state.inRawBlock = p;
9673
+ return;
9674
+ }
9675
+ n.state.linkEmitted = !0;
9676
+ }
9677
+ return {
9678
+ type: u ? "image" : "link",
9679
+ raw: t,
9680
+ href: r,
9681
+ title: i,
9682
+ text: o,
9683
+ tokens: c
9684
+ };
9685
+ }
9686
+ function kt(l, e, t) {
9687
+ let n = l.match(t.other.indentCodeCompensation);
9688
+ if (n === null) return e;
9689
+ let s = n[1];
9690
+ return e.split(`
9691
+ `).map((r) => {
9692
+ let i = r.match(t.other.beginningSpace);
9693
+ if (i === null) return r;
9694
+ let [o] = i;
9695
+ return o.length >= s.length ? r.slice(s.length) : r;
9696
+ }).join(`
9697
+ `);
9698
+ }
9699
+ var y = class {
9700
+ options;
9701
+ rules;
9702
+ lexer;
9703
+ constructor(e) {
9704
+ this.options = e || R;
9705
+ }
9706
+ space(e) {
9707
+ let t = this.rules.block.newline.exec(e);
9708
+ if (t && t[0].length > 0) return {
9709
+ type: "space",
9710
+ raw: t[0]
9711
+ };
9712
+ }
9713
+ code(e) {
9714
+ let t = this.rules.block.code.exec(e);
9715
+ if (t) {
9716
+ let n = this.options.pedantic ? t[0] : te(t[0]);
9717
+ return {
9718
+ type: "code",
9719
+ raw: n,
9720
+ codeBlockStyle: "indented",
9721
+ text: n.replace(this.rules.other.codeRemoveIndent, "")
9722
+ };
9723
+ }
9724
+ }
9725
+ fences(e) {
9726
+ let t = this.rules.block.fences.exec(e);
9727
+ if (t) {
9728
+ let n = t[0], s = kt(n, t[3] || "", this.rules);
9729
+ return {
9730
+ type: "code",
9731
+ raw: n,
9732
+ lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
9733
+ text: s
9734
+ };
9735
+ }
9736
+ }
9737
+ heading(e) {
9738
+ let t = this.rules.block.heading.exec(e);
9739
+ if (t) {
9740
+ let n = t[2].trim();
9741
+ if (this.rules.other.endingHash.test(n)) {
9742
+ let s = $(n, "#");
9743
+ (this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (n = s.trim());
9744
+ }
9745
+ return {
9746
+ type: "heading",
9747
+ raw: $(t[0], `
9748
+ `),
9749
+ depth: t[1].length,
9750
+ text: n,
9751
+ tokens: this.lexer.inline(n)
9752
+ };
9753
+ }
9754
+ }
9755
+ hr(e) {
9756
+ let t = this.rules.block.hr.exec(e);
9757
+ if (t) return {
9758
+ type: "hr",
9759
+ raw: $(t[0], `
9760
+ `)
9761
+ };
9762
+ }
9763
+ blockquote(e) {
9764
+ let t = this.rules.block.blockquote.exec(e);
9765
+ if (t) {
9766
+ let n = $(t[0], `
9767
+ `).split(`
9768
+ `), s = "", r = "", i = [];
9769
+ for (; n.length > 0;) {
9770
+ let o = !1, u = [], a;
9771
+ for (a = 0; a < n.length; a++) if (this.rules.other.blockquoteStart.test(n[a])) u.push(n[a]), o = !0;
9772
+ else if (!o) u.push(n[a]);
9773
+ else break;
9774
+ n = n.slice(a);
9775
+ let p = u.join(`
9776
+ `), c = p.replace(this.rules.other.blockquoteSetextReplace, `
9777
+ $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
9778
+ s = s ? `${s}
9779
+ ${p}` : p, r = r ? `${r}
9780
+ ${c}` : c;
9781
+ let h = this.lexer.state.top;
9782
+ if (this.lexer.state.top = !0, this.lexer.blockTokens(c, i, !0), this.lexer.state.top = h, n.length === 0) break;
9783
+ let d = i.at(-1);
9784
+ if (d?.type === "code") break;
9785
+ if (d?.type === "blockquote") {
9786
+ let O = d, g = n.join(`
9787
+ `), w = O.raw + `
9788
+ ` + g.replace(this.rules.other.blockquoteSetextReplace2, ""), E = this.blockquote(w);
9789
+ i[i.length - 1] = E, s = `${s}
9790
+ ${g}`, r = r.substring(0, r.length - O.text.length) + E.text;
9791
+ break;
9792
+ } else if (d?.type === "list") {
9793
+ let O = d, g = O.raw + `
9794
+ ` + n.join(`
9795
+ `), w = this.list(g);
9796
+ i[i.length - 1] = w, s = s.substring(0, s.length - d.raw.length) + w.raw, r = r.substring(0, r.length - O.raw.length) + w.raw, n = g.substring(i.at(-1).raw.length).split(`
9797
+ `);
9798
+ continue;
9799
+ }
9800
+ }
9801
+ return {
9802
+ type: "blockquote",
9803
+ raw: s,
9804
+ tokens: i,
9805
+ text: r
9806
+ };
9807
+ }
9808
+ }
9809
+ list(e) {
9810
+ let t = this.rules.block.list.exec(e);
9811
+ if (t) {
9812
+ let n = t[1].trim(), s = n.length > 1, r = {
9813
+ type: "list",
9814
+ raw: "",
9815
+ ordered: s,
9816
+ start: s ? +n.slice(0, -1) : "",
9817
+ loose: !1,
9818
+ items: []
9819
+ };
9820
+ n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]");
9821
+ let i = this.rules.other.listItemRegex(n), o = !1;
9822
+ for (; e;) {
9823
+ let a = !1, p = "", c = "";
9824
+ if (!(t = i.exec(e)) || this.rules.block.hr.test(e)) break;
9825
+ p = t[0], e = e.substring(p.length);
9826
+ let h = me(t[2].split(`
9827
+ `, 1)[0], t[1].length), d = e.split(`
9828
+ `, 1)[0], O = !h.trim(), g = 0;
9829
+ if (this.options.pedantic ? (g = 2, c = h.trimStart()) : O ? g = t[1].length + 1 : (g = h.search(this.rules.other.nonSpaceChar), g = g > 4 ? 1 : g, c = h.slice(g), g += t[1].length), O && this.rules.other.blankLine.test(d) && (p += d + `
9830
+ `, e = e.substring(d.length + 1), a = !0), !a) {
9831
+ let w = this.rules.other.nextBulletRegex(g), E = this.rules.other.hrRegex(g), ne = this.rules.other.fencesBeginRegex(g), re = this.rules.other.headingBeginRegex(g), be = this.rules.other.htmlBeginRegex(g), Re = this.rules.other.blockquoteBeginRegex(g);
9832
+ for (; e;) {
9833
+ let N = e.split(`
9834
+ `, 1)[0], D;
9835
+ if (d = N, this.options.pedantic ? (d = d.replace(this.rules.other.listReplaceNesting, " "), D = d) : D = d.replace(this.rules.other.tabCharGlobal, " "), ne.test(d) || re.test(d) || be.test(d) || Re.test(d) || w.test(d) || E.test(d)) break;
9836
+ if (D.search(this.rules.other.nonSpaceChar) >= g || !d.trim()) c += `
9837
+ ` + D.slice(g);
9838
+ else {
9839
+ if (O || h.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || ne.test(h) || re.test(h) || E.test(h)) break;
9840
+ c += `
9841
+ ` + d;
9842
+ }
9843
+ O = !d.trim(), p += N + `
9844
+ `, e = e.substring(N.length + 1), h = D.slice(g);
9845
+ }
9846
+ }
9847
+ r.loose || (o ? r.loose = !0 : this.rules.other.doubleBlankLine.test(p) && (o = !0)), r.items.push({
9848
+ type: "list_item",
9849
+ raw: p,
9850
+ task: !!this.options.gfm && this.rules.other.listIsTask.test(c),
9851
+ loose: !1,
9852
+ text: c,
9853
+ tokens: []
9854
+ }), r.raw += p;
9855
+ }
9856
+ let u = r.items.at(-1);
9857
+ if (u) u.raw = u.raw.trimEnd(), u.text = u.text.trimEnd();
9858
+ else return;
9859
+ r.raw = r.raw.trimEnd();
9860
+ for (let a of r.items) if (this.lexer.state.top = !1, a.tokens = this.lexer.blockTokens(a.text, []), !r.loose) {
9861
+ let p = a.tokens.filter((h) => h.type === "space");
9862
+ r.loose = p.length > 0 && p.some((h) => this.rules.other.anyLine.test(h.raw));
9863
+ }
9864
+ for (let a of r.items) {
9865
+ let p = a.tokens[0];
9866
+ if (a.task && (p?.type === "text" || p?.type === "paragraph")) {
9867
+ 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, "");
9868
+ for (let h = this.lexer.inlineQueue.length - 1; h >= 0; h--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)) {
9869
+ this.lexer.inlineQueue[h].src = this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask, "");
9870
+ break;
9871
+ }
9872
+ let c = this.rules.other.listTaskCheckbox.exec(a.raw);
9873
+ if (c) {
9874
+ let h = {
9875
+ type: "checkbox",
9876
+ raw: c[0] + " ",
9877
+ checked: c[0] !== "[ ]"
9878
+ };
9879
+ a.checked = h.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 = h.raw + a.tokens[0].raw, a.tokens[0].text = h.raw + a.tokens[0].text, a.tokens[0].tokens.unshift(h)) : a.tokens.unshift({
9880
+ type: "paragraph",
9881
+ raw: h.raw,
9882
+ text: h.raw,
9883
+ tokens: [h]
9884
+ }) : a.tokens.unshift(h);
9885
+ }
9886
+ } else a.task && (a.task = !1);
9887
+ }
9888
+ if (r.loose) for (let a of r.items) {
9889
+ a.loose = !0;
9890
+ for (let p of a.tokens) p.type === "text" && (p.type = "paragraph");
9891
+ }
9892
+ return r;
9893
+ }
9894
+ }
9895
+ html(e) {
9896
+ let t = this.rules.block.html.exec(e);
9897
+ if (t) {
9898
+ let n = te(t[0]);
9899
+ return {
9900
+ type: "html",
9901
+ block: !0,
9902
+ raw: n,
9903
+ pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
9904
+ text: n
9905
+ };
9906
+ }
9907
+ }
9908
+ def(e) {
9909
+ let t = this.rules.block.def.exec(e);
9910
+ if (t) {
9911
+ 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];
9912
+ return {
9913
+ type: "def",
9914
+ tag: n,
9915
+ raw: $(t[0], `
9916
+ `),
9917
+ href: s,
9918
+ title: r
9919
+ };
9920
+ }
9921
+ }
9922
+ table(e) {
9923
+ let t = this.rules.block.table.exec(e);
9924
+ if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
9925
+ let n = ee(t[1]), s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
9926
+ `) : [], i = {
9927
+ type: "table",
9928
+ raw: $(t[0], `
9929
+ `),
9930
+ header: [],
9931
+ align: [],
9932
+ rows: []
9933
+ };
9934
+ if (n.length === s.length) {
9935
+ for (let o of s) 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);
9936
+ for (let o = 0; o < n.length; o++) i.header.push({
9937
+ text: n[o],
9938
+ tokens: this.lexer.inline(n[o]),
9939
+ header: !0,
9940
+ align: i.align[o]
9941
+ });
9942
+ for (let o of r) i.rows.push(ee(o, i.header.length).map((u, a) => ({
9943
+ text: u,
9944
+ tokens: this.lexer.inline(u),
9945
+ header: !1,
9946
+ align: i.align[a]
9947
+ })));
9948
+ return i;
9949
+ }
9950
+ }
9951
+ lheading(e) {
9952
+ let t = this.rules.block.lheading.exec(e);
9953
+ if (t) {
9954
+ let n = t[1].trim();
9955
+ return {
9956
+ type: "heading",
9957
+ raw: $(t[0], `
9958
+ `),
9959
+ depth: t[2].charAt(0) === "=" ? 1 : 2,
9960
+ text: n,
9961
+ tokens: this.lexer.inline(n)
9962
+ };
9963
+ }
9964
+ }
9965
+ paragraph(e) {
9966
+ let t = this.rules.block.paragraph.exec(e);
9967
+ if (t) {
9968
+ let n = t[1].charAt(t[1].length - 1) === `
9969
+ ` ? t[1].slice(0, -1) : t[1];
9970
+ return {
9971
+ type: "paragraph",
9972
+ raw: t[0],
9973
+ text: n,
9974
+ tokens: this.lexer.inline(n)
9975
+ };
9976
+ }
9977
+ }
9978
+ text(e) {
9979
+ let t = this.rules.block.text.exec(e);
9980
+ if (t) return {
9981
+ type: "text",
9982
+ raw: t[0],
9983
+ text: t[0],
9984
+ tokens: this.lexer.inline(t[0])
9985
+ };
9986
+ }
9987
+ escape(e) {
9988
+ let t = this.rules.inline.escape.exec(e);
9989
+ if (t) return {
9990
+ type: "escape",
9991
+ raw: t[0],
9992
+ text: t[1]
9993
+ };
9994
+ }
9995
+ tag(e) {
9996
+ let t = this.rules.inline.tag.exec(e);
9997
+ if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
9998
+ type: "html",
9999
+ raw: t[0],
10000
+ inLink: this.lexer.state.inLink,
10001
+ inRawBlock: this.lexer.state.inRawBlock,
10002
+ block: !1,
10003
+ text: t[0]
10004
+ };
10005
+ }
10006
+ link(e) {
10007
+ let t = this.rules.inline.link.exec(e);
10008
+ if (t) {
10009
+ let n = t[2].trim();
10010
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
10011
+ if (!this.rules.other.endAngleBracket.test(n)) return;
10012
+ let i = $(n.slice(0, -1), "\\");
10013
+ if ((n.length - i.length) % 2 === 0) return;
10014
+ } else {
10015
+ let i = fe(t[2], "()");
10016
+ if (i === -2) return;
10017
+ if (i > -1) {
10018
+ let u = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + i;
10019
+ t[2] = t[2].substring(0, i), t[0] = t[0].substring(0, u).trim(), t[3] = "";
10020
+ }
10021
+ }
10022
+ let s = t[2], r = "";
10023
+ if (this.options.pedantic) {
10024
+ let i = this.rules.other.pedanticHrefTitle.exec(s);
10025
+ i && (s = i[1], r = i[3]);
10026
+ } else r = t[3] ? t[3].slice(1, -1) : "";
10027
+ 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, {
10028
+ href: s && s.replace(this.rules.inline.anyPunctuation, "$1"),
10029
+ title: r && r.replace(this.rules.inline.anyPunctuation, "$1")
10030
+ }, t[0], this.lexer, this.rules);
10031
+ }
10032
+ }
10033
+ reflink(e, t) {
10034
+ let n;
10035
+ if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
10036
+ let r = t[(n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " ").toLowerCase()];
10037
+ if (!r) {
10038
+ let i = n[0].charAt(0);
10039
+ return {
10040
+ type: "text",
10041
+ raw: i,
10042
+ text: i
10043
+ };
10044
+ }
10045
+ return xe(n, r, n[0], this.lexer, this.rules);
10046
+ }
10047
+ }
10048
+ emStrong(e, t, n = "") {
10049
+ let s = this.rules.inline.emStrongLDelim.exec(e);
10050
+ if (!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
10051
+ if (!(s[1] || s[3] || "") || !n || this.rules.inline.punctuation.exec(n)) {
10052
+ let i = [...s[0]].length - 1, o, u, a = i, p = 0, c = s[0][0], h = n === c, d = c === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
10053
+ for (d.lastIndex = 0, t = t.slice(-1 * e.length + i); (s = d.exec(t)) !== null;) {
10054
+ if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o) continue;
10055
+ if (u = [...o].length, s[3] || s[4]) {
10056
+ a += u;
10057
+ continue;
10058
+ } else if (s[5] || s[6]) {
10059
+ if (i % 3 && !((i + u) % 3)) {
10060
+ p += u;
10061
+ continue;
10062
+ }
10063
+ if (h) break;
10064
+ }
10065
+ if (a -= u, a > 0) continue;
10066
+ u = Math.min(u, u + a + p);
10067
+ let O = [...s[0]][0].length, g = e.slice(0, i + s.index + O + u);
10068
+ if (Math.min(i, u) % 2) {
10069
+ let E = g.slice(1, -1);
10070
+ return {
10071
+ type: "em",
10072
+ raw: g,
10073
+ text: E,
10074
+ tokens: this.lexer.inlineTokens(E)
10075
+ };
10076
+ }
10077
+ let w = g.slice(2, -2);
10078
+ return {
10079
+ type: "strong",
10080
+ raw: g,
10081
+ text: w,
10082
+ tokens: this.lexer.inlineTokens(w)
10083
+ };
10084
+ }
10085
+ }
10086
+ }
10087
+ codespan(e) {
10088
+ let t = this.rules.inline.code.exec(e);
10089
+ if (t) {
10090
+ 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);
10091
+ return s && r && (n = n.substring(1, n.length - 1)), {
10092
+ type: "codespan",
10093
+ raw: t[0],
10094
+ text: n
10095
+ };
10096
+ }
10097
+ }
10098
+ br(e) {
10099
+ let t = this.rules.inline.br.exec(e);
10100
+ if (t) return {
10101
+ type: "br",
10102
+ raw: t[0]
10103
+ };
10104
+ }
10105
+ del(e, t, n = "") {
10106
+ let s = this.rules.inline.delLDelim.exec(e);
10107
+ if (!s) return;
10108
+ if (!(s[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
10109
+ let i = [...s[0]].length - 1, o, u, a = i, p = this.rules.inline.delRDelim;
10110
+ for (p.lastIndex = 0, t = t.slice(-1 * e.length + i); (s = p.exec(t)) !== null;) {
10111
+ if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o || (u = [...o].length, u !== i)) continue;
10112
+ if (s[3] || s[4]) {
10113
+ a += u;
10114
+ continue;
10115
+ }
10116
+ if (a -= u, a > 0) continue;
10117
+ u = Math.min(u, u + a);
10118
+ let c = [...s[0]][0].length, h = e.slice(0, i + s.index + c + u), d = h.slice(i, -i);
10119
+ return {
10120
+ type: "del",
10121
+ raw: h,
10122
+ text: d,
10123
+ tokens: this.lexer.inlineTokens(d)
10124
+ };
10125
+ }
10126
+ }
10127
+ }
10128
+ autolink(e) {
10129
+ let t = this.rules.inline.autolink.exec(e);
10130
+ if (t) {
10131
+ let n, s;
10132
+ return t[2] === "@" ? (n = t[1], s = "mailto:" + n) : (n = t[1], s = n), {
10133
+ type: "link",
10134
+ raw: t[0],
10135
+ text: n,
10136
+ href: s,
10137
+ tokens: [{
10138
+ type: "text",
10139
+ raw: n,
10140
+ text: n
10141
+ }]
10142
+ };
10143
+ }
10144
+ }
10145
+ url(e) {
10146
+ let t;
10147
+ if (t = this.rules.inline.url.exec(e)) {
10148
+ let n, s;
10149
+ if (t[2] === "@") n = t[0], s = "mailto:" + n;
10150
+ else {
10151
+ let r;
10152
+ do
10153
+ r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
10154
+ while (r !== t[0]);
10155
+ n = t[0], t[1] === "www." ? s = "http://" + t[0] : s = t[0];
10156
+ }
10157
+ return {
10158
+ type: "link",
10159
+ raw: t[0],
10160
+ text: n,
10161
+ href: s,
10162
+ tokens: [{
10163
+ type: "text",
10164
+ raw: n,
10165
+ text: n
10166
+ }]
10167
+ };
10168
+ }
10169
+ }
10170
+ inlineText(e) {
10171
+ let t = this.rules.inline.text.exec(e);
10172
+ if (t) {
10173
+ let n = this.lexer.state.inRawBlock;
10174
+ return {
10175
+ type: "text",
10176
+ raw: t[0],
10177
+ text: t[0],
10178
+ escaped: n
10179
+ };
10180
+ }
10181
+ }
10182
+ };
10183
+ var x = class l {
10184
+ tokens;
10185
+ options;
10186
+ state;
10187
+ inlineQueue;
10188
+ tokenizer;
10189
+ constructor(e) {
10190
+ this.tokens = [], this.tokens.links = Object.create(null), this.options = e || R, this.options.tokenizer = this.options.tokenizer || new y(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
10191
+ inLink: !1,
10192
+ inRawBlock: !1,
10193
+ linkEmitted: !1,
10194
+ top: !0
10195
+ };
10196
+ let t = {
10197
+ other: m,
10198
+ block: H.normal,
10199
+ inline: B.normal
10200
+ };
10201
+ this.options.pedantic ? (t.block = H.pedantic, t.inline = B.pedantic) : this.options.gfm && (t.block = H.gfm, this.options.breaks ? t.inline = B.breaks : t.inline = B.gfm), this.tokenizer.rules = t;
10202
+ }
10203
+ static get rules() {
10204
+ return {
10205
+ block: H,
10206
+ inline: B
10207
+ };
10208
+ }
10209
+ static lex(e, t) {
10210
+ return new l(t).lex(e);
10211
+ }
10212
+ static lexInline(e, t) {
10213
+ return new l(t).inlineTokens(e);
10214
+ }
10215
+ lex(e) {
10216
+ e = e.replace(m.carriageReturn, `
10217
+ `), this.blockTokens(e, this.tokens);
10218
+ for (let t = 0; t < this.inlineQueue.length; t++) {
10219
+ let n = this.inlineQueue[t];
10220
+ this.inlineTokens(n.src, n.tokens);
10221
+ }
10222
+ return this.inlineQueue = [], this.tokens;
10223
+ }
10224
+ blockTokens(e, t = [], n = !1) {
10225
+ this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, ""));
10226
+ let s = 1 / 0;
10227
+ for (; e;) {
10228
+ if (e.length < s) s = e.length;
10229
+ else {
10230
+ this.infiniteLoopError(e.charCodeAt(0));
10231
+ break;
10232
+ }
10233
+ let r;
10234
+ if (this.options.extensions?.block?.some((o) => (r = o.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1)) continue;
10235
+ if (r = this.tokenizer.space(e)) {
10236
+ e = e.substring(r.raw.length);
10237
+ let o = t.at(-1);
10238
+ r.raw.length === 1 && o !== void 0 ? o.raw += `
10239
+ ` : t.push(r);
10240
+ continue;
10241
+ }
10242
+ if (r = this.tokenizer.code(e)) {
10243
+ e = e.substring(r.raw.length);
10244
+ let o = t.at(-1);
10245
+ o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`
10246
+ `) ? "" : `
10247
+ `) + r.raw, o.text += `
10248
+ ` + r.text, this.inlineQueue.at(-1).src = o.text) : t.push(r);
10249
+ continue;
10250
+ }
10251
+ if (r = this.tokenizer.fences(e)) {
10252
+ e = e.substring(r.raw.length), t.push(r);
10253
+ continue;
10254
+ }
10255
+ if (r = this.tokenizer.heading(e)) {
10256
+ e = e.substring(r.raw.length), t.push(r);
10257
+ continue;
10258
+ }
10259
+ if (r = this.tokenizer.hr(e)) {
10260
+ e = e.substring(r.raw.length), t.push(r);
10261
+ continue;
10262
+ }
10263
+ if (r = this.tokenizer.blockquote(e)) {
10264
+ e = e.substring(r.raw.length), t.push(r);
10265
+ continue;
10266
+ }
10267
+ if (r = this.tokenizer.list(e)) {
10268
+ e = e.substring(r.raw.length), t.push(r);
10269
+ continue;
10270
+ }
10271
+ if (r = this.tokenizer.html(e)) {
10272
+ e = e.substring(r.raw.length), t.push(r);
10273
+ continue;
10274
+ }
10275
+ if (r = this.tokenizer.def(e)) {
10276
+ e = e.substring(r.raw.length);
10277
+ let o = t.at(-1);
10278
+ o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`
10279
+ `) ? "" : `
10280
+ `) + r.raw, o.text += `
10281
+ ` + r.raw, this.inlineQueue.at(-1).src = o.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = {
10282
+ href: r.href,
10283
+ title: r.title
10284
+ }, t.push(r));
10285
+ continue;
10286
+ }
10287
+ if (r = this.tokenizer.table(e)) {
10288
+ e = e.substring(r.raw.length), t.push(r);
10289
+ continue;
10290
+ }
10291
+ if (r = this.tokenizer.lheading(e)) {
10292
+ e = e.substring(r.raw.length), t.push(r);
10293
+ continue;
10294
+ }
10295
+ let i = e;
10296
+ if (this.options.extensions?.startBlock) {
10297
+ let o = 1 / 0, u = e.slice(1), a;
10298
+ this.options.extensions.startBlock.forEach((p) => {
10299
+ a = p.call({ lexer: this }, u), typeof a == "number" && a >= 0 && (o = Math.min(o, a));
10300
+ }), o < 1 / 0 && o >= 0 && (i = e.substring(0, o + 1));
10301
+ }
10302
+ if (this.state.top && (r = this.tokenizer.paragraph(i))) {
10303
+ let o = t.at(-1);
10304
+ n && o?.type === "paragraph" ? (o.raw += (o.raw.endsWith(`
10305
+ `) ? "" : `
10306
+ `) + r.raw, o.text += `
10307
+ ` + 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);
10308
+ continue;
10309
+ }
10310
+ if (r = this.tokenizer.text(e)) {
10311
+ e = e.substring(r.raw.length);
10312
+ let o = t.at(-1);
10313
+ o?.type === "text" ? (o.raw += (o.raw.endsWith(`
10314
+ `) ? "" : `
10315
+ `) + r.raw, o.text += `
10316
+ ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t.push(r);
10317
+ continue;
10318
+ }
10319
+ if (e) {
10320
+ this.infiniteLoopError(e.charCodeAt(0));
10321
+ break;
10322
+ }
10323
+ }
10324
+ return this.state.top = !0, t;
10325
+ }
10326
+ inline(e, t = []) {
10327
+ return this.inlineQueue.push({
10328
+ src: e,
10329
+ tokens: t
10330
+ }), t;
10331
+ }
10332
+ linkInText(e) {
10333
+ if (!e.includes("[")) return !1;
10334
+ let t = this.tokenizer.rules.inline.link;
10335
+ for (let n of e.matchAll(this.tokenizer.rules.inline.blockSkip)) if (t.test(n[0]) && e.charAt(n.index - 1) !== "!") return !0;
10336
+ for (let n of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)) {
10337
+ let s = n[0], r = s.lastIndexOf("[");
10338
+ if (!(s.charAt(0) === "!" || !Object.hasOwn(this.tokens.links, s.slice(r + 1, -1))) && !(r > 1 && this.linkInText(s.slice(1, r - 1)))) return !0;
10339
+ }
10340
+ return !1;
10341
+ }
10342
+ inlineTokens(e, t = []) {
10343
+ this.tokenizer.lexer = this;
10344
+ let n = e;
10345
+ if (this.tokens.links && e.includes("[")) {
10346
+ let o = this.tokenizer.rules.inline.reflinkSearch, u = (a) => {
10347
+ let p = a.lastIndexOf("[");
10348
+ if (!Object.hasOwn(this.tokens.links, a.slice(p + 1, -1))) return a;
10349
+ if (p > 1 && a.charAt(0) !== "!") {
10350
+ let c = a.slice(1, p - 1);
10351
+ if (this.linkInText(c)) return "[" + c.replace(o, u) + "][" + "a".repeat(a.length - p - 2) + "]";
10352
+ }
10353
+ return "[" + "a".repeat(a.length - 2) + "]";
10354
+ };
10355
+ n = n.replace(o, u);
10356
+ }
10357
+ n = n.replace(this.tokenizer.rules.inline.anyPunctuation, (o) => "+".repeat(o.length)), n = n.replace(this.tokenizer.rules.inline.blockSkip, (o, u, a) => {
10358
+ let p = a ? a.length : 0;
10359
+ return o.slice(0, p) + "[" + "a".repeat(o.length - p - 2) + "]";
10360
+ }), n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
10361
+ let s = !1, r = "", i = 1 / 0;
10362
+ for (; e;) {
10363
+ if (e.length < i) i = e.length;
10364
+ else {
10365
+ this.infiniteLoopError(e.charCodeAt(0));
10366
+ break;
10367
+ }
10368
+ s || (r = ""), s = !1;
10369
+ let o;
10370
+ if (this.options.extensions?.inline?.some((a) => (o = a.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), !0) : !1)) continue;
10371
+ if (o = this.tokenizer.escape(e)) {
10372
+ e = e.substring(o.raw.length), t.push(o);
10373
+ continue;
10374
+ }
10375
+ if (o = this.tokenizer.tag(e)) {
10376
+ e = e.substring(o.raw.length), t.push(o);
10377
+ continue;
10378
+ }
10379
+ if (o = this.tokenizer.link(e)) {
10380
+ e = e.substring(o.raw.length), t.push(o);
10381
+ continue;
10382
+ }
10383
+ if (o = this.tokenizer.reflink(e, this.tokens.links)) {
10384
+ e = e.substring(o.raw.length);
10385
+ let a = t.at(-1);
10386
+ o.type === "text" && a?.type === "text" ? (a.raw += o.raw, a.text += o.text) : t.push(o);
10387
+ continue;
10388
+ }
10389
+ if (o = this.tokenizer.emStrong(e, n, r)) {
10390
+ e = e.substring(o.raw.length), t.push(o);
10391
+ continue;
10392
+ }
10393
+ if (o = this.tokenizer.codespan(e)) {
10394
+ e = e.substring(o.raw.length), t.push(o);
10395
+ continue;
10396
+ }
10397
+ if (o = this.tokenizer.br(e)) {
10398
+ e = e.substring(o.raw.length), t.push(o);
10399
+ continue;
10400
+ }
10401
+ if (o = this.tokenizer.del(e, n, r)) {
10402
+ e = e.substring(o.raw.length), t.push(o);
10403
+ continue;
10404
+ }
10405
+ if (o = this.tokenizer.autolink(e)) {
10406
+ e = e.substring(o.raw.length), t.push(o);
10407
+ continue;
10408
+ }
10409
+ if (!this.state.inLink && (o = this.tokenizer.url(e))) {
10410
+ e = e.substring(o.raw.length), t.push(o);
10411
+ continue;
10412
+ }
10413
+ let u = e;
10414
+ if (this.options.extensions?.startInline) {
10415
+ let a = 1 / 0, p = e.slice(1), c;
10416
+ this.options.extensions.startInline.forEach((h) => {
10417
+ c = h.call({ lexer: this }, p), typeof c == "number" && c >= 0 && (a = Math.min(a, c));
10418
+ }), a < 1 / 0 && a >= 0 && (u = e.substring(0, a + 1));
10419
+ }
10420
+ if (o = this.tokenizer.inlineText(u)) {
10421
+ e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (r = o.raw.slice(-1)), s = !0;
10422
+ let a = t.at(-1);
10423
+ a?.type === "text" ? (a.raw += o.raw, a.text += o.text) : t.push(o);
10424
+ continue;
10425
+ }
10426
+ if (e) {
10427
+ this.infiniteLoopError(e.charCodeAt(0));
10428
+ break;
10429
+ }
10430
+ }
10431
+ return t;
10432
+ }
10433
+ infiniteLoopError(e) {
10434
+ let t = "Infinite loop on byte: " + e;
10435
+ if (this.options.silent) console.error(t);
10436
+ else throw new Error(t);
10437
+ }
10438
+ };
10439
+ var P = class {
10440
+ options;
10441
+ parser;
10442
+ constructor(e) {
10443
+ this.options = e || R;
10444
+ }
10445
+ space(e) {
10446
+ return "";
10447
+ }
10448
+ code({ text: e, lang: t, escaped: n }) {
10449
+ let s = (t || "").match(m.notSpaceStart)?.[0], r = e.replace(m.endingNewline, "") + `
10450
+ `;
10451
+ return s ? "<pre><code class=\"language-" + T(s) + "\">" + (n ? r : T(r, !0)) + `</code></pre>
10452
+ ` : "<pre><code>" + (n ? r : T(r, !0)) + `</code></pre>
10453
+ `;
10454
+ }
10455
+ blockquote({ tokens: e }) {
10456
+ return `<blockquote>
10457
+ ${this.parser.parse(e)}</blockquote>
10458
+ `;
10459
+ }
10460
+ html({ text: e }) {
10461
+ return e;
10462
+ }
10463
+ def(e) {
10464
+ return "";
10465
+ }
10466
+ heading({ tokens: e, depth: t }) {
10467
+ return `<h${t}>${this.parser.parseInline(e)}</h${t}>
10468
+ `;
10469
+ }
10470
+ hr(e) {
10471
+ return `<hr>
10472
+ `;
10473
+ }
10474
+ list(e) {
10475
+ let t = e.ordered, n = e.start, s = "";
10476
+ for (let o = 0; o < e.items.length; o++) {
10477
+ let u = e.items[o];
10478
+ s += this.listitem(u);
10479
+ }
10480
+ let r = t ? "ol" : "ul", i = t && n !== 1 ? " start=\"" + n + "\"" : "";
10481
+ return "<" + r + i + `>
10482
+ ` + s + "</" + r + `>
10483
+ `;
10484
+ }
10485
+ listitem(e) {
10486
+ return `<li>${this.parser.parse(e.tokens)}</li>
10487
+ `;
10488
+ }
10489
+ checkbox({ checked: e }) {
10490
+ return "<input " + (e ? "checked=\"\" " : "") + "disabled=\"\" type=\"checkbox\"> ";
10491
+ }
10492
+ paragraph({ tokens: e }) {
10493
+ return `<p>${this.parser.parseInline(e)}</p>
10494
+ `;
10495
+ }
10496
+ table(e) {
10497
+ let t = "", n = "";
10498
+ for (let r = 0; r < e.header.length; r++) n += this.tablecell(e.header[r]);
10499
+ t += this.tablerow({ text: n });
10500
+ let s = "";
10501
+ for (let r = 0; r < e.rows.length; r++) {
10502
+ let i = e.rows[r];
10503
+ n = "";
10504
+ for (let o = 0; o < i.length; o++) n += this.tablecell(i[o]);
10505
+ s += this.tablerow({ text: n });
10506
+ }
10507
+ return s && (s = `<tbody>${s}</tbody>`), `<table>
10508
+ <thead>
10509
+ ` + t + `</thead>
10510
+ ` + s + `</table>
10511
+ `;
10512
+ }
10513
+ tablerow({ text: e }) {
10514
+ return `<tr>
10515
+ ${e}</tr>
10516
+ `;
10517
+ }
10518
+ tablecell(e) {
10519
+ let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
10520
+ return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
10521
+ `;
10522
+ }
10523
+ strong({ tokens: e }) {
10524
+ return `<strong>${this.parser.parseInline(e)}</strong>`;
10525
+ }
10526
+ em({ tokens: e }) {
10527
+ return `<em>${this.parser.parseInline(e)}</em>`;
10528
+ }
10529
+ codespan({ text: e }) {
10530
+ return `<code>${T(e, !0)}</code>`;
10531
+ }
10532
+ br(e) {
10533
+ return "<br>";
10534
+ }
10535
+ del({ tokens: e }) {
10536
+ return `<del>${this.parser.parseInline(e)}</del>`;
10537
+ }
10538
+ link({ href: e, title: t, tokens: n }) {
10539
+ let s = this.parser.parseInline(n), r = Y(e);
10540
+ if (r === null) return s;
10541
+ e = r;
10542
+ let i = "<a href=\"" + e + "\"";
10543
+ return t && (i += " title=\"" + T(t) + "\""), i += ">" + s + "</a>", i;
10544
+ }
10545
+ image({ href: e, title: t, text: n, tokens: s }) {
10546
+ s && (n = this.parser.parseInline(s, this.parser.textRenderer));
10547
+ let r = Y(e);
10548
+ if (r === null) return T(n);
10549
+ e = r;
10550
+ let i = `<img src="${e}" alt="${T(n)}"`;
10551
+ return t && (i += ` title="${T(t)}"`), i += ">", i;
10552
+ }
10553
+ text(e) {
10554
+ return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : T(e.text);
10555
+ }
10556
+ };
10557
+ var L = class {
10558
+ strong({ text: e }) {
10559
+ return e;
10560
+ }
10561
+ em({ text: e }) {
10562
+ return e;
10563
+ }
10564
+ codespan({ text: e }) {
10565
+ return e;
10566
+ }
10567
+ del({ text: e }) {
10568
+ return e;
10569
+ }
10570
+ html({ text: e }) {
10571
+ return e;
10572
+ }
10573
+ text({ text: e }) {
10574
+ return e;
10575
+ }
10576
+ link({ text: e }) {
10577
+ return "" + e;
10578
+ }
10579
+ image({ text: e }) {
10580
+ return "" + e;
10581
+ }
10582
+ br() {
10583
+ return "";
10584
+ }
10585
+ checkbox({ raw: e }) {
10586
+ return e;
10587
+ }
10588
+ };
10589
+ var b = class l {
10590
+ options;
10591
+ renderer;
10592
+ textRenderer;
10593
+ constructor(e) {
10594
+ this.options = e || R, this.options.renderer = this.options.renderer || new P(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new L();
10595
+ }
10596
+ static parse(e, t) {
10597
+ return new l(t).parse(e);
10598
+ }
10599
+ static parseInline(e, t) {
10600
+ return new l(t).parseInline(e);
10601
+ }
10602
+ parse(e) {
10603
+ this.renderer.parser = this;
10604
+ let t = "";
10605
+ for (let n = 0; n < e.length; n++) {
10606
+ let s = e[n];
10607
+ if (this.options.extensions?.renderers?.[s.type]) {
10608
+ let i = s, o = this.options.extensions.renderers[i.type].call({ parser: this }, i);
10609
+ if (o !== !1 || ![
10610
+ "space",
10611
+ "hr",
10612
+ "heading",
10613
+ "code",
10614
+ "table",
10615
+ "blockquote",
10616
+ "list",
10617
+ "checkbox",
10618
+ "html",
10619
+ "def",
10620
+ "paragraph",
10621
+ "text"
10622
+ ].includes(i.type)) {
10623
+ t += o || "";
10624
+ continue;
10625
+ }
10626
+ }
10627
+ let r = s;
10628
+ switch (r.type) {
10629
+ case "space":
10630
+ t += this.renderer.space(r);
10631
+ break;
10632
+ case "hr":
10633
+ t += this.renderer.hr(r);
10634
+ break;
10635
+ case "heading":
10636
+ t += this.renderer.heading(r);
10637
+ break;
10638
+ case "code":
10639
+ t += this.renderer.code(r);
10640
+ break;
10641
+ case "table":
10642
+ t += this.renderer.table(r);
10643
+ break;
10644
+ case "blockquote":
10645
+ t += this.renderer.blockquote(r);
10646
+ break;
10647
+ case "list":
10648
+ t += this.renderer.list(r);
10649
+ break;
10650
+ case "checkbox":
10651
+ t += this.renderer.checkbox(r);
10652
+ break;
10653
+ case "html":
10654
+ t += this.renderer.html(r);
10655
+ break;
10656
+ case "def":
10657
+ t += this.renderer.def(r);
10658
+ break;
10659
+ case "paragraph":
10660
+ t += this.renderer.paragraph(r);
10661
+ break;
10662
+ case "text":
10663
+ t += this.renderer.text(r);
10664
+ break;
10665
+ default: {
10666
+ let i = "Token with \"" + r.type + "\" type was not found.";
10667
+ if (this.options.silent) return console.error(i), "";
10668
+ throw new Error(i);
10669
+ }
10670
+ }
10671
+ }
10672
+ return t;
10673
+ }
10674
+ parseInline(e, t = this.renderer) {
10675
+ this.renderer.parser = this;
10676
+ let n = "";
10677
+ for (let s = 0; s < e.length; s++) {
10678
+ let r = e[s];
10679
+ if (this.options.extensions?.renderers?.[r.type]) {
10680
+ let o = this.options.extensions.renderers[r.type].call({ parser: this }, r);
10681
+ if (o !== !1 || ![
10682
+ "escape",
10683
+ "html",
10684
+ "link",
10685
+ "image",
10686
+ "checkbox",
10687
+ "strong",
10688
+ "em",
10689
+ "codespan",
10690
+ "br",
10691
+ "del",
10692
+ "text"
10693
+ ].includes(r.type)) {
10694
+ n += o || "";
10695
+ continue;
10696
+ }
10697
+ }
10698
+ let i = r;
10699
+ switch (i.type) {
10700
+ case "escape":
10701
+ n += t.text(i);
10702
+ break;
10703
+ case "html":
10704
+ n += t.html(i);
10705
+ break;
10706
+ case "link":
10707
+ n += t.link(i);
10708
+ break;
10709
+ case "image":
10710
+ n += t.image(i);
10711
+ break;
10712
+ case "checkbox":
10713
+ n += t.checkbox(i);
10714
+ break;
10715
+ case "strong":
10716
+ n += t.strong(i);
10717
+ break;
10718
+ case "em":
10719
+ n += t.em(i);
10720
+ break;
10721
+ case "codespan":
10722
+ n += t.codespan(i);
10723
+ break;
10724
+ case "br":
10725
+ n += t.br(i);
10726
+ break;
10727
+ case "del":
10728
+ n += t.del(i);
10729
+ break;
10730
+ case "text":
10731
+ n += t.text(i);
10732
+ break;
10733
+ default: {
10734
+ let o = "Token with \"" + i.type + "\" type was not found.";
10735
+ if (this.options.silent) return console.error(o), "";
10736
+ throw new Error(o);
10737
+ }
10738
+ }
10739
+ }
10740
+ return n;
10741
+ }
10742
+ };
10743
+ var S = class {
10744
+ options;
10745
+ block;
10746
+ constructor(e) {
10747
+ this.options = e || R;
10748
+ }
10749
+ static passThroughHooks = /* @__PURE__ */ new Set([
10750
+ "preprocess",
10751
+ "postprocess",
10752
+ "processAllTokens",
10753
+ "emStrongMask"
10754
+ ]);
10755
+ static passThroughHooksRespectAsync = /* @__PURE__ */ new Set([
10756
+ "preprocess",
10757
+ "postprocess",
10758
+ "processAllTokens"
10759
+ ]);
10760
+ preprocess(e) {
10761
+ return e;
10762
+ }
10763
+ postprocess(e) {
10764
+ return e;
10765
+ }
10766
+ processAllTokens(e) {
10767
+ return e;
10768
+ }
10769
+ emStrongMask(e) {
10770
+ return e;
10771
+ }
10772
+ provideLexer(e = this.block) {
10773
+ return e ? x.lex : x.lexInline;
10774
+ }
10775
+ provideParser(e = this.block) {
10776
+ return e ? b.parse : b.parseInline;
10777
+ }
10778
+ };
10779
+ var Z = class {
10780
+ defaults = A();
10781
+ options = this.setOptions;
10782
+ parse = this.parseMarkdown(!0);
10783
+ parseInline = this.parseMarkdown(!1);
10784
+ Parser = b;
10785
+ Renderer = P;
10786
+ TextRenderer = L;
10787
+ Lexer = x;
10788
+ Tokenizer = y;
10789
+ Hooks = S;
10790
+ constructor(...e) {
10791
+ this.use(...e);
10792
+ }
10793
+ walkTokens(e, t) {
10794
+ let n = [];
10795
+ for (let s of e) switch (n = n.concat(t.call(this, s)), s.type) {
10796
+ case "table": {
10797
+ let r = s;
10798
+ for (let i of r.header) n = n.concat(this.walkTokens(i.tokens, t));
10799
+ for (let i of r.rows) for (let o of i) n = n.concat(this.walkTokens(o.tokens, t));
10800
+ break;
10801
+ }
10802
+ case "list": {
10803
+ let r = s;
10804
+ n = n.concat(this.walkTokens(r.items, t));
10805
+ break;
10806
+ }
10807
+ default: {
10808
+ let r = s;
10809
+ this.defaults.extensions?.childTokens?.[r.type] ? this.defaults.extensions.childTokens[r.type].forEach((i) => {
10810
+ let o = r[i].flat(1 / 0);
10811
+ n = n.concat(this.walkTokens(o, t));
10812
+ }) : r.tokens && (n = n.concat(this.walkTokens(r.tokens, t)));
10813
+ }
10814
+ }
10815
+ return n;
10816
+ }
10817
+ use(...e) {
10818
+ let t = this.defaults.extensions || {
10819
+ renderers: {},
10820
+ childTokens: {}
10821
+ };
10822
+ return e.forEach((n) => {
10823
+ let s = { ...n };
10824
+ if (s.async = this.defaults.async || s.async || !1, n.extensions && (n.extensions.forEach((r) => {
10825
+ if (!r.name) throw new Error("extension name required");
10826
+ if ("renderer" in r) {
10827
+ let i = t.renderers[r.name];
10828
+ i ? t.renderers[r.name] = function(...o) {
10829
+ let u = r.renderer.apply(this, o);
10830
+ return u === !1 && (u = i.apply(this, o)), u;
10831
+ } : t.renderers[r.name] = r.renderer;
10832
+ }
10833
+ if ("tokenizer" in r) {
10834
+ if (!r.level || r.level !== "block" && r.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
10835
+ let i = t[r.level];
10836
+ 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]));
10837
+ }
10838
+ "childTokens" in r && r.childTokens && (t.childTokens[r.name] = r.childTokens);
10839
+ }), s.extensions = t), n.renderer) {
10840
+ let r = this.defaults.renderer || new P(this.defaults);
10841
+ for (let i in n.renderer) {
10842
+ if (!(i in r)) throw new Error(`renderer '${i}' does not exist`);
10843
+ if (["options", "parser"].includes(i)) continue;
10844
+ let o = i, u = n.renderer[o], a = r[o];
10845
+ r[o] = (...p) => {
10846
+ let c = u.apply(r, p);
10847
+ return c === !1 && (c = a.apply(r, p)), c || "";
10848
+ };
10849
+ }
10850
+ s.renderer = r;
10851
+ }
10852
+ if (n.tokenizer) {
10853
+ let r = this.defaults.tokenizer || new y(this.defaults);
10854
+ for (let i in n.tokenizer) {
10855
+ if (!(i in r)) throw new Error(`tokenizer '${i}' does not exist`);
10856
+ if ([
10857
+ "options",
10858
+ "rules",
10859
+ "lexer"
10860
+ ].includes(i)) continue;
10861
+ let o = i, u = n.tokenizer[o], a = r[o];
10862
+ r[o] = (...p) => {
10863
+ let c = u.apply(r, p);
10864
+ return c === !1 && (c = a.apply(r, p)), c;
10865
+ };
10866
+ }
10867
+ s.tokenizer = r;
10868
+ }
10869
+ if (n.hooks) {
10870
+ let r = this.defaults.hooks || new S();
10871
+ for (let i in n.hooks) {
10872
+ if (!(i in r)) throw new Error(`hook '${i}' does not exist`);
10873
+ if (["options", "block"].includes(i)) continue;
10874
+ let o = i, u = n.hooks[o], a = r[o];
10875
+ S.passThroughHooks.has(i) ? r[o] = (p) => {
10876
+ if (this.defaults.async && S.passThroughHooksRespectAsync.has(i)) return (async () => {
10877
+ let h = await u.call(r, p);
10878
+ return a.call(r, h);
10879
+ })();
10880
+ let c = u.call(r, p);
10881
+ return a.call(r, c);
10882
+ } : r[o] = (...p) => {
10883
+ if (this.defaults.async) return (async () => {
10884
+ let h = await u.apply(r, p);
10885
+ return h === !1 && (h = await a.apply(r, p)), h;
10886
+ })();
10887
+ let c = u.apply(r, p);
10888
+ return c === !1 && (c = a.apply(r, p)), c;
10889
+ };
10890
+ }
10891
+ s.hooks = r;
10892
+ }
10893
+ if (n.walkTokens) {
10894
+ let r = this.defaults.walkTokens, i = n.walkTokens;
10895
+ s.walkTokens = function(o) {
10896
+ let u = [];
10897
+ return u.push(i.call(this, o)), r && (u = u.concat(r.call(this, o))), u;
10898
+ };
10899
+ }
10900
+ this.defaults = {
10901
+ ...this.defaults,
10902
+ ...s
10903
+ };
10904
+ }), this;
10905
+ }
10906
+ setOptions(e) {
10907
+ return this.defaults = {
10908
+ ...this.defaults,
10909
+ ...e
10910
+ }, this;
10911
+ }
10912
+ lexer(e, t) {
10913
+ return x.lex(e, t ?? this.defaults);
10914
+ }
10915
+ parser(e, t) {
10916
+ return b.parse(e, t ?? this.defaults);
10917
+ }
10918
+ parseMarkdown(e) {
10919
+ return (n, s) => {
10920
+ let r = { ...s }, i = {
10921
+ ...this.defaults,
10922
+ ...r
10923
+ }, o = this.onError(!!i.silent, !!i.async);
10924
+ if (this.defaults.async === !0 && r.async === !1) return o(/* @__PURE__ */ new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
10925
+ if (typeof n > "u" || n === null) return o(/* @__PURE__ */ new Error("marked(): input parameter is undefined or null"));
10926
+ if (typeof n != "string") return o(/* @__PURE__ */ new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
10927
+ if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async) return (async () => {
10928
+ let u = i.hooks ? await i.hooks.preprocess(n) : n, p = await (i.hooks ? await i.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(u, i), c = i.hooks ? await i.hooks.processAllTokens(p) : p;
10929
+ i.walkTokens && await Promise.all(this.walkTokens(c, i.walkTokens));
10930
+ let d = await (i.hooks ? await i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(c, i);
10931
+ return i.hooks ? await i.hooks.postprocess(d) : d;
10932
+ })().catch(o);
10933
+ try {
10934
+ i.hooks && (n = i.hooks.preprocess(n));
10935
+ let a = (i.hooks ? i.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(n, i);
10936
+ i.hooks && (a = i.hooks.processAllTokens(a)), i.walkTokens && this.walkTokens(a, i.walkTokens);
10937
+ let c = (i.hooks ? i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(a, i);
10938
+ return i.hooks && (c = i.hooks.postprocess(c)), c;
10939
+ } catch (u) {
10940
+ return o(u);
10941
+ }
10942
+ };
10943
+ }
10944
+ onError(e, t) {
10945
+ return (n) => {
10946
+ if (n.message += `
10947
+ Please report this to https://github.com/markedjs/marked.`, e) {
10948
+ let s = "<p>An error occurred:</p><pre>" + T(n.message + "", !0) + "</pre>";
10949
+ return t ? Promise.resolve(s) : s;
10950
+ }
10951
+ if (t) return Promise.reject(n);
10952
+ throw n;
10953
+ };
10954
+ }
10955
+ };
10956
+ var M = new Z();
10957
+ function f(l, e) {
10958
+ return M.parse(l, e);
10959
+ }
10960
+ f.options = f.setOptions = function(l) {
10961
+ return M.setOptions(l), f.defaults = M.defaults, j(f.defaults), f;
10962
+ };
10963
+ f.getDefaults = A;
10964
+ f.defaults = R;
10965
+ function dt(...l) {
10966
+ return M.use(...l), f.defaults = M.defaults, j(f.defaults), f;
10967
+ }
10968
+ f.use = dt;
10969
+ f.walkTokens = function(l, e) {
10970
+ return M.walkTokens(l, e);
10971
+ };
10972
+ f.parseInline = M.parseInline;
10973
+ f.Parser = b;
10974
+ f.parser = b.parse;
10975
+ f.Renderer = P;
10976
+ f.TextRenderer = L;
10977
+ f.Lexer = x;
10978
+ f.lexer = x.lex;
10979
+ f.Tokenizer = y;
10980
+ f.Hooks = S;
10981
+ f.parse = f;
10982
+ f.options;
10983
+ f.setOptions;
10984
+ f.walkTokens;
10985
+ f.parseInline;
10986
+ b.parse;
10987
+ x.lex;
10988
+ //#endregion
9339
10989
  //#region src/skiff-debug.ts
9340
10990
  /**
9341
10991
  * skiff-debug.ts — Skiff 调试问答页(F4a',v1.25.x 实验性)
@@ -9440,8 +11090,23 @@ function skiffDebugPage(cccs, defaultRoot, webPort) {
9440
11090
  textarea { min-height: 72px; resize: vertical; }
9441
11091
  button { margin-top: 12px; padding: 9px 18px; border-radius: 8px; border: 0; background: #0ba875; color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
9442
11092
  button:disabled { opacity: .55; cursor: wait; }
9443
- #answer { white-space: pre-wrap; background: #fff; border: 1px solid #d0d7de; border-radius: 8px; padding: 12px; margin-top: 16px; font-size: 14px; line-height: 1.55; min-height: 48px; }
11093
+ #answer { background: #fff; border: 1px solid #d0d7de; border-radius: 8px; padding: 12px; margin-top: 16px; font-size: 14px; line-height: 1.6; min-height: 48px; word-break: break-word; }
9444
11094
  @media (prefers-color-scheme: dark) { #answer { background: #26282c; border-color: #3a3d42; } }
11095
+ /* Markdown 渲染(v1.25.8):代码/标题/列表/引用/think 折叠 */
11096
+ #answer p { margin: 6px 0; }
11097
+ #answer h1, #answer h2, #answer h3 { margin: 12px 0 6px; font-size: 15px; line-height: 1.4; }
11098
+ #answer h1 { font-size: 17px; }
11099
+ #answer code { background: rgba(127,127,127,.14); border-radius: 4px; padding: 1px 5px; font-size: 13px; font-family: ui-monospace, SFMono-Regular, monospace; }
11100
+ #answer pre { background: rgba(127,127,127,.1); border-radius: 8px; padding: 10px 12px; overflow-x: auto; margin: 8px 0; }
11101
+ #answer pre code { background: none; padding: 0; font-size: 13px; line-height: 1.5; }
11102
+ #answer ul, #answer ol { margin: 6px 0; padding-left: 22px; }
11103
+ #answer li { margin: 2px 0; }
11104
+ #answer blockquote { margin: 6px 0; padding: 2px 12px; border-left: 3px solid rgba(127,127,127,.35); opacity: .88; }
11105
+ #answer a { color: #0ba875; text-decoration: underline; }
11106
+ details.think { margin: 8px 0; border: 1px solid rgba(210,153,34,.4); border-radius: 8px; background: rgba(210,153,34,.06); }
11107
+ details.think summary { cursor: pointer; padding: 6px 10px; font-size: 12px; color: #d29922; font-weight: 600; user-select: none; list-style-position: inside; }
11108
+ details.think summary:hover { opacity: .8; }
11109
+ details.think .think-body { padding: 2px 12px 10px; font-size: 13px; opacity: .78; white-space: normal; }
9445
11110
  #trajectory { margin-top: 12px; font-size: 13px; }
9446
11111
  .t-entry { border-left: 2px solid #d0d7de; padding: 6px 10px; margin: 6px 0; border-radius: 0 6px 6px 0; background: rgba(127,127,127,.06); white-space: pre-wrap; word-break: break-word; }
9447
11112
  .t-user { border-left-color: #0ba875; }
@@ -9455,7 +11120,7 @@ function skiffDebugPage(cccs, defaultRoot, webPort) {
9455
11120
  <body>
9456
11121
  <main>
9457
11122
  <h1>Skiff Debug</h1>
9458
- <div class="sub">宁静号 trajectory 子集角色问答页(v1.25.4 实验性)— 多 CCC 可切换,走 DSH agent-loop 会话核心,轨迹与 WebUI 同源</div>
11123
+ <div class="sub">宁静号 trajectory 子集角色问答页(v1.25.9 实验性)— 多 CCC 可切换,走 DSH agent-loop 会话核心,回答 marked 服务端渲染 + think 折叠</div>
9459
11124
  <div class="ccc" id="cccBadge"></div>
9460
11125
  <label for="ccc">认知容器</label>
9461
11126
  <select id="ccc"></select>
@@ -9513,7 +11178,7 @@ btn.addEventListener('click', async () => {
9513
11178
  const data = await res.json()
9514
11179
  if (!res.ok) throw new Error(data.error || ('HTTP ' + res.status))
9515
11180
  answer.className = ''
9516
- answer.textContent = data.answer || '(空回答)'
11181
+ answer.innerHTML = data.answer_html || esc(data.answer || '') || '(空回答)'
9517
11182
  renderTrajectory(data.trajectory || [], data.sessionId || '')
9518
11183
  } catch (err) {
9519
11184
  answer.className = 'err'
@@ -9544,6 +11209,33 @@ function escapeHtml(s) {
9544
11209
  })[c] ?? c);
9545
11210
  }
9546
11211
  /**
11212
+ * Markdown 渲染(v1.25.9,正经库 marked 服务端渲染——替代手写正则渲染器,S142 用户要求):
11213
+ * ① 提取 `<think>…</think>` 块(占位符 \u0000T<idx>\u0000)
11214
+ * ② 正文与 think 内容**先 escapeHtml 再 marked.parse**(GFM + breaks)——markdown 语法不受
11215
+ * 转义影响,原始 HTML 注入被消除(安全);代码块内 `<` 显示为实体(可接受)
11216
+ * ③ think 占位符还原为 `<details class="think">` 折叠卡(🧠 思考过程,默认收起)
11217
+ */
11218
+ function renderSkiffMarkdown(raw) {
11219
+ const thinks = [];
11220
+ const body = raw.replace(/<think>([\s\S]*?)<\/think>/gi, (_m, inner) => {
11221
+ const idx = thinks.length;
11222
+ thinks.push(String(inner ?? "").trim());
11223
+ return `\u0000T${idx}\u0000`;
11224
+ });
11225
+ const parsed = f.parse(escapeHtml(body), {
11226
+ breaks: true,
11227
+ gfm: true
11228
+ });
11229
+ return (typeof parsed === "string" ? parsed : "").replace(/\u0000T(\d+)\u0000/g, (_m, idx) => {
11230
+ const inner = thinks[Number(idx)] ?? "";
11231
+ const innerHtml = inner === "" ? "" : f.parse(escapeHtml(inner), {
11232
+ breaks: true,
11233
+ gfm: true
11234
+ });
11235
+ return `<details class="think"><summary>🧠 思考过程</summary><div class="think-body">${typeof innerHtml === "string" ? innerHtml : ""}</div></details>`;
11236
+ });
11237
+ }
11238
+ /**
9547
11239
  * 启动调试问答服务(单实例;重复启动幂等返回既有实例)。
9548
11240
  *
9549
11241
  * **CCC 绑定(v1.25.2 用户指出)**:服务绑定一个默认 CCC root(调用方 resolveSkiffRoot
@@ -9608,6 +11300,7 @@ async function handle(ctx, defaultRoot, webPort, req, res) {
9608
11300
  const result = await askSkiff(ctx, (await createSkiffAgent(ctx, ccc, roleName, role, readHandymanConfig(ccc)?.defaultModel)).agent, question);
9609
11301
  sendJson(res, 200, {
9610
11302
  answer: result.answer,
11303
+ answer_html: renderSkiffMarkdown(result.answer),
9611
11304
  sessionId: result.sessionId,
9612
11305
  trajectory: result.trajectory
9613
11306
  });