laif-ds 1.1.5 → 1.2.0
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/dist/CHANGELOG.md +6 -0
- package/dist/_virtual/prism-cpp.js +3 -0
- package/dist/_virtual/prism-cpp2.js +5 -0
- package/dist/_virtual/prism-java.js +3 -0
- package/dist/_virtual/prism-java2.js +5 -0
- package/dist/_virtual/prism-python.js +3 -0
- package/dist/_virtual/prism-python2.js +5 -0
- package/dist/_virtual/prism-rust.js +3 -0
- package/dist/_virtual/prism-rust2.js +5 -0
- package/dist/_virtual/prism-typescript.js +3 -0
- package/dist/_virtual/prism-typescript2.js +5 -0
- package/dist/_virtual/prism.js +3 -0
- package/dist/_virtual/prism2.js +5 -0
- package/dist/agent-docs/adoption-report.json +16 -14
- package/dist/agent-docs/components/AppEditor.md +4 -0
- package/dist/agent-docs/manifest.json +3 -3
- package/dist/components/editor/plugins/paste-markdown-plugin.js +75 -0
- package/dist/components/ui/app-editor.js +128 -116
- package/dist/node_modules/@lexical/code-prism/dist/LexicalCodePrism.prod.js +27 -0
- package/dist/node_modules/@lexical/markdown/dist/LexicalMarkdown.prod.js +114 -109
- package/dist/node_modules/prismjs/components/prism-c.js +77 -0
- package/dist/node_modules/prismjs/components/prism-clike.js +32 -0
- package/dist/node_modules/prismjs/components/prism-cpp.js +93 -0
- package/dist/node_modules/prismjs/components/prism-css.js +56 -0
- package/dist/node_modules/prismjs/components/prism-java.js +122 -0
- package/dist/node_modules/prismjs/components/prism-javascript.js +138 -0
- package/dist/node_modules/prismjs/components/prism-markdown.js +301 -0
- package/dist/node_modules/prismjs/components/prism-markup.js +174 -0
- package/dist/node_modules/prismjs/components/prism-objectivec.js +11 -0
- package/dist/node_modules/prismjs/components/prism-powershell.js +56 -0
- package/dist/node_modules/prismjs/components/prism-python.js +69 -0
- package/dist/node_modules/prismjs/components/prism-rust.js +124 -0
- package/dist/node_modules/prismjs/components/prism-sql.js +34 -0
- package/dist/node_modules/prismjs/components/prism-swift.js +114 -0
- package/dist/node_modules/prismjs/components/prism-typescript.js +53 -0
- package/dist/node_modules/prismjs/prism.js +1165 -0
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../../_virtual/prism.js";
|
|
3
|
+
import "../../../prismjs/components/prism-clike.js";
|
|
4
|
+
import "../../../prismjs/components/prism-javascript.js";
|
|
5
|
+
import "../../../prismjs/components/prism-markup.js";
|
|
6
|
+
import "../../../prismjs/components/prism-markdown.js";
|
|
7
|
+
import "../../../prismjs/components/prism-c.js";
|
|
8
|
+
import "../../../prismjs/components/prism-css.js";
|
|
9
|
+
import "../../../prismjs/components/prism-objectivec.js";
|
|
10
|
+
import "../../../prismjs/components/prism-sql.js";
|
|
11
|
+
import "../../../prismjs/components/prism-powershell.js";
|
|
12
|
+
import "../../../../_virtual/prism-python.js";
|
|
13
|
+
import "../../../../_virtual/prism-rust.js";
|
|
14
|
+
import "../../../prismjs/components/prism-swift.js";
|
|
15
|
+
import "../../../../_virtual/prism-typescript.js";
|
|
16
|
+
import "../../../../_virtual/prism-java.js";
|
|
17
|
+
import "../../../../_virtual/prism-cpp.js";
|
|
18
|
+
(function(r) {
|
|
19
|
+
r.languages.diff = { coord: [/^(?:\*{3}|-{3}|\+{3}).*$/m, /^@@.*@@$/m, /^\d.*$/m] };
|
|
20
|
+
var t = { "deleted-sign": "-", "deleted-arrow": "<", "inserted-sign": "+", "inserted-arrow": ">", unchanged: " ", diff: "!" };
|
|
21
|
+
Object.keys(t).forEach(function(e) {
|
|
22
|
+
var a = t[e], i = [];
|
|
23
|
+
/^\w+$/.test(e) || i.push(/\w+/.exec(e)[0]), e === "diff" && i.push("bold"), r.languages.diff[e] = { pattern: RegExp("^(?:[" + a + `].*(?:\r
|
|
24
|
+
?|
|
|
25
|
+
|(?![\\s\\S])))+`, "m"), alias: i, inside: { line: { pattern: /(.)(?=[\s\S]).*(?:\r\n?|\n)?/, lookbehind: !0 }, prefix: { pattern: /[\s\S]/, alias: /\w+/.exec(e)[0] } } };
|
|
26
|
+
}), Object.defineProperty(r.languages.diff, "PREFIXES", { value: t });
|
|
27
|
+
})(Prism), Prism.languages.go = Prism.languages.extend("clike", { string: { pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/, lookbehind: !0, greedy: !0 }, keyword: /\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/, boolean: /\b(?:_|false|iota|nil|true)\b/, number: [/\b0(?:b[01_]+|o[0-7_]+)i?\b/i, /\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i, /(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i], operator: /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./, builtin: /\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/ }), Prism.languages.insertBefore("go", "string", { char: { pattern: /'(?:\\.|[^'\\\r\n]){0,10}'/, greedy: !0 } }), delete Prism.languages.go["class-name"];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { createState as G, $setState as _, $getState as X, $createTextNode as F, $findMatchingParent as
|
|
3
|
-
import { CodeNode as
|
|
4
|
-
import { LinkNode as
|
|
5
|
-
import { ListNode as
|
|
6
|
-
import { HeadingNode as
|
|
7
|
-
function
|
|
2
|
+
import { createState as G, $setState as _, $getState as X, $createTextNode as F, $findMatchingParent as ae, $getRoot as ce, $createLineBreakNode as Oe, $getSelection as ye, ArtificialNode__DO_NOT_USE as be, $isElementNode as K, $isDecoratorNode as fe, $isParagraphNode as de, $isTextNode as v, $isLineBreakNode as ue, $createParagraphNode as _e, $createTabNode as Me } from "../../../lexical/dist/Lexical.prod.js";
|
|
3
|
+
import { CodeNode as Ae, $createCodeNode as A, $isCodeNode as ke } from "../../code-core/dist/LexicalCodeCore.prod.js";
|
|
4
|
+
import { LinkNode as Fe, $createLinkNode as Be, $isLinkNode as q, $isAutoLinkNode as we } from "../../link/dist/LexicalLink.prod.js";
|
|
5
|
+
import { ListNode as ge, ListItemNode as pe, $isListNode as R, $createListItemNode as De, $createListNode as je, $isListItemNode as he } from "../../list/dist/LexicalList.prod.js";
|
|
6
|
+
import { HeadingNode as He, QuoteNode as Pe, $isHeadingNode as Ue, $isQuoteNode as D, $createQuoteNode as ze, $createHeadingNode as Qe } from "../../rich-text/dist/LexicalRichText.prod.js";
|
|
7
|
+
function We(e, t) {
|
|
8
8
|
const o = {};
|
|
9
9
|
for (const r of e) {
|
|
10
10
|
const n = t(r);
|
|
@@ -12,21 +12,21 @@ function Ue(e, t) {
|
|
|
12
12
|
}
|
|
13
13
|
return o;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
const t =
|
|
15
|
+
function xe(e) {
|
|
16
|
+
const t = We(e, (o) => o.type);
|
|
17
17
|
return { element: t.element || [], multilineElement: t["multiline-element"] || [], textFormat: t["text-format"] || [], textMatch: t["text-match"] || [] };
|
|
18
18
|
}
|
|
19
|
-
const
|
|
19
|
+
const Y = /\s/, j = /[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~]/, Ge = /^\s{0,3}$/;
|
|
20
20
|
function H(e) {
|
|
21
|
-
if (!
|
|
21
|
+
if (!de(e)) return !1;
|
|
22
22
|
const t = e.getFirstChild();
|
|
23
|
-
return t == null || e.getChildrenSize() === 1 && v(t) &&
|
|
23
|
+
return t == null || e.getChildrenSize() === 1 && v(t) && Ge.test(t.getTextContent());
|
|
24
24
|
}
|
|
25
25
|
function P(e) {
|
|
26
26
|
return e.replace(/\\([!-/:-@[-`{-~])/g, "$1").replace(/&#(\d+);/g, (t, o) => String.fromCodePoint(Number(o)));
|
|
27
27
|
}
|
|
28
|
-
const
|
|
29
|
-
function
|
|
28
|
+
const me = /^(\s*)(\d{1,})\.\s/, $e = /^(\s*)[-*+]\s/, Xe = /^(\s*)(?:[-*+]\s)?\s?(\[(\s|x)?\])\s/i, U = /^(#{1,6})\s/, Ie = /^>\s/, Te = /^([ \t]*`{3,})([\w-]+)?[ \t]?/, z = /^[ \t]*`{3,}$/, Ke = /^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/, Ve = /^(?:\|)(.+)(?:\|)\s?$/;
|
|
29
|
+
function Ze(e) {
|
|
30
30
|
if (e[0] !== "|") return !1;
|
|
31
31
|
const { length: t } = e;
|
|
32
32
|
let o = 1, r = 0;
|
|
@@ -38,13 +38,13 @@ function Xe(e) {
|
|
|
38
38
|
}
|
|
39
39
|
return r > 0 && (o === t || o === t - 1 && /\s/.test(e[o]));
|
|
40
40
|
}
|
|
41
|
-
const
|
|
41
|
+
const J = /^<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i, ee = /^<\/[a-z_][\w-]*\s*>/i, te = (e) => new RegExp(`(?:${e.source})$`, e.flags), b = /* @__PURE__ */ G("mdListMarker", { parse: (e) => typeof e == "string" && /^[-*+]$/.test(e) ? e : "-", resetOnCopyNode: !0 }), ne = /* @__PURE__ */ G("mdCodeFence", { parse: (e) => typeof e == "string" && /^`{3,}$/.test(e) ? e : "```", resetOnCopyNode: !0 }), Ee = /* @__PURE__ */ G("mdHardLineBreak", { parse: (e) => typeof e == "string" && /^(\\| {2,})$/.test(e) ? e : "", resetOnCopyNode: !0 });
|
|
42
42
|
function Q(e) {
|
|
43
43
|
if (e.endsWith("\\")) return [e.slice(0, -1), "\\"];
|
|
44
44
|
const t = e.match(/^(.*?\S)( {2,})$/);
|
|
45
45
|
return t ? [t[1], t[2]] : null;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function qe(e) {
|
|
48
48
|
const t = e.getChildren(), o = t.length - 1, r = t[o];
|
|
49
49
|
if (!v(r)) return null;
|
|
50
50
|
const n = r.getTextContent(), c = Q(n);
|
|
@@ -54,28 +54,28 @@ function Ke(e) {
|
|
|
54
54
|
}
|
|
55
55
|
return /^ {2,}$/.test(n) && (function(s, l) {
|
|
56
56
|
for (let i = l - 1; i >= 0; i--) {
|
|
57
|
-
if (
|
|
57
|
+
if (ue(s[i])) return !1;
|
|
58
58
|
if (/\S/.test(s[i].getTextContent())) return !0;
|
|
59
59
|
}
|
|
60
60
|
return !1;
|
|
61
61
|
})(t, o) ? (r.setTextContent(""), n) : null;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
const t =
|
|
65
|
-
return o !== null && _(t,
|
|
63
|
+
function Ne(e) {
|
|
64
|
+
const t = Oe(), o = qe(e);
|
|
65
|
+
return o !== null && _(t, Ee, o), t;
|
|
66
66
|
}
|
|
67
|
-
const
|
|
67
|
+
const Ce = (e) => (t, o, r, n) => {
|
|
68
68
|
const c = e(r);
|
|
69
69
|
c.append(...o), t.replace(c), n || c.select(0, 0);
|
|
70
|
-
},
|
|
71
|
-
const c = t.getPreviousSibling(), s = t.getNextSibling(), l =
|
|
70
|
+
}, Se = (e) => (t, o, r, n) => {
|
|
71
|
+
const c = t.getPreviousSibling(), s = t.getNextSibling(), l = De(e === "check" ? r[3] === "x" : void 0), i = r[0].trim()[0], a = e !== "bullet" && e !== "check" || i !== b.parse(i) ? void 0 : i;
|
|
72
72
|
if (R(s) && s.getListType() === e) {
|
|
73
73
|
a && _(s, b, a);
|
|
74
74
|
const d = s.getFirstChild();
|
|
75
75
|
d !== null ? d.insertBefore(l) : s.append(l), e === "number" && s.setStart(Number(r[2])), t.remove();
|
|
76
76
|
} else if (R(c) && c.getListType() === e) a && _(c, b, a), c.append(l), t.remove();
|
|
77
77
|
else {
|
|
78
|
-
const d =
|
|
78
|
+
const d = je(e, e === "number" ? Number(r[2]) : void 0);
|
|
79
79
|
a && _(d, b, a), d.append(l), t.replace(d);
|
|
80
80
|
}
|
|
81
81
|
l.append(...o), n || l.select(0, 0);
|
|
@@ -88,7 +88,7 @@ const Ne = (e) => (t, o, r, n) => {
|
|
|
88
88
|
}, V = (e, t, o, r) => {
|
|
89
89
|
const n = [], c = e.getChildren();
|
|
90
90
|
let s = 0;
|
|
91
|
-
for (const l of c) if (
|
|
91
|
+
for (const l of c) if (he(l)) {
|
|
92
92
|
if (l.getChildrenSize() === 1) {
|
|
93
93
|
const p = l.getFirstChild();
|
|
94
94
|
if (R(p)) {
|
|
@@ -104,31 +104,31 @@ const Ne = (e) => (t, o, r, n) => {
|
|
|
104
104
|
}
|
|
105
105
|
return n.join(`
|
|
106
106
|
`);
|
|
107
|
-
},
|
|
108
|
-
if (!
|
|
107
|
+
}, Ye = { dependencies: [He], export: (e, t) => {
|
|
108
|
+
if (!Ue(e)) return null;
|
|
109
109
|
const o = Number(e.getTag().slice(1));
|
|
110
110
|
return "#".repeat(o) + " " + t(e);
|
|
111
|
-
}, regExp: U, replace:
|
|
111
|
+
}, regExp: U, replace: Ce((e) => {
|
|
112
112
|
const t = "h" + e[1].length;
|
|
113
|
-
return
|
|
114
|
-
}), triggerOnEnter: !0, type: "element" },
|
|
113
|
+
return Qe(t);
|
|
114
|
+
}), triggerOnEnter: !0, type: "element" }, Je = { dependencies: [Pe], export: (e, t) => {
|
|
115
115
|
if (!D(e)) return null;
|
|
116
116
|
const o = t(e).split(`
|
|
117
117
|
`), r = [];
|
|
118
118
|
for (const n of o) r.push("> " + n);
|
|
119
119
|
return r.join(`
|
|
120
120
|
`);
|
|
121
|
-
}, regExp:
|
|
121
|
+
}, regExp: Ie, replace: (e, t, o, r) => {
|
|
122
122
|
if (r) {
|
|
123
123
|
const c = e.getPreviousSibling();
|
|
124
|
-
if (D(c)) return c.splice(c.getChildrenSize(), 0, [
|
|
124
|
+
if (D(c)) return c.splice(c.getChildrenSize(), 0, [Ne(c), ...t]), void e.remove();
|
|
125
125
|
}
|
|
126
|
-
const n =
|
|
126
|
+
const n = ze();
|
|
127
127
|
n.append(...t), e.replace(n), r || n.select(0, 0);
|
|
128
|
-
}, triggerOnEnter: !0, type: "element" }, k = { dependencies: [
|
|
129
|
-
if (!
|
|
128
|
+
}, triggerOnEnter: !0, type: "element" }, k = { dependencies: [Ae], export: (e) => {
|
|
129
|
+
if (!ke(e)) return null;
|
|
130
130
|
const t = e.getTextContent();
|
|
131
|
-
let o = X(e,
|
|
131
|
+
let o = X(e, ne);
|
|
132
132
|
if (t.indexOf(o) > -1) {
|
|
133
133
|
const r = t.match(/`{3,}/g);
|
|
134
134
|
if (r) {
|
|
@@ -155,7 +155,7 @@ const Ne = (e) => (t, o, r, n) => {
|
|
|
155
155
|
}
|
|
156
156
|
const d = e.slice(o + 1), f = s.slice(r[0].length);
|
|
157
157
|
return f.length > 0 && d.unshift(f), k.replace(t, null, r, null, d, !0), [!0, e.length - 1];
|
|
158
|
-
}, regExpEnd: { optional: !0, regExp: z }, regExpStart:
|
|
158
|
+
}, regExpEnd: { optional: !0, regExp: z }, regExpStart: Te, replace: (e, t, o, r, n, c) => {
|
|
159
159
|
let s, l;
|
|
160
160
|
const i = o[1] ? o[1].trim() : "```", a = o[2] || void 0;
|
|
161
161
|
if (!t && n) {
|
|
@@ -165,18 +165,18 @@ const Ne = (e) => (t, o, r, n) => {
|
|
|
165
165
|
l = n.join(`
|
|
166
166
|
`);
|
|
167
167
|
}
|
|
168
|
-
_(s,
|
|
168
|
+
_(s, ne, i);
|
|
169
169
|
const u = F(l);
|
|
170
170
|
s.append(u), e.append(s);
|
|
171
|
-
} else t &&
|
|
172
|
-
}, type: "multiline-element" },
|
|
173
|
-
if (!
|
|
171
|
+
} else t && Ce((u) => A(u ? u[2] : void 0))(e, t, o, c);
|
|
172
|
+
}, type: "multiline-element" }, et = { dependencies: [ge, pe], export: (e, t, o) => R(e) ? V(e, t, 0, o) : null, regExp: $e, replace: Se("bullet"), triggerOnEnter: !0, type: "element" }, tt = { dependencies: [ge, pe], export: (e, t, o) => R(e) ? V(e, t, 0, o) : null, regExp: me, replace: Se("number"), triggerOnEnter: !0, type: "element" }, nt = { format: ["code"], tag: "`", type: "text-format" }, rt = { format: ["highlight"], tag: "==", type: "text-format" }, ot = { format: ["bold", "italic"], tag: "***", type: "text-format" }, st = { format: ["bold", "italic"], intraword: !1, tag: "___", type: "text-format" }, lt = { format: ["bold"], tag: "**", type: "text-format" }, it = { format: ["bold"], intraword: !1, tag: "__", type: "text-format" }, at = { format: ["strikethrough"], tag: "~~", type: "text-format" }, ct = { format: ["italic"], tag: "*", type: "text-format" }, ft = { format: ["italic"], intraword: !1, tag: "_", type: "text-format" }, dt = { dependencies: [Fe], export: (e, t, o) => {
|
|
173
|
+
if (!q(e) || we(e)) return null;
|
|
174
174
|
const r = t(e);
|
|
175
175
|
let n = e.getTitle();
|
|
176
176
|
return n != null && (n = n.replace(/([\\"])/g, "\\$1")), n ? `[${r}](${e.getURL()} "${n}")` : `[${r}](${e.getURL()})`;
|
|
177
177
|
}, importRegExp: /(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/, regExp: /(?:\[([^[\]]*(?:\[[^[\]]*\][^[\]]*)*)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/, replace: (e, t) => {
|
|
178
|
-
if (
|
|
179
|
-
const [, o, r, n] = t, c = r != null ? P(r) : void 0, s = n != null ? P(n) : void 0, l =
|
|
178
|
+
if (ae(e, q)) return;
|
|
179
|
+
const [, o, r, n] = t, c = r != null ? P(r) : void 0, s = n != null ? P(n) : void 0, l = Be(c, { title: s }), i = o.split("[").length - 1, a = o.split("]").length - 1;
|
|
180
180
|
let u = o, d = "";
|
|
181
181
|
if (i < a) return;
|
|
182
182
|
if (i > a) {
|
|
@@ -185,24 +185,24 @@ const Ne = (e) => (t, o, r, n) => {
|
|
|
185
185
|
}
|
|
186
186
|
const f = F(u);
|
|
187
187
|
return f.setFormat(e.getFormat()), l.append(f), e.replace(l), d && l.insertBefore(F(d)), f;
|
|
188
|
-
}, trigger: ")", type: "text-match" },
|
|
189
|
-
function
|
|
188
|
+
}, trigger: ")", type: "text-match" }, ut = [Ye, Je, et, tt], gt = [k], pt = [nt, ot, st, lt, it, rt, ct, ft, at], ht = [dt], Z = [...ut, ...gt, ...pt, ...ht];
|
|
189
|
+
function Re(e, t = !1) {
|
|
190
190
|
const o = e.split(`
|
|
191
191
|
`);
|
|
192
192
|
let r = 0;
|
|
193
193
|
const n = [];
|
|
194
194
|
for (let c = 0; c < o.length; c++) {
|
|
195
195
|
const s = o[c], l = s.trimEnd(), i = n[n.length - 1], a = c < o.length - 1 ? Q(s) : null, u = i !== void 0 && Q(i) !== null;
|
|
196
|
-
if (
|
|
196
|
+
if (Ke.test(l)) n.push(l);
|
|
197
197
|
else if (r === 0) {
|
|
198
198
|
{
|
|
199
|
-
const d = l.match(
|
|
199
|
+
const d = l.match(Te);
|
|
200
200
|
if (d) {
|
|
201
201
|
r = d[1].trim().length, n.push(l);
|
|
202
202
|
continue;
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
l === "" || i === "" || !i || U.test(i) || U.test(l) ||
|
|
205
|
+
l === "" || i === "" || !i || U.test(i) || U.test(l) || Ie.test(l) || me.test(l) || $e.test(l) || Xe.test(l) || Ve.test(l) || Ze(l) || u || !t || J.test(l) || ee.test(l) || te(ee).test(i) || te(J).test(i) || z.test(i) ? n.push(!t && l !== "" || a !== null ? s : l) : n[n.length - 1] = i + " " + (a === null ? l : s).trimStart();
|
|
206
206
|
} else {
|
|
207
207
|
if (z.test(l) && l.trim().length >= r) {
|
|
208
208
|
r = 0, n.push(l);
|
|
@@ -214,13 +214,13 @@ function gt(e, t = !1) {
|
|
|
214
214
|
return n.join(`
|
|
215
215
|
`);
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function xt(e, t, o, r, n) {
|
|
218
218
|
for (const c of t) {
|
|
219
219
|
if (!c.export) continue;
|
|
220
220
|
const s = c.export(e, (l) => B(l, o, r, void 0, void 0, n));
|
|
221
221
|
if (s != null) return s;
|
|
222
222
|
}
|
|
223
|
-
return K(e) ? B(e, o, r, void 0, void 0, n) :
|
|
223
|
+
return K(e) ? B(e, o, r, void 0, void 0, n) : fe(e) ? e.getTextContent() : null;
|
|
224
224
|
}
|
|
225
225
|
function B(e, t, o, r, n, c = !1) {
|
|
226
226
|
const s = [], l = e.getChildren();
|
|
@@ -228,21 +228,21 @@ function B(e, t, o, r, n, c = !1) {
|
|
|
228
228
|
e: for (const i of l) {
|
|
229
229
|
for (const a of o) {
|
|
230
230
|
if (!a.export) continue;
|
|
231
|
-
const u = a.export(i, (d) => B(d, t, o, r, [...n, ...r], c), (d, f) =>
|
|
231
|
+
const u = a.export(i, (d) => B(d, t, o, r, [...n, ...r], c), (d, f) => re(d, f, t, r, n, c));
|
|
232
232
|
if (u != null) {
|
|
233
233
|
s.push(u);
|
|
234
234
|
continue e;
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
-
|
|
237
|
+
ue(i) ? s.push(mt(i)) : v(i) ? s.push(re(i, i.getTextContent(), t, r, n, c)) : K(i) ? s.push(B(i, t, o, r, n, c)) : fe(i) && s.push(i.getTextContent());
|
|
238
238
|
}
|
|
239
239
|
return s.join("");
|
|
240
240
|
}
|
|
241
|
-
function
|
|
242
|
-
return X(e,
|
|
241
|
+
function mt(e) {
|
|
242
|
+
return X(e, Ee) + `
|
|
243
243
|
`;
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function re(e, t, o, r, n, c = !1) {
|
|
246
246
|
const s = e.hasFormat("code");
|
|
247
247
|
let l, i, a, u, d = t;
|
|
248
248
|
if (s || (d = c ? d.replace(/([*_`~])/g, "\\$1") : d.replace(/([*_`~\\])/g, "\\$1")), s) {
|
|
@@ -256,10 +256,10 @@ function ne(e, t, o, r, n, c = !1) {
|
|
|
256
256
|
l = x[1], i = x[2], a = x[3], u = i === "";
|
|
257
257
|
}
|
|
258
258
|
let f = "", p = "", g = "";
|
|
259
|
-
const h =
|
|
259
|
+
const h = oe(e, !0), E = oe(e, !1), $ = /* @__PURE__ */ new Set();
|
|
260
260
|
for (const x of o) {
|
|
261
261
|
const I = x.format[0], m = x.tag;
|
|
262
|
-
I !== "code" &&
|
|
262
|
+
I !== "code" && se(e, I) && !$.has(I) && ($.add(I), se(h, I) && r.find((N) => N.tag === m) || (r.push({ format: I, tag: m }), f += m));
|
|
263
263
|
}
|
|
264
264
|
for (let x = 0; x < r.length; x++) {
|
|
265
265
|
const I = W(e, r[x].format), m = W(E, r[x].format);
|
|
@@ -273,17 +273,17 @@ function ne(e, t, o, r, n, c = !1) {
|
|
|
273
273
|
}
|
|
274
274
|
return u && !e.hasFormat("code") ? p + d : p + l + f + i + g + a;
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function oe(e, t) {
|
|
277
277
|
const o = t ? e.getPreviousSibling() : e.getNextSibling();
|
|
278
278
|
return v(o) ? o : null;
|
|
279
279
|
}
|
|
280
280
|
function W(e, t) {
|
|
281
281
|
return v(e) && e.hasFormat(t);
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function se(e, t) {
|
|
284
284
|
return !!W(e, t) && (t === "code" || !e || !/^\s*$/.test(e.getTextContent()));
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function $t(e, t) {
|
|
287
287
|
const o = e.getTextContent(), r = t.transformersByTag["`"], n = [];
|
|
288
288
|
let c = null;
|
|
289
289
|
if (r) {
|
|
@@ -339,7 +339,7 @@ function xt(e, t) {
|
|
|
339
339
|
}
|
|
340
340
|
let m = 1;
|
|
341
341
|
for (; x + m < d.length && d[x + m] === I; ) m++;
|
|
342
|
-
const N =
|
|
342
|
+
const N = le(I, d, x, m, !0), T = le(I, d, x, m, !1);
|
|
343
343
|
(N || T) && g.push({ active: !0, canClose: T, canOpen: N, char: I, index: x, length: m, originalLength: m }), x += m;
|
|
344
344
|
}
|
|
345
345
|
return g;
|
|
@@ -358,7 +358,7 @@ function xt(e, t) {
|
|
|
358
358
|
const T = f[N];
|
|
359
359
|
if (!T.active || !T.canOpen || T.length === 0 || T.char !== $.char || (T.canClose || $.canOpen) && (T.originalLength + $.originalLength) % 3 == 0 && T.originalLength % 3 != 0 && $.originalLength % 3 != 0)
|
|
360
360
|
continue;
|
|
361
|
-
const O = Math.min(T.length, $.length), w = Object.keys(p.transformersByTag).filter((C) => C[0] === T.char && C.length <= O).sort((C,
|
|
361
|
+
const O = Math.min(T.length, $.length), w = Object.keys(p.transformersByTag).filter((C) => C[0] === T.char && C.length <= O).sort((C, ve) => ve.length - C.length)[0];
|
|
362
362
|
if (!w) continue;
|
|
363
363
|
m = !0;
|
|
364
364
|
const y = w.length, M = { content: d.slice(T.index + T.length, $.index), endIndex: $.index + y, startIndex: T.index + (T.length - y), tag: w };
|
|
@@ -376,25 +376,25 @@ function xt(e, t) {
|
|
|
376
376
|
const u = [o.slice(i.startIndex, i.endIndex), i.tag, i.content];
|
|
377
377
|
return u.index = i.startIndex, u.input = o, { endIndex: i.endIndex, isCodeSpan: a === r, match: u, startIndex: i.startIndex, transformer: a };
|
|
378
378
|
}
|
|
379
|
-
function
|
|
380
|
-
if (!
|
|
379
|
+
function le(e, t, o, r, n) {
|
|
380
|
+
if (!ie(t, o, r, n)) return !1;
|
|
381
381
|
if (e === "*") return !0;
|
|
382
382
|
if (e === "_") {
|
|
383
|
-
if (!
|
|
383
|
+
if (!ie(t, o, r, !n)) return !0;
|
|
384
384
|
const c = n ? t[o - 1] : t[o + r];
|
|
385
385
|
return c !== void 0 && j.test(c);
|
|
386
386
|
}
|
|
387
387
|
return !0;
|
|
388
388
|
}
|
|
389
|
-
function
|
|
389
|
+
function ie(e, t, o, r) {
|
|
390
390
|
const n = e[t - 1], c = e[t + o], [s, l] = r ? [c, n] : [n, c];
|
|
391
|
-
return s !== void 0 && !
|
|
391
|
+
return s !== void 0 && !Y.test(s) && (!j.test(s) || l === void 0 || Y.test(l) || j.test(l));
|
|
392
392
|
}
|
|
393
393
|
function L(e) {
|
|
394
394
|
return v(e) && !e.hasFormat("code");
|
|
395
395
|
}
|
|
396
396
|
function S(e, t, o) {
|
|
397
|
-
let r =
|
|
397
|
+
let r = $t(e, t), n = (function(s, l) {
|
|
398
398
|
const i = s;
|
|
399
399
|
let a, u, d, f;
|
|
400
400
|
for (const p of l) {
|
|
@@ -425,8 +425,8 @@ function S(e, t, o) {
|
|
|
425
425
|
const c = P(e.getTextContent());
|
|
426
426
|
e.setTextContent(c);
|
|
427
427
|
}
|
|
428
|
-
function
|
|
429
|
-
const n =
|
|
428
|
+
function Le(e, t, o, r = !1) {
|
|
429
|
+
const n = xe(o), c = (function(a) {
|
|
430
430
|
const u = {}, d = {}, f = [];
|
|
431
431
|
for (const p of a) {
|
|
432
432
|
const { tag: g } = p;
|
|
@@ -438,14 +438,14 @@ function mt(e, t, o, r = !1) {
|
|
|
438
438
|
})(n.textFormat), s = e.split(`
|
|
439
439
|
`), l = s.length;
|
|
440
440
|
for (let a = 0; a < l; a++) {
|
|
441
|
-
const u = s[a], [d, f] =
|
|
442
|
-
d ? a = f :
|
|
441
|
+
const u = s[a], [d, f] = It(s, a, n.multilineElement, t);
|
|
442
|
+
d ? a = f : Tt(u, t, n.element, c, n.textMatch, r);
|
|
443
443
|
}
|
|
444
444
|
const i = t.getChildren();
|
|
445
445
|
for (const a of i) if (!r && H(a) && t.getChildrenSize() > 1) a.remove();
|
|
446
|
-
else if (K(a)) for (const u of a.getAllTextNodes())
|
|
446
|
+
else if (K(a)) for (const u of a.getAllTextNodes()) Et(u);
|
|
447
447
|
}
|
|
448
|
-
function
|
|
448
|
+
function It(e, t, o, r) {
|
|
449
449
|
for (const n of o) {
|
|
450
450
|
const { handleImportAfterStartMatch: c, regExpEnd: s, regExpStart: l, replace: i } = n, a = e[t].match(l);
|
|
451
451
|
if (!a) continue;
|
|
@@ -482,8 +482,8 @@ function $t(e, t, o, r) {
|
|
|
482
482
|
}
|
|
483
483
|
return [!1, t];
|
|
484
484
|
}
|
|
485
|
-
function
|
|
486
|
-
const s = F(e), l =
|
|
485
|
+
function Tt(e, t, o, r, n, c) {
|
|
486
|
+
const s = F(e), l = _e();
|
|
487
487
|
l.append(s), t.append(l);
|
|
488
488
|
for (const { regExp: i, replace: a } of o) {
|
|
489
489
|
const u = e.match(i);
|
|
@@ -491,35 +491,39 @@ function It(e, t, o, r, n, c) {
|
|
|
491
491
|
}
|
|
492
492
|
if (S(s, r, n), l.getParent() !== null && e.length > 0) {
|
|
493
493
|
const i = l.getPreviousSibling();
|
|
494
|
-
if (!c && (
|
|
494
|
+
if (!c && (de(i) || D(i) || R(i))) {
|
|
495
495
|
let a = i;
|
|
496
496
|
if (R(i)) {
|
|
497
497
|
const u = i.getLastDescendant();
|
|
498
|
-
a = u == null ? null :
|
|
498
|
+
a = u == null ? null : ae(u, he);
|
|
499
499
|
}
|
|
500
|
-
a != null && a.getTextContentSize() > 0 && (a.splice(a.getChildrenSize(), 0, [
|
|
500
|
+
a != null && a.getTextContentSize() > 0 && (a.splice(a.getChildrenSize(), 0, [Ne(a), ...l.getChildren()]), l.remove());
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
|
-
function
|
|
504
|
+
function Et(e) {
|
|
505
505
|
const t = /* @__PURE__ */ new Set(), o = e.getTextContent();
|
|
506
506
|
let r = o.indexOf(" ");
|
|
507
507
|
for (; r !== -1; ) t.add(r), t.add(r + 1), r = o.indexOf(" ", r + 1);
|
|
508
508
|
e.splitText(...t).forEach((n) => {
|
|
509
|
-
n.getTextContent() === " " && n.replace(
|
|
509
|
+
n.getTextContent() === " " && n.replace(Me());
|
|
510
510
|
});
|
|
511
511
|
}
|
|
512
|
-
function
|
|
513
|
-
const c = r ? e :
|
|
514
|
-
s.clear(),
|
|
512
|
+
function vt(e, t = Z, o, r = !1, n = !1) {
|
|
513
|
+
const c = r ? e : Re(e, n), s = ce();
|
|
514
|
+
s.clear(), Le(c, s, t, r), ye() !== null && s.selectStart();
|
|
515
|
+
}
|
|
516
|
+
function Ot(e, t = Z, o = !1, r = !1) {
|
|
517
|
+
const n = o ? e : Re(e, r), c = new be();
|
|
518
|
+
return Le(n, c, t, o), c.getChildren();
|
|
515
519
|
}
|
|
516
|
-
function
|
|
520
|
+
function yt(e = Z, t, o = !1) {
|
|
517
521
|
return (function(n, c = !1) {
|
|
518
|
-
const s =
|
|
522
|
+
const s = xe(n), l = [...s.multilineElement, ...s.element], i = !c, a = s.textFormat.filter((u) => u.format.length === 1).sort((u, d) => Number(u.format.includes("code")) - Number(d.format.includes("code")));
|
|
519
523
|
return (u) => {
|
|
520
|
-
const d = [], f = (u ||
|
|
524
|
+
const d = [], f = (u || ce()).getChildren();
|
|
521
525
|
for (let p = 0; p < f.length; p++) {
|
|
522
|
-
const g = f[p], h =
|
|
526
|
+
const g = f[p], h = xt(g, l, a, s.textMatch, c);
|
|
523
527
|
h != null && d.push(i && p > 0 && !H(g) && !H(f[p - 1]) ? `
|
|
524
528
|
`.concat(h) : h);
|
|
525
529
|
}
|
|
@@ -529,27 +533,28 @@ function vt(e = Se, t, o = !1) {
|
|
|
529
533
|
})(e, o)(t);
|
|
530
534
|
}
|
|
531
535
|
export {
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
536
|
+
vt as $convertFromMarkdownString,
|
|
537
|
+
yt as $convertToMarkdownString,
|
|
538
|
+
Ot as $generateNodesFromMarkdownString,
|
|
539
|
+
ot as BOLD_ITALIC_STAR,
|
|
540
|
+
st as BOLD_ITALIC_UNDERSCORE,
|
|
541
|
+
lt as BOLD_STAR,
|
|
542
|
+
it as BOLD_UNDERSCORE,
|
|
538
543
|
k as CODE,
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
544
|
+
ut as ELEMENT_TRANSFORMERS,
|
|
545
|
+
Ye as HEADING,
|
|
546
|
+
rt as HIGHLIGHT,
|
|
547
|
+
nt as INLINE_CODE,
|
|
548
|
+
ct as ITALIC_STAR,
|
|
549
|
+
ft as ITALIC_UNDERSCORE,
|
|
550
|
+
dt as LINK,
|
|
551
|
+
gt as MULTILINE_ELEMENT_TRANSFORMERS,
|
|
552
|
+
tt as ORDERED_LIST,
|
|
553
|
+
Je as QUOTE,
|
|
554
|
+
at as STRIKETHROUGH,
|
|
555
|
+
pt as TEXT_FORMAT_TRANSFORMERS,
|
|
556
|
+
ht as TEXT_MATCH_TRANSFORMERS,
|
|
557
|
+
Z as TRANSFORMERS,
|
|
558
|
+
et as UNORDERED_LIST,
|
|
559
|
+
Ze as isTableRowDivider
|
|
555
560
|
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
Prism.languages.c = Prism.languages.extend("clike", {
|
|
3
|
+
comment: {
|
|
4
|
+
pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,
|
|
5
|
+
greedy: !0
|
|
6
|
+
},
|
|
7
|
+
string: {
|
|
8
|
+
// https://en.cppreference.com/w/c/language/string_literal
|
|
9
|
+
pattern: /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
|
|
10
|
+
greedy: !0
|
|
11
|
+
},
|
|
12
|
+
"class-name": {
|
|
13
|
+
pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
|
|
14
|
+
lookbehind: !0
|
|
15
|
+
},
|
|
16
|
+
keyword: /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,
|
|
17
|
+
function: /\b[a-z_]\w*(?=\s*\()/i,
|
|
18
|
+
number: /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
|
|
19
|
+
operator: />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/
|
|
20
|
+
});
|
|
21
|
+
Prism.languages.insertBefore("c", "string", {
|
|
22
|
+
char: {
|
|
23
|
+
// https://en.cppreference.com/w/c/language/character_constant
|
|
24
|
+
pattern: /'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,
|
|
25
|
+
greedy: !0
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
Prism.languages.insertBefore("c", "string", {
|
|
29
|
+
macro: {
|
|
30
|
+
// allow for multiline macro definitions
|
|
31
|
+
// spaces after the # character compile fine with gcc
|
|
32
|
+
pattern: /(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,
|
|
33
|
+
lookbehind: !0,
|
|
34
|
+
greedy: !0,
|
|
35
|
+
alias: "property",
|
|
36
|
+
inside: {
|
|
37
|
+
string: [
|
|
38
|
+
{
|
|
39
|
+
// highlight the path of the include statement as a string
|
|
40
|
+
pattern: /^(#\s*include\s*)<[^>]+>/,
|
|
41
|
+
lookbehind: !0
|
|
42
|
+
},
|
|
43
|
+
Prism.languages.c.string
|
|
44
|
+
],
|
|
45
|
+
char: Prism.languages.c.char,
|
|
46
|
+
comment: Prism.languages.c.comment,
|
|
47
|
+
"macro-name": [
|
|
48
|
+
{
|
|
49
|
+
pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
|
|
50
|
+
lookbehind: !0
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
pattern: /(^#\s*define\s+)\w+\b(?=\()/i,
|
|
54
|
+
lookbehind: !0,
|
|
55
|
+
alias: "function"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
// highlight macro directives as keywords
|
|
59
|
+
directive: {
|
|
60
|
+
pattern: /^(#\s*)[a-z]+/,
|
|
61
|
+
lookbehind: !0,
|
|
62
|
+
alias: "keyword"
|
|
63
|
+
},
|
|
64
|
+
"directive-hash": /^#/,
|
|
65
|
+
punctuation: /##|\\(?=[\r\n])/,
|
|
66
|
+
expression: {
|
|
67
|
+
pattern: /\S[\s\S]*/,
|
|
68
|
+
inside: Prism.languages.c
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
Prism.languages.insertBefore("c", "function", {
|
|
74
|
+
// highlight predefined macros as constants
|
|
75
|
+
constant: /\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/
|
|
76
|
+
});
|
|
77
|
+
delete Prism.languages.c.boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
Prism.languages.clike = {
|
|
3
|
+
comment: [
|
|
4
|
+
{
|
|
5
|
+
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
|
|
6
|
+
lookbehind: !0,
|
|
7
|
+
greedy: !0
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
pattern: /(^|[^\\:])\/\/.*/,
|
|
11
|
+
lookbehind: !0,
|
|
12
|
+
greedy: !0
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
string: {
|
|
16
|
+
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
|
|
17
|
+
greedy: !0
|
|
18
|
+
},
|
|
19
|
+
"class-name": {
|
|
20
|
+
pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
|
|
21
|
+
lookbehind: !0,
|
|
22
|
+
inside: {
|
|
23
|
+
punctuation: /[.\\]/
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
keyword: /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
|
|
27
|
+
boolean: /\b(?:false|true)\b/,
|
|
28
|
+
function: /\b\w+(?=\()/,
|
|
29
|
+
number: /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
|
|
30
|
+
operator: /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
|
|
31
|
+
punctuation: /[{}[\];(),.:]/
|
|
32
|
+
};
|