@dsh-plus/lifeboat 0.2.2 → 0.2.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/lib/client.js +686 -76
- package/lib/index.js +11 -3
- package/lib/style.css +90 -78
- package/package.json +9 -9
- package/src/fallback-llm.ts +20 -5
package/lib/client.js
CHANGED
|
@@ -17894,20 +17894,20 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
17894
17894
|
json_default = [lang$31];
|
|
17895
17895
|
}));
|
|
17896
17896
|
//#endregion
|
|
17897
|
-
//#region ../../node_modules/.pnpm/@deepseek-ai+dsh-client-ui-primitives@0.1.
|
|
17897
|
+
//#region ../../node_modules/.pnpm/@deepseek-ai+dsh-client-ui-primitives@0.1.3-alpha.2_@deepseek-ai+cordis@4.0.2/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/DiffBlock.module.css
|
|
17898
17898
|
var DiffBlock_module_default;
|
|
17899
17899
|
var init_DiffBlock_module = __esmMin((() => {
|
|
17900
17900
|
DiffBlock_module_default = {
|
|
17901
|
-
"add": "
|
|
17902
|
-
"block": "
|
|
17903
|
-
"body": "
|
|
17904
|
-
"copyButton": "
|
|
17905
|
-
"del": "
|
|
17906
|
-
"expand": "
|
|
17907
|
-
"footer": "
|
|
17908
|
-
"gap": "
|
|
17909
|
-
"line": "
|
|
17910
|
-
"path": "
|
|
17901
|
+
"add": "obLtqa_add",
|
|
17902
|
+
"block": "obLtqa_block",
|
|
17903
|
+
"body": "obLtqa_body",
|
|
17904
|
+
"copyButton": "obLtqa_copyButton",
|
|
17905
|
+
"del": "obLtqa_del",
|
|
17906
|
+
"expand": "obLtqa_expand",
|
|
17907
|
+
"footer": "obLtqa_footer",
|
|
17908
|
+
"gap": "obLtqa_gap",
|
|
17909
|
+
"line": "obLtqa_line",
|
|
17910
|
+
"path": "obLtqa_path"
|
|
17911
17911
|
};
|
|
17912
17912
|
}));
|
|
17913
17913
|
//#endregion
|
|
@@ -58054,31 +58054,32 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
58054
58054
|
init_types();
|
|
58055
58055
|
}));
|
|
58056
58056
|
//#endregion
|
|
58057
|
-
//#region ../../node_modules/.pnpm/@deepseek-ai+dsh-client-ui-primitives@0.1.
|
|
58057
|
+
//#region ../../node_modules/.pnpm/@deepseek-ai+dsh-client-ui-primitives@0.1.3-alpha.2_@deepseek-ai+cordis@4.0.2/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/markdown/CodeBlock.module.css
|
|
58058
58058
|
var CodeBlock_module_default;
|
|
58059
58059
|
var init_CodeBlock_module = __esmMin((() => {
|
|
58060
58060
|
CodeBlock_module_default = {
|
|
58061
|
-
"action": "
|
|
58062
|
-
"banner": "
|
|
58063
|
-
"bannerWrap": "
|
|
58064
|
-
"block": "
|
|
58065
|
-
"copyButton": "
|
|
58066
|
-
"infostring": "
|
|
58067
|
-
"plain": "
|
|
58068
|
-
"shiki": "
|
|
58061
|
+
"action": "folzqq_action",
|
|
58062
|
+
"banner": "folzqq_banner",
|
|
58063
|
+
"bannerWrap": "folzqq_bannerWrap",
|
|
58064
|
+
"block": "folzqq_block",
|
|
58065
|
+
"copyButton": "folzqq_copyButton",
|
|
58066
|
+
"infostring": "folzqq_infostring",
|
|
58067
|
+
"plain": "folzqq_plain",
|
|
58068
|
+
"shiki": "folzqq_shiki"
|
|
58069
58069
|
};
|
|
58070
58070
|
}));
|
|
58071
58071
|
//#endregion
|
|
58072
|
-
//#region ../../node_modules/.pnpm/@deepseek-ai+dsh-client-ui-primitives@0.1.
|
|
58072
|
+
//#region ../../node_modules/.pnpm/@deepseek-ai+dsh-client-ui-primitives@0.1.3-alpha.2_@deepseek-ai+cordis@4.0.2/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/markdown/MarkdownText.module.css
|
|
58073
58073
|
var MarkdownText_module_default;
|
|
58074
58074
|
var init_MarkdownText_module = __esmMin((() => {
|
|
58075
58075
|
MarkdownText_module_default = {
|
|
58076
|
-
"fileMention": "
|
|
58077
|
-
"image": "
|
|
58078
|
-
"imageAlt": "
|
|
58079
|
-
"
|
|
58080
|
-
"
|
|
58081
|
-
"
|
|
58076
|
+
"fileMention": "vrxa6G_fileMention",
|
|
58077
|
+
"image": "vrxa6G_image",
|
|
58078
|
+
"imageAlt": "vrxa6G_imageAlt",
|
|
58079
|
+
"linkIcon": "vrxa6G_linkIcon",
|
|
58080
|
+
"markdown": "vrxa6G_markdown",
|
|
58081
|
+
"tableFill": "vrxa6G_tableFill",
|
|
58082
|
+
"tableScroll": "vrxa6G_tableScroll"
|
|
58082
58083
|
};
|
|
58083
58084
|
}));
|
|
58084
58085
|
//#endregion
|
|
@@ -58405,7 +58406,7 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
58405
58406
|
less_default = [lang];
|
|
58406
58407
|
}));
|
|
58407
58408
|
//#endregion
|
|
58408
|
-
//#region ../../node_modules/.pnpm/@deepseek-ai+dsh-client-ui-primitives@0.1.
|
|
58409
|
+
//#region ../../node_modules/.pnpm/@deepseek-ai+dsh-client-ui-primitives@0.1.3-alpha.2_@deepseek-ai+cordis@4.0.2/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/index.js
|
|
58409
58410
|
/**
|
|
58410
58411
|
* Write text to the host clipboard, preferring the async Clipboard API and
|
|
58411
58412
|
* falling back to `execCommand('copy')` on hosts (jsdom, insecure contexts)
|
|
@@ -58437,6 +58438,70 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
58437
58438
|
el.remove();
|
|
58438
58439
|
}
|
|
58439
58440
|
}
|
|
58441
|
+
/**
|
|
58442
|
+
* Derive a file path's link-icon category from its extension. Unknown and
|
|
58443
|
+
* missing extensions fall to `other` (the plain-paper glyph).
|
|
58444
|
+
* @param path - File path as the producing tool spelled it (either separator).
|
|
58445
|
+
* @returns The file's glyph category; never `url` or `folder`.
|
|
58446
|
+
*/
|
|
58447
|
+
function classifyLinkPath(path) {
|
|
58448
|
+
const name = path.slice(Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\")) + 1);
|
|
58449
|
+
const dot = name.lastIndexOf(".");
|
|
58450
|
+
if (dot < 0) return "other";
|
|
58451
|
+
const extension = name.slice(dot + 1).toLowerCase();
|
|
58452
|
+
if (CODE_EXTENSIONS.has(extension)) return "code";
|
|
58453
|
+
if (IMAGE_EXTENSIONS.has(extension)) return "image";
|
|
58454
|
+
return DOCUMENT_EXTENSIONS.has(extension) ? "document" : "other";
|
|
58455
|
+
}
|
|
58456
|
+
/** Local exhaustiveness helper — this package does not depend on `dsh-llm`. */
|
|
58457
|
+
/* v8 ignore next 3 -- closed-union backstop; only reached if a kind is forged */
|
|
58458
|
+
function assertNever$1(value) {
|
|
58459
|
+
throw new Error(`unreachable link icon kind: ${String(value)}`);
|
|
58460
|
+
}
|
|
58461
|
+
/**
|
|
58462
|
+
* Render the leading glyph for one clickable artifact link.
|
|
58463
|
+
* @param props - The link category, optional size (default 14px — the inline
|
|
58464
|
+
* link text size these glyphs sit beside), and optional CSS class.
|
|
58465
|
+
* @returns The category's SVG glyph, riding currentColor.
|
|
58466
|
+
*/
|
|
58467
|
+
function LinkIcon({ kind, size = 14, className }) {
|
|
58468
|
+
switch (kind) {
|
|
58469
|
+
case "url": return (0, react_jsx_runtime.jsx)(GlobeGlyph, {
|
|
58470
|
+
size,
|
|
58471
|
+
className
|
|
58472
|
+
});
|
|
58473
|
+
case "folder": return (0, react_jsx_runtime.jsx)(FolderGlyph, {
|
|
58474
|
+
size,
|
|
58475
|
+
className
|
|
58476
|
+
});
|
|
58477
|
+
case "code": return (0, react_jsx_runtime.jsx)(CodeGlyph, {
|
|
58478
|
+
size,
|
|
58479
|
+
className
|
|
58480
|
+
});
|
|
58481
|
+
case "image": return (0, react_jsx_runtime.jsx)(PhotoGlyph, {
|
|
58482
|
+
size,
|
|
58483
|
+
className
|
|
58484
|
+
});
|
|
58485
|
+
case "document": return (0, react_jsx_runtime.jsx)(PaperDocGlyph, {
|
|
58486
|
+
size,
|
|
58487
|
+
className
|
|
58488
|
+
});
|
|
58489
|
+
case "other": return (0, react_jsx_runtime.jsx)(PaperGlyph, {
|
|
58490
|
+
size,
|
|
58491
|
+
className
|
|
58492
|
+
});
|
|
58493
|
+
/* v8 ignore next -- closed-union backstop; only reached if a kind is forged */
|
|
58494
|
+
default: return assertNever$1(kind);
|
|
58495
|
+
}
|
|
58496
|
+
}
|
|
58497
|
+
/**
|
|
58498
|
+
* Whether a language hint can use the shared syntax highlighter.
|
|
58499
|
+
* @param lang - Language hint from a code surface.
|
|
58500
|
+
* @returns Whether the hint resolves to a supported grammar.
|
|
58501
|
+
*/
|
|
58502
|
+
function supportsHighlighting(lang) {
|
|
58503
|
+
return lang !== void 0 && LANG_ALIASES.has(lang.toLowerCase());
|
|
58504
|
+
}
|
|
58440
58505
|
/** Construct and pre-tokenize the boot grammars outside the user-content scan budget. */
|
|
58441
58506
|
function createHighlighter() {
|
|
58442
58507
|
const instance = createHighlighterCoreSync({
|
|
@@ -58571,6 +58636,34 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
58571
58636
|
return spans;
|
|
58572
58637
|
}
|
|
58573
58638
|
/**
|
|
58639
|
+
* Activate one supported code surface when it first intersects the viewport.
|
|
58640
|
+
* Activation lasts for the component lifetime; browsers without
|
|
58641
|
+
* IntersectionObserver activate immediately.
|
|
58642
|
+
* @param target - Code surface whose plain rendering reserves its geometry.
|
|
58643
|
+
* @param lang - Optional language hint.
|
|
58644
|
+
* @returns Whether this component may build highlighted output.
|
|
58645
|
+
*/
|
|
58646
|
+
function useViewportHighlighting(target, lang) {
|
|
58647
|
+
const supported = supportsHighlighting(lang);
|
|
58648
|
+
const [activated, setActivated] = (0, react.useState)(false);
|
|
58649
|
+
const activate = (0, react.useCallback)(() => {
|
|
58650
|
+
setActivated(true);
|
|
58651
|
+
}, []);
|
|
58652
|
+
(0, react.useEffect)(() => {
|
|
58653
|
+
if (activated || !supported) return;
|
|
58654
|
+
const element = target.current;
|
|
58655
|
+
/* v8 ignore next -- React attaches the host ref before running effects. */
|
|
58656
|
+
if (element === null) return;
|
|
58657
|
+
return highlightViewport.observe(element, activate);
|
|
58658
|
+
}, [
|
|
58659
|
+
activate,
|
|
58660
|
+
activated,
|
|
58661
|
+
supported,
|
|
58662
|
+
target
|
|
58663
|
+
]);
|
|
58664
|
+
return activated && supported;
|
|
58665
|
+
}
|
|
58666
|
+
/**
|
|
58574
58667
|
* A block's render key: its absolute source start offset. A position-less
|
|
58575
58668
|
* node (a grammar is free to omit positions) falls back to a negative
|
|
58576
58669
|
* list-index key — unique within one update's tail, which is the only place
|
|
@@ -58582,6 +58675,84 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
58582
58675
|
const offset = node.position?.start.offset;
|
|
58583
58676
|
return offset === void 0 ? -(index + 1) : base + offset;
|
|
58584
58677
|
}
|
|
58678
|
+
/** Return the first line terminator at or after `start`, including a CRLF pair. */
|
|
58679
|
+
function lineTerminatorEnd(text, start) {
|
|
58680
|
+
for (let index = start; index < text.length; index += 1) {
|
|
58681
|
+
const char = text[index];
|
|
58682
|
+
if (char === "\n") return index + 1;
|
|
58683
|
+
if (char === "\r") return text[index + 1] === "\n" ? index + 2 : index + 1;
|
|
58684
|
+
}
|
|
58685
|
+
}
|
|
58686
|
+
/**
|
|
58687
|
+
* Source prefix before the last completed line. Keeping that line beside the
|
|
58688
|
+
* current partial line lets the grammar retain its trailing-newline semantics.
|
|
58689
|
+
*/
|
|
58690
|
+
function committableLinePrefixLength(text) {
|
|
58691
|
+
let previousEnd = 0;
|
|
58692
|
+
let end = 0;
|
|
58693
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
58694
|
+
const char = text[index];
|
|
58695
|
+
if (char === "\n") {
|
|
58696
|
+
previousEnd = end;
|
|
58697
|
+
end = index + 1;
|
|
58698
|
+
continue;
|
|
58699
|
+
}
|
|
58700
|
+
if (char !== "\r" || index + 1 >= text.length) continue;
|
|
58701
|
+
if (text[index + 1] === "\n") index += 1;
|
|
58702
|
+
previousEnd = end;
|
|
58703
|
+
end = index + 1;
|
|
58704
|
+
}
|
|
58705
|
+
return previousEnd;
|
|
58706
|
+
}
|
|
58707
|
+
/** Exact source terminator ending a non-empty committable prefix. */
|
|
58708
|
+
function trailingLineTerminator(text) {
|
|
58709
|
+
return text.endsWith("\r\n") ? "\r\n" : text.endsWith("\r") ? "\r" : "\n";
|
|
58710
|
+
}
|
|
58711
|
+
/** Whether `text` contains a CommonMark closing fence on one of its logical lines. */
|
|
58712
|
+
function containsClosingFence(text, marker, markerLength) {
|
|
58713
|
+
let start = 0;
|
|
58714
|
+
while (start <= text.length) {
|
|
58715
|
+
let end = start;
|
|
58716
|
+
while (end < text.length && text[end] !== "\n" && text[end] !== "\r") end += 1;
|
|
58717
|
+
const line = text.slice(start, end);
|
|
58718
|
+
let indent = 0;
|
|
58719
|
+
while (indent < 3 && line[indent] === " ") indent += 1;
|
|
58720
|
+
let run = indent;
|
|
58721
|
+
while (line[run] === marker) run += 1;
|
|
58722
|
+
if (run - indent >= markerLength && /^[ \t]*$/.test(line.slice(run))) return true;
|
|
58723
|
+
if (end === text.length) return false;
|
|
58724
|
+
start = text[end] === "\r" && text[end + 1] === "\n" ? end + 2 : end + 1;
|
|
58725
|
+
}
|
|
58726
|
+
/* v8 ignore next -- each loop iteration returns at EOF or advances past a line terminator. */
|
|
58727
|
+
return false;
|
|
58728
|
+
}
|
|
58729
|
+
/** Advance an mdast point across one append while treating a split CRLF as one line ending. */
|
|
58730
|
+
function advancePoint(point, appended, precededByCarriageReturn) {
|
|
58731
|
+
let line = point.line;
|
|
58732
|
+
let column = point.column;
|
|
58733
|
+
let afterCarriageReturn = precededByCarriageReturn;
|
|
58734
|
+
for (const char of appended) {
|
|
58735
|
+
if (char === "\n") {
|
|
58736
|
+
if (!afterCarriageReturn) line += 1;
|
|
58737
|
+
column = 1;
|
|
58738
|
+
afterCarriageReturn = false;
|
|
58739
|
+
continue;
|
|
58740
|
+
}
|
|
58741
|
+
if (char === "\r") {
|
|
58742
|
+
line += 1;
|
|
58743
|
+
column = 1;
|
|
58744
|
+
afterCarriageReturn = true;
|
|
58745
|
+
continue;
|
|
58746
|
+
}
|
|
58747
|
+
column += 1;
|
|
58748
|
+
afterCarriageReturn = false;
|
|
58749
|
+
}
|
|
58750
|
+
return {
|
|
58751
|
+
line,
|
|
58752
|
+
column,
|
|
58753
|
+
offset: point.offset + appended.length
|
|
58754
|
+
};
|
|
58755
|
+
}
|
|
58585
58756
|
function isCjkCharacter(code) {
|
|
58586
58757
|
return code !== null && code >= 0 && cjkCharacter.test(String.fromCodePoint(code));
|
|
58587
58758
|
}
|
|
@@ -58764,52 +58935,98 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
58764
58935
|
mdastExtensions: [gfmFromMarkdown(), mathFromMarkdown()]
|
|
58765
58936
|
});
|
|
58766
58937
|
}
|
|
58938
|
+
function renderLine(line, index) {
|
|
58939
|
+
return (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [index > 0 && "\n", (0, react_jsx_runtime.jsx)("span", {
|
|
58940
|
+
className: "line",
|
|
58941
|
+
children: line.map((span, spanIndex) => (0, react_jsx_runtime.jsx)("span", {
|
|
58942
|
+
style: span.style,
|
|
58943
|
+
children: span.text
|
|
58944
|
+
}, spanIndex))
|
|
58945
|
+
})] }, index);
|
|
58946
|
+
}
|
|
58767
58947
|
function CodeBlock({ code, lang, streaming, className, copyLabel, copiedLabel }) {
|
|
58768
58948
|
const trimmed = code.endsWith("\n") ? code.slice(0, -1) : code;
|
|
58949
|
+
const rootRef = (0, react.useRef)(null);
|
|
58950
|
+
const highlighting = useViewportHighlighting(rootRef, lang);
|
|
58769
58951
|
const loaded = (0, react.useSyncExternalStore)(subscribeGrammarLoaded, grammarLoadCount, grammarLoadCount);
|
|
58770
|
-
const html = (0, react.useMemo)(() => streaming === true ? void 0 : highlightToHtml(trimmed, lang), [
|
|
58771
|
-
streaming,
|
|
58772
|
-
trimmed,
|
|
58773
|
-
lang,
|
|
58774
|
-
loaded
|
|
58775
|
-
]);
|
|
58776
58952
|
const sessionRef = (0, react.useRef)(null);
|
|
58777
58953
|
const lineCacheRef = (0, react.useRef)(null);
|
|
58954
|
+
const settledRef = (0, react.useRef)(false);
|
|
58778
58955
|
const streamedBody = (0, react.useMemo)(() => {
|
|
58956
|
+
if (!highlighting) {
|
|
58957
|
+
sessionRef.current = null;
|
|
58958
|
+
lineCacheRef.current = null;
|
|
58959
|
+
settledRef.current = false;
|
|
58960
|
+
return;
|
|
58961
|
+
}
|
|
58779
58962
|
if (streaming !== true) {
|
|
58963
|
+
const previous = lineCacheRef.current;
|
|
58964
|
+
if (previous !== null && previous.code === trimmed && previous.lang === lang) {
|
|
58965
|
+
settledRef.current = true;
|
|
58966
|
+
return previous.body;
|
|
58967
|
+
}
|
|
58780
58968
|
sessionRef.current = null;
|
|
58781
58969
|
lineCacheRef.current = null;
|
|
58970
|
+
settledRef.current = true;
|
|
58782
58971
|
return;
|
|
58783
58972
|
}
|
|
58973
|
+
if (settledRef.current) {
|
|
58974
|
+
sessionRef.current = null;
|
|
58975
|
+
lineCacheRef.current = null;
|
|
58976
|
+
settledRef.current = false;
|
|
58977
|
+
}
|
|
58784
58978
|
sessionRef.current ??= new StreamingHighlightSession();
|
|
58785
|
-
const
|
|
58786
|
-
if (
|
|
58979
|
+
const frame = sessionRef.current.updateFrame(trimmed, lang);
|
|
58980
|
+
if (frame === void 0) {
|
|
58787
58981
|
lineCacheRef.current = null;
|
|
58788
58982
|
return;
|
|
58789
58983
|
}
|
|
58790
58984
|
const previous = lineCacheRef.current;
|
|
58791
|
-
|
|
58792
|
-
|
|
58793
|
-
|
|
58794
|
-
|
|
58795
|
-
|
|
58796
|
-
|
|
58797
|
-
|
|
58798
|
-
|
|
58799
|
-
|
|
58800
|
-
|
|
58801
|
-
|
|
58802
|
-
|
|
58985
|
+
if (previous?.frame === frame && previous.code === trimmed && previous.lang === lang) return previous.body;
|
|
58986
|
+
const sameGeneration = previous?.generation === frame.generation;
|
|
58987
|
+
const groups = sameGeneration ? [...previous.groups] : [];
|
|
58988
|
+
let pending = sameGeneration ? [...previous.pending] : [];
|
|
58989
|
+
let nextLine = sameGeneration ? previous.nextLine : 0;
|
|
58990
|
+
for (const line of frame.appended) {
|
|
58991
|
+
pending.push(renderLine(line, nextLine));
|
|
58992
|
+
nextLine += 1;
|
|
58993
|
+
if (pending.length !== STREAMING_LINE_GROUP_SIZE) continue;
|
|
58994
|
+
const start = nextLine - pending.length;
|
|
58995
|
+
groups.push((0, react_jsx_runtime.jsx)(react.Fragment, { children: pending }, start));
|
|
58996
|
+
pending = [];
|
|
58997
|
+
}
|
|
58998
|
+
const tail = frame.tail.map((line, index) => renderLine(line, nextLine + index));
|
|
58999
|
+
const tailGroup = (0, react_jsx_runtime.jsx)(react.Fragment, { children: [...pending, ...tail] }, nextLine - pending.length);
|
|
59000
|
+
const body = (0, react_jsx_runtime.jsx)("pre", {
|
|
58803
59001
|
...SHIKI_PRE_PROPS,
|
|
58804
|
-
children: (0, react_jsx_runtime.
|
|
59002
|
+
children: (0, react_jsx_runtime.jsxs)("code", { children: [groups, tailGroup] })
|
|
58805
59003
|
});
|
|
59004
|
+
lineCacheRef.current = {
|
|
59005
|
+
code: trimmed,
|
|
59006
|
+
lang,
|
|
59007
|
+
generation: frame.generation,
|
|
59008
|
+
frame,
|
|
59009
|
+
groups,
|
|
59010
|
+
pending,
|
|
59011
|
+
nextLine,
|
|
59012
|
+
body
|
|
59013
|
+
};
|
|
59014
|
+
return body;
|
|
58806
59015
|
}, [
|
|
58807
59016
|
streaming,
|
|
59017
|
+
highlighting,
|
|
59018
|
+
trimmed,
|
|
59019
|
+
lang,
|
|
59020
|
+
loaded
|
|
59021
|
+
]);
|
|
59022
|
+
const html = (0, react.useMemo)(() => highlighting && streaming !== true && streamedBody === void 0 ? highlightToHtml(trimmed, lang) : void 0, [
|
|
59023
|
+
streaming,
|
|
59024
|
+
highlighting,
|
|
59025
|
+
streamedBody,
|
|
58808
59026
|
trimmed,
|
|
58809
59027
|
lang,
|
|
58810
59028
|
loaded
|
|
58811
59029
|
]);
|
|
58812
|
-
const rootRef = (0, react.useRef)(null);
|
|
58813
59030
|
const [copied, setCopied] = (0, react.useState)(false);
|
|
58814
59031
|
const onCopy = (0, react.useCallback)(() => {
|
|
58815
59032
|
if (copied) return;
|
|
@@ -59053,13 +59270,16 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
59053
59270
|
const href = inlineCodeHttpUrl(value);
|
|
59054
59271
|
if (href !== void 0) return (0, react_jsx_runtime.jsx)("code", { children: renderSafeLink(href, [value], "link") }, key);
|
|
59055
59272
|
const mention = context.inLink === true ? void 0 : context.fileMentions?.resolve(value);
|
|
59056
|
-
if (mention !== void 0) return (0, react_jsx_runtime.jsx)("code", { children: (0, react_jsx_runtime.
|
|
59273
|
+
if (mention !== void 0) return (0, react_jsx_runtime.jsx)("code", { children: (0, react_jsx_runtime.jsxs)("button", {
|
|
59057
59274
|
type: "button",
|
|
59058
59275
|
className: MarkdownText_module_default.fileMention,
|
|
59059
59276
|
title: mention.title,
|
|
59060
59277
|
"aria-label": mention.label,
|
|
59061
59278
|
onClick: mention.open,
|
|
59062
|
-
children:
|
|
59279
|
+
children: [(0, react_jsx_runtime.jsx)(LinkIcon, {
|
|
59280
|
+
kind: classifyLinkPath(value),
|
|
59281
|
+
className: MarkdownText_module_default.linkIcon
|
|
59282
|
+
}), value]
|
|
59063
59283
|
}) }, key);
|
|
59064
59284
|
return (0, react_jsx_runtime.jsx)("code", { children: value }, key);
|
|
59065
59285
|
}
|
|
@@ -59073,7 +59293,7 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
59073
59293
|
case "link": return renderAnchor(node.url, renderChildren(node.children, {
|
|
59074
59294
|
...context,
|
|
59075
59295
|
inLink: true
|
|
59076
|
-
}), key);
|
|
59296
|
+
}), key, !anchorWrapsOnlyImages(node.children));
|
|
59077
59297
|
case "linkReference": return renderLinkReference(node, key, context);
|
|
59078
59298
|
case "image": return renderImage(node.url, node.alt ?? "", key);
|
|
59079
59299
|
case "imageReference": return renderImageReference(node, key, context);
|
|
@@ -59168,22 +59388,33 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
59168
59388
|
}
|
|
59169
59389
|
return (0, react_jsx_runtime.jsx)("tr", { children: cells }, key);
|
|
59170
59390
|
}
|
|
59391
|
+
/**
|
|
59392
|
+
* True when an anchor's markdown children are all images, so the anchor is a
|
|
59393
|
+
* clickable picture (badge, thumbnail): the leading URL glyph would dangle
|
|
59394
|
+
* beside the image instead of leading link text, so those anchors skip it.
|
|
59395
|
+
*/
|
|
59396
|
+
function anchorWrapsOnlyImages(children) {
|
|
59397
|
+
return children.length > 0 && children.every((child) => child.type === "image" || child.type === "imageReference");
|
|
59398
|
+
}
|
|
59171
59399
|
/** Anchor over an already-authored href: allowlisted or unwrapped, external links get the safe attributes. */
|
|
59172
|
-
function renderSafeLink(href, children, key) {
|
|
59400
|
+
function renderSafeLink(href, children, key, glyph = true) {
|
|
59173
59401
|
const safeHref = sanitizeUrl(href);
|
|
59174
59402
|
if (safeHref === "") return (0, react_jsx_runtime.jsx)(react.Fragment, { children }, key);
|
|
59175
|
-
return (0, react_jsx_runtime.
|
|
59403
|
+
return (0, react_jsx_runtime.jsxs)("a", {
|
|
59176
59404
|
href: safeHref,
|
|
59177
59405
|
...["http:", "https:"].includes(new URL(safeHref).protocol) ? {
|
|
59178
59406
|
target: "_blank",
|
|
59179
59407
|
rel: "noopener noreferrer"
|
|
59180
59408
|
} : {},
|
|
59181
|
-
children
|
|
59409
|
+
children: [glyph && (0, react_jsx_runtime.jsx)(LinkIcon, {
|
|
59410
|
+
kind: "url",
|
|
59411
|
+
className: MarkdownText_module_default.linkIcon
|
|
59412
|
+
}), children]
|
|
59182
59413
|
}, key);
|
|
59183
59414
|
}
|
|
59184
59415
|
/** Anchor over a parsed markdown destination, which hast normalized before the allowlist saw it. */
|
|
59185
|
-
function renderAnchor(url, children, key) {
|
|
59186
|
-
return renderSafeLink(normalizeUri(url), children, key);
|
|
59416
|
+
function renderAnchor(url, children, key, glyph = true) {
|
|
59417
|
+
return renderSafeLink(normalizeUri(url), children, key, glyph);
|
|
59187
59418
|
}
|
|
59188
59419
|
/**
|
|
59189
59420
|
* The complete inline-code value when it is exactly an absolute HTTP(S) URL
|
|
@@ -59226,10 +59457,11 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
59226
59457
|
renderChildren(node.children, context),
|
|
59227
59458
|
referenceSuffix(node)
|
|
59228
59459
|
] }, key);
|
|
59229
|
-
|
|
59460
|
+
const rendered = renderChildren(node.children, {
|
|
59230
59461
|
...context,
|
|
59231
59462
|
inLink: true
|
|
59232
|
-
})
|
|
59463
|
+
});
|
|
59464
|
+
return renderAnchor(definition.url, rendered, key, !anchorWrapsOnlyImages(node.children));
|
|
59233
59465
|
}
|
|
59234
59466
|
function renderImageReference(node, key, context) {
|
|
59235
59467
|
const definition = context.targets.definitions.get(node.identifier.toUpperCase());
|
|
@@ -59309,7 +59541,8 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
59309
59541
|
};
|
|
59310
59542
|
const blocks = wrapBlockChildren(renderBlocks(root.children.map((node, index) => ({
|
|
59311
59543
|
node,
|
|
59312
|
-
|
|
59544
|
+
/* v8 ignore next -- parseFull uses parseGfm, which stamps every top-level node. */
|
|
59545
|
+
key: node.position?.start.offset ?? -(index + 1)
|
|
59313
59546
|
})), context), false);
|
|
59314
59547
|
const section = renderFootnoteSection(context);
|
|
59315
59548
|
return section === null ? blocks : [
|
|
@@ -59318,7 +59551,7 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
59318
59551
|
section
|
|
59319
59552
|
];
|
|
59320
59553
|
}
|
|
59321
|
-
var LANGS, LAZY_GRAMMARS, LANG_ALIASES, cssVariablesTheme, regexEngine, singleton, BOOT_GRAMMAR_WARMUPS, requested, listeners, loadCount, DECORATION_BITS, StreamingHighlightSession, UNSTABLE_TAIL_BLOCKS, IncrementalMarkdownParser, cjkCharacter, tokenizeCjkFriendlyAttention, cjkFriendlyAttention, cjkFriendlyStrongExtension, previousBackslash, tokenizeBackslashMathText, tokenizeNonLazyContinuation, nonLazyContinuation, backslashMathText, backslashMathFlow, sameLineDollarMathFlow, backslashMath, SHIKI_PRE_PROPS, StreamingRenderer;
|
|
59554
|
+
var CODE_EXTENSIONS, IMAGE_EXTENSIONS, DOCUMENT_EXTENSIONS, GlobeGlyph, CodeGlyph, FolderGlyph, PhotoGlyph, PaperGlyph, PaperDocGlyph, LANGS, LAZY_GRAMMARS, LANG_ALIASES, cssVariablesTheme, regexEngine, singleton, BOOT_GRAMMAR_WARMUPS, requested, listeners, loadCount, DECORATION_BITS, StreamingHighlightSession, noop, HighlightViewport, highlightViewport, UNSTABLE_TAIL_BLOCKS, IncrementalMarkdownParser, cjkCharacter, tokenizeCjkFriendlyAttention, cjkFriendlyAttention, cjkFriendlyStrongExtension, previousBackslash, tokenizeBackslashMathText, tokenizeNonLazyContinuation, nonLazyContinuation, backslashMathText, backslashMathFlow, sameLineDollarMathFlow, backslashMath, SHIKI_PRE_PROPS, STREAMING_LINE_GROUP_SIZE, StreamingRenderer;
|
|
59322
59555
|
var init_lib = __esmMin((() => {
|
|
59323
59556
|
init_clsx();
|
|
59324
59557
|
require_react_dom();
|
|
@@ -59344,6 +59577,210 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
59344
59577
|
init_katex();
|
|
59345
59578
|
init_MarkdownText_module();
|
|
59346
59579
|
init_katex_min();
|
|
59580
|
+
CODE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
59581
|
+
"ts",
|
|
59582
|
+
"tsx",
|
|
59583
|
+
"js",
|
|
59584
|
+
"jsx",
|
|
59585
|
+
"mjs",
|
|
59586
|
+
"cjs",
|
|
59587
|
+
"cts",
|
|
59588
|
+
"mts",
|
|
59589
|
+
"css",
|
|
59590
|
+
"scss",
|
|
59591
|
+
"sass",
|
|
59592
|
+
"less",
|
|
59593
|
+
"html",
|
|
59594
|
+
"htm",
|
|
59595
|
+
"vue",
|
|
59596
|
+
"svelte",
|
|
59597
|
+
"astro",
|
|
59598
|
+
"json",
|
|
59599
|
+
"jsonc",
|
|
59600
|
+
"json5",
|
|
59601
|
+
"yaml",
|
|
59602
|
+
"yml",
|
|
59603
|
+
"toml",
|
|
59604
|
+
"xml",
|
|
59605
|
+
"ini",
|
|
59606
|
+
"env",
|
|
59607
|
+
"sh",
|
|
59608
|
+
"bash",
|
|
59609
|
+
"zsh",
|
|
59610
|
+
"fish",
|
|
59611
|
+
"ps1",
|
|
59612
|
+
"bat",
|
|
59613
|
+
"cmd",
|
|
59614
|
+
"py",
|
|
59615
|
+
"pyi",
|
|
59616
|
+
"rb",
|
|
59617
|
+
"rs",
|
|
59618
|
+
"go",
|
|
59619
|
+
"java",
|
|
59620
|
+
"kt",
|
|
59621
|
+
"kts",
|
|
59622
|
+
"c",
|
|
59623
|
+
"cc",
|
|
59624
|
+
"cpp",
|
|
59625
|
+
"cxx",
|
|
59626
|
+
"h",
|
|
59627
|
+
"hh",
|
|
59628
|
+
"hpp",
|
|
59629
|
+
"cs",
|
|
59630
|
+
"php",
|
|
59631
|
+
"swift",
|
|
59632
|
+
"sql",
|
|
59633
|
+
"csv",
|
|
59634
|
+
"tsv",
|
|
59635
|
+
"proto",
|
|
59636
|
+
"graphql",
|
|
59637
|
+
"gql",
|
|
59638
|
+
"lua",
|
|
59639
|
+
"r",
|
|
59640
|
+
"pl",
|
|
59641
|
+
"scala",
|
|
59642
|
+
"clj",
|
|
59643
|
+
"cljs",
|
|
59644
|
+
"ex",
|
|
59645
|
+
"exs",
|
|
59646
|
+
"erl",
|
|
59647
|
+
"hs",
|
|
59648
|
+
"dart"
|
|
59649
|
+
]);
|
|
59650
|
+
IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
59651
|
+
"png",
|
|
59652
|
+
"jpg",
|
|
59653
|
+
"jpeg",
|
|
59654
|
+
"gif",
|
|
59655
|
+
"svg",
|
|
59656
|
+
"webp",
|
|
59657
|
+
"avif",
|
|
59658
|
+
"bmp",
|
|
59659
|
+
"ico",
|
|
59660
|
+
"tif",
|
|
59661
|
+
"tiff",
|
|
59662
|
+
"heic",
|
|
59663
|
+
"heif"
|
|
59664
|
+
]);
|
|
59665
|
+
DOCUMENT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
59666
|
+
"pdf",
|
|
59667
|
+
"doc",
|
|
59668
|
+
"docx",
|
|
59669
|
+
"xls",
|
|
59670
|
+
"xlsx",
|
|
59671
|
+
"ppt",
|
|
59672
|
+
"pptx"
|
|
59673
|
+
]);
|
|
59674
|
+
GlobeGlyph = ({ size, className }) => (0, react_jsx_runtime.jsx)("svg", {
|
|
59675
|
+
width: size,
|
|
59676
|
+
height: size,
|
|
59677
|
+
className,
|
|
59678
|
+
viewBox: "0 0 20 20",
|
|
59679
|
+
fill: "none",
|
|
59680
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
59681
|
+
"aria-hidden": true,
|
|
59682
|
+
children: (0, react_jsx_runtime.jsx)("path", {
|
|
59683
|
+
fillRule: "evenodd",
|
|
59684
|
+
clipRule: "evenodd",
|
|
59685
|
+
d: "M9.99951 1.68994C14.5889 1.68994 18.3098 5.41022 18.3101 9.99951C18.3101 14.589 14.589 18.3101 9.99951 18.3101C5.41022 18.3098 1.68994 14.5889 1.68994 9.99951C1.69017 5.41037 5.41037 1.69017 9.99951 1.68994ZM3.23193 10.7495C3.52924 13.463 5.41981 15.6965 7.94873 16.4946C7.74323 16.1395 7.56487 15.736 7.41162 15.3022C6.97892 14.0773 6.70459 12.4906 6.63232 10.7495H3.23193ZM13.3667 10.7495C13.2944 12.4906 13.0211 14.0773 12.5884 15.3022C12.4352 15.7359 12.2557 16.1386 12.0503 16.4937C14.5794 15.6956 16.4707 13.4631 16.7681 10.7495H13.3667ZM8.13428 10.7495C8.20587 12.3512 8.45916 13.7619 8.82666 14.8022C9.046 15.4231 9.29031 15.8714 9.52686 16.1499C9.76321 16.428 9.92505 16.4651 9.99951 16.4653C10.0737 16.4653 10.2362 16.4288 10.4731 16.1499C10.7097 15.8714 10.954 15.4231 11.1733 14.8022C11.5408 13.7619 11.7941 12.3512 11.8657 10.7495H8.13428ZM9.99951 3.18994C9.92505 3.19013 9.76321 3.22823 9.52686 3.50635C9.29035 3.78486 9.04595 4.23325 8.82666 4.854C8.43314 5.96808 8.16996 7.50638 8.12158 9.24951H11.8784C11.83 7.50638 11.5669 5.96808 11.1733 4.854C10.954 4.23324 10.7097 3.78486 10.4731 3.50635C10.2362 3.22748 10.0737 3.18994 9.99951 3.18994ZM12.27 3.57861C12.3862 3.82232 12.4924 4.0822 12.5884 4.354C13.0494 5.65902 13.33 7.37415 13.3784 9.24951H16.7681C16.4792 6.61525 14.6885 4.43369 12.27 3.57861ZM7.729 3.57861C5.3109 4.4338 3.52072 6.61541 3.23193 9.24951H6.62158C6.67001 7.37415 6.95063 5.65902 7.41162 4.354C7.50759 4.08233 7.61287 3.82221 7.729 3.57861Z",
|
|
59686
|
+
fill: "currentColor"
|
|
59687
|
+
})
|
|
59688
|
+
});
|
|
59689
|
+
CodeGlyph = ({ size, className }) => (0, react_jsx_runtime.jsxs)("svg", {
|
|
59690
|
+
width: size,
|
|
59691
|
+
height: size,
|
|
59692
|
+
className,
|
|
59693
|
+
viewBox: "0 0 20 20",
|
|
59694
|
+
fill: "none",
|
|
59695
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
59696
|
+
"aria-hidden": true,
|
|
59697
|
+
children: [
|
|
59698
|
+
(0, react_jsx_runtime.jsx)("path", {
|
|
59699
|
+
d: "M5 15.2021L1.67188 11.874C1.42017 11.6223 1.1823 11.3858 1.00781 11.1689C0.823288 10.9396 0.645016 10.6559 0.586914 10.2891C0.556619 10.0975 0.556619 9.90245 0.586914 9.71094C0.645016 9.3441 0.823288 9.06042 1.00781 8.83105C1.1823 8.61419 1.42017 8.37768 1.67188 8.12598L5 4.79785L6.20215 6L2.87402 9.32813C2.59555 9.6066 2.43539 9.76802 2.33203 9.89648C2.29246 9.94567 2.27406 9.97638 2.26563 9.99121C2.26528 9.99711 2.26528 10.0029 2.26563 10.0088C2.27406 10.0236 2.29246 10.0543 2.33203 10.1035C2.43539 10.232 2.59555 10.3934 2.87402 10.6719L6.20215 14L5 15.2021Z",
|
|
59700
|
+
fill: "currentColor"
|
|
59701
|
+
}),
|
|
59702
|
+
(0, react_jsx_runtime.jsx)("path", {
|
|
59703
|
+
d: "M15 15.2021L18.3281 11.874C18.5798 11.6223 18.8177 11.3858 18.9922 11.1689C19.1767 10.9396 19.355 10.6559 19.4131 10.2891C19.4434 10.0975 19.4434 9.90245 19.4131 9.71094C19.355 9.3441 19.1767 9.06042 18.9922 8.83105C18.8177 8.61419 18.5798 8.37768 18.3281 8.12598L15 4.79785L13.7979 6L17.126 9.32813C17.4045 9.6066 17.5646 9.76802 17.668 9.89648C17.7075 9.94567 17.7259 9.97638 17.7344 9.99121C17.7347 9.99711 17.7347 10.0029 17.7344 10.0088C17.7259 10.0236 17.7075 10.0543 17.668 10.1035C17.5646 10.232 17.4045 10.3934 17.126 10.6719L13.7979 14L15 15.2021Z",
|
|
59704
|
+
fill: "currentColor"
|
|
59705
|
+
}),
|
|
59706
|
+
(0, react_jsx_runtime.jsx)("path", {
|
|
59707
|
+
d: "M9.41181 15.0993L7.76955 14.6593L10.3577 5.00002L12 5.44006L9.41181 15.0993Z",
|
|
59708
|
+
fill: "currentColor"
|
|
59709
|
+
})
|
|
59710
|
+
]
|
|
59711
|
+
});
|
|
59712
|
+
FolderGlyph = ({ size, className }) => (0, react_jsx_runtime.jsxs)("svg", {
|
|
59713
|
+
width: size,
|
|
59714
|
+
height: size,
|
|
59715
|
+
className,
|
|
59716
|
+
viewBox: "0 0 20 20",
|
|
59717
|
+
fill: "none",
|
|
59718
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
59719
|
+
"aria-hidden": true,
|
|
59720
|
+
children: [(0, react_jsx_runtime.jsx)("path", {
|
|
59721
|
+
d: "M1.2002 11.4178V6.7244C1.2002 6.47036 1.19957 6.2962 1.21387 6.12773C1.29746 5.14425 1.76052 4.23195 2.50489 3.58378C2.63247 3.47269 2.77337 3.37059 2.97852 3.2205C3.11259 3.12241 3.20444 3.05471 3.29981 2.99296C3.85318 2.6347 4.49029 2.42604 5.14844 2.38847C5.26177 2.38201 5.37601 2.38261 5.542 2.38261H7.91211C8.63453 2.38261 9.13199 2.37701 9.61329 2.49882C9.7656 2.53739 9.91613 2.58526 10.0625 2.64237C10.525 2.8229 10.9267 3.11712 11.5147 3.5369L12.0859 3.94413C12.1927 4.02032 12.2509 4.06163 12.2959 4.09062C12.3336 4.11488 12.3394 4.11605 12.332 4.11308C12.3403 4.11633 12.3488 4.11875 12.3574 4.12089C12.3627 4.12161 12.3757 4.12265 12.4004 4.12382C12.4538 4.12635 12.5252 4.12675 12.6563 4.12675C13.7369 4.12675 14.6105 4.12608 15.3086 4.19999C16.0209 4.27545 16.643 4.43585 17.1885 4.82011C17.5449 5.07115 17.8554 5.38173 18.1064 5.73808C18.4908 6.28368 18.6521 6.90645 18.7275 7.61894C18.8014 8.31701 18.7998 9.19066 18.7998 10.2713V11.4178C18.7998 12.5248 18.801 13.4195 18.7236 14.1336C18.6446 14.8626 18.4763 15.4982 18.0742 16.0516C17.8399 16.374 17.5559 16.6571 17.2334 16.8914C16.68 17.2935 16.0445 17.4628 15.3154 17.5418C14.6014 17.6191 13.7065 17.618 12.5996 17.618H7.40039C6.29352 17.618 5.39863 17.6191 4.68457 17.5418C3.95547 17.4628 3.32001 17.2935 2.76661 16.8914C2.44414 16.6571 2.16011 16.374 1.92579 16.0516C1.52375 15.4982 1.35537 14.8626 1.27637 14.1336C1.199 13.4195 1.2002 12.5248 1.2002 11.4178ZM2.79981 11.4178C2.79981 12.5602 2.80136 13.3529 2.86719 13.9607C2.93144 14.5537 3.04885 14.8759 3.21973 15.1111C3.35542 15.2979 3.52029 15.4618 3.70704 15.5975C3.94221 15.7683 4.26361 15.8867 4.85645 15.951C5.46439 16.0168 6.25766 16.0174 7.40039 16.0174H12.5996C13.7424 16.0174 14.5356 16.0168 15.1436 15.951C15.7364 15.8867 16.0578 15.7683 16.293 15.5975C16.4797 15.4618 16.6446 15.2979 16.7803 15.1111C16.9512 14.8759 17.0686 14.5537 17.1328 13.9607C17.1986 13.3529 17.2002 12.5602 17.2002 11.4178V10.2713C17.2002 9.15571 17.1987 8.38124 17.1357 7.7869C17.0743 7.20716 16.9618 6.8914 16.7988 6.65995C16.6534 6.45353 16.473 6.2741 16.2666 6.1287C16.0351 5.96565 15.7196 5.85222 15.1397 5.79081C14.5454 5.7279 13.7716 5.72733 12.6563 5.72733C12.4465 5.72733 12.2081 5.73253 11.9736 5.6746C11.8947 5.65509 11.8168 5.63037 11.7412 5.60038C11.517 5.51135 11.3268 5.36863 11.1563 5.24687L10.585 4.83866C9.93302 4.37321 9.71454 4.22394 9.48047 4.13261C9.39579 4.09958 9.30882 4.07191 9.22071 4.0496C8.97721 3.98798 8.71286 3.98222 7.91211 3.98222H5.542C5.35809 3.98222 5.29665 3.98285 5.23926 3.98612C4.85821 4.00788 4.48933 4.12829 4.16895 4.33573C4.12071 4.36697 4.07125 4.40295 3.92286 4.51151C3.69569 4.67771 3.61995 4.73389 3.55567 4.78983C3.1248 5.16501 2.8561 5.69324 2.80762 6.26249C2.80039 6.34752 2.79981 6.44244 2.79981 6.7244V11.4178Z",
|
|
59722
|
+
fill: "currentColor"
|
|
59723
|
+
}), (0, react_jsx_runtime.jsx)("path", {
|
|
59724
|
+
d: "M15.4913 8.11793V9.71754H4.50892V8.11793H15.4913Z",
|
|
59725
|
+
fill: "currentColor"
|
|
59726
|
+
})]
|
|
59727
|
+
});
|
|
59728
|
+
PhotoGlyph = ({ size, className }) => (0, react_jsx_runtime.jsxs)("svg", {
|
|
59729
|
+
width: size,
|
|
59730
|
+
height: size,
|
|
59731
|
+
className,
|
|
59732
|
+
viewBox: "0 0 20 20",
|
|
59733
|
+
fill: "none",
|
|
59734
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
59735
|
+
"aria-hidden": true,
|
|
59736
|
+
children: [(0, react_jsx_runtime.jsx)("path", {
|
|
59737
|
+
fillRule: "evenodd",
|
|
59738
|
+
clipRule: "evenodd",
|
|
59739
|
+
d: "M13 5.15039C14.574 5.15039 15.8496 6.42599 15.8496 8C15.8496 9.57401 14.574 10.8496 13 10.8496C11.426 10.8496 10.1504 9.57401 10.1504 8C10.1504 6.42599 11.426 5.1504 13 5.15039ZM13 6.84961C12.3649 6.84961 11.8496 7.36488 11.8496 8C11.8496 8.63513 12.3649 9.15039 13 9.15039C13.6351 9.15039 14.1504 8.63513 14.1504 8C14.1504 7.36488 13.6351 6.84961 13 6.84961Z",
|
|
59740
|
+
fill: "currentColor"
|
|
59741
|
+
}), (0, react_jsx_runtime.jsx)("path", {
|
|
59742
|
+
fillRule: "evenodd",
|
|
59743
|
+
clipRule: "evenodd",
|
|
59744
|
+
d: "M12.5996 2.15039C13.7056 2.15039 14.6038 2.14883 15.3213 2.22656C16.0546 2.30602 16.6994 2.47647 17.2627 2.88574C17.5895 3.1232 17.8768 3.41049 18.1143 3.73731C18.5235 4.30063 18.694 4.9454 18.7734 5.67871C18.8512 6.39616 18.8496 7.29441 18.8496 8.40039V11.5996C18.8496 12.7056 18.8512 13.6038 18.7734 14.3213C18.694 15.0546 18.5235 15.6994 18.1143 16.2627C17.8768 16.5895 17.5895 16.8768 17.2627 17.1143C16.6994 17.5235 16.0546 17.694 15.3213 17.7734C14.6038 17.8512 13.7056 17.8496 12.5996 17.8496H7.40039C6.29441 17.8496 5.39616 17.8512 4.67871 17.7734C3.9454 17.694 3.30063 17.5235 2.73731 17.1143C2.41049 16.8768 2.1232 16.5895 1.88574 16.2627C1.47647 15.6994 1.30602 15.0546 1.22656 14.3213C1.14883 13.6038 1.15039 12.7056 1.15039 11.5996V8.40039C1.15039 7.29441 1.14883 6.39616 1.22656 5.67871C1.30602 4.9454 1.47647 4.30063 1.88574 3.73731C2.1232 3.41049 2.41049 3.1232 2.73731 2.88574C3.30063 2.47647 3.9454 2.30602 4.67871 2.22656C5.39616 2.14883 6.29441 2.15039 7.40039 2.15039H12.5996ZM5.56348 10.8164C5.30962 10.8348 5.02517 10.9291 4.58008 11.1973C4.13813 11.4635 3.60989 11.8565 2.85449 12.4229C2.85831 13.1414 2.86855 13.6903 2.91699 14.1377C2.98078 14.7264 3.09709 15.0384 3.26074 15.2637C3.39335 15.4462 3.55382 15.6067 3.73633 15.7393C3.96158 15.9029 4.2736 16.0192 4.86231 16.083C5.46688 16.1485 6.25677 16.1504 7.40039 16.1504H11.9492L8.71094 12.9131C8.00039 12.2025 7.51129 11.7149 7.09571 11.376C6.69274 11.0474 6.42364 10.9144 6.17481 10.8604C5.97432 10.8168 5.7681 10.8017 5.56348 10.8164ZM7.40039 3.84961C6.25677 3.84961 5.46688 3.85153 4.86231 3.91699C4.2736 3.98078 3.96158 4.09709 3.73633 4.26074C3.55382 4.39335 3.39335 4.55382 3.26074 4.73633C3.09709 4.96158 2.98078 5.2736 2.91699 5.86231C2.85153 6.46688 2.84961 7.25677 2.84961 8.40039V10.3105C3.15698 10.0902 3.43896 9.8988 3.70215 9.74024C4.26649 9.40025 4.81639 9.16621 5.44141 9.1211C5.80775 9.0947 6.17623 9.1213 6.53516 9.19922C7.14769 9.33224 7.65922 9.64212 8.16992 10.0586C8.66793 10.4648 9.22718 11.025 9.91309 11.7109L14.333 16.1318C14.6363 16.122 14.9012 16.1086 15.1377 16.083C15.7264 16.0192 16.0384 15.9029 16.2637 15.7393C16.4462 15.6067 16.6067 15.4462 16.7393 15.2637C16.9029 15.0384 17.0192 14.7264 17.083 14.1377C17.1485 13.5331 17.1504 12.7432 17.1504 11.5996V8.40039C17.1504 7.25677 17.1485 6.46688 17.083 5.86231C17.0192 5.2736 16.9029 4.96158 16.7393 4.73633C16.6067 4.55382 16.4462 4.39335 16.2637 4.26074C16.0384 4.09709 15.7264 3.98078 15.1377 3.91699C14.5331 3.85153 13.7432 3.84961 12.5996 3.84961H7.40039Z",
|
|
59745
|
+
fill: "currentColor"
|
|
59746
|
+
})]
|
|
59747
|
+
});
|
|
59748
|
+
PaperGlyph = ({ size, className }) => (0, react_jsx_runtime.jsx)("svg", {
|
|
59749
|
+
width: size,
|
|
59750
|
+
height: size,
|
|
59751
|
+
className,
|
|
59752
|
+
viewBox: "0 0 20 20",
|
|
59753
|
+
fill: "none",
|
|
59754
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
59755
|
+
"aria-hidden": true,
|
|
59756
|
+
children: (0, react_jsx_runtime.jsx)("path", {
|
|
59757
|
+
d: "M11.3467 4.59607C11.3469 5.40284 11.3499 5.9609 11.3965 6.39099C11.444 6.82964 11.5288 7.03981 11.6328 7.18298C11.7253 7.3102 11.8376 7.42158 11.9648 7.51404C12.108 7.61807 12.3181 7.70283 12.7568 7.75037C13.1851 7.79675 13.7399 7.79992 14.541 7.80017L11.3467 4.59607ZM17.2695 12.7455C17.2695 13.5901 17.2706 14.2881 17.21 14.848C17.1477 15.4228 17.0119 15.9463 16.6768 16.4076C16.4856 16.6707 16.2543 16.902 15.9912 17.0931C15.5298 17.4284 15.0065 17.5641 14.4316 17.6263C13.8718 17.687 13.1737 17.6859 12.3291 17.6859H8.23926C7.39498 17.6859 6.69745 17.687 6.1377 17.6263C5.56284 17.5641 5.03855 17.4284 4.57715 17.0931C4.31413 16.902 4.08272 16.6706 3.8916 16.4076C3.55647 15.9463 3.42167 15.4227 3.35938 14.848C3.29872 14.2881 3.29981 13.5901 3.29981 12.7455V6.80017C3.29981 5.95586 3.29876 5.25837 3.35938 4.69861C3.42166 4.12375 3.55638 3.59946 3.8916 3.13806C4.08274 2.87503 4.31412 2.64365 4.57715 2.45252C5.03855 2.11729 5.56284 1.98257 6.1377 1.92029C6.69746 1.85967 7.39495 1.86072 8.23926 1.86072H9.38468C10.039 1.86072 10.3661 1.86072 10.6679 1.95896C10.7677 1.99146 10.8648 2.03176 10.9583 2.0795C11.241 2.22382 11.472 2.45549 11.934 2.91883L16.2188 7.21612C16.679 7.67761 16.909 7.90836 17.0523 8.1902C17.0997 8.28342 17.1397 8.38022 17.172 8.4797C17.2695 8.78045 17.2695 9.10631 17.2695 9.75801V12.7455ZM4.89942 12.7455C4.89942 13.6256 4.90106 14.2215 4.9502 14.6752C4.99773 15.1139 5.08249 15.324 5.18652 15.4672C5.27898 15.5944 5.39037 15.7067 5.51758 15.7992C5.66076 15.9032 5.87093 15.988 6.30957 16.0355C6.76321 16.0847 7.35919 16.0853 8.23926 16.0853H12.3291C13.2091 16.0853 13.8051 16.0846 14.2588 16.0355C14.6973 15.988 14.9076 15.9032 15.0508 15.7992C15.1781 15.7067 15.2903 15.5945 15.3828 15.4672C15.4868 15.324 15.5716 15.1139 15.6191 14.6752C15.6683 14.2215 15.6689 13.6256 15.6689 12.7455V9.40076H14.6865C13.8419 9.40076 13.1439 9.40185 12.584 9.34119C12.0093 9.27889 11.4857 9.14411 11.0244 8.80896C10.7614 8.61784 10.53 8.38645 10.3389 8.12341C10.0036 7.66202 9.86795 7.13773 9.80567 6.56287C9.74505 6.00312 9.74609 5.30558 9.7461 4.4613V3.46033H8.23926C7.35919 3.46033 6.76321 3.46196 6.30957 3.51111C5.87097 3.55865 5.66075 3.64342 5.51758 3.74744C5.39057 3.83979 5.27888 3.95148 5.18652 4.07849C5.0825 4.22166 4.99773 4.43188 4.9502 4.87048C4.90105 5.32412 4.89942 5.92011 4.89942 6.80017V12.7455Z",
|
|
59758
|
+
fill: "currentColor"
|
|
59759
|
+
})
|
|
59760
|
+
});
|
|
59761
|
+
PaperDocGlyph = ({ size, className }) => (0, react_jsx_runtime.jsxs)("svg", {
|
|
59762
|
+
width: size,
|
|
59763
|
+
height: size,
|
|
59764
|
+
className,
|
|
59765
|
+
viewBox: "0 0 20 20",
|
|
59766
|
+
fill: "none",
|
|
59767
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
59768
|
+
"aria-hidden": true,
|
|
59769
|
+
children: [
|
|
59770
|
+
(0, react_jsx_runtime.jsx)("path", {
|
|
59771
|
+
d: "M11.3457 4.5957C11.3459 5.40247 11.3489 5.96054 11.3955 6.39063C11.443 6.82927 11.5278 7.03944 11.6318 7.18262C11.7243 7.30983 11.8367 7.42122 11.9639 7.51367C12.1071 7.61771 12.3171 7.70247 12.7559 7.75C13.1841 7.79639 13.739 7.79955 14.54 7.79981L11.3457 4.5957ZM17.2686 12.7451C17.2686 13.5897 17.2696 14.2878 17.209 14.8477C17.1467 15.4224 17.011 15.9459 16.6758 16.4072C16.4846 16.6703 16.2533 16.9016 15.9902 17.0928C15.5289 17.428 15.0055 17.5637 14.4307 17.626C13.8708 17.6866 13.1727 17.6855 12.3281 17.6855H8.23828C7.394 17.6855 6.69647 17.6866 6.13672 17.626C5.56186 17.5637 5.03757 17.428 4.57617 17.0928C4.31315 16.9016 4.08175 16.6703 3.89063 16.4072C3.55549 15.9459 3.42069 15.4224 3.3584 14.8477C3.29774 14.2878 3.29883 13.5897 3.29883 12.7451V6.79981C3.29883 5.95549 3.29778 5.258 3.3584 4.69824C3.42068 4.12338 3.5554 3.5991 3.89063 3.1377C4.08176 2.87466 4.31314 2.64328 4.57617 2.45215C5.03757 2.11692 5.56186 1.98221 6.13672 1.91992C6.69648 1.8593 7.39397 1.86035 8.23828 1.86035H9.3837C10.038 1.86035 10.3652 1.86035 10.6669 1.9586C10.7668 1.99109 10.8639 2.03139 10.9573 2.07913C11.24 2.22346 11.471 2.45512 11.933 2.91846L16.2178 7.21575C16.678 7.67725 16.9081 7.90799 17.0514 8.18983C17.0988 8.28305 17.1388 8.37985 17.171 8.47933C17.2686 8.78009 17.2686 9.10594 17.2686 9.75765V12.7451ZM4.89844 12.7451C4.89844 13.6253 4.90008 14.2211 4.94922 14.6748C4.99675 15.1135 5.08151 15.3236 5.18555 15.4668C5.278 15.594 5.38939 15.7064 5.5166 15.7988C5.65978 15.9029 5.86995 15.9876 6.30859 16.0352C6.76223 16.0843 7.35822 16.085 8.23828 16.085H12.3281C13.2081 16.085 13.8042 16.0843 14.2578 16.0352C14.6963 15.9876 14.9066 15.9028 15.0498 15.7988C15.1771 15.7063 15.2893 15.5941 15.3818 15.4668C15.4859 15.3236 15.5706 15.1135 15.6182 14.6748C15.6673 14.2211 15.668 13.6252 15.668 12.7451V9.40039H14.6855C13.841 9.40039 13.1429 9.40148 12.583 9.34082C12.0083 9.27852 11.4847 9.14374 11.0234 8.8086C10.7604 8.61747 10.5291 8.38608 10.3379 8.12305C10.0027 7.66165 9.86697 7.13736 9.80469 6.5625C9.74408 6.00275 9.74512 5.30522 9.74512 4.46094V3.45996H8.23828C7.35822 3.45996 6.76223 3.46159 6.30859 3.51074C5.86999 3.55828 5.65977 3.64305 5.5166 3.74707C5.38959 3.83942 5.2779 3.95111 5.18555 4.07813C5.08153 4.2213 4.99676 4.43152 4.94922 4.87012C4.90007 5.32376 4.89844 5.91974 4.89844 6.79981V12.7451Z",
|
|
59772
|
+
fill: "currentColor"
|
|
59773
|
+
}),
|
|
59774
|
+
(0, react_jsx_runtime.jsx)("path", {
|
|
59775
|
+
d: "M11.1523 13.0995V14.4999H6.30273V13.0995H11.1523Z",
|
|
59776
|
+
fill: "currentColor"
|
|
59777
|
+
}),
|
|
59778
|
+
(0, react_jsx_runtime.jsx)("path", {
|
|
59779
|
+
d: "M10.2148 10V11.4004H6.30273V10H10.2148Z",
|
|
59780
|
+
fill: "currentColor"
|
|
59781
|
+
})
|
|
59782
|
+
]
|
|
59783
|
+
});
|
|
59347
59784
|
LANGS = [
|
|
59348
59785
|
typescript_default,
|
|
59349
59786
|
shellscript_default,
|
|
@@ -59460,11 +59897,15 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
59460
59897
|
lastCode;
|
|
59461
59898
|
lastLang;
|
|
59462
59899
|
lastResult;
|
|
59900
|
+
generation = 0;
|
|
59901
|
+
lastFrame;
|
|
59463
59902
|
reset(resolved) {
|
|
59464
59903
|
this.resolved = resolved;
|
|
59465
59904
|
this.prefix = "";
|
|
59466
59905
|
this.spans = [];
|
|
59467
59906
|
this.state = void 0;
|
|
59907
|
+
this.generation += 1;
|
|
59908
|
+
this.lastFrame = void 0;
|
|
59468
59909
|
}
|
|
59469
59910
|
/** Tokenize `text` with `resolved`, resuming from the cached grammar state when one exists. */
|
|
59470
59911
|
tokenize(resolved, text) {
|
|
@@ -59475,28 +59916,23 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
59475
59916
|
});
|
|
59476
59917
|
}
|
|
59477
59918
|
/**
|
|
59478
|
-
* Tokenize
|
|
59479
|
-
*
|
|
59480
|
-
*
|
|
59481
|
-
*
|
|
59482
|
-
* a React caller can reuse cached line elements. A lazy grammar not yet
|
|
59483
|
-
* loaded returns `undefined` and loads in the background exactly as
|
|
59484
|
-
* {@link highlightToHtml} does; the next call after it registers highlights.
|
|
59485
|
-
* @param code - the fence text accumulated so far (display-trimmed, no synthetic trailing newline).
|
|
59486
|
-
* @param lang - the language hint (a markdown fence info string).
|
|
59487
|
-
* @returns one entry per line of `code` (each an array of runs), or `undefined` for unknown or not-yet-loaded languages.
|
|
59919
|
+
* Tokenize one update as a delta for a retained renderer.
|
|
59920
|
+
* @param code - the fence text accumulated so far.
|
|
59921
|
+
* @param lang - the language hint.
|
|
59922
|
+
* @returns Newly completed lines plus the current tail, or `undefined` for the plain arm.
|
|
59488
59923
|
*/
|
|
59489
|
-
|
|
59490
|
-
if (code === this.lastCode && lang === this.lastLang && this.
|
|
59924
|
+
updateFrame(code, lang) {
|
|
59925
|
+
if (code === this.lastCode && lang === this.lastLang && this.lastFrame !== void 0) return this.lastFrame;
|
|
59491
59926
|
this.lastCode = code;
|
|
59492
59927
|
this.lastLang = lang;
|
|
59928
|
+
this.lastResult = void 0;
|
|
59493
59929
|
const resolved = lang === void 0 ? void 0 : LANG_ALIASES.get(lang.toLowerCase());
|
|
59494
59930
|
if (resolved === void 0 || !ensureGrammar(resolved)) {
|
|
59495
59931
|
this.reset(void 0);
|
|
59496
|
-
this.lastResult = void 0;
|
|
59497
59932
|
return;
|
|
59498
59933
|
}
|
|
59499
59934
|
if (resolved !== this.resolved || !code.startsWith(this.prefix)) this.reset(resolved);
|
|
59935
|
+
const firstNewLine = this.spans.length;
|
|
59500
59936
|
const rest = code.slice(this.prefix.length);
|
|
59501
59937
|
const lastNewline = rest.lastIndexOf("\n");
|
|
59502
59938
|
if (lastNewline >= 0) {
|
|
@@ -59506,10 +59942,69 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
59506
59942
|
this.state = highlighter().getLastGrammarState(tokens);
|
|
59507
59943
|
this.prefix = code.slice(0, this.prefix.length + lastNewline + 1);
|
|
59508
59944
|
}
|
|
59509
|
-
this.
|
|
59945
|
+
this.lastFrame = {
|
|
59946
|
+
generation: this.generation,
|
|
59947
|
+
appended: this.spans.slice(firstNewLine),
|
|
59948
|
+
tail: this.tokenize(resolved, rest.slice(lastNewline + 1)).map(lineSpans)
|
|
59949
|
+
};
|
|
59950
|
+
return this.lastFrame;
|
|
59951
|
+
}
|
|
59952
|
+
/**
|
|
59953
|
+
* Tokenize the fence's current text into per-line highlighted runs;
|
|
59954
|
+
* `undefined` means the caller renders its plain fallback. Idempotent per
|
|
59955
|
+
* (`code`, `lang`) input — repeated calls return the identical result array —
|
|
59956
|
+
* and a retained line keeps its span-array identity across growing calls, so
|
|
59957
|
+
* a React caller can reuse cached line elements. A lazy grammar not yet
|
|
59958
|
+
* loaded returns `undefined` and loads in the background exactly as
|
|
59959
|
+
* {@link highlightToHtml} does; the next call after it registers highlights.
|
|
59960
|
+
* @param code - the fence text accumulated so far (display-trimmed, no synthetic trailing newline).
|
|
59961
|
+
* @param lang - the language hint (a markdown fence info string).
|
|
59962
|
+
* @returns one entry per line of `code` (each an array of runs), or `undefined` for unknown or not-yet-loaded languages.
|
|
59963
|
+
*/
|
|
59964
|
+
update(code, lang) {
|
|
59965
|
+
if (code === this.lastCode && lang === this.lastLang && this.lastResult !== void 0) return this.lastResult;
|
|
59966
|
+
const frame = this.updateFrame(code, lang);
|
|
59967
|
+
if (frame === void 0) return void 0;
|
|
59968
|
+
this.lastResult = [...this.spans, ...frame.tail];
|
|
59510
59969
|
return this.lastResult;
|
|
59511
59970
|
}
|
|
59512
59971
|
};
|
|
59972
|
+
noop = () => {};
|
|
59973
|
+
HighlightViewport = class {
|
|
59974
|
+
observer;
|
|
59975
|
+
activators = /* @__PURE__ */ new Map();
|
|
59976
|
+
observe(element, activate) {
|
|
59977
|
+
if (typeof IntersectionObserver === "undefined") {
|
|
59978
|
+
activate();
|
|
59979
|
+
return noop;
|
|
59980
|
+
}
|
|
59981
|
+
this.observer ??= new IntersectionObserver((entries) => {
|
|
59982
|
+
for (const entry of entries) {
|
|
59983
|
+
if (!entry.isIntersecting) continue;
|
|
59984
|
+
const current = this.activators.get(entry.target);
|
|
59985
|
+
/* v8 ignore next -- the observer reports only elements still registered with it. */
|
|
59986
|
+
if (current === void 0) continue;
|
|
59987
|
+
this.activators.delete(entry.target);
|
|
59988
|
+
this.observer?.unobserve(entry.target);
|
|
59989
|
+
current();
|
|
59990
|
+
}
|
|
59991
|
+
this.releaseEmptyObserver();
|
|
59992
|
+
});
|
|
59993
|
+
this.activators.set(element, activate);
|
|
59994
|
+
this.observer.observe(element);
|
|
59995
|
+
return () => {
|
|
59996
|
+
this.activators.delete(element);
|
|
59997
|
+
this.observer?.unobserve(element);
|
|
59998
|
+
this.releaseEmptyObserver();
|
|
59999
|
+
};
|
|
60000
|
+
}
|
|
60001
|
+
releaseEmptyObserver() {
|
|
60002
|
+
if (this.activators.size > 0) return;
|
|
60003
|
+
this.observer?.disconnect();
|
|
60004
|
+
this.observer = void 0;
|
|
60005
|
+
}
|
|
60006
|
+
};
|
|
60007
|
+
highlightViewport = new HighlightViewport();
|
|
59513
60008
|
DiffBlock_module_default.path, DiffBlock_module_default.del, DiffBlock_module_default.add, DiffBlock_module_default.gap;
|
|
59514
60009
|
UNSTABLE_TAIL_BLOCKS = 2;
|
|
59515
60010
|
IncrementalMarkdownParser = class {
|
|
@@ -59519,10 +60014,112 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
59519
60014
|
frozen = [];
|
|
59520
60015
|
generation = 0;
|
|
59521
60016
|
cached = null;
|
|
60017
|
+
openFence = null;
|
|
59522
60018
|
/** @param parse - Grammar shared with whatever renders the blocks, so boundaries agree. */
|
|
59523
60019
|
constructor(parse) {
|
|
59524
60020
|
this.parse = parse;
|
|
59525
60021
|
}
|
|
60022
|
+
/** Parse one unclosed-fence content slice through the caller's grammar. */
|
|
60023
|
+
fenceValue(state, text) {
|
|
60024
|
+
const root = this.parse(`${state.syntheticPrefix}${text}`);
|
|
60025
|
+
if (root.children.length !== 1) return void 0;
|
|
60026
|
+
const node = root.children[0];
|
|
60027
|
+
return node.type === "code" ? node.value : void 0;
|
|
60028
|
+
}
|
|
60029
|
+
/** Recognize the parsed tail's final unclosed fence and prepare its incremental content frontier. */
|
|
60030
|
+
openFenceState(text, base, tail, frozen) {
|
|
60031
|
+
const codeIndex = tail.length - 1;
|
|
60032
|
+
const block = tail[codeIndex];
|
|
60033
|
+
if (block?.node.type !== "code") return null;
|
|
60034
|
+
const node = block.node;
|
|
60035
|
+
const startOffset = node.position?.start.offset;
|
|
60036
|
+
const end = node.position?.end;
|
|
60037
|
+
if (startOffset === void 0 || end?.offset === void 0) return null;
|
|
60038
|
+
/* v8 ignore next -- the caller's parse slice ends at text.length, so its final node ends there. */
|
|
60039
|
+
if (base + end.offset !== text.length) return null;
|
|
60040
|
+
const source = text.slice(base);
|
|
60041
|
+
const previousLf = source.lastIndexOf("\n", startOffset - 1);
|
|
60042
|
+
const previousCr = source.lastIndexOf("\r", startOffset - 1);
|
|
60043
|
+
const lineStart = Math.max(previousLf, previousCr) + 1;
|
|
60044
|
+
const terminatorEnd = lineTerminatorEnd(source, startOffset);
|
|
60045
|
+
/* v8 ignore next -- a parser-confirmed fenced code node requires its opening line terminator. */
|
|
60046
|
+
if (terminatorEnd === void 0) return null;
|
|
60047
|
+
if (terminatorEnd === source.length && source.endsWith("\r")) return null;
|
|
60048
|
+
const openingLine = source.slice(lineStart, terminatorEnd).replace(/[\r\n]+$/, "");
|
|
60049
|
+
const opening = /^( {0,3})(`{3,}|~{3,})/.exec(openingLine);
|
|
60050
|
+
if (opening === null) return null;
|
|
60051
|
+
const indent = opening[1];
|
|
60052
|
+
const run = opening[2];
|
|
60053
|
+
/* v8 ignore next -- mdast positions a fenced code node at the matched delimiter after indentation. */
|
|
60054
|
+
if (lineStart + indent.length !== startOffset) return null;
|
|
60055
|
+
const marker = run[0];
|
|
60056
|
+
const contentStart = base + terminatorEnd;
|
|
60057
|
+
const content = text.slice(contentStart);
|
|
60058
|
+
if (containsClosingFence(content, marker, run.length)) return null;
|
|
60059
|
+
const syntheticPrefix = `${indent}${run}\n`;
|
|
60060
|
+
const stableLength = committableLinePrefixLength(content);
|
|
60061
|
+
const stableValue = stableLength === 0 ? "" : this.fenceValue({ syntheticPrefix }, content.slice(0, stableLength));
|
|
60062
|
+
if (stableValue === void 0) return null;
|
|
60063
|
+
const pendingStart = contentStart + stableLength;
|
|
60064
|
+
const stableSource = content.slice(0, stableLength);
|
|
60065
|
+
const valuePrefix = stableLength === 0 ? "" : `${stableValue}${trailingLineTerminator(stableSource)}`;
|
|
60066
|
+
const pendingValue = this.fenceValue({ syntheticPrefix }, text.slice(pendingStart));
|
|
60067
|
+
if (pendingValue === void 0 || `${valuePrefix}${pendingValue}` !== node.value) return null;
|
|
60068
|
+
return {
|
|
60069
|
+
marker,
|
|
60070
|
+
markerLength: run.length,
|
|
60071
|
+
syntheticPrefix,
|
|
60072
|
+
codeIndex,
|
|
60073
|
+
frozen,
|
|
60074
|
+
tail,
|
|
60075
|
+
pendingStart,
|
|
60076
|
+
valuePrefix,
|
|
60077
|
+
end: {
|
|
60078
|
+
line: end.line,
|
|
60079
|
+
column: end.column,
|
|
60080
|
+
offset: end.offset
|
|
60081
|
+
},
|
|
60082
|
+
endedWithCarriageReturn: text.endsWith("\r")
|
|
60083
|
+
};
|
|
60084
|
+
}
|
|
60085
|
+
/** Extend a recognized unclosed fence without parsing its completed content prefix again. */
|
|
60086
|
+
updateOpenFence(state, text, previousText) {
|
|
60087
|
+
const pending = text.slice(state.pendingStart);
|
|
60088
|
+
if (containsClosingFence(pending, state.marker, state.markerLength)) return void 0;
|
|
60089
|
+
const pendingValue = this.fenceValue(state, pending);
|
|
60090
|
+
if (pendingValue === void 0) return void 0;
|
|
60091
|
+
const stableLength = committableLinePrefixLength(pending);
|
|
60092
|
+
const stableValue = stableLength === 0 ? "" : this.fenceValue(state, pending.slice(0, stableLength));
|
|
60093
|
+
if (stableValue === void 0) return void 0;
|
|
60094
|
+
const previousNode = state.tail[state.codeIndex].node;
|
|
60095
|
+
const end = advancePoint(state.end, text.slice(previousText.length), state.endedWithCarriageReturn);
|
|
60096
|
+
const node = {
|
|
60097
|
+
...previousNode,
|
|
60098
|
+
value: `${state.valuePrefix}${pendingValue}`,
|
|
60099
|
+
position: {
|
|
60100
|
+
start: previousNode.position.start,
|
|
60101
|
+
end
|
|
60102
|
+
}
|
|
60103
|
+
};
|
|
60104
|
+
const tail = state.tail.map((entry, index) => index === state.codeIndex ? {
|
|
60105
|
+
...entry,
|
|
60106
|
+
node
|
|
60107
|
+
} : entry);
|
|
60108
|
+
const cached = {
|
|
60109
|
+
frozen: state.frozen,
|
|
60110
|
+
tail,
|
|
60111
|
+
generation: this.generation
|
|
60112
|
+
};
|
|
60113
|
+
this.openFence = {
|
|
60114
|
+
...state,
|
|
60115
|
+
tail,
|
|
60116
|
+
pendingStart: state.pendingStart + stableLength,
|
|
60117
|
+
valuePrefix: stableLength === 0 ? state.valuePrefix : `${state.valuePrefix}${stableValue}${trailingLineTerminator(pending.slice(0, stableLength))}`,
|
|
60118
|
+
end,
|
|
60119
|
+
endedWithCarriageReturn: text.endsWith("\r")
|
|
60120
|
+
};
|
|
60121
|
+
return cached;
|
|
60122
|
+
}
|
|
59526
60123
|
/**
|
|
59527
60124
|
* Fold the current accumulated text and return the frozen/tail split.
|
|
59528
60125
|
* Idempotent for identical input (the previous result is returned as-is),
|
|
@@ -59536,8 +60133,19 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
59536
60133
|
this.prevText = "";
|
|
59537
60134
|
this.tailStart = 0;
|
|
59538
60135
|
this.frozen = [];
|
|
60136
|
+
this.openFence = null;
|
|
59539
60137
|
this.generation += 1;
|
|
59540
60138
|
}
|
|
60139
|
+
const previousText = this.prevText;
|
|
60140
|
+
if (previousText !== "" && this.openFence !== null) {
|
|
60141
|
+
const incremental = this.updateOpenFence(this.openFence, text, previousText);
|
|
60142
|
+
if (incremental !== void 0) {
|
|
60143
|
+
this.prevText = text;
|
|
60144
|
+
this.cached = incremental;
|
|
60145
|
+
return incremental;
|
|
60146
|
+
}
|
|
60147
|
+
this.openFence = null;
|
|
60148
|
+
}
|
|
59541
60149
|
this.prevText = text;
|
|
59542
60150
|
const base = this.tailStart;
|
|
59543
60151
|
const blocks = this.parse(text.slice(base)).children;
|
|
@@ -59562,6 +60170,7 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
59562
60170
|
tail,
|
|
59563
60171
|
generation: this.generation
|
|
59564
60172
|
};
|
|
60173
|
+
this.openFence = this.openFenceState(text, base, tail, this.cached.frozen);
|
|
59565
60174
|
return this.cached;
|
|
59566
60175
|
}
|
|
59567
60176
|
};
|
|
@@ -59752,6 +60361,7 @@ XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
|
59752
60361
|
},
|
|
59753
60362
|
tabIndex: 0
|
|
59754
60363
|
};
|
|
60364
|
+
STREAMING_LINE_GROUP_SIZE = 32;
|
|
59755
60365
|
StreamingRenderer = class {
|
|
59756
60366
|
labels;
|
|
59757
60367
|
parser = new IncrementalMarkdownParser(parseGfm);
|