@dudko.dev/agent-web-ui 0.0.0 → 0.0.1
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/LICENSE +21 -0
- package/README.md +251 -5
- package/dist/canvas.cjs +266 -0
- package/dist/canvas.cjs.map +1 -0
- package/dist/canvas.d.cts +105 -0
- package/dist/canvas.d.ts +105 -0
- package/dist/canvas.js +200 -0
- package/dist/canvas.js.map +1 -0
- package/dist/chunk-4EHUITGU.js +342 -0
- package/dist/chunk-4EHUITGU.js.map +1 -0
- package/dist/chunk-7O64ZI6Z.js +125 -0
- package/dist/chunk-7O64ZI6Z.js.map +1 -0
- package/dist/chunk-A55Q377T.js +342 -0
- package/dist/chunk-A55Q377T.js.map +1 -0
- package/dist/chunk-EL2YCROY.js +127 -0
- package/dist/chunk-EL2YCROY.js.map +1 -0
- package/dist/chunk-GB7RZJMG.js +98 -0
- package/dist/chunk-GB7RZJMG.js.map +1 -0
- package/dist/chunk-KZQB35LS.js +22 -0
- package/dist/chunk-KZQB35LS.js.map +1 -0
- package/dist/chunk-P2F2P3JC.js +400 -0
- package/dist/chunk-P2F2P3JC.js.map +1 -0
- package/dist/chunk-TPK25QGK.js +342 -0
- package/dist/chunk-TPK25QGK.js.map +1 -0
- package/dist/en-CcNUz2tN.d.cts +342 -0
- package/dist/en-CcNUz2tN.d.ts +342 -0
- package/dist/index.cjs +4143 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +919 -0
- package/dist/index.d.ts +919 -0
- package/dist/index.js +3771 -0
- package/dist/index.js.map +1 -0
- package/dist/labels-B5xpIGf_.d.cts +25 -0
- package/dist/labels-B5xpIGf_.d.ts +25 -0
- package/dist/labels-D5BrHct4.d.cts +1208 -0
- package/dist/labels-UuWI7wPo.d.ts +1208 -0
- package/dist/locales/be.cjs +794 -0
- package/dist/locales/be.cjs.map +1 -0
- package/dist/locales/be.d.cts +14 -0
- package/dist/locales/be.d.ts +14 -0
- package/dist/locales/be.js +374 -0
- package/dist/locales/be.js.map +1 -0
- package/dist/locales/bg.cjs +747 -0
- package/dist/locales/bg.cjs.map +1 -0
- package/dist/locales/bg.d.cts +14 -0
- package/dist/locales/bg.d.ts +14 -0
- package/dist/locales/bg.js +327 -0
- package/dist/locales/bg.js.map +1 -0
- package/dist/locales/ca.cjs +773 -0
- package/dist/locales/ca.cjs.map +1 -0
- package/dist/locales/ca.d.cts +14 -0
- package/dist/locales/ca.d.ts +14 -0
- package/dist/locales/ca.js +353 -0
- package/dist/locales/ca.js.map +1 -0
- package/dist/locales/cs.cjs +794 -0
- package/dist/locales/cs.cjs.map +1 -0
- package/dist/locales/cs.d.cts +14 -0
- package/dist/locales/cs.d.ts +14 -0
- package/dist/locales/cs.js +374 -0
- package/dist/locales/cs.js.map +1 -0
- package/dist/locales/da.cjs +747 -0
- package/dist/locales/da.cjs.map +1 -0
- package/dist/locales/da.d.cts +14 -0
- package/dist/locales/da.d.ts +14 -0
- package/dist/locales/da.js +327 -0
- package/dist/locales/da.js.map +1 -0
- package/dist/locales/de.cjs +756 -0
- package/dist/locales/de.cjs.map +1 -0
- package/dist/locales/de.d.cts +14 -0
- package/dist/locales/de.d.ts +14 -0
- package/dist/locales/de.js +336 -0
- package/dist/locales/de.js.map +1 -0
- package/dist/locales/el.cjs +756 -0
- package/dist/locales/el.cjs.map +1 -0
- package/dist/locales/el.d.cts +14 -0
- package/dist/locales/el.d.ts +14 -0
- package/dist/locales/el.js +336 -0
- package/dist/locales/el.js.map +1 -0
- package/dist/locales/en.cjs +753 -0
- package/dist/locales/en.cjs.map +1 -0
- package/dist/locales/en.d.cts +10 -0
- package/dist/locales/en.d.ts +10 -0
- package/dist/locales/en.js +333 -0
- package/dist/locales/en.js.map +1 -0
- package/dist/locales/es-419.cjs +778 -0
- package/dist/locales/es-419.cjs.map +1 -0
- package/dist/locales/es-419.d.cts +16 -0
- package/dist/locales/es-419.d.ts +16 -0
- package/dist/locales/es-419.js +23 -0
- package/dist/locales/es-419.js.map +1 -0
- package/dist/locales/es.cjs +769 -0
- package/dist/locales/es.cjs.map +1 -0
- package/dist/locales/es.d.cts +14 -0
- package/dist/locales/es.d.ts +14 -0
- package/dist/locales/es.js +14 -0
- package/dist/locales/es.js.map +1 -0
- package/dist/locales/fi.cjs +753 -0
- package/dist/locales/fi.cjs.map +1 -0
- package/dist/locales/fi.d.cts +14 -0
- package/dist/locales/fi.d.ts +14 -0
- package/dist/locales/fi.js +333 -0
- package/dist/locales/fi.js.map +1 -0
- package/dist/locales/fr-CA.cjs +777 -0
- package/dist/locales/fr-CA.cjs.map +1 -0
- package/dist/locales/fr-CA.d.cts +17 -0
- package/dist/locales/fr-CA.d.ts +17 -0
- package/dist/locales/fr-CA.js +22 -0
- package/dist/locales/fr-CA.js.map +1 -0
- package/dist/locales/fr.cjs +769 -0
- package/dist/locales/fr.cjs.map +1 -0
- package/dist/locales/fr.d.cts +14 -0
- package/dist/locales/fr.d.ts +14 -0
- package/dist/locales/fr.js +14 -0
- package/dist/locales/fr.js.map +1 -0
- package/dist/locales/gn.cjs +750 -0
- package/dist/locales/gn.cjs.map +1 -0
- package/dist/locales/gn.d.cts +16 -0
- package/dist/locales/gn.d.ts +16 -0
- package/dist/locales/gn.js +330 -0
- package/dist/locales/gn.js.map +1 -0
- package/dist/locales/hr.cjs +769 -0
- package/dist/locales/hr.cjs.map +1 -0
- package/dist/locales/hr.d.cts +14 -0
- package/dist/locales/hr.d.ts +14 -0
- package/dist/locales/hr.js +349 -0
- package/dist/locales/hr.js.map +1 -0
- package/dist/locales/ht.cjs +750 -0
- package/dist/locales/ht.cjs.map +1 -0
- package/dist/locales/ht.d.cts +16 -0
- package/dist/locales/ht.d.ts +16 -0
- package/dist/locales/ht.js +330 -0
- package/dist/locales/ht.js.map +1 -0
- package/dist/locales/hu.cjs +753 -0
- package/dist/locales/hu.cjs.map +1 -0
- package/dist/locales/hu.d.cts +14 -0
- package/dist/locales/hu.d.ts +14 -0
- package/dist/locales/hu.js +333 -0
- package/dist/locales/hu.js.map +1 -0
- package/dist/locales/index.cjs +537 -0
- package/dist/locales/index.cjs.map +1 -0
- package/dist/locales/index.d.cts +38 -0
- package/dist/locales/index.d.ts +38 -0
- package/dist/locales/index.js +105 -0
- package/dist/locales/index.js.map +1 -0
- package/dist/locales/it.cjs +777 -0
- package/dist/locales/it.cjs.map +1 -0
- package/dist/locales/it.d.cts +14 -0
- package/dist/locales/it.d.ts +14 -0
- package/dist/locales/it.js +357 -0
- package/dist/locales/it.js.map +1 -0
- package/dist/locales/nb.cjs +747 -0
- package/dist/locales/nb.cjs.map +1 -0
- package/dist/locales/nb.d.cts +14 -0
- package/dist/locales/nb.d.ts +14 -0
- package/dist/locales/nb.js +327 -0
- package/dist/locales/nb.js.map +1 -0
- package/dist/locales/nl.cjs +753 -0
- package/dist/locales/nl.cjs.map +1 -0
- package/dist/locales/nl.d.cts +14 -0
- package/dist/locales/nl.d.ts +14 -0
- package/dist/locales/nl.js +333 -0
- package/dist/locales/nl.js.map +1 -0
- package/dist/locales/pl.cjs +794 -0
- package/dist/locales/pl.cjs.map +1 -0
- package/dist/locales/pl.d.cts +14 -0
- package/dist/locales/pl.d.ts +14 -0
- package/dist/locales/pl.js +374 -0
- package/dist/locales/pl.js.map +1 -0
- package/dist/locales/pt-BR.cjs +773 -0
- package/dist/locales/pt-BR.cjs.map +1 -0
- package/dist/locales/pt-BR.d.cts +14 -0
- package/dist/locales/pt-BR.d.ts +14 -0
- package/dist/locales/pt-BR.js +353 -0
- package/dist/locales/pt-BR.js.map +1 -0
- package/dist/locales/pt.cjs +777 -0
- package/dist/locales/pt.cjs.map +1 -0
- package/dist/locales/pt.d.cts +14 -0
- package/dist/locales/pt.d.ts +14 -0
- package/dist/locales/pt.js +357 -0
- package/dist/locales/pt.js.map +1 -0
- package/dist/locales/qu.cjs +756 -0
- package/dist/locales/qu.cjs.map +1 -0
- package/dist/locales/qu.d.cts +16 -0
- package/dist/locales/qu.d.ts +16 -0
- package/dist/locales/qu.js +336 -0
- package/dist/locales/qu.js.map +1 -0
- package/dist/locales/ro.cjs +769 -0
- package/dist/locales/ro.cjs.map +1 -0
- package/dist/locales/ro.d.cts +14 -0
- package/dist/locales/ro.d.ts +14 -0
- package/dist/locales/ro.js +349 -0
- package/dist/locales/ro.js.map +1 -0
- package/dist/locales/ru.cjs +789 -0
- package/dist/locales/ru.cjs.map +1 -0
- package/dist/locales/ru.d.cts +14 -0
- package/dist/locales/ru.d.ts +14 -0
- package/dist/locales/ru.js +369 -0
- package/dist/locales/ru.js.map +1 -0
- package/dist/locales/sk.cjs +794 -0
- package/dist/locales/sk.cjs.map +1 -0
- package/dist/locales/sk.d.cts +14 -0
- package/dist/locales/sk.d.ts +14 -0
- package/dist/locales/sk.js +374 -0
- package/dist/locales/sk.js.map +1 -0
- package/dist/locales/sq.cjs +753 -0
- package/dist/locales/sq.cjs.map +1 -0
- package/dist/locales/sq.d.cts +14 -0
- package/dist/locales/sq.d.ts +14 -0
- package/dist/locales/sq.js +333 -0
- package/dist/locales/sq.js.map +1 -0
- package/dist/locales/sr-Latn.cjs +841 -0
- package/dist/locales/sr-Latn.cjs.map +1 -0
- package/dist/locales/sr-Latn.d.cts +17 -0
- package/dist/locales/sr-Latn.d.ts +17 -0
- package/dist/locales/sr-Latn.js +86 -0
- package/dist/locales/sr-Latn.js.map +1 -0
- package/dist/locales/sr.cjs +769 -0
- package/dist/locales/sr.cjs.map +1 -0
- package/dist/locales/sr.d.cts +14 -0
- package/dist/locales/sr.d.ts +14 -0
- package/dist/locales/sr.js +14 -0
- package/dist/locales/sr.js.map +1 -0
- package/dist/locales/sv.cjs +753 -0
- package/dist/locales/sv.cjs.map +1 -0
- package/dist/locales/sv.d.cts +14 -0
- package/dist/locales/sv.d.ts +14 -0
- package/dist/locales/sv.js +333 -0
- package/dist/locales/sv.js.map +1 -0
- package/dist/locales/tr.cjs +750 -0
- package/dist/locales/tr.cjs.map +1 -0
- package/dist/locales/tr.d.cts +14 -0
- package/dist/locales/tr.d.ts +14 -0
- package/dist/locales/tr.js +330 -0
- package/dist/locales/tr.js.map +1 -0
- package/dist/locales/uk.cjs +794 -0
- package/dist/locales/uk.cjs.map +1 -0
- package/dist/locales/uk.d.cts +14 -0
- package/dist/locales/uk.d.ts +14 -0
- package/dist/locales/uk.js +374 -0
- package/dist/locales/uk.js.map +1 -0
- package/dist/markdown.cjs +620 -0
- package/dist/markdown.cjs.map +1 -0
- package/dist/markdown.d.cts +153 -0
- package/dist/markdown.d.ts +153 -0
- package/dist/markdown.js +573 -0
- package/dist/markdown.js.map +1 -0
- package/dist/mcp-app-entry-BA-Ca39z.d.ts +1480 -0
- package/dist/mcp-app-entry-tybABaHg.d.cts +1480 -0
- package/dist/mcp-app-policy-DXKQ2jjM.d.cts +73 -0
- package/dist/mcp-app-policy-DXKQ2jjM.d.ts +73 -0
- package/dist/mcp-app-sandbox.cjs +323 -0
- package/dist/mcp-app-sandbox.cjs.map +1 -0
- package/dist/mcp-app-sandbox.d.cts +70 -0
- package/dist/mcp-app-sandbox.d.ts +70 -0
- package/dist/mcp-app-sandbox.js +209 -0
- package/dist/mcp-app-sandbox.js.map +1 -0
- package/dist/mcp-app.cjs +980 -0
- package/dist/mcp-app.cjs.map +1 -0
- package/dist/mcp-app.d.cts +3 -0
- package/dist/mcp-app.d.ts +3 -0
- package/dist/mcp-app.js +816 -0
- package/dist/mcp-app.js.map +1 -0
- package/dist/pipeline.cjs +845 -0
- package/dist/pipeline.cjs.map +1 -0
- package/dist/pipeline.css +1407 -0
- package/dist/pipeline.d.cts +348 -0
- package/dist/pipeline.d.ts +348 -0
- package/dist/pipeline.js +778 -0
- package/dist/pipeline.js.map +1 -0
- package/dist/styles.css +4109 -0
- package/dist/types-BmvgYUzF.d.cts +19 -0
- package/dist/types-Cr5gmUts.d.ts +19 -0
- package/package.json +155 -8
|
@@ -0,0 +1,620 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/markdown/index.ts
|
|
21
|
+
var markdown_exports = {};
|
|
22
|
+
__export(markdown_exports, {
|
|
23
|
+
MARKDOWN_CACHE_MAX: () => MARKDOWN_CACHE_MAX,
|
|
24
|
+
MARKDOWN_LONG_CELL: () => MARKDOWN_LONG_CELL,
|
|
25
|
+
emptyMarkdownStream: () => emptyMarkdownStream,
|
|
26
|
+
markdownCellIsLong: () => markdownCellIsLong,
|
|
27
|
+
markdownPlainText: () => markdownPlainText,
|
|
28
|
+
markdownSettled: () => markdownSettled,
|
|
29
|
+
parseMarkdown: () => parseMarkdown,
|
|
30
|
+
parseMarkdownCached: () => parseMarkdownCached,
|
|
31
|
+
parseMarkdownInline: () => parseMarkdownInline,
|
|
32
|
+
parseMarkdownStreaming: () => parseMarkdownStreaming,
|
|
33
|
+
safeHref: () => safeHref,
|
|
34
|
+
workspaceLinkPath: () => workspaceLinkPath
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(markdown_exports);
|
|
37
|
+
|
|
38
|
+
// src/named-files.ts
|
|
39
|
+
var PATH_MAX = 512;
|
|
40
|
+
var workspacePathOf = (raw) => {
|
|
41
|
+
if (raw.length < 2 || raw.length > PATH_MAX) return void 0;
|
|
42
|
+
if (raw[0] !== "/" || raw[1] === "/") return void 0;
|
|
43
|
+
if (/[\u0000-\u001f\u007f\\]/.test(raw)) return void 0;
|
|
44
|
+
const segments = raw.slice(1).split("/");
|
|
45
|
+
for (const s of segments) {
|
|
46
|
+
if (!s || s === "." || s === ".." || s.trim() !== s) return void 0;
|
|
47
|
+
}
|
|
48
|
+
return raw;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// src/markdown/parse.ts
|
|
52
|
+
var decoded = (s) => {
|
|
53
|
+
if (!s.includes("%")) return s;
|
|
54
|
+
try {
|
|
55
|
+
return decodeURIComponent(s);
|
|
56
|
+
} catch {
|
|
57
|
+
return s;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
var PATH_MAX2 = 512;
|
|
61
|
+
var DEST_MAX = 9 * PATH_MAX2;
|
|
62
|
+
var TITLE_MAX = PATH_MAX2;
|
|
63
|
+
var workspaceLinkPath = (raw) => {
|
|
64
|
+
const runs = parseMarkdownInline(`[x](${raw})`);
|
|
65
|
+
return runs.length === 1 && runs[0].t === "file" ? runs[0].path : void 0;
|
|
66
|
+
};
|
|
67
|
+
var safeHref = (url) => {
|
|
68
|
+
const u = url.trim();
|
|
69
|
+
return /^(https?:\/\/|mailto:)[^\s]+$/i.test(u) ? u : void 0;
|
|
70
|
+
};
|
|
71
|
+
var spaceCode = (code) => code === 32 || code >= 9 && code <= 13 || code > 127 && /\s/.test(String.fromCharCode(code));
|
|
72
|
+
var isSpace = (c) => c === void 0 || spaceCode(c.charCodeAt(0));
|
|
73
|
+
var isWord = (c) => {
|
|
74
|
+
if (c === void 0) return false;
|
|
75
|
+
const code = c.charCodeAt(0);
|
|
76
|
+
if (code < 128)
|
|
77
|
+
return code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122;
|
|
78
|
+
return /[\p{L}\p{N}]/u.test(c);
|
|
79
|
+
};
|
|
80
|
+
var URL_START = /^https?:\/\//i;
|
|
81
|
+
var URL_TAIL = /[.,;:!?'")\]]+$/;
|
|
82
|
+
var nextOf = (text, test) => {
|
|
83
|
+
const next = new Int32Array(text.length + 1);
|
|
84
|
+
next[text.length] = text.length;
|
|
85
|
+
for (let i = text.length - 1; i >= 0; i--) next[i] = test(text.charCodeAt(i)) ? i : next[i + 1];
|
|
86
|
+
return next;
|
|
87
|
+
};
|
|
88
|
+
var pushText = (out, v) => {
|
|
89
|
+
if (!v) return;
|
|
90
|
+
const last = out[out.length - 1];
|
|
91
|
+
if (last?.t === "text") last.v += v;
|
|
92
|
+
else out.push({ t: "text", v });
|
|
93
|
+
};
|
|
94
|
+
var parseMarkdownInline = (source, depth = 0, tail = false, words = false) => {
|
|
95
|
+
const text = tail ? source.replace(/[*_~`]+$/, "") : source;
|
|
96
|
+
if (depth > 8) return text ? [{ t: "text", v: text }] : [];
|
|
97
|
+
const n = text.length;
|
|
98
|
+
const closeBracket = nextOf(text, (c) => c === 93);
|
|
99
|
+
const closeParen = nextOf(text, (c) => c === 41);
|
|
100
|
+
const newline = nextOf(text, (c) => c === 10);
|
|
101
|
+
const space = nextOf(text, spaceCode);
|
|
102
|
+
const runs = /* @__PURE__ */ new Map();
|
|
103
|
+
for (let i2 = 0; i2 < n; ) {
|
|
104
|
+
if (text[i2] !== "`") {
|
|
105
|
+
i2++;
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
let j = i2;
|
|
109
|
+
while (j < n && text[j] === "`") j++;
|
|
110
|
+
const list = runs.get(j - i2) ?? [];
|
|
111
|
+
list.push(i2);
|
|
112
|
+
runs.set(j - i2, list);
|
|
113
|
+
i2 = j;
|
|
114
|
+
}
|
|
115
|
+
const cursor = /* @__PURE__ */ new Map();
|
|
116
|
+
let lookups;
|
|
117
|
+
const look = () => lookups ??= {
|
|
118
|
+
lt: nextOf(text, (c) => c === 60),
|
|
119
|
+
gt: nextOf(text, (c) => c === 62),
|
|
120
|
+
openParen: nextOf(text, (c) => c === 40),
|
|
121
|
+
dq: nextOf(text, (c) => c === 34),
|
|
122
|
+
sq: nextOf(text, (c) => c === 39),
|
|
123
|
+
solid: nextOf(text, (c) => !spaceCode(c))
|
|
124
|
+
};
|
|
125
|
+
let readAt = -1;
|
|
126
|
+
let read;
|
|
127
|
+
const fileLinkAt = (close) => {
|
|
128
|
+
if (close !== readAt) {
|
|
129
|
+
readAt = close;
|
|
130
|
+
read = readFileLink(close + 2);
|
|
131
|
+
}
|
|
132
|
+
return read;
|
|
133
|
+
};
|
|
134
|
+
const readFileLink = (start) => {
|
|
135
|
+
const x = look();
|
|
136
|
+
const line = newline[start];
|
|
137
|
+
const p = x.solid[start];
|
|
138
|
+
if (p >= n || p > line) return void 0;
|
|
139
|
+
let from;
|
|
140
|
+
let to;
|
|
141
|
+
let after;
|
|
142
|
+
if (text[p] === "<") {
|
|
143
|
+
from = p + 1;
|
|
144
|
+
if (from < n && text[from] !== "/") return void 0;
|
|
145
|
+
to = x.gt[from];
|
|
146
|
+
const bad = Math.min(x.lt[from], line);
|
|
147
|
+
if (to >= n) return bad >= n && n - from <= DEST_MAX ? "open" : void 0;
|
|
148
|
+
if (bad < to || to - from > DEST_MAX) return void 0;
|
|
149
|
+
after = to + 1;
|
|
150
|
+
} else if (text[p] === "/") {
|
|
151
|
+
from = p;
|
|
152
|
+
if (text[p + 1] === "/") return void 0;
|
|
153
|
+
to = Math.min(space[p], closeParen[p]);
|
|
154
|
+
const bad = Math.min(x.lt[p], x.gt[p], x.openParen[p]);
|
|
155
|
+
if (to >= n) return bad >= n && n - from <= DEST_MAX ? "open" : void 0;
|
|
156
|
+
if (bad < to || to - from > DEST_MAX) return void 0;
|
|
157
|
+
after = to;
|
|
158
|
+
} else return void 0;
|
|
159
|
+
const path = workspacePathOf(decoded(text.slice(from, to)));
|
|
160
|
+
if (!path) return void 0;
|
|
161
|
+
let q = x.solid[after];
|
|
162
|
+
if (q > line) return void 0;
|
|
163
|
+
if (q >= n) return "open";
|
|
164
|
+
if ((text[q] === '"' || text[q] === "'") && q > after) {
|
|
165
|
+
const shut = (text[q] === '"' ? x.dq : x.sq)[q + 1];
|
|
166
|
+
if (shut >= n) return line >= n && n - q <= TITLE_MAX ? "open" : void 0;
|
|
167
|
+
if (shut > line || shut - q > TITLE_MAX) return void 0;
|
|
168
|
+
q = x.solid[shut + 1];
|
|
169
|
+
if (q > line) return void 0;
|
|
170
|
+
if (q >= n) return "open";
|
|
171
|
+
}
|
|
172
|
+
return text[q] === ")" ? { path, end: q } : void 0;
|
|
173
|
+
};
|
|
174
|
+
const tokens = [];
|
|
175
|
+
const flush = (from, to) => {
|
|
176
|
+
let at = from;
|
|
177
|
+
while (at < to) {
|
|
178
|
+
const nl = Math.min(newline[at], to);
|
|
179
|
+
if (nl > at) tokens.push({ t: "text", v: text.slice(at, nl) });
|
|
180
|
+
if (nl < to) tokens.push({ t: "br" });
|
|
181
|
+
at = nl + 1;
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
let plain = 0;
|
|
185
|
+
let i = 0;
|
|
186
|
+
while (i < n) {
|
|
187
|
+
const c = text[i];
|
|
188
|
+
if (c === "`") {
|
|
189
|
+
let j = i;
|
|
190
|
+
while (j < n && text[j] === "`") j++;
|
|
191
|
+
const len = j - i;
|
|
192
|
+
const list = runs.get(len);
|
|
193
|
+
let k = cursor.get(len) ?? 0;
|
|
194
|
+
while (k < list.length && list[k] <= i) k++;
|
|
195
|
+
cursor.set(len, k);
|
|
196
|
+
if (k < list.length) {
|
|
197
|
+
flush(plain, i);
|
|
198
|
+
const end = list[k];
|
|
199
|
+
cursor.set(len, k + 1);
|
|
200
|
+
const body = text.slice(j, end).replace(/\n/g, " ");
|
|
201
|
+
const v = /^ .* $/s.test(body) && body.trim() ? body.slice(1, -1) : body;
|
|
202
|
+
const path = !words && v.includes("/") ? workspacePathOf(v) : void 0;
|
|
203
|
+
tokens.push(path ? { t: "code", v, path } : { t: "code", v });
|
|
204
|
+
i = plain = end + len;
|
|
205
|
+
} else if (tail) {
|
|
206
|
+
flush(plain, i);
|
|
207
|
+
const body = text.slice(j).replace(/\n/g, " ");
|
|
208
|
+
tokens.push({ t: "code", v: body.startsWith(" ") && body.trim() ? body.slice(1) : body });
|
|
209
|
+
i = plain = n;
|
|
210
|
+
} else i = j;
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
if (c === "[") {
|
|
214
|
+
const close = closeBracket[i + 1];
|
|
215
|
+
if (close < n && close > i + 1 && close < newline[i] && text[close + 1] === "(") {
|
|
216
|
+
const end = closeParen[close + 2];
|
|
217
|
+
const href = end < n && space[close + 2] >= end ? safeHref(text.slice(close + 2, end)) : void 0;
|
|
218
|
+
if (href) {
|
|
219
|
+
flush(plain, i);
|
|
220
|
+
tokens.push({
|
|
221
|
+
t: "link",
|
|
222
|
+
href,
|
|
223
|
+
c: parseMarkdownInline(text.slice(i + 1, close), depth + 1, false, true)
|
|
224
|
+
});
|
|
225
|
+
i = plain = end + 1;
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
const file = fileLinkAt(close);
|
|
229
|
+
if (file !== void 0 && file !== "open") {
|
|
230
|
+
flush(plain, i);
|
|
231
|
+
tokens.push({
|
|
232
|
+
t: "file",
|
|
233
|
+
path: file.path,
|
|
234
|
+
c: parseMarkdownInline(text.slice(i + 1, close), depth + 1, false, true)
|
|
235
|
+
});
|
|
236
|
+
i = plain = file.end + 1;
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
if (tail && (file === "open" || end >= n && space[close + 2] >= n)) {
|
|
240
|
+
flush(plain, i);
|
|
241
|
+
tokens.push(...parseMarkdownInline(text.slice(i + 1, close), depth + 1, false, true));
|
|
242
|
+
i = plain = n;
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (tail && newline[i] >= n && (close >= n || close === n - 1)) {
|
|
247
|
+
flush(plain, i);
|
|
248
|
+
if (close >= n) {
|
|
249
|
+
i = plain = i + 1;
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
tokens.push(...parseMarkdownInline(text.slice(i + 1, close), depth + 1));
|
|
253
|
+
i = plain = n;
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
i++;
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
if (!words && (c === "h" || c === "H") && URL_START.test(text.slice(i, i + 8)) && !isWord(text[i - 1])) {
|
|
260
|
+
let end = space[i];
|
|
261
|
+
for (let k = i; k < end; k++) {
|
|
262
|
+
if ("<>()".includes(text[k])) {
|
|
263
|
+
end = k;
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
const url = text.slice(i, end).replace(URL_TAIL, "");
|
|
268
|
+
if (url.length > 8) {
|
|
269
|
+
flush(plain, i);
|
|
270
|
+
tokens.push({ t: "link", href: url, c: [{ t: "text", v: url }] });
|
|
271
|
+
i = plain = i + url.length;
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
i++;
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
if (c === "*" || c === "_" || c === "~") {
|
|
278
|
+
let j = i;
|
|
279
|
+
while (j < n && text[j] === c) j++;
|
|
280
|
+
const before = text[i - 1];
|
|
281
|
+
const after = text[j];
|
|
282
|
+
let open = !isSpace(after);
|
|
283
|
+
let close = !isSpace(before);
|
|
284
|
+
if (c === "_" && isWord(before) && isWord(after)) open = close = false;
|
|
285
|
+
const len = j - i;
|
|
286
|
+
if (c === "~" && len !== 2 || !open && !close) {
|
|
287
|
+
i = j;
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
flush(plain, i);
|
|
291
|
+
const sizes = c === "~" ? [2] : len === 1 ? [1] : len === 2 ? [2] : open && !close ? [2, 1] : [1, 2];
|
|
292
|
+
let used = 0;
|
|
293
|
+
for (const size of sizes) {
|
|
294
|
+
tokens.push({ t: "delim", ch: c, n: size, open, close, lead: !isWord(before) });
|
|
295
|
+
used += size;
|
|
296
|
+
}
|
|
297
|
+
if (len > used) tokens.push({ t: "text", v: c.repeat(len - used) });
|
|
298
|
+
i = plain = j;
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
i++;
|
|
302
|
+
}
|
|
303
|
+
flush(plain, n);
|
|
304
|
+
const stacks = [[], [], [], [], [], []];
|
|
305
|
+
const kindOf = (tok) => (tok.ch === "*" ? 0 : tok.ch === "_" ? 2 : 4) + tok.n - 1;
|
|
306
|
+
for (let idx = 0; idx < tokens.length; idx++) {
|
|
307
|
+
const tok = tokens[idx];
|
|
308
|
+
if (tok.t !== "delim") continue;
|
|
309
|
+
const own = stacks[kindOf(tok)];
|
|
310
|
+
const top = own.length ? own[own.length - 1] : -1;
|
|
311
|
+
if (tok.close && top >= 0 && top < idx - 1) {
|
|
312
|
+
own.pop();
|
|
313
|
+
tokens[top].match = idx;
|
|
314
|
+
tok.match = top;
|
|
315
|
+
for (const st of stacks) while (st.length && st[st.length - 1] > top) st.pop();
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
if (tok.open) own.push(idx);
|
|
319
|
+
}
|
|
320
|
+
if (tail) {
|
|
321
|
+
const open = stacks.flat().sort((a, b) => b - a);
|
|
322
|
+
for (const idx of open) {
|
|
323
|
+
const opener = tokens[idx];
|
|
324
|
+
if (!opener.lead) continue;
|
|
325
|
+
opener.match = tokens.length;
|
|
326
|
+
tokens.push({ t: "delim", ch: opener.ch, n: opener.n, open: false, close: true, match: idx });
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
const root = [];
|
|
330
|
+
const frames = [{ out: root, until: -1 }];
|
|
331
|
+
tokens.forEach((tok, idx) => {
|
|
332
|
+
const frame = frames[frames.length - 1];
|
|
333
|
+
if (tok.t !== "delim") {
|
|
334
|
+
if (tok.t === "text") pushText(frame.out, tok.v);
|
|
335
|
+
else frame.out.push(tok);
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
if (tok.match !== void 0 && tok.match > idx) {
|
|
339
|
+
const node = {
|
|
340
|
+
t: tok.ch === "~" ? "del" : tok.n === 2 ? "strong" : "em",
|
|
341
|
+
c: []
|
|
342
|
+
};
|
|
343
|
+
frames.push({ out: node.c, node, until: tok.match });
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
if (tok.match !== void 0 && frame.until === idx && frame.node) {
|
|
347
|
+
frames.pop();
|
|
348
|
+
frames[frames.length - 1].out.push(frame.node);
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
pushText(frame.out, tok.ch.repeat(tok.n));
|
|
352
|
+
});
|
|
353
|
+
return root;
|
|
354
|
+
};
|
|
355
|
+
var FENCE = /^([ \t]*)(`{3,}|~{3,})\s*([\w+#.-]*)/;
|
|
356
|
+
var HEADING = /^ {0,3}(#{1,6})\s+(.*?)\s*#*\s*$/;
|
|
357
|
+
var HR = /^ {0,3}([-*_])(?:\s*\1){2,}\s*$/;
|
|
358
|
+
var BULLET = /^( *)([-*+])\s+(.*)$/;
|
|
359
|
+
var ORDERED = /^( *)(\d{1,9})[.)]\s+(.*)$/;
|
|
360
|
+
var QUOTE = /^ {0,3}>\s?(.*)$/;
|
|
361
|
+
var TABLE_RULE = /^\s*\|?\s*:?-{1,}:?\s*(\|\s*:?-{1,}:?\s*)*\|?\s*$/;
|
|
362
|
+
var LIST_NESTING_MAX = 8;
|
|
363
|
+
var cells = (line) => {
|
|
364
|
+
let s = line.trim();
|
|
365
|
+
if (s.startsWith("|")) s = s.slice(1);
|
|
366
|
+
if (s.endsWith("|") && !s.endsWith("\\|")) s = s.slice(0, -1);
|
|
367
|
+
const out = [];
|
|
368
|
+
let cur = "";
|
|
369
|
+
for (let i = 0; i < s.length; i++) {
|
|
370
|
+
if (s[i] === "\\" && s[i + 1] === "|") {
|
|
371
|
+
cur += "|";
|
|
372
|
+
i++;
|
|
373
|
+
} else if (s[i] === "|") {
|
|
374
|
+
out.push(cur.trim());
|
|
375
|
+
cur = "";
|
|
376
|
+
} else cur += s[i];
|
|
377
|
+
}
|
|
378
|
+
out.push(cur.trim());
|
|
379
|
+
return out;
|
|
380
|
+
};
|
|
381
|
+
var alignOf = (cell) => {
|
|
382
|
+
const c = cell.trim();
|
|
383
|
+
const left = c.startsWith(":");
|
|
384
|
+
const right = c.endsWith(":");
|
|
385
|
+
return left && right ? "center" : right ? "right" : left ? "left" : void 0;
|
|
386
|
+
};
|
|
387
|
+
var startsBlock = (line, next) => FENCE.test(line) || HEADING.test(line) || HR.test(line) || BULLET.test(line) || ORDERED.test(line) || QUOTE.test(line) || line.includes("|") && next !== void 0 && TABLE_RULE.test(next) && next.includes("-");
|
|
388
|
+
var parseMarkdown = (text, depth = 0, streaming = false) => {
|
|
389
|
+
const lines = text.replace(/\r\n?/g, "\n").split("\n");
|
|
390
|
+
const out = [];
|
|
391
|
+
let i = 0;
|
|
392
|
+
const last = (k) => streaming && k >= lines.length - 1;
|
|
393
|
+
while (i < lines.length) {
|
|
394
|
+
const line = lines[i];
|
|
395
|
+
if (!line.trim()) {
|
|
396
|
+
i++;
|
|
397
|
+
continue;
|
|
398
|
+
}
|
|
399
|
+
const fence = FENCE.exec(line);
|
|
400
|
+
if (fence) {
|
|
401
|
+
const body2 = [];
|
|
402
|
+
const indent = new RegExp(`^[ \\t]{0,${fence[1].length}}`);
|
|
403
|
+
i++;
|
|
404
|
+
while (i < lines.length && !lines[i].trimStart().startsWith(fence[2])) {
|
|
405
|
+
body2.push(lines[i++].replace(indent, ""));
|
|
406
|
+
}
|
|
407
|
+
i++;
|
|
408
|
+
out.push({ t: "code", lang: fence[3], v: body2.join("\n") });
|
|
409
|
+
continue;
|
|
410
|
+
}
|
|
411
|
+
const heading = HEADING.exec(line);
|
|
412
|
+
if (heading) {
|
|
413
|
+
out.push({
|
|
414
|
+
t: "h",
|
|
415
|
+
level: heading[1].length,
|
|
416
|
+
c: parseMarkdownInline(heading[2], 0, last(i))
|
|
417
|
+
});
|
|
418
|
+
i++;
|
|
419
|
+
continue;
|
|
420
|
+
}
|
|
421
|
+
if (HR.test(line)) {
|
|
422
|
+
out.push({ t: "hr" });
|
|
423
|
+
i++;
|
|
424
|
+
continue;
|
|
425
|
+
}
|
|
426
|
+
if (QUOTE.test(line) && depth < 4) {
|
|
427
|
+
const body2 = [];
|
|
428
|
+
while (i < lines.length && QUOTE.test(lines[i])) body2.push(QUOTE.exec(lines[i++])[1]);
|
|
429
|
+
out.push({
|
|
430
|
+
t: "quote",
|
|
431
|
+
c: parseMarkdown(body2.join("\n"), depth + 1, streaming && i >= lines.length)
|
|
432
|
+
});
|
|
433
|
+
continue;
|
|
434
|
+
}
|
|
435
|
+
const next = lines[i + 1];
|
|
436
|
+
if (line.includes("|") && next !== void 0 && TABLE_RULE.test(next) && next.includes("-")) {
|
|
437
|
+
const head = cells(line);
|
|
438
|
+
const align = cells(next).map(alignOf);
|
|
439
|
+
i += 2;
|
|
440
|
+
const rows = [];
|
|
441
|
+
while (i < lines.length && lines[i].trim() && lines[i].includes("|")) {
|
|
442
|
+
const row = cells(lines[i]);
|
|
443
|
+
let open = -1;
|
|
444
|
+
if (last(i)) {
|
|
445
|
+
for (let k = 0; k < row.length; k++) if (row[k] !== "") open = k;
|
|
446
|
+
}
|
|
447
|
+
i++;
|
|
448
|
+
rows.push(head.map((_, k) => parseMarkdownInline(row[k] ?? "", 0, k === open)));
|
|
449
|
+
}
|
|
450
|
+
out.push({ t: "table", align, head: head.map((h) => parseMarkdownInline(h)), rows });
|
|
451
|
+
continue;
|
|
452
|
+
}
|
|
453
|
+
if (BULLET.test(line) || ORDERED.test(line)) {
|
|
454
|
+
const ordered = !BULLET.test(line);
|
|
455
|
+
const first = (ordered ? ORDERED : BULLET).exec(line);
|
|
456
|
+
const indent = first[1].length;
|
|
457
|
+
const list = {
|
|
458
|
+
t: "list",
|
|
459
|
+
ordered,
|
|
460
|
+
start: ordered ? Number(first[2]) : 1,
|
|
461
|
+
items: []
|
|
462
|
+
};
|
|
463
|
+
while (i < lines.length) {
|
|
464
|
+
const l = lines[i];
|
|
465
|
+
const m = (ordered ? ORDERED : BULLET).exec(l);
|
|
466
|
+
if (m && m[1].length <= indent + 1) {
|
|
467
|
+
list.items.push({ c: parseMarkdownInline(m[3], 0, last(i)) });
|
|
468
|
+
i++;
|
|
469
|
+
continue;
|
|
470
|
+
}
|
|
471
|
+
const nested = BULLET.exec(l) ?? ORDERED.exec(l);
|
|
472
|
+
if (nested && nested[1].length > indent + 1 && list.items.length) {
|
|
473
|
+
if (depth >= LIST_NESTING_MAX) {
|
|
474
|
+
list.items.push({ c: parseMarkdownInline(nested[3], 0, last(i)) });
|
|
475
|
+
i++;
|
|
476
|
+
continue;
|
|
477
|
+
}
|
|
478
|
+
const subLines = [];
|
|
479
|
+
while (i < lines.length) {
|
|
480
|
+
const s = BULLET.exec(lines[i]) ?? ORDERED.exec(lines[i]);
|
|
481
|
+
if (!s || s[1].length <= indent + 1) break;
|
|
482
|
+
subLines.push(lines[i++].slice(nested[1].length));
|
|
483
|
+
}
|
|
484
|
+
const sub = parseMarkdown(
|
|
485
|
+
subLines.join("\n"),
|
|
486
|
+
depth + 1,
|
|
487
|
+
streaming && i >= lines.length
|
|
488
|
+
).find((b) => b.t === "list");
|
|
489
|
+
if (sub) list.items[list.items.length - 1].sub = sub;
|
|
490
|
+
continue;
|
|
491
|
+
}
|
|
492
|
+
if (l.trim() && /^\s+/.test(l) && !startsBlock(l.trim(), lines[i + 1]) && list.items.length) {
|
|
493
|
+
const item = list.items[list.items.length - 1];
|
|
494
|
+
item.c.push({ t: "br" }, ...parseMarkdownInline(l.trim(), 0, last(i)));
|
|
495
|
+
i++;
|
|
496
|
+
continue;
|
|
497
|
+
}
|
|
498
|
+
break;
|
|
499
|
+
}
|
|
500
|
+
out.push(list);
|
|
501
|
+
continue;
|
|
502
|
+
}
|
|
503
|
+
const body = [line];
|
|
504
|
+
i++;
|
|
505
|
+
while (i < lines.length && lines[i].trim() && !startsBlock(lines[i], lines[i + 1])) {
|
|
506
|
+
body.push(lines[i++]);
|
|
507
|
+
}
|
|
508
|
+
out.push({
|
|
509
|
+
t: "p",
|
|
510
|
+
c: parseMarkdownInline(
|
|
511
|
+
body.map((l) => l.trim()).join("\n"),
|
|
512
|
+
0,
|
|
513
|
+
streaming && i >= lines.length
|
|
514
|
+
)
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
return out;
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
// src/markdown/stream.ts
|
|
521
|
+
var FENCE2 = /^[ \t]*(`{3,}|~{3,})/;
|
|
522
|
+
var MARKERS_ONLY = /^[\s#>*+\-_|`~=:\d.)]{0,16}$/;
|
|
523
|
+
var RULE_SO_FAR = /^\s*\|?[\s:|-]*$/;
|
|
524
|
+
var pipes = (line) => line !== void 0 && line.includes("|");
|
|
525
|
+
var blank = (line) => line === void 0 || !line.trim();
|
|
526
|
+
var markdownSettled = (text) => {
|
|
527
|
+
const lines = text.split("\n");
|
|
528
|
+
const n = lines.length;
|
|
529
|
+
let fence;
|
|
530
|
+
for (let i = 0; i < n - 1; i++) {
|
|
531
|
+
const line = lines[i];
|
|
532
|
+
if (fence) {
|
|
533
|
+
if (line.trimStart().startsWith(fence)) fence = void 0;
|
|
534
|
+
} else {
|
|
535
|
+
const m = FENCE2.exec(line);
|
|
536
|
+
if (m) fence = m[1];
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
const lastLine = lines[n - 1];
|
|
540
|
+
const cut = (count) => lines.slice(0, n - count).join("\n") + (n > count ? "\n" : "");
|
|
541
|
+
if (fence) {
|
|
542
|
+
const t = lastLine.trim();
|
|
543
|
+
return !t || fence.startsWith(t) ? cut(1) : text;
|
|
544
|
+
}
|
|
545
|
+
const inTable = (k) => pipes(lines[k]) && !blank(lines[k]);
|
|
546
|
+
if (n >= 2 && lines[n - 2].trimStart().startsWith("|") && RULE_SO_FAR.test(lastLine) && !inTable(n - 3))
|
|
547
|
+
return cut(2);
|
|
548
|
+
if (lastLine.trimStart().startsWith("|") && !inTable(n - 2)) return cut(1);
|
|
549
|
+
if (lastLine && MARKERS_ONLY.test(lastLine)) return cut(1);
|
|
550
|
+
return text;
|
|
551
|
+
};
|
|
552
|
+
var finishedEnd = (text, from) => {
|
|
553
|
+
let fence;
|
|
554
|
+
let end = from;
|
|
555
|
+
let at = from;
|
|
556
|
+
while (at < text.length) {
|
|
557
|
+
const nl = text.indexOf("\n", at);
|
|
558
|
+
if (nl < 0) break;
|
|
559
|
+
const line = text.slice(at, nl);
|
|
560
|
+
if (fence) {
|
|
561
|
+
if (line.trimStart().startsWith(fence)) fence = void 0;
|
|
562
|
+
} else {
|
|
563
|
+
const m = FENCE2.exec(line);
|
|
564
|
+
if (m) fence = m[1];
|
|
565
|
+
else if (!line.trim()) end = nl + 1;
|
|
566
|
+
}
|
|
567
|
+
at = nl + 1;
|
|
568
|
+
}
|
|
569
|
+
return end;
|
|
570
|
+
};
|
|
571
|
+
var emptyMarkdownStream = () => ({ done: "", finished: [], blocks: [] });
|
|
572
|
+
var parseMarkdownStreaming = (prev, text) => {
|
|
573
|
+
const source = text.includes("\r") ? text.replace(/\r\n?/g, "\n") : text;
|
|
574
|
+
const base = source.startsWith(prev.done) ? prev : emptyMarkdownStream();
|
|
575
|
+
const end = finishedEnd(source, base.done.length);
|
|
576
|
+
const finished = end > base.done.length ? [...base.finished, ...parseMarkdown(source.slice(base.done.length, end))] : base.finished;
|
|
577
|
+
const tail = parseMarkdown(markdownSettled(source.slice(end)).replace(/\n$/, ""), 0, true);
|
|
578
|
+
return {
|
|
579
|
+
done: source.slice(0, end),
|
|
580
|
+
finished,
|
|
581
|
+
blocks: tail.length ? [...finished, ...tail] : finished
|
|
582
|
+
};
|
|
583
|
+
};
|
|
584
|
+
|
|
585
|
+
// src/markdown/render.ts
|
|
586
|
+
var MARKDOWN_CACHE_MAX = 64;
|
|
587
|
+
var parsed = /* @__PURE__ */ new Map();
|
|
588
|
+
var parseMarkdownCached = (text) => {
|
|
589
|
+
const hit = parsed.get(text);
|
|
590
|
+
if (hit) return hit;
|
|
591
|
+
const blocks = parseMarkdown(text);
|
|
592
|
+
parsed.set(text, blocks);
|
|
593
|
+
if (parsed.size > MARKDOWN_CACHE_MAX) parsed.delete(parsed.keys().next().value);
|
|
594
|
+
return blocks;
|
|
595
|
+
};
|
|
596
|
+
var markdownPlainText = (runs) => runs.map(
|
|
597
|
+
(r) => r.t === "text" || r.t === "code" ? r.v : r.t === "br" ? " " : markdownPlainText(r.c)
|
|
598
|
+
).join("");
|
|
599
|
+
var MARKDOWN_LONG_CELL = 48;
|
|
600
|
+
var lengthOf = (runs) => runs.reduce(
|
|
601
|
+
(n, r) => n + (r.t === "text" || r.t === "code" ? r.v.length : r.t === "br" ? 1 : lengthOf(r.c)),
|
|
602
|
+
0
|
|
603
|
+
);
|
|
604
|
+
var markdownCellIsLong = (runs) => lengthOf(runs) > MARKDOWN_LONG_CELL;
|
|
605
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
606
|
+
0 && (module.exports = {
|
|
607
|
+
MARKDOWN_CACHE_MAX,
|
|
608
|
+
MARKDOWN_LONG_CELL,
|
|
609
|
+
emptyMarkdownStream,
|
|
610
|
+
markdownCellIsLong,
|
|
611
|
+
markdownPlainText,
|
|
612
|
+
markdownSettled,
|
|
613
|
+
parseMarkdown,
|
|
614
|
+
parseMarkdownCached,
|
|
615
|
+
parseMarkdownInline,
|
|
616
|
+
parseMarkdownStreaming,
|
|
617
|
+
safeHref,
|
|
618
|
+
workspaceLinkPath
|
|
619
|
+
});
|
|
620
|
+
//# sourceMappingURL=markdown.cjs.map
|