dsh-taskflow 0.1.3 → 0.1.4

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/client.js CHANGED
@@ -58,7 +58,7 @@ __export(client_exports, {
58
58
  inject: () => inject
59
59
  });
60
60
  module.exports = __toCommonJS(client_exports);
61
- var import_react13 = __toESM(require("react"));
61
+ var import_react15 = __toESM(require("react"));
62
62
  var import_react_dom4 = require("react-dom");
63
63
 
64
64
  // taskflow-source:src/client/components/task-panel.jsx
@@ -122,9 +122,9 @@ function visibleTree(plan, { filter = "all", scope = "global", sessionId } = {})
122
122
  const all = Object.values(plan.tasks), kept = /* @__PURE__ */ new Set();
123
123
  const matches = (t) => (filter === "all" || (filter === "active" ? !["completed", "cancelled"].includes(t.status) : t.status === filter)) && (scope === "global" || t.executionSessionId === sessionId || t.recordSession?.id === sessionId || t.recordHistory?.some((r) => r.id === sessionId) || (t.parentId ? plan.tasks[t.parentId].executionSessionId : plan.rootSessionId) === sessionId);
124
124
  for (const t of all.filter(matches)) {
125
- for (let x = t; x; x = plan.tasks[x.parentId]) {
126
- if (kept.has(x.id)) break;
127
- kept.add(x.id);
125
+ for (let x2 = t; x2; x2 = plan.tasks[x2.parentId]) {
126
+ if (kept.has(x2.id)) break;
127
+ kept.add(x2.id);
128
128
  }
129
129
  }
130
130
  const walk = (parentId) => all.filter((t) => t.parentId === parentId && kept.has(t.id)).map((t) => ({ ...t, children: walk(t.id) }));
@@ -329,11 +329,11 @@ function ToolPanel({ tool, onClose, renderer, mount, sessionId, openers, foregro
329
329
  if (event.button !== 0 || kind === "move" && event.target.closest("button,a,input")) return;
330
330
  event.preventDefault();
331
331
  stopDrag.current();
332
- const start = { ...latest.current }, x = event.clientX, y = event.clientY, pointerId = event.pointerId;
332
+ const start = { ...latest.current }, x2 = event.clientX, y2 = event.clientY, pointerId = event.pointerId;
333
333
  setDragging(true);
334
334
  const move = (e) => {
335
335
  if (e.pointerId !== pointerId) return;
336
- const dx = e.clientX - x, dy = e.clientY - y;
336
+ const dx = e.clientX - x2, dy = e.clientY - y2;
337
337
  if (kind === "move") setLayout(bounds({ ...start, x: start.x + dx, y: start.y + dy }));
338
338
  else if (start.floating) setLayout(bounds({ ...start, width: start.width + dx, height: kind === "corner" ? start.height + dy : start.height }));
339
339
  else setLayout({ ...start, dockWidth: fit(start.dockWidth + dx, 240, (mount?.parentElement?.getBoundingClientRect().width || 1e3) - 320) });
@@ -622,6 +622,11 @@ var styles_default = `/* Host-only adaptations. Component declarations are synce
622
622
  .tf-host-preview.tf-host-preview{position:fixed!important;border:0!important;border-radius:8px!important;box-shadow:none!important;overflow:hidden!important}
623
623
  .tf-host-preview [data-dockkit-float-grip],.tf-host-preview>[data-dockkit-float-resize]{display:none!important}
624
624
  .tf-host-preview [data-textpreview-path]{display:none!important}
625
+ .tf-execution-record{margin:12px 0 18px;border:1px solid var(--dsw-alias-border-light,var(--border,#e5e7eb));border-radius:12px;overflow:hidden;color:inherit;font:inherit}
626
+ .tf-record-heading{display:flex;align-items:center;flex-wrap:wrap;gap:8px;width:100%;padding:10px 14px;border:0;background:var(--dsw-alias-bg-container-secondary,rgba(127,127,127,.04));color:inherit;font:inherit;font-size:13px;text-align:left;cursor:pointer}
627
+ .tf-record-heading strong{font-weight:600}.tf-record-marker{color:var(--dsw-alias-state-business-primary,#4d6bfe)}.tf-record-task,.tf-record-duration,.tf-record-model{color:var(--dsw-alias-text-secondary,var(--secondary,#747983));font-size:12px}.tf-record-chevron{margin-left:auto}
628
+ .tf-record-body{padding:4px 16px 14px;min-width:0;font-size:14px;line-height:1.7;overflow-wrap:anywhere}.tf-record-model{margin:6px 0}.tf-record-body .tf-markdown-preview{padding:0;font:inherit}.tf-record-body pre{overflow:auto;max-width:100%;padding:12px;border-radius:8px;background:rgba(127,127,127,.07);font-size:12px;line-height:1.6;white-space:pre-wrap;overflow-wrap:anywhere}
629
+ .tf-record-body .tf-markdown-table{overflow:auto}.tf-record-body table{border-collapse:collapse;width:100%}.tf-record-body th,.tf-record-body td{padding:6px 10px;border:1px solid var(--border,#e5e7eb);text-align:left}
625
630
  `;
626
631
 
627
632
  // taskflow-source:src/client/generated/prototype.css
@@ -892,6 +897,1621 @@ function useCompactChecklist(enabled) {
892
897
  return { anchor, panel, dragging, separator: { role: "separator", tabIndex: 0, "aria-label": "调整待办任务清单宽度", "aria-orientation": "vertical", "aria-valuemin": MIN_WIDTH, "aria-valuemax": size.max, "aria-valuenow": size.width, onPointerDown, onKeyDown } };
893
898
  }
894
899
 
900
+ // taskflow-source:src/client/components/execution-record.jsx
901
+ var import_react14 = __toESM(require("react"));
902
+
903
+ // taskflow-source:src/client/components/markdown-preview.jsx
904
+ var import_react13 = __toESM(require("react"));
905
+
906
+ // taskflow-vendor:node_modules/marked/lib/marked.esm.js
907
+ function G() {
908
+ return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
909
+ }
910
+ var S = G();
911
+ function ue(l3) {
912
+ S = l3;
913
+ }
914
+ var q = { exec: () => null };
915
+ function D(l3) {
916
+ let e = [];
917
+ return (t) => {
918
+ let n = Math.max(0, Math.min(3, t - 1)), r = e[n];
919
+ return r || (r = l3(n), e[n] = r), r;
920
+ };
921
+ }
922
+ function g(l3, e = "") {
923
+ let t = typeof l3 == "string" ? l3 : l3.source, n = { replace: (r, s) => {
924
+ let o = typeof s == "string" ? s : s.source;
925
+ return o = o.replace(O.caret, "$1"), t = t.replace(r, o), n;
926
+ }, getRegex: () => new RegExp(t, e) };
927
+ return n;
928
+ }
929
+ var _e = ((l3 = "") => {
930
+ try {
931
+ return !!new RegExp("(?<=1)(?<!1)" + l3);
932
+ } catch {
933
+ return false;
934
+ }
935
+ })();
936
+ var O = { codeRemoveIndent: /^(?: {0,3}\t| {1,4})/gm, listInterruptsParagraph: /^ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/, 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}((?:=+|-+)[ \t]*)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, blockquoteMarkerWhitespace: /^( {0,3}>)(\t[ \t]*)/gm, nestedBlockMarker: /^ {0,3}(?:(?:[*+-]|\d{1,9}[.)])(?: |$)|> ?)/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\][ \t]+\S/, listReplaceTask: /^\[[ xX]\][ \t]+/, 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}));/, numericCharacterReferenceOrAmpersand: /&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/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: D((l3) => new RegExp(`^ {0,${l3}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)), hrRegex: D((l3) => new RegExp(`^ {0,${l3}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)), fencesBeginRegex: D((l3) => new RegExp(`^ {0,${l3}}(?:\`\`\`|~~~)`)), headingBeginRegex: D((l3) => new RegExp(`^ {0,${l3}}#{1,6}(?:\\s|$)`)), pedanticHeadingBeginRegex: D((l3) => new RegExp(`^ {0,${l3}}#`)), htmlBeginRegex: D((l3) => new RegExp(`^ {0,${l3}}(?:</?(?:${he})(?:[ \\t]+|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`, "i")), blockquoteBeginRegex: D((l3) => new RegExp(`^ {0,${l3}}>`)), nestedContainerMarkers: /^(?: {0,3}(?:(?:[*+-]|\d{1,9}[.)])[ \t]+|>[ \t]?))+/ };
937
+ var Ge = /^(?:[ \t]*(?:\n|$))+/;
938
+ var Ne = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
939
+ var Fe = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*) *(?=\n|$)|$)/;
940
+ var V = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
941
+ var Qe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
942
+ var ce = / {0,3}(?:[*+-]|\d{1,9}[.)])/;
943
+ var he = "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";
944
+ var J = g(" {0,3}(?:</?(?:tag)(?:[ \\t]+|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag", he).getRegex();
945
+ var $e = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/;
946
+ var Le = g($e).replace(/bull/g, ce).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(/\|table/g, "").replace(/html/g, J).getRegex();
947
+ var We = g($e).replace(/bull/g, ce).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(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).replace(/html/g, J).getRegex();
948
+ var de = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/;
949
+ var Ue = /^[^\n]+/;
950
+ var ge = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/;
951
+ var Ke = g(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<(?:\\.|[^\n<>\\])*>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", ge).replace("title", /(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex();
952
+ var Xe = g(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, ce).getRegex();
953
+ var ke = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
954
+ var Ve = g("^ {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)(?:[ \\t]+|\\n|/?>|$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*?[ \\t]*/?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", ke).replace("tag", he).replace("attribute", /[ \t]+[a-zA-Z:_][\w.:-]*(?:[ \t]*=[ \t]*"[^"\n]*"|[ \t]*=[ \t]*'[^'\n]*'|[ \t]*=[ \t]*[^\s"'=<>`]+)?/).getRegex();
955
+ var Ce = (l3) => g(de).replace("hr", V).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", J).getRegex();
956
+ var Je = Ce(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/);
957
+ var Ye = Ce(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/);
958
+ var et = g(/^( {0,3}> ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace("paragraph", Ye).getRegex();
959
+ var fe = { blockquote: et, code: Ne, def: Ke, fences: Fe, heading: Qe, hr: V, html: Ve, lheading: Le, list: Xe, newline: Ge, paragraph: Je, table: q, text: Ue };
960
+ var Pe = g("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", V).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", J).getRegex();
961
+ var tt = { ...fe, lheading: We, table: Pe, paragraph: g(de).replace("hr", V).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Pe).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", J).getRegex() };
962
+ var nt = { ...fe, html: g(`^ *(?:comment(?: *\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1>(?: *\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace("comment", ke).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: q, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: g(de).replace("hr", V).replace("heading", ` *#{1,6} *[^
963
+ ]`).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").replace("lheading", Le).getRegex() };
964
+ var rt = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
965
+ var st = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
966
+ var Ie = /^( {2,}|\\)\n(?!\s*$)[ \t]*/;
967
+ var it = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
968
+ var L = /[\p{P}\p{S}]/u;
969
+ var N = /[\s\p{P}\p{S}]/u;
970
+ var Y = /[^\s\p{P}\p{S}]/u;
971
+ var ot = g(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, N).getRegex();
972
+ var at = /[\p{Pi}\p{Ps}"']/u;
973
+ var Ae = /(?!~)[\p{P}\p{S}]/u;
974
+ var lt = /(?!~)[\s\p{P}\p{S}]/u;
975
+ var ut = /(?:[^\s\p{P}\p{S}]|~)/u;
976
+ var pt = g(/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();
977
+ var Ee = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/;
978
+ var ct = g(Ee, "u").replace(/punct/g, L).getRegex();
979
+ var ht = g(Ee, "u").replace(/punct/g, Ae).getRegex();
980
+ var dt = /^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/;
981
+ var gt = g(dt, "u").replace(/openQuote/g, at).replace(/punct/g, L).getRegex();
982
+ var ze = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
983
+ var kt = g(ze, "gu").replace(/notPunctSpace/g, Y).replace(/punctSpace/g, N).replace(/punct/g, L).getRegex();
984
+ var ft = g(ze, "gu").replace(/notPunctSpace/g, ut).replace(/punctSpace/g, lt).replace(/punct/g, Ae).getRegex();
985
+ var mt = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)";
986
+ var xt = g(mt, "gu").replace(/notPunctSpace/g, Y).replace(/punctSpace/g, N).replace(/punct/g, L).getRegex();
987
+ var bt = g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, Y).replace(/punctSpace/g, N).replace(/punct/g, L).getRegex();
988
+ var Rt = "^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)";
989
+ var Tt = g(Rt, "gu").replace(/notPunctSpace/g, Y).replace(/punctSpace/g, N).replace(/punct/g, L).getRegex();
990
+ var Ot = g(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, L).getRegex();
991
+ var wt = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)";
992
+ var Pt = g(wt, "gu").replace(/notPunctSpace/g, Y).replace(/punctSpace/g, N).replace(/punct/g, L).getRegex();
993
+ var yt = g(/\\(punct)/, "gu").replace(/punct/g, L).getRegex();
994
+ var St = g(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/, "gu").replace(/punct/g, L).getRegex();
995
+ var _t = g(/^<(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();
996
+ var $t = g(ke).replace("(?:-->|$)", "-->").getRegex();
997
+ var Lt = g("^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", $t).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
998
+ var Me = /\[(?:\\[\s\S]|[^\[\]\\])*\]/;
999
+ var ie = g(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets", Me).getRegex();
1000
+ var Ct = g(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label", ie).replace("href", /<(?:\\.|[^\n<>\\])*>|(?!<)[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex();
1001
+ var It = g(/^!?\[(label)\]\[(ref)\]/).replace("label", ie).replace("ref", ge).getRegex();
1002
+ var At = g(/^!?\[(ref)\](?:\[\])?/).replace("ref", ge).getRegex();
1003
+ var ye = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/;
1004
+ var Et = g(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets", Me).getRegex();
1005
+ var zt = g("reflink|nolink(?!\\()", "g").replace("reflink", g(/^!?\[(label)\]\[(ref)\]/).replace("label", Et).replace("ref", ye).getRegex()).replace("nolink", g(/^!?\[(ref)\](?:\[\])?/).replace("ref", ye).getRegex()).getRegex();
1006
+ var Se = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;
1007
+ var Mt = /[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/;
1008
+ var Bt = g(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g, Mt).getRegex();
1009
+ var me = { _backpedal: q, anyPunctuation: yt, anyPunctuationOutsideCode: St, autolink: _t, blockSkip: pt, br: Ie, code: st, del: q, delLDelim: q, delRDelim: q, emStrongLDelim: ct, emStrongRDelimAst: kt, emStrongRDelimUnd: bt, escape: rt, link: Ct, nolink: At, punctuation: ot, reflink: It, reflinkSearch: zt, tag: Lt, text: it, url: q };
1010
+ var Dt = { ...me, emStrongLDelim: gt, emStrongRDelimAst: xt, emStrongRDelimUnd: Tt, link: g(/^!?\[(label)\]\((.*?)\)/).replace("label", ie).getRegex(), reflink: g(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", ie).getRegex() };
1011
+ var pe = { ...me, emStrongRDelimAst: ft, emStrongLDelim: ht, delLDelim: Ot, delRDelim: Pt, url: g(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol", Bt).replace("protocol", Se).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: g(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|wwwStart|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol", Se).replace(/emailProtocol/g, /(?:mailto|xmpp):/).replace("wwwStart", _e ? "(?<![^\\s*_~(])www\\." : "www\\.").getRegex() };
1012
+ var qt = { ...pe, br: g(Ie).replace("{2,}", "*").getRegex(), text: g(pe.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
1013
+ var ee = { normal: fe, gfm: tt, pedantic: nt };
1014
+ var F = { normal: me, gfm: pe, breaks: qt, pedantic: Dt };
1015
+ var vt = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" };
1016
+ var Be = (l3) => vt[l3];
1017
+ function y(l3, e) {
1018
+ if (e) {
1019
+ if (O.escapeTest.test(l3)) return l3.replace(O.escapeReplace, Be);
1020
+ } else if (O.escapeTestNoEncode.test(l3)) return l3.replace(O.escapeReplaceNoEncode, Be);
1021
+ return l3;
1022
+ }
1023
+ function De(l3) {
1024
+ return O.numericCharacterReference.test(l3) ? l3.replace(O.numericCharacterReferenceOrAmpersand, (e, t, n) => {
1025
+ if (t === void 0 && n === void 0) return "&amp;";
1026
+ let r = t === void 0 ? Number.parseInt(n, 16) : Number.parseInt(t, 10);
1027
+ return r === 0 || r > 1114111 || r >= 55296 && r <= 57343 ? "�" : r === 38 ? "&amp;" : String.fromCodePoint(r);
1028
+ }) : l3;
1029
+ }
1030
+ function xe(l3) {
1031
+ try {
1032
+ l3 = encodeURI(l3).replace(O.percentDecode, "%");
1033
+ } catch {
1034
+ return null;
1035
+ }
1036
+ return l3;
1037
+ }
1038
+ function be(l3, e) {
1039
+ let t = l3.replace(O.findPipe, (s, o, i) => {
1040
+ let a = false, c = o;
1041
+ for (; --c >= 0 && i[c] === "\\"; ) a = !a;
1042
+ return a ? "|" : " |";
1043
+ }), n = t.split(O.splitPipe), r = 0;
1044
+ if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e) if (n.length > e) n.splice(e);
1045
+ else for (; n.length < e; ) n.push("");
1046
+ for (; r < n.length; r++) n[r] = n[r].trim().replace(O.slashPipe, "|");
1047
+ return n;
1048
+ }
1049
+ function C(l3, e, t) {
1050
+ let n = l3.length;
1051
+ if (n === 0) return "";
1052
+ let r = 0;
1053
+ for (; r < n; ) {
1054
+ let s = l3.charAt(n - r - 1);
1055
+ if (s === e && !t) r++;
1056
+ else if (s !== e && t) r++;
1057
+ else break;
1058
+ }
1059
+ return l3.slice(0, n - r);
1060
+ }
1061
+ function Re(l3) {
1062
+ let e = l3.split(`
1063
+ `), t = e.length - 1;
1064
+ for (; t >= 0 && O.blankLine.test(e[t]); ) t--;
1065
+ return e.length - t <= 2 ? l3 : e.slice(0, t + 1).join(`
1066
+ `);
1067
+ }
1068
+ function W(l3) {
1069
+ return l3.trim().replace(O.multipleSpaceGlobal, " ").toLowerCase().toUpperCase().toLowerCase();
1070
+ }
1071
+ function Te(l3, e) {
1072
+ if (l3.indexOf(e[0]) === -1 && l3.indexOf(e[1]) === -1) return -1;
1073
+ let t = 0;
1074
+ for (let n = 0; n < l3.length; n++) if (l3[n] === "\\") n++;
1075
+ else if (l3[n] === e[0]) t++;
1076
+ else if (l3[n] === e[1] && (t--, t < 0)) return n;
1077
+ return t > 0 ? -2 : -1;
1078
+ }
1079
+ var Q = /* @__PURE__ */ new WeakMap();
1080
+ function Oe(l3) {
1081
+ let e = { "*": -1, _: -1 }, t = -1, n = l3.length;
1082
+ for (let r = 0; r < n; r++) {
1083
+ let s = l3[r];
1084
+ if (s !== "*" && s !== "_" && s !== "~") continue;
1085
+ let o = r === 0 ? `
1086
+ ` : l3[r - 1], i = r + 1;
1087
+ for (; i < n && l3[i] === s; ) i++;
1088
+ o !== " " && o !== " " && o !== `
1089
+ ` && o !== "\r" && o !== "\f" && (s === "~" ? t = r : e[s] = r), r = i - 1;
1090
+ }
1091
+ return { maskedSrc: l3, lastPossibleEmStrongCloserIndex: e, lastPossibleDelCloserIndex: t };
1092
+ }
1093
+ function qe(l3, e) {
1094
+ let t = Oe(e), n = Q.get(l3);
1095
+ n ? n.push(t) : Q.set(l3, [t]);
1096
+ }
1097
+ function ve(l3) {
1098
+ let e = Q.get(l3);
1099
+ e && (e.pop(), e.length === 0 && Q.delete(l3));
1100
+ }
1101
+ function oe(l3, e, t) {
1102
+ let n = Q.get(l3)?.at(-1);
1103
+ return n && n.maskedSrc === e ? n.lastPossibleEmStrongCloserIndex[t] : Oe(e).lastPossibleEmStrongCloserIndex[t];
1104
+ }
1105
+ function ae(l3, e) {
1106
+ let t = Q.get(l3)?.at(-1);
1107
+ return t && t.maskedSrc === e ? t.lastPossibleDelCloserIndex : Oe(e).lastPossibleDelCloserIndex;
1108
+ }
1109
+ function te(l3, e = 0) {
1110
+ let t = e, n = "";
1111
+ for (let r of l3) if (r === " ") {
1112
+ let s = 4 - t % 4;
1113
+ n += " ".repeat(s), t += s;
1114
+ } else n += r, t++;
1115
+ return n;
1116
+ }
1117
+ function Ht(l3, e) {
1118
+ let t = "";
1119
+ for (let n = 0; n < l3.length; n++) {
1120
+ if (l3[n] === "`") {
1121
+ let r = e.inline.code.exec(l3.slice(n));
1122
+ if (r) {
1123
+ t += r[0], n += r[0].length - 1;
1124
+ continue;
1125
+ }
1126
+ }
1127
+ if (l3[n] === "\\" && (l3[n + 1] === "[" || l3[n + 1] === "]")) {
1128
+ t += l3[n + 1], n++;
1129
+ continue;
1130
+ }
1131
+ t += l3[n];
1132
+ }
1133
+ return t;
1134
+ }
1135
+ function He(l3, e, t, n, r) {
1136
+ let s = e.href, o = e.title || null, i = Ht(l3[1], r), a = l3[0].charAt(0) === "!", c = n.state.inLink, u = n.state.linkEmitted, d = n.state.inRawBlock;
1137
+ n.state.inLink = true, n.state.linkEmitted = false;
1138
+ let h = n.inlineTokens(i), p = n.state.linkEmitted;
1139
+ if (n.state.linkEmitted = u, n.state.inLink = c, !a) {
1140
+ if (p) {
1141
+ n.state.inRawBlock = d;
1142
+ return;
1143
+ }
1144
+ n.state.linkEmitted = true;
1145
+ }
1146
+ return { type: a ? "image" : "link", raw: t, href: s, title: o, text: i, tokens: h };
1147
+ }
1148
+ function Zt(l3, e, t) {
1149
+ let n = l3.match(t.other.indentCodeCompensation);
1150
+ if (n === null) return e;
1151
+ let r = n[1];
1152
+ return e.split(`
1153
+ `).map((s) => {
1154
+ let o = s.match(t.other.beginningSpace);
1155
+ if (o === null) return s;
1156
+ let [i] = o;
1157
+ return s.slice(Math.min(i.length, r.length));
1158
+ }).join(`
1159
+ `);
1160
+ }
1161
+ function Ze(l3, e, t, n) {
1162
+ if (!e.includes("<")) return false;
1163
+ for (let r = 0; r < e.length; r++) {
1164
+ if (e[r] === "\\") {
1165
+ r++;
1166
+ continue;
1167
+ }
1168
+ if (e[r] === "`") {
1169
+ let i = n.inline.code.exec(e.slice(r));
1170
+ if (i) {
1171
+ r += i[0].length - 1;
1172
+ continue;
1173
+ }
1174
+ }
1175
+ if (e[r] !== "<") continue;
1176
+ let s = l3.slice(t + r), o = n.inline.tag.exec(s) || n.inline.autolink.exec(s);
1177
+ if (o) {
1178
+ if (o[0].length > e.length - r) return true;
1179
+ r += o[0].length - 1;
1180
+ }
1181
+ }
1182
+ return false;
1183
+ }
1184
+ var _ = class {
1185
+ options;
1186
+ rules;
1187
+ lexer;
1188
+ constructor(e) {
1189
+ this.options = e || S;
1190
+ }
1191
+ space(e) {
1192
+ let t = this.rules.block.newline.exec(e);
1193
+ if (t && t[0].length > 0) return { type: "space", raw: t[0] };
1194
+ }
1195
+ code(e) {
1196
+ let t = this.rules.block.code.exec(e);
1197
+ if (t) {
1198
+ let n = this.options.pedantic ? t[0] : Re(t[0]), r = n.replace(this.rules.other.codeRemoveIndent, "");
1199
+ return { type: "code", raw: n, codeBlockStyle: "indented", text: r };
1200
+ }
1201
+ }
1202
+ fences(e) {
1203
+ let t = this.rules.block.fences.exec(e);
1204
+ if (t) {
1205
+ let n = t[0], r = Zt(n, t[3] || "", this.rules);
1206
+ return t[3] !== void 0 && (r === "" || r.endsWith(`
1207
+ `)) && (r += `
1208
+ `), { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: r };
1209
+ }
1210
+ }
1211
+ heading(e) {
1212
+ let t = this.rules.block.heading.exec(e);
1213
+ if (t) {
1214
+ let n = t[2].trim();
1215
+ if (this.rules.other.endingHash.test(n)) {
1216
+ let r = C(n, "#");
1217
+ (this.options.pedantic || !r || this.rules.other.endingSpaceTabChar.test(r)) && (n = r.trim());
1218
+ }
1219
+ return { type: "heading", raw: C(t[0], `
1220
+ `), depth: t[1].length, text: n, tokens: this.lexer.inline(n) };
1221
+ }
1222
+ }
1223
+ hr(e) {
1224
+ let t = this.rules.block.hr.exec(e);
1225
+ if (t) return { type: "hr", raw: C(t[0], `
1226
+ `) };
1227
+ }
1228
+ blockquote(e) {
1229
+ let t = this.rules.block.blockquote.exec(e);
1230
+ if (t) {
1231
+ let n = C(t[0], `
1232
+ `).split(`
1233
+ `), r = "", s = "", o = [];
1234
+ for (; n.length > 0; ) {
1235
+ let i = false, a = [], c;
1236
+ for (c = 0; c < n.length; c++) if (this.rules.other.blockquoteStart.test(n[c])) a.push(n[c]), i = true;
1237
+ else if (!i) a.push(n[c]);
1238
+ else break;
1239
+ n = n.slice(c);
1240
+ let u = a.join(`
1241
+ `), d = u.replace(this.rules.other.blockquoteMarkerWhitespace, (k, m, b) => b.startsWith(" ") ? m + " " + b.slice(1) : m + te(b, m.length)).replace(this.rules.other.blockquoteSetextReplace, `
1242
+ $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
1243
+ r = r ? `${r}
1244
+ ${u}` : u, s = s ? `${s}
1245
+ ${d}` : d;
1246
+ let h = this.lexer.state.top;
1247
+ if (this.lexer.state.top = true, this.lexer.blockTokens(d, o, true), this.lexer.state.top = h, n.length === 0) break;
1248
+ let p = o.at(-1);
1249
+ if (p?.type === "code" || p?.type === "heading" || p?.type === "hr" || p?.type === "html" || p?.type === "table") break;
1250
+ if (p?.type === "blockquote") {
1251
+ let k = p, m = n.join(`
1252
+ `), b = k.raw + `
1253
+ ` + m.replace(this.rules.other.blockquoteSetextReplace2, ""), f = this.blockquote(b);
1254
+ o[o.length - 1] = f;
1255
+ let R = b.substring(f.raw.length).replace(/^\n/, ""), E = R ? R.split(`
1256
+ `).length : 0, T = E ? n.slice(0, -E) : n;
1257
+ if (T.length > 0 && (r = `${r}
1258
+ ${T.join(`
1259
+ `)}`), s = s.substring(0, s.length - k.text.length) + f.text, n = n.slice(T.length), n.length > 0 && this.rules.other.blockquoteStart.test(n[0])) continue;
1260
+ break;
1261
+ } else if (p?.type === "list") {
1262
+ let k = p, m = k.raw + `
1263
+ ` + n.join(`
1264
+ `), b = this.list(m);
1265
+ o[o.length - 1] = b;
1266
+ let f = b.raw.length > k.raw.length ? m.slice(k.raw.length + 1, b.raw.length).split(`
1267
+ `).length : 0;
1268
+ if (f > 0) {
1269
+ let R = n.slice(0, f).join(`
1270
+ `);
1271
+ r = `${r}
1272
+ ${R}`, s = `${s}
1273
+ ${R}`;
1274
+ }
1275
+ if (n = n.slice(f), n.length > 0 && !this.rules.other.blockquoteStart.test(n[0])) break;
1276
+ continue;
1277
+ }
1278
+ }
1279
+ return { type: "blockquote", raw: r, tokens: o, text: s };
1280
+ }
1281
+ }
1282
+ list(e) {
1283
+ let t = this.rules.block.list.exec(e);
1284
+ if (t) {
1285
+ if (!this.options.pedantic && this.lexer.state.lastToken?.type === "text" && !this.rules.other.listInterruptsParagraph.test(e)) return;
1286
+ let n = e, r = () => n.length - e.length, s = t[1].trim(), o = s.length > 1, i = { type: "list", raw: "", ordered: o, start: o ? +s.slice(0, -1) : "", loose: false, items: [] };
1287
+ s = o ? `\\d{1,9}\\${s.slice(-1)}` : `\\${s}`, this.options.pedantic && (s = o ? s : "[*+-]");
1288
+ let a = this.rules.other.listItemRegex(s), c = false;
1289
+ for (; e; ) {
1290
+ let h = false, p = "";
1291
+ if (!(t = a.exec(e)) || this.rules.block.hr.test(e)) break;
1292
+ let k = r();
1293
+ e = e.substring(t[0].length);
1294
+ let m = t[2].split(`
1295
+ `, 1)[0], b = t[1].length, f = this.options.pedantic ? te(m, b) : m.replace(this.rules.other.leadingSpaceTab, (H) => te(H, b)), R = e.split(`
1296
+ `, 1)[0], E = !f.trim(), T = 0;
1297
+ if (this.options.pedantic ? (T = 2, p = f.trimStart()) : E ? T = b + 1 : (T = f.search(this.rules.other.nonSpaceChar), T = T > 4 ? 1 : T, p = f.slice(T), T += b), E && this.rules.other.blankLine.test(R) && (e = e.substring(R.length + 1), h = true), !h) {
1298
+ let H = this.rules.other.nextBulletRegex(T), K = this.rules.other.hrRegex(T), re = this.rules.other.fencesBeginRegex(T), B = this.options.pedantic ? this.rules.other.pedanticHeadingBeginRegex(T) : this.rules.other.headingBeginRegex(T), X = this.rules.other.htmlBeginRegex(T), se = this.rules.other.blockquoteBeginRegex(T), le = false;
1299
+ for (; e; ) {
1300
+ let we = e.split(`
1301
+ `, 1)[0], Z;
1302
+ if (R = we, this.options.pedantic ? (R = R.replace(this.rules.other.listReplaceNesting, " "), Z = R) : Z = R.replace(this.rules.other.leadingSpaceTab, ($) => te($)), re.test(R) || B.test(R) || X.test(R) || se.test(R) || H.test(R) || K.test(R)) break;
1303
+ if (Z.search(this.rules.other.nonSpaceChar) >= T || !R.trim()) p += `
1304
+ ` + Z.slice(T), le = false;
1305
+ else {
1306
+ if (E) break;
1307
+ let $ = f;
1308
+ if (!this.options.pedantic && !p.includes(`
1309
+ `) && !f.includes(" ")) {
1310
+ let j;
1311
+ for (; !K.test($) && (j = this.rules.other.nestedBlockMarker.exec($)); ) $ = $.slice(j[0].length);
1312
+ if (!$.trim()) break;
1313
+ }
1314
+ if ($.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || re.test($) || B.test($) || X.test($) || K.test($)) break;
1315
+ if (!this.options.pedantic && !le) {
1316
+ let j = f.replace(this.rules.other.nestedContainerMarkers, "");
1317
+ if (this.rules.block.fences.test(j) || this.rules.block.heading.test(j) || this.rules.block.hr.test(j)) break;
1318
+ }
1319
+ let je = !this.options.pedantic && /^ {0,3}(?:=+|-+) *$/.test(R) && this.rules.block.lheading.test(`${f}
1320
+ ${R}`) ? ` ${Z.replace(/^ {0,3}/, "")}` : R;
1321
+ p += `
1322
+ ` + je, le = true;
1323
+ }
1324
+ E = !R.trim(), e = e.substring(we.length + 1), f = Z.slice(T);
1325
+ }
1326
+ }
1327
+ let U = n.slice(k, r());
1328
+ i.loose || (c ? i.loose = true : this.rules.other.doubleBlankLine.test(U) && (c = true)), i.items.push({ type: "list_item", raw: U, task: !!this.options.gfm && this.rules.other.listIsTask.test(p), loose: false, text: p, tokens: [] });
1329
+ }
1330
+ let u = i.items.at(-1);
1331
+ if (u) u.raw = u.raw.trimEnd(), u.text = u.text.trimEnd();
1332
+ else return;
1333
+ i.raw = n.slice(0, r()).trimEnd();
1334
+ let d = [];
1335
+ for (let h of i.items) if (this.lexer.state.top = false, d.push(this.lexer.inlineQueue.length), h.tokens = this.lexer.blockTokens(h.text, []), !i.loose) {
1336
+ let p = h.tokens.filter((m) => m.type === "space"), k = p.length > 0 && p.some((m) => this.rules.other.anyLine.test(m.raw));
1337
+ i.loose = k;
1338
+ }
1339
+ for (let h = 0; h < i.items.length; h++) {
1340
+ let p = i.items[h], k = p.tokens[0];
1341
+ if (p.task && (k?.type === "text" || k?.type === "paragraph")) {
1342
+ p.text = p.text.replace(this.rules.other.listReplaceTask, ""), k.raw = k.raw.replace(this.rules.other.listReplaceTask, ""), k.text = k.text.replace(this.rules.other.listReplaceTask, "");
1343
+ let m = this.lexer.inlineQueue;
1344
+ for (let f = d[h]; f < m.length; f++) if (m[f].tokens === k.tokens) {
1345
+ m[f].src = m[f].src.replace(this.rules.other.listReplaceTask, "");
1346
+ break;
1347
+ }
1348
+ let b = this.rules.other.listTaskCheckbox.exec(p.raw);
1349
+ if (b) {
1350
+ let f = { type: "checkbox", raw: b[0] + " ", checked: b[0] !== "[ ]" };
1351
+ p.checked = f.checked, i.loose ? p.tokens[0] && ["paragraph", "text"].includes(p.tokens[0].type) && "tokens" in p.tokens[0] && p.tokens[0].tokens ? (p.tokens[0].raw = f.raw + p.tokens[0].raw, p.tokens[0].text = f.raw + p.tokens[0].text, p.tokens[0].tokens.unshift(f)) : p.tokens.unshift({ type: "paragraph", raw: f.raw, text: f.raw, tokens: [f] }) : p.tokens.unshift(f);
1352
+ }
1353
+ } else p.task && (p.task = false);
1354
+ }
1355
+ if (i.loose) for (let h of i.items) {
1356
+ h.loose = true;
1357
+ for (let p of h.tokens) p.type === "text" && (p.type = "paragraph");
1358
+ }
1359
+ return i;
1360
+ }
1361
+ }
1362
+ html(e) {
1363
+ let t = this.rules.block.html.exec(e);
1364
+ if (t) {
1365
+ if (this.lexer.state.lastToken?.type === "paragraph" && !this.rules.other.htmlBeginRegex(4).test(e)) return;
1366
+ let n = Re(t[0]);
1367
+ return { type: "html", block: true, raw: n, pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: n };
1368
+ }
1369
+ }
1370
+ def(e) {
1371
+ let t = this.rules.block.def.exec(e);
1372
+ if (t) {
1373
+ if (!this.rules.other.startAngleBracket.test(t[2]) && Te(t[2], "()") !== -1) return;
1374
+ let n = W(t[1]), r = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", s = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
1375
+ return { type: "def", tag: n, raw: C(t[0], `
1376
+ `), href: r, title: s };
1377
+ }
1378
+ }
1379
+ table(e) {
1380
+ let t = this.rules.block.table.exec(e);
1381
+ if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
1382
+ let n = be(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), s = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
1383
+ `) : [], o = { type: "table", raw: C(t[0], `
1384
+ `), header: [], align: [], rows: [] };
1385
+ if (n.length === r.length) {
1386
+ for (let i of r) 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);
1387
+ 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] });
1388
+ for (let i of s) o.rows.push(be(i, o.header.length).map((a, c) => ({ text: a, tokens: this.lexer.inline(a), header: false, align: o.align[c] })));
1389
+ return o;
1390
+ }
1391
+ }
1392
+ lheading(e) {
1393
+ let t = this.rules.block.lheading.exec(e);
1394
+ if (t) {
1395
+ let n = t[1].trim();
1396
+ return { type: "heading", raw: C(t[0], `
1397
+ `), depth: t[2].charAt(0) === "=" ? 1 : 2, text: n, tokens: this.lexer.inline(n) };
1398
+ }
1399
+ }
1400
+ paragraph(e) {
1401
+ let t = this.rules.block.paragraph.exec(e);
1402
+ if (t) {
1403
+ let n = t[1].charAt(t[1].length - 1) === `
1404
+ ` ? t[1].slice(0, -1) : t[1];
1405
+ return { type: "paragraph", raw: t[0], text: n, tokens: this.lexer.inline(n) };
1406
+ }
1407
+ }
1408
+ text(e) {
1409
+ let t = this.rules.block.text.exec(e);
1410
+ if (t) return { type: "text", raw: t[0], text: t[0], tokens: this.lexer.inline(t[0]) };
1411
+ }
1412
+ escape(e) {
1413
+ if (e.charCodeAt(0) !== 92) return;
1414
+ let t = this.rules.inline.escape.exec(e);
1415
+ if (t) return { type: "escape", raw: t[0], text: t[1] };
1416
+ }
1417
+ tag(e) {
1418
+ if (e.charCodeAt(0) !== 60) return;
1419
+ let t = this.rules.inline.tag.exec(e);
1420
+ 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] };
1421
+ }
1422
+ link(e) {
1423
+ if (this.lexer.state.linkParenPossible === false) return;
1424
+ let t = e.charCodeAt(0);
1425
+ if (t !== 91 && t !== 33) return;
1426
+ let n = this.rules.inline.link.exec(e);
1427
+ if (n) {
1428
+ let r = n[0].charAt(0) === "!" ? 2 : 1;
1429
+ if (!this.options.pedantic && Ze(e, n[1], r, this.rules)) return;
1430
+ let s = n[2].trim();
1431
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(s)) {
1432
+ if (!this.rules.other.endAngleBracket.test(s)) return;
1433
+ let c = C(s.slice(0, -1), "\\");
1434
+ if ((s.length - c.length) % 2 === 0) return;
1435
+ } else {
1436
+ let c = Te(n[2], "()");
1437
+ if (c === -2) return;
1438
+ if (c > -1) {
1439
+ let d = (n[0].indexOf("!") === 0 ? 5 : 4) + n[1].length + c;
1440
+ n[2] = n[2].substring(0, c), n[0] = n[0].substring(0, d).trim(), n[3] = "";
1441
+ }
1442
+ }
1443
+ let o = C(n[0].slice(0, -1), "\\");
1444
+ if ((n[0].length - o.length) % 2 === 0) return;
1445
+ let i = n[2], a = "";
1446
+ if (this.options.pedantic) {
1447
+ let c = this.rules.other.pedanticHrefTitle.exec(i);
1448
+ c && (i = c[1], a = c[3]);
1449
+ } else a = n[3] ? n[3].slice(1, -1) : "";
1450
+ return i = i.trim(), this.rules.other.startAngleBracket.test(i) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(s) ? i = i.slice(1) : i = i.slice(1, -1)), He(n, { href: i && i.replace(this.rules.inline.anyPunctuation, "$1"), title: a && a.replace(this.rules.inline.anyPunctuation, "$1") }, n[0], this.lexer, this.rules);
1451
+ }
1452
+ }
1453
+ reflink(e, t) {
1454
+ let n = e.charCodeAt(0);
1455
+ if (n !== 91 && n !== 33) return;
1456
+ let r;
1457
+ if ((r = this.rules.inline.reflink.exec(e)) || (r = this.rules.inline.nolink.exec(e))) {
1458
+ let s = r[0].charAt(0) === "!" ? 2 : 1;
1459
+ if (!this.options.pedantic && Ze(e, r[1], s, this.rules)) return;
1460
+ let o = t[W(r[2] || r[1])];
1461
+ if (!o) {
1462
+ let i = r[0].charAt(0);
1463
+ return { type: "text", raw: i, text: i };
1464
+ }
1465
+ return He(r, o, r[0], this.lexer, this.rules);
1466
+ }
1467
+ }
1468
+ emStrong(e, t, n = "") {
1469
+ let r = this.rules.inline.emStrongLDelim.exec(e);
1470
+ if (!r || !r[1] && !r[2] && !r[3] && !r[4]) return;
1471
+ let s = r[0][0], o = n === s, i = t.length - e.length, a = i;
1472
+ for (; !this.options.pedantic && a > 0 && t[a - 1] === s; ) a--;
1473
+ let c = [...t.slice(Math.max(0, a - 2), a)].at(-1) ?? "", u = c === "*" || c === "_" || !!this.rules.inline.punctuation.exec(c);
1474
+ a < i && (n = c);
1475
+ let d = a < i ? u : n === "*" || n === "_" || !!this.rules.inline.punctuation.exec(n);
1476
+ if (r[4] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
1477
+ let h = r[1] || r[3] || "";
1478
+ if (!h || !n || d) {
1479
+ let p = [...r[0]].length - 1, k, m, b = p, f = 0, R = i - a + p, E = !this.options.pedantic && !!c.trim() && (!!h || s === "*" && !u);
1480
+ if (s !== "*" && s !== "_") return;
1481
+ let T = s === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd, U = oe(this, t, s), H = t.length - e.length + p;
1482
+ if (U < H) return;
1483
+ t = t.slice(-1 * e.length + p);
1484
+ let K = U - H;
1485
+ for (T.lastIndex = 0; (r = T.exec(t)) !== null && !(r.index > K); ) {
1486
+ if (k = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !k) continue;
1487
+ if (m = [...k].length, r[3] || r[4]) {
1488
+ b += m;
1489
+ continue;
1490
+ } else if ((r[5] || r[6] || E) && R % 3 && !((R + m) % 3)) {
1491
+ if (o && (r[5] || r[6])) break;
1492
+ f += m;
1493
+ continue;
1494
+ }
1495
+ if (b -= m, b > 0) continue;
1496
+ m = Math.min(m, m + b + f);
1497
+ let re = [...r[0]][0].length, B = e.slice(0, p + r.index + re + m);
1498
+ if (Math.min(p, m) % 2) {
1499
+ let se = B.slice(1, -1);
1500
+ return { type: "em", raw: B, text: se, tokens: this.lexer.inlineTokens(se) };
1501
+ }
1502
+ let X = B.slice(2, -2);
1503
+ return { type: "strong", raw: B, text: X, tokens: this.lexer.inlineTokens(X) };
1504
+ }
1505
+ }
1506
+ }
1507
+ codespan(e) {
1508
+ if (e.charCodeAt(0) !== 96) return;
1509
+ let t = this.rules.inline.code.exec(e);
1510
+ if (t) {
1511
+ let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), r = this.rules.other.nonSpaceChar.test(n), s = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
1512
+ return r && s && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: t[0], text: n };
1513
+ }
1514
+ }
1515
+ br(e) {
1516
+ let t = e.charCodeAt(0);
1517
+ if (t !== 32 && t !== 92 && t !== 10) return;
1518
+ let n = this.rules.inline.br.exec(e);
1519
+ if (n) return { type: "br", raw: n[0] };
1520
+ }
1521
+ del(e, t, n = "") {
1522
+ if (e.charCodeAt(0) !== 126) return;
1523
+ let r = this.rules.inline.delLDelim.exec(e);
1524
+ if (!r) return;
1525
+ if (!(r[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
1526
+ let o = [...r[0]].length - 1, i, a, c = o, u = this.rules.inline.delRDelim, d = ae(this, t), h = t.length - e.length + o;
1527
+ if (d < h) return;
1528
+ t = t.slice(-1 * e.length + o);
1529
+ let p = d - h;
1530
+ for (u.lastIndex = 0; (r = u.exec(t)) !== null && !(r.index > p); ) {
1531
+ if (i = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !i || (a = [...i].length, a !== o)) continue;
1532
+ if (r[3] || r[4]) {
1533
+ c += a;
1534
+ continue;
1535
+ }
1536
+ if (c -= a, c > 0) continue;
1537
+ a = Math.min(a, a + c);
1538
+ let k = [...r[0]][0].length, m = e.slice(0, o + r.index + k + a), b = m.slice(o, -o);
1539
+ return { type: "del", raw: m, text: b, tokens: this.lexer.inlineTokens(b) };
1540
+ }
1541
+ }
1542
+ }
1543
+ autolink(e) {
1544
+ if (e.charCodeAt(0) !== 60) return;
1545
+ let t = this.rules.inline.autolink.exec(e);
1546
+ if (t) {
1547
+ let n, r;
1548
+ return t[2] === "@" ? (n = t[1], r = "mailto:" + n) : (n = t[1], r = n), { type: "link", raw: t[0], text: n, href: r, autolink: true, tokens: [{ type: "text", raw: n, text: n }] };
1549
+ }
1550
+ }
1551
+ url(e) {
1552
+ let t;
1553
+ if (t = this.rules.inline.url.exec(e)) {
1554
+ let n, r;
1555
+ if (t[2] === "@") n = t[0], r = "mailto:" + n;
1556
+ else {
1557
+ let s;
1558
+ do
1559
+ s = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
1560
+ while (s !== t[0]);
1561
+ n = t[0], t[1] === "www." ? r = "http://" + t[0] : r = t[0];
1562
+ }
1563
+ return { type: "link", raw: t[0], text: n, href: r, autolink: true, tokens: [{ type: "text", raw: n, text: n }] };
1564
+ }
1565
+ }
1566
+ inlineText(e) {
1567
+ let t = this.rules.inline.text.exec(e);
1568
+ if (t) {
1569
+ let n = this.lexer.state.inRawBlock;
1570
+ return { type: "text", raw: t[0], text: n ? t[0] : De(t[0]), escaped: n };
1571
+ }
1572
+ }
1573
+ };
1574
+ var w = class l {
1575
+ tokens;
1576
+ options;
1577
+ state;
1578
+ inlineQueue;
1579
+ tokenizer;
1580
+ constructor(e) {
1581
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || S, this.options.tokenizer = this.options.tokenizer || new _(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, linkEmitted: false, linkParenPossible: true, top: true };
1582
+ let t = { other: O, block: ee.normal, inline: F.normal };
1583
+ this.options.pedantic ? (t.block = ee.pedantic, t.inline = F.pedantic) : this.options.gfm && (t.block = ee.gfm, this.options.breaks ? t.inline = F.breaks : t.inline = F.gfm), this.tokenizer.rules = t;
1584
+ }
1585
+ static get rules() {
1586
+ return { block: ee, inline: F };
1587
+ }
1588
+ static lex(e, t) {
1589
+ return new l(t).lex(e);
1590
+ }
1591
+ static lexInline(e, t) {
1592
+ return new l(t).inlineTokens(e);
1593
+ }
1594
+ lex(e) {
1595
+ e = e.replace(O.carriageReturn, `
1596
+ `), this.blockTokens(e, this.tokens);
1597
+ for (let t = 0; t < this.inlineQueue.length; t++) {
1598
+ let n = this.inlineQueue[t];
1599
+ this.state.inRawBlock = false, this.inlineTokens(n.src, n.tokens);
1600
+ }
1601
+ return this.inlineQueue = [], this.tokens;
1602
+ }
1603
+ blockTokens(e, t = [], n = false) {
1604
+ this.tokenizer.lexer = this;
1605
+ let r = this.state.lastToken;
1606
+ this.options.pedantic && (e = e.replace(O.tabCharGlobal, " ").replace(O.spaceLine, ""));
1607
+ let s = 1 / 0, o, i = this.options.gfm && !this.options.pedantic && this.tokenizer.paragraph === _.prototype.paragraph;
1608
+ for (; e; ) {
1609
+ if (e.length < s) s = e.length;
1610
+ else {
1611
+ this.infiniteLoopError(e.charCodeAt(0));
1612
+ break;
1613
+ }
1614
+ this.state.lastToken = t.at(-1);
1615
+ let a;
1616
+ if (this.options.extensions?.block?.some((u) => (a = u.call({ lexer: this }, e, t)) ? (e = e.substring(a.raw.length), t.push(a), true) : false)) continue;
1617
+ if (a = this.tokenizer.space(e)) {
1618
+ e = e.substring(a.raw.length);
1619
+ let u = t.at(-1);
1620
+ a.raw.length === 1 && u !== void 0 ? u.raw += `
1621
+ ` : t.push(a);
1622
+ continue;
1623
+ }
1624
+ if (a = this.tokenizer.code(e)) {
1625
+ e = e.substring(a.raw.length);
1626
+ let u = t.at(-1);
1627
+ u?.type === "paragraph" || u?.type === "text" ? (u.raw += (u.raw.endsWith(`
1628
+ `) ? "" : `
1629
+ `) + a.raw, u.text += `
1630
+ ` + a.text, this.inlineQueue.at(-1).src = u.text) : t.push(a);
1631
+ continue;
1632
+ }
1633
+ if (a = this.tokenizer.fences(e)) {
1634
+ e = e.substring(a.raw.length), t.push(a);
1635
+ continue;
1636
+ }
1637
+ if (a = this.tokenizer.heading(e)) {
1638
+ e = e.substring(a.raw.length), t.push(a);
1639
+ continue;
1640
+ }
1641
+ if (a = this.tokenizer.hr(e)) {
1642
+ e = e.substring(a.raw.length), t.push(a);
1643
+ continue;
1644
+ }
1645
+ if (a = this.tokenizer.blockquote(e)) {
1646
+ e = e.substring(a.raw.length), t.push(a);
1647
+ continue;
1648
+ }
1649
+ if (a = this.tokenizer.list(e)) {
1650
+ e = e.substring(a.raw.length), t.push(a);
1651
+ continue;
1652
+ }
1653
+ if (a = this.tokenizer.html(e)) {
1654
+ e = e.substring(a.raw.length), t.push(a);
1655
+ continue;
1656
+ }
1657
+ if (a = this.tokenizer.def(e)) {
1658
+ e = e.substring(a.raw.length);
1659
+ let u = t.at(-1);
1660
+ u?.type === "paragraph" || u?.type === "text" ? (u.raw += (u.raw.endsWith(`
1661
+ `) ? "" : `
1662
+ `) + a.raw, u.text += `
1663
+ ` + a.raw, this.inlineQueue.at(-1).src = u.text) : (this.tokens.links[a.tag] || (this.tokens.links[a.tag] = { href: a.href, title: a.title }), t.push(a));
1664
+ continue;
1665
+ }
1666
+ if (a = this.tokenizer.table(e)) {
1667
+ e = e.substring(a.raw.length), t.push(a);
1668
+ continue;
1669
+ }
1670
+ if (a = this.tokenizer.lheading(e)) {
1671
+ e = e.substring(a.raw.length), t.push(a);
1672
+ continue;
1673
+ }
1674
+ let c = e;
1675
+ if (this.options.extensions?.startBlock) {
1676
+ let u = 1 / 0, d = e.slice(1), h;
1677
+ this.options.extensions.startBlock.forEach((p) => {
1678
+ h = p.call({ lexer: this }, d), typeof h == "number" && h >= 0 && (u = Math.min(u, h));
1679
+ }), u < 1 / 0 && u >= 0 && (c = e.substring(0, u + 1));
1680
+ }
1681
+ if (this.state.top && (a = this.tokenizer.paragraph(c))) {
1682
+ let u = t.at(-1);
1683
+ (n || u === o && i) && u?.type === "paragraph" ? (u.raw += (u.raw.endsWith(`
1684
+ `) ? "" : `
1685
+ `) + a.raw, u.text += `
1686
+ ` + a.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = u.text, o = u) : (t.push(a), o = a), n = c.length !== e.length, e = e.substring(a.raw.length);
1687
+ continue;
1688
+ }
1689
+ if (a = this.tokenizer.text(e)) {
1690
+ e = e.substring(a.raw.length);
1691
+ let u = t.at(-1);
1692
+ u?.type === "text" ? (u.raw += (u.raw.endsWith(`
1693
+ `) ? "" : `
1694
+ `) + a.raw, u.text += `
1695
+ ` + a.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = u.text) : t.push(a);
1696
+ continue;
1697
+ }
1698
+ if (e) {
1699
+ this.infiniteLoopError(e.charCodeAt(0));
1700
+ break;
1701
+ }
1702
+ }
1703
+ return this.state.top = true, this.state.lastToken = r, t;
1704
+ }
1705
+ inline(e, t = []) {
1706
+ return this.inlineQueue.push({ src: e, tokens: t }), t;
1707
+ }
1708
+ linkInText(e) {
1709
+ if (!e.includes("[")) return false;
1710
+ let t = this.tokenizer.rules.inline.link;
1711
+ for (let n of e.matchAll(this.tokenizer.rules.inline.blockSkip)) if (t.test(n[0]) && e.charAt(n.index - 1) !== "!") return true;
1712
+ for (let n of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)) {
1713
+ let r = n[0], s = r.lastIndexOf("[");
1714
+ if (!(r.charAt(0) === "!" || !Object.hasOwn(this.tokens.links, W(r.slice(s + 1, -1)))) && !(s > 1 && this.linkInText(r.slice(1, s - 1)))) return true;
1715
+ }
1716
+ return false;
1717
+ }
1718
+ inlineTokens(e, t = []) {
1719
+ this.tokenizer.lexer = this;
1720
+ let n = this.state.linkParenPossible;
1721
+ this.state.linkParenPossible = e.includes(")");
1722
+ try {
1723
+ return this.#t(e, t);
1724
+ } finally {
1725
+ this.state.linkParenPossible = n;
1726
+ }
1727
+ }
1728
+ #t(e, t) {
1729
+ let n = e.includes("*") || e.includes("_") || e.includes("~"), r = n || this.options.hooks?.emStrongMask || this.tokenizer.emStrong !== _.prototype.emStrong || this.tokenizer.del !== _.prototype.del ? this.#r(e) : e;
1730
+ if (!n) return this.#e(e, r, t);
1731
+ qe(this.tokenizer, r);
1732
+ try {
1733
+ return this.#e(e, r, t);
1734
+ } finally {
1735
+ ve(this.tokenizer);
1736
+ }
1737
+ }
1738
+ #e(e, t, n) {
1739
+ let r = false, s = "", o = 1 / 0;
1740
+ for (; e; ) {
1741
+ if (e.length < o) o = e.length;
1742
+ else {
1743
+ this.infiniteLoopError(e.charCodeAt(0));
1744
+ break;
1745
+ }
1746
+ r || (s = ""), r = false;
1747
+ let i;
1748
+ if (this.options.extensions?.inline?.some((u) => (i = u.call({ lexer: this }, e, n)) ? (e = e.substring(i.raw.length), n.push(i), true) : false)) continue;
1749
+ if (i = this.tokenizer.escape(e)) {
1750
+ e = e.substring(i.raw.length), n.push(i);
1751
+ continue;
1752
+ }
1753
+ if (i = this.tokenizer.tag(e)) {
1754
+ e = e.substring(i.raw.length), n.push(i);
1755
+ continue;
1756
+ }
1757
+ if (i = this.tokenizer.link(e)) {
1758
+ e = e.substring(i.raw.length), n.push(i);
1759
+ continue;
1760
+ }
1761
+ if (i = this.tokenizer.reflink(e, this.tokens.links)) {
1762
+ e = e.substring(i.raw.length);
1763
+ let u = n.at(-1);
1764
+ i.type === "text" && u?.type === "text" ? (u.raw += i.raw, u.text += i.text) : n.push(i);
1765
+ continue;
1766
+ }
1767
+ let a = e[0];
1768
+ if (a === "*" || a === "_") {
1769
+ let u = t.length - e.length;
1770
+ if (oe(this.tokenizer, t, a) <= u) {
1771
+ let h = 1;
1772
+ for (; h < e.length && e.charCodeAt(h) === a.charCodeAt(0); ) h++;
1773
+ let p = e.substring(0, h), k = n.at(-1);
1774
+ k?.type === "text" && !k.escaped ? (k.raw += p, k.text += p) : n.push({ type: "text", raw: p, text: p, escaped: false }), e = e.substring(h), s = a, r = true;
1775
+ continue;
1776
+ }
1777
+ } else if (a === "~") {
1778
+ let u = t.length - e.length;
1779
+ if (ae(this.tokenizer, t) <= u) {
1780
+ let h = 1;
1781
+ for (; h < e.length && e.charCodeAt(h) === 126; ) h++;
1782
+ let p = e.substring(0, h), k = n.at(-1);
1783
+ k?.type === "text" && !k.escaped ? (k.raw += p, k.text += p) : n.push({ type: "text", raw: p, text: p, escaped: false }), e = e.substring(h), s = a, r = true;
1784
+ continue;
1785
+ }
1786
+ }
1787
+ if (i = this.tokenizer.emStrong(e, t, s)) {
1788
+ e = e.substring(i.raw.length), n.push(i);
1789
+ continue;
1790
+ }
1791
+ if (i = this.tokenizer.codespan(e)) {
1792
+ e = e.substring(i.raw.length), n.push(i);
1793
+ continue;
1794
+ }
1795
+ if (i = this.tokenizer.br(e)) {
1796
+ e = e.substring(i.raw.length), n.push(i);
1797
+ continue;
1798
+ }
1799
+ if (i = this.tokenizer.del(e, t, s)) {
1800
+ e = e.substring(i.raw.length), n.push(i);
1801
+ continue;
1802
+ }
1803
+ if (i = this.tokenizer.autolink(e)) {
1804
+ e = e.substring(i.raw.length), n.push(i);
1805
+ continue;
1806
+ }
1807
+ if (!this.state.inLink && (i = this.tokenizer.url(e))) {
1808
+ e = e.substring(i.raw.length), n.push(i);
1809
+ continue;
1810
+ }
1811
+ let c = e;
1812
+ if (this.options.extensions?.startInline) {
1813
+ let u = 1 / 0, d = e.slice(1), h;
1814
+ this.options.extensions.startInline.forEach((p) => {
1815
+ h = p.call({ lexer: this }, d), typeof h == "number" && h >= 0 && (u = Math.min(u, h));
1816
+ }), u < 1 / 0 && u >= 0 && (c = e.substring(0, u + 1));
1817
+ }
1818
+ if (i = this.tokenizer.inlineText(c)) {
1819
+ e = e.substring(i.raw.length), i.raw.slice(-1) !== "_" && (s = i.raw.slice(-1)), r = true;
1820
+ let u = n.at(-1);
1821
+ u?.type === "text" ? (u.raw += i.raw, u.text += i.text) : n.push(i);
1822
+ continue;
1823
+ }
1824
+ if (e) {
1825
+ this.infiniteLoopError(e.charCodeAt(0));
1826
+ break;
1827
+ }
1828
+ }
1829
+ return n;
1830
+ }
1831
+ #n(e) {
1832
+ let { blockSkip: t, tag: n, autolink: r } = this.tokenizer.rules.inline, s = "", o = 0, i;
1833
+ for (t.lastIndex = 0; i = t.exec(e); ) {
1834
+ let a = i.index + (i[2] ? i[2].length : 0), c = i.index + i[0].length;
1835
+ if (e.charAt(a) === "<") {
1836
+ let u = e.slice(a), d = n.exec(u) || r.exec(u);
1837
+ if (!d) {
1838
+ t.lastIndex = a + 1;
1839
+ continue;
1840
+ }
1841
+ c = a + d[0].length, t.lastIndex = c;
1842
+ }
1843
+ s += e.slice(o, a) + "[" + "a".repeat(c - a - 2) + "]", o = c;
1844
+ }
1845
+ return s + e.slice(o);
1846
+ }
1847
+ #r(e) {
1848
+ let t = e;
1849
+ if (this.tokens.links && e.includes("[")) {
1850
+ let n = this.tokenizer.rules.inline.reflinkSearch, r = (s) => {
1851
+ let o = s.lastIndexOf("[");
1852
+ if (!Object.hasOwn(this.tokens.links, W(s.slice(o + 1, -1)))) return s;
1853
+ if (o > 1 && s.charAt(0) !== "!") {
1854
+ let i = s.slice(1, o - 1);
1855
+ if (this.linkInText(i)) return "[" + i.replace(n, r) + "][" + "a".repeat(s.length - o - 2) + "]";
1856
+ }
1857
+ return "[" + "a".repeat(s.length - 2) + "]";
1858
+ };
1859
+ t = t.replace(n, r);
1860
+ }
1861
+ return t = t.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode, (n, r, s) => s ? "+".repeat(n.length) : r ? r + n.slice(r.length, -r.length).replace(/`/g, "+") + r : n), t = this.#n(t), t = this.options.hooks?.emStrongMask?.call({ lexer: this }, t) ?? t, t;
1862
+ }
1863
+ infiniteLoopError(e) {
1864
+ let t = "Infinite loop on byte: " + e;
1865
+ if (this.options.silent) console.error(t);
1866
+ else throw new Error(t);
1867
+ }
1868
+ };
1869
+ var I = class {
1870
+ options;
1871
+ parser;
1872
+ constructor(e) {
1873
+ this.options = e || S;
1874
+ }
1875
+ space(e) {
1876
+ return "";
1877
+ }
1878
+ code({ text: e, lang: t, escaped: n }) {
1879
+ let r = (t || "").match(O.notSpaceStart)?.[0], s = e ? e.replace(O.endingNewline, "") + `
1880
+ ` : "";
1881
+ return r ? '<pre><code class="language-' + y(r) + '">' + (n ? s : y(s, true)) + `</code></pre>
1882
+ ` : "<pre><code>" + (n ? s : y(s, true)) + `</code></pre>
1883
+ `;
1884
+ }
1885
+ blockquote({ tokens: e }) {
1886
+ return `<blockquote>
1887
+ ${this.parser.parse(e)}</blockquote>
1888
+ `;
1889
+ }
1890
+ html({ text: e }) {
1891
+ return e;
1892
+ }
1893
+ def(e) {
1894
+ return "";
1895
+ }
1896
+ heading({ tokens: e, depth: t }) {
1897
+ return `<h${t}>${this.parser.parseInline(e)}</h${t}>
1898
+ `;
1899
+ }
1900
+ hr(e) {
1901
+ return `<hr>
1902
+ `;
1903
+ }
1904
+ list(e) {
1905
+ let t = e.ordered, n = e.start, r = "";
1906
+ for (let i = 0; i < e.items.length; i++) {
1907
+ let a = e.items[i];
1908
+ r += this.listitem(a);
1909
+ }
1910
+ let s = t ? "ol" : "ul", o = t && n !== 1 ? ' start="' + n + '"' : "";
1911
+ return "<" + s + o + `>
1912
+ ` + r + "</" + s + `>
1913
+ `;
1914
+ }
1915
+ listitem(e) {
1916
+ return `<li>${this.parser.parse(e.tokens)}</li>
1917
+ `;
1918
+ }
1919
+ checkbox({ checked: e }) {
1920
+ return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
1921
+ }
1922
+ paragraph({ tokens: e }) {
1923
+ return `<p>${this.parser.parseInline(e)}</p>
1924
+ `;
1925
+ }
1926
+ table(e) {
1927
+ let t = "", n = "";
1928
+ for (let s = 0; s < e.header.length; s++) n += this.tablecell(e.header[s]);
1929
+ t += this.tablerow({ text: n });
1930
+ let r = "";
1931
+ for (let s = 0; s < e.rows.length; s++) {
1932
+ let o = e.rows[s];
1933
+ n = "";
1934
+ for (let i = 0; i < o.length; i++) n += this.tablecell(o[i]);
1935
+ r += this.tablerow({ text: n });
1936
+ }
1937
+ return r && (r = `<tbody>${r}</tbody>`), `<table>
1938
+ <thead>
1939
+ ` + t + `</thead>
1940
+ ` + r + `</table>
1941
+ `;
1942
+ }
1943
+ tablerow({ text: e }) {
1944
+ return `<tr>
1945
+ ${e}</tr>
1946
+ `;
1947
+ }
1948
+ tablecell(e) {
1949
+ let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
1950
+ return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
1951
+ `;
1952
+ }
1953
+ strong({ tokens: e }) {
1954
+ return `<strong>${this.parser.parseInline(e)}</strong>`;
1955
+ }
1956
+ em({ tokens: e }) {
1957
+ return `<em>${this.parser.parseInline(e)}</em>`;
1958
+ }
1959
+ codespan({ text: e }) {
1960
+ return `<code>${y(e, true)}</code>`;
1961
+ }
1962
+ br(e) {
1963
+ return "<br>";
1964
+ }
1965
+ del({ tokens: e }) {
1966
+ return `<del>${this.parser.parseInline(e)}</del>`;
1967
+ }
1968
+ link({ href: e, title: t, text: n, tokens: r, autolink: s }) {
1969
+ let o = s ? y(n, true) : this.parser.parseInline(r), i = xe(e);
1970
+ if (i === null) return o;
1971
+ e = y(i, s);
1972
+ let a = '<a href="' + e + '"';
1973
+ return t && (a += ' title="' + y(t) + '"'), a += ">" + o + "</a>", a;
1974
+ }
1975
+ image({ href: e, title: t, text: n, tokens: r }) {
1976
+ r && (n = this.parser.parseInline(r, this.parser.textRenderer));
1977
+ let s = xe(e);
1978
+ if (s === null) return y(n);
1979
+ e = s;
1980
+ let o = `<img src="${y(e)}" alt="${y(n)}"`;
1981
+ return t && (o += ` title="${y(t)}"`), o += ">", o;
1982
+ }
1983
+ text(e) {
1984
+ return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : y(e.text);
1985
+ }
1986
+ };
1987
+ var z = class {
1988
+ parser;
1989
+ strong({ text: e, tokens: t }) {
1990
+ return t ? this.parser.parseInline(t, this) : e;
1991
+ }
1992
+ em({ text: e, tokens: t }) {
1993
+ return t ? this.parser.parseInline(t, this) : e;
1994
+ }
1995
+ codespan({ text: e }) {
1996
+ return e;
1997
+ }
1998
+ del({ text: e, tokens: t }) {
1999
+ return t ? this.parser.parseInline(t, this) : e;
2000
+ }
2001
+ html({ text: e }) {
2002
+ return e;
2003
+ }
2004
+ text({ text: e }) {
2005
+ return e;
2006
+ }
2007
+ link({ text: e, tokens: t }) {
2008
+ return t ? this.parser.parseInline(t, this) : e;
2009
+ }
2010
+ image({ text: e, tokens: t }) {
2011
+ return t ? this.parser.parseInline(t, this) : e;
2012
+ }
2013
+ br() {
2014
+ return `
2015
+ `;
2016
+ }
2017
+ checkbox({ raw: e }) {
2018
+ return e;
2019
+ }
2020
+ };
2021
+ var P = class l2 {
2022
+ options;
2023
+ renderer;
2024
+ textRenderer;
2025
+ constructor(e) {
2026
+ this.options = e || S, this.options.renderer = this.options.renderer || new I(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new z(), this.textRenderer.parser = this;
2027
+ }
2028
+ static parse(e, t) {
2029
+ return new l2(t).parse(e);
2030
+ }
2031
+ static parseInline(e, t) {
2032
+ return new l2(t).parseInline(e);
2033
+ }
2034
+ parse(e) {
2035
+ this.renderer.parser = this;
2036
+ let t = "";
2037
+ for (let n = 0; n < e.length; n++) {
2038
+ let r = e[n];
2039
+ if (this.options.extensions?.renderers?.[r.type]) {
2040
+ let o = r, i = this.options.extensions.renderers[o.type].call({ parser: this }, o);
2041
+ if (i !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "checkbox", "html", "def", "paragraph", "text"].includes(o.type)) {
2042
+ t += i === false ? "" : i ?? "";
2043
+ continue;
2044
+ }
2045
+ }
2046
+ let s = r;
2047
+ switch (s.type) {
2048
+ case "space": {
2049
+ t += this.renderer.space(s);
2050
+ break;
2051
+ }
2052
+ case "hr": {
2053
+ t += this.renderer.hr(s);
2054
+ break;
2055
+ }
2056
+ case "heading": {
2057
+ t += this.renderer.heading(s);
2058
+ break;
2059
+ }
2060
+ case "code": {
2061
+ t += this.renderer.code(s);
2062
+ break;
2063
+ }
2064
+ case "table": {
2065
+ t += this.renderer.table(s);
2066
+ break;
2067
+ }
2068
+ case "blockquote": {
2069
+ t += this.renderer.blockquote(s);
2070
+ break;
2071
+ }
2072
+ case "list": {
2073
+ t += this.renderer.list(s);
2074
+ break;
2075
+ }
2076
+ case "checkbox": {
2077
+ t += this.renderer.checkbox(s);
2078
+ break;
2079
+ }
2080
+ case "html": {
2081
+ t += this.renderer.html(s);
2082
+ break;
2083
+ }
2084
+ case "def": {
2085
+ t += this.renderer.def(s);
2086
+ break;
2087
+ }
2088
+ case "paragraph": {
2089
+ t += this.renderer.paragraph(s);
2090
+ break;
2091
+ }
2092
+ case "text": {
2093
+ t += this.renderer.text(s);
2094
+ break;
2095
+ }
2096
+ default: {
2097
+ let o = 'Token with "' + s.type + '" type was not found.';
2098
+ if (this.options.silent) return console.error(o), "";
2099
+ throw new Error(o);
2100
+ }
2101
+ }
2102
+ }
2103
+ return t;
2104
+ }
2105
+ parseInline(e, t = this.renderer) {
2106
+ this.renderer.parser = this;
2107
+ let n = "";
2108
+ for (let r = 0; r < e.length; r++) {
2109
+ let s = e[r];
2110
+ if (this.options.extensions?.renderers?.[s.type]) {
2111
+ let i = this.options.extensions.renderers[s.type].call({ parser: this }, s);
2112
+ if (i !== false || !["escape", "html", "link", "image", "checkbox", "strong", "em", "codespan", "br", "del", "text"].includes(s.type)) {
2113
+ n += i === false ? "" : i ?? "";
2114
+ continue;
2115
+ }
2116
+ }
2117
+ let o = s;
2118
+ switch (o.type) {
2119
+ case "escape": {
2120
+ n += t.text(o);
2121
+ break;
2122
+ }
2123
+ case "html": {
2124
+ n += t.html(o);
2125
+ break;
2126
+ }
2127
+ case "link": {
2128
+ n += t.link(o);
2129
+ break;
2130
+ }
2131
+ case "image": {
2132
+ n += t.image(o);
2133
+ break;
2134
+ }
2135
+ case "checkbox": {
2136
+ n += t.checkbox(o);
2137
+ break;
2138
+ }
2139
+ case "strong": {
2140
+ n += t.strong(o);
2141
+ break;
2142
+ }
2143
+ case "em": {
2144
+ n += t.em(o);
2145
+ break;
2146
+ }
2147
+ case "codespan": {
2148
+ n += t.codespan(o);
2149
+ break;
2150
+ }
2151
+ case "br": {
2152
+ n += t.br(o);
2153
+ break;
2154
+ }
2155
+ case "del": {
2156
+ n += t.del(o);
2157
+ break;
2158
+ }
2159
+ case "text": {
2160
+ n += t.text(o);
2161
+ break;
2162
+ }
2163
+ default: {
2164
+ let i = 'Token with "' + o.type + '" type was not found.';
2165
+ if (this.options.silent) return console.error(i), "";
2166
+ throw new Error(i);
2167
+ }
2168
+ }
2169
+ }
2170
+ return n;
2171
+ }
2172
+ };
2173
+ var A = class {
2174
+ options;
2175
+ block;
2176
+ constructor(e) {
2177
+ this.options = e || S;
2178
+ }
2179
+ static passThroughHooks = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
2180
+ static passThroughHooksRespectAsync = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"]);
2181
+ preprocess(e) {
2182
+ return e;
2183
+ }
2184
+ postprocess(e) {
2185
+ return e;
2186
+ }
2187
+ processAllTokens(e) {
2188
+ return e;
2189
+ }
2190
+ emStrongMask(e) {
2191
+ return e;
2192
+ }
2193
+ provideLexer(e = this.block) {
2194
+ return e ? w.lex : w.lexInline;
2195
+ }
2196
+ provideParser(e = this.block) {
2197
+ return e ? P.parse : P.parseInline;
2198
+ }
2199
+ };
2200
+ function M(l3, e) {
2201
+ if (Array.isArray(e)) for (let t = 0; t < e.length; t++) l3.push(e[t]);
2202
+ else l3.push(e);
2203
+ }
2204
+ var ne = class {
2205
+ defaults = G();
2206
+ options = this.setOptions;
2207
+ parse = this.parseMarkdown(true);
2208
+ parseInline = this.parseMarkdown(false);
2209
+ Parser = P;
2210
+ Renderer = I;
2211
+ TextRenderer = z;
2212
+ Lexer = w;
2213
+ Tokenizer = _;
2214
+ Hooks = A;
2215
+ constructor(...e) {
2216
+ this.use(...e);
2217
+ }
2218
+ walkTokens(e, t) {
2219
+ let n = [];
2220
+ for (let r of e) switch (M(n, t.call(this, r)), r.type) {
2221
+ case "table": {
2222
+ let s = r;
2223
+ for (let o of s.header) M(n, this.walkTokens(o.tokens, t));
2224
+ for (let o of s.rows) for (let i of o) M(n, this.walkTokens(i.tokens, t));
2225
+ break;
2226
+ }
2227
+ case "list": {
2228
+ let s = r;
2229
+ M(n, this.walkTokens(s.items, t));
2230
+ break;
2231
+ }
2232
+ default: {
2233
+ let s = r;
2234
+ this.defaults.extensions?.childTokens?.[s.type] ? this.defaults.extensions.childTokens[s.type].forEach((o) => {
2235
+ let i = s[o].flat(1 / 0);
2236
+ M(n, this.walkTokens(i, t));
2237
+ }) : s.tokens && M(n, this.walkTokens(s.tokens, t));
2238
+ }
2239
+ }
2240
+ return n;
2241
+ }
2242
+ use(...e) {
2243
+ let t = this.defaults.extensions || { renderers: /* @__PURE__ */ Object.create(null), childTokens: /* @__PURE__ */ Object.create(null) };
2244
+ return e.forEach((n) => {
2245
+ let r = { ...n };
2246
+ if (r.async = this.defaults.async || r.async || false, n.extensions && (n.extensions.forEach((s) => {
2247
+ if (!s.name) throw new Error("extension name required");
2248
+ if ("renderer" in s) {
2249
+ let o = t.renderers[s.name];
2250
+ o ? t.renderers[s.name] = function(...i) {
2251
+ let a = s.renderer.apply(this, i);
2252
+ return a === false && (a = o.apply(this, i)), a;
2253
+ } : t.renderers[s.name] = s.renderer;
2254
+ }
2255
+ if ("tokenizer" in s) {
2256
+ if (!s.level || s.level !== "block" && s.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
2257
+ let o = t[s.level];
2258
+ o ? o.unshift(s.tokenizer) : t[s.level] = [s.tokenizer], s.start && (s.level === "block" ? t.startBlock ? t.startBlock.push(s.start) : t.startBlock = [s.start] : s.level === "inline" && (t.startInline ? t.startInline.push(s.start) : t.startInline = [s.start]));
2259
+ }
2260
+ "childTokens" in s && s.childTokens && (t.childTokens[s.name] = s.childTokens);
2261
+ }), r.extensions = t), n.renderer) {
2262
+ let s = this.defaults.renderer || new I(this.defaults);
2263
+ for (let o in n.renderer) {
2264
+ if (!(o in s)) throw new Error(`renderer '${o}' does not exist`);
2265
+ if (["options", "parser"].includes(o)) continue;
2266
+ let i = o, a = n.renderer[i], c = s[i];
2267
+ s[i] = (...u) => {
2268
+ let d = a.apply(s, u);
2269
+ return d === false && (d = c.apply(s, u)), d === false ? "" : d ?? "";
2270
+ };
2271
+ }
2272
+ r.renderer = s;
2273
+ }
2274
+ if (n.tokenizer) {
2275
+ let s = this.defaults.tokenizer || new _(this.defaults);
2276
+ for (let o in n.tokenizer) {
2277
+ if (!(o in s)) throw new Error(`tokenizer '${o}' does not exist`);
2278
+ if (["options", "rules", "lexer"].includes(o)) continue;
2279
+ let i = o, a = n.tokenizer[i], c = s[i];
2280
+ s[i] = (...u) => {
2281
+ let d = a.apply(s, u);
2282
+ return d === false && (d = c.apply(s, u)), d;
2283
+ };
2284
+ }
2285
+ r.tokenizer = s;
2286
+ }
2287
+ if (n.hooks) {
2288
+ let s = this.defaults.hooks || new A();
2289
+ for (let o in n.hooks) {
2290
+ if (!(o in s)) throw new Error(`hook '${o}' does not exist`);
2291
+ if (["options", "block"].includes(o)) continue;
2292
+ let i = o, a = n.hooks[i], c = s[i];
2293
+ A.passThroughHooks.has(o) ? s[i] = (u) => {
2294
+ if (s.options.async && A.passThroughHooksRespectAsync.has(o)) return (async () => {
2295
+ let h = await a.call(s, u);
2296
+ return c.call(s, h);
2297
+ })();
2298
+ let d = a.call(s, u);
2299
+ return c.call(s, d);
2300
+ } : s[i] = (...u) => {
2301
+ if (s.options.async) return (async () => {
2302
+ let h = await a.apply(s, u);
2303
+ return h === false && (h = await c.apply(s, u)), h;
2304
+ })();
2305
+ let d = a.apply(s, u);
2306
+ return d === false && (d = c.apply(s, u)), d;
2307
+ };
2308
+ }
2309
+ r.hooks = s;
2310
+ }
2311
+ if (n.walkTokens) {
2312
+ let s = this.defaults.walkTokens, o = n.walkTokens;
2313
+ r.walkTokens = function(i) {
2314
+ let a = [];
2315
+ return M(a, o.call(this, i)), s && M(a, s.call(this, i)), a;
2316
+ };
2317
+ }
2318
+ this.defaults = { ...this.defaults, ...r };
2319
+ }), this;
2320
+ }
2321
+ setOptions(e) {
2322
+ return this.defaults = { ...this.defaults, ...e }, this;
2323
+ }
2324
+ lexer(e, t) {
2325
+ return w.lex(e, t ?? this.defaults);
2326
+ }
2327
+ parser(e, t) {
2328
+ return P.parse(e, t ?? this.defaults);
2329
+ }
2330
+ parseMarkdown(e) {
2331
+ return (n, r) => {
2332
+ let s = { ...r }, o = { ...this.defaults, ...s }, i = this.onError(!!o.silent, !!o.async);
2333
+ if (this.defaults.async === true && s.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."));
2334
+ if (typeof n > "u" || n === null) return i(new Error("marked(): input parameter is undefined or null"));
2335
+ if (typeof n != "string") return i(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
2336
+ if (o.hooks && (o.hooks.options = o, o.hooks.block = e), o.async) return (async () => {
2337
+ let a = o.hooks ? await o.hooks.preprocess(n) : n, u = await (o.hooks ? await o.hooks.provideLexer(e) : e ? w.lex : w.lexInline)(a, o), d = o.hooks ? await o.hooks.processAllTokens(u) : u;
2338
+ o.walkTokens && await Promise.all(this.walkTokens(d, o.walkTokens));
2339
+ let p = await (o.hooks ? await o.hooks.provideParser(e) : e ? P.parse : P.parseInline)(d, o);
2340
+ return o.hooks ? await o.hooks.postprocess(p) : p;
2341
+ })().catch(i);
2342
+ try {
2343
+ o.hooks && (n = o.hooks.preprocess(n));
2344
+ let c = (o.hooks ? o.hooks.provideLexer(e) : e ? w.lex : w.lexInline)(n, o);
2345
+ o.hooks && (c = o.hooks.processAllTokens(c)), o.walkTokens && this.walkTokens(c, o.walkTokens);
2346
+ let d = (o.hooks ? o.hooks.provideParser(e) : e ? P.parse : P.parseInline)(c, o);
2347
+ return o.hooks && (d = o.hooks.postprocess(d)), d;
2348
+ } catch (a) {
2349
+ return i(a);
2350
+ }
2351
+ };
2352
+ }
2353
+ onError(e, t) {
2354
+ return (n) => {
2355
+ if (n.message += `
2356
+ Please report this to https://github.com/markedjs/marked.`, e) {
2357
+ let r = "<p>An error occurred:</p><pre>" + y(n.message + "", true) + "</pre>";
2358
+ return t ? Promise.resolve(r) : r;
2359
+ }
2360
+ if (t) return Promise.reject(n);
2361
+ throw n;
2362
+ };
2363
+ }
2364
+ };
2365
+ var v = new ne();
2366
+ function x(l3, e) {
2367
+ return v.parse(l3, e);
2368
+ }
2369
+ x.options = x.setOptions = function(l3) {
2370
+ return v.setOptions(l3), x.defaults = v.defaults, ue(x.defaults), x;
2371
+ };
2372
+ x.getDefaults = G;
2373
+ x.defaults = S;
2374
+ function jt(...l3) {
2375
+ return v.use(...l3), x.defaults = v.defaults, ue(x.defaults), x;
2376
+ }
2377
+ x.use = jt;
2378
+ x.walkTokens = function(l3, e) {
2379
+ return v.walkTokens(l3, e);
2380
+ };
2381
+ x.parseInline = v.parseInline;
2382
+ x.Parser = P;
2383
+ x.parser = P.parse;
2384
+ x.Renderer = I;
2385
+ x.TextRenderer = z;
2386
+ x.Lexer = w;
2387
+ x.lexer = w.lex;
2388
+ x.Tokenizer = _;
2389
+ x.Hooks = A;
2390
+ x.parse = x;
2391
+ var En = x.options;
2392
+ var zn = x.setOptions;
2393
+ var Mn = x.walkTokens;
2394
+ var Bn = x.parseInline;
2395
+ var qn = P.parse;
2396
+ var vn = w.lex;
2397
+
2398
+ // taskflow-source:src/client/components/markdown-preview.jsx
2399
+ var safeHref = (href) => {
2400
+ try {
2401
+ const u = new URL(href);
2402
+ return ["http:", "https:", "mailto:"].includes(u.protocol) && !u.username && !u.password ? href : null;
2403
+ } catch {
2404
+ return href.startsWith("#") ? href : null;
2405
+ }
2406
+ };
2407
+ function MarkdownPreview({ text, label = "Markdown 文档预览" }) {
2408
+ const nodes = (0, import_react13.useMemo)(() => {
2409
+ const render = (tokens, depth = 0) => depth > 64 ? null : tokens.map((t, i) => {
2410
+ const inner = () => t.tokens ? render(t.tokens, depth + 1) : t.text;
2411
+ switch (t.type) {
2412
+ case "space":
2413
+ return null;
2414
+ case "heading":
2415
+ return import_react13.default.createElement(`h${t.depth}`, { key: i }, inner());
2416
+ case "paragraph":
2417
+ return /* @__PURE__ */ import_react13.default.createElement("p", { key: i }, inner());
2418
+ case "strong":
2419
+ return /* @__PURE__ */ import_react13.default.createElement("strong", { key: i }, inner());
2420
+ case "em":
2421
+ return /* @__PURE__ */ import_react13.default.createElement("em", { key: i }, inner());
2422
+ case "del":
2423
+ return /* @__PURE__ */ import_react13.default.createElement("del", { key: i }, inner());
2424
+ case "code":
2425
+ return /* @__PURE__ */ import_react13.default.createElement("pre", { key: i }, /* @__PURE__ */ import_react13.default.createElement("code", null, t.text));
2426
+ case "codespan":
2427
+ return /* @__PURE__ */ import_react13.default.createElement("code", { key: i }, t.text);
2428
+ case "blockquote":
2429
+ return /* @__PURE__ */ import_react13.default.createElement("blockquote", { key: i }, inner());
2430
+ case "br":
2431
+ return /* @__PURE__ */ import_react13.default.createElement("br", { key: i });
2432
+ case "hr":
2433
+ return /* @__PURE__ */ import_react13.default.createElement("hr", { key: i });
2434
+ case "link": {
2435
+ const href = safeHref(t.href);
2436
+ return href ? /* @__PURE__ */ import_react13.default.createElement("a", { key: i, href, target: "_blank", rel: "noopener noreferrer" }, inner()) : /* @__PURE__ */ import_react13.default.createElement("span", { key: i }, inner());
2437
+ }
2438
+ case "image":
2439
+ return /* @__PURE__ */ import_react13.default.createElement("span", { key: i, className: "tf-markdown-image" }, "[图片:", t.text || "未命名", "]");
2440
+ case "list":
2441
+ return import_react13.default.createElement(t.ordered ? "ol" : "ul", { key: i, start: t.ordered ? t.start : void 0 }, t.items.map((item, j) => /* @__PURE__ */ import_react13.default.createElement("li", { key: j }, item.task && /* @__PURE__ */ import_react13.default.createElement("input", { type: "checkbox", checked: !!item.checked, readOnly: true, "aria-label": item.checked ? "已完成" : "未完成" }), " ", render(item.tokens, depth + 1))));
2442
+ case "table":
2443
+ return /* @__PURE__ */ import_react13.default.createElement("div", { className: "tf-markdown-table", key: i }, /* @__PURE__ */ import_react13.default.createElement("table", null, /* @__PURE__ */ import_react13.default.createElement("thead", null, /* @__PURE__ */ import_react13.default.createElement("tr", null, t.header.map((c, j) => /* @__PURE__ */ import_react13.default.createElement("th", { key: j }, render(c.tokens, depth + 1))))), /* @__PURE__ */ import_react13.default.createElement("tbody", null, t.rows.map((row, j) => /* @__PURE__ */ import_react13.default.createElement("tr", { key: j }, row.map((c, k) => /* @__PURE__ */ import_react13.default.createElement("td", { key: k }, render(c.tokens, depth + 1))))))));
2444
+ default:
2445
+ return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, { key: i }, t.type === "html" ? t.raw : inner() ?? t.raw);
2446
+ }
2447
+ });
2448
+ try {
2449
+ return render(x.lexer(text, { gfm: true }));
2450
+ } catch {
2451
+ return /* @__PURE__ */ import_react13.default.createElement("pre", null, text);
2452
+ }
2453
+ }, [text]);
2454
+ return /* @__PURE__ */ import_react13.default.createElement("article", { className: "tf-markdown-preview", "aria-label": label }, nodes);
2455
+ }
2456
+
2457
+ // taskflow-source:src/client/components/execution-record.jsx
2458
+ var labels = { requirements: "任务要求", status: "执行状态", progress: "阶段进展", "model-call": "模型调用", "model-output": "模型输出", "tool-call": "工具调用", "tool-result": "工具结果", result: "最终结果", process: "执行记录" };
2459
+ function executionRecord(data) {
2460
+ const source = data?.source, summary = source?.summary;
2461
+ if (source?.kind !== "taskflow" || typeof summary !== "string" || !/^T-\d+\s/.test(summary)) return null;
2462
+ const text = (data.content ?? []).filter((block) => block.type === "text").map((block) => block.text).join("\n");
2463
+ if (!text.trim()) return null;
2464
+ const detail = source.record ?? {};
2465
+ const category = detail.category in labels ? detail.category : /任务要求$/.test(summary) ? "requirements" : /最终结果|已完成$/.test(summary) ? "result" : /^执行工具:/.test(text) ? "tool-call" : /执行状态$/.test(summary) ? "status" : /执行进展$/.test(summary) ? "progress" : "process";
2466
+ return { ...detail, taskId: summary.match(/^T-\d+/)[0], category, text, categoryLabel: labels[category] };
2467
+ }
2468
+ function formattedJson(text) {
2469
+ try {
2470
+ return JSON.stringify(JSON.parse(text), null, 2);
2471
+ } catch {
2472
+ return null;
2473
+ }
2474
+ }
2475
+ function ExecutionRecord({ data }) {
2476
+ const record = executionRecord(data), [expanded, setExpanded] = (0, import_react14.useState)(true);
2477
+ if (!record) return null;
2478
+ const { text, category, categoryLabel, taskId } = record;
2479
+ const tool = record.tool || text.match(/^执行工具:([^\n]+)/)?.[1];
2480
+ const input = category === "tool-call" ? text.replace(/^执行工具:[^\n]*\n?/, "") : null;
2481
+ const json = input === null && category === "tool-result" ? formattedJson(text) : null;
2482
+ return /* @__PURE__ */ import_react14.default.createElement("section", { className: "tf-execution-record", "data-taskflow-record": category }, /* @__PURE__ */ import_react14.default.createElement("button", { type: "button", className: "tf-record-heading", "aria-expanded": expanded, onClick: () => setExpanded((value) => !value) }, /* @__PURE__ */ import_react14.default.createElement("span", { className: "tf-record-marker", "aria-hidden": "true" }, category === "tool-call" ? "↗" : category === "tool-result" ? "↙" : "•"), /* @__PURE__ */ import_react14.default.createElement("strong", null, categoryLabel), /* @__PURE__ */ import_react14.default.createElement("span", { className: "tf-record-task" }, taskId), tool && /* @__PURE__ */ import_react14.default.createElement("code", null, tool), record.status === "failed" && /* @__PURE__ */ import_react14.default.createElement("span", { className: "tf-error" }, "失败"), Number.isFinite(record.durationMs) && /* @__PURE__ */ import_react14.default.createElement("span", { className: "tf-record-duration" }, (record.durationMs / 1e3).toFixed(1), "s"), /* @__PURE__ */ import_react14.default.createElement("span", { className: "tf-record-chevron", "aria-hidden": "true" }, expanded ? "⌃" : "⌄")), expanded && /* @__PURE__ */ import_react14.default.createElement("div", { className: "tf-record-body" }, record.model?.provider && record.model?.model && /* @__PURE__ */ import_react14.default.createElement("p", { className: "tf-record-model" }, record.model.provider, " / ", record.model.model), input !== null ? /* @__PURE__ */ import_react14.default.createElement("pre", { "aria-label": "工具调用参数" }, /* @__PURE__ */ import_react14.default.createElement("code", null, formattedJson(input) ?? input)) : json !== null ? /* @__PURE__ */ import_react14.default.createElement("pre", { "aria-label": "工具返回结果" }, /* @__PURE__ */ import_react14.default.createElement("code", null, json)) : /* @__PURE__ */ import_react14.default.createElement(MarkdownPreview, { text, label: "执行内容" })));
2483
+ }
2484
+ function registerExecutionRecords(ctx) {
2485
+ const slots = ctx.slots, seat = "conversation.chat.node";
2486
+ if (typeof slots.entries !== "function" || typeof slots.subscribe !== "function") return;
2487
+ ctx.effect(() => slots.inject(seat, () => {
2488
+ const ours = /* @__PURE__ */ new Set();
2489
+ let original, remove, disposed = false;
2490
+ const refresh = () => {
2491
+ if (disposed) return;
2492
+ const entry = slots.entries(seat).find((candidate) => candidate.options.key === "context" && !ours.has(candidate.component));
2493
+ if (entry === original) return;
2494
+ original = entry;
2495
+ remove?.();
2496
+ remove = void 0;
2497
+ if (!entry) return;
2498
+ const Original = entry.component;
2499
+ function RecordOrContext(props) {
2500
+ return executionRecord(props.node?.data) ? /* @__PURE__ */ import_react14.default.createElement(ExecutionRecord, { data: props.node.data }) : /* @__PURE__ */ import_react14.default.createElement(Original, { ...props });
2501
+ }
2502
+ ours.add(RecordOrContext);
2503
+ remove = slots.register({ name: seat, key: "context", priority: (entry.options.priority ?? 0) - 1, locale: entry.locale, inject: entry.inject }, RecordOrContext);
2504
+ };
2505
+ const unsubscribe = slots.subscribe(seat, refresh);
2506
+ refresh();
2507
+ return () => {
2508
+ disposed = true;
2509
+ unsubscribe();
2510
+ remove?.();
2511
+ };
2512
+ }));
2513
+ }
2514
+
895
2515
  // taskflow-source:src/client/index.jsx
896
2516
  var inject = ["slots", "sessions", "connection"];
897
2517
  function createApi(connection) {
@@ -903,6 +2523,7 @@ function createApi(connection) {
903
2523
  return { view: (sessionId) => call("taskflow/view", { sessionId }), action: (sessionId, action, data) => call("taskflow/action", { sessionId, action, ...data }) };
904
2524
  }
905
2525
  function apply(ctx) {
2526
+ registerExecutionRecords(ctx);
906
2527
  const api = createApi(ctx.connection), renderers = /* @__PURE__ */ new Map();
907
2528
  const panels = /* @__PURE__ */ new Map(), panelListeners = /* @__PURE__ */ new Set();
908
2529
  const updatePanel = (key, value) => {
@@ -946,51 +2567,51 @@ function apply(ctx) {
946
2567
  throw new Error("负责会话尚未就绪,请返回父会话后增补事项");
947
2568
  };
948
2569
  function Panel(props) {
949
- const view = useTaskflow(api, props.sessionId), tabInfo = props.useTabInfo?.(), key = (0, import_react13.useRef)(Symbol());
2570
+ const view = useTaskflow(api, props.sessionId), tabInfo = props.useTabInfo?.(), key = (0, import_react15.useRef)(Symbol());
950
2571
  const visible = tabInfo?.tab.visible;
951
2572
  const compact = useCompactChecklist(visible === true && !tabInfo?.sidebar?.fullscreen && !tabInfo?.panel?.isFloating);
952
- (0, import_react13.useEffect)(() => {
2573
+ (0, import_react15.useEffect)(() => {
953
2574
  if (tabInfo) updatePanel(key.current, { sid: props.sessionId, visible });
954
2575
  return () => updatePanel(key.current);
955
2576
  }, [props.sessionId, visible]);
956
2577
  const recordTask = Object.values(view.plan?.tasks ?? {}).find((t) => t.recordSession?.id === props.sessionId || t.recordHistory?.some((r) => r.id === props.sessionId));
957
- return /* @__PURE__ */ import_react13.default.createElement("div", { ref: compact.anchor, className: "tf-checklist-root" }, /* @__PURE__ */ import_react13.default.createElement(TaskPanel, { view, sessionId: props.sessionId, action: (type, data) => api.action(props.sessionId, type, data), navigate: (id) => scope.uiWorkspace.openSession(id), augment: (value) => augment(props, value, recordTask && executionTarget(view.plan, recordTask)) }), compact.panel && (0, import_react_dom4.createPortal)(/* @__PURE__ */ import_react13.default.createElement("div", { className: "tf-checklist-resizer", ...compact.separator }), compact.panel), compact.dragging && (0, import_react_dom4.createPortal)(/* @__PURE__ */ import_react13.default.createElement("div", { className: "tf-checklist-resize-shield" }), document.body));
2578
+ return /* @__PURE__ */ import_react15.default.createElement("div", { ref: compact.anchor, className: "tf-checklist-root" }, /* @__PURE__ */ import_react15.default.createElement(TaskPanel, { view, sessionId: props.sessionId, action: (type, data) => api.action(props.sessionId, type, data), navigate: (id) => scope.uiWorkspace.openSession(id), augment: (value) => augment(props, value, recordTask && executionTarget(view.plan, recordTask)) }), compact.panel && (0, import_react_dom4.createPortal)(/* @__PURE__ */ import_react15.default.createElement("div", { className: "tf-checklist-resizer", ...compact.separator }), compact.panel), compact.dragging && (0, import_react_dom4.createPortal)(/* @__PURE__ */ import_react15.default.createElement("div", { className: "tf-checklist-resize-shield" }), document.body));
958
2579
  }
959
2580
  register("sidebar.right.pane.tab", { key: "dsh-taskflow" }, Panel);
960
2581
  function Tree(props) {
961
2582
  const current = scope.sidebarRight.mounted;
962
- const sid = (0, import_react13.useSyncExternalStore)(current ? (listener) => current.subscribe(listener) : () => () => {
2583
+ const sid = (0, import_react15.useSyncExternalStore)(current ? (listener) => current.subscribe(listener) : () => () => {
963
2584
  }, current ? () => current.getSnapshot() : () => null);
964
- return /* @__PURE__ */ import_react13.default.createElement(SessionTree, { api, sessionId: props.sessionId, currentSessionId: sid, navigate: (target) => scope.uiWorkspace.openSession(target) });
2585
+ return /* @__PURE__ */ import_react15.default.createElement(SessionTree, { api, sessionId: props.sessionId, currentSessionId: sid, navigate: (target) => scope.uiWorkspace.openSession(target) });
965
2586
  }
966
2587
  register("sidebar.session.row.trailing", { id: "taskflow-children", order: 10 }, Tree);
967
2588
  function Replies(props) {
968
2589
  const current = scope.sidebarRight.mounted;
969
- const foreground = (0, import_react13.useSyncExternalStore)(current ? (listener) => current.subscribe(listener) : () => () => {
2590
+ const foreground = (0, import_react15.useSyncExternalStore)(current ? (listener) => current.subscribe(listener) : () => () => {
970
2591
  }, current ? () => current.getSnapshot() === props.sessionId : () => true);
971
- return /* @__PURE__ */ import_react13.default.createElement(QuickReplies, { key: props.sessionId, api, ...props, foreground, focus: () => {
2592
+ return /* @__PURE__ */ import_react15.default.createElement(QuickReplies, { key: props.sessionId, api, ...props, foreground, focus: () => {
972
2593
  const binding = ctx.sessions.binding(props.sessionId);
973
2594
  if (binding) ctx.conversation?.input?.for(binding.ctx)?.focus();
974
2595
  } });
975
2596
  }
976
2597
  register("conversation.input.dock", { id: "taskflow-quick-replies", order: -10 }, Replies);
977
2598
  function SessionEntry(props) {
978
- const entryAnchor = (0, import_react13.useRef)(null), entryTarget = useHeaderEntryTarget(entryAnchor);
979
- const panelVisible = (0, import_react13.useSyncExternalStore)((fn) => {
2599
+ const entryAnchor = (0, import_react15.useRef)(null), entryTarget = useHeaderEntryTarget(entryAnchor);
2600
+ const panelVisible = (0, import_react15.useSyncExternalStore)((fn) => {
980
2601
  panelListeners.add(fn);
981
2602
  return () => panelListeners.delete(fn);
982
2603
  }, () => [...panels.values()].some((p) => p.sid === props.sessionId && p.visible));
983
2604
  const current = scope.sidebarRight.mounted;
984
- const foreground = (0, import_react13.useSyncExternalStore)(current ? (listener) => current.subscribe(listener) : () => () => {
2605
+ const foreground = (0, import_react15.useSyncExternalStore)(current ? (listener) => current.subscribe(listener) : () => () => {
985
2606
  }, current ? () => current.getSnapshot() === props.sessionId : () => true);
986
- const view = useTaskflow(api, props.sessionId), [mount, setMount] = (0, import_react13.useState)(null), [showTool, setShowTool] = (0, import_react13.useState)(true), [, refreshEntry] = (0, import_react13.useState)(0), autoOpened = (0, import_react13.useRef)(false);
987
- (0, import_react13.useEffect)(() => {
2607
+ const view = useTaskflow(api, props.sessionId), [mount, setMount] = (0, import_react15.useState)(null), [showTool, setShowTool] = (0, import_react15.useState)(true), [, refreshEntry] = (0, import_react15.useState)(0), autoOpened = (0, import_react15.useRef)(false);
2608
+ (0, import_react15.useEffect)(() => {
988
2609
  if (mount) mount.parentElement?.classList.toggle("tf-tool-show-tool", showTool);
989
2610
  }, [mount, showTool]);
990
- (0, import_react13.useEffect)(() => {
2611
+ (0, import_react15.useEffect)(() => {
991
2612
  if (view.tool?.open) setShowTool(true);
992
2613
  }, [view.tool?.open, props.sessionId]);
993
- (0, import_react13.useEffect)(() => {
2614
+ (0, import_react15.useEffect)(() => {
994
2615
  if (view.plan && !autoOpened.current) {
995
2616
  try {
996
2617
  scope.sidebarRight.openTab("taskflow");
@@ -999,10 +2620,10 @@ function apply(ctx) {
999
2620
  }
1000
2621
  }
1001
2622
  }, [view.plan?.id, props.sessionId]);
1002
- (0, import_react13.useEffect)(() => {
2623
+ (0, import_react15.useEffect)(() => {
1003
2624
  autoOpened.current = false;
1004
2625
  }, [props.sessionId]);
1005
- (0, import_react13.useEffect)(() => {
2626
+ (0, import_react15.useEffect)(() => {
1006
2627
  if (!view.tool?.open) {
1007
2628
  setMount(null);
1008
2629
  return;
@@ -1041,15 +2662,15 @@ function apply(ctx) {
1041
2662
  }, [view.tool?.open, props.sessionId]);
1042
2663
  const renderer = (tool, file) => {
1043
2664
  const Renderer = renderers.get(file?.format) || renderers.get(tool.kind);
1044
- return Renderer ? /* @__PURE__ */ import_react13.default.createElement(Renderer, { tool, file, sessionId: props.sessionId }) : null;
2665
+ return Renderer ? /* @__PURE__ */ import_react15.default.createElement(Renderer, { tool, file, sessionId: props.sessionId }) : null;
1045
2666
  };
1046
2667
  const expanded = scope.sidebarRight.isExpanded() && (panelVisible || scope.sidebarRight.active()?.kind === "taskflow");
1047
- const entry = /* @__PURE__ */ import_react13.default.createElement("button", { type: "button", className: "tf-entry", title: expanded ? "收起待办任务清单" : "展开待办任务清单", "aria-label": "待办任务清单", "aria-expanded": expanded, onClick: () => {
2668
+ const entry = /* @__PURE__ */ import_react15.default.createElement("button", { type: "button", className: "tf-entry", title: expanded ? "收起待办任务清单" : "展开待办任务清单", "aria-label": "待办任务清单", "aria-expanded": expanded, onClick: () => {
1048
2669
  if (scope.sidebarRight.isExpanded() && (panelVisible || scope.sidebarRight.active()?.kind === "taskflow")) scope.sidebarRight.toggleExpanded();
1049
2670
  else scope.sidebarRight.openTab("taskflow");
1050
2671
  refreshEntry((n) => n + 1);
1051
- } }, /* @__PURE__ */ import_react13.default.createElement(TaskIcon, null), /* @__PURE__ */ import_react13.default.createElement("span", null, "任务"));
1052
- return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement("span", { ref: entryAnchor, className: "tf-entry-anchor" }, entryTarget ? (0, import_react_dom4.createPortal)(entry, entryTarget) : entry), view.tool?.open && /* @__PURE__ */ import_react13.default.createElement("span", { className: "tf-mobile-view" }, /* @__PURE__ */ import_react13.default.createElement("button", { "aria-pressed": !showTool, onClick: () => setShowTool(false) }, "看对话"), /* @__PURE__ */ import_react13.default.createElement("button", { "aria-pressed": showTool, onClick: () => setShowTool(true) }, "看工具")), mount && (0, import_react_dom4.createPortal)(/* @__PURE__ */ import_react13.default.createElement(ToolPanel, { key: props.sessionId, sessionId: props.sessionId, mount, tool: view.tool, onClose: () => void api.action(props.sessionId, "close-view", {}), renderer, openers, foreground }), mount));
2672
+ } }, /* @__PURE__ */ import_react15.default.createElement(TaskIcon, null), /* @__PURE__ */ import_react15.default.createElement("span", null, "任务"));
2673
+ return /* @__PURE__ */ import_react15.default.createElement(import_react15.default.Fragment, null, /* @__PURE__ */ import_react15.default.createElement("span", { ref: entryAnchor, className: "tf-entry-anchor" }, entryTarget ? (0, import_react_dom4.createPortal)(entry, entryTarget) : entry), view.tool?.open && /* @__PURE__ */ import_react15.default.createElement("span", { className: "tf-mobile-view" }, /* @__PURE__ */ import_react15.default.createElement("button", { "aria-pressed": !showTool, onClick: () => setShowTool(false) }, "看对话"), /* @__PURE__ */ import_react15.default.createElement("button", { "aria-pressed": showTool, onClick: () => setShowTool(true) }, "看工具")), mount && (0, import_react_dom4.createPortal)(/* @__PURE__ */ import_react15.default.createElement(ToolPanel, { key: props.sessionId, sessionId: props.sessionId, mount, tool: view.tool, onClose: () => void api.action(props.sessionId, "close-view", {}), renderer, openers, foreground }), mount));
1053
2674
  }
1054
2675
  register("conversation.session.header.utilities", { id: "taskflow", order: -5 }, SessionEntry);
1055
2676
  });