litedown 1.0.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/README.md +52 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +4013 -0
- package/dist/index.umd.js +51 -0
- package/dist/vite.svg +1 -0
- package/package.json +75 -0
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,4013 @@
|
|
|
1
|
+
import { useCallback, useRef, useState } from "react";
|
|
2
|
+
var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __getOwnPropNames = Object.getOwnPropertyNames, __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty, __commonJSMin = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), __copyProps = (e, t, n, r) => {
|
|
3
|
+
if (t && typeof t == "object" || typeof t == "function") for (var s = __getOwnPropNames(t), l = 0, u = s.length, d; l < u; l++) d = s[l], !__hasOwnProp.call(e, d) && d !== n && __defProp(e, d, {
|
|
4
|
+
get: ((e) => t[e]).bind(null, d),
|
|
5
|
+
enumerable: !(r = __getOwnPropDesc(t, d)) || r.enumerable
|
|
6
|
+
});
|
|
7
|
+
return e;
|
|
8
|
+
}, __toESM = (e, t, n) => (n = e == null ? {} : __create(__getProtoOf(e)), __copyProps(t || !e || !e.__esModule ? __defProp(n, "default", {
|
|
9
|
+
value: e,
|
|
10
|
+
enumerable: !0
|
|
11
|
+
}) : n, e)), SYMBOLS = {
|
|
12
|
+
alpha: "α",
|
|
13
|
+
beta: "β",
|
|
14
|
+
gamma: "γ",
|
|
15
|
+
delta: "δ",
|
|
16
|
+
epsilon: "ε",
|
|
17
|
+
varepsilon: "ɛ",
|
|
18
|
+
zeta: "ζ",
|
|
19
|
+
eta: "η",
|
|
20
|
+
theta: "θ",
|
|
21
|
+
vartheta: "ϑ",
|
|
22
|
+
iota: "ι",
|
|
23
|
+
kappa: "κ",
|
|
24
|
+
lambda: "λ",
|
|
25
|
+
mu: "μ",
|
|
26
|
+
nu: "ν",
|
|
27
|
+
xi: "ξ",
|
|
28
|
+
pi: "π",
|
|
29
|
+
varpi: "ϖ",
|
|
30
|
+
rho: "ρ",
|
|
31
|
+
varrho: "ϱ",
|
|
32
|
+
sigma: "σ",
|
|
33
|
+
varsigma: "ς",
|
|
34
|
+
tau: "τ",
|
|
35
|
+
upsilon: "υ",
|
|
36
|
+
phi: "ϕ",
|
|
37
|
+
varphi: "φ",
|
|
38
|
+
chi: "χ",
|
|
39
|
+
psi: "ψ",
|
|
40
|
+
omega: "ω",
|
|
41
|
+
Gamma: "Γ",
|
|
42
|
+
Delta: "Δ",
|
|
43
|
+
Theta: "Θ",
|
|
44
|
+
Lambda: "Λ",
|
|
45
|
+
Xi: "Ξ",
|
|
46
|
+
Pi: "Π",
|
|
47
|
+
Sigma: "Σ",
|
|
48
|
+
Upsilon: "Υ",
|
|
49
|
+
Phi: "Φ",
|
|
50
|
+
Psi: "Ψ",
|
|
51
|
+
Omega: "Ω",
|
|
52
|
+
times: "×",
|
|
53
|
+
div: "÷",
|
|
54
|
+
cdot: "·",
|
|
55
|
+
pm: "±",
|
|
56
|
+
mp: "∓",
|
|
57
|
+
leq: "≤",
|
|
58
|
+
le: "≤",
|
|
59
|
+
geq: "≥",
|
|
60
|
+
ge: "≥",
|
|
61
|
+
neq: "≠",
|
|
62
|
+
ne: "≠",
|
|
63
|
+
approx: "≈",
|
|
64
|
+
equiv: "≡",
|
|
65
|
+
sim: "∼",
|
|
66
|
+
simeq: "≃",
|
|
67
|
+
ll: "≪",
|
|
68
|
+
gg: "≫",
|
|
69
|
+
subset: "⊂",
|
|
70
|
+
supset: "⊃",
|
|
71
|
+
subseteq: "⊆",
|
|
72
|
+
supseteq: "⊇",
|
|
73
|
+
in: "∈",
|
|
74
|
+
notin: "∉",
|
|
75
|
+
cup: "∪",
|
|
76
|
+
cap: "∩",
|
|
77
|
+
setminus: "∖",
|
|
78
|
+
land: "∧",
|
|
79
|
+
lor: "∨",
|
|
80
|
+
lnot: "¬",
|
|
81
|
+
neg: "¬",
|
|
82
|
+
forall: "∀",
|
|
83
|
+
exists: "∃",
|
|
84
|
+
nexists: "∄",
|
|
85
|
+
Rightarrow: "⇒",
|
|
86
|
+
Leftarrow: "⇐",
|
|
87
|
+
Leftrightarrow: "⇔",
|
|
88
|
+
rightarrow: "→",
|
|
89
|
+
to: "→",
|
|
90
|
+
leftarrow: "←",
|
|
91
|
+
leftrightarrow: "↔",
|
|
92
|
+
uparrow: "↑",
|
|
93
|
+
downarrow: "↓",
|
|
94
|
+
mapsto: "↦",
|
|
95
|
+
implies: "⟹",
|
|
96
|
+
iff: "⟺",
|
|
97
|
+
infty: "∞",
|
|
98
|
+
infinity: "∞",
|
|
99
|
+
partial: "∂",
|
|
100
|
+
nabla: "∇",
|
|
101
|
+
emptyset: "∅",
|
|
102
|
+
varnothing: "∅",
|
|
103
|
+
ldots: "…",
|
|
104
|
+
cdots: "⋯",
|
|
105
|
+
vdots: "⋮",
|
|
106
|
+
ddots: "⋱",
|
|
107
|
+
prime: "′",
|
|
108
|
+
angle: "∠",
|
|
109
|
+
triangle: "△",
|
|
110
|
+
star: "⋆",
|
|
111
|
+
ast: "∗",
|
|
112
|
+
circ: "∘",
|
|
113
|
+
bullet: "∙",
|
|
114
|
+
dagger: "†",
|
|
115
|
+
ddagger: "‡",
|
|
116
|
+
hbar: "ℏ",
|
|
117
|
+
ell: "ℓ",
|
|
118
|
+
Re: "ℜ",
|
|
119
|
+
Im: "ℑ",
|
|
120
|
+
aleph: "ℵ",
|
|
121
|
+
quad: " ",
|
|
122
|
+
qquad: " ",
|
|
123
|
+
",": " ",
|
|
124
|
+
";": " ",
|
|
125
|
+
"!": "",
|
|
126
|
+
hat: "̂",
|
|
127
|
+
bar: "̄",
|
|
128
|
+
dot: "̇",
|
|
129
|
+
ddot: "̈",
|
|
130
|
+
tilde: "̃",
|
|
131
|
+
vec: "⃗"
|
|
132
|
+
}, LARGE_OPS = {
|
|
133
|
+
sum: "∑",
|
|
134
|
+
prod: "∏",
|
|
135
|
+
coprod: "∐",
|
|
136
|
+
int: "∫",
|
|
137
|
+
iint: "∬",
|
|
138
|
+
iiint: "∭",
|
|
139
|
+
oint: "∮",
|
|
140
|
+
bigcup: "⋃",
|
|
141
|
+
bigcap: "⋂",
|
|
142
|
+
bigoplus: "⨁",
|
|
143
|
+
bigotimes: "⨂",
|
|
144
|
+
bigvee: "⋁",
|
|
145
|
+
bigwedge: "⋀",
|
|
146
|
+
lim: "lim",
|
|
147
|
+
sup: "sup",
|
|
148
|
+
inf: "inf",
|
|
149
|
+
max: "max",
|
|
150
|
+
min: "min",
|
|
151
|
+
arg: "arg",
|
|
152
|
+
det: "det",
|
|
153
|
+
gcd: "gcd",
|
|
154
|
+
log: "log",
|
|
155
|
+
ln: "ln",
|
|
156
|
+
exp: "exp",
|
|
157
|
+
sin: "sin",
|
|
158
|
+
cos: "cos",
|
|
159
|
+
tan: "tan",
|
|
160
|
+
sec: "sec",
|
|
161
|
+
csc: "csc",
|
|
162
|
+
cot: "cot",
|
|
163
|
+
sinh: "sinh",
|
|
164
|
+
cosh: "cosh",
|
|
165
|
+
tanh: "tanh",
|
|
166
|
+
arcsin: "arcsin",
|
|
167
|
+
arccos: "arccos",
|
|
168
|
+
arctan: "arctan",
|
|
169
|
+
Pr: "Pr",
|
|
170
|
+
hom: "hom",
|
|
171
|
+
ker: "ker",
|
|
172
|
+
dim: "dim",
|
|
173
|
+
deg: "deg"
|
|
174
|
+
}, DELIMITERS = {
|
|
175
|
+
"(": "(",
|
|
176
|
+
")": ")",
|
|
177
|
+
"[": "[",
|
|
178
|
+
"]": "]",
|
|
179
|
+
"\\{": "{",
|
|
180
|
+
"\\}": "}",
|
|
181
|
+
lbrace: "{",
|
|
182
|
+
rbrace: "}",
|
|
183
|
+
langle: "⟨",
|
|
184
|
+
rangle: "⟩",
|
|
185
|
+
lfloor: "⌊",
|
|
186
|
+
rfloor: "⌋",
|
|
187
|
+
lceil: "⌈",
|
|
188
|
+
rceil: "⌉",
|
|
189
|
+
"|": "|",
|
|
190
|
+
"\\|": "‖",
|
|
191
|
+
vert: "|",
|
|
192
|
+
Vert: "‖",
|
|
193
|
+
".": ""
|
|
194
|
+
}, FONT_COMMANDS = {
|
|
195
|
+
mathbb: "double-struck",
|
|
196
|
+
mathbf: "bold",
|
|
197
|
+
mathit: "italic",
|
|
198
|
+
mathrm: "normal",
|
|
199
|
+
mathcal: "script",
|
|
200
|
+
mathfrak: "fraktur",
|
|
201
|
+
mathsf: "sans-serif",
|
|
202
|
+
mathtt: "monospace",
|
|
203
|
+
boldsymbol: "bold-italic",
|
|
204
|
+
textbf: "bold",
|
|
205
|
+
textit: "italic",
|
|
206
|
+
textrm: "normal",
|
|
207
|
+
text: "normal"
|
|
208
|
+
}, DOUBLE_STRUCK = {
|
|
209
|
+
A: "𝔸",
|
|
210
|
+
B: "𝔹",
|
|
211
|
+
C: "ℂ",
|
|
212
|
+
D: "𝔻",
|
|
213
|
+
E: "𝔼",
|
|
214
|
+
F: "𝔽",
|
|
215
|
+
G: "𝔾",
|
|
216
|
+
H: "ℍ",
|
|
217
|
+
I: "𝕀",
|
|
218
|
+
J: "𝕁",
|
|
219
|
+
K: "𝕂",
|
|
220
|
+
L: "𝕃",
|
|
221
|
+
M: "𝕄",
|
|
222
|
+
N: "ℕ",
|
|
223
|
+
O: "𝕆",
|
|
224
|
+
P: "ℙ",
|
|
225
|
+
Q: "ℚ",
|
|
226
|
+
R: "ℝ",
|
|
227
|
+
S: "𝕊",
|
|
228
|
+
T: "𝕋",
|
|
229
|
+
U: "𝕌",
|
|
230
|
+
V: "𝕍",
|
|
231
|
+
W: "𝕎",
|
|
232
|
+
X: "𝕏",
|
|
233
|
+
Y: "𝕐",
|
|
234
|
+
Z: "ℤ",
|
|
235
|
+
0: "𝟘",
|
|
236
|
+
1: "𝟙",
|
|
237
|
+
2: "𝟚",
|
|
238
|
+
3: "𝟛",
|
|
239
|
+
4: "𝟜",
|
|
240
|
+
5: "𝟝",
|
|
241
|
+
6: "𝟞",
|
|
242
|
+
7: "𝟟",
|
|
243
|
+
8: "𝟠",
|
|
244
|
+
9: "𝟡"
|
|
245
|
+
};
|
|
246
|
+
function escapeHtml$2(e) {
|
|
247
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
248
|
+
}
|
|
249
|
+
function parseGroup(e, t) {
|
|
250
|
+
if (t >= e.length) return {
|
|
251
|
+
content: "",
|
|
252
|
+
end: t
|
|
253
|
+
};
|
|
254
|
+
if (e[t] === "{") {
|
|
255
|
+
let n = 1, r = t + 1;
|
|
256
|
+
for (; r < e.length && n > 0;) e[r] === "{" ? n++ : e[r] === "}" && n--, r++;
|
|
257
|
+
return {
|
|
258
|
+
content: e.slice(t + 1, r - 1),
|
|
259
|
+
end: r
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
if (e[t] === "\\") {
|
|
263
|
+
let n = e.slice(t).match(/^\\([a-zA-Z]+|.)/);
|
|
264
|
+
if (n) return {
|
|
265
|
+
content: e.slice(t, t + n[0].length),
|
|
266
|
+
end: t + n[0].length
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
return {
|
|
270
|
+
content: e[t],
|
|
271
|
+
end: t + 1
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
function latexToMathML(e) {
|
|
275
|
+
return tokensToMathML(tokenize(e.trim()));
|
|
276
|
+
}
|
|
277
|
+
function tokenize(e) {
|
|
278
|
+
let t = [], n = 0;
|
|
279
|
+
for (; n < e.length;) {
|
|
280
|
+
let r = e[n];
|
|
281
|
+
if (r === " " || r === " ") {
|
|
282
|
+
n++;
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
if (r === "\\" && e[n + 1] === "\\") {
|
|
286
|
+
t.push({
|
|
287
|
+
type: "newline",
|
|
288
|
+
value: "\\\\"
|
|
289
|
+
}), n += 2;
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
if (r === "&") {
|
|
293
|
+
t.push({
|
|
294
|
+
type: "ampersand",
|
|
295
|
+
value: "&"
|
|
296
|
+
}), n++;
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
if (r === "^") {
|
|
300
|
+
n++;
|
|
301
|
+
let r = parseGroup(e, n);
|
|
302
|
+
t.push({
|
|
303
|
+
type: "superscript",
|
|
304
|
+
value: r.content
|
|
305
|
+
}), n = r.end;
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
if (r === "_") {
|
|
309
|
+
n++;
|
|
310
|
+
let r = parseGroup(e, n);
|
|
311
|
+
t.push({
|
|
312
|
+
type: "subscript",
|
|
313
|
+
value: r.content
|
|
314
|
+
}), n = r.end;
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
if (r === "{") {
|
|
318
|
+
let r = 1, i = n + 1;
|
|
319
|
+
for (; i < e.length && r > 0;) e[i] === "{" ? r++ : e[i] === "}" && r--, i++;
|
|
320
|
+
t.push({
|
|
321
|
+
type: "group",
|
|
322
|
+
value: e.slice(n + 1, i - 1)
|
|
323
|
+
}), n = i;
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
if (r === "\\") {
|
|
327
|
+
let r = e.slice(n).match(/^\\([a-zA-Z]+|[^a-zA-Z])/);
|
|
328
|
+
if (r) {
|
|
329
|
+
t.push({
|
|
330
|
+
type: "command",
|
|
331
|
+
value: r[1]
|
|
332
|
+
}), n += r[0].length;
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
t.push({
|
|
337
|
+
type: "text",
|
|
338
|
+
value: r
|
|
339
|
+
}), n++;
|
|
340
|
+
}
|
|
341
|
+
return t;
|
|
342
|
+
}
|
|
343
|
+
function tokensToMathML(e) {
|
|
344
|
+
let t = "", n = 0;
|
|
345
|
+
for (; n < e.length;) {
|
|
346
|
+
let r = e[n], i = e[n + 1];
|
|
347
|
+
if (r.type === "command") {
|
|
348
|
+
let a = r.value;
|
|
349
|
+
if (FONT_COMMANDS[a]) {
|
|
350
|
+
let e = FONT_COMMANDS[a];
|
|
351
|
+
if (i) {
|
|
352
|
+
let r = (i.type, i.value);
|
|
353
|
+
if (a === "mathbb") {
|
|
354
|
+
let e = r.split("").map((e) => DOUBLE_STRUCK[e] || e).join("");
|
|
355
|
+
t += `<mi>${e}</mi>`;
|
|
356
|
+
} else a === "text" || a === "textrm" ? t += `<mtext>${escapeHtml$2(r)}</mtext>` : t += `<mi mathvariant="${e}">${escapeHtml$2(r)}</mi>`;
|
|
357
|
+
n += 2;
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (a === "frac" || a === "dfrac" || a === "tfrac") {
|
|
362
|
+
let r = e[n + 1], i = e[n + 2];
|
|
363
|
+
if (r && i) {
|
|
364
|
+
let e = r.type === "group" ? latexToMathML(r.value) : renderToken(r), a = i.type === "group" ? latexToMathML(i.value) : renderToken(i);
|
|
365
|
+
t += `<mfrac>${e}${a}</mfrac>`, n += 3;
|
|
366
|
+
continue;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
if (a === "sqrt" && i && i.type === "group") {
|
|
370
|
+
let e = latexToMathML(i.value);
|
|
371
|
+
t += `<msqrt>${e}</msqrt>`, n += 2;
|
|
372
|
+
continue;
|
|
373
|
+
}
|
|
374
|
+
if ((a === "overline" || a === "bar") && i) {
|
|
375
|
+
let e = i.type === "group" ? latexToMathML(i.value) : renderToken(i);
|
|
376
|
+
t += `<mover>${e}<mo>¯</mo></mover>`, n += 2;
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
379
|
+
if (a === "underline" && i) {
|
|
380
|
+
let e = i.type === "group" ? latexToMathML(i.value) : renderToken(i);
|
|
381
|
+
t += `<munder>${e}<mo>_</mo></munder>`, n += 2;
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
if ((a === "hat" || a === "widehat") && i) {
|
|
385
|
+
let e = i.type === "group" ? latexToMathML(i.value) : renderToken(i);
|
|
386
|
+
t += `<mover>${e}<mo>^</mo></mover>`, n += 2;
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
if ((a === "tilde" || a === "widetilde") && i) {
|
|
390
|
+
let e = i.type === "group" ? latexToMathML(i.value) : renderToken(i);
|
|
391
|
+
t += `<mover>${e}<mo>˜</mo></mover>`, n += 2;
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
if (a === "vec" && i) {
|
|
395
|
+
let e = i.type === "group" ? latexToMathML(i.value) : renderToken(i);
|
|
396
|
+
t += `<mover>${e}<mo>→</mo></mover>`, n += 2;
|
|
397
|
+
continue;
|
|
398
|
+
}
|
|
399
|
+
if (a === "dot" && i) {
|
|
400
|
+
let e = i.type === "group" ? latexToMathML(i.value) : renderToken(i);
|
|
401
|
+
t += `<mover>${e}<mo>˙</mo></mover>`, n += 2;
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
if (a === "ddot" && i) {
|
|
405
|
+
let e = i.type === "group" ? latexToMathML(i.value) : renderToken(i);
|
|
406
|
+
t += `<mover>${e}<mo>¨</mo></mover>`, n += 2;
|
|
407
|
+
continue;
|
|
408
|
+
}
|
|
409
|
+
if (a === "left") {
|
|
410
|
+
let r = 1, a = n + 1, o = "";
|
|
411
|
+
i && (i.type === "text" ? (o = DELIMITERS[i.value] || i.value, a = n + 2) : i.type === "command" && (o = DELIMITERS[i.value] || SYMBOLS[i.value] || i.value, a = n + 2));
|
|
412
|
+
let s = "", c = [];
|
|
413
|
+
for (; a < e.length;) {
|
|
414
|
+
if (e[a].type === "command" && e[a].value === "left" && r++, e[a].type === "command" && e[a].value === "right" && (r--, r === 0)) {
|
|
415
|
+
if (a + 1 < e.length) {
|
|
416
|
+
let t = e[a + 1];
|
|
417
|
+
t.type === "text" ? s = DELIMITERS[t.value] || t.value : t.type === "command" && (s = DELIMITERS[t.value] || SYMBOLS[t.value] || t.value), a += 2;
|
|
418
|
+
} else a++;
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
r > 0 && c.push(e[a]), a++;
|
|
422
|
+
}
|
|
423
|
+
let l = tokensToMathML(c);
|
|
424
|
+
t += `<mrow><mo stretchy="true">${o}</mo>${l}<mo stretchy="true">${s}</mo></mrow>`, n = a;
|
|
425
|
+
continue;
|
|
426
|
+
}
|
|
427
|
+
if (a === "right") {
|
|
428
|
+
n++;
|
|
429
|
+
continue;
|
|
430
|
+
}
|
|
431
|
+
if (LARGE_OPS[a]) {
|
|
432
|
+
let r = LARGE_OPS[a], o = /^[a-z]+$/i.test(r), s = "", c = "", l = 1;
|
|
433
|
+
i && i.type === "subscript" ? (s = latexToMathML(i.value), l++, e[n + l] && e[n + l].type === "superscript" && (c = latexToMathML(e[n + l].value), l++)) : i && i.type === "superscript" && (c = latexToMathML(i.value), l++, e[n + l] && e[n + l].type === "subscript" && (s = latexToMathML(e[n + l].value), l++));
|
|
434
|
+
let u = o ? `<mo>${r}</mo>` : `<mo largeop="true">${r}</mo>`;
|
|
435
|
+
s && c ? t += `<munderover>${u}${s}${c}</munderover>` : s ? t += `<munder>${u}${s}</munder>` : c ? t += `<mover>${u}${c}</mover>` : t += u, n += l;
|
|
436
|
+
continue;
|
|
437
|
+
}
|
|
438
|
+
if (a === "begin" && i && i.type === "group") {
|
|
439
|
+
let r = i.value, a = n + 2, o = 1, s = [];
|
|
440
|
+
for (; a < e.length;) {
|
|
441
|
+
if (e[a].type === "command" && e[a].value === "begin" && o++, e[a].type === "command" && e[a].value === "end" && (o--, o === 0)) {
|
|
442
|
+
a += 2;
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
445
|
+
s.push(e[a]), a++;
|
|
446
|
+
}
|
|
447
|
+
r === "matrix" || r === "pmatrix" || r === "bmatrix" || r === "vmatrix" || r === "Bmatrix" || r === "Vmatrix" ? t += renderMatrix(s, r) : r === "cases" ? t += renderCases(s) : r === "aligned" || r === "align" || r === "align*" ? t += renderAligned(s) : t += tokensToMathML(s), n = a;
|
|
448
|
+
continue;
|
|
449
|
+
}
|
|
450
|
+
if (a === "end") {
|
|
451
|
+
n += 2;
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
454
|
+
if (a === "binom") {
|
|
455
|
+
let r = e[n + 1], i = e[n + 2];
|
|
456
|
+
if (r && i) {
|
|
457
|
+
let e = r.type === "group" ? latexToMathML(r.value) : renderToken(r), a = i.type === "group" ? latexToMathML(i.value) : renderToken(i);
|
|
458
|
+
t += `<mrow><mo></mo><mfrac linethickness="0">${e}${a}</mfrac><mo></mo></mrow>`, n += 3;
|
|
459
|
+
continue;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
if (a === "color" && i && i.type === "group") {
|
|
463
|
+
let r = i.value, a = e[n + 2];
|
|
464
|
+
if (a) {
|
|
465
|
+
let e = a.type === "group" ? latexToMathML(a.value) : renderToken(a);
|
|
466
|
+
t += `<mstyle mathcolor="${escapeHtml$2(r)}">${e}</mstyle>`, n += 3;
|
|
467
|
+
} else n += 2;
|
|
468
|
+
continue;
|
|
469
|
+
}
|
|
470
|
+
if (a === "boxed" && i) {
|
|
471
|
+
let e = i.type === "group" ? latexToMathML(i.value) : renderToken(i);
|
|
472
|
+
t += `<menclose notation="box">${e}</menclose>`, n += 2;
|
|
473
|
+
continue;
|
|
474
|
+
}
|
|
475
|
+
if (a === "cancel" && i) {
|
|
476
|
+
let e = i.type === "group" ? latexToMathML(i.value) : renderToken(i);
|
|
477
|
+
t += `<menclose notation="updiagonalstrike">${e}</menclose>`, n += 2;
|
|
478
|
+
continue;
|
|
479
|
+
}
|
|
480
|
+
if (a === "operatorname" && i && i.type === "group") {
|
|
481
|
+
t += `<mo>${escapeHtml$2(i.value)}</mo>`, n += 2;
|
|
482
|
+
continue;
|
|
483
|
+
}
|
|
484
|
+
if (a === "quad" || a === "qquad" || a === "," || a === ";" || a === "!" || a === " ") {
|
|
485
|
+
t += `<mspace width="${a === "qquad" ? "2em" : a === "quad" ? "1em" : a === ";" ? "0.28em" : a === "," ? "0.17em" : "0"}"/>`, n++;
|
|
486
|
+
continue;
|
|
487
|
+
}
|
|
488
|
+
if (SYMBOLS[a]) {
|
|
489
|
+
t += `<mo>${SYMBOLS[a]}</mo>`, n++;
|
|
490
|
+
continue;
|
|
491
|
+
}
|
|
492
|
+
if (DELIMITERS[a]) {
|
|
493
|
+
t += `<mo>${DELIMITERS[a]}</mo>`, n++;
|
|
494
|
+
continue;
|
|
495
|
+
}
|
|
496
|
+
t += `<mo>\\${escapeHtml$2(a)}</mo>`, n++;
|
|
497
|
+
continue;
|
|
498
|
+
}
|
|
499
|
+
if (r.type === "text" || r.type === "group") {
|
|
500
|
+
let a = r.type === "group" ? `<mrow>${latexToMathML(r.value)}</mrow>` : renderChar(r.value), o = "", s = "", c = 1;
|
|
501
|
+
i && i.type === "subscript" ? (o = latexToMathML(i.value), c++, e[n + c] && e[n + c].type === "superscript" && (s = latexToMathML(e[n + c].value), c++)) : i && i.type === "superscript" && (s = latexToMathML(i.value), c++, e[n + c] && e[n + c].type === "subscript" && (o = latexToMathML(e[n + c].value), c++)), o && s ? t += `<msubsup>${a}${o}${s}</msubsup>` : o ? t += `<msub>${a}${o}</msub>` : s ? t += `<msup>${a}${s}</msup>` : t += a, n += c;
|
|
502
|
+
continue;
|
|
503
|
+
}
|
|
504
|
+
if (r.type === "subscript") {
|
|
505
|
+
let e = latexToMathML(r.value);
|
|
506
|
+
t += `<msub><mrow></mrow>${e}</msub>`, n++;
|
|
507
|
+
continue;
|
|
508
|
+
}
|
|
509
|
+
if (r.type === "superscript") {
|
|
510
|
+
let e = latexToMathML(r.value);
|
|
511
|
+
t += `<msup><mrow></mrow>${e}</msup>`, n++;
|
|
512
|
+
continue;
|
|
513
|
+
}
|
|
514
|
+
if (r.type === "newline") {
|
|
515
|
+
t += "<mspace linebreak=\"newline\"/>", n++;
|
|
516
|
+
continue;
|
|
517
|
+
}
|
|
518
|
+
if (r.type === "ampersand") {
|
|
519
|
+
n++;
|
|
520
|
+
continue;
|
|
521
|
+
}
|
|
522
|
+
t += renderToken(r), n++;
|
|
523
|
+
}
|
|
524
|
+
return t;
|
|
525
|
+
}
|
|
526
|
+
function renderChar(e) {
|
|
527
|
+
return /[0-9]/.test(e) ? `<mn>${e}</mn>` : /[a-zA-Z]/.test(e) ? `<mi>${e}</mi>` : [
|
|
528
|
+
"+",
|
|
529
|
+
"-",
|
|
530
|
+
"=",
|
|
531
|
+
"<",
|
|
532
|
+
">",
|
|
533
|
+
"!",
|
|
534
|
+
"/",
|
|
535
|
+
"|",
|
|
536
|
+
",",
|
|
537
|
+
".",
|
|
538
|
+
":",
|
|
539
|
+
"?"
|
|
540
|
+
].includes(e) ? `<mo>${escapeHtml$2(e)}</mo>` : e === "(" || e === ")" || e === "[" || e === "]" ? `<mo>${e}</mo>` : `<mo>${escapeHtml$2(e)}</mo>`;
|
|
541
|
+
}
|
|
542
|
+
function renderToken(e) {
|
|
543
|
+
return e.type === "text" ? renderChar(e.value) : e.type === "group" ? `<mrow>${latexToMathML(e.value)}</mrow>` : e.type === "command" ? SYMBOLS[e.value] ? `<mo>${SYMBOLS[e.value]}</mo>` : LARGE_OPS[e.value] ? `<mo>${LARGE_OPS[e.value]}</mo>` : `<mi>${escapeHtml$2(e.value)}</mi>` : "";
|
|
544
|
+
}
|
|
545
|
+
function renderMatrix(e, t) {
|
|
546
|
+
let n = [[]], r = n[0];
|
|
547
|
+
for (let t of e) t.type === "newline" ? (n.push([]), r = n[n.length - 1]) : r.push(t);
|
|
548
|
+
let i = "";
|
|
549
|
+
for (let e of n) {
|
|
550
|
+
if (e.length === 0) continue;
|
|
551
|
+
let t = [[]], n = t[0];
|
|
552
|
+
for (let r of e) r.type === "ampersand" ? (t.push([]), n = t[t.length - 1]) : n.push(r);
|
|
553
|
+
i += "<mtr>";
|
|
554
|
+
for (let e of t) i += `<mtd columnalign="center">${tokensToMathML(e)}</mtd>`;
|
|
555
|
+
i += "</mtr>";
|
|
556
|
+
}
|
|
557
|
+
let a = `(<mtable columnspacing="0.5em" rowspacing="0.2em">${i}</mtable>)`;
|
|
558
|
+
switch (t) {
|
|
559
|
+
case "pmatrix": return `<mrow><mo></mo>${a}<mo></mo></mrow>`;
|
|
560
|
+
case "bmatrix": return `<mrow><mo>[</mo>${a}<mo>]</mo></mrow>`;
|
|
561
|
+
case "vmatrix": return `<mrow><mo>|</mo>${a}<mo>|</mo></mrow>`;
|
|
562
|
+
case "Bmatrix": return `<mrow><mo>{</mo>${a}<mo>}</mo></mrow>`;
|
|
563
|
+
case "Vmatrix": return `<mrow><mo>‖</mo>${a}<mo>‖</mo></mrow>`;
|
|
564
|
+
default: return a;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
function renderCases(e) {
|
|
568
|
+
let t = [[]], n = t[0];
|
|
569
|
+
for (let r of e) r.type === "newline" ? (t.push([]), n = t[t.length - 1]) : n.push(r);
|
|
570
|
+
let r = "";
|
|
571
|
+
for (let e of t) {
|
|
572
|
+
if (e.length === 0) continue;
|
|
573
|
+
let t = [[]], n = t[0];
|
|
574
|
+
for (let r of e) r.type === "ampersand" ? (t.push([]), n = t[t.length - 1]) : n.push(r);
|
|
575
|
+
r += "<mtr>";
|
|
576
|
+
for (let e of t) r += `<mtd columnalign="left" rowalign="center">${tokensToMathML(e)}</mtd>`;
|
|
577
|
+
r += "</mtr>";
|
|
578
|
+
}
|
|
579
|
+
return `<mrow><mo stretchy="true" minsize="1.2em">{</mo><mtable columnalign="left" columnspacing="0em" rowspacing="0.1em">${r}</mtable></mrow>`;
|
|
580
|
+
}
|
|
581
|
+
function renderAligned(e) {
|
|
582
|
+
let t = [[]], n = t[0];
|
|
583
|
+
for (let r of e) r.type === "newline" ? (t.push([]), n = t[t.length - 1]) : n.push(r);
|
|
584
|
+
let r = "";
|
|
585
|
+
for (let e of t) {
|
|
586
|
+
if (e.length === 0) continue;
|
|
587
|
+
let t = [[]], n = t[0];
|
|
588
|
+
for (let r of e) r.type === "ampersand" ? (t.push([]), n = t[t.length - 1]) : n.push(r);
|
|
589
|
+
r += "<mtr>";
|
|
590
|
+
for (let e = 0; e < t.length; e++) {
|
|
591
|
+
let n = e % 2 == 0 ? "right" : "left";
|
|
592
|
+
r += `<mtd columnalign="${n}">${tokensToMathML(t[e])}</mtd>`;
|
|
593
|
+
}
|
|
594
|
+
r += "</mtr>";
|
|
595
|
+
}
|
|
596
|
+
return `<mtable columnalign="right left" columnspacing="1em" rowspacing="0.3em">${r}</mtable>`;
|
|
597
|
+
}
|
|
598
|
+
function renderInlineMath(e) {
|
|
599
|
+
try {
|
|
600
|
+
return `<math xmlns="http://www.w3.org/1998/Math/MathML">${latexToMathML(e)}</math>`;
|
|
601
|
+
} catch {
|
|
602
|
+
return `<code class="math-error">${escapeHtml$2(e)}</code>`;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
function renderDisplayMath(e) {
|
|
606
|
+
try {
|
|
607
|
+
return `<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">${latexToMathML(e)}</math>`;
|
|
608
|
+
} catch {
|
|
609
|
+
return `<pre class="math-error"><code>${escapeHtml$2(e)}</code></pre>`;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
var import_prism = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((e, t) => {
|
|
613
|
+
/**
|
|
614
|
+
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
615
|
+
*
|
|
616
|
+
* @license MIT <https://opensource.org/licenses/MIT>
|
|
617
|
+
* @author Lea Verou <https://lea.verou.me>
|
|
618
|
+
* @namespace
|
|
619
|
+
* @public
|
|
620
|
+
*/
|
|
621
|
+
var n = function(e) {
|
|
622
|
+
var t = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i, n = 0, r = {}, i = {
|
|
623
|
+
manual: e.Prism && e.Prism.manual,
|
|
624
|
+
disableWorkerMessageHandler: e.Prism && e.Prism.disableWorkerMessageHandler,
|
|
625
|
+
util: {
|
|
626
|
+
encode: function e(t) {
|
|
627
|
+
return t instanceof a ? new a(t.type, e(t.content), t.alias) : Array.isArray(t) ? t.map(e) : t.replace(/&/g, "&").replace(/</g, "<").replace(/\u00a0/g, " ");
|
|
628
|
+
},
|
|
629
|
+
type: function(e) {
|
|
630
|
+
return Object.prototype.toString.call(e).slice(8, -1);
|
|
631
|
+
},
|
|
632
|
+
objId: function(e) {
|
|
633
|
+
return e.__id || Object.defineProperty(e, "__id", { value: ++n }), e.__id;
|
|
634
|
+
},
|
|
635
|
+
clone: function e(t, n) {
|
|
636
|
+
n ||= {};
|
|
637
|
+
var r, a;
|
|
638
|
+
switch (i.util.type(t)) {
|
|
639
|
+
case "Object":
|
|
640
|
+
if (a = i.util.objId(t), n[a]) return n[a];
|
|
641
|
+
for (var o in r = {}, n[a] = r, t) t.hasOwnProperty(o) && (r[o] = e(t[o], n));
|
|
642
|
+
return r;
|
|
643
|
+
case "Array": return a = i.util.objId(t), n[a] ? n[a] : (r = [], n[a] = r, t.forEach(function(t, i) {
|
|
644
|
+
r[i] = e(t, n);
|
|
645
|
+
}), r);
|
|
646
|
+
default: return t;
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
getLanguage: function(e) {
|
|
650
|
+
for (; e;) {
|
|
651
|
+
var n = t.exec(e.className);
|
|
652
|
+
if (n) return n[1].toLowerCase();
|
|
653
|
+
e = e.parentElement;
|
|
654
|
+
}
|
|
655
|
+
return "none";
|
|
656
|
+
},
|
|
657
|
+
setLanguage: function(e, n) {
|
|
658
|
+
e.className = e.className.replace(RegExp(t, "gi"), ""), e.classList.add("language-" + n);
|
|
659
|
+
},
|
|
660
|
+
currentScript: function() {
|
|
661
|
+
if (typeof document > "u") return null;
|
|
662
|
+
if (document.currentScript && document.currentScript.tagName === "SCRIPT") return document.currentScript;
|
|
663
|
+
try {
|
|
664
|
+
throw Error();
|
|
665
|
+
} catch (r) {
|
|
666
|
+
var e = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(r.stack) || [])[1];
|
|
667
|
+
if (e) {
|
|
668
|
+
var t = document.getElementsByTagName("script");
|
|
669
|
+
for (var n in t) if (t[n].src == e) return t[n];
|
|
670
|
+
}
|
|
671
|
+
return null;
|
|
672
|
+
}
|
|
673
|
+
},
|
|
674
|
+
isActive: function(e, t, n) {
|
|
675
|
+
for (var r = "no-" + t; e;) {
|
|
676
|
+
var i = e.classList;
|
|
677
|
+
if (i.contains(t)) return !0;
|
|
678
|
+
if (i.contains(r)) return !1;
|
|
679
|
+
e = e.parentElement;
|
|
680
|
+
}
|
|
681
|
+
return !!n;
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
languages: {
|
|
685
|
+
plain: r,
|
|
686
|
+
plaintext: r,
|
|
687
|
+
text: r,
|
|
688
|
+
txt: r,
|
|
689
|
+
extend: function(e, t) {
|
|
690
|
+
var n = i.util.clone(i.languages[e]);
|
|
691
|
+
for (var r in t) n[r] = t[r];
|
|
692
|
+
return n;
|
|
693
|
+
},
|
|
694
|
+
insertBefore: function(e, t, n, r) {
|
|
695
|
+
r ||= i.languages;
|
|
696
|
+
var a = r[e], o = {};
|
|
697
|
+
for (var s in a) if (a.hasOwnProperty(s)) {
|
|
698
|
+
if (s == t) for (var c in n) n.hasOwnProperty(c) && (o[c] = n[c]);
|
|
699
|
+
n.hasOwnProperty(s) || (o[s] = a[s]);
|
|
700
|
+
}
|
|
701
|
+
var l = r[e];
|
|
702
|
+
return r[e] = o, i.languages.DFS(i.languages, function(t, n) {
|
|
703
|
+
n === l && t != e && (this[t] = o);
|
|
704
|
+
}), o;
|
|
705
|
+
},
|
|
706
|
+
DFS: function e(t, n, r, a) {
|
|
707
|
+
a ||= {};
|
|
708
|
+
var o = i.util.objId;
|
|
709
|
+
for (var s in t) if (t.hasOwnProperty(s)) {
|
|
710
|
+
n.call(t, s, t[s], r || s);
|
|
711
|
+
var c = t[s], l = i.util.type(c);
|
|
712
|
+
l === "Object" && !a[o(c)] ? (a[o(c)] = !0, e(c, n, null, a)) : l === "Array" && !a[o(c)] && (a[o(c)] = !0, e(c, n, s, a));
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
},
|
|
716
|
+
plugins: {},
|
|
717
|
+
highlightAll: function(e, t) {
|
|
718
|
+
i.highlightAllUnder(document, e, t);
|
|
719
|
+
},
|
|
720
|
+
highlightAllUnder: function(e, t, n) {
|
|
721
|
+
var r = {
|
|
722
|
+
callback: n,
|
|
723
|
+
container: e,
|
|
724
|
+
selector: "code[class*=\"language-\"], [class*=\"language-\"] code, code[class*=\"lang-\"], [class*=\"lang-\"] code"
|
|
725
|
+
};
|
|
726
|
+
i.hooks.run("before-highlightall", r), r.elements = Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)), i.hooks.run("before-all-elements-highlight", r);
|
|
727
|
+
for (var a = 0, o; o = r.elements[a++];) i.highlightElement(o, t === !0, r.callback);
|
|
728
|
+
},
|
|
729
|
+
highlightElement: function(t, n, r) {
|
|
730
|
+
var a = i.util.getLanguage(t), o = i.languages[a];
|
|
731
|
+
i.util.setLanguage(t, a);
|
|
732
|
+
var s = t.parentElement;
|
|
733
|
+
s && s.nodeName.toLowerCase() === "pre" && i.util.setLanguage(s, a);
|
|
734
|
+
var c = {
|
|
735
|
+
element: t,
|
|
736
|
+
language: a,
|
|
737
|
+
grammar: o,
|
|
738
|
+
code: t.textContent
|
|
739
|
+
};
|
|
740
|
+
function l(e) {
|
|
741
|
+
c.highlightedCode = e, i.hooks.run("before-insert", c), c.element.innerHTML = c.highlightedCode, i.hooks.run("after-highlight", c), i.hooks.run("complete", c), r && r.call(c.element);
|
|
742
|
+
}
|
|
743
|
+
if (i.hooks.run("before-sanity-check", c), s = c.element.parentElement, s && s.nodeName.toLowerCase() === "pre" && !s.hasAttribute("tabindex") && s.setAttribute("tabindex", "0"), !c.code) {
|
|
744
|
+
i.hooks.run("complete", c), r && r.call(c.element);
|
|
745
|
+
return;
|
|
746
|
+
}
|
|
747
|
+
if (i.hooks.run("before-highlight", c), !c.grammar) {
|
|
748
|
+
l(i.util.encode(c.code));
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
if (n && e.Worker) {
|
|
752
|
+
var u = new Worker(i.filename);
|
|
753
|
+
u.onmessage = function(e) {
|
|
754
|
+
l(e.data);
|
|
755
|
+
}, u.postMessage(JSON.stringify({
|
|
756
|
+
language: c.language,
|
|
757
|
+
code: c.code,
|
|
758
|
+
immediateClose: !0
|
|
759
|
+
}));
|
|
760
|
+
} else l(i.highlight(c.code, c.grammar, c.language));
|
|
761
|
+
},
|
|
762
|
+
highlight: function(e, t, n) {
|
|
763
|
+
var r = {
|
|
764
|
+
code: e,
|
|
765
|
+
grammar: t,
|
|
766
|
+
language: n
|
|
767
|
+
};
|
|
768
|
+
if (i.hooks.run("before-tokenize", r), !r.grammar) throw Error("The language \"" + r.language + "\" has no grammar.");
|
|
769
|
+
return r.tokens = i.tokenize(r.code, r.grammar), i.hooks.run("after-tokenize", r), a.stringify(i.util.encode(r.tokens), r.language);
|
|
770
|
+
},
|
|
771
|
+
tokenize: function(e, t) {
|
|
772
|
+
var n = t.rest;
|
|
773
|
+
if (n) {
|
|
774
|
+
for (var r in n) t[r] = n[r];
|
|
775
|
+
delete t.rest;
|
|
776
|
+
}
|
|
777
|
+
var i = new c();
|
|
778
|
+
return l(i, i.head, e), s(e, i, t, i.head, 0), d(i);
|
|
779
|
+
},
|
|
780
|
+
hooks: {
|
|
781
|
+
all: {},
|
|
782
|
+
add: function(e, t) {
|
|
783
|
+
var n = i.hooks.all;
|
|
784
|
+
n[e] = n[e] || [], n[e].push(t);
|
|
785
|
+
},
|
|
786
|
+
run: function(e, t) {
|
|
787
|
+
var n = i.hooks.all[e];
|
|
788
|
+
if (!(!n || !n.length)) for (var r = 0, a; a = n[r++];) a(t);
|
|
789
|
+
}
|
|
790
|
+
},
|
|
791
|
+
Token: a
|
|
792
|
+
};
|
|
793
|
+
e.Prism = i;
|
|
794
|
+
function a(e, t, n, r) {
|
|
795
|
+
this.type = e, this.content = t, this.alias = n, this.length = (r || "").length | 0;
|
|
796
|
+
}
|
|
797
|
+
a.stringify = function e(t, n) {
|
|
798
|
+
if (typeof t == "string") return t;
|
|
799
|
+
if (Array.isArray(t)) {
|
|
800
|
+
var r = "";
|
|
801
|
+
return t.forEach(function(t) {
|
|
802
|
+
r += e(t, n);
|
|
803
|
+
}), r;
|
|
804
|
+
}
|
|
805
|
+
var a = {
|
|
806
|
+
type: t.type,
|
|
807
|
+
content: e(t.content, n),
|
|
808
|
+
tag: "span",
|
|
809
|
+
classes: ["token", t.type],
|
|
810
|
+
attributes: {},
|
|
811
|
+
language: n
|
|
812
|
+
}, o = t.alias;
|
|
813
|
+
o && (Array.isArray(o) ? Array.prototype.push.apply(a.classes, o) : a.classes.push(o)), i.hooks.run("wrap", a);
|
|
814
|
+
var s = "";
|
|
815
|
+
for (var c in a.attributes) s += " " + c + "=\"" + (a.attributes[c] || "").replace(/"/g, """) + "\"";
|
|
816
|
+
return "<" + a.tag + " class=\"" + a.classes.join(" ") + "\"" + s + ">" + a.content + "</" + a.tag + ">";
|
|
817
|
+
};
|
|
818
|
+
function o(e, t, n, r) {
|
|
819
|
+
e.lastIndex = t;
|
|
820
|
+
var i = e.exec(n);
|
|
821
|
+
if (i && r && i[1]) {
|
|
822
|
+
var a = i[1].length;
|
|
823
|
+
i.index += a, i[0] = i[0].slice(a);
|
|
824
|
+
}
|
|
825
|
+
return i;
|
|
826
|
+
}
|
|
827
|
+
function s(e, t, n, r, c, d) {
|
|
828
|
+
for (var f in n) if (!(!n.hasOwnProperty(f) || !n[f])) {
|
|
829
|
+
var p = n[f];
|
|
830
|
+
p = Array.isArray(p) ? p : [p];
|
|
831
|
+
for (var m = 0; m < p.length; ++m) {
|
|
832
|
+
if (d && d.cause == f + "," + m) return;
|
|
833
|
+
var h = p[m], g = h.inside, _ = !!h.lookbehind, v = !!h.greedy, y = h.alias;
|
|
834
|
+
if (v && !h.pattern.global) {
|
|
835
|
+
var b = h.pattern.toString().match(/[imsuy]*$/)[0];
|
|
836
|
+
h.pattern = RegExp(h.pattern.source, b + "g");
|
|
837
|
+
}
|
|
838
|
+
for (var x = h.pattern || h, S = r.next, C = c; S !== t.tail && !(d && C >= d.reach); C += S.value.length, S = S.next) {
|
|
839
|
+
var w = S.value;
|
|
840
|
+
if (t.length > e.length) return;
|
|
841
|
+
if (!(w instanceof a)) {
|
|
842
|
+
var T = 1, E;
|
|
843
|
+
if (v) {
|
|
844
|
+
if (E = o(x, C, e, _), !E || E.index >= e.length) break;
|
|
845
|
+
var D = E.index, O = E.index + E[0].length, k = C;
|
|
846
|
+
for (k += S.value.length; D >= k;) S = S.next, k += S.value.length;
|
|
847
|
+
if (k -= S.value.length, C = k, S.value instanceof a) continue;
|
|
848
|
+
for (var A = S; A !== t.tail && (k < O || typeof A.value == "string"); A = A.next) T++, k += A.value.length;
|
|
849
|
+
T--, w = e.slice(C, k), E.index -= C;
|
|
850
|
+
} else if (E = o(x, 0, w, _), !E) continue;
|
|
851
|
+
var D = E.index, j = E[0], M = w.slice(0, D), N = w.slice(D + j.length), P = C + w.length;
|
|
852
|
+
d && P > d.reach && (d.reach = P);
|
|
853
|
+
var F = S.prev;
|
|
854
|
+
M && (F = l(t, F, M), C += M.length), u(t, F, T);
|
|
855
|
+
var I = new a(f, g ? i.tokenize(j, g) : j, y, j);
|
|
856
|
+
if (S = l(t, F, I), N && l(t, S, N), T > 1) {
|
|
857
|
+
var L = {
|
|
858
|
+
cause: f + "," + m,
|
|
859
|
+
reach: P
|
|
860
|
+
};
|
|
861
|
+
s(e, t, n, S.prev, C, L), d && L.reach > d.reach && (d.reach = L.reach);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
function c() {
|
|
869
|
+
var e = {
|
|
870
|
+
value: null,
|
|
871
|
+
prev: null,
|
|
872
|
+
next: null
|
|
873
|
+
}, t = {
|
|
874
|
+
value: null,
|
|
875
|
+
prev: e,
|
|
876
|
+
next: null
|
|
877
|
+
};
|
|
878
|
+
e.next = t, this.head = e, this.tail = t, this.length = 0;
|
|
879
|
+
}
|
|
880
|
+
function l(e, t, n) {
|
|
881
|
+
var r = t.next, i = {
|
|
882
|
+
value: n,
|
|
883
|
+
prev: t,
|
|
884
|
+
next: r
|
|
885
|
+
};
|
|
886
|
+
return t.next = i, r.prev = i, e.length++, i;
|
|
887
|
+
}
|
|
888
|
+
function u(e, t, n) {
|
|
889
|
+
for (var r = t.next, i = 0; i < n && r !== e.tail; i++) r = r.next;
|
|
890
|
+
t.next = r, r.prev = t, e.length -= i;
|
|
891
|
+
}
|
|
892
|
+
function d(e) {
|
|
893
|
+
for (var t = [], n = e.head.next; n !== e.tail;) t.push(n.value), n = n.next;
|
|
894
|
+
return t;
|
|
895
|
+
}
|
|
896
|
+
if (!e.document) return e.addEventListener && (i.disableWorkerMessageHandler || e.addEventListener("message", function(t) {
|
|
897
|
+
var n = JSON.parse(t.data), r = n.language, a = n.code, o = n.immediateClose;
|
|
898
|
+
e.postMessage(i.highlight(a, i.languages[r], r)), o && e.close();
|
|
899
|
+
}, !1)), i;
|
|
900
|
+
var f = i.util.currentScript();
|
|
901
|
+
f && (i.filename = f.src, f.hasAttribute("data-manual") && (i.manual = !0));
|
|
902
|
+
function p() {
|
|
903
|
+
i.manual || i.highlightAll();
|
|
904
|
+
}
|
|
905
|
+
if (!i.manual) {
|
|
906
|
+
var m = document.readyState;
|
|
907
|
+
m === "loading" || m === "interactive" && f && f.defer ? document.addEventListener("DOMContentLoaded", p) : window.requestAnimationFrame ? window.requestAnimationFrame(p) : window.setTimeout(p, 16);
|
|
908
|
+
}
|
|
909
|
+
return i;
|
|
910
|
+
}(typeof window < "u" ? window : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : {});
|
|
911
|
+
t !== void 0 && t.exports && (t.exports = n), typeof global < "u" && (global.Prism = n), n.languages.markup = {
|
|
912
|
+
comment: {
|
|
913
|
+
pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
|
|
914
|
+
greedy: !0
|
|
915
|
+
},
|
|
916
|
+
prolog: {
|
|
917
|
+
pattern: /<\?[\s\S]+?\?>/,
|
|
918
|
+
greedy: !0
|
|
919
|
+
},
|
|
920
|
+
doctype: {
|
|
921
|
+
pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
|
|
922
|
+
greedy: !0,
|
|
923
|
+
inside: {
|
|
924
|
+
"internal-subset": {
|
|
925
|
+
pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
|
|
926
|
+
lookbehind: !0,
|
|
927
|
+
greedy: !0,
|
|
928
|
+
inside: null
|
|
929
|
+
},
|
|
930
|
+
string: {
|
|
931
|
+
pattern: /"[^"]*"|'[^']*'/,
|
|
932
|
+
greedy: !0
|
|
933
|
+
},
|
|
934
|
+
punctuation: /^<!|>$|[[\]]/,
|
|
935
|
+
"doctype-tag": /^DOCTYPE/i,
|
|
936
|
+
name: /[^\s<>'"]+/
|
|
937
|
+
}
|
|
938
|
+
},
|
|
939
|
+
cdata: {
|
|
940
|
+
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
941
|
+
greedy: !0
|
|
942
|
+
},
|
|
943
|
+
tag: {
|
|
944
|
+
pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
|
|
945
|
+
greedy: !0,
|
|
946
|
+
inside: {
|
|
947
|
+
tag: {
|
|
948
|
+
pattern: /^<\/?[^\s>\/]+/,
|
|
949
|
+
inside: {
|
|
950
|
+
punctuation: /^<\/?/,
|
|
951
|
+
namespace: /^[^\s>\/:]+:/
|
|
952
|
+
}
|
|
953
|
+
},
|
|
954
|
+
"special-attr": [],
|
|
955
|
+
"attr-value": {
|
|
956
|
+
pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
|
|
957
|
+
inside: { punctuation: [{
|
|
958
|
+
pattern: /^=/,
|
|
959
|
+
alias: "attr-equals"
|
|
960
|
+
}, {
|
|
961
|
+
pattern: /^(\s*)["']|["']$/,
|
|
962
|
+
lookbehind: !0
|
|
963
|
+
}] }
|
|
964
|
+
},
|
|
965
|
+
punctuation: /\/?>/,
|
|
966
|
+
"attr-name": {
|
|
967
|
+
pattern: /[^\s>\/]+/,
|
|
968
|
+
inside: { namespace: /^[^\s>\/:]+:/ }
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
},
|
|
972
|
+
entity: [{
|
|
973
|
+
pattern: /&[\da-z]{1,8};/i,
|
|
974
|
+
alias: "named-entity"
|
|
975
|
+
}, /&#x?[\da-f]{1,8};/i]
|
|
976
|
+
}, n.languages.markup.tag.inside["attr-value"].inside.entity = n.languages.markup.entity, n.languages.markup.doctype.inside["internal-subset"].inside = n.languages.markup, n.hooks.add("wrap", function(e) {
|
|
977
|
+
e.type === "entity" && (e.attributes.title = e.content.replace(/&/, "&"));
|
|
978
|
+
}), Object.defineProperty(n.languages.markup.tag, "addInlined", { value: function(e, t) {
|
|
979
|
+
var r = {};
|
|
980
|
+
r["language-" + t] = {
|
|
981
|
+
pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
|
|
982
|
+
lookbehind: !0,
|
|
983
|
+
inside: n.languages[t]
|
|
984
|
+
}, r.cdata = /^<!\[CDATA\[|\]\]>$/i;
|
|
985
|
+
var i = { "included-cdata": {
|
|
986
|
+
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
987
|
+
inside: r
|
|
988
|
+
} };
|
|
989
|
+
i["language-" + t] = {
|
|
990
|
+
pattern: /[\s\S]+/,
|
|
991
|
+
inside: n.languages[t]
|
|
992
|
+
};
|
|
993
|
+
var a = {};
|
|
994
|
+
a[e] = {
|
|
995
|
+
pattern: RegExp("(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[\\s\\S])*?(?=<\\/__>)".replace(/__/g, function() {
|
|
996
|
+
return e;
|
|
997
|
+
}), "i"),
|
|
998
|
+
lookbehind: !0,
|
|
999
|
+
greedy: !0,
|
|
1000
|
+
inside: i
|
|
1001
|
+
}, n.languages.insertBefore("markup", "cdata", a);
|
|
1002
|
+
} }), Object.defineProperty(n.languages.markup.tag, "addAttribute", { value: function(e, t) {
|
|
1003
|
+
n.languages.markup.tag.inside["special-attr"].push({
|
|
1004
|
+
pattern: RegExp("(^|[\"'\\s])(?:" + e + ")\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s'\">=]+(?=[\\s>]))", "i"),
|
|
1005
|
+
lookbehind: !0,
|
|
1006
|
+
inside: {
|
|
1007
|
+
"attr-name": /^[^\s=]+/,
|
|
1008
|
+
"attr-value": {
|
|
1009
|
+
pattern: /=[\s\S]+/,
|
|
1010
|
+
inside: {
|
|
1011
|
+
value: {
|
|
1012
|
+
pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
|
|
1013
|
+
lookbehind: !0,
|
|
1014
|
+
alias: [t, "language-" + t],
|
|
1015
|
+
inside: n.languages[t]
|
|
1016
|
+
},
|
|
1017
|
+
punctuation: [{
|
|
1018
|
+
pattern: /^=/,
|
|
1019
|
+
alias: "attr-equals"
|
|
1020
|
+
}, /"|'/]
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
});
|
|
1025
|
+
} }), n.languages.html = n.languages.markup, n.languages.mathml = n.languages.markup, n.languages.svg = n.languages.markup, n.languages.xml = n.languages.extend("markup", {}), n.languages.ssml = n.languages.xml, n.languages.atom = n.languages.xml, n.languages.rss = n.languages.xml, (function(e) {
|
|
1026
|
+
var t = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
|
1027
|
+
e.languages.css = {
|
|
1028
|
+
comment: /\/\*[\s\S]*?\*\//,
|
|
1029
|
+
atrule: {
|
|
1030
|
+
pattern: RegExp("@[\\w-](?:[^;{\\s\"']|\\s+(?!\\s)|" + t.source + ")*?(?:;|(?=\\s*\\{))"),
|
|
1031
|
+
inside: {
|
|
1032
|
+
rule: /^@[\w-]+/,
|
|
1033
|
+
"selector-function-argument": {
|
|
1034
|
+
pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
|
|
1035
|
+
lookbehind: !0,
|
|
1036
|
+
alias: "selector"
|
|
1037
|
+
},
|
|
1038
|
+
keyword: {
|
|
1039
|
+
pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
|
|
1040
|
+
lookbehind: !0
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
},
|
|
1044
|
+
url: {
|
|
1045
|
+
pattern: RegExp("\\burl\\((?:" + t.source + "|(?:[^\\\\\\r\\n()\"']|\\\\[\\s\\S])*)\\)", "i"),
|
|
1046
|
+
greedy: !0,
|
|
1047
|
+
inside: {
|
|
1048
|
+
function: /^url/i,
|
|
1049
|
+
punctuation: /^\(|\)$/,
|
|
1050
|
+
string: {
|
|
1051
|
+
pattern: RegExp("^" + t.source + "$"),
|
|
1052
|
+
alias: "url"
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
},
|
|
1056
|
+
selector: {
|
|
1057
|
+
pattern: RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|" + t.source + ")*(?=\\s*\\{)"),
|
|
1058
|
+
lookbehind: !0
|
|
1059
|
+
},
|
|
1060
|
+
string: {
|
|
1061
|
+
pattern: t,
|
|
1062
|
+
greedy: !0
|
|
1063
|
+
},
|
|
1064
|
+
property: {
|
|
1065
|
+
pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
|
|
1066
|
+
lookbehind: !0
|
|
1067
|
+
},
|
|
1068
|
+
important: /!important\b/i,
|
|
1069
|
+
function: {
|
|
1070
|
+
pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
|
|
1071
|
+
lookbehind: !0
|
|
1072
|
+
},
|
|
1073
|
+
punctuation: /[(){};:,]/
|
|
1074
|
+
}, e.languages.css.atrule.inside.rest = e.languages.css;
|
|
1075
|
+
var n = e.languages.markup;
|
|
1076
|
+
n && (n.tag.addInlined("style", "css"), n.tag.addAttribute("style", "css"));
|
|
1077
|
+
})(n), n.languages.clike = {
|
|
1078
|
+
comment: [{
|
|
1079
|
+
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
|
|
1080
|
+
lookbehind: !0,
|
|
1081
|
+
greedy: !0
|
|
1082
|
+
}, {
|
|
1083
|
+
pattern: /(^|[^\\:])\/\/.*/,
|
|
1084
|
+
lookbehind: !0,
|
|
1085
|
+
greedy: !0
|
|
1086
|
+
}],
|
|
1087
|
+
string: {
|
|
1088
|
+
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
|
|
1089
|
+
greedy: !0
|
|
1090
|
+
},
|
|
1091
|
+
"class-name": {
|
|
1092
|
+
pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
|
|
1093
|
+
lookbehind: !0,
|
|
1094
|
+
inside: { punctuation: /[.\\]/ }
|
|
1095
|
+
},
|
|
1096
|
+
keyword: /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
|
|
1097
|
+
boolean: /\b(?:false|true)\b/,
|
|
1098
|
+
function: /\b\w+(?=\()/,
|
|
1099
|
+
number: /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
|
|
1100
|
+
operator: /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
|
|
1101
|
+
punctuation: /[{}[\];(),.:]/
|
|
1102
|
+
}, n.languages.javascript = n.languages.extend("clike", {
|
|
1103
|
+
"class-name": [n.languages.clike["class-name"], {
|
|
1104
|
+
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
|
|
1105
|
+
lookbehind: !0
|
|
1106
|
+
}],
|
|
1107
|
+
keyword: [{
|
|
1108
|
+
pattern: /((?:^|\})\s*)catch\b/,
|
|
1109
|
+
lookbehind: !0
|
|
1110
|
+
}, {
|
|
1111
|
+
pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
|
|
1112
|
+
lookbehind: !0
|
|
1113
|
+
}],
|
|
1114
|
+
function: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
|
|
1115
|
+
number: {
|
|
1116
|
+
pattern: RegExp("(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])"),
|
|
1117
|
+
lookbehind: !0
|
|
1118
|
+
},
|
|
1119
|
+
operator: /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
|
|
1120
|
+
}), n.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/, n.languages.insertBefore("javascript", "keyword", {
|
|
1121
|
+
regex: {
|
|
1122
|
+
pattern: RegExp("((?:^|[^$\\w\\xA0-\\uFFFF.\"'\\])\\s]|\\b(?:return|yield))\\s*)\\/(?:(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))"),
|
|
1123
|
+
lookbehind: !0,
|
|
1124
|
+
greedy: !0,
|
|
1125
|
+
inside: {
|
|
1126
|
+
"regex-source": {
|
|
1127
|
+
pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
|
|
1128
|
+
lookbehind: !0,
|
|
1129
|
+
alias: "language-regex",
|
|
1130
|
+
inside: n.languages.regex
|
|
1131
|
+
},
|
|
1132
|
+
"regex-delimiter": /^\/|\/$/,
|
|
1133
|
+
"regex-flags": /^[a-z]+$/
|
|
1134
|
+
}
|
|
1135
|
+
},
|
|
1136
|
+
"function-variable": {
|
|
1137
|
+
pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
|
|
1138
|
+
alias: "function"
|
|
1139
|
+
},
|
|
1140
|
+
parameter: [
|
|
1141
|
+
{
|
|
1142
|
+
pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
|
|
1143
|
+
lookbehind: !0,
|
|
1144
|
+
inside: n.languages.javascript
|
|
1145
|
+
},
|
|
1146
|
+
{
|
|
1147
|
+
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
|
|
1148
|
+
lookbehind: !0,
|
|
1149
|
+
inside: n.languages.javascript
|
|
1150
|
+
},
|
|
1151
|
+
{
|
|
1152
|
+
pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
|
|
1153
|
+
lookbehind: !0,
|
|
1154
|
+
inside: n.languages.javascript
|
|
1155
|
+
},
|
|
1156
|
+
{
|
|
1157
|
+
pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
|
|
1158
|
+
lookbehind: !0,
|
|
1159
|
+
inside: n.languages.javascript
|
|
1160
|
+
}
|
|
1161
|
+
],
|
|
1162
|
+
constant: /\b[A-Z](?:[A-Z_]|\dx?)*\b/
|
|
1163
|
+
}), n.languages.insertBefore("javascript", "string", {
|
|
1164
|
+
hashbang: {
|
|
1165
|
+
pattern: /^#!.*/,
|
|
1166
|
+
greedy: !0,
|
|
1167
|
+
alias: "comment"
|
|
1168
|
+
},
|
|
1169
|
+
"template-string": {
|
|
1170
|
+
pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
|
|
1171
|
+
greedy: !0,
|
|
1172
|
+
inside: {
|
|
1173
|
+
"template-punctuation": {
|
|
1174
|
+
pattern: /^`|`$/,
|
|
1175
|
+
alias: "string"
|
|
1176
|
+
},
|
|
1177
|
+
interpolation: {
|
|
1178
|
+
pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
|
|
1179
|
+
lookbehind: !0,
|
|
1180
|
+
inside: {
|
|
1181
|
+
"interpolation-punctuation": {
|
|
1182
|
+
pattern: /^\$\{|\}$/,
|
|
1183
|
+
alias: "punctuation"
|
|
1184
|
+
},
|
|
1185
|
+
rest: n.languages.javascript
|
|
1186
|
+
}
|
|
1187
|
+
},
|
|
1188
|
+
string: /[\s\S]+/
|
|
1189
|
+
}
|
|
1190
|
+
},
|
|
1191
|
+
"string-property": {
|
|
1192
|
+
pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
|
|
1193
|
+
lookbehind: !0,
|
|
1194
|
+
greedy: !0,
|
|
1195
|
+
alias: "property"
|
|
1196
|
+
}
|
|
1197
|
+
}), n.languages.insertBefore("javascript", "operator", { "literal-property": {
|
|
1198
|
+
pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
|
|
1199
|
+
lookbehind: !0,
|
|
1200
|
+
alias: "property"
|
|
1201
|
+
} }), n.languages.markup && (n.languages.markup.tag.addInlined("script", "javascript"), n.languages.markup.tag.addAttribute("on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)", "javascript")), n.languages.js = n.languages.javascript, (function() {
|
|
1202
|
+
if (n === void 0 || typeof document > "u") return;
|
|
1203
|
+
Element.prototype.matches || (Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector);
|
|
1204
|
+
var e = "Loading…", t = function(e, t) {
|
|
1205
|
+
return "✖ Error " + e + " while fetching file: " + t;
|
|
1206
|
+
}, r = "✖ Error: File does not exist or is empty", i = {
|
|
1207
|
+
js: "javascript",
|
|
1208
|
+
py: "python",
|
|
1209
|
+
rb: "ruby",
|
|
1210
|
+
ps1: "powershell",
|
|
1211
|
+
psm1: "powershell",
|
|
1212
|
+
sh: "bash",
|
|
1213
|
+
bat: "batch",
|
|
1214
|
+
h: "c",
|
|
1215
|
+
tex: "latex"
|
|
1216
|
+
}, a = "data-src-status", o = "loading", s = "loaded", c = "failed", l = "pre[data-src]:not([" + a + "=\"" + s + "\"]):not([" + a + "=\"" + o + "\"])";
|
|
1217
|
+
function u(e, n, i) {
|
|
1218
|
+
var a = new XMLHttpRequest();
|
|
1219
|
+
a.open("GET", e, !0), a.onreadystatechange = function() {
|
|
1220
|
+
a.readyState == 4 && (a.status < 400 && a.responseText ? n(a.responseText) : a.status >= 400 ? i(t(a.status, a.statusText)) : i(r));
|
|
1221
|
+
}, a.send(null);
|
|
1222
|
+
}
|
|
1223
|
+
function d(e) {
|
|
1224
|
+
var t = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(e || "");
|
|
1225
|
+
if (t) {
|
|
1226
|
+
var n = Number(t[1]), r = t[2], i = t[3];
|
|
1227
|
+
return r ? i ? [n, Number(i)] : [n, void 0] : [n, n];
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
n.hooks.add("before-highlightall", function(e) {
|
|
1231
|
+
e.selector += ", " + l;
|
|
1232
|
+
}), n.hooks.add("before-sanity-check", function(t) {
|
|
1233
|
+
var r = t.element;
|
|
1234
|
+
if (r.matches(l)) {
|
|
1235
|
+
t.code = "", r.setAttribute(a, o);
|
|
1236
|
+
var f = r.appendChild(document.createElement("CODE"));
|
|
1237
|
+
f.textContent = e;
|
|
1238
|
+
var p = r.getAttribute("data-src"), m = t.language;
|
|
1239
|
+
if (m === "none") {
|
|
1240
|
+
var h = (/\.(\w+)$/.exec(p) || [, "none"])[1];
|
|
1241
|
+
m = i[h] || h;
|
|
1242
|
+
}
|
|
1243
|
+
n.util.setLanguage(f, m), n.util.setLanguage(r, m);
|
|
1244
|
+
var g = n.plugins.autoloader;
|
|
1245
|
+
g && g.loadLanguages(m), u(p, function(e) {
|
|
1246
|
+
r.setAttribute(a, s);
|
|
1247
|
+
var t = d(r.getAttribute("data-range"));
|
|
1248
|
+
if (t) {
|
|
1249
|
+
var i = e.split(/\r\n?|\n/g), o = t[0], c = t[1] == null ? i.length : t[1];
|
|
1250
|
+
o < 0 && (o += i.length), o = Math.max(0, Math.min(o - 1, i.length)), c < 0 && (c += i.length), c = Math.max(0, Math.min(c, i.length)), e = i.slice(o, c).join("\n"), r.hasAttribute("data-start") || r.setAttribute("data-start", String(o + 1));
|
|
1251
|
+
}
|
|
1252
|
+
f.textContent = e, n.highlightElement(f);
|
|
1253
|
+
}, function(e) {
|
|
1254
|
+
r.setAttribute(a, c), f.textContent = e;
|
|
1255
|
+
});
|
|
1256
|
+
}
|
|
1257
|
+
}), n.plugins.fileHighlight = { highlight: function(e) {
|
|
1258
|
+
for (var t = (e || document).querySelectorAll(l), r = 0, i; i = t[r++];) n.highlightElement(i);
|
|
1259
|
+
} };
|
|
1260
|
+
var f = !1;
|
|
1261
|
+
n.fileHighlight = function() {
|
|
1262
|
+
f ||= (console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."), !0), n.plugins.fileHighlight.highlight.apply(this, arguments);
|
|
1263
|
+
};
|
|
1264
|
+
})();
|
|
1265
|
+
})))(), 1);
|
|
1266
|
+
Prism.languages.javascript = Prism.languages.extend("clike", {
|
|
1267
|
+
"class-name": [Prism.languages.clike["class-name"], {
|
|
1268
|
+
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
|
|
1269
|
+
lookbehind: !0
|
|
1270
|
+
}],
|
|
1271
|
+
keyword: [{
|
|
1272
|
+
pattern: /((?:^|\})\s*)catch\b/,
|
|
1273
|
+
lookbehind: !0
|
|
1274
|
+
}, {
|
|
1275
|
+
pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
|
|
1276
|
+
lookbehind: !0
|
|
1277
|
+
}],
|
|
1278
|
+
function: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
|
|
1279
|
+
number: {
|
|
1280
|
+
pattern: RegExp("(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])"),
|
|
1281
|
+
lookbehind: !0
|
|
1282
|
+
},
|
|
1283
|
+
operator: /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
|
|
1284
|
+
}), Prism.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/, Prism.languages.insertBefore("javascript", "keyword", {
|
|
1285
|
+
regex: {
|
|
1286
|
+
pattern: RegExp("((?:^|[^$\\w\\xA0-\\uFFFF.\"'\\])\\s]|\\b(?:return|yield))\\s*)\\/(?:(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))"),
|
|
1287
|
+
lookbehind: !0,
|
|
1288
|
+
greedy: !0,
|
|
1289
|
+
inside: {
|
|
1290
|
+
"regex-source": {
|
|
1291
|
+
pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
|
|
1292
|
+
lookbehind: !0,
|
|
1293
|
+
alias: "language-regex",
|
|
1294
|
+
inside: Prism.languages.regex
|
|
1295
|
+
},
|
|
1296
|
+
"regex-delimiter": /^\/|\/$/,
|
|
1297
|
+
"regex-flags": /^[a-z]+$/
|
|
1298
|
+
}
|
|
1299
|
+
},
|
|
1300
|
+
"function-variable": {
|
|
1301
|
+
pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
|
|
1302
|
+
alias: "function"
|
|
1303
|
+
},
|
|
1304
|
+
parameter: [
|
|
1305
|
+
{
|
|
1306
|
+
pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
|
|
1307
|
+
lookbehind: !0,
|
|
1308
|
+
inside: Prism.languages.javascript
|
|
1309
|
+
},
|
|
1310
|
+
{
|
|
1311
|
+
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
|
|
1312
|
+
lookbehind: !0,
|
|
1313
|
+
inside: Prism.languages.javascript
|
|
1314
|
+
},
|
|
1315
|
+
{
|
|
1316
|
+
pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
|
|
1317
|
+
lookbehind: !0,
|
|
1318
|
+
inside: Prism.languages.javascript
|
|
1319
|
+
},
|
|
1320
|
+
{
|
|
1321
|
+
pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
|
|
1322
|
+
lookbehind: !0,
|
|
1323
|
+
inside: Prism.languages.javascript
|
|
1324
|
+
}
|
|
1325
|
+
],
|
|
1326
|
+
constant: /\b[A-Z](?:[A-Z_]|\dx?)*\b/
|
|
1327
|
+
}), Prism.languages.insertBefore("javascript", "string", {
|
|
1328
|
+
hashbang: {
|
|
1329
|
+
pattern: /^#!.*/,
|
|
1330
|
+
greedy: !0,
|
|
1331
|
+
alias: "comment"
|
|
1332
|
+
},
|
|
1333
|
+
"template-string": {
|
|
1334
|
+
pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
|
|
1335
|
+
greedy: !0,
|
|
1336
|
+
inside: {
|
|
1337
|
+
"template-punctuation": {
|
|
1338
|
+
pattern: /^`|`$/,
|
|
1339
|
+
alias: "string"
|
|
1340
|
+
},
|
|
1341
|
+
interpolation: {
|
|
1342
|
+
pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
|
|
1343
|
+
lookbehind: !0,
|
|
1344
|
+
inside: {
|
|
1345
|
+
"interpolation-punctuation": {
|
|
1346
|
+
pattern: /^\$\{|\}$/,
|
|
1347
|
+
alias: "punctuation"
|
|
1348
|
+
},
|
|
1349
|
+
rest: Prism.languages.javascript
|
|
1350
|
+
}
|
|
1351
|
+
},
|
|
1352
|
+
string: /[\s\S]+/
|
|
1353
|
+
}
|
|
1354
|
+
},
|
|
1355
|
+
"string-property": {
|
|
1356
|
+
pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
|
|
1357
|
+
lookbehind: !0,
|
|
1358
|
+
greedy: !0,
|
|
1359
|
+
alias: "property"
|
|
1360
|
+
}
|
|
1361
|
+
}), Prism.languages.insertBefore("javascript", "operator", { "literal-property": {
|
|
1362
|
+
pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
|
|
1363
|
+
lookbehind: !0,
|
|
1364
|
+
alias: "property"
|
|
1365
|
+
} }), Prism.languages.markup && (Prism.languages.markup.tag.addInlined("script", "javascript"), Prism.languages.markup.tag.addAttribute("on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)", "javascript")), Prism.languages.js = Prism.languages.javascript, (function(e) {
|
|
1366
|
+
e.languages.typescript = e.languages.extend("javascript", {
|
|
1367
|
+
"class-name": {
|
|
1368
|
+
pattern: /(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,
|
|
1369
|
+
lookbehind: !0,
|
|
1370
|
+
greedy: !0,
|
|
1371
|
+
inside: null
|
|
1372
|
+
},
|
|
1373
|
+
builtin: /\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/
|
|
1374
|
+
}), e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/, /\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/, /\btype\b(?=\s*(?:[\{*]|$))/), delete e.languages.typescript.parameter, delete e.languages.typescript["literal-property"];
|
|
1375
|
+
var t = e.languages.extend("typescript", {});
|
|
1376
|
+
delete t["class-name"], e.languages.typescript["class-name"].inside = t, e.languages.insertBefore("typescript", "function", {
|
|
1377
|
+
decorator: {
|
|
1378
|
+
pattern: /@[$\w\xA0-\uFFFF]+/,
|
|
1379
|
+
inside: {
|
|
1380
|
+
at: {
|
|
1381
|
+
pattern: /^@/,
|
|
1382
|
+
alias: "operator"
|
|
1383
|
+
},
|
|
1384
|
+
function: /^[\s\S]+/
|
|
1385
|
+
}
|
|
1386
|
+
},
|
|
1387
|
+
"generic-function": {
|
|
1388
|
+
pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,
|
|
1389
|
+
greedy: !0,
|
|
1390
|
+
inside: {
|
|
1391
|
+
function: /^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,
|
|
1392
|
+
generic: {
|
|
1393
|
+
pattern: /<[\s\S]+/,
|
|
1394
|
+
alias: "class-name",
|
|
1395
|
+
inside: t
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
}), e.languages.ts = e.languages.typescript;
|
|
1400
|
+
})(Prism), (function(e) {
|
|
1401
|
+
var t = e.util.clone(e.languages.javascript), n = "(?:\\s|\\/\\/.*(?!.)|\\/\\*(?:[^*]|\\*(?!\\/))\\*\\/)", r = "(?:\\{(?:\\{(?:\\{[^{}]*\\}|[^{}])*\\}|[^{}])*\\})", i = "(?:\\{<S>*\\.{3}(?:[^{}]|<BRACES>)*\\})";
|
|
1402
|
+
function a(e, t) {
|
|
1403
|
+
return e = e.replace(/<S>/g, function() {
|
|
1404
|
+
return n;
|
|
1405
|
+
}).replace(/<BRACES>/g, function() {
|
|
1406
|
+
return r;
|
|
1407
|
+
}).replace(/<SPREAD>/g, function() {
|
|
1408
|
+
return i;
|
|
1409
|
+
}), RegExp(e, t);
|
|
1410
|
+
}
|
|
1411
|
+
i = a(i).source, e.languages.jsx = e.languages.extend("markup", t), e.languages.jsx.tag.pattern = a("<\\/?(?:[\\w.:-]+(?:<S>+(?:[\\w.:$-]+(?:=(?:\"(?:\\\\[\\s\\S]|[^\\\\\"])*\"|'(?:\\\\[\\s\\S]|[^\\\\'])*'|[^\\s{'\"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\\/?)?>"), e.languages.jsx.tag.inside.tag.pattern = /^<\/?[^\s>\/]*/, e.languages.jsx.tag.inside["attr-value"].pattern = /=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/, e.languages.jsx.tag.inside.tag.inside["class-name"] = /^[A-Z]\w*(?:\.[A-Z]\w*)*$/, e.languages.jsx.tag.inside.comment = t.comment, e.languages.insertBefore("inside", "attr-name", { spread: {
|
|
1412
|
+
pattern: a("<SPREAD>"),
|
|
1413
|
+
inside: e.languages.jsx
|
|
1414
|
+
} }, e.languages.jsx.tag), e.languages.insertBefore("inside", "special-attr", { script: {
|
|
1415
|
+
pattern: a("=<BRACES>"),
|
|
1416
|
+
alias: "language-javascript",
|
|
1417
|
+
inside: {
|
|
1418
|
+
"script-punctuation": {
|
|
1419
|
+
pattern: /^=(?=\{)/,
|
|
1420
|
+
alias: "punctuation"
|
|
1421
|
+
},
|
|
1422
|
+
rest: e.languages.jsx
|
|
1423
|
+
}
|
|
1424
|
+
} }, e.languages.jsx.tag);
|
|
1425
|
+
var o = function(e) {
|
|
1426
|
+
return e ? typeof e == "string" ? e : typeof e.content == "string" ? e.content : e.content.map(o).join("") : "";
|
|
1427
|
+
}, s = function(t) {
|
|
1428
|
+
for (var n = [], r = 0; r < t.length; r++) {
|
|
1429
|
+
var i = t[r], a = !1;
|
|
1430
|
+
if (typeof i != "string" && (i.type === "tag" && i.content[0] && i.content[0].type === "tag" ? i.content[0].content[0].content === "</" ? n.length > 0 && n[n.length - 1].tagName === o(i.content[0].content[1]) && n.pop() : i.content[i.content.length - 1].content === "/>" || n.push({
|
|
1431
|
+
tagName: o(i.content[0].content[1]),
|
|
1432
|
+
openedBraces: 0
|
|
1433
|
+
}) : n.length > 0 && i.type === "punctuation" && i.content === "{" ? n[n.length - 1].openedBraces++ : n.length > 0 && n[n.length - 1].openedBraces > 0 && i.type === "punctuation" && i.content === "}" ? n[n.length - 1].openedBraces-- : a = !0), (a || typeof i == "string") && n.length > 0 && n[n.length - 1].openedBraces === 0) {
|
|
1434
|
+
var c = o(i);
|
|
1435
|
+
r < t.length - 1 && (typeof t[r + 1] == "string" || t[r + 1].type === "plain-text") && (c += o(t[r + 1]), t.splice(r + 1, 1)), r > 0 && (typeof t[r - 1] == "string" || t[r - 1].type === "plain-text") && (c = o(t[r - 1]) + c, t.splice(r - 1, 1), r--), t[r] = new e.Token("plain-text", c, null, c);
|
|
1436
|
+
}
|
|
1437
|
+
i.content && typeof i.content != "string" && s(i.content);
|
|
1438
|
+
}
|
|
1439
|
+
};
|
|
1440
|
+
e.hooks.add("after-tokenize", function(e) {
|
|
1441
|
+
e.language !== "jsx" && e.language !== "tsx" || s(e.tokens);
|
|
1442
|
+
});
|
|
1443
|
+
})(Prism), (function(e) {
|
|
1444
|
+
var t = e.util.clone(e.languages.typescript);
|
|
1445
|
+
e.languages.tsx = e.languages.extend("jsx", t), delete e.languages.tsx.parameter, delete e.languages.tsx["literal-property"];
|
|
1446
|
+
var n = e.languages.tsx.tag;
|
|
1447
|
+
n.pattern = RegExp("(^|[^\\w$]|(?=<\\/))(?:" + n.pattern.source + ")", n.pattern.flags), n.lookbehind = !0;
|
|
1448
|
+
})(Prism), (function(e) {
|
|
1449
|
+
var t = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
|
1450
|
+
e.languages.css = {
|
|
1451
|
+
comment: /\/\*[\s\S]*?\*\//,
|
|
1452
|
+
atrule: {
|
|
1453
|
+
pattern: RegExp("@[\\w-](?:[^;{\\s\"']|\\s+(?!\\s)|" + t.source + ")*?(?:;|(?=\\s*\\{))"),
|
|
1454
|
+
inside: {
|
|
1455
|
+
rule: /^@[\w-]+/,
|
|
1456
|
+
"selector-function-argument": {
|
|
1457
|
+
pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
|
|
1458
|
+
lookbehind: !0,
|
|
1459
|
+
alias: "selector"
|
|
1460
|
+
},
|
|
1461
|
+
keyword: {
|
|
1462
|
+
pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
|
|
1463
|
+
lookbehind: !0
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
},
|
|
1467
|
+
url: {
|
|
1468
|
+
pattern: RegExp("\\burl\\((?:" + t.source + "|(?:[^\\\\\\r\\n()\"']|\\\\[\\s\\S])*)\\)", "i"),
|
|
1469
|
+
greedy: !0,
|
|
1470
|
+
inside: {
|
|
1471
|
+
function: /^url/i,
|
|
1472
|
+
punctuation: /^\(|\)$/,
|
|
1473
|
+
string: {
|
|
1474
|
+
pattern: RegExp("^" + t.source + "$"),
|
|
1475
|
+
alias: "url"
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
},
|
|
1479
|
+
selector: {
|
|
1480
|
+
pattern: RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|" + t.source + ")*(?=\\s*\\{)"),
|
|
1481
|
+
lookbehind: !0
|
|
1482
|
+
},
|
|
1483
|
+
string: {
|
|
1484
|
+
pattern: t,
|
|
1485
|
+
greedy: !0
|
|
1486
|
+
},
|
|
1487
|
+
property: {
|
|
1488
|
+
pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
|
|
1489
|
+
lookbehind: !0
|
|
1490
|
+
},
|
|
1491
|
+
important: /!important\b/i,
|
|
1492
|
+
function: {
|
|
1493
|
+
pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
|
|
1494
|
+
lookbehind: !0
|
|
1495
|
+
},
|
|
1496
|
+
punctuation: /[(){};:,]/
|
|
1497
|
+
}, e.languages.css.atrule.inside.rest = e.languages.css;
|
|
1498
|
+
var n = e.languages.markup;
|
|
1499
|
+
n && (n.tag.addInlined("style", "css"), n.tag.addAttribute("style", "css"));
|
|
1500
|
+
})(Prism), Prism.languages.python = {
|
|
1501
|
+
comment: {
|
|
1502
|
+
pattern: /(^|[^\\])#.*/,
|
|
1503
|
+
lookbehind: !0,
|
|
1504
|
+
greedy: !0
|
|
1505
|
+
},
|
|
1506
|
+
"string-interpolation": {
|
|
1507
|
+
pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
|
|
1508
|
+
greedy: !0,
|
|
1509
|
+
inside: {
|
|
1510
|
+
interpolation: {
|
|
1511
|
+
pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
|
|
1512
|
+
lookbehind: !0,
|
|
1513
|
+
inside: {
|
|
1514
|
+
"format-spec": {
|
|
1515
|
+
pattern: /(:)[^:(){}]+(?=\}$)/,
|
|
1516
|
+
lookbehind: !0
|
|
1517
|
+
},
|
|
1518
|
+
"conversion-option": {
|
|
1519
|
+
pattern: //,
|
|
1520
|
+
alias: "punctuation"
|
|
1521
|
+
},
|
|
1522
|
+
rest: null
|
|
1523
|
+
}
|
|
1524
|
+
},
|
|
1525
|
+
string: /[\s\S]+/
|
|
1526
|
+
}
|
|
1527
|
+
},
|
|
1528
|
+
"triple-quoted-string": {
|
|
1529
|
+
pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
|
|
1530
|
+
greedy: !0,
|
|
1531
|
+
alias: "string"
|
|
1532
|
+
},
|
|
1533
|
+
string: {
|
|
1534
|
+
pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
|
|
1535
|
+
greedy: !0
|
|
1536
|
+
},
|
|
1537
|
+
function: {
|
|
1538
|
+
pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
|
|
1539
|
+
lookbehind: !0
|
|
1540
|
+
},
|
|
1541
|
+
"class-name": {
|
|
1542
|
+
pattern: /(\bclass\s+)\w+/i,
|
|
1543
|
+
lookbehind: !0
|
|
1544
|
+
},
|
|
1545
|
+
decorator: {
|
|
1546
|
+
pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
|
|
1547
|
+
lookbehind: !0,
|
|
1548
|
+
alias: ["annotation", "punctuation"],
|
|
1549
|
+
inside: { punctuation: /\./ }
|
|
1550
|
+
},
|
|
1551
|
+
keyword: /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
|
|
1552
|
+
builtin: /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
|
|
1553
|
+
boolean: /\b(?:False|None|True)\b/,
|
|
1554
|
+
number: /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
|
|
1555
|
+
operator: /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
|
|
1556
|
+
punctuation: /[{}[\];(),.:]/
|
|
1557
|
+
}, Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest = Prism.languages.python, Prism.languages.py = Prism.languages.python, (function(e) {
|
|
1558
|
+
var t = "\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b", n = {
|
|
1559
|
+
pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
|
|
1560
|
+
lookbehind: !0,
|
|
1561
|
+
alias: "punctuation",
|
|
1562
|
+
inside: null
|
|
1563
|
+
}, r = {
|
|
1564
|
+
bash: n,
|
|
1565
|
+
environment: {
|
|
1566
|
+
pattern: RegExp("\\$" + t),
|
|
1567
|
+
alias: "constant"
|
|
1568
|
+
},
|
|
1569
|
+
variable: [
|
|
1570
|
+
{
|
|
1571
|
+
pattern: /\$?\(\([\s\S]+?\)\)/,
|
|
1572
|
+
greedy: !0,
|
|
1573
|
+
inside: {
|
|
1574
|
+
variable: [{
|
|
1575
|
+
pattern: /(^\$\(\([\s\S]+)\)\)/,
|
|
1576
|
+
lookbehind: !0
|
|
1577
|
+
}, /^\$\(\(/],
|
|
1578
|
+
number: /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
|
|
1579
|
+
operator: /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
|
|
1580
|
+
punctuation: /\(\(?|\)\)?|,|;/
|
|
1581
|
+
}
|
|
1582
|
+
},
|
|
1583
|
+
{
|
|
1584
|
+
pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
|
|
1585
|
+
greedy: !0,
|
|
1586
|
+
inside: { variable: /^\$\(|^`|\)$|`$/ }
|
|
1587
|
+
},
|
|
1588
|
+
{
|
|
1589
|
+
pattern: /\$\{[^}]+\}/,
|
|
1590
|
+
greedy: !0,
|
|
1591
|
+
inside: {
|
|
1592
|
+
operator: /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
|
|
1593
|
+
punctuation: /[\[\]]/,
|
|
1594
|
+
environment: {
|
|
1595
|
+
pattern: RegExp("(\\{)" + t),
|
|
1596
|
+
lookbehind: !0,
|
|
1597
|
+
alias: "constant"
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
},
|
|
1601
|
+
/\$(?:\w+|[#?*!@$])/
|
|
1602
|
+
],
|
|
1603
|
+
entity: /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/
|
|
1604
|
+
};
|
|
1605
|
+
e.languages.bash = {
|
|
1606
|
+
shebang: {
|
|
1607
|
+
pattern: /^#!\s*\/.*/,
|
|
1608
|
+
alias: "important"
|
|
1609
|
+
},
|
|
1610
|
+
comment: {
|
|
1611
|
+
pattern: /(^|[^"{\\$])#.*/,
|
|
1612
|
+
lookbehind: !0
|
|
1613
|
+
},
|
|
1614
|
+
"function-name": [{
|
|
1615
|
+
pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
|
|
1616
|
+
lookbehind: !0,
|
|
1617
|
+
alias: "function"
|
|
1618
|
+
}, {
|
|
1619
|
+
pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
|
|
1620
|
+
alias: "function"
|
|
1621
|
+
}],
|
|
1622
|
+
"for-or-select": {
|
|
1623
|
+
pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
|
|
1624
|
+
alias: "variable",
|
|
1625
|
+
lookbehind: !0
|
|
1626
|
+
},
|
|
1627
|
+
"assign-left": {
|
|
1628
|
+
pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
|
|
1629
|
+
inside: { environment: {
|
|
1630
|
+
pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + t),
|
|
1631
|
+
lookbehind: !0,
|
|
1632
|
+
alias: "constant"
|
|
1633
|
+
} },
|
|
1634
|
+
alias: "variable",
|
|
1635
|
+
lookbehind: !0
|
|
1636
|
+
},
|
|
1637
|
+
parameter: {
|
|
1638
|
+
pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,
|
|
1639
|
+
alias: "variable",
|
|
1640
|
+
lookbehind: !0
|
|
1641
|
+
},
|
|
1642
|
+
string: [
|
|
1643
|
+
{
|
|
1644
|
+
pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
|
|
1645
|
+
lookbehind: !0,
|
|
1646
|
+
greedy: !0,
|
|
1647
|
+
inside: r
|
|
1648
|
+
},
|
|
1649
|
+
{
|
|
1650
|
+
pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
|
|
1651
|
+
lookbehind: !0,
|
|
1652
|
+
greedy: !0,
|
|
1653
|
+
inside: { bash: n }
|
|
1654
|
+
},
|
|
1655
|
+
{
|
|
1656
|
+
pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
|
|
1657
|
+
lookbehind: !0,
|
|
1658
|
+
greedy: !0,
|
|
1659
|
+
inside: r
|
|
1660
|
+
},
|
|
1661
|
+
{
|
|
1662
|
+
pattern: /(^|[^$\\])'[^']*'/,
|
|
1663
|
+
lookbehind: !0,
|
|
1664
|
+
greedy: !0
|
|
1665
|
+
},
|
|
1666
|
+
{
|
|
1667
|
+
pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
|
|
1668
|
+
greedy: !0,
|
|
1669
|
+
inside: { entity: r.entity }
|
|
1670
|
+
}
|
|
1671
|
+
],
|
|
1672
|
+
environment: {
|
|
1673
|
+
pattern: RegExp("\\$?" + t),
|
|
1674
|
+
alias: "constant"
|
|
1675
|
+
},
|
|
1676
|
+
variable: r.variable,
|
|
1677
|
+
function: {
|
|
1678
|
+
pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
|
|
1679
|
+
lookbehind: !0
|
|
1680
|
+
},
|
|
1681
|
+
keyword: {
|
|
1682
|
+
pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
|
|
1683
|
+
lookbehind: !0
|
|
1684
|
+
},
|
|
1685
|
+
builtin: {
|
|
1686
|
+
pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,
|
|
1687
|
+
lookbehind: !0,
|
|
1688
|
+
alias: "class-name"
|
|
1689
|
+
},
|
|
1690
|
+
boolean: {
|
|
1691
|
+
pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
|
|
1692
|
+
lookbehind: !0
|
|
1693
|
+
},
|
|
1694
|
+
"file-descriptor": {
|
|
1695
|
+
pattern: /\B&\d\b/,
|
|
1696
|
+
alias: "important"
|
|
1697
|
+
},
|
|
1698
|
+
operator: {
|
|
1699
|
+
pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
|
|
1700
|
+
inside: { "file-descriptor": {
|
|
1701
|
+
pattern: /^\d/,
|
|
1702
|
+
alias: "important"
|
|
1703
|
+
} }
|
|
1704
|
+
},
|
|
1705
|
+
punctuation: /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
|
|
1706
|
+
number: {
|
|
1707
|
+
pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
|
|
1708
|
+
lookbehind: !0
|
|
1709
|
+
}
|
|
1710
|
+
}, n.inside = e.languages.bash;
|
|
1711
|
+
for (var i = [
|
|
1712
|
+
"comment",
|
|
1713
|
+
"function-name",
|
|
1714
|
+
"for-or-select",
|
|
1715
|
+
"assign-left",
|
|
1716
|
+
"parameter",
|
|
1717
|
+
"string",
|
|
1718
|
+
"environment",
|
|
1719
|
+
"function",
|
|
1720
|
+
"keyword",
|
|
1721
|
+
"builtin",
|
|
1722
|
+
"boolean",
|
|
1723
|
+
"file-descriptor",
|
|
1724
|
+
"operator",
|
|
1725
|
+
"punctuation",
|
|
1726
|
+
"number"
|
|
1727
|
+
], a = r.variable[1].inside, o = 0; o < i.length; o++) a[i[o]] = e.languages.bash[i[o]];
|
|
1728
|
+
e.languages.sh = e.languages.bash, e.languages.shell = e.languages.bash;
|
|
1729
|
+
})(Prism), Prism.languages.json = {
|
|
1730
|
+
property: {
|
|
1731
|
+
pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
|
|
1732
|
+
lookbehind: !0,
|
|
1733
|
+
greedy: !0
|
|
1734
|
+
},
|
|
1735
|
+
string: {
|
|
1736
|
+
pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
|
|
1737
|
+
lookbehind: !0,
|
|
1738
|
+
greedy: !0
|
|
1739
|
+
},
|
|
1740
|
+
comment: {
|
|
1741
|
+
pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
|
|
1742
|
+
greedy: !0
|
|
1743
|
+
},
|
|
1744
|
+
number: /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
|
|
1745
|
+
punctuation: /[{}[\],]/,
|
|
1746
|
+
operator: /:/,
|
|
1747
|
+
boolean: /\b(?:false|true)\b/,
|
|
1748
|
+
null: {
|
|
1749
|
+
pattern: /\bnull\b/,
|
|
1750
|
+
alias: "keyword"
|
|
1751
|
+
}
|
|
1752
|
+
}, Prism.languages.webmanifest = Prism.languages.json, (function(e) {
|
|
1753
|
+
var t = "(?:\\\\.|[^\\\\\\n\\r]|(?:\\n|\\r\\n?)(?![\\r\\n]))";
|
|
1754
|
+
function n(e) {
|
|
1755
|
+
return e = e.replace(/<inner>/g, function() {
|
|
1756
|
+
return t;
|
|
1757
|
+
}), RegExp("((?:^|[^\\\\])(?:\\\\{2})*)(?:" + e + ")");
|
|
1758
|
+
}
|
|
1759
|
+
var r = "(?:\\\\.|``(?:[^`\\r\\n]|`(?!`))+``|`[^`\\r\\n]+`|[^\\\\|\\r\\n`])+", i = "\\|?__(?:\\|__)+\\|?(?:(?:\\n|\\r\\n?)|(?![\\s\\S]))".replace(/__/g, function() {
|
|
1760
|
+
return r;
|
|
1761
|
+
}), a = "\\|?[ \\t]*:?-{3,}:?[ \\t]*(?:\\|[ \\t]*:?-{3,}:?[ \\t]*)+\\|?(?:\\n|\\r\\n?)";
|
|
1762
|
+
e.languages.markdown = e.languages.extend("markup", {}), e.languages.insertBefore("markdown", "prolog", {
|
|
1763
|
+
"front-matter-block": {
|
|
1764
|
+
pattern: /(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,
|
|
1765
|
+
lookbehind: !0,
|
|
1766
|
+
greedy: !0,
|
|
1767
|
+
inside: {
|
|
1768
|
+
punctuation: /^---|---$/,
|
|
1769
|
+
"front-matter": {
|
|
1770
|
+
pattern: /\S+(?:\s+\S+)*/,
|
|
1771
|
+
alias: ["yaml", "language-yaml"],
|
|
1772
|
+
inside: e.languages.yaml
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
},
|
|
1776
|
+
blockquote: {
|
|
1777
|
+
pattern: /^>(?:[\t ]*>)*/m,
|
|
1778
|
+
alias: "punctuation"
|
|
1779
|
+
},
|
|
1780
|
+
table: {
|
|
1781
|
+
pattern: RegExp("^" + i + a + "(?:" + i + ")*", "m"),
|
|
1782
|
+
inside: {
|
|
1783
|
+
"table-data-rows": {
|
|
1784
|
+
pattern: RegExp("^(" + i + a + ")(?:" + i + ")*$"),
|
|
1785
|
+
lookbehind: !0,
|
|
1786
|
+
inside: {
|
|
1787
|
+
"table-data": {
|
|
1788
|
+
pattern: RegExp(r),
|
|
1789
|
+
inside: e.languages.markdown
|
|
1790
|
+
},
|
|
1791
|
+
punctuation: /\|/
|
|
1792
|
+
}
|
|
1793
|
+
},
|
|
1794
|
+
"table-line": {
|
|
1795
|
+
pattern: RegExp("^(" + i + ")" + a + "$"),
|
|
1796
|
+
lookbehind: !0,
|
|
1797
|
+
inside: { punctuation: /\||:?-{3,}:?/ }
|
|
1798
|
+
},
|
|
1799
|
+
"table-header-row": {
|
|
1800
|
+
pattern: RegExp("^" + i + "$"),
|
|
1801
|
+
inside: {
|
|
1802
|
+
"table-header": {
|
|
1803
|
+
pattern: RegExp(r),
|
|
1804
|
+
alias: "important",
|
|
1805
|
+
inside: e.languages.markdown
|
|
1806
|
+
},
|
|
1807
|
+
punctuation: /\|/
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
},
|
|
1812
|
+
code: [{
|
|
1813
|
+
pattern: /((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,
|
|
1814
|
+
lookbehind: !0,
|
|
1815
|
+
alias: "keyword"
|
|
1816
|
+
}, {
|
|
1817
|
+
pattern: /^```[\s\S]*?^```$/m,
|
|
1818
|
+
greedy: !0,
|
|
1819
|
+
inside: {
|
|
1820
|
+
"code-block": {
|
|
1821
|
+
pattern: /^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,
|
|
1822
|
+
lookbehind: !0
|
|
1823
|
+
},
|
|
1824
|
+
"code-language": {
|
|
1825
|
+
pattern: /^(```).+/,
|
|
1826
|
+
lookbehind: !0
|
|
1827
|
+
},
|
|
1828
|
+
punctuation: /```/
|
|
1829
|
+
}
|
|
1830
|
+
}],
|
|
1831
|
+
title: [{
|
|
1832
|
+
pattern: /\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,
|
|
1833
|
+
alias: "important",
|
|
1834
|
+
inside: { punctuation: /==+$|--+$/ }
|
|
1835
|
+
}, {
|
|
1836
|
+
pattern: /(^\s*)#.+/m,
|
|
1837
|
+
lookbehind: !0,
|
|
1838
|
+
alias: "important",
|
|
1839
|
+
inside: { punctuation: /^#+|#+$/ }
|
|
1840
|
+
}],
|
|
1841
|
+
hr: {
|
|
1842
|
+
pattern: /(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,
|
|
1843
|
+
lookbehind: !0,
|
|
1844
|
+
alias: "punctuation"
|
|
1845
|
+
},
|
|
1846
|
+
list: {
|
|
1847
|
+
pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,
|
|
1848
|
+
lookbehind: !0,
|
|
1849
|
+
alias: "punctuation"
|
|
1850
|
+
},
|
|
1851
|
+
"url-reference": {
|
|
1852
|
+
pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,
|
|
1853
|
+
inside: {
|
|
1854
|
+
variable: {
|
|
1855
|
+
pattern: /^(!?\[)[^\]]+/,
|
|
1856
|
+
lookbehind: !0
|
|
1857
|
+
},
|
|
1858
|
+
string: /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,
|
|
1859
|
+
punctuation: /^[\[\]!:]|[<>]/
|
|
1860
|
+
},
|
|
1861
|
+
alias: "url"
|
|
1862
|
+
},
|
|
1863
|
+
bold: {
|
|
1864
|
+
pattern: n("\\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\\b|\\*\\*(?:(?!\\*)<inner>|\\*(?:(?!\\*)<inner>)+\\*)+\\*\\*"),
|
|
1865
|
+
lookbehind: !0,
|
|
1866
|
+
greedy: !0,
|
|
1867
|
+
inside: {
|
|
1868
|
+
content: {
|
|
1869
|
+
pattern: /(^..)[\s\S]+(?=..$)/,
|
|
1870
|
+
lookbehind: !0,
|
|
1871
|
+
inside: {}
|
|
1872
|
+
},
|
|
1873
|
+
punctuation: /\*\*|__/
|
|
1874
|
+
}
|
|
1875
|
+
},
|
|
1876
|
+
italic: {
|
|
1877
|
+
pattern: n("\\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\\b|\\*(?:(?!\\*)<inner>|\\*\\*(?:(?!\\*)<inner>)+\\*\\*)+\\*"),
|
|
1878
|
+
lookbehind: !0,
|
|
1879
|
+
greedy: !0,
|
|
1880
|
+
inside: {
|
|
1881
|
+
content: {
|
|
1882
|
+
pattern: /(^.)[\s\S]+(?=.$)/,
|
|
1883
|
+
lookbehind: !0,
|
|
1884
|
+
inside: {}
|
|
1885
|
+
},
|
|
1886
|
+
punctuation: /[*_]/
|
|
1887
|
+
}
|
|
1888
|
+
},
|
|
1889
|
+
strike: {
|
|
1890
|
+
pattern: n("(~~?)(?:(?!~)<inner>)+\\2"),
|
|
1891
|
+
lookbehind: !0,
|
|
1892
|
+
greedy: !0,
|
|
1893
|
+
inside: {
|
|
1894
|
+
content: {
|
|
1895
|
+
pattern: /(^~~?)[\s\S]+(?=\1$)/,
|
|
1896
|
+
lookbehind: !0,
|
|
1897
|
+
inside: {}
|
|
1898
|
+
},
|
|
1899
|
+
punctuation: /~~?/
|
|
1900
|
+
}
|
|
1901
|
+
},
|
|
1902
|
+
"code-snippet": {
|
|
1903
|
+
pattern: /(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,
|
|
1904
|
+
lookbehind: !0,
|
|
1905
|
+
greedy: !0,
|
|
1906
|
+
alias: ["code", "keyword"]
|
|
1907
|
+
},
|
|
1908
|
+
url: {
|
|
1909
|
+
pattern: n("!?\\[(?:(?!\\])<inner>)+\\](?:\\([^\\s)]+(?:[\\t ]+\"(?:\\\\.|[^\"\\\\])*\")?\\)|[ \\t]?\\[(?:(?!\\])<inner>)+\\])"),
|
|
1910
|
+
lookbehind: !0,
|
|
1911
|
+
greedy: !0,
|
|
1912
|
+
inside: {
|
|
1913
|
+
operator: /^!/,
|
|
1914
|
+
content: {
|
|
1915
|
+
pattern: /(^\[)[^\]]+(?=\])/,
|
|
1916
|
+
lookbehind: !0,
|
|
1917
|
+
inside: {}
|
|
1918
|
+
},
|
|
1919
|
+
variable: {
|
|
1920
|
+
pattern: /(^\][ \t]?\[)[^\]]+(?=\]$)/,
|
|
1921
|
+
lookbehind: !0
|
|
1922
|
+
},
|
|
1923
|
+
url: {
|
|
1924
|
+
pattern: /(^\]\()[^\s)]+/,
|
|
1925
|
+
lookbehind: !0
|
|
1926
|
+
},
|
|
1927
|
+
string: {
|
|
1928
|
+
pattern: /(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,
|
|
1929
|
+
lookbehind: !0
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
}), [
|
|
1934
|
+
"url",
|
|
1935
|
+
"bold",
|
|
1936
|
+
"italic",
|
|
1937
|
+
"strike"
|
|
1938
|
+
].forEach(function(t) {
|
|
1939
|
+
[
|
|
1940
|
+
"url",
|
|
1941
|
+
"bold",
|
|
1942
|
+
"italic",
|
|
1943
|
+
"strike",
|
|
1944
|
+
"code-snippet"
|
|
1945
|
+
].forEach(function(n) {
|
|
1946
|
+
t !== n && (e.languages.markdown[t].inside.content.inside[n] = e.languages.markdown[n]);
|
|
1947
|
+
});
|
|
1948
|
+
}), e.hooks.add("after-tokenize", function(e) {
|
|
1949
|
+
if (e.language !== "markdown" && e.language !== "md") return;
|
|
1950
|
+
function t(e) {
|
|
1951
|
+
if (!(!e || typeof e == "string")) for (var n = 0, r = e.length; n < r; n++) {
|
|
1952
|
+
var i = e[n];
|
|
1953
|
+
if (i.type !== "code") {
|
|
1954
|
+
t(i.content);
|
|
1955
|
+
continue;
|
|
1956
|
+
}
|
|
1957
|
+
var a = i.content[1], o = i.content[3];
|
|
1958
|
+
if (a && o && a.type === "code-language" && o.type === "code-block" && typeof a.content == "string") {
|
|
1959
|
+
var s = a.content.replace(/\b#/g, "sharp").replace(/\b\+\+/g, "pp");
|
|
1960
|
+
s = (/[a-z][\w-]*/i.exec(s) || [""])[0].toLowerCase();
|
|
1961
|
+
var c = "language-" + s;
|
|
1962
|
+
o.alias ? typeof o.alias == "string" ? o.alias = [o.alias, c] : o.alias.push(c) : o.alias = [c];
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
t(e.tokens);
|
|
1967
|
+
}), e.hooks.add("wrap", function(t) {
|
|
1968
|
+
if (t.type === "code-block") {
|
|
1969
|
+
for (var n = "", r = 0, i = t.classes.length; r < i; r++) {
|
|
1970
|
+
var a = t.classes[r], o = /language-(.+)/.exec(a);
|
|
1971
|
+
if (o) {
|
|
1972
|
+
n = o[1];
|
|
1973
|
+
break;
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
var s = e.languages[n];
|
|
1977
|
+
if (s) t.content = e.highlight(l(t.content), s, n);
|
|
1978
|
+
else if (n && n !== "none" && e.plugins.autoloader) {
|
|
1979
|
+
var c = "md-" + (/* @__PURE__ */ new Date()).valueOf() + "-" + Math.floor(Math.random() * 0x2386f26fc10000);
|
|
1980
|
+
t.attributes.id = c, e.plugins.autoloader.loadLanguages(n, function() {
|
|
1981
|
+
var t = document.getElementById(c);
|
|
1982
|
+
t && (t.innerHTML = e.highlight(t.textContent, e.languages[n], n));
|
|
1983
|
+
});
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
});
|
|
1987
|
+
var o = RegExp(e.languages.markup.tag.pattern.source, "gi"), s = {
|
|
1988
|
+
amp: "&",
|
|
1989
|
+
lt: "<",
|
|
1990
|
+
gt: ">",
|
|
1991
|
+
quot: "\""
|
|
1992
|
+
}, c = String.fromCodePoint || String.fromCharCode;
|
|
1993
|
+
function l(e) {
|
|
1994
|
+
var t = e.replace(o, "");
|
|
1995
|
+
return t = t.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi, function(e, t) {
|
|
1996
|
+
return t = t.toLowerCase(), t[0] === "#" ? c(t[1] === "x" ? parseInt(t.slice(2), 16) : Number(t.slice(1))) : s[t] || e;
|
|
1997
|
+
}), t;
|
|
1998
|
+
}
|
|
1999
|
+
e.languages.md = e.languages.markdown;
|
|
2000
|
+
})(Prism), (function(e) {
|
|
2001
|
+
var t = /[*&][^\s[\]{},]+/, n = /!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/, r = "(?:" + n.source + "(?:[ ]+" + t.source + ")?|" + t.source + "(?:[ ]+" + n.source + ")?)", i = "(?:[^\\s\\x00-\\x08\\x0e-\\x1f!\"#%&'*,\\-:>?@[\\]`{|}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]|[?:-]<PLAIN>)(?:[ \\t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*".replace(/<PLAIN>/g, function() {
|
|
2002
|
+
return "[^\\s\\x00-\\x08\\x0e-\\x1f,[\\]{}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]";
|
|
2003
|
+
}), a = "\"(?:[^\"\\\\\\r\\n]|\\\\.)*\"|'(?:[^'\\\\\\r\\n]|\\\\.)*'";
|
|
2004
|
+
function o(e, t) {
|
|
2005
|
+
t = (t || "").replace(/m/g, "") + "m";
|
|
2006
|
+
var n = "([:\\-,[{]\\s*(?:\\s<<prop>>[ \\t]+)?)(?:<<value>>)(?=[ \\t]*(?:$|,|\\]|\\}|(?:[\\r\\n]\\s*)?#))".replace(/<<prop>>/g, function() {
|
|
2007
|
+
return r;
|
|
2008
|
+
}).replace(/<<value>>/g, function() {
|
|
2009
|
+
return e;
|
|
2010
|
+
});
|
|
2011
|
+
return RegExp(n, t);
|
|
2012
|
+
}
|
|
2013
|
+
e.languages.yaml = {
|
|
2014
|
+
scalar: {
|
|
2015
|
+
pattern: RegExp("([\\-:]\\s*(?:\\s<<prop>>[ \\t]+)?[|>])[ \\t]*(?:((?:\\r?\\n|\\r)[ \\t]+)\\S[^\\r\\n]*(?:\\2[^\\r\\n]+)*)".replace(/<<prop>>/g, function() {
|
|
2016
|
+
return r;
|
|
2017
|
+
})),
|
|
2018
|
+
lookbehind: !0,
|
|
2019
|
+
alias: "string"
|
|
2020
|
+
},
|
|
2021
|
+
comment: /#.*/,
|
|
2022
|
+
key: {
|
|
2023
|
+
pattern: RegExp("((?:^|[:\\-,[{\\r\\n?])[ \\t]*(?:<<prop>>[ \\t]+)?)<<key>>(?=\\s*:\\s)".replace(/<<prop>>/g, function() {
|
|
2024
|
+
return r;
|
|
2025
|
+
}).replace(/<<key>>/g, function() {
|
|
2026
|
+
return "(?:" + i + "|" + a + ")";
|
|
2027
|
+
})),
|
|
2028
|
+
lookbehind: !0,
|
|
2029
|
+
greedy: !0,
|
|
2030
|
+
alias: "atrule"
|
|
2031
|
+
},
|
|
2032
|
+
directive: {
|
|
2033
|
+
pattern: /(^[ \t]*)%.+/m,
|
|
2034
|
+
lookbehind: !0,
|
|
2035
|
+
alias: "important"
|
|
2036
|
+
},
|
|
2037
|
+
datetime: {
|
|
2038
|
+
pattern: o("\\d{4}-\\d\\d?-\\d\\d?(?:[tT]|[ \\t]+)\\d\\d?:\\d{2}:\\d{2}(?:\\.\\d*)?(?:[ \\t]*(?:Z|[-+]\\d\\d?(?::\\d{2})?))?|\\d{4}-\\d{2}-\\d{2}|\\d\\d?:\\d{2}(?::\\d{2}(?:\\.\\d*)?)?"),
|
|
2039
|
+
lookbehind: !0,
|
|
2040
|
+
alias: "number"
|
|
2041
|
+
},
|
|
2042
|
+
boolean: {
|
|
2043
|
+
pattern: o("false|true", "i"),
|
|
2044
|
+
lookbehind: !0,
|
|
2045
|
+
alias: "important"
|
|
2046
|
+
},
|
|
2047
|
+
null: {
|
|
2048
|
+
pattern: o("null|~", "i"),
|
|
2049
|
+
lookbehind: !0,
|
|
2050
|
+
alias: "important"
|
|
2051
|
+
},
|
|
2052
|
+
string: {
|
|
2053
|
+
pattern: o(a),
|
|
2054
|
+
lookbehind: !0,
|
|
2055
|
+
greedy: !0
|
|
2056
|
+
},
|
|
2057
|
+
number: {
|
|
2058
|
+
pattern: o("[+-]?(?:0x[\\da-f]+|0o[0-7]+|(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?|\\.inf|\\.nan)", "i"),
|
|
2059
|
+
lookbehind: !0
|
|
2060
|
+
},
|
|
2061
|
+
tag: n,
|
|
2062
|
+
important: t,
|
|
2063
|
+
punctuation: /---|[:[\]{}\-,|>?]|\.\.\./
|
|
2064
|
+
}, e.languages.yml = e.languages.yaml;
|
|
2065
|
+
})(Prism), Prism.languages.sql = {
|
|
2066
|
+
comment: {
|
|
2067
|
+
pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
|
|
2068
|
+
lookbehind: !0
|
|
2069
|
+
},
|
|
2070
|
+
variable: [{
|
|
2071
|
+
pattern: /@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,
|
|
2072
|
+
greedy: !0
|
|
2073
|
+
}, /@[\w.$]+/],
|
|
2074
|
+
string: {
|
|
2075
|
+
pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,
|
|
2076
|
+
greedy: !0,
|
|
2077
|
+
lookbehind: !0
|
|
2078
|
+
},
|
|
2079
|
+
identifier: {
|
|
2080
|
+
pattern: /(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,
|
|
2081
|
+
greedy: !0,
|
|
2082
|
+
lookbehind: !0,
|
|
2083
|
+
inside: { punctuation: /^`|`$/ }
|
|
2084
|
+
},
|
|
2085
|
+
function: /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,
|
|
2086
|
+
keyword: /\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,
|
|
2087
|
+
boolean: /\b(?:FALSE|NULL|TRUE)\b/i,
|
|
2088
|
+
number: /\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,
|
|
2089
|
+
operator: /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,
|
|
2090
|
+
punctuation: /[;[\]()`,.]/
|
|
2091
|
+
}, (function(e) {
|
|
2092
|
+
for (var t = "\\/\\*(?:[^*/]|\\*(?!\\/)|\\/(?!\\*)|<self>)*\\*\\/", n = 0; n < 2; n++) t = t.replace(/<self>/g, function() {
|
|
2093
|
+
return t;
|
|
2094
|
+
});
|
|
2095
|
+
t = t.replace(/<self>/g, function() {
|
|
2096
|
+
return "[^\\s\\S]";
|
|
2097
|
+
}), e.languages.rust = {
|
|
2098
|
+
comment: [{
|
|
2099
|
+
pattern: RegExp("(^|[^\\\\])" + t),
|
|
2100
|
+
lookbehind: !0,
|
|
2101
|
+
greedy: !0
|
|
2102
|
+
}, {
|
|
2103
|
+
pattern: /(^|[^\\:])\/\/.*/,
|
|
2104
|
+
lookbehind: !0,
|
|
2105
|
+
greedy: !0
|
|
2106
|
+
}],
|
|
2107
|
+
string: {
|
|
2108
|
+
pattern: /b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,
|
|
2109
|
+
greedy: !0
|
|
2110
|
+
},
|
|
2111
|
+
char: {
|
|
2112
|
+
pattern: /b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,
|
|
2113
|
+
greedy: !0
|
|
2114
|
+
},
|
|
2115
|
+
attribute: {
|
|
2116
|
+
pattern: /#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,
|
|
2117
|
+
greedy: !0,
|
|
2118
|
+
alias: "attr-name",
|
|
2119
|
+
inside: { string: null }
|
|
2120
|
+
},
|
|
2121
|
+
"closure-params": {
|
|
2122
|
+
pattern: /([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,
|
|
2123
|
+
lookbehind: !0,
|
|
2124
|
+
greedy: !0,
|
|
2125
|
+
inside: {
|
|
2126
|
+
"closure-punctuation": {
|
|
2127
|
+
pattern: /^\||\|$/,
|
|
2128
|
+
alias: "punctuation"
|
|
2129
|
+
},
|
|
2130
|
+
rest: null
|
|
2131
|
+
}
|
|
2132
|
+
},
|
|
2133
|
+
"lifetime-annotation": {
|
|
2134
|
+
pattern: /'\w+/,
|
|
2135
|
+
alias: "symbol"
|
|
2136
|
+
},
|
|
2137
|
+
"fragment-specifier": {
|
|
2138
|
+
pattern: /(\$\w+:)[a-z]+/,
|
|
2139
|
+
lookbehind: !0,
|
|
2140
|
+
alias: "punctuation"
|
|
2141
|
+
},
|
|
2142
|
+
variable: /\$\w+/,
|
|
2143
|
+
"function-definition": {
|
|
2144
|
+
pattern: /(\bfn\s+)\w+/,
|
|
2145
|
+
lookbehind: !0,
|
|
2146
|
+
alias: "function"
|
|
2147
|
+
},
|
|
2148
|
+
"type-definition": {
|
|
2149
|
+
pattern: /(\b(?:enum|struct|trait|type|union)\s+)\w+/,
|
|
2150
|
+
lookbehind: !0,
|
|
2151
|
+
alias: "class-name"
|
|
2152
|
+
},
|
|
2153
|
+
"module-declaration": [{
|
|
2154
|
+
pattern: /(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,
|
|
2155
|
+
lookbehind: !0,
|
|
2156
|
+
alias: "namespace"
|
|
2157
|
+
}, {
|
|
2158
|
+
pattern: /(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,
|
|
2159
|
+
lookbehind: !0,
|
|
2160
|
+
alias: "namespace",
|
|
2161
|
+
inside: { punctuation: /::/ }
|
|
2162
|
+
}],
|
|
2163
|
+
keyword: [/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/, /\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],
|
|
2164
|
+
function: /\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,
|
|
2165
|
+
macro: {
|
|
2166
|
+
pattern: /\b\w+!/,
|
|
2167
|
+
alias: "property"
|
|
2168
|
+
},
|
|
2169
|
+
constant: /\b[A-Z_][A-Z_\d]+\b/,
|
|
2170
|
+
"class-name": /\b[A-Z]\w*\b/,
|
|
2171
|
+
namespace: {
|
|
2172
|
+
pattern: /(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,
|
|
2173
|
+
inside: { punctuation: /::/ }
|
|
2174
|
+
},
|
|
2175
|
+
number: /\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,
|
|
2176
|
+
boolean: /\b(?:false|true)\b/,
|
|
2177
|
+
punctuation: /->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,
|
|
2178
|
+
operator: /[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/
|
|
2179
|
+
}, e.languages.rust["closure-params"].inside.rest = e.languages.rust, e.languages.rust.attribute.inside.string = e.languages.rust.string;
|
|
2180
|
+
})(Prism), Prism.languages.go = Prism.languages.extend("clike", {
|
|
2181
|
+
string: {
|
|
2182
|
+
pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,
|
|
2183
|
+
lookbehind: !0,
|
|
2184
|
+
greedy: !0
|
|
2185
|
+
},
|
|
2186
|
+
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/,
|
|
2187
|
+
boolean: /\b(?:_|false|iota|nil|true)\b/,
|
|
2188
|
+
number: [
|
|
2189
|
+
/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,
|
|
2190
|
+
/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,
|
|
2191
|
+
/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i
|
|
2192
|
+
],
|
|
2193
|
+
operator: /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
|
|
2194
|
+
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/
|
|
2195
|
+
}), Prism.languages.insertBefore("go", "string", { char: {
|
|
2196
|
+
pattern: /'(?:\\.|[^'\\\r\n]){0,10}'/,
|
|
2197
|
+
greedy: !0
|
|
2198
|
+
} }), delete Prism.languages.go["class-name"], (function(e) {
|
|
2199
|
+
var t = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/, n = "(?:[a-z]\\w*\\s*\\.\\s*)*(?:[A-Z]\\w*\\s*\\.\\s*)*", r = {
|
|
2200
|
+
pattern: RegExp("(^|[^\\w.])" + n + "[A-Z](?:[\\d_A-Z]*[a-z]\\w*)?\\b"),
|
|
2201
|
+
lookbehind: !0,
|
|
2202
|
+
inside: {
|
|
2203
|
+
namespace: {
|
|
2204
|
+
pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
|
|
2205
|
+
inside: { punctuation: /\./ }
|
|
2206
|
+
},
|
|
2207
|
+
punctuation: /\./
|
|
2208
|
+
}
|
|
2209
|
+
};
|
|
2210
|
+
e.languages.java = e.languages.extend("clike", {
|
|
2211
|
+
string: {
|
|
2212
|
+
pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,
|
|
2213
|
+
lookbehind: !0,
|
|
2214
|
+
greedy: !0
|
|
2215
|
+
},
|
|
2216
|
+
"class-name": [
|
|
2217
|
+
r,
|
|
2218
|
+
{
|
|
2219
|
+
pattern: RegExp("(^|[^\\w.])" + n + "[A-Z]\\w*(?=\\s+\\w+\\s*[;,=()]|\\s*(?:\\[[\\s,]*\\]\\s*)?::\\s*new\\b)"),
|
|
2220
|
+
lookbehind: !0,
|
|
2221
|
+
inside: r.inside
|
|
2222
|
+
},
|
|
2223
|
+
{
|
|
2224
|
+
pattern: RegExp("(\\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\\s+)" + n + "[A-Z]\\w*\\b"),
|
|
2225
|
+
lookbehind: !0,
|
|
2226
|
+
inside: r.inside
|
|
2227
|
+
}
|
|
2228
|
+
],
|
|
2229
|
+
keyword: t,
|
|
2230
|
+
function: [e.languages.clike.function, {
|
|
2231
|
+
pattern: /(::\s*)[a-z_]\w*/,
|
|
2232
|
+
lookbehind: !0
|
|
2233
|
+
}],
|
|
2234
|
+
number: /\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,
|
|
2235
|
+
operator: {
|
|
2236
|
+
pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,
|
|
2237
|
+
lookbehind: !0
|
|
2238
|
+
},
|
|
2239
|
+
constant: /\b[A-Z][A-Z_\d]+\b/
|
|
2240
|
+
}), e.languages.insertBefore("java", "string", {
|
|
2241
|
+
"triple-quoted-string": {
|
|
2242
|
+
pattern: /"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,
|
|
2243
|
+
greedy: !0,
|
|
2244
|
+
alias: "string"
|
|
2245
|
+
},
|
|
2246
|
+
char: {
|
|
2247
|
+
pattern: /'(?:\\.|[^'\\\r\n]){1,6}'/,
|
|
2248
|
+
greedy: !0
|
|
2249
|
+
}
|
|
2250
|
+
}), e.languages.insertBefore("java", "class-name", {
|
|
2251
|
+
annotation: {
|
|
2252
|
+
pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/,
|
|
2253
|
+
lookbehind: !0,
|
|
2254
|
+
alias: "punctuation"
|
|
2255
|
+
},
|
|
2256
|
+
generics: {
|
|
2257
|
+
pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,
|
|
2258
|
+
inside: {
|
|
2259
|
+
"class-name": r,
|
|
2260
|
+
keyword: t,
|
|
2261
|
+
punctuation: /[<>(),.:]/,
|
|
2262
|
+
operator: /[?&|]/
|
|
2263
|
+
}
|
|
2264
|
+
},
|
|
2265
|
+
import: [{
|
|
2266
|
+
pattern: RegExp("(\\bimport\\s+)" + n + "(?:[A-Z]\\w*|\\*)(?=\\s*;)"),
|
|
2267
|
+
lookbehind: !0,
|
|
2268
|
+
inside: {
|
|
2269
|
+
namespace: r.inside.namespace,
|
|
2270
|
+
punctuation: /\./,
|
|
2271
|
+
operator: /\*/,
|
|
2272
|
+
"class-name": /\w+/
|
|
2273
|
+
}
|
|
2274
|
+
}, {
|
|
2275
|
+
pattern: RegExp("(\\bimport\\s+static\\s+)" + n + "(?:\\w+|\\*)(?=\\s*;)"),
|
|
2276
|
+
lookbehind: !0,
|
|
2277
|
+
alias: "static",
|
|
2278
|
+
inside: {
|
|
2279
|
+
namespace: r.inside.namespace,
|
|
2280
|
+
static: /\b\w+$/,
|
|
2281
|
+
punctuation: /\./,
|
|
2282
|
+
operator: /\*/,
|
|
2283
|
+
"class-name": /\w+/
|
|
2284
|
+
}
|
|
2285
|
+
}],
|
|
2286
|
+
namespace: {
|
|
2287
|
+
pattern: RegExp("(\\b(?:exports|import(?:\\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\\s+)(?!<keyword>)[a-z]\\w*(?:\\.[a-z]\\w*)*\\.?".replace(/<keyword>/g, function() {
|
|
2288
|
+
return t.source;
|
|
2289
|
+
})),
|
|
2290
|
+
lookbehind: !0,
|
|
2291
|
+
inside: { punctuation: /\./ }
|
|
2292
|
+
}
|
|
2293
|
+
});
|
|
2294
|
+
})(Prism), Prism.languages.c = Prism.languages.extend("clike", {
|
|
2295
|
+
comment: {
|
|
2296
|
+
pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,
|
|
2297
|
+
greedy: !0
|
|
2298
|
+
},
|
|
2299
|
+
string: {
|
|
2300
|
+
pattern: /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
|
|
2301
|
+
greedy: !0
|
|
2302
|
+
},
|
|
2303
|
+
"class-name": {
|
|
2304
|
+
pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
|
|
2305
|
+
lookbehind: !0
|
|
2306
|
+
},
|
|
2307
|
+
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/,
|
|
2308
|
+
function: /\b[a-z_]\w*(?=\s*\()/i,
|
|
2309
|
+
number: /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
|
|
2310
|
+
operator: />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/
|
|
2311
|
+
}), Prism.languages.insertBefore("c", "string", { char: {
|
|
2312
|
+
pattern: /'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,
|
|
2313
|
+
greedy: !0
|
|
2314
|
+
} }), Prism.languages.insertBefore("c", "string", { macro: {
|
|
2315
|
+
pattern: /(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,
|
|
2316
|
+
lookbehind: !0,
|
|
2317
|
+
greedy: !0,
|
|
2318
|
+
alias: "property",
|
|
2319
|
+
inside: {
|
|
2320
|
+
string: [{
|
|
2321
|
+
pattern: /^(#\s*include\s*)<[^>]+>/,
|
|
2322
|
+
lookbehind: !0
|
|
2323
|
+
}, Prism.languages.c.string],
|
|
2324
|
+
char: Prism.languages.c.char,
|
|
2325
|
+
comment: Prism.languages.c.comment,
|
|
2326
|
+
"macro-name": [{
|
|
2327
|
+
pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
|
|
2328
|
+
lookbehind: !0
|
|
2329
|
+
}, {
|
|
2330
|
+
pattern: /(^#\s*define\s+)\w+\b(?=\()/i,
|
|
2331
|
+
lookbehind: !0,
|
|
2332
|
+
alias: "function"
|
|
2333
|
+
}],
|
|
2334
|
+
directive: {
|
|
2335
|
+
pattern: /^(#\s*)[a-z]+/,
|
|
2336
|
+
lookbehind: !0,
|
|
2337
|
+
alias: "keyword"
|
|
2338
|
+
},
|
|
2339
|
+
"directive-hash": /^#/,
|
|
2340
|
+
punctuation: /##|\\(?=[\r\n])/,
|
|
2341
|
+
expression: {
|
|
2342
|
+
pattern: /\S[\s\S]*/,
|
|
2343
|
+
inside: Prism.languages.c
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
} }), Prism.languages.insertBefore("c", "function", { constant: /\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/ }), delete Prism.languages.c.boolean, (function(e) {
|
|
2347
|
+
var t = /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/, n = "\\b(?!<keyword>)\\w+(?:\\s*\\.\\s*\\w+)*\\b".replace(/<keyword>/g, function() {
|
|
2348
|
+
return t.source;
|
|
2349
|
+
});
|
|
2350
|
+
e.languages.cpp = e.languages.extend("c", {
|
|
2351
|
+
"class-name": [
|
|
2352
|
+
{
|
|
2353
|
+
pattern: RegExp("(\\b(?:class|concept|enum|struct|typename)\\s+)(?!<keyword>)\\w+".replace(/<keyword>/g, function() {
|
|
2354
|
+
return t.source;
|
|
2355
|
+
})),
|
|
2356
|
+
lookbehind: !0
|
|
2357
|
+
},
|
|
2358
|
+
/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,
|
|
2359
|
+
/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,
|
|
2360
|
+
/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/
|
|
2361
|
+
],
|
|
2362
|
+
keyword: t,
|
|
2363
|
+
number: {
|
|
2364
|
+
pattern: /(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,
|
|
2365
|
+
greedy: !0
|
|
2366
|
+
},
|
|
2367
|
+
operator: />>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,
|
|
2368
|
+
boolean: /\b(?:false|true)\b/
|
|
2369
|
+
}), e.languages.insertBefore("cpp", "string", {
|
|
2370
|
+
module: {
|
|
2371
|
+
pattern: RegExp("(\\b(?:import|module)\\s+)(?:\"(?:\\\\(?:\\r\\n|[\\s\\S])|[^\"\\\\\\r\\n])*\"|<[^<>\\r\\n]*>|" + "<mod-name>(?:\\s*:\\s*<mod-name>)?|:\\s*<mod-name>".replace(/<mod-name>/g, function() {
|
|
2372
|
+
return n;
|
|
2373
|
+
}) + ")"),
|
|
2374
|
+
lookbehind: !0,
|
|
2375
|
+
greedy: !0,
|
|
2376
|
+
inside: {
|
|
2377
|
+
string: /^[<"][\s\S]+/,
|
|
2378
|
+
operator: /:/,
|
|
2379
|
+
punctuation: /\./
|
|
2380
|
+
}
|
|
2381
|
+
},
|
|
2382
|
+
"raw-string": {
|
|
2383
|
+
pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,
|
|
2384
|
+
alias: "string",
|
|
2385
|
+
greedy: !0
|
|
2386
|
+
}
|
|
2387
|
+
}), e.languages.insertBefore("cpp", "keyword", { "generic-function": {
|
|
2388
|
+
pattern: /\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,
|
|
2389
|
+
inside: {
|
|
2390
|
+
function: /^\w+/,
|
|
2391
|
+
generic: {
|
|
2392
|
+
pattern: /<[\s\S]+/,
|
|
2393
|
+
alias: "class-name",
|
|
2394
|
+
inside: e.languages.cpp
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
} }), e.languages.insertBefore("cpp", "operator", { "double-colon": {
|
|
2398
|
+
pattern: /::/,
|
|
2399
|
+
alias: "punctuation"
|
|
2400
|
+
} }), e.languages.insertBefore("cpp", "class-name", { "base-clause": {
|
|
2401
|
+
pattern: /(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,
|
|
2402
|
+
lookbehind: !0,
|
|
2403
|
+
greedy: !0,
|
|
2404
|
+
inside: e.languages.extend("cpp", {})
|
|
2405
|
+
} }), e.languages.insertBefore("inside", "double-colon", { "class-name": /\b[a-z_]\w*\b(?!\s*::)/i }, e.languages.cpp["base-clause"]);
|
|
2406
|
+
})(Prism), (function(e) {
|
|
2407
|
+
function t(e, t) {
|
|
2408
|
+
return e.replace(/<<(\d+)>>/g, function(e, n) {
|
|
2409
|
+
return "(?:" + t[+n] + ")";
|
|
2410
|
+
});
|
|
2411
|
+
}
|
|
2412
|
+
function n(e, n, r) {
|
|
2413
|
+
return RegExp(t(e, n), r || "");
|
|
2414
|
+
}
|
|
2415
|
+
function r(e, t) {
|
|
2416
|
+
for (var n = 0; n < t; n++) e = e.replace(/<<self>>/g, function() {
|
|
2417
|
+
return "(?:" + e + ")";
|
|
2418
|
+
});
|
|
2419
|
+
return e.replace(/<<self>>/g, "[^\\s\\S]");
|
|
2420
|
+
}
|
|
2421
|
+
var i = {
|
|
2422
|
+
type: "bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",
|
|
2423
|
+
typeDeclaration: "class enum interface record struct",
|
|
2424
|
+
contextual: "add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)",
|
|
2425
|
+
other: "abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield"
|
|
2426
|
+
};
|
|
2427
|
+
function a(e) {
|
|
2428
|
+
return "\\b(?:" + e.trim().replace(/ /g, "|") + ")\\b";
|
|
2429
|
+
}
|
|
2430
|
+
var o = a(i.typeDeclaration), s = RegExp(a(i.type + " " + i.typeDeclaration + " " + i.contextual + " " + i.other)), c = a(i.typeDeclaration + " " + i.contextual + " " + i.other), l = a(i.type + " " + i.typeDeclaration + " " + i.other), u = r("<(?:[^<>;=+\\-*/%&|^]|<<self>>)*>", 2), d = r("\\((?:[^()]|<<self>>)*\\)", 2), f = "@?\\b[A-Za-z_]\\w*\\b", p = t("<<0>>(?:\\s*<<1>>)?", [f, u]), m = t("(?!<<0>>)<<1>>(?:\\s*\\.\\s*<<1>>)*", [c, p]), h = "\\[\\s*(?:,\\s*)*\\]", g = t("<<0>>(?:\\s*(?:\\?\\s*)?<<1>>)*(?:\\s*\\?)?", [m, h]), _ = t("(?:<<0>>|<<1>>)(?:\\s*(?:\\?\\s*)?<<2>>)*(?:\\s*\\?)?", [
|
|
2431
|
+
t("\\(<<0>>+(?:,<<0>>+)+\\)", [t("[^,()<>[\\];=+\\-*/%&|^]|<<0>>|<<1>>|<<2>>", [
|
|
2432
|
+
u,
|
|
2433
|
+
d,
|
|
2434
|
+
h
|
|
2435
|
+
])]),
|
|
2436
|
+
m,
|
|
2437
|
+
h
|
|
2438
|
+
]), v = {
|
|
2439
|
+
keyword: s,
|
|
2440
|
+
punctuation: /[<>()?,.:[\]]/
|
|
2441
|
+
}, y = "'(?:[^\\r\\n'\\\\]|\\\\.|\\\\[Uux][\\da-fA-F]{1,8})'", b = "\"(?:\\\\.|[^\\\\\"\\r\\n])*\"", x = "@\"(?:\"\"|\\\\[\\s\\S]|[^\\\\\"])*\"(?!\")";
|
|
2442
|
+
e.languages.csharp = e.languages.extend("clike", {
|
|
2443
|
+
string: [{
|
|
2444
|
+
pattern: n("(^|[^$\\\\])<<0>>", [x]),
|
|
2445
|
+
lookbehind: !0,
|
|
2446
|
+
greedy: !0
|
|
2447
|
+
}, {
|
|
2448
|
+
pattern: n("(^|[^@$\\\\])<<0>>", [b]),
|
|
2449
|
+
lookbehind: !0,
|
|
2450
|
+
greedy: !0
|
|
2451
|
+
}],
|
|
2452
|
+
"class-name": [
|
|
2453
|
+
{
|
|
2454
|
+
pattern: n("(\\busing\\s+static\\s+)<<0>>(?=\\s*;)", [m]),
|
|
2455
|
+
lookbehind: !0,
|
|
2456
|
+
inside: v
|
|
2457
|
+
},
|
|
2458
|
+
{
|
|
2459
|
+
pattern: n("(\\busing\\s+<<0>>\\s*=\\s*)<<1>>(?=\\s*;)", [f, _]),
|
|
2460
|
+
lookbehind: !0,
|
|
2461
|
+
inside: v
|
|
2462
|
+
},
|
|
2463
|
+
{
|
|
2464
|
+
pattern: n("(\\busing\\s+)<<0>>(?=\\s*=)", [f]),
|
|
2465
|
+
lookbehind: !0
|
|
2466
|
+
},
|
|
2467
|
+
{
|
|
2468
|
+
pattern: n("(\\b<<0>>\\s+)<<1>>", [o, p]),
|
|
2469
|
+
lookbehind: !0,
|
|
2470
|
+
inside: v
|
|
2471
|
+
},
|
|
2472
|
+
{
|
|
2473
|
+
pattern: n("(\\bcatch\\s*\\(\\s*)<<0>>", [m]),
|
|
2474
|
+
lookbehind: !0,
|
|
2475
|
+
inside: v
|
|
2476
|
+
},
|
|
2477
|
+
{
|
|
2478
|
+
pattern: n("(\\bwhere\\s+)<<0>>", [f]),
|
|
2479
|
+
lookbehind: !0
|
|
2480
|
+
},
|
|
2481
|
+
{
|
|
2482
|
+
pattern: n("(\\b(?:is(?:\\s+not)?|as)\\s+)<<0>>", [g]),
|
|
2483
|
+
lookbehind: !0,
|
|
2484
|
+
inside: v
|
|
2485
|
+
},
|
|
2486
|
+
{
|
|
2487
|
+
pattern: n("\\b<<0>>(?=\\s+(?!<<1>>|with\\s*\\{)<<2>>(?:\\s*[=,;:{)\\]]|\\s+(?:in|when)\\b))", [
|
|
2488
|
+
_,
|
|
2489
|
+
l,
|
|
2490
|
+
f
|
|
2491
|
+
]),
|
|
2492
|
+
inside: v
|
|
2493
|
+
}
|
|
2494
|
+
],
|
|
2495
|
+
keyword: s,
|
|
2496
|
+
number: /(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,
|
|
2497
|
+
operator: />>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,
|
|
2498
|
+
punctuation: /\?\.?|::|[{}[\];(),.:]/
|
|
2499
|
+
}), e.languages.insertBefore("csharp", "number", { range: {
|
|
2500
|
+
pattern: /\.\./,
|
|
2501
|
+
alias: "operator"
|
|
2502
|
+
} }), e.languages.insertBefore("csharp", "punctuation", { "named-parameter": {
|
|
2503
|
+
pattern: n("([(,]\\s*)<<0>>(?=\\s*:)", [f]),
|
|
2504
|
+
lookbehind: !0,
|
|
2505
|
+
alias: "punctuation"
|
|
2506
|
+
} }), e.languages.insertBefore("csharp", "class-name", {
|
|
2507
|
+
namespace: {
|
|
2508
|
+
pattern: n("(\\b(?:namespace|using)\\s+)<<0>>(?:\\s*\\.\\s*<<0>>)*(?=\\s*[;{])", [f]),
|
|
2509
|
+
lookbehind: !0,
|
|
2510
|
+
inside: { punctuation: /\./ }
|
|
2511
|
+
},
|
|
2512
|
+
"type-expression": {
|
|
2513
|
+
pattern: n("(\\b(?:default|sizeof|typeof)\\s*\\(\\s*(?!\\s))(?:[^()\\s]|\\s(?!\\s)|<<0>>)*(?=\\s*\\))", [d]),
|
|
2514
|
+
lookbehind: !0,
|
|
2515
|
+
alias: "class-name",
|
|
2516
|
+
inside: v
|
|
2517
|
+
},
|
|
2518
|
+
"return-type": {
|
|
2519
|
+
pattern: n("<<0>>(?=\\s+(?:<<1>>\\s*(?:=>|[({]|\\.\\s*this\\s*\\[)|this\\s*\\[))", [_, m]),
|
|
2520
|
+
inside: v,
|
|
2521
|
+
alias: "class-name"
|
|
2522
|
+
},
|
|
2523
|
+
"constructor-invocation": {
|
|
2524
|
+
pattern: n("(\\bnew\\s+)<<0>>(?=\\s*[[({])", [_]),
|
|
2525
|
+
lookbehind: !0,
|
|
2526
|
+
inside: v,
|
|
2527
|
+
alias: "class-name"
|
|
2528
|
+
},
|
|
2529
|
+
"generic-method": {
|
|
2530
|
+
pattern: n("<<0>>\\s*<<1>>(?=\\s*\\()", [f, u]),
|
|
2531
|
+
inside: {
|
|
2532
|
+
function: n("^<<0>>", [f]),
|
|
2533
|
+
generic: {
|
|
2534
|
+
pattern: RegExp(u),
|
|
2535
|
+
alias: "class-name",
|
|
2536
|
+
inside: v
|
|
2537
|
+
}
|
|
2538
|
+
}
|
|
2539
|
+
},
|
|
2540
|
+
"type-list": {
|
|
2541
|
+
pattern: n("\\b((?:<<0>>\\s+<<1>>|record\\s+<<1>>\\s*<<5>>|where\\s+<<2>>)\\s*:\\s*)(?:<<3>>|<<4>>|<<1>>\\s*<<5>>|<<6>>)(?:\\s*,\\s*(?:<<3>>|<<4>>|<<6>>))*(?=\\s*(?:where|[{;]|=>|$))", [
|
|
2542
|
+
o,
|
|
2543
|
+
p,
|
|
2544
|
+
f,
|
|
2545
|
+
_,
|
|
2546
|
+
s.source,
|
|
2547
|
+
d,
|
|
2548
|
+
"\\bnew\\s*\\(\\s*\\)"
|
|
2549
|
+
]),
|
|
2550
|
+
lookbehind: !0,
|
|
2551
|
+
inside: {
|
|
2552
|
+
"record-arguments": {
|
|
2553
|
+
pattern: n("(^(?!new\\s*\\()<<0>>\\s*)<<1>>", [p, d]),
|
|
2554
|
+
lookbehind: !0,
|
|
2555
|
+
greedy: !0,
|
|
2556
|
+
inside: e.languages.csharp
|
|
2557
|
+
},
|
|
2558
|
+
keyword: s,
|
|
2559
|
+
"class-name": {
|
|
2560
|
+
pattern: RegExp(_),
|
|
2561
|
+
greedy: !0,
|
|
2562
|
+
inside: v
|
|
2563
|
+
},
|
|
2564
|
+
punctuation: /[,()]/
|
|
2565
|
+
}
|
|
2566
|
+
},
|
|
2567
|
+
preprocessor: {
|
|
2568
|
+
pattern: /(^[\t ]*)#.*/m,
|
|
2569
|
+
lookbehind: !0,
|
|
2570
|
+
alias: "property",
|
|
2571
|
+
inside: { directive: {
|
|
2572
|
+
pattern: /(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,
|
|
2573
|
+
lookbehind: !0,
|
|
2574
|
+
alias: "keyword"
|
|
2575
|
+
} }
|
|
2576
|
+
}
|
|
2577
|
+
});
|
|
2578
|
+
var S = b + "|" + y, C = t("\\/(?![*/])|\\/\\/[^\\r\\n]*[\\r\\n]|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/|<<0>>", [S]), w = r(t("[^\"'/()]|<<0>>|\\(<<self>>*\\)", [C]), 2), T = "\\b(?:assembly|event|field|method|module|param|property|return|type)\\b", E = t("<<0>>(?:\\s*\\(<<1>>*\\))?", [m, w]);
|
|
2579
|
+
e.languages.insertBefore("csharp", "class-name", { attribute: {
|
|
2580
|
+
pattern: n("((?:^|[^\\s\\w>)?])\\s*\\[\\s*)(?:<<0>>\\s*:\\s*)?<<1>>(?:\\s*,\\s*<<1>>)*(?=\\s*\\])", [T, E]),
|
|
2581
|
+
lookbehind: !0,
|
|
2582
|
+
greedy: !0,
|
|
2583
|
+
inside: {
|
|
2584
|
+
target: {
|
|
2585
|
+
pattern: n("^<<0>>(?=\\s*:)", [T]),
|
|
2586
|
+
alias: "keyword"
|
|
2587
|
+
},
|
|
2588
|
+
"attribute-arguments": {
|
|
2589
|
+
pattern: n("\\(<<0>>*\\)", [w]),
|
|
2590
|
+
inside: e.languages.csharp
|
|
2591
|
+
},
|
|
2592
|
+
"class-name": {
|
|
2593
|
+
pattern: RegExp(m),
|
|
2594
|
+
inside: { punctuation: /\./ }
|
|
2595
|
+
},
|
|
2596
|
+
punctuation: /[:,]/
|
|
2597
|
+
}
|
|
2598
|
+
} });
|
|
2599
|
+
var D = ":[^}\\r\\n]+", O = r(t("[^\"'/()]|<<0>>|\\(<<self>>*\\)", [C]), 2), k = t("\\{(?!\\{)(?:(?![}:])<<0>>)*<<1>>?\\}", [O, D]), A = r(t("[^\"'/()]|\\/(?!\\*)|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/|<<0>>|\\(<<self>>*\\)", [S]), 2), j = t("\\{(?!\\{)(?:(?![}:])<<0>>)*<<1>>?\\}", [A, D]);
|
|
2600
|
+
function M(t, r) {
|
|
2601
|
+
return {
|
|
2602
|
+
interpolation: {
|
|
2603
|
+
pattern: n("((?:^|[^{])(?:\\{\\{)*)<<0>>", [t]),
|
|
2604
|
+
lookbehind: !0,
|
|
2605
|
+
inside: {
|
|
2606
|
+
"format-string": {
|
|
2607
|
+
pattern: n("(^\\{(?:(?![}:])<<0>>)*)<<1>>(?=\\}$)", [r, D]),
|
|
2608
|
+
lookbehind: !0,
|
|
2609
|
+
inside: { punctuation: /^:/ }
|
|
2610
|
+
},
|
|
2611
|
+
punctuation: /^\{|\}$/,
|
|
2612
|
+
expression: {
|
|
2613
|
+
pattern: /[\s\S]+/,
|
|
2614
|
+
alias: "language-csharp",
|
|
2615
|
+
inside: e.languages.csharp
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2618
|
+
},
|
|
2619
|
+
string: /[\s\S]+/
|
|
2620
|
+
};
|
|
2621
|
+
}
|
|
2622
|
+
e.languages.insertBefore("csharp", "string", {
|
|
2623
|
+
"interpolation-string": [{
|
|
2624
|
+
pattern: n("(^|[^\\\\])(?:\\$@|@\\$)\"(?:\"\"|\\\\[\\s\\S]|\\{\\{|<<0>>|[^\\\\{\"])*\"", [k]),
|
|
2625
|
+
lookbehind: !0,
|
|
2626
|
+
greedy: !0,
|
|
2627
|
+
inside: M(k, O)
|
|
2628
|
+
}, {
|
|
2629
|
+
pattern: n("(^|[^@\\\\])\\$\"(?:\\\\.|\\{\\{|<<0>>|[^\\\\\"{])*\"", [j]),
|
|
2630
|
+
lookbehind: !0,
|
|
2631
|
+
greedy: !0,
|
|
2632
|
+
inside: M(j, A)
|
|
2633
|
+
}],
|
|
2634
|
+
char: {
|
|
2635
|
+
pattern: RegExp(y),
|
|
2636
|
+
greedy: !0
|
|
2637
|
+
}
|
|
2638
|
+
}), e.languages.dotnet = e.languages.cs = e.languages.csharp;
|
|
2639
|
+
})(Prism), (function(e) {
|
|
2640
|
+
e.languages.ruby = e.languages.extend("clike", {
|
|
2641
|
+
comment: {
|
|
2642
|
+
pattern: /#.*|^=begin\s[\s\S]*?^=end/m,
|
|
2643
|
+
greedy: !0
|
|
2644
|
+
},
|
|
2645
|
+
"class-name": {
|
|
2646
|
+
pattern: /(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,
|
|
2647
|
+
lookbehind: !0,
|
|
2648
|
+
inside: { punctuation: /[.\\]/ }
|
|
2649
|
+
},
|
|
2650
|
+
keyword: /\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,
|
|
2651
|
+
operator: /\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,
|
|
2652
|
+
punctuation: /[(){}[\].,;]/
|
|
2653
|
+
}), e.languages.insertBefore("ruby", "operator", { "double-colon": {
|
|
2654
|
+
pattern: /::/,
|
|
2655
|
+
alias: "punctuation"
|
|
2656
|
+
} });
|
|
2657
|
+
var t = {
|
|
2658
|
+
pattern: /((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,
|
|
2659
|
+
lookbehind: !0,
|
|
2660
|
+
inside: {
|
|
2661
|
+
content: {
|
|
2662
|
+
pattern: /^(#\{)[\s\S]+(?=\}$)/,
|
|
2663
|
+
lookbehind: !0,
|
|
2664
|
+
inside: e.languages.ruby
|
|
2665
|
+
},
|
|
2666
|
+
delimiter: {
|
|
2667
|
+
pattern: /^#\{|\}$/,
|
|
2668
|
+
alias: "punctuation"
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
};
|
|
2672
|
+
delete e.languages.ruby.function;
|
|
2673
|
+
var n = "(?:" + [
|
|
2674
|
+
"([^a-zA-Z0-9\\s{(\\[<=])(?:(?!\\1)[^\\\\]|\\\\[\\s\\S])*\\1",
|
|
2675
|
+
"\\((?:[^()\\\\]|\\\\[\\s\\S]|\\((?:[^()\\\\]|\\\\[\\s\\S])*\\))*\\)",
|
|
2676
|
+
"\\{(?:[^{}\\\\]|\\\\[\\s\\S]|\\{(?:[^{}\\\\]|\\\\[\\s\\S])*\\})*\\}",
|
|
2677
|
+
"\\[(?:[^\\[\\]\\\\]|\\\\[\\s\\S]|\\[(?:[^\\[\\]\\\\]|\\\\[\\s\\S])*\\])*\\]",
|
|
2678
|
+
"<(?:[^<>\\\\]|\\\\[\\s\\S]|<(?:[^<>\\\\]|\\\\[\\s\\S])*>)*>"
|
|
2679
|
+
].join("|") + ")", r = "(?:\"(?:\\\\.|[^\"\\\\\\r\\n])*\"|(?:\\b[a-zA-Z_]\\w*|[^\\s\\0-\\x7F]+)[?!]?|\\$.)";
|
|
2680
|
+
e.languages.insertBefore("ruby", "keyword", {
|
|
2681
|
+
"regex-literal": [{
|
|
2682
|
+
pattern: RegExp("%r" + n + "[egimnosux]{0,6}"),
|
|
2683
|
+
greedy: !0,
|
|
2684
|
+
inside: {
|
|
2685
|
+
interpolation: t,
|
|
2686
|
+
regex: /[\s\S]+/
|
|
2687
|
+
}
|
|
2688
|
+
}, {
|
|
2689
|
+
pattern: /(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,
|
|
2690
|
+
lookbehind: !0,
|
|
2691
|
+
greedy: !0,
|
|
2692
|
+
inside: {
|
|
2693
|
+
interpolation: t,
|
|
2694
|
+
regex: /[\s\S]+/
|
|
2695
|
+
}
|
|
2696
|
+
}],
|
|
2697
|
+
variable: /[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,
|
|
2698
|
+
symbol: [{
|
|
2699
|
+
pattern: RegExp("(^|[^:]):" + r),
|
|
2700
|
+
lookbehind: !0,
|
|
2701
|
+
greedy: !0
|
|
2702
|
+
}, {
|
|
2703
|
+
pattern: RegExp("([\\r\\n{(,][ \\t]*)" + r + "(?=:(?!:))"),
|
|
2704
|
+
lookbehind: !0,
|
|
2705
|
+
greedy: !0
|
|
2706
|
+
}],
|
|
2707
|
+
"method-definition": {
|
|
2708
|
+
pattern: /(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,
|
|
2709
|
+
lookbehind: !0,
|
|
2710
|
+
inside: {
|
|
2711
|
+
function: /\b\w+$/,
|
|
2712
|
+
keyword: /^self\b/,
|
|
2713
|
+
"class-name": /^\w+/,
|
|
2714
|
+
punctuation: /\./
|
|
2715
|
+
}
|
|
2716
|
+
}
|
|
2717
|
+
}), e.languages.insertBefore("ruby", "string", {
|
|
2718
|
+
"string-literal": [
|
|
2719
|
+
{
|
|
2720
|
+
pattern: RegExp("%[qQiIwWs]?" + n),
|
|
2721
|
+
greedy: !0,
|
|
2722
|
+
inside: {
|
|
2723
|
+
interpolation: t,
|
|
2724
|
+
string: /[\s\S]+/
|
|
2725
|
+
}
|
|
2726
|
+
},
|
|
2727
|
+
{
|
|
2728
|
+
pattern: /("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,
|
|
2729
|
+
greedy: !0,
|
|
2730
|
+
inside: {
|
|
2731
|
+
interpolation: t,
|
|
2732
|
+
string: /[\s\S]+/
|
|
2733
|
+
}
|
|
2734
|
+
},
|
|
2735
|
+
{
|
|
2736
|
+
pattern: /<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,
|
|
2737
|
+
alias: "heredoc-string",
|
|
2738
|
+
greedy: !0,
|
|
2739
|
+
inside: {
|
|
2740
|
+
delimiter: {
|
|
2741
|
+
pattern: /^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,
|
|
2742
|
+
inside: {
|
|
2743
|
+
symbol: /\b\w+/,
|
|
2744
|
+
punctuation: /^<<[-~]?/
|
|
2745
|
+
}
|
|
2746
|
+
},
|
|
2747
|
+
interpolation: t,
|
|
2748
|
+
string: /[\s\S]+/
|
|
2749
|
+
}
|
|
2750
|
+
},
|
|
2751
|
+
{
|
|
2752
|
+
pattern: /<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,
|
|
2753
|
+
alias: "heredoc-string",
|
|
2754
|
+
greedy: !0,
|
|
2755
|
+
inside: {
|
|
2756
|
+
delimiter: {
|
|
2757
|
+
pattern: /^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,
|
|
2758
|
+
inside: {
|
|
2759
|
+
symbol: /\b\w+/,
|
|
2760
|
+
punctuation: /^<<[-~]?'|'$/
|
|
2761
|
+
}
|
|
2762
|
+
},
|
|
2763
|
+
string: /[\s\S]+/
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2766
|
+
],
|
|
2767
|
+
"command-literal": [{
|
|
2768
|
+
pattern: RegExp("%x" + n),
|
|
2769
|
+
greedy: !0,
|
|
2770
|
+
inside: {
|
|
2771
|
+
interpolation: t,
|
|
2772
|
+
command: {
|
|
2773
|
+
pattern: /[\s\S]+/,
|
|
2774
|
+
alias: "string"
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2777
|
+
}, {
|
|
2778
|
+
pattern: /`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,
|
|
2779
|
+
greedy: !0,
|
|
2780
|
+
inside: {
|
|
2781
|
+
interpolation: t,
|
|
2782
|
+
command: {
|
|
2783
|
+
pattern: /[\s\S]+/,
|
|
2784
|
+
alias: "string"
|
|
2785
|
+
}
|
|
2786
|
+
}
|
|
2787
|
+
}]
|
|
2788
|
+
}), delete e.languages.ruby.string, e.languages.insertBefore("ruby", "number", {
|
|
2789
|
+
builtin: /\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,
|
|
2790
|
+
constant: /\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/
|
|
2791
|
+
}), e.languages.rb = e.languages.ruby;
|
|
2792
|
+
})(Prism), (function(e) {
|
|
2793
|
+
var t = /\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/, n = [
|
|
2794
|
+
{
|
|
2795
|
+
pattern: /\b(?:false|true)\b/i,
|
|
2796
|
+
alias: "boolean"
|
|
2797
|
+
},
|
|
2798
|
+
{
|
|
2799
|
+
pattern: /(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,
|
|
2800
|
+
greedy: !0,
|
|
2801
|
+
lookbehind: !0
|
|
2802
|
+
},
|
|
2803
|
+
{
|
|
2804
|
+
pattern: /(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,
|
|
2805
|
+
greedy: !0,
|
|
2806
|
+
lookbehind: !0
|
|
2807
|
+
},
|
|
2808
|
+
/\b(?:null)\b/i,
|
|
2809
|
+
/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/
|
|
2810
|
+
], r = /\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i, i = /<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/, a = /[{}\[\](),:;]/;
|
|
2811
|
+
e.languages.php = {
|
|
2812
|
+
delimiter: {
|
|
2813
|
+
pattern: /\?>$|^<\?(?:php(?=\s)|=)?/i,
|
|
2814
|
+
alias: "important"
|
|
2815
|
+
},
|
|
2816
|
+
comment: t,
|
|
2817
|
+
variable: /\$+(?:\w+\b|(?=\{))/,
|
|
2818
|
+
package: {
|
|
2819
|
+
pattern: /(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
|
|
2820
|
+
lookbehind: !0,
|
|
2821
|
+
inside: { punctuation: /\\/ }
|
|
2822
|
+
},
|
|
2823
|
+
"class-name-definition": {
|
|
2824
|
+
pattern: /(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,
|
|
2825
|
+
lookbehind: !0,
|
|
2826
|
+
alias: "class-name"
|
|
2827
|
+
},
|
|
2828
|
+
"function-definition": {
|
|
2829
|
+
pattern: /(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,
|
|
2830
|
+
lookbehind: !0,
|
|
2831
|
+
alias: "function"
|
|
2832
|
+
},
|
|
2833
|
+
keyword: [
|
|
2834
|
+
{
|
|
2835
|
+
pattern: /(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,
|
|
2836
|
+
alias: "type-casting",
|
|
2837
|
+
greedy: !0,
|
|
2838
|
+
lookbehind: !0
|
|
2839
|
+
},
|
|
2840
|
+
{
|
|
2841
|
+
pattern: /([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,
|
|
2842
|
+
alias: "type-hint",
|
|
2843
|
+
greedy: !0,
|
|
2844
|
+
lookbehind: !0
|
|
2845
|
+
},
|
|
2846
|
+
{
|
|
2847
|
+
pattern: /(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,
|
|
2848
|
+
alias: "return-type",
|
|
2849
|
+
greedy: !0,
|
|
2850
|
+
lookbehind: !0
|
|
2851
|
+
},
|
|
2852
|
+
{
|
|
2853
|
+
pattern: /\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,
|
|
2854
|
+
alias: "type-declaration",
|
|
2855
|
+
greedy: !0
|
|
2856
|
+
},
|
|
2857
|
+
{
|
|
2858
|
+
pattern: /(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,
|
|
2859
|
+
alias: "type-declaration",
|
|
2860
|
+
greedy: !0,
|
|
2861
|
+
lookbehind: !0
|
|
2862
|
+
},
|
|
2863
|
+
{
|
|
2864
|
+
pattern: /\b(?:parent|self|static)(?=\s*::)/i,
|
|
2865
|
+
alias: "static-context",
|
|
2866
|
+
greedy: !0
|
|
2867
|
+
},
|
|
2868
|
+
{
|
|
2869
|
+
pattern: /(\byield\s+)from\b/i,
|
|
2870
|
+
lookbehind: !0
|
|
2871
|
+
},
|
|
2872
|
+
/\bclass\b/i,
|
|
2873
|
+
{
|
|
2874
|
+
pattern: /((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,
|
|
2875
|
+
lookbehind: !0
|
|
2876
|
+
}
|
|
2877
|
+
],
|
|
2878
|
+
"argument-name": {
|
|
2879
|
+
pattern: /([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,
|
|
2880
|
+
lookbehind: !0
|
|
2881
|
+
},
|
|
2882
|
+
"class-name": [
|
|
2883
|
+
{
|
|
2884
|
+
pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,
|
|
2885
|
+
greedy: !0,
|
|
2886
|
+
lookbehind: !0
|
|
2887
|
+
},
|
|
2888
|
+
{
|
|
2889
|
+
pattern: /(\|\s*)\b[a-z_]\w*(?!\\)\b/i,
|
|
2890
|
+
greedy: !0,
|
|
2891
|
+
lookbehind: !0
|
|
2892
|
+
},
|
|
2893
|
+
{
|
|
2894
|
+
pattern: /\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,
|
|
2895
|
+
greedy: !0
|
|
2896
|
+
},
|
|
2897
|
+
{
|
|
2898
|
+
pattern: /(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,
|
|
2899
|
+
alias: "class-name-fully-qualified",
|
|
2900
|
+
greedy: !0,
|
|
2901
|
+
lookbehind: !0,
|
|
2902
|
+
inside: { punctuation: /\\/ }
|
|
2903
|
+
},
|
|
2904
|
+
{
|
|
2905
|
+
pattern: /(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,
|
|
2906
|
+
alias: "class-name-fully-qualified",
|
|
2907
|
+
greedy: !0,
|
|
2908
|
+
inside: { punctuation: /\\/ }
|
|
2909
|
+
},
|
|
2910
|
+
{
|
|
2911
|
+
pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
|
|
2912
|
+
alias: "class-name-fully-qualified",
|
|
2913
|
+
greedy: !0,
|
|
2914
|
+
lookbehind: !0,
|
|
2915
|
+
inside: { punctuation: /\\/ }
|
|
2916
|
+
},
|
|
2917
|
+
{
|
|
2918
|
+
pattern: /\b[a-z_]\w*(?=\s*\$)/i,
|
|
2919
|
+
alias: "type-declaration",
|
|
2920
|
+
greedy: !0
|
|
2921
|
+
},
|
|
2922
|
+
{
|
|
2923
|
+
pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,
|
|
2924
|
+
alias: ["class-name-fully-qualified", "type-declaration"],
|
|
2925
|
+
greedy: !0,
|
|
2926
|
+
inside: { punctuation: /\\/ }
|
|
2927
|
+
},
|
|
2928
|
+
{
|
|
2929
|
+
pattern: /\b[a-z_]\w*(?=\s*::)/i,
|
|
2930
|
+
alias: "static-context",
|
|
2931
|
+
greedy: !0
|
|
2932
|
+
},
|
|
2933
|
+
{
|
|
2934
|
+
pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,
|
|
2935
|
+
alias: ["class-name-fully-qualified", "static-context"],
|
|
2936
|
+
greedy: !0,
|
|
2937
|
+
inside: { punctuation: /\\/ }
|
|
2938
|
+
},
|
|
2939
|
+
{
|
|
2940
|
+
pattern: /([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,
|
|
2941
|
+
alias: "type-hint",
|
|
2942
|
+
greedy: !0,
|
|
2943
|
+
lookbehind: !0
|
|
2944
|
+
},
|
|
2945
|
+
{
|
|
2946
|
+
pattern: /([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,
|
|
2947
|
+
alias: ["class-name-fully-qualified", "type-hint"],
|
|
2948
|
+
greedy: !0,
|
|
2949
|
+
lookbehind: !0,
|
|
2950
|
+
inside: { punctuation: /\\/ }
|
|
2951
|
+
},
|
|
2952
|
+
{
|
|
2953
|
+
pattern: /(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,
|
|
2954
|
+
alias: "return-type",
|
|
2955
|
+
greedy: !0,
|
|
2956
|
+
lookbehind: !0
|
|
2957
|
+
},
|
|
2958
|
+
{
|
|
2959
|
+
pattern: /(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
|
|
2960
|
+
alias: ["class-name-fully-qualified", "return-type"],
|
|
2961
|
+
greedy: !0,
|
|
2962
|
+
lookbehind: !0,
|
|
2963
|
+
inside: { punctuation: /\\/ }
|
|
2964
|
+
}
|
|
2965
|
+
],
|
|
2966
|
+
constant: n,
|
|
2967
|
+
function: {
|
|
2968
|
+
pattern: /(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,
|
|
2969
|
+
lookbehind: !0,
|
|
2970
|
+
inside: { punctuation: /\\/ }
|
|
2971
|
+
},
|
|
2972
|
+
property: {
|
|
2973
|
+
pattern: /(->\s*)\w+/,
|
|
2974
|
+
lookbehind: !0
|
|
2975
|
+
},
|
|
2976
|
+
number: r,
|
|
2977
|
+
operator: i,
|
|
2978
|
+
punctuation: a
|
|
2979
|
+
};
|
|
2980
|
+
var o = {
|
|
2981
|
+
pattern: /\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,
|
|
2982
|
+
lookbehind: !0,
|
|
2983
|
+
inside: e.languages.php
|
|
2984
|
+
}, s = [
|
|
2985
|
+
{
|
|
2986
|
+
pattern: /<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,
|
|
2987
|
+
alias: "nowdoc-string",
|
|
2988
|
+
greedy: !0,
|
|
2989
|
+
inside: { delimiter: {
|
|
2990
|
+
pattern: /^<<<'[^']+'|[a-z_]\w*;$/i,
|
|
2991
|
+
alias: "symbol",
|
|
2992
|
+
inside: { punctuation: /^<<<'?|[';]$/ }
|
|
2993
|
+
} }
|
|
2994
|
+
},
|
|
2995
|
+
{
|
|
2996
|
+
pattern: /<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,
|
|
2997
|
+
alias: "heredoc-string",
|
|
2998
|
+
greedy: !0,
|
|
2999
|
+
inside: {
|
|
3000
|
+
delimiter: {
|
|
3001
|
+
pattern: /^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,
|
|
3002
|
+
alias: "symbol",
|
|
3003
|
+
inside: { punctuation: /^<<<"?|[";]$/ }
|
|
3004
|
+
},
|
|
3005
|
+
interpolation: o
|
|
3006
|
+
}
|
|
3007
|
+
},
|
|
3008
|
+
{
|
|
3009
|
+
pattern: /`(?:\\[\s\S]|[^\\`])*`/,
|
|
3010
|
+
alias: "backtick-quoted-string",
|
|
3011
|
+
greedy: !0
|
|
3012
|
+
},
|
|
3013
|
+
{
|
|
3014
|
+
pattern: /'(?:\\[\s\S]|[^\\'])*'/,
|
|
3015
|
+
alias: "single-quoted-string",
|
|
3016
|
+
greedy: !0
|
|
3017
|
+
},
|
|
3018
|
+
{
|
|
3019
|
+
pattern: /"(?:\\[\s\S]|[^\\"])*"/,
|
|
3020
|
+
alias: "double-quoted-string",
|
|
3021
|
+
greedy: !0,
|
|
3022
|
+
inside: { interpolation: o }
|
|
3023
|
+
}
|
|
3024
|
+
];
|
|
3025
|
+
e.languages.insertBefore("php", "variable", {
|
|
3026
|
+
string: s,
|
|
3027
|
+
attribute: {
|
|
3028
|
+
pattern: /#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,
|
|
3029
|
+
greedy: !0,
|
|
3030
|
+
inside: {
|
|
3031
|
+
"attribute-content": {
|
|
3032
|
+
pattern: /^(#\[)[\s\S]+(?=\]$)/,
|
|
3033
|
+
lookbehind: !0,
|
|
3034
|
+
inside: {
|
|
3035
|
+
comment: t,
|
|
3036
|
+
string: s,
|
|
3037
|
+
"attribute-class-name": [{
|
|
3038
|
+
pattern: /([^:]|^)\b[a-z_]\w*(?!\\)\b/i,
|
|
3039
|
+
alias: "class-name",
|
|
3040
|
+
greedy: !0,
|
|
3041
|
+
lookbehind: !0
|
|
3042
|
+
}, {
|
|
3043
|
+
pattern: /([^:]|^)(?:\\?\b[a-z_]\w*)+/i,
|
|
3044
|
+
alias: ["class-name", "class-name-fully-qualified"],
|
|
3045
|
+
greedy: !0,
|
|
3046
|
+
lookbehind: !0,
|
|
3047
|
+
inside: { punctuation: /\\/ }
|
|
3048
|
+
}],
|
|
3049
|
+
constant: n,
|
|
3050
|
+
number: r,
|
|
3051
|
+
operator: i,
|
|
3052
|
+
punctuation: a
|
|
3053
|
+
}
|
|
3054
|
+
},
|
|
3055
|
+
delimiter: {
|
|
3056
|
+
pattern: /^#\[|\]$/,
|
|
3057
|
+
alias: "punctuation"
|
|
3058
|
+
}
|
|
3059
|
+
}
|
|
3060
|
+
}
|
|
3061
|
+
}), e.hooks.add("before-tokenize", function(t) {
|
|
3062
|
+
/<\?/.test(t.code) && e.languages["markup-templating"].buildPlaceholders(t, "php", /<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g);
|
|
3063
|
+
}), e.hooks.add("after-tokenize", function(t) {
|
|
3064
|
+
e.languages["markup-templating"].tokenizePlaceholders(t, "php");
|
|
3065
|
+
});
|
|
3066
|
+
})(Prism), Prism.languages.swift = {
|
|
3067
|
+
comment: {
|
|
3068
|
+
pattern: /(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,
|
|
3069
|
+
lookbehind: !0,
|
|
3070
|
+
greedy: !0
|
|
3071
|
+
},
|
|
3072
|
+
"string-literal": [{
|
|
3073
|
+
pattern: RegExp("(^|[^\"#])(?:\"(?:\\\\(?:\\((?:[^()]|\\([^()]*\\))*\\)|\\r\\n|[^(])|[^\\\\\\r\\n\"])*\"|\"\"\"(?:\\\\(?:\\((?:[^()]|\\([^()]*\\))*\\)|[^(])|[^\\\\\"]|\"(?!\"\"))*\"\"\")(?![\"#])"),
|
|
3074
|
+
lookbehind: !0,
|
|
3075
|
+
greedy: !0,
|
|
3076
|
+
inside: {
|
|
3077
|
+
interpolation: {
|
|
3078
|
+
pattern: /(\\\()(?:[^()]|\([^()]*\))*(?=\))/,
|
|
3079
|
+
lookbehind: !0,
|
|
3080
|
+
inside: null
|
|
3081
|
+
},
|
|
3082
|
+
"interpolation-punctuation": {
|
|
3083
|
+
pattern: /^\)|\\\($/,
|
|
3084
|
+
alias: "punctuation"
|
|
3085
|
+
},
|
|
3086
|
+
punctuation: /\\(?=[\r\n])/,
|
|
3087
|
+
string: /[\s\S]+/
|
|
3088
|
+
}
|
|
3089
|
+
}, {
|
|
3090
|
+
pattern: RegExp("(^|[^\"#])(#+)(?:\"(?:\\\\(?:#+\\((?:[^()]|\\([^()]*\\))*\\)|\\r\\n|[^#])|[^\\\\\\r\\n])*?\"|\"\"\"(?:\\\\(?:#+\\((?:[^()]|\\([^()]*\\))*\\)|[^#])|[^\\\\])*?\"\"\")\\2"),
|
|
3091
|
+
lookbehind: !0,
|
|
3092
|
+
greedy: !0,
|
|
3093
|
+
inside: {
|
|
3094
|
+
interpolation: {
|
|
3095
|
+
pattern: /(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,
|
|
3096
|
+
lookbehind: !0,
|
|
3097
|
+
inside: null
|
|
3098
|
+
},
|
|
3099
|
+
"interpolation-punctuation": {
|
|
3100
|
+
pattern: /^\)|\\#+\($/,
|
|
3101
|
+
alias: "punctuation"
|
|
3102
|
+
},
|
|
3103
|
+
string: /[\s\S]+/
|
|
3104
|
+
}
|
|
3105
|
+
}],
|
|
3106
|
+
directive: {
|
|
3107
|
+
pattern: RegExp("#(?:(?:elseif|if)\\b(?:[ ]*(?:![ \\t]*)?(?:\\b\\w+\\b(?:[ \\t]*\\((?:[^()]|\\([^()]*\\))*\\))?|\\((?:[^()]|\\([^()]*\\))*\\))(?:[ \\t]*(?:&&|\\|\\|))?)+|(?:else|endif)\\b)"),
|
|
3108
|
+
alias: "property",
|
|
3109
|
+
inside: {
|
|
3110
|
+
"directive-name": /^#\w+/,
|
|
3111
|
+
boolean: /\b(?:false|true)\b/,
|
|
3112
|
+
number: /\b\d+(?:\.\d+)*\b/,
|
|
3113
|
+
operator: /!|&&|\|\||[<>]=?/,
|
|
3114
|
+
punctuation: /[(),]/
|
|
3115
|
+
}
|
|
3116
|
+
},
|
|
3117
|
+
literal: {
|
|
3118
|
+
pattern: /#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,
|
|
3119
|
+
alias: "constant"
|
|
3120
|
+
},
|
|
3121
|
+
"other-directive": {
|
|
3122
|
+
pattern: /#\w+\b/,
|
|
3123
|
+
alias: "property"
|
|
3124
|
+
},
|
|
3125
|
+
attribute: {
|
|
3126
|
+
pattern: /@\w+/,
|
|
3127
|
+
alias: "atrule"
|
|
3128
|
+
},
|
|
3129
|
+
"function-definition": {
|
|
3130
|
+
pattern: /(\bfunc\s+)\w+/,
|
|
3131
|
+
lookbehind: !0,
|
|
3132
|
+
alias: "function"
|
|
3133
|
+
},
|
|
3134
|
+
label: {
|
|
3135
|
+
pattern: /\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,
|
|
3136
|
+
lookbehind: !0,
|
|
3137
|
+
alias: "important"
|
|
3138
|
+
},
|
|
3139
|
+
keyword: /\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,
|
|
3140
|
+
boolean: /\b(?:false|true)\b/,
|
|
3141
|
+
nil: {
|
|
3142
|
+
pattern: /\bnil\b/,
|
|
3143
|
+
alias: "constant"
|
|
3144
|
+
},
|
|
3145
|
+
"short-argument": /\$\d+\b/,
|
|
3146
|
+
omit: {
|
|
3147
|
+
pattern: /\b_\b/,
|
|
3148
|
+
alias: "keyword"
|
|
3149
|
+
},
|
|
3150
|
+
number: /\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,
|
|
3151
|
+
"class-name": /\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,
|
|
3152
|
+
function: /\b[a-z_]\w*(?=\s*\()/i,
|
|
3153
|
+
constant: /\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,
|
|
3154
|
+
operator: /[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,
|
|
3155
|
+
punctuation: /[{}[\]();,.:\\]/
|
|
3156
|
+
}, Prism.languages.swift["string-literal"].forEach(function(e) {
|
|
3157
|
+
e.inside.interpolation.inside = Prism.languages.swift;
|
|
3158
|
+
}), (function(e) {
|
|
3159
|
+
e.languages.kotlin = e.languages.extend("clike", {
|
|
3160
|
+
keyword: {
|
|
3161
|
+
pattern: /(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,
|
|
3162
|
+
lookbehind: !0
|
|
3163
|
+
},
|
|
3164
|
+
function: [{
|
|
3165
|
+
pattern: /(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,
|
|
3166
|
+
greedy: !0
|
|
3167
|
+
}, {
|
|
3168
|
+
pattern: /(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,
|
|
3169
|
+
lookbehind: !0,
|
|
3170
|
+
greedy: !0
|
|
3171
|
+
}],
|
|
3172
|
+
number: /\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,
|
|
3173
|
+
operator: /\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/
|
|
3174
|
+
}), delete e.languages.kotlin["class-name"];
|
|
3175
|
+
var t = {
|
|
3176
|
+
"interpolation-punctuation": {
|
|
3177
|
+
pattern: /^\$\{?|\}$/,
|
|
3178
|
+
alias: "punctuation"
|
|
3179
|
+
},
|
|
3180
|
+
expression: {
|
|
3181
|
+
pattern: /[\s\S]+/,
|
|
3182
|
+
inside: e.languages.kotlin
|
|
3183
|
+
}
|
|
3184
|
+
};
|
|
3185
|
+
e.languages.insertBefore("kotlin", "string", {
|
|
3186
|
+
"string-literal": [{
|
|
3187
|
+
pattern: /"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,
|
|
3188
|
+
alias: "multiline",
|
|
3189
|
+
inside: {
|
|
3190
|
+
interpolation: {
|
|
3191
|
+
pattern: /\$(?:[a-z_]\w*|\{[^{}]*\})/i,
|
|
3192
|
+
inside: t
|
|
3193
|
+
},
|
|
3194
|
+
string: /[\s\S]+/
|
|
3195
|
+
}
|
|
3196
|
+
}, {
|
|
3197
|
+
pattern: /"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,
|
|
3198
|
+
alias: "singleline",
|
|
3199
|
+
inside: {
|
|
3200
|
+
interpolation: {
|
|
3201
|
+
pattern: /((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,
|
|
3202
|
+
lookbehind: !0,
|
|
3203
|
+
inside: t
|
|
3204
|
+
},
|
|
3205
|
+
string: /[\s\S]+/
|
|
3206
|
+
}
|
|
3207
|
+
}],
|
|
3208
|
+
char: {
|
|
3209
|
+
pattern: /'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,
|
|
3210
|
+
greedy: !0
|
|
3211
|
+
}
|
|
3212
|
+
}), delete e.languages.kotlin.string, e.languages.insertBefore("kotlin", "keyword", { annotation: {
|
|
3213
|
+
pattern: /\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,
|
|
3214
|
+
alias: "builtin"
|
|
3215
|
+
} }), e.languages.insertBefore("kotlin", "function", { label: {
|
|
3216
|
+
pattern: /\b\w+@|@\w+\b/,
|
|
3217
|
+
alias: "symbol"
|
|
3218
|
+
} }), e.languages.kt = e.languages.kotlin, e.languages.kts = e.languages.kotlin;
|
|
3219
|
+
})(Prism), (function(e) {
|
|
3220
|
+
var t = [/\b(?:async|sync|yield)\*/, /\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|covariant|default|deferred|do|dynamic|else|enum|export|extends|extension|external|factory|final|finally|for|get|hide|if|implements|import|in|interface|library|mixin|new|null|on|operator|part|rethrow|return|set|show|static|super|switch|sync|this|throw|try|typedef|var|void|while|with|yield)\b/], n = "(^|[^\\w.])(?:[a-z]\\w*\\s*\\.\\s*)*(?:[A-Z]\\w*\\s*\\.\\s*)*", r = {
|
|
3221
|
+
pattern: RegExp(n + "[A-Z](?:[\\d_A-Z]*[a-z]\\w*)?\\b"),
|
|
3222
|
+
lookbehind: !0,
|
|
3223
|
+
inside: { namespace: {
|
|
3224
|
+
pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
|
|
3225
|
+
inside: { punctuation: /\./ }
|
|
3226
|
+
} }
|
|
3227
|
+
};
|
|
3228
|
+
e.languages.dart = e.languages.extend("clike", {
|
|
3229
|
+
"class-name": [r, {
|
|
3230
|
+
pattern: RegExp(n + "[A-Z]\\w*(?=\\s+\\w+\\s*[;,=()])"),
|
|
3231
|
+
lookbehind: !0,
|
|
3232
|
+
inside: r.inside
|
|
3233
|
+
}],
|
|
3234
|
+
keyword: t,
|
|
3235
|
+
operator: /\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/
|
|
3236
|
+
}), e.languages.insertBefore("dart", "string", {
|
|
3237
|
+
"string-literal": {
|
|
3238
|
+
pattern: /r?(?:("""|''')[\s\S]*?\1|(["'])(?:\\.|(?!\2)[^\\\r\n])*\2(?!\2))/,
|
|
3239
|
+
greedy: !0,
|
|
3240
|
+
inside: {
|
|
3241
|
+
interpolation: {
|
|
3242
|
+
pattern: /((?:^|[^\\])(?:\\{2})*)\$(?:\w+|\{(?:[^{}]|\{[^{}]*\})*\})/,
|
|
3243
|
+
lookbehind: !0,
|
|
3244
|
+
inside: {
|
|
3245
|
+
punctuation: /^\$\{?|\}$/,
|
|
3246
|
+
expression: {
|
|
3247
|
+
pattern: /[\s\S]+/,
|
|
3248
|
+
inside: e.languages.dart
|
|
3249
|
+
}
|
|
3250
|
+
}
|
|
3251
|
+
},
|
|
3252
|
+
string: /[\s\S]+/
|
|
3253
|
+
}
|
|
3254
|
+
},
|
|
3255
|
+
string: void 0
|
|
3256
|
+
}), e.languages.insertBefore("dart", "class-name", { metadata: {
|
|
3257
|
+
pattern: /@\w+/,
|
|
3258
|
+
alias: "function"
|
|
3259
|
+
} }), e.languages.insertBefore("dart", "class-name", { generics: {
|
|
3260
|
+
pattern: /<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<[\w\s,.&?]*>)*>)*>)*>/,
|
|
3261
|
+
inside: {
|
|
3262
|
+
"class-name": r,
|
|
3263
|
+
keyword: t,
|
|
3264
|
+
punctuation: /[<>(),.:]/,
|
|
3265
|
+
operator: /[?&|]/
|
|
3266
|
+
}
|
|
3267
|
+
} });
|
|
3268
|
+
})(Prism), Prism.languages.markup = {
|
|
3269
|
+
comment: {
|
|
3270
|
+
pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
|
|
3271
|
+
greedy: !0
|
|
3272
|
+
},
|
|
3273
|
+
prolog: {
|
|
3274
|
+
pattern: /<\?[\s\S]+?\?>/,
|
|
3275
|
+
greedy: !0
|
|
3276
|
+
},
|
|
3277
|
+
doctype: {
|
|
3278
|
+
pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
|
|
3279
|
+
greedy: !0,
|
|
3280
|
+
inside: {
|
|
3281
|
+
"internal-subset": {
|
|
3282
|
+
pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
|
|
3283
|
+
lookbehind: !0,
|
|
3284
|
+
greedy: !0,
|
|
3285
|
+
inside: null
|
|
3286
|
+
},
|
|
3287
|
+
string: {
|
|
3288
|
+
pattern: /"[^"]*"|'[^']*'/,
|
|
3289
|
+
greedy: !0
|
|
3290
|
+
},
|
|
3291
|
+
punctuation: /^<!|>$|[[\]]/,
|
|
3292
|
+
"doctype-tag": /^DOCTYPE/i,
|
|
3293
|
+
name: /[^\s<>'"]+/
|
|
3294
|
+
}
|
|
3295
|
+
},
|
|
3296
|
+
cdata: {
|
|
3297
|
+
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
3298
|
+
greedy: !0
|
|
3299
|
+
},
|
|
3300
|
+
tag: {
|
|
3301
|
+
pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
|
|
3302
|
+
greedy: !0,
|
|
3303
|
+
inside: {
|
|
3304
|
+
tag: {
|
|
3305
|
+
pattern: /^<\/?[^\s>\/]+/,
|
|
3306
|
+
inside: {
|
|
3307
|
+
punctuation: /^<\/?/,
|
|
3308
|
+
namespace: /^[^\s>\/:]+:/
|
|
3309
|
+
}
|
|
3310
|
+
},
|
|
3311
|
+
"special-attr": [],
|
|
3312
|
+
"attr-value": {
|
|
3313
|
+
pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
|
|
3314
|
+
inside: { punctuation: [{
|
|
3315
|
+
pattern: /^=/,
|
|
3316
|
+
alias: "attr-equals"
|
|
3317
|
+
}, {
|
|
3318
|
+
pattern: /^(\s*)["']|["']$/,
|
|
3319
|
+
lookbehind: !0
|
|
3320
|
+
}] }
|
|
3321
|
+
},
|
|
3322
|
+
punctuation: /\/?>/,
|
|
3323
|
+
"attr-name": {
|
|
3324
|
+
pattern: /[^\s>\/]+/,
|
|
3325
|
+
inside: { namespace: /^[^\s>\/:]+:/ }
|
|
3326
|
+
}
|
|
3327
|
+
}
|
|
3328
|
+
},
|
|
3329
|
+
entity: [{
|
|
3330
|
+
pattern: /&[\da-z]{1,8};/i,
|
|
3331
|
+
alias: "named-entity"
|
|
3332
|
+
}, /&#x?[\da-f]{1,8};/i]
|
|
3333
|
+
}, Prism.languages.markup.tag.inside["attr-value"].inside.entity = Prism.languages.markup.entity, Prism.languages.markup.doctype.inside["internal-subset"].inside = Prism.languages.markup, Prism.hooks.add("wrap", function(e) {
|
|
3334
|
+
e.type === "entity" && (e.attributes.title = e.content.replace(/&/, "&"));
|
|
3335
|
+
}), Object.defineProperty(Prism.languages.markup.tag, "addInlined", { value: function(e, t) {
|
|
3336
|
+
var n = {};
|
|
3337
|
+
n["language-" + t] = {
|
|
3338
|
+
pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
|
|
3339
|
+
lookbehind: !0,
|
|
3340
|
+
inside: Prism.languages[t]
|
|
3341
|
+
}, n.cdata = /^<!\[CDATA\[|\]\]>$/i;
|
|
3342
|
+
var r = { "included-cdata": {
|
|
3343
|
+
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
3344
|
+
inside: n
|
|
3345
|
+
} };
|
|
3346
|
+
r["language-" + t] = {
|
|
3347
|
+
pattern: /[\s\S]+/,
|
|
3348
|
+
inside: Prism.languages[t]
|
|
3349
|
+
};
|
|
3350
|
+
var i = {};
|
|
3351
|
+
i[e] = {
|
|
3352
|
+
pattern: RegExp("(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[\\s\\S])*?(?=<\\/__>)".replace(/__/g, function() {
|
|
3353
|
+
return e;
|
|
3354
|
+
}), "i"),
|
|
3355
|
+
lookbehind: !0,
|
|
3356
|
+
greedy: !0,
|
|
3357
|
+
inside: r
|
|
3358
|
+
}, Prism.languages.insertBefore("markup", "cdata", i);
|
|
3359
|
+
} }), Object.defineProperty(Prism.languages.markup.tag, "addAttribute", { value: function(e, t) {
|
|
3360
|
+
Prism.languages.markup.tag.inside["special-attr"].push({
|
|
3361
|
+
pattern: RegExp("(^|[\"'\\s])(?:" + e + ")\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s'\">=]+(?=[\\s>]))", "i"),
|
|
3362
|
+
lookbehind: !0,
|
|
3363
|
+
inside: {
|
|
3364
|
+
"attr-name": /^[^\s=]+/,
|
|
3365
|
+
"attr-value": {
|
|
3366
|
+
pattern: /=[\s\S]+/,
|
|
3367
|
+
inside: {
|
|
3368
|
+
value: {
|
|
3369
|
+
pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
|
|
3370
|
+
lookbehind: !0,
|
|
3371
|
+
alias: [t, "language-" + t],
|
|
3372
|
+
inside: Prism.languages[t]
|
|
3373
|
+
},
|
|
3374
|
+
punctuation: [{
|
|
3375
|
+
pattern: /^=/,
|
|
3376
|
+
alias: "attr-equals"
|
|
3377
|
+
}, /"|'/]
|
|
3378
|
+
}
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
3381
|
+
});
|
|
3382
|
+
} }), Prism.languages.html = Prism.languages.markup, Prism.languages.mathml = Prism.languages.markup, Prism.languages.svg = Prism.languages.markup, Prism.languages.xml = Prism.languages.extend("markup", {}), Prism.languages.ssml = Prism.languages.xml, Prism.languages.atom = Prism.languages.xml, Prism.languages.rss = Prism.languages.xml;
|
|
3383
|
+
var LANG_ALIASES = {
|
|
3384
|
+
js: "javascript",
|
|
3385
|
+
ts: "typescript",
|
|
3386
|
+
py: "python",
|
|
3387
|
+
rb: "ruby",
|
|
3388
|
+
sh: "bash",
|
|
3389
|
+
shell: "bash",
|
|
3390
|
+
zsh: "bash",
|
|
3391
|
+
yml: "yaml",
|
|
3392
|
+
html: "markup",
|
|
3393
|
+
xml: "markup",
|
|
3394
|
+
svg: "markup",
|
|
3395
|
+
cs: "csharp",
|
|
3396
|
+
"c++": "cpp",
|
|
3397
|
+
"objective-c": "c",
|
|
3398
|
+
objc: "c",
|
|
3399
|
+
jsonc: "json"
|
|
3400
|
+
};
|
|
3401
|
+
function escapeHtml$1(e) {
|
|
3402
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
3403
|
+
}
|
|
3404
|
+
function highlightCode(e, t) {
|
|
3405
|
+
if (!t) return escapeHtml$1(e);
|
|
3406
|
+
let n = t.toLowerCase().trim(), r = LANG_ALIASES[n] || n, i = import_prism.default.languages[r];
|
|
3407
|
+
if (!i) return escapeHtml$1(e);
|
|
3408
|
+
try {
|
|
3409
|
+
return import_prism.default.highlight(e, i, r);
|
|
3410
|
+
} catch {
|
|
3411
|
+
return escapeHtml$1(e);
|
|
3412
|
+
}
|
|
3413
|
+
}
|
|
3414
|
+
function getLanguageDisplayName(e) {
|
|
3415
|
+
return {
|
|
3416
|
+
javascript: "JavaScript",
|
|
3417
|
+
typescript: "TypeScript",
|
|
3418
|
+
python: "Python",
|
|
3419
|
+
bash: "Bash",
|
|
3420
|
+
json: "JSON",
|
|
3421
|
+
css: "CSS",
|
|
3422
|
+
html: "HTML",
|
|
3423
|
+
jsx: "JSX",
|
|
3424
|
+
tsx: "TSX",
|
|
3425
|
+
sql: "SQL",
|
|
3426
|
+
yaml: "YAML",
|
|
3427
|
+
rust: "Rust",
|
|
3428
|
+
go: "Go",
|
|
3429
|
+
java: "Java",
|
|
3430
|
+
c: "C",
|
|
3431
|
+
cpp: "C++",
|
|
3432
|
+
csharp: "C#",
|
|
3433
|
+
ruby: "Ruby",
|
|
3434
|
+
php: "PHP",
|
|
3435
|
+
swift: "Swift",
|
|
3436
|
+
kotlin: "Kotlin",
|
|
3437
|
+
dart: "Dart",
|
|
3438
|
+
markdown: "Markdown",
|
|
3439
|
+
markup: "HTML"
|
|
3440
|
+
}[LANG_ALIASES[e.toLowerCase()] || e.toLowerCase()] || e;
|
|
3441
|
+
}
|
|
3442
|
+
var COLORS = [
|
|
3443
|
+
"#6366f1",
|
|
3444
|
+
"#8b5cf6",
|
|
3445
|
+
"#a855f7",
|
|
3446
|
+
"#d946ef",
|
|
3447
|
+
"#ec4899",
|
|
3448
|
+
"#f43f5e",
|
|
3449
|
+
"#ef4444",
|
|
3450
|
+
"#f97316",
|
|
3451
|
+
"#eab308",
|
|
3452
|
+
"#84cc16",
|
|
3453
|
+
"#22c55e",
|
|
3454
|
+
"#14b8a6",
|
|
3455
|
+
"#06b6d4",
|
|
3456
|
+
"#3b82f6",
|
|
3457
|
+
"#2563eb"
|
|
3458
|
+
], NODE_COLORS = {
|
|
3459
|
+
fill: "#e0e7ff",
|
|
3460
|
+
stroke: "#6366f1",
|
|
3461
|
+
text: "#1e1b4b",
|
|
3462
|
+
bg: "#f8fafc"
|
|
3463
|
+
};
|
|
3464
|
+
function escapeXml(e) {
|
|
3465
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
3466
|
+
}
|
|
3467
|
+
function measureText(e, t = 14) {
|
|
3468
|
+
return e.length * t * .6 + 20;
|
|
3469
|
+
}
|
|
3470
|
+
function parseFlowchart(e) {
|
|
3471
|
+
let t = /* @__PURE__ */ new Map(), n = [], r = "TB", i = (e[0]?.trim() || "").match(/^(?:graph|flowchart)\s+(TB|BT|LR|RL)/i);
|
|
3472
|
+
i && (r = i[1].toUpperCase());
|
|
3473
|
+
let a = /^(\w+)(\[([^\]]*)\]|\(([^)]*)\)|\{([^}]*)\}|>([^\]]*)\]|\[\[([^\]]*)\]\]|\(\(([^)]*)\)\)|\[\/([^\]]*)\\\]|\[\(([^)]*)\)\])/;
|
|
3474
|
+
function o(e, n, r) {
|
|
3475
|
+
if (!t.has(e)) t.set(e, {
|
|
3476
|
+
id: e,
|
|
3477
|
+
label: n || e,
|
|
3478
|
+
shape: r || "rect",
|
|
3479
|
+
x: 0,
|
|
3480
|
+
y: 0,
|
|
3481
|
+
width: 0,
|
|
3482
|
+
height: 0
|
|
3483
|
+
});
|
|
3484
|
+
else if (n) {
|
|
3485
|
+
let i = t.get(e);
|
|
3486
|
+
i.label = n, r && (i.shape = r);
|
|
3487
|
+
}
|
|
3488
|
+
}
|
|
3489
|
+
function s(e) {
|
|
3490
|
+
e = e.trim();
|
|
3491
|
+
let t = e.match(a);
|
|
3492
|
+
if (t) {
|
|
3493
|
+
let e = t[1];
|
|
3494
|
+
if (t[3] !== void 0) return {
|
|
3495
|
+
id: e,
|
|
3496
|
+
label: t[3],
|
|
3497
|
+
shape: "rect"
|
|
3498
|
+
};
|
|
3499
|
+
if (t[4] !== void 0) return {
|
|
3500
|
+
id: e,
|
|
3501
|
+
label: t[4],
|
|
3502
|
+
shape: "round"
|
|
3503
|
+
};
|
|
3504
|
+
if (t[5] !== void 0) return {
|
|
3505
|
+
id: e,
|
|
3506
|
+
label: t[5],
|
|
3507
|
+
shape: "diamond"
|
|
3508
|
+
};
|
|
3509
|
+
if (t[6] !== void 0) return {
|
|
3510
|
+
id: e,
|
|
3511
|
+
label: t[6],
|
|
3512
|
+
shape: "stadium"
|
|
3513
|
+
};
|
|
3514
|
+
if (t[7] !== void 0) return {
|
|
3515
|
+
id: e,
|
|
3516
|
+
label: t[7],
|
|
3517
|
+
shape: "rect"
|
|
3518
|
+
};
|
|
3519
|
+
if (t[8] !== void 0) return {
|
|
3520
|
+
id: e,
|
|
3521
|
+
label: t[8],
|
|
3522
|
+
shape: "circle"
|
|
3523
|
+
};
|
|
3524
|
+
if (t[9] !== void 0) return {
|
|
3525
|
+
id: e,
|
|
3526
|
+
label: t[9],
|
|
3527
|
+
shape: "parallelogram"
|
|
3528
|
+
};
|
|
3529
|
+
if (t[10] !== void 0) return {
|
|
3530
|
+
id: e,
|
|
3531
|
+
label: t[10],
|
|
3532
|
+
shape: "cylinder"
|
|
3533
|
+
};
|
|
3534
|
+
}
|
|
3535
|
+
let n = e.replace(/\s+/g, "");
|
|
3536
|
+
return {
|
|
3537
|
+
id: n,
|
|
3538
|
+
label: n,
|
|
3539
|
+
shape: "rect"
|
|
3540
|
+
};
|
|
3541
|
+
}
|
|
3542
|
+
for (let t = 1; t < e.length; t++) {
|
|
3543
|
+
let r = e[t].trim();
|
|
3544
|
+
if (!r || r.startsWith("%%") || r.startsWith("style") || r.startsWith("class") || r.startsWith("click")) continue;
|
|
3545
|
+
let i = r.match(/^(.+?)\s*(-->|---|-\.->|-\.{2,}->|==>|-.->|--\>|--)\s*(?:\|([^|]*)\|)?\s*(.+?)$/);
|
|
3546
|
+
if (i) {
|
|
3547
|
+
let e = i[1].trim(), t = i[2], r = i[3]?.trim() || "", a = i[4].trim(), c = s(e), l = s(a);
|
|
3548
|
+
o(c.id, c.label, c.shape), o(l.id, l.label, l.shape);
|
|
3549
|
+
let u = "solid", d = !0;
|
|
3550
|
+
t === "---" ? (d = !1, u = "solid") : t.includes("-.") || t.includes("..") ? u = "dotted" : t === "==>" && (u = "thick"), n.push({
|
|
3551
|
+
from: c.id,
|
|
3552
|
+
to: l.id,
|
|
3553
|
+
label: r,
|
|
3554
|
+
style: u,
|
|
3555
|
+
arrow: d
|
|
3556
|
+
});
|
|
3557
|
+
} else {
|
|
3558
|
+
let e = s(r);
|
|
3559
|
+
e.id && o(e.id, e.label, e.shape);
|
|
3560
|
+
}
|
|
3561
|
+
}
|
|
3562
|
+
return {
|
|
3563
|
+
nodes: Array.from(t.values()),
|
|
3564
|
+
edges: n,
|
|
3565
|
+
direction: r
|
|
3566
|
+
};
|
|
3567
|
+
}
|
|
3568
|
+
function layoutFlowchart(e, t, n) {
|
|
3569
|
+
if (e.length === 0) return {
|
|
3570
|
+
width: 200,
|
|
3571
|
+
height: 100
|
|
3572
|
+
};
|
|
3573
|
+
let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
3574
|
+
for (let t of e) r.set(t.id, []), i.set(t.id, 0);
|
|
3575
|
+
for (let e of t) r.get(e.from)?.push(e.to), i.set(e.to, (i.get(e.to) || 0) + 1);
|
|
3576
|
+
let a = [], o = /* @__PURE__ */ new Set(), s = [];
|
|
3577
|
+
for (let t of e) (i.get(t.id) || 0) === 0 && s.push(t.id);
|
|
3578
|
+
for (s.length === 0 && e.length > 0 && s.push(e[0].id); s.length > 0;) {
|
|
3579
|
+
let e = [...s];
|
|
3580
|
+
a.push(e), s.length = 0;
|
|
3581
|
+
for (let t of e) {
|
|
3582
|
+
o.add(t);
|
|
3583
|
+
for (let e of r.get(t) || []) if (!o.has(e)) {
|
|
3584
|
+
let t = (i.get(e) || 1) - 1;
|
|
3585
|
+
i.set(e, t), t <= 0 && s.push(e);
|
|
3586
|
+
}
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
for (let t of e) o.has(t.id) || a.push([t.id]);
|
|
3590
|
+
let c = n === "LR" || n === "RL", l = new Map(e.map((e) => [e.id, e]));
|
|
3591
|
+
for (let e = 0; e < a.length; e++) {
|
|
3592
|
+
let t = a[e], n = t.length;
|
|
3593
|
+
for (let r = 0; r < n; r++) {
|
|
3594
|
+
let i = l.get(t[r]);
|
|
3595
|
+
i && (i.width = Math.max(140, measureText(i.label)), i.height = 50, c ? (i.x = e * 200 + 40, i.y = r * 110 + 40 - (n - 1) * 110 / 2 + 200) : (i.x = r * 200 + 40 - (n - 1) * 200 / 2 + 400, i.y = e * 110 + 40));
|
|
3596
|
+
}
|
|
3597
|
+
}
|
|
3598
|
+
let u = Infinity, d = Infinity, f = -Infinity, p = -Infinity;
|
|
3599
|
+
for (let t of e) u = Math.min(u, t.x), d = Math.min(d, t.y), f = Math.max(f, t.x + t.width), p = Math.max(p, t.y + t.height);
|
|
3600
|
+
for (let t of e) t.x -= u - 40, t.y -= d - 40;
|
|
3601
|
+
return {
|
|
3602
|
+
width: f - u + 80,
|
|
3603
|
+
height: p - d + 80
|
|
3604
|
+
};
|
|
3605
|
+
}
|
|
3606
|
+
function renderFlowchartSVG(e) {
|
|
3607
|
+
let { nodes: t, edges: n, direction: r } = parseFlowchart(e.split("\n").filter((e) => e.trim())), { width: i, height: a } = layoutFlowchart(t, n, r), o = new Map(t.map((e) => [e.id, e])), s = "";
|
|
3608
|
+
s += `<defs>
|
|
3609
|
+
<marker id="arrowhead" markerWidth="10" markerHeight="7" refX="10" refY="3.5" orient="auto">
|
|
3610
|
+
<polygon points="0 0, 10 3.5, 0 7" fill="${NODE_COLORS.stroke}" />
|
|
3611
|
+
</marker>
|
|
3612
|
+
<marker id="arrowhead-thick" markerWidth="10" markerHeight="7" refX="10" refY="3.5" orient="auto">
|
|
3613
|
+
<polygon points="0 0, 10 3.5, 0 7" fill="${NODE_COLORS.stroke}" />
|
|
3614
|
+
</marker>
|
|
3615
|
+
</defs>`;
|
|
3616
|
+
for (let e of n) {
|
|
3617
|
+
let t = o.get(e.from), n = o.get(e.to);
|
|
3618
|
+
if (!t || !n) continue;
|
|
3619
|
+
let r = t.x + t.width / 2, i = t.y + t.height / 2, a = n.x + n.width / 2, c = n.y + n.height / 2, l = Math.atan2(c - i, a - r), u = r + Math.cos(l) * (t.width / 2), d = i + Math.sin(l) * (t.height / 2), f = a - Math.cos(l) * (n.width / 2), p = c - Math.sin(l) * (n.height / 2), m = e.style === "dotted" ? "stroke-dasharray=\"5,5\"" : "", h = e.style === "thick" ? "3" : "1.5", g = e.arrow ? "marker-end=\"url(#arrowhead)\"" : "";
|
|
3620
|
+
if (s += `<line x1="${u}" y1="${d}" x2="${f}" y2="${p}"
|
|
3621
|
+
stroke="${NODE_COLORS.stroke}" stroke-width="${h}" ${m} ${g} />`, e.label) {
|
|
3622
|
+
let t = (u + f) / 2, n = (d + p) / 2;
|
|
3623
|
+
s += `<rect x="${t - measureText(e.label, 11) / 2}" y="${n - 10}" width="${measureText(e.label, 11)}" height="20" fill="white" rx="3" />`, s += `<text x="${t}" y="${n + 4}" text-anchor="middle" font-size="11" fill="${NODE_COLORS.text}">${escapeXml(e.label)}</text>`;
|
|
3624
|
+
}
|
|
3625
|
+
}
|
|
3626
|
+
for (let e of t) {
|
|
3627
|
+
let t = e.x + e.width / 2, n = e.y + e.height / 2;
|
|
3628
|
+
switch (e.shape) {
|
|
3629
|
+
case "round":
|
|
3630
|
+
s += `<rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}"
|
|
3631
|
+
rx="15" ry="15" fill="${NODE_COLORS.fill}" stroke="${NODE_COLORS.stroke}" stroke-width="2" />`;
|
|
3632
|
+
break;
|
|
3633
|
+
case "diamond":
|
|
3634
|
+
s += `<polygon points="${t},${e.y} ${e.x + e.width},${n} ${t},${e.y + e.height} ${e.x},${n}"
|
|
3635
|
+
fill="${NODE_COLORS.fill}" stroke="${NODE_COLORS.stroke}" stroke-width="2" />`;
|
|
3636
|
+
break;
|
|
3637
|
+
case "circle":
|
|
3638
|
+
let r = Math.max(e.width, e.height) / 2;
|
|
3639
|
+
s += `<circle cx="${t}" cy="${n}" r="${r}" fill="${NODE_COLORS.fill}" stroke="${NODE_COLORS.stroke}" stroke-width="2" />`;
|
|
3640
|
+
break;
|
|
3641
|
+
case "stadium":
|
|
3642
|
+
s += `<rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}"
|
|
3643
|
+
rx="${e.height / 2}" ry="${e.height / 2}" fill="${NODE_COLORS.fill}" stroke="${NODE_COLORS.stroke}" stroke-width="2" />`;
|
|
3644
|
+
break;
|
|
3645
|
+
default: s += `<rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}"
|
|
3646
|
+
rx="5" ry="5" fill="${NODE_COLORS.fill}" stroke="${NODE_COLORS.stroke}" stroke-width="2" />`;
|
|
3647
|
+
}
|
|
3648
|
+
s += `<text x="${t}" y="${n + 5}" text-anchor="middle" font-size="13" font-family="system-ui, sans-serif" fill="${NODE_COLORS.text}">${escapeXml(e.label)}</text>`;
|
|
3649
|
+
}
|
|
3650
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${i} ${a}" width="100%" class="mermaid-svg" style="max-width:${i}px;">
|
|
3651
|
+
<rect width="100%" height="100%" fill="${NODE_COLORS.bg}" rx="8" />
|
|
3652
|
+
${s}
|
|
3653
|
+
</svg>`;
|
|
3654
|
+
}
|
|
3655
|
+
function renderSequenceDiagram(e) {
|
|
3656
|
+
let t = e.split("\n").map((e) => e.trim()).filter((e) => e && !e.startsWith("%%")), n = [], r = [], i = /* @__PURE__ */ new Map();
|
|
3657
|
+
function a(e, t) {
|
|
3658
|
+
if (i.has(e)) t && (i.get(e).label = t);
|
|
3659
|
+
else {
|
|
3660
|
+
let r = {
|
|
3661
|
+
id: e,
|
|
3662
|
+
label: t || e,
|
|
3663
|
+
x: 0
|
|
3664
|
+
};
|
|
3665
|
+
n.push(r), i.set(e, r);
|
|
3666
|
+
}
|
|
3667
|
+
}
|
|
3668
|
+
for (let e = 1; e < t.length; e++) {
|
|
3669
|
+
let n = t[e], i = n.match(/^participant\s+(\w+)(?:\s+as\s+(.+))?$/i);
|
|
3670
|
+
if (i) {
|
|
3671
|
+
a(i[1], i[2] || i[1]);
|
|
3672
|
+
continue;
|
|
3673
|
+
}
|
|
3674
|
+
let o = n.match(/^actor\s+(\w+)(?:\s+as\s+(.+))?$/i);
|
|
3675
|
+
if (o) {
|
|
3676
|
+
a(o[1], o[2] || o[1]);
|
|
3677
|
+
continue;
|
|
3678
|
+
}
|
|
3679
|
+
let s = n.match(/^(\w+)\s*(--?>>?|--?>>?-|->|-->)\s*(\w+)\s*:\s*(.*)$/);
|
|
3680
|
+
if (s) {
|
|
3681
|
+
let e = s[1], t = s[2], n = s[3], i = s[4];
|
|
3682
|
+
a(e), a(n), r.push({
|
|
3683
|
+
from: e,
|
|
3684
|
+
to: n,
|
|
3685
|
+
label: i,
|
|
3686
|
+
style: t.startsWith("--") ? "dashed" : "solid",
|
|
3687
|
+
arrow: t.includes(">>") ? "filled" : "open"
|
|
3688
|
+
});
|
|
3689
|
+
}
|
|
3690
|
+
}
|
|
3691
|
+
n.forEach((e, t) => {
|
|
3692
|
+
e.x = 30 + t * 160 + 120 / 2;
|
|
3693
|
+
});
|
|
3694
|
+
let o = n.length * 160 + 30, s = 140 + r.length * 50 + 40, c = "";
|
|
3695
|
+
for (let e of n) c += `<rect x="${e.x - 120 / 2}" y="30" width="120" height="40"
|
|
3696
|
+
rx="5" fill="${NODE_COLORS.fill}" stroke="${NODE_COLORS.stroke}" stroke-width="2" />`, c += `<text x="${e.x}" y="55" text-anchor="middle" font-size="13" font-family="system-ui, sans-serif" fill="${NODE_COLORS.text}">${escapeXml(e.label)}</text>`;
|
|
3697
|
+
let l = s - 30 - 40;
|
|
3698
|
+
for (let e of n) c += `<line x1="${e.x}" y1="70" x2="${e.x}" y2="${l}"
|
|
3699
|
+
stroke="#cbd5e1" stroke-width="1" stroke-dasharray="4,4" />`;
|
|
3700
|
+
for (let e = 0; e < r.length; e++) {
|
|
3701
|
+
let t = r[e], n = i.get(t.from), a = i.get(t.to);
|
|
3702
|
+
if (!n || !a) continue;
|
|
3703
|
+
let o = 100 + e * 50, s = n.x, l = a.x, u = t.style === "dashed" ? "stroke-dasharray=\"5,5\"" : "";
|
|
3704
|
+
s === l ? c += `<path d="M ${s} ${o} C ${s + 40} ${o}, ${s + 40} ${o + 20}, ${s} ${o + 20}"
|
|
3705
|
+
fill="none" stroke="${NODE_COLORS.stroke}" stroke-width="1.5" ${u} marker-end="url(#arrowhead)" />` : c += `<line x1="${s}" y1="${o}" x2="${l}" y2="${o}"
|
|
3706
|
+
stroke="${NODE_COLORS.stroke}" stroke-width="1.5" ${u} marker-end="url(#arrowhead)" />`;
|
|
3707
|
+
let d = (s + l) / 2;
|
|
3708
|
+
c += `<text x="${d}" y="${o - 8}" text-anchor="middle" font-size="12" font-family="system-ui, sans-serif" fill="${NODE_COLORS.text}">${escapeXml(t.label)}</text>`;
|
|
3709
|
+
}
|
|
3710
|
+
for (let e of n) c += `<rect x="${e.x - 120 / 2}" y="${l}" width="120" height="40"
|
|
3711
|
+
rx="5" fill="${NODE_COLORS.fill}" stroke="${NODE_COLORS.stroke}" stroke-width="2" />`, c += `<text x="${e.x}" y="${l + 40 / 2 + 5}" text-anchor="middle" font-size="13" font-family="system-ui, sans-serif" fill="${NODE_COLORS.text}">${escapeXml(e.label)}</text>`;
|
|
3712
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${o} ${s}" width="100%" class="mermaid-svg" style="max-width:${o}px;">
|
|
3713
|
+
<defs>
|
|
3714
|
+
<marker id="arrowhead" markerWidth="10" markerHeight="7" refX="10" refY="3.5" orient="auto">
|
|
3715
|
+
<polygon points="0 0, 10 3.5, 0 7" fill="${NODE_COLORS.stroke}" />
|
|
3716
|
+
</marker>
|
|
3717
|
+
</defs>
|
|
3718
|
+
<rect width="100%" height="100%" fill="${NODE_COLORS.bg}" rx="8" />
|
|
3719
|
+
${c}
|
|
3720
|
+
</svg>`;
|
|
3721
|
+
}
|
|
3722
|
+
function renderPieChart(e) {
|
|
3723
|
+
let t = e.split("\n").map((e) => e.trim()).filter((e) => e && !e.startsWith("%%")), n = [], r = "";
|
|
3724
|
+
for (let e of t) {
|
|
3725
|
+
if (e.toLowerCase().startsWith("pie")) continue;
|
|
3726
|
+
let t = e.match(/^title\s+(.+)$/i);
|
|
3727
|
+
if (t) {
|
|
3728
|
+
r = t[1];
|
|
3729
|
+
continue;
|
|
3730
|
+
}
|
|
3731
|
+
let i = e.match(/^"([^"]+)"\s*:\s*(\d+(?:\.\d+)?)$/);
|
|
3732
|
+
i && n.push({
|
|
3733
|
+
label: i[1],
|
|
3734
|
+
value: parseFloat(i[2]),
|
|
3735
|
+
color: COLORS[n.length % COLORS.length]
|
|
3736
|
+
});
|
|
3737
|
+
}
|
|
3738
|
+
let i = n.reduce((e, t) => e + t.value, 0);
|
|
3739
|
+
if (i === 0) return "<div class=\"mermaid-error\">No data for pie chart</div>";
|
|
3740
|
+
let a = "";
|
|
3741
|
+
r && (a += `<text x="150" y="20" text-anchor="middle" font-size="16" font-weight="bold" font-family="system-ui, sans-serif" fill="${NODE_COLORS.text}">${escapeXml(r)}</text>`);
|
|
3742
|
+
let o = -Math.PI / 2;
|
|
3743
|
+
for (let e of n) {
|
|
3744
|
+
let t = e.value / i * 2 * Math.PI, n = 150 + 120 * Math.cos(o), r = 150 + 120 * Math.sin(o), s = 150 + 120 * Math.cos(o + t), c = 150 + 120 * Math.sin(o + t), l = t > Math.PI ? 1 : 0;
|
|
3745
|
+
a += `<path d="M 150 150 L ${n} ${r} A 120 120 0 ${l} 1 ${s} ${c} Z"
|
|
3746
|
+
fill="${e.color}" stroke="white" stroke-width="2" />`;
|
|
3747
|
+
let u = o + t / 2, d = 150 + 78 * Math.cos(u), f = 150 + 78 * Math.sin(u), p = Math.round(e.value / i * 100);
|
|
3748
|
+
p > 5 && (a += `<text x="${d}" y="${f + 4}" text-anchor="middle" font-size="12" font-weight="bold" font-family="system-ui, sans-serif" fill="white">${p}%</text>`), o += t;
|
|
3749
|
+
}
|
|
3750
|
+
for (let e = 0; e < n.length; e++) {
|
|
3751
|
+
let t = 50 + e * 25;
|
|
3752
|
+
a += `<rect x="320" y="${t - 8}" width="14" height="14" rx="3" fill="${n[e].color}" />`, a += `<text x="342" y="${t + 4}" font-size="12" font-family="system-ui, sans-serif" fill="${NODE_COLORS.text}">${escapeXml(n[e].label)} (${Math.round(n[e].value / i * 100)}%)</text>`;
|
|
3753
|
+
}
|
|
3754
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 520 ${Math.max(300, n.length * 25 + 80)}" width="100%" class="mermaid-svg" style="max-width:520px;">
|
|
3755
|
+
<rect width="100%" height="100%" fill="${NODE_COLORS.bg}" rx="8" />
|
|
3756
|
+
${a}
|
|
3757
|
+
</svg>`;
|
|
3758
|
+
}
|
|
3759
|
+
function renderMermaid(e) {
|
|
3760
|
+
let t = e.trim(), n = t.split("\n")[0].trim().toLowerCase();
|
|
3761
|
+
try {
|
|
3762
|
+
return n.startsWith("graph") || n.startsWith("flowchart") ? renderFlowchartSVG(t) : n.startsWith("sequencediagram") || n.startsWith("sequence") ? renderSequenceDiagram(t) : n.startsWith("pie") ? renderPieChart(t) : `<div class="mermaid-fallback">
|
|
3763
|
+
<div style="padding:16px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;font-family:monospace;font-size:13px;white-space:pre-wrap;color:#475569;">
|
|
3764
|
+
<div style="font-weight:600;margin-bottom:8px;color:#6366f1;">📊 Mermaid Diagram</div>
|
|
3765
|
+
${escapeXml(t)}
|
|
3766
|
+
</div>
|
|
3767
|
+
</div>`;
|
|
3768
|
+
} catch {
|
|
3769
|
+
return "<div class=\"mermaid-error\" style=\"padding:16px;background:#fef2f2;border:1px solid #fecaca;border-radius:8px;color:#991b1b;\">\n Error rendering diagram\n </div>";
|
|
3770
|
+
}
|
|
3771
|
+
}
|
|
3772
|
+
var DEFAULT_OPTIONS = {
|
|
3773
|
+
math: !0,
|
|
3774
|
+
highlight: !0,
|
|
3775
|
+
mermaid: !0,
|
|
3776
|
+
tables: !0,
|
|
3777
|
+
classPrefix: "sd",
|
|
3778
|
+
onCodeBlock: () => {},
|
|
3779
|
+
onUpdate: () => {},
|
|
3780
|
+
streaming: !0,
|
|
3781
|
+
cursor: "▋",
|
|
3782
|
+
gfm: !0
|
|
3783
|
+
};
|
|
3784
|
+
function escapeHtml(e) {
|
|
3785
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
3786
|
+
}
|
|
3787
|
+
function processInline(e, t) {
|
|
3788
|
+
let n = e;
|
|
3789
|
+
return n = n.replace(/`([^`]+)`/g, "<code class=\"sd-inline-code\">$1</code>"), t.math && !t.streaming && (n = n.replace(/(?<!\$)\$(?!\$)(.+?)(?<!\$)\$(?!\$)/g, (e, t) => renderInlineMath(t))), n = n.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, "<img src=\"$2\" alt=\"$1\" class=\"sd-image\" loading=\"lazy\" />"), n = n.replace(/\[([^\]]+)\]\(([^)]+)\)/g, "<a href=\"$2\" class=\"sd-link\" target=\"_blank\" rel=\"noopener noreferrer\">$1</a>"), n = n.replace(/\*\*\*(.+?)\*\*\*/g, "<strong><em>$1</em></strong>"), n = n.replace(/___(.+?)___/g, "<strong><em>$1</em></strong>"), n = n.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>"), n = n.replace(/__(.+?)__/g, "<strong>$1</strong>"), n = n.replace(/(?<!\*)\*(?!\*)(.+?)(?<!\*)\*(?!\*)/g, "<em>$1</em>"), n = n.replace(/(?<!_)_(?!_)(.+?)(?<!_)_(?!_)/g, "<em>$1</em>"), t.gfm && (n = n.replace(/~~(.+?)~~/g, "<del>$1</del>")), n = n.replace(/\^([^\s^]+)\^/g, "<sup>$1</sup>"), n = n.replace(/==(.+?)==/g, "<mark>$1</mark>"), n;
|
|
3790
|
+
}
|
|
3791
|
+
function renderTable(e) {
|
|
3792
|
+
if (e.length < 2) return "";
|
|
3793
|
+
let t = (e) => e.replace(/^\|/, "").replace(/\|$/, "").split("|").map((e) => e.trim()), n = t(e[0]), r = t(e[1]).map((e) => e.startsWith(":") && e.endsWith(":") ? "center" : e.endsWith(":") ? "right" : "left"), i = "<div class=\"sd-table-wrapper\"><table class=\"sd-table\"><thead><tr>";
|
|
3794
|
+
for (let e = 0; e < n.length; e++) i += `<th style="text-align:${r[e] || "left"}">${n[e]}</th>`;
|
|
3795
|
+
i += "</tr></thead><tbody>";
|
|
3796
|
+
for (let a = 2; a < e.length; a++) {
|
|
3797
|
+
let o = t(e[a]);
|
|
3798
|
+
i += "<tr>";
|
|
3799
|
+
for (let e = 0; e < n.length; e++) i += `<td style="text-align:${r[e] || "left"}">${o[e] || ""}</td>`;
|
|
3800
|
+
i += "</tr>";
|
|
3801
|
+
}
|
|
3802
|
+
return i += "</tbody></table></div>", i;
|
|
3803
|
+
}
|
|
3804
|
+
function render(e, t) {
|
|
3805
|
+
let n = {
|
|
3806
|
+
...DEFAULT_OPTIONS,
|
|
3807
|
+
...t
|
|
3808
|
+
}, r = e.split("\n"), i = [], a = 0, o = !1;
|
|
3809
|
+
function s() {
|
|
3810
|
+
o &&= (i.push("</p>"), !1);
|
|
3811
|
+
}
|
|
3812
|
+
for (; a < r.length;) {
|
|
3813
|
+
let e = r[a], t = e.trimEnd();
|
|
3814
|
+
if (t === "") {
|
|
3815
|
+
s(), a++;
|
|
3816
|
+
continue;
|
|
3817
|
+
}
|
|
3818
|
+
if (n.math && t.startsWith("$$")) {
|
|
3819
|
+
s();
|
|
3820
|
+
let e = [];
|
|
3821
|
+
if (t.length > 2 && t.endsWith("$$") && t !== "$$") {
|
|
3822
|
+
let e = t.slice(2, -2).trim();
|
|
3823
|
+
i.push(`<div class="sd-math-display">${renderDisplayMath(e)}</div>`), a++;
|
|
3824
|
+
continue;
|
|
3825
|
+
}
|
|
3826
|
+
for (a++; a < r.length && !r[a].trimEnd().startsWith("$$");) e.push(r[a]), a++;
|
|
3827
|
+
a < r.length && a++;
|
|
3828
|
+
let n = e.join("\n").trim();
|
|
3829
|
+
i.push(`<div class="sd-math-display">${renderDisplayMath(n)}</div>`);
|
|
3830
|
+
continue;
|
|
3831
|
+
}
|
|
3832
|
+
if (t.startsWith("```")) {
|
|
3833
|
+
s();
|
|
3834
|
+
let e = t.slice(3).trim(), o = [];
|
|
3835
|
+
for (a++; a < r.length && !r[a].trimEnd().startsWith("```");) o.push(r[a]), a++;
|
|
3836
|
+
a < r.length && a++;
|
|
3837
|
+
let c = o.join("\n");
|
|
3838
|
+
if (n.mermaid && e.toLowerCase() === "mermaid") {
|
|
3839
|
+
i.push(`<div class="sd-mermaid">${renderMermaid(c)}</div>`);
|
|
3840
|
+
continue;
|
|
3841
|
+
}
|
|
3842
|
+
let l = n.highlight ? highlightCode(c, e) : escapeHtml(c), u = e ? getLanguageDisplayName(e) : "", d = u ? `<div class="sd-code-lang">${escapeHtml(u)}</div>` : "";
|
|
3843
|
+
i.push(`<div class="sd-code-block">${d}<pre class="sd-pre"><code class="language-${escapeHtml(e || "text")}">${l}</code></pre></div>`), e && c && n.onCodeBlock(e, c);
|
|
3844
|
+
continue;
|
|
3845
|
+
}
|
|
3846
|
+
let c = t.match(/^(#{1,6})\s+(.+)$/);
|
|
3847
|
+
if (c) {
|
|
3848
|
+
s();
|
|
3849
|
+
let e = c[1].length, t = processInline(c[2], n), r = c[2].toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
|
|
3850
|
+
i.push(`<h${e} id="${r}" class="sd-h${e}">${t}</h${e}>`), a++;
|
|
3851
|
+
continue;
|
|
3852
|
+
}
|
|
3853
|
+
if (/^(-{3,}|\*{3,}|_{3,})$/.test(t)) {
|
|
3854
|
+
s(), i.push("<hr class=\"sd-hr\" />"), a++;
|
|
3855
|
+
continue;
|
|
3856
|
+
}
|
|
3857
|
+
if (t.startsWith(">")) {
|
|
3858
|
+
s();
|
|
3859
|
+
let e = [];
|
|
3860
|
+
for (; a < r.length && (r[a].trimEnd().startsWith(">") || r[a].trim() !== "" && e.length > 0);) {
|
|
3861
|
+
let t = r[a].trimEnd();
|
|
3862
|
+
if (t.startsWith(">")) e.push(t.replace(/^>\s?/, ""));
|
|
3863
|
+
else if (t.trim() === "") break;
|
|
3864
|
+
else e.push(t);
|
|
3865
|
+
a++;
|
|
3866
|
+
}
|
|
3867
|
+
let t = render(e.join("\n"), n), o = e[0]?.match(/^\[!(NOTE|TIP|WARNING|CAUTION|IMPORTANT)\]\s*(.*)$/i);
|
|
3868
|
+
if (o) {
|
|
3869
|
+
let t = o[1].toLowerCase(), r = o[2] || o[1], a = render(e.slice(1).join("\n"), n);
|
|
3870
|
+
i.push(`<div class="sd-callout sd-callout-${t}"><div class="sd-callout-title">${{
|
|
3871
|
+
note: "📝",
|
|
3872
|
+
tip: "💡",
|
|
3873
|
+
warning: "⚠️",
|
|
3874
|
+
caution: "🔴",
|
|
3875
|
+
important: "❗"
|
|
3876
|
+
}[t] || "📌"} ${escapeHtml(r)}</div><div class="sd-callout-body">${a}</div></div>`);
|
|
3877
|
+
} else i.push(`<blockquote class="sd-blockquote">${t}</blockquote>`);
|
|
3878
|
+
continue;
|
|
3879
|
+
}
|
|
3880
|
+
if (n.tables && t.includes("|") && a + 1 < r.length && /^\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)*\|?\s*$/.test(r[a + 1]?.trimEnd() || "")) {
|
|
3881
|
+
s();
|
|
3882
|
+
let e = [];
|
|
3883
|
+
for (; a < r.length && r[a].trimEnd().includes("|");) e.push(r[a].trimEnd()), a++;
|
|
3884
|
+
i.push(renderTable(e));
|
|
3885
|
+
continue;
|
|
3886
|
+
}
|
|
3887
|
+
if (/^(\s*)([-*+])\s/.test(e)) {
|
|
3888
|
+
s();
|
|
3889
|
+
let e = [];
|
|
3890
|
+
for (; a < r.length;) {
|
|
3891
|
+
let t = r[a].match(/^(\s*)([-*+])\s(.*)$/);
|
|
3892
|
+
if (t) {
|
|
3893
|
+
let r = t[1].length, i = t[3], o;
|
|
3894
|
+
if (n.gfm) {
|
|
3895
|
+
let e = i.match(/^\[([ xX])\]\s(.*)/);
|
|
3896
|
+
e && (o = e[1] !== " ", i = e[2]);
|
|
3897
|
+
}
|
|
3898
|
+
e.push({
|
|
3899
|
+
indent: r,
|
|
3900
|
+
content: i,
|
|
3901
|
+
checked: o
|
|
3902
|
+
}), a++;
|
|
3903
|
+
} else if (r[a].trim() === "") {
|
|
3904
|
+
a++;
|
|
3905
|
+
break;
|
|
3906
|
+
} else break;
|
|
3907
|
+
}
|
|
3908
|
+
i.push("<ul class=\"sd-list sd-ul\">");
|
|
3909
|
+
for (let t of e) {
|
|
3910
|
+
let e = t.indent > 0 ? ` style="margin-left:${t.indent * 10}px"` : "";
|
|
3911
|
+
if (t.checked !== void 0) {
|
|
3912
|
+
let r = t.checked ? "☑" : "☐";
|
|
3913
|
+
i.push(`<li class="sd-li sd-task-item"${e}><span class="sd-checkbox">${r}</span> ${processInline(t.content, n)}</li>`);
|
|
3914
|
+
} else i.push(`<li class="sd-li"${e}>${processInline(t.content, n)}</li>`);
|
|
3915
|
+
}
|
|
3916
|
+
i.push("</ul>");
|
|
3917
|
+
continue;
|
|
3918
|
+
}
|
|
3919
|
+
if (/^(\s*)\d+\.\s/.test(e)) {
|
|
3920
|
+
s();
|
|
3921
|
+
let e = [];
|
|
3922
|
+
for (; a < r.length;) {
|
|
3923
|
+
let t = r[a].match(/^(\s*)\d+\.\s(.*)$/);
|
|
3924
|
+
if (t) e.push({
|
|
3925
|
+
indent: t[1].length,
|
|
3926
|
+
content: t[2]
|
|
3927
|
+
}), a++;
|
|
3928
|
+
else if (r[a].trim() === "") {
|
|
3929
|
+
a++;
|
|
3930
|
+
break;
|
|
3931
|
+
} else break;
|
|
3932
|
+
}
|
|
3933
|
+
i.push("<ol class=\"sd-list sd-ol\">");
|
|
3934
|
+
for (let t of e) {
|
|
3935
|
+
let e = t.indent > 0 ? ` style="margin-left:${t.indent * 10}px"` : "";
|
|
3936
|
+
i.push(`<li class="sd-li"${e}>${processInline(t.content, n)}</li>`);
|
|
3937
|
+
}
|
|
3938
|
+
i.push("</ol>");
|
|
3939
|
+
continue;
|
|
3940
|
+
}
|
|
3941
|
+
o ? i.push("<br />") : (i.push("<p class=\"sd-p\">"), o = !0), i.push(processInline(t, n)), a++;
|
|
3942
|
+
}
|
|
3943
|
+
return s(), i.join("\n");
|
|
3944
|
+
}
|
|
3945
|
+
var StreamdownRenderer = class {
|
|
3946
|
+
buffer = "";
|
|
3947
|
+
options;
|
|
3948
|
+
listeners = [];
|
|
3949
|
+
constructor(e) {
|
|
3950
|
+
this.options = {
|
|
3951
|
+
...DEFAULT_OPTIONS,
|
|
3952
|
+
...e
|
|
3953
|
+
};
|
|
3954
|
+
}
|
|
3955
|
+
push(e) {
|
|
3956
|
+
this.buffer += e;
|
|
3957
|
+
let t = this.render();
|
|
3958
|
+
return this.notify(t), t;
|
|
3959
|
+
}
|
|
3960
|
+
render() {
|
|
3961
|
+
let e = render(this.buffer, this.options);
|
|
3962
|
+
return this.options.streaming && this.options.cursor && (e += `<span class="sd-cursor">${this.options.cursor}</span>`), e;
|
|
3963
|
+
}
|
|
3964
|
+
finish() {
|
|
3965
|
+
let e = {
|
|
3966
|
+
...this.options,
|
|
3967
|
+
streaming: !1
|
|
3968
|
+
}, t = render(this.buffer, e);
|
|
3969
|
+
return this.notify(t), t;
|
|
3970
|
+
}
|
|
3971
|
+
reset() {
|
|
3972
|
+
this.buffer = "", this.notify("");
|
|
3973
|
+
}
|
|
3974
|
+
getBuffer() {
|
|
3975
|
+
return this.buffer;
|
|
3976
|
+
}
|
|
3977
|
+
onUpdate(e) {
|
|
3978
|
+
return this.listeners.push(e), () => {
|
|
3979
|
+
this.listeners = this.listeners.filter((t) => t !== e);
|
|
3980
|
+
};
|
|
3981
|
+
}
|
|
3982
|
+
notify(e) {
|
|
3983
|
+
for (let t of this.listeners) t(e);
|
|
3984
|
+
this.options.onUpdate(e);
|
|
3985
|
+
}
|
|
3986
|
+
};
|
|
3987
|
+
function useStreamdown(r) {
|
|
3988
|
+
let [i, a] = useState(""), [o, s] = useState(!1), c = useRef(null), l = useRef(null);
|
|
3989
|
+
return {
|
|
3990
|
+
html: i,
|
|
3991
|
+
isStreaming: o,
|
|
3992
|
+
start: useCallback(() => {
|
|
3993
|
+
l.current &&= (l.current(), null), c.current = new StreamdownRenderer(r), l.current = c.current.onUpdate(a), s(!0), a("");
|
|
3994
|
+
}, [r]),
|
|
3995
|
+
push: useCallback((e) => {
|
|
3996
|
+
c.current && c.current.push(e);
|
|
3997
|
+
}, []),
|
|
3998
|
+
finish: useCallback(() => {
|
|
3999
|
+
c.current && (a(c.current.finish()), s(!1));
|
|
4000
|
+
}, []),
|
|
4001
|
+
reset: useCallback(() => {
|
|
4002
|
+
c.current && c.current.reset(), a(""), s(!1);
|
|
4003
|
+
}, []),
|
|
4004
|
+
render: useCallback((e) => {
|
|
4005
|
+
let t = render(e, {
|
|
4006
|
+
...r,
|
|
4007
|
+
streaming: !1
|
|
4008
|
+
});
|
|
4009
|
+
return a(t), t;
|
|
4010
|
+
}, [r])
|
|
4011
|
+
};
|
|
4012
|
+
}
|
|
4013
|
+
export { StreamdownRenderer, getLanguageDisplayName, highlightCode, render, renderDisplayMath, renderInlineMath, renderMermaid, useStreamdown };
|