@andares/pdeditor 0.4.0 → 0.5.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 +359 -79
- package/dist/core.d.ts +68 -13
- package/dist/element-auto.cjs +46 -0
- package/dist/element-auto.d.ts +1 -0
- package/dist/element-auto.js +868 -0
- package/dist/element.cjs +46 -0
- package/dist/element.d.ts +43 -0
- package/dist/element.js +867 -0
- package/dist/highlighters.d.ts +1 -1
- package/dist/index.cjs +16 -16
- package/dist/index.d.ts +9 -2
- package/dist/index.js +864 -774
- package/dist/inline.d.ts +4 -23
- package/dist/pd-highlight.d.ts +1 -1
- package/dist/pd.cjs +14 -14
- package/dist/pd.d.ts +2 -2
- package/dist/pd.js +436 -352
- package/dist/plugins.d.ts +14 -2
- package/dist/react.cjs +46 -0
- package/dist/react.d.ts +30 -0
- package/dist/react.js +937 -0
- package/package.json +52 -12
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/pd.cjs.map +0 -1
- package/dist/pd.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,338 +1,423 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { hasLiteralColon as ke, matchKeyValue as we, findKeyValueSeparator as Ae, splitInlineCode as He } from "@andares/pdfoundation";
|
|
2
|
+
import { format as ut, jsonToPdText as ct, pdToJsonText as dt } from "@andares/pdfoundation";
|
|
3
|
+
function Ne(r, o, { signal: n, edges: t } = {}) {
|
|
4
|
+
let u, l = null;
|
|
5
|
+
const m = t != null && t.includes("leading"), c = t == null || t.includes("trailing"), k = () => {
|
|
6
|
+
l !== null && (r.apply(u, l), u = void 0, l = null);
|
|
7
|
+
}, P = () => {
|
|
8
|
+
c && k(), F();
|
|
8
9
|
};
|
|
9
|
-
let
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
},
|
|
10
|
+
let x = null;
|
|
11
|
+
const w = () => {
|
|
12
|
+
x != null && clearTimeout(x), x = setTimeout(() => {
|
|
13
|
+
x = null, P();
|
|
14
|
+
}, o);
|
|
14
15
|
}, $ = () => {
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
$(),
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
}, y = function(...
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
16
|
+
x !== null && (clearTimeout(x), x = null);
|
|
17
|
+
}, F = () => {
|
|
18
|
+
$(), u = void 0, l = null;
|
|
19
|
+
}, E = () => {
|
|
20
|
+
k();
|
|
21
|
+
}, y = function(...p) {
|
|
22
|
+
if (n != null && n.aborted) return;
|
|
23
|
+
u = this, l = p;
|
|
24
|
+
const f = x == null;
|
|
25
|
+
w(), m && f && k();
|
|
25
26
|
};
|
|
26
|
-
return y.schedule =
|
|
27
|
+
return y.schedule = w, y.cancel = F, y.flush = E, n == null || n.addEventListener("abort", F, { once: !0 }), y;
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return a.length === 0 ? ge : (e) => a.reduce((t, l, c) => l(t, { html: c > 0 }), e);
|
|
29
|
+
function be(r, o) {
|
|
30
|
+
const n = r, t = n.key.toLowerCase(), u = o.split("+"), l = u.slice(0, -1), m = u[u.length - 1];
|
|
31
|
+
return !(t !== m || l.includes("shift") !== n.shiftKey || l.includes("ctrl") !== n.ctrlKey || l.includes("alt") !== n.altKey || l.includes("meta") !== n.metaKey);
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (this.root = a instanceof Node ? a : document.querySelector(a), !this.root) throw new Error(`element with "${a}" selector is not exist`);
|
|
37
|
-
const t = { value: "", styles: {}, plugins: [], highlighter: ge }, { highlighters: l, ...c } = e;
|
|
38
|
-
this.options = { ...t, ...c, highlighter: l ? re(l) : t.highlighter }, this.options.value = this.options.value == null ? "" : String(this.options.value), this.init();
|
|
39
|
-
}
|
|
40
|
-
init() {
|
|
41
|
-
this.textarea = document.createElement("textarea"), this.textarea.setAttribute("spellcheck", "false"), this.textarea.setAttribute("autocapitalize", "off"), this.textarea.setAttribute("autocorrect", "off"), this.textarea.setAttribute("autocomplete", "off"), this.pre = document.createElement("pre");
|
|
42
|
-
const a = Object.keys(ne).concat(Object.keys(this.options.styles)).concat(["paddingLeft"]);
|
|
43
|
-
this.initialRootStyles = {};
|
|
44
|
-
const e = this.root.style;
|
|
45
|
-
a.forEach((t) => {
|
|
46
|
-
this.initialRootStyles[t] = e[t] || "";
|
|
47
|
-
}), Object.assign(this.root.style, ne, this.options.styles), Object.assign(this.textarea.style, be), Object.assign(this.pre.style, xe), this.basePaddingLeft = this.root.style.paddingLeft || "", this.root.appendChild(this.textarea), this.root.appendChild(this.pre), this.addTextareaEvents(), this.update({ value: this.options.value }), this.updateLines();
|
|
48
|
-
}
|
|
49
|
-
addTextareaEvents() {
|
|
50
|
-
this.handleEvent = (a) => {
|
|
51
|
-
if (a.type === "keydown" && this.textarea.readOnly) return;
|
|
52
|
-
const e = a;
|
|
53
|
-
if (e.isComposing || e.keyCode === 229) return;
|
|
54
|
-
const t = (function(l, c) {
|
|
55
|
-
const { value: v, selectionStart: o, selectionEnd: p } = c.target;
|
|
56
|
-
return l.reduce((A, b) => ({ ...A, ...b(A, c) }), { value: v, selectionStart: o, selectionEnd: p });
|
|
57
|
-
})(this.options.plugins, a);
|
|
58
|
-
this.update(t);
|
|
59
|
-
}, this.textarea.addEventListener("input", this.handleEvent), this.textarea.addEventListener("keydown", this.handleEvent), this.textarea.addEventListener("compositionend", this.handleEvent);
|
|
60
|
-
}
|
|
61
|
-
update(a) {
|
|
62
|
-
if (!this.textarea) return;
|
|
63
|
-
let { value: e, selectionStart: t, selectionEnd: l } = a;
|
|
64
|
-
e != null && (e = String(e), t == null && (t = this.textarea.selectionStart), l == null && (l = this.textarea.selectionEnd), this.textarea.value !== e && (this.textarea.value = e)), t != null && (this.textarea.selectionStart = t), l != null && (this.textarea.selectionEnd = l), e !== this.value && e != null && (this.value = e, this.render(), this.updateCallback && this.updateCallback(e));
|
|
65
|
-
}
|
|
66
|
-
updateOptions(a) {
|
|
67
|
-
if (!this.textarea) return;
|
|
68
|
-
const { highlighters: e, ...t } = a;
|
|
69
|
-
if (this.options = { ...this.options, ...t, highlighter: e ? re(e) : this.options.highlighter }, a.styles) {
|
|
70
|
-
const l = this.root.style;
|
|
71
|
-
Object.keys(a.styles).forEach((c) => {
|
|
72
|
-
c in this.initialRootStyles || (this.initialRootStyles[c] = l[c] || "");
|
|
73
|
-
}), Object.assign(this.root.style, a.styles), ("paddingLeft" in a.styles || "padding" in a.styles) && (this.basePaddingLeft = this.root.style.paddingLeft || "");
|
|
74
|
-
}
|
|
75
|
-
this.lines && !this.options.lineNumbers && (N(this.lines), this.lines = null, this.root.style.paddingLeft = this.basePaddingLeft), a.value != null && this.update({ value: a.value }), this.render();
|
|
76
|
-
}
|
|
77
|
-
render() {
|
|
78
|
-
const a = this.options.highlighter(this.value);
|
|
79
|
-
this.pre.innerHTML = a + "<br/>", this.updateLines();
|
|
80
|
-
}
|
|
81
|
-
updateLines() {
|
|
82
|
-
if (!this.options.lineNumbers) return;
|
|
83
|
-
this.lines || (this.lines = document.createElement("pre"), this.root.appendChild(this.lines), Object.assign(this.lines.style, ke));
|
|
84
|
-
const a = this.value.split(`
|
|
85
|
-
`), e = a.length.toString().length;
|
|
86
|
-
this.root.style.paddingLeft = `${e + 1}ch`, this.lines.innerHTML = a.map((t, l) => `${`<span class="yace-line" style="position: absolute; opacity: .3; left: 0; width: ${e}ch; text-align: right">${1 + l}</span>`}${`<span style="color: transparent; pointer-events: none">${pe(t)}</span>`}`).join(`
|
|
87
|
-
`);
|
|
88
|
-
}
|
|
89
|
-
destroy() {
|
|
90
|
-
this.textarea && (this.textarea.removeEventListener("input", this.handleEvent), this.textarea.removeEventListener("keydown", this.handleEvent), this.textarea.removeEventListener("compositionend", this.handleEvent), N(this.textarea), N(this.pre), N(this.lines), Object.assign(this.root.style, this.initialRootStyles), Object.assign(this, { textarea: null, pre: null, lines: null, updateCallback: null, handleEvent: null, initialRootStyles: null, options: null, root: null }));
|
|
91
|
-
}
|
|
92
|
-
onUpdate(a) {
|
|
93
|
-
this.updateCallback = a;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
function N(n) {
|
|
97
|
-
n && n.parentNode && n.parentNode.removeChild(n);
|
|
98
|
-
}
|
|
99
|
-
function pe(n) {
|
|
100
|
-
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
101
|
-
}
|
|
102
|
-
function B(n, a) {
|
|
103
|
-
const e = n, t = e.key.toLowerCase(), l = a.split("+"), c = l.slice(0, -1), v = l[l.length - 1];
|
|
104
|
-
return !(t !== v || c.includes("shift") !== e.shiftKey || c.includes("ctrl") !== e.ctrlKey || c.includes("alt") !== e.altKey || c.includes("meta") !== e.metaKey);
|
|
105
|
-
}
|
|
106
|
-
function ae(n, a) {
|
|
107
|
-
var l;
|
|
108
|
-
const t = n.slice(0, a).split(`
|
|
33
|
+
function Se(r, o) {
|
|
34
|
+
var u;
|
|
35
|
+
const t = r.slice(0, o).split(`
|
|
109
36
|
`);
|
|
110
|
-
return { line: t.length - 1, col: ((
|
|
37
|
+
return { line: t.length - 1, col: ((u = t[t.length - 1]) == null ? void 0 : u.length) ?? 0 };
|
|
111
38
|
}
|
|
112
|
-
function
|
|
113
|
-
var
|
|
39
|
+
function ce(r, o, n) {
|
|
40
|
+
var u;
|
|
114
41
|
let t = 0;
|
|
115
|
-
for (let
|
|
116
|
-
return t +
|
|
42
|
+
for (let l = 0; l < o; l++) t += (((u = r[l]) == null ? void 0 : u.length) ?? 0) + 1;
|
|
43
|
+
return t + n;
|
|
117
44
|
}
|
|
118
|
-
function
|
|
119
|
-
return (
|
|
120
|
-
var
|
|
121
|
-
if (
|
|
122
|
-
const { value:
|
|
123
|
-
`).pop() ?? "",
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
${
|
|
45
|
+
function Ee() {
|
|
46
|
+
return (r, o) => {
|
|
47
|
+
var P;
|
|
48
|
+
if (o.type !== "keydown" || !be(o, "enter")) return;
|
|
49
|
+
const { value: n, selectionStart: t, selectionEnd: u } = r, l = n.slice(0, t).split(`
|
|
50
|
+
`).pop() ?? "", m = ((P = /^\s*/.exec(l)) == null ? void 0 : P[0]) ?? "";
|
|
51
|
+
o.preventDefault();
|
|
52
|
+
const c = /^(\s*)-(?=[ ]|$)/.test(l), k = `
|
|
53
|
+
${m}${c ? "- " : ""}`;
|
|
127
54
|
return {
|
|
128
|
-
value:
|
|
129
|
-
selectionStart: t +
|
|
130
|
-
selectionEnd: t +
|
|
55
|
+
value: n.slice(0, t) + k + n.slice(u),
|
|
56
|
+
selectionStart: t + k.length,
|
|
57
|
+
selectionEnd: t + k.length
|
|
131
58
|
};
|
|
132
59
|
};
|
|
133
60
|
}
|
|
134
|
-
function
|
|
135
|
-
return /^(\s*)-(
|
|
61
|
+
function qe(r) {
|
|
62
|
+
return /^(\s*)-(?=[ ]|$)/.test(r);
|
|
136
63
|
}
|
|
137
|
-
function
|
|
138
|
-
return
|
|
64
|
+
function $e(r, o) {
|
|
65
|
+
return r.startsWith(o) ? o.length : r.startsWith(" ") ? 1 : 0;
|
|
139
66
|
}
|
|
140
|
-
function
|
|
141
|
-
return (
|
|
142
|
-
if (
|
|
143
|
-
const { value: t, selectionStart:
|
|
144
|
-
`),
|
|
145
|
-
`).length - 1,
|
|
146
|
-
`).length - 1,
|
|
147
|
-
if (
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
(
|
|
151
|
-
), $ =
|
|
67
|
+
function Fe(r) {
|
|
68
|
+
return (o, n) => {
|
|
69
|
+
if (n.type !== "keydown") return;
|
|
70
|
+
const { value: t, selectionStart: u, selectionEnd: l } = o, m = t.split(`
|
|
71
|
+
`), c = t.slice(0, u).split(`
|
|
72
|
+
`).length - 1, k = t.slice(0, l).split(`
|
|
73
|
+
`).length - 1, P = Se(t, u), x = Se(t, l);
|
|
74
|
+
if (be(n, "shift+tab")) {
|
|
75
|
+
n.preventDefault();
|
|
76
|
+
const w = m.map(
|
|
77
|
+
(p, f) => f >= c && f <= k ? p.slice($e(p, r)) : p
|
|
78
|
+
), $ = w.join(`
|
|
152
79
|
`);
|
|
153
80
|
if ($ === t) return;
|
|
154
|
-
const
|
|
155
|
-
const
|
|
156
|
-
return { line:
|
|
157
|
-
},
|
|
81
|
+
const F = (p) => {
|
|
82
|
+
const f = $e(m[p.line] ?? "", r);
|
|
83
|
+
return { line: p.line, col: Math.max(0, p.col - f) };
|
|
84
|
+
}, E = F(P), y = F(x);
|
|
158
85
|
return {
|
|
159
86
|
value: $,
|
|
160
|
-
selectionStart:
|
|
161
|
-
selectionEnd:
|
|
87
|
+
selectionStart: ce(w, E.line, E.col),
|
|
88
|
+
selectionEnd: ce(w, y.line, y.col)
|
|
162
89
|
};
|
|
163
90
|
}
|
|
164
|
-
if (
|
|
165
|
-
|
|
166
|
-
const
|
|
167
|
-
if (
|
|
168
|
-
const
|
|
169
|
-
(
|
|
170
|
-
), y =
|
|
171
|
-
`),
|
|
172
|
-
const
|
|
91
|
+
if (be(n, "tab")) {
|
|
92
|
+
n.preventDefault();
|
|
93
|
+
const w = m.map((E, y) => ({ l: E, i: y })).filter(({ i: E }) => E >= c && E <= k);
|
|
94
|
+
if (w.length > 0 && w.every(({ l: E }) => qe(E)) || u !== l) {
|
|
95
|
+
const E = m.map(
|
|
96
|
+
(i, s) => s >= c && s <= k && i !== "" ? r + i : i
|
|
97
|
+
), y = E.join(`
|
|
98
|
+
`), p = (i) => {
|
|
99
|
+
const s = m[i.line] ?? "", g = i.line >= c && i.line <= k;
|
|
173
100
|
return {
|
|
174
|
-
line:
|
|
175
|
-
col:
|
|
101
|
+
line: i.line,
|
|
102
|
+
col: g && s !== "" ? i.col + r.length : i.col
|
|
176
103
|
};
|
|
177
|
-
},
|
|
104
|
+
}, f = p(P), e = p(x);
|
|
178
105
|
return {
|
|
179
106
|
value: y,
|
|
180
|
-
selectionStart:
|
|
181
|
-
selectionEnd:
|
|
107
|
+
selectionStart: ce(E, f.line, f.col),
|
|
108
|
+
selectionEnd: ce(E, e.line, e.col)
|
|
182
109
|
};
|
|
183
110
|
}
|
|
184
|
-
const
|
|
111
|
+
const F = u + r.length;
|
|
185
112
|
return {
|
|
186
|
-
value: t.slice(0,
|
|
187
|
-
selectionStart:
|
|
188
|
-
selectionEnd:
|
|
113
|
+
value: t.slice(0, u) + r + t.slice(l),
|
|
114
|
+
selectionStart: F,
|
|
115
|
+
selectionEnd: F
|
|
189
116
|
};
|
|
190
117
|
}
|
|
191
118
|
};
|
|
192
119
|
}
|
|
193
|
-
function
|
|
194
|
-
return
|
|
120
|
+
function ve(r) {
|
|
121
|
+
return r.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
122
|
+
}
|
|
123
|
+
function J(r) {
|
|
124
|
+
return r.replace(/\r\n?/g, `
|
|
125
|
+
`);
|
|
195
126
|
}
|
|
196
|
-
function
|
|
197
|
-
const
|
|
127
|
+
function Be(r, o) {
|
|
128
|
+
const n = document.createRange();
|
|
129
|
+
n.selectNodeContents(r), r.replaceChildren(n.createContextualFragment(o));
|
|
130
|
+
}
|
|
131
|
+
function Ke(r, o) {
|
|
132
|
+
const n = Math.min(r.length, o.length);
|
|
198
133
|
let t = 0;
|
|
199
|
-
for (; t <
|
|
134
|
+
for (; t < n && r.charCodeAt(t) === o.charCodeAt(t); ) t++;
|
|
200
135
|
return t;
|
|
201
136
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
137
|
+
const We = /* @__PURE__ */ new Set([
|
|
138
|
+
"padding",
|
|
139
|
+
"paddingTop",
|
|
140
|
+
"paddingRight",
|
|
141
|
+
"paddingBottom",
|
|
142
|
+
"paddingLeft"
|
|
143
|
+
]);
|
|
144
|
+
function Le(r) {
|
|
145
|
+
var t;
|
|
146
|
+
const o = {
|
|
147
|
+
top: "0px",
|
|
148
|
+
right: "0px",
|
|
149
|
+
bottom: "0px",
|
|
150
|
+
left: "0px"
|
|
151
|
+
}, n = (t = r.padding) == null ? void 0 : t.trim();
|
|
152
|
+
if (n) {
|
|
153
|
+
const u = n.split(/\s+/);
|
|
154
|
+
if (u.length === 1) {
|
|
155
|
+
const l = u[0] ?? "0px";
|
|
156
|
+
o.top = o.right = o.bottom = o.left = l;
|
|
157
|
+
} else u.length === 2 ? (o.top = o.bottom = u[0] ?? "0px", o.right = o.left = u[1] ?? "0px") : u.length === 3 ? (o.top = u[0] ?? "0px", o.right = o.left = u[1] ?? "0px", o.bottom = u[2] ?? "0px") : (o.top = u[0] ?? "0px", o.right = u[1] ?? "0px", o.bottom = u[2] ?? "0px", o.left = u[3] ?? "0px");
|
|
158
|
+
}
|
|
159
|
+
return r.paddingTop && (o.top = r.paddingTop), r.paddingRight && (o.right = r.paddingRight), r.paddingBottom && (o.bottom = r.paddingBottom), r.paddingLeft && (o.left = r.paddingLeft), o;
|
|
160
|
+
}
|
|
161
|
+
function Ge(r) {
|
|
162
|
+
return r.startsWith("--") ? r : r.replace(/[A-Z]/g, (o) => `-${o.toLowerCase()}`);
|
|
163
|
+
}
|
|
164
|
+
const Ce = "position:relative;display:block;box-sizing:border-box;width:100%;height:auto;max-height:inherit;overflow:hidden;text-align:start;margin:0;border:0;font-family:var(--pd-font-family,inherit);font-size:var(--pd-font-size,inherit);line-height:var(--pd-line-height,1.5);letter-spacing:var(--pd-letter-spacing,inherit);color:var(--pd-color,inherit);background:var(--pd-background,transparent);tab-size:4;font-variant-ligatures:none;font-kerning:normal;", Te = "position:absolute;left:0;top:0;width:100%;height:100%;box-sizing:border-box;margin:0;border:0;outline:none;resize:none;background:transparent;-webkit-text-fill-color:transparent;caret-color:var(--pd-caret-color,currentColor);overflow:auto;scrollbar-gutter:stable;white-space:pre-wrap;overflow-wrap:break-word;word-break:normal;font:inherit;line-height:inherit;letter-spacing:inherit;tab-size:inherit;z-index:2;", _e = "position:relative;left:auto;top:auto;width:100%;height:auto;box-sizing:border-box;margin:0;border:0;overflow:hidden;scrollbar-gutter:stable;pointer-events:none;user-select:none;white-space:pre-wrap;overflow-wrap:break-word;word-break:normal;font:inherit;line-height:inherit;letter-spacing:inherit;tab-size:inherit;color:inherit;z-index:1;", Ze = "position:absolute;left:0;top:0;width:100%;height:100%;box-sizing:border-box;margin:0;border:0;overflow:hidden;scrollbar-gutter:stable;pointer-events:none;user-select:none;white-space:pre-wrap;overflow-wrap:break-word;word-break:normal;font:inherit;line-height:inherit;letter-spacing:inherit;tab-size:inherit;color:inherit;z-index:0;", Pe = "position:absolute;left:0;top:0;width:100%;height:100%;box-sizing:border-box;margin:0;border:0;overflow:hidden;scrollbar-gutter:stable;pointer-events:none;user-select:none;white-space:pre-wrap;overflow-wrap:break-word;word-break:normal;font:inherit;line-height:inherit;letter-spacing:inherit;tab-size:inherit;color:inherit;opacity:var(--pd-placeholder-opacity,0.5);z-index:1;";
|
|
165
|
+
function de(r, o, n, t, u = {}) {
|
|
166
|
+
const l = document.createElement(r);
|
|
167
|
+
l.className = o, l.setAttribute("part", n), l.style.cssText = t;
|
|
168
|
+
for (const [m, c] of Object.entries(u)) l.setAttribute(m, c);
|
|
169
|
+
return l;
|
|
170
|
+
}
|
|
171
|
+
function Ve(r, o, n) {
|
|
172
|
+
let t = { ...o }, u = t.language ?? "pd", l = J(t.value ?? ""), m = l, c = !1, k = !1, P = !1, x = t.lineNumbers ?? !1, w = V(), $ = "", F = !1, E = 0, y = null;
|
|
173
|
+
const p = de("div", "pd-root", "root", Ce), f = de("pre", "pd-highlight", "highlight", _e, {
|
|
174
|
+
"aria-hidden": "true"
|
|
175
|
+
}), e = de("textarea", "pd-input", "input", Te), i = de("div", "pd-placeholder", "placeholder", Pe, {
|
|
176
|
+
"aria-hidden": "true"
|
|
222
177
|
});
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
const h = Fe(g.value, s.value);
|
|
245
|
-
g.selStart = h, g.selEnd = h;
|
|
178
|
+
let s = null;
|
|
179
|
+
e.spellcheck = t.spellcheck ?? !1, e.setAttribute("autocapitalize", "off"), e.setAttribute("autocorrect", "off"), e.setAttribute("autocomplete", "off"), e.setAttribute("wrap", "soft"), e.value = l, e.readOnly = t.readOnly ?? !1, e.disabled = t.disabled ?? !1, ((a) => {
|
|
180
|
+
a !== void 0 && a >= 0 ? e.maxLength = a : e.removeAttribute("maxlength");
|
|
181
|
+
})(t.maxLength), t.dir && (e.dir = t.dir), oe(), p.appendChild(f), p.appendChild(i), p.appendChild(e), r.appendChild(p), le(), Y(), I(), h();
|
|
182
|
+
function d() {
|
|
183
|
+
c || (f.scrollTop = e.scrollTop, f.scrollLeft = e.scrollLeft, s && (s.scrollTop = e.scrollTop, s.scrollLeft = e.scrollLeft));
|
|
184
|
+
}
|
|
185
|
+
function b() {
|
|
186
|
+
if (typeof getComputedStyle != "function") return 0;
|
|
187
|
+
const a = getComputedStyle(r), v = Number.parseFloat(a.paddingTop) || 0, A = Number.parseFloat(a.paddingBottom) || 0;
|
|
188
|
+
return Math.max(0, r.clientHeight - v - A);
|
|
189
|
+
}
|
|
190
|
+
function S() {
|
|
191
|
+
F ? (f.style.position = "absolute", f.style.left = "0", f.style.top = "0", f.style.height = "100%") : (f.style.position = "relative", f.style.left = "auto", f.style.top = "auto", f.style.height = "auto");
|
|
192
|
+
}
|
|
193
|
+
function h() {
|
|
194
|
+
if (c) return;
|
|
195
|
+
const a = b(), v = f.scrollHeight;
|
|
196
|
+
if (!F) {
|
|
197
|
+
a > 0 && v > a + 1 && (F = !0, S(), p.style.height = `${a}px`, d());
|
|
198
|
+
return;
|
|
246
199
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
const g = p.selectionStart, m = p.selectionEnd;
|
|
251
|
-
i({ value: s, selStart: g, selEnd: m });
|
|
252
|
-
}, u = (s) => {
|
|
253
|
-
const g = s.selStart >= 0 ? s.selStart : s.value.length, m = s.selEnd >= 0 ? s.selEnd : s.value.length;
|
|
254
|
-
c = !0, o.update({
|
|
255
|
-
value: s.value,
|
|
256
|
-
selectionStart: g,
|
|
257
|
-
selectionEnd: m
|
|
258
|
-
}), p.value === s.value && p.setSelectionRange(g, m), c = !1;
|
|
259
|
-
}, d = (s) => {
|
|
260
|
-
const g = s.ctrlKey || s.metaKey, m = s.key.toLowerCase();
|
|
261
|
-
if (!g || m !== "z" && m !== "y") return;
|
|
262
|
-
if (m === "y" || m === "z" && s.shiftKey) {
|
|
263
|
-
if (i.flush(), y.length === 0) return;
|
|
264
|
-
s.preventDefault();
|
|
265
|
-
const E = y.pop();
|
|
266
|
-
E !== void 0 && (w.push(E), f(), u(E));
|
|
267
|
-
} else {
|
|
268
|
-
if (i.flush(), w.length <= 1) return;
|
|
269
|
-
s.preventDefault();
|
|
270
|
-
const E = w.pop();
|
|
271
|
-
E !== void 0 && y.push(E);
|
|
272
|
-
const F = w.at(-1);
|
|
273
|
-
F !== void 0 && u(F);
|
|
200
|
+
if (a <= 0 || v <= a + 1) {
|
|
201
|
+
F = !1, S(), p.style.height = "", e.scrollTop = 0;
|
|
202
|
+
return;
|
|
274
203
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
204
|
+
const A = Number.parseFloat(p.style.height) || 0;
|
|
205
|
+
Math.abs(A - a) > 0.5 && (p.style.height = `${a}px`), d();
|
|
206
|
+
}
|
|
207
|
+
function T() {
|
|
208
|
+
if (!E) {
|
|
209
|
+
if (typeof requestAnimationFrame != "function") {
|
|
210
|
+
h();
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
E = requestAnimationFrame(() => {
|
|
214
|
+
E = 0, h();
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
typeof ResizeObserver < "u" && (y = new ResizeObserver(() => T()), y.observe(r), y.observe(p));
|
|
219
|
+
const R = () => d(), H = (a, v, A) => {
|
|
220
|
+
var C;
|
|
221
|
+
l = a, m = a, ne({ value: a, selStart: v, selEnd: A }), (C = t.onValueChange) == null || C.call(t, a);
|
|
222
|
+
}, Q = (a) => {
|
|
223
|
+
if (c) return;
|
|
224
|
+
const v = J(e.value);
|
|
225
|
+
if (k || a != null && a.isComposing) {
|
|
226
|
+
l = v, I();
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
v !== l && (l = v, I()), v !== m && H(v, e.selectionStart, e.selectionEnd);
|
|
230
|
+
}, ee = () => {
|
|
231
|
+
k = !0;
|
|
232
|
+
}, ie = () => {
|
|
233
|
+
k = !1;
|
|
234
|
+
const a = J(e.value);
|
|
235
|
+
a !== l && (l = a, I());
|
|
236
|
+
}, ge = Math.max(0, t.historyLimit ?? 5), te = Math.max(0, t.historyDebounce ?? 1e3), L = [
|
|
237
|
+
{ value: l, selStart: -1, selEnd: -1 }
|
|
238
|
+
], z = [], N = () => {
|
|
239
|
+
L.length > ge + 1 && L.splice(1, 1);
|
|
240
|
+
}, W = (a) => {
|
|
241
|
+
const v = L[0];
|
|
242
|
+
if (v !== void 0 && v.selStart < 0 && v.value !== a.value) {
|
|
243
|
+
const C = Ke(v.value, a.value);
|
|
244
|
+
v.selStart = C, v.selEnd = C;
|
|
245
|
+
}
|
|
246
|
+
const A = L.at(-1);
|
|
247
|
+
A !== void 0 && A.value === a.value || (z.length = 0, L.push(a), N());
|
|
248
|
+
}, D = Ne(W, te), ne = (a) => {
|
|
249
|
+
te === 0 ? W(a) : D(a);
|
|
250
|
+
}, j = (a) => {
|
|
251
|
+
var C;
|
|
252
|
+
const v = a.selStart >= 0 ? a.selStart : Math.min(a.value.length, e.selectionStart), A = a.selEnd >= 0 ? a.selEnd : v;
|
|
253
|
+
l = a.value, m = a.value, e.value = a.value, e.setSelectionRange(
|
|
254
|
+
Math.max(0, Math.min(v, a.value.length)),
|
|
255
|
+
Math.max(0, Math.min(A, a.value.length))
|
|
256
|
+
), I(), d(), (C = t.onValueChange) == null || C.call(t, a.value);
|
|
257
|
+
}, K = () => {
|
|
258
|
+
if (D.flush(), L.length <= 1) return !1;
|
|
259
|
+
const a = L.pop();
|
|
260
|
+
a !== void 0 && z.push(a);
|
|
261
|
+
const v = L.at(-1);
|
|
262
|
+
return v !== void 0 && j(v), !0;
|
|
263
|
+
}, G = () => {
|
|
264
|
+
if (D.flush(), z.length === 0) return !1;
|
|
265
|
+
const a = z.pop();
|
|
266
|
+
return a === void 0 ? !1 : (L.push(a), N(), j(a), !0);
|
|
267
|
+
}, Z = (a) => {
|
|
268
|
+
var O;
|
|
269
|
+
if (c || a.isComposing || k || e.readOnly || e.disabled) return;
|
|
270
|
+
const v = a.ctrlKey || a.metaKey, A = a.key.toLowerCase();
|
|
271
|
+
if (v && (A === "z" || A === "y")) {
|
|
272
|
+
a.preventDefault(), A === "y" || A === "z" && a.shiftKey ? G() : K();
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
if (A === "escape") {
|
|
276
|
+
(t.tabBehavior ?? "indent") === "indent" && (P = !0);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
if (A === "tab" && (t.tabBehavior ?? "indent") === "focus") return;
|
|
280
|
+
if (A === "tab" && P) {
|
|
281
|
+
P = !1;
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
const C = {
|
|
285
|
+
value: l,
|
|
286
|
+
selectionStart: e.selectionStart,
|
|
287
|
+
selectionEnd: e.selectionEnd
|
|
288
|
+
};
|
|
289
|
+
let _ = C;
|
|
290
|
+
for (const U of fe) {
|
|
291
|
+
const q = U(_, a);
|
|
292
|
+
q && (_ = { ..._, ...q });
|
|
293
|
+
}
|
|
294
|
+
(_.value !== C.value || _.selectionStart !== C.selectionStart || _.selectionEnd !== C.selectionEnd) && (a.preventDefault(), l = _.value, e.value = _.value, e.setSelectionRange(_.selectionStart, _.selectionEnd), m = _.value, I(), ne({
|
|
295
|
+
value: _.value,
|
|
296
|
+
selStart: _.selectionStart,
|
|
297
|
+
selEnd: _.selectionEnd
|
|
298
|
+
}), (O = t.onValueChange) == null || O.call(t, _.value), d());
|
|
299
|
+
}, X = () => p.classList.add("pd-focused"), re = () => p.classList.remove("pd-focused");
|
|
300
|
+
e.addEventListener("input", Q), e.addEventListener("compositionstart", ee), e.addEventListener("compositionend", ie), e.addEventListener("scroll", R, { passive: !0 }), e.addEventListener("keydown", Z), e.addEventListener("focus", X), e.addEventListener("blur", re);
|
|
301
|
+
function V() {
|
|
302
|
+
return t.highlight ? (a) => {
|
|
303
|
+
var v;
|
|
304
|
+
return ((v = t.highlight) == null ? void 0 : v.call(t, a, u)) ?? "";
|
|
305
|
+
} : n(u);
|
|
306
|
+
}
|
|
307
|
+
function I() {
|
|
308
|
+
if (c) return;
|
|
309
|
+
const a = t.highlightThreshold ?? 1e5, v = l.length > a ? ve(l) : w(l);
|
|
310
|
+
Be(f, `${v}<br/>`), x && se(), Y(), y || T();
|
|
311
|
+
}
|
|
312
|
+
function se() {
|
|
313
|
+
if (!x) return;
|
|
314
|
+
s || (s = document.createElement("pre"), s.className = "pd-lines", s.setAttribute("part", "gutter"), s.setAttribute("aria-hidden", "true"), p.insertBefore(s, i));
|
|
315
|
+
const a = l.split(`
|
|
316
|
+
`), A = `${String(a.length).length + 1}ch`, C = Le(t.styles ?? {}), _ = `position:absolute;inset-inline-start:${C.left};width:${A};text-align:end;opacity:var(--pd-gutter-opacity,0.35);color:var(--pd-gutter-color,inherit)`, O = document.createDocumentFragment();
|
|
317
|
+
a.forEach((U, q) => {
|
|
318
|
+
const ue = document.createElement("span");
|
|
319
|
+
ue.className = "pd-ln", ue.style.cssText = _, ue.textContent = String(q + 1);
|
|
320
|
+
const he = document.createElement("span");
|
|
321
|
+
he.style.color = "transparent", he.textContent = U, O.append(ue, he), q < a.length - 1 && O.append(document.createTextNode(`
|
|
322
|
+
`));
|
|
323
|
+
}), O.append(document.createElement("br")), s.replaceChildren(O), A !== $ && ($ = A, le(), s.style.cssText = xe(C));
|
|
324
|
+
}
|
|
325
|
+
function Y() {
|
|
326
|
+
const a = t.placeholder ?? "";
|
|
327
|
+
i.textContent = a, i.style.display = a && l.length === 0 ? "block" : "none", a ? e.setAttribute("aria-placeholder", a) : e.removeAttribute("aria-placeholder");
|
|
328
|
+
}
|
|
329
|
+
function ye(a) {
|
|
330
|
+
const v = $ ? `calc(${a.left} + ${$})` : a.left;
|
|
331
|
+
return `padding:${a.top} ${a.right} ${a.bottom} ${v};`;
|
|
332
|
+
}
|
|
333
|
+
function pe(a, v) {
|
|
334
|
+
return v + ye(a);
|
|
335
|
+
}
|
|
336
|
+
function xe(a) {
|
|
337
|
+
return Ze + ye(a);
|
|
338
|
+
}
|
|
339
|
+
function le() {
|
|
340
|
+
const a = t.styles ?? {}, v = Le(a), A = Object.entries(a).filter(([C]) => !We.has(C)).map(([C, _]) => `${Ge(C)}:${_};`).join("");
|
|
341
|
+
p.style.cssText = Ce + A, f.style.cssText = pe(v, _e), e.style.cssText = pe(v, Te), i.style.cssText = pe(v, Pe), s && (s.style.cssText = xe(v)), S(), t.dir && (p.dir = t.dir, e.dir = t.dir, f.dir = t.dir, i.dir = t.dir, s && (s.dir = t.dir));
|
|
342
|
+
}
|
|
343
|
+
function oe() {
|
|
344
|
+
t.ariaLabel ? e.setAttribute("aria-label", t.ariaLabel) : e.removeAttribute("aria-label"), t.ariaLabelledby ? e.setAttribute("aria-labelledby", t.ariaLabelledby) : e.removeAttribute("aria-labelledby"), t.ariaDescribedby ? e.setAttribute("aria-describedby", t.ariaDescribedby) : e.removeAttribute("aria-describedby"), t.readOnly ? e.setAttribute("aria-readonly", "true") : e.removeAttribute("aria-readonly"), t.disabled ? e.setAttribute("aria-disabled", "true") : e.removeAttribute("aria-disabled");
|
|
345
|
+
}
|
|
346
|
+
x && se();
|
|
347
|
+
const fe = [Ee(), Fe(t.indentUnit ?? " ")];
|
|
348
|
+
return {
|
|
349
|
+
setValue(a, v) {
|
|
350
|
+
if (c || k) return;
|
|
351
|
+
let A = J(a);
|
|
352
|
+
t.maxLength !== void 0 && t.maxLength >= 0 && (A = A.slice(0, t.maxLength)), D.cancel(), l = A, m = A, e.value = A, e.setSelectionRange(A.length, A.length), ((v == null ? void 0 : v.resetHistory) ?? !0) && (L.length = 0, L.push({ value: A, selStart: -1, selEnd: -1 }), z.length = 0), I(), d();
|
|
279
353
|
},
|
|
280
354
|
getValue() {
|
|
281
|
-
return
|
|
355
|
+
return l;
|
|
282
356
|
},
|
|
283
|
-
setLanguage(
|
|
284
|
-
t =
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
357
|
+
setLanguage(a) {
|
|
358
|
+
u = a, t = { ...t, language: a }, w = V(), I();
|
|
359
|
+
},
|
|
360
|
+
setPlaceholder(a) {
|
|
361
|
+
t = { ...t, placeholder: a }, Y();
|
|
362
|
+
},
|
|
363
|
+
setReadOnly(a) {
|
|
364
|
+
t = { ...t, readOnly: a }, e.readOnly = a, oe();
|
|
365
|
+
},
|
|
366
|
+
setDisabled(a) {
|
|
367
|
+
t = { ...t, disabled: a }, e.disabled = a, oe();
|
|
368
|
+
},
|
|
369
|
+
setLineNumbers(a) {
|
|
370
|
+
x !== a && (x = a, !a && s && (s.remove(), s = null, $ = ""), le(), I());
|
|
371
|
+
},
|
|
372
|
+
update(a) {
|
|
373
|
+
c || (t = { ...t, ...a }, a.indentUnit !== void 0 && fe.splice(0, fe.length, Ee(), Fe(a.indentUnit)), a.language !== void 0 && (u = a.language), ("highlight" in a || a.language !== void 0) && (w = V()), a.lineNumbers !== void 0 && (x = a.lineNumbers, !x && s && (s.remove(), s = null, $ = "")), a.value !== void 0 && (l = J(a.value), m = l, e.value = l, L.length = 0, L.push({ value: l, selStart: -1, selEnd: -1 }), z.length = 0), a.readOnly !== void 0 && (e.readOnly = a.readOnly), a.disabled !== void 0 && (e.disabled = a.disabled), a.maxLength !== void 0 && (a.maxLength >= 0 ? e.maxLength = a.maxLength : e.removeAttribute("maxlength")), a.spellcheck !== void 0 && (e.spellcheck = a.spellcheck), a.dir !== void 0 && (e.dir = a.dir), oe(), le(), I(), d());
|
|
374
|
+
},
|
|
375
|
+
focus() {
|
|
376
|
+
e.focus();
|
|
377
|
+
},
|
|
378
|
+
blur() {
|
|
379
|
+
e.blur();
|
|
380
|
+
},
|
|
381
|
+
undo() {
|
|
382
|
+
K();
|
|
383
|
+
},
|
|
384
|
+
redo() {
|
|
385
|
+
G();
|
|
386
|
+
},
|
|
387
|
+
insertText(a) {
|
|
388
|
+
var U;
|
|
389
|
+
if (c || e.readOnly || e.disabled) return;
|
|
390
|
+
const v = e.selectionStart, A = e.selectionEnd;
|
|
391
|
+
let C = J(a);
|
|
392
|
+
if (t.maxLength !== void 0 && t.maxLength >= 0) {
|
|
393
|
+
const q = t.maxLength - (l.length - (A - v));
|
|
394
|
+
if (q <= 0) return;
|
|
395
|
+
C.length > q && (C = C.slice(0, q));
|
|
396
|
+
}
|
|
397
|
+
const _ = l.slice(0, v) + C + l.slice(A);
|
|
398
|
+
l = _, m = _, e.value = _;
|
|
399
|
+
const O = v + C.length;
|
|
400
|
+
e.setSelectionRange(O, O), I(), ne({ value: _, selStart: O, selEnd: O }), (U = t.onValueChange) == null || U.call(t, _), d();
|
|
401
|
+
},
|
|
402
|
+
getSelection() {
|
|
403
|
+
return { start: e.selectionStart, end: e.selectionEnd };
|
|
404
|
+
},
|
|
405
|
+
setSelection(a, v = a) {
|
|
406
|
+
const A = (C) => Math.max(0, Math.min(l.length, Number.isFinite(C) ? C : 0));
|
|
407
|
+
e.setSelectionRange(A(a), A(v));
|
|
292
408
|
},
|
|
293
409
|
destroy() {
|
|
294
|
-
|
|
410
|
+
c || (c = !0, D.cancel(), y == null || y.disconnect(), E && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(E), e.removeEventListener("input", Q), e.removeEventListener("compositionstart", ee), e.removeEventListener("compositionend", ie), e.removeEventListener("scroll", R), e.removeEventListener("keydown", Z), e.removeEventListener("focus", X), e.removeEventListener("blur", re), p.remove());
|
|
295
411
|
},
|
|
296
|
-
textarea:
|
|
412
|
+
textarea: e,
|
|
413
|
+
root: p,
|
|
414
|
+
pre: f
|
|
297
415
|
};
|
|
298
416
|
}
|
|
299
|
-
function
|
|
300
|
-
|
|
301
|
-
let e = "", t = !1;
|
|
302
|
-
for (const l of n)
|
|
303
|
-
l === "`" ? t ? (a.push({ code: !0, seg: e + "`" }), e = "", t = !1) : (e && a.push({ code: !1, seg: e }), e = "`", t = !0) : e += l;
|
|
304
|
-
return e && a.push({ code: !1, seg: e }), a;
|
|
305
|
-
}
|
|
306
|
-
function Y(n) {
|
|
307
|
-
for (const { code: a, seg: e } of J(n))
|
|
308
|
-
if (!a && (e.includes(":-") || e.includes(":-")))
|
|
309
|
-
return !0;
|
|
310
|
-
return !1;
|
|
311
|
-
}
|
|
312
|
-
function V(n) {
|
|
313
|
-
let a = 0;
|
|
314
|
-
for (const { code: e, seg: t } of J(n)) {
|
|
315
|
-
if (!e) {
|
|
316
|
-
const l = t.indexOf(":");
|
|
317
|
-
if (l !== -1) return a + l;
|
|
318
|
-
}
|
|
319
|
-
a += t.length;
|
|
320
|
-
}
|
|
321
|
-
return -1;
|
|
417
|
+
function M(r) {
|
|
418
|
+
return r.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
322
419
|
}
|
|
323
|
-
|
|
324
|
-
if (Y(n)) return null;
|
|
325
|
-
const a = V(n);
|
|
326
|
-
if (a <= 0) return null;
|
|
327
|
-
const e = n.slice(0, a), t = n.slice(a + 1);
|
|
328
|
-
if (/\s$/.test(e) || t !== "" && !/^\s/.test(t)) return null;
|
|
329
|
-
const l = t.trim();
|
|
330
|
-
return { key: e.trim(), value: l === "" ? void 0 : l };
|
|
331
|
-
}
|
|
332
|
-
function C(n) {
|
|
333
|
-
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
334
|
-
}
|
|
335
|
-
const P = {
|
|
420
|
+
const B = {
|
|
336
421
|
key: "pd-key",
|
|
337
422
|
keyPunct: "pd-key-punct",
|
|
338
423
|
item: "pd-item",
|
|
@@ -342,81 +427,81 @@ const P = {
|
|
|
342
427
|
inlineCode: "pd-inline-code",
|
|
343
428
|
fence: "pd-fence"
|
|
344
429
|
};
|
|
345
|
-
function
|
|
346
|
-
return `<span class="${
|
|
430
|
+
function Ye(r) {
|
|
431
|
+
return `<span class="${B.inlineCode}">${M(r)}</span>`;
|
|
347
432
|
}
|
|
348
|
-
const
|
|
349
|
-
function
|
|
350
|
-
let
|
|
351
|
-
|
|
433
|
+
const Re = /(?:^|\s):([^\s-][^\s]*)(?=\s|$)/g;
|
|
434
|
+
function Ue(r) {
|
|
435
|
+
let o = "", n = 0;
|
|
436
|
+
Re.lastIndex = 0;
|
|
352
437
|
let t;
|
|
353
|
-
for (; (t =
|
|
354
|
-
const
|
|
355
|
-
|
|
438
|
+
for (; (t = Re.exec(r)) !== null; ) {
|
|
439
|
+
const u = /^\s/.test(t[0]) ? 1 : 0, l = t.index + u;
|
|
440
|
+
o += M(r.slice(n, l)), o += `<span class="${B.ref}">${M(r.slice(l, t.index + t[0].length))}</span>`, n = t.index + t[0].length;
|
|
356
441
|
}
|
|
357
|
-
return
|
|
442
|
+
return o += M(r.slice(n)), o;
|
|
358
443
|
}
|
|
359
|
-
function
|
|
360
|
-
let
|
|
361
|
-
for (const { code:
|
|
362
|
-
|
|
363
|
-
return
|
|
444
|
+
function ae(r) {
|
|
445
|
+
let o = "";
|
|
446
|
+
for (const { code: n, seg: t } of He(r))
|
|
447
|
+
o += n ? Ye(t) : Ue(t);
|
|
448
|
+
return o;
|
|
364
449
|
}
|
|
365
|
-
function
|
|
366
|
-
const
|
|
367
|
-
return `${
|
|
450
|
+
function ze(r, o, n, t) {
|
|
451
|
+
const u = `<span class="${B.key}">${ae(n)}</span>`, l = `<span class="${B.keyPunct}">:</span>`;
|
|
452
|
+
return `${r}${o}${u}${l}${ae(t)}`;
|
|
368
453
|
}
|
|
369
|
-
function
|
|
370
|
-
const
|
|
371
|
-
if (/^\/\/!pd(?:\s+[^\s]+)?$/.test(
|
|
372
|
-
const t = /^(\s*)(\/\/!pd)(\s*.*)$/.exec(
|
|
373
|
-
return `${
|
|
454
|
+
function Xe(r) {
|
|
455
|
+
const o = r.trim();
|
|
456
|
+
if (/^\/\/!pd(?:\s+[^\s]+)?$/.test(o)) {
|
|
457
|
+
const t = /^(\s*)(\/\/!pd)(\s*.*)$/.exec(r), u = (t == null ? void 0 : t[1]) ?? "", l = (t == null ? void 0 : t[2]) ?? "//!pd", m = (t == null ? void 0 : t[3]) ?? "";
|
|
458
|
+
return `${M(u)}<span class="${B.section}">${M(l)}</span>${ae(m)}`;
|
|
374
459
|
}
|
|
375
|
-
if (
|
|
376
|
-
return `<span class="${
|
|
377
|
-
const
|
|
378
|
-
if (
|
|
379
|
-
const t =
|
|
380
|
-
if (!
|
|
381
|
-
const
|
|
382
|
-
return `${t}${
|
|
460
|
+
if (o === "---")
|
|
461
|
+
return `<span class="${B.sep}">${M(r)}</span>`;
|
|
462
|
+
const n = /^(\s*)(-)(?=[ ]|$)/.exec(r);
|
|
463
|
+
if (n) {
|
|
464
|
+
const t = M(n[1] ?? ""), u = (n[1] ?? "").length + 1, l = r.slice(u), m = l.trimStart(), c = l.slice(0, l.length - m.length), k = `<span class="${B.item}">-</span>`;
|
|
465
|
+
if (!ke(m) && we(m)) {
|
|
466
|
+
const x = Ae(m), w = m.slice(0, x), $ = m.slice(x + 1);
|
|
467
|
+
return `${t}${k}${M(c)}${ze("", "", w, $)}`;
|
|
383
468
|
}
|
|
384
|
-
return `${t}${
|
|
469
|
+
return `${t}${k}${M(c)}${ae(m)}`;
|
|
385
470
|
}
|
|
386
|
-
if (!
|
|
387
|
-
const
|
|
388
|
-
return
|
|
471
|
+
if (!ke(o) && we(o)) {
|
|
472
|
+
const u = r.length - r.trimStart().length, l = r.slice(u), m = Ae(l), c = l.slice(0, m).trim(), k = l.slice(m + 1);
|
|
473
|
+
return ze(M(r.slice(0, u)), "", c, k);
|
|
389
474
|
}
|
|
390
|
-
return
|
|
475
|
+
return ae(r);
|
|
391
476
|
}
|
|
392
|
-
function
|
|
393
|
-
const
|
|
477
|
+
function Je(r) {
|
|
478
|
+
const o = r.split(`
|
|
394
479
|
`);
|
|
395
|
-
let
|
|
480
|
+
let n = !1;
|
|
396
481
|
const t = [];
|
|
397
|
-
for (const
|
|
398
|
-
const
|
|
399
|
-
if (
|
|
400
|
-
|
|
482
|
+
for (const u of o) {
|
|
483
|
+
const l = u.trimStart();
|
|
484
|
+
if (n) {
|
|
485
|
+
l.startsWith("```") ? (n = !1, t.push(`<span class="${B.fence}">${M(u)}</span>`)) : t.push(M(u));
|
|
401
486
|
continue;
|
|
402
487
|
}
|
|
403
|
-
if (
|
|
404
|
-
|
|
488
|
+
if (l.startsWith("```")) {
|
|
489
|
+
n = !0, t.push(`<span class="${B.fence}">${M(u)}</span>`);
|
|
405
490
|
continue;
|
|
406
491
|
}
|
|
407
|
-
t.push(
|
|
492
|
+
t.push(Xe(u));
|
|
408
493
|
}
|
|
409
494
|
return t.join(`
|
|
410
495
|
`);
|
|
411
496
|
}
|
|
412
|
-
var
|
|
413
|
-
function
|
|
414
|
-
return
|
|
497
|
+
var De = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
498
|
+
function Qe(r) {
|
|
499
|
+
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
415
500
|
}
|
|
416
|
-
var
|
|
417
|
-
function
|
|
418
|
-
return
|
|
419
|
-
var
|
|
501
|
+
var me = { exports: {} }, Ie;
|
|
502
|
+
function et() {
|
|
503
|
+
return Ie || (Ie = 1, (function(r) {
|
|
504
|
+
var o = typeof window < "u" ? window : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : {};
|
|
420
505
|
/**
|
|
421
506
|
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
422
507
|
*
|
|
@@ -425,8 +510,8 @@ function Re() {
|
|
|
425
510
|
* @namespace
|
|
426
511
|
* @public
|
|
427
512
|
*/
|
|
428
|
-
var
|
|
429
|
-
var
|
|
513
|
+
var n = (function(t) {
|
|
514
|
+
var u = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i, l = 0, m = {}, c = {
|
|
430
515
|
/**
|
|
431
516
|
* By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
|
|
432
517
|
* current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
|
|
@@ -481,8 +566,8 @@ function Re() {
|
|
|
481
566
|
* @memberof Prism
|
|
482
567
|
*/
|
|
483
568
|
util: {
|
|
484
|
-
encode: function i
|
|
485
|
-
return
|
|
569
|
+
encode: function e(i) {
|
|
570
|
+
return i instanceof k ? new k(i.type, e(i.content), i.alias) : Array.isArray(i) ? i.map(e) : i.replace(/&/g, "&").replace(/</g, "<").replace(/\u00a0/g, " ");
|
|
486
571
|
},
|
|
487
572
|
/**
|
|
488
573
|
* Returns the name of the type of the given value.
|
|
@@ -500,8 +585,8 @@ function Re() {
|
|
|
500
585
|
* type(String) === 'Function'
|
|
501
586
|
* type(/abc+/) === 'RegExp'
|
|
502
587
|
*/
|
|
503
|
-
type: function(
|
|
504
|
-
return Object.prototype.toString.call(
|
|
588
|
+
type: function(e) {
|
|
589
|
+
return Object.prototype.toString.call(e).slice(8, -1);
|
|
505
590
|
},
|
|
506
591
|
/**
|
|
507
592
|
* Returns a unique number for the given object. Later calls will still return the same number.
|
|
@@ -509,8 +594,8 @@ function Re() {
|
|
|
509
594
|
* @param {Object} obj
|
|
510
595
|
* @returns {number}
|
|
511
596
|
*/
|
|
512
|
-
objId: function(
|
|
513
|
-
return
|
|
597
|
+
objId: function(e) {
|
|
598
|
+
return e.__id || Object.defineProperty(e, "__id", { value: ++l }), e.__id;
|
|
514
599
|
},
|
|
515
600
|
/**
|
|
516
601
|
* Creates a deep clone of the given object.
|
|
@@ -522,30 +607,30 @@ function Re() {
|
|
|
522
607
|
* @returns {T}
|
|
523
608
|
* @template T
|
|
524
609
|
*/
|
|
525
|
-
clone: function i
|
|
526
|
-
|
|
527
|
-
var
|
|
528
|
-
switch (
|
|
610
|
+
clone: function e(i, s) {
|
|
611
|
+
s = s || {};
|
|
612
|
+
var g, d;
|
|
613
|
+
switch (c.util.type(i)) {
|
|
529
614
|
case "Object":
|
|
530
|
-
if (
|
|
531
|
-
return
|
|
532
|
-
|
|
533
|
-
{},
|
|
534
|
-
for (var
|
|
535
|
-
|
|
615
|
+
if (d = c.util.objId(i), s[d])
|
|
616
|
+
return s[d];
|
|
617
|
+
g = /** @type {Record<string, any>} */
|
|
618
|
+
{}, s[d] = g;
|
|
619
|
+
for (var b in i)
|
|
620
|
+
i.hasOwnProperty(b) && (g[b] = e(i[b], s));
|
|
536
621
|
return (
|
|
537
622
|
/** @type {any} */
|
|
538
|
-
|
|
623
|
+
g
|
|
539
624
|
);
|
|
540
625
|
case "Array":
|
|
541
|
-
return
|
|
626
|
+
return d = c.util.objId(i), s[d] ? s[d] : (g = [], s[d] = g, /** @type {Array} */
|
|
542
627
|
/** @type {any} */
|
|
543
|
-
|
|
544
|
-
|
|
628
|
+
i.forEach(function(S, h) {
|
|
629
|
+
g[h] = e(S, s);
|
|
545
630
|
}), /** @type {any} */
|
|
546
|
-
|
|
631
|
+
g);
|
|
547
632
|
default:
|
|
548
|
-
return
|
|
633
|
+
return i;
|
|
549
634
|
}
|
|
550
635
|
},
|
|
551
636
|
/**
|
|
@@ -556,12 +641,12 @@ function Re() {
|
|
|
556
641
|
* @param {Element} element
|
|
557
642
|
* @returns {string}
|
|
558
643
|
*/
|
|
559
|
-
getLanguage: function(
|
|
560
|
-
for (;
|
|
561
|
-
var
|
|
562
|
-
if (
|
|
563
|
-
return
|
|
564
|
-
|
|
644
|
+
getLanguage: function(e) {
|
|
645
|
+
for (; e; ) {
|
|
646
|
+
var i = u.exec(e.className);
|
|
647
|
+
if (i)
|
|
648
|
+
return i[1].toLowerCase();
|
|
649
|
+
e = e.parentElement;
|
|
565
650
|
}
|
|
566
651
|
return "none";
|
|
567
652
|
},
|
|
@@ -572,8 +657,8 @@ function Re() {
|
|
|
572
657
|
* @param {string} language
|
|
573
658
|
* @returns {void}
|
|
574
659
|
*/
|
|
575
|
-
setLanguage: function(
|
|
576
|
-
|
|
660
|
+
setLanguage: function(e, i) {
|
|
661
|
+
e.className = e.className.replace(RegExp(u, "gi"), ""), e.classList.add("language-" + i);
|
|
577
662
|
},
|
|
578
663
|
/**
|
|
579
664
|
* Returns the script element that is currently executing.
|
|
@@ -592,13 +677,13 @@ function Re() {
|
|
|
592
677
|
);
|
|
593
678
|
try {
|
|
594
679
|
throw new Error();
|
|
595
|
-
} catch (
|
|
596
|
-
var
|
|
597
|
-
if (
|
|
598
|
-
var
|
|
599
|
-
for (var
|
|
600
|
-
if (
|
|
601
|
-
return
|
|
680
|
+
} catch (g) {
|
|
681
|
+
var e = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(g.stack) || [])[1];
|
|
682
|
+
if (e) {
|
|
683
|
+
var i = document.getElementsByTagName("script");
|
|
684
|
+
for (var s in i)
|
|
685
|
+
if (i[s].src == e)
|
|
686
|
+
return i[s];
|
|
602
687
|
}
|
|
603
688
|
return null;
|
|
604
689
|
}
|
|
@@ -622,16 +707,16 @@ function Re() {
|
|
|
622
707
|
* @param {boolean} [defaultActivation=false]
|
|
623
708
|
* @returns {boolean}
|
|
624
709
|
*/
|
|
625
|
-
isActive: function(
|
|
626
|
-
for (var
|
|
627
|
-
var
|
|
628
|
-
if (
|
|
710
|
+
isActive: function(e, i, s) {
|
|
711
|
+
for (var g = "no-" + i; e; ) {
|
|
712
|
+
var d = e.classList;
|
|
713
|
+
if (d.contains(i))
|
|
629
714
|
return !0;
|
|
630
|
-
if (
|
|
715
|
+
if (d.contains(g))
|
|
631
716
|
return !1;
|
|
632
|
-
|
|
717
|
+
e = e.parentElement;
|
|
633
718
|
}
|
|
634
|
-
return !!
|
|
719
|
+
return !!s;
|
|
635
720
|
}
|
|
636
721
|
},
|
|
637
722
|
/**
|
|
@@ -645,10 +730,10 @@ function Re() {
|
|
|
645
730
|
/**
|
|
646
731
|
* The grammar for plain, unformatted text.
|
|
647
732
|
*/
|
|
648
|
-
plain:
|
|
649
|
-
plaintext:
|
|
650
|
-
text:
|
|
651
|
-
txt:
|
|
733
|
+
plain: m,
|
|
734
|
+
plaintext: m,
|
|
735
|
+
text: m,
|
|
736
|
+
txt: m,
|
|
652
737
|
/**
|
|
653
738
|
* Creates a deep copy of the language with the given id and appends the given tokens.
|
|
654
739
|
*
|
|
@@ -677,11 +762,11 @@ function Re() {
|
|
|
677
762
|
* 'color': /\b(?:red|green|blue)\b/
|
|
678
763
|
* });
|
|
679
764
|
*/
|
|
680
|
-
extend: function(
|
|
681
|
-
var
|
|
682
|
-
for (var
|
|
683
|
-
|
|
684
|
-
return
|
|
765
|
+
extend: function(e, i) {
|
|
766
|
+
var s = c.util.clone(c.languages[e]);
|
|
767
|
+
for (var g in i)
|
|
768
|
+
s[g] = i[g];
|
|
769
|
+
return s;
|
|
685
770
|
},
|
|
686
771
|
/**
|
|
687
772
|
* Inserts tokens _before_ another token in a language definition or any other grammar.
|
|
@@ -758,31 +843,31 @@ function Re() {
|
|
|
758
843
|
* @returns {Grammar} The new grammar object.
|
|
759
844
|
* @public
|
|
760
845
|
*/
|
|
761
|
-
insertBefore: function(
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
var
|
|
765
|
-
for (var
|
|
766
|
-
if (
|
|
767
|
-
if (
|
|
768
|
-
for (var h in
|
|
769
|
-
|
|
770
|
-
|
|
846
|
+
insertBefore: function(e, i, s, g) {
|
|
847
|
+
g = g || /** @type {any} */
|
|
848
|
+
c.languages;
|
|
849
|
+
var d = g[e], b = {};
|
|
850
|
+
for (var S in d)
|
|
851
|
+
if (d.hasOwnProperty(S)) {
|
|
852
|
+
if (S == i)
|
|
853
|
+
for (var h in s)
|
|
854
|
+
s.hasOwnProperty(h) && (b[h] = s[h]);
|
|
855
|
+
s.hasOwnProperty(S) || (b[S] = d[S]);
|
|
771
856
|
}
|
|
772
|
-
var
|
|
773
|
-
return
|
|
774
|
-
|
|
775
|
-
}),
|
|
857
|
+
var T = g[e];
|
|
858
|
+
return g[e] = b, c.languages.DFS(c.languages, function(R, H) {
|
|
859
|
+
H === T && R != e && (this[R] = b);
|
|
860
|
+
}), b;
|
|
776
861
|
},
|
|
777
862
|
// Traverse a language definition with Depth First Search
|
|
778
|
-
DFS: function i
|
|
779
|
-
|
|
780
|
-
var
|
|
781
|
-
for (var
|
|
782
|
-
if (
|
|
783
|
-
|
|
784
|
-
var h =
|
|
785
|
-
|
|
863
|
+
DFS: function e(i, s, g, d) {
|
|
864
|
+
d = d || {};
|
|
865
|
+
var b = c.util.objId;
|
|
866
|
+
for (var S in i)
|
|
867
|
+
if (i.hasOwnProperty(S)) {
|
|
868
|
+
s.call(i, S, i[S], g || S);
|
|
869
|
+
var h = i[S], T = c.util.type(h);
|
|
870
|
+
T === "Object" && !d[b(h)] ? (d[b(h)] = !0, e(h, s, null, d)) : T === "Array" && !d[b(h)] && (d[b(h)] = !0, e(h, s, S, d));
|
|
786
871
|
}
|
|
787
872
|
}
|
|
788
873
|
},
|
|
@@ -799,8 +884,8 @@ function Re() {
|
|
|
799
884
|
* @memberof Prism
|
|
800
885
|
* @public
|
|
801
886
|
*/
|
|
802
|
-
highlightAll: function(
|
|
803
|
-
|
|
887
|
+
highlightAll: function(e, i) {
|
|
888
|
+
c.highlightAllUnder(document, e, i);
|
|
804
889
|
},
|
|
805
890
|
/**
|
|
806
891
|
* Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
|
|
@@ -817,15 +902,15 @@ function Re() {
|
|
|
817
902
|
* @memberof Prism
|
|
818
903
|
* @public
|
|
819
904
|
*/
|
|
820
|
-
highlightAllUnder: function(
|
|
821
|
-
var
|
|
822
|
-
callback:
|
|
823
|
-
container:
|
|
905
|
+
highlightAllUnder: function(e, i, s) {
|
|
906
|
+
var g = {
|
|
907
|
+
callback: s,
|
|
908
|
+
container: e,
|
|
824
909
|
selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
|
|
825
910
|
};
|
|
826
|
-
|
|
827
|
-
for (var
|
|
828
|
-
|
|
911
|
+
c.hooks.run("before-highlightall", g), g.elements = Array.prototype.slice.apply(g.container.querySelectorAll(g.selector)), c.hooks.run("before-all-elements-highlight", g);
|
|
912
|
+
for (var d = 0, b; b = g.elements[d++]; )
|
|
913
|
+
c.highlightElement(b, i === !0, g.callback);
|
|
829
914
|
},
|
|
830
915
|
/**
|
|
831
916
|
* Highlights the code inside a single element.
|
|
@@ -855,39 +940,39 @@ function Re() {
|
|
|
855
940
|
* @memberof Prism
|
|
856
941
|
* @public
|
|
857
942
|
*/
|
|
858
|
-
highlightElement: function(
|
|
859
|
-
var
|
|
860
|
-
|
|
861
|
-
var
|
|
862
|
-
|
|
863
|
-
var
|
|
864
|
-
element:
|
|
865
|
-
language:
|
|
866
|
-
grammar:
|
|
867
|
-
code:
|
|
943
|
+
highlightElement: function(e, i, s) {
|
|
944
|
+
var g = c.util.getLanguage(e), d = c.languages[g];
|
|
945
|
+
c.util.setLanguage(e, g);
|
|
946
|
+
var b = e.parentElement;
|
|
947
|
+
b && b.nodeName.toLowerCase() === "pre" && c.util.setLanguage(b, g);
|
|
948
|
+
var S = e.textContent, h = {
|
|
949
|
+
element: e,
|
|
950
|
+
language: g,
|
|
951
|
+
grammar: d,
|
|
952
|
+
code: S
|
|
868
953
|
};
|
|
869
|
-
function
|
|
870
|
-
h.highlightedCode =
|
|
954
|
+
function T(H) {
|
|
955
|
+
h.highlightedCode = H, c.hooks.run("before-insert", h), h.element.innerHTML = h.highlightedCode, c.hooks.run("after-highlight", h), c.hooks.run("complete", h), s && s.call(h.element);
|
|
871
956
|
}
|
|
872
|
-
if (
|
|
873
|
-
|
|
957
|
+
if (c.hooks.run("before-sanity-check", h), b = h.element.parentElement, b && b.nodeName.toLowerCase() === "pre" && !b.hasAttribute("tabindex") && b.setAttribute("tabindex", "0"), !h.code) {
|
|
958
|
+
c.hooks.run("complete", h), s && s.call(h.element);
|
|
874
959
|
return;
|
|
875
960
|
}
|
|
876
|
-
if (
|
|
877
|
-
|
|
961
|
+
if (c.hooks.run("before-highlight", h), !h.grammar) {
|
|
962
|
+
T(c.util.encode(h.code));
|
|
878
963
|
return;
|
|
879
964
|
}
|
|
880
|
-
if (
|
|
881
|
-
var
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
},
|
|
965
|
+
if (i && t.Worker) {
|
|
966
|
+
var R = new Worker(c.filename);
|
|
967
|
+
R.onmessage = function(H) {
|
|
968
|
+
T(H.data);
|
|
969
|
+
}, R.postMessage(JSON.stringify({
|
|
885
970
|
language: h.language,
|
|
886
971
|
code: h.code,
|
|
887
972
|
immediateClose: !0
|
|
888
973
|
}));
|
|
889
974
|
} else
|
|
890
|
-
|
|
975
|
+
T(c.highlight(h.code, h.grammar, h.language));
|
|
891
976
|
},
|
|
892
977
|
/**
|
|
893
978
|
* Low-level function, only use if you know what you’re doing. It accepts a string of text as input
|
|
@@ -909,15 +994,15 @@ function Re() {
|
|
|
909
994
|
* @example
|
|
910
995
|
* Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
|
|
911
996
|
*/
|
|
912
|
-
highlight: function(
|
|
913
|
-
var
|
|
914
|
-
code:
|
|
915
|
-
grammar:
|
|
916
|
-
language:
|
|
997
|
+
highlight: function(e, i, s) {
|
|
998
|
+
var g = {
|
|
999
|
+
code: e,
|
|
1000
|
+
grammar: i,
|
|
1001
|
+
language: s
|
|
917
1002
|
};
|
|
918
|
-
if (
|
|
919
|
-
throw new Error('The language "' +
|
|
920
|
-
return
|
|
1003
|
+
if (c.hooks.run("before-tokenize", g), !g.grammar)
|
|
1004
|
+
throw new Error('The language "' + g.language + '" has no grammar.');
|
|
1005
|
+
return g.tokens = c.tokenize(g.code, g.grammar), c.hooks.run("after-tokenize", g), k.stringify(c.util.encode(g.tokens), g.language);
|
|
921
1006
|
},
|
|
922
1007
|
/**
|
|
923
1008
|
* This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
|
|
@@ -943,15 +1028,15 @@ function Re() {
|
|
|
943
1028
|
* }
|
|
944
1029
|
* });
|
|
945
1030
|
*/
|
|
946
|
-
tokenize: function(
|
|
947
|
-
var
|
|
948
|
-
if (
|
|
949
|
-
for (var
|
|
950
|
-
|
|
951
|
-
delete
|
|
1031
|
+
tokenize: function(e, i) {
|
|
1032
|
+
var s = i.rest;
|
|
1033
|
+
if (s) {
|
|
1034
|
+
for (var g in s)
|
|
1035
|
+
i[g] = s[g];
|
|
1036
|
+
delete i.rest;
|
|
952
1037
|
}
|
|
953
|
-
var
|
|
954
|
-
return $(
|
|
1038
|
+
var d = new w();
|
|
1039
|
+
return $(d, d.head, e), x(e, d, i, d.head, 0), E(d);
|
|
955
1040
|
},
|
|
956
1041
|
/**
|
|
957
1042
|
* @namespace
|
|
@@ -972,9 +1057,9 @@ function Re() {
|
|
|
972
1057
|
* @param {HookCallback} callback The callback function which is given environment variables.
|
|
973
1058
|
* @public
|
|
974
1059
|
*/
|
|
975
|
-
add: function(
|
|
976
|
-
var
|
|
977
|
-
|
|
1060
|
+
add: function(e, i) {
|
|
1061
|
+
var s = c.hooks.all;
|
|
1062
|
+
s[e] = s[e] || [], s[e].push(i);
|
|
978
1063
|
},
|
|
979
1064
|
/**
|
|
980
1065
|
* Runs a hook invoking all registered callbacks with the given environment variables.
|
|
@@ -985,135 +1070,135 @@ function Re() {
|
|
|
985
1070
|
* @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
|
|
986
1071
|
* @public
|
|
987
1072
|
*/
|
|
988
|
-
run: function(
|
|
989
|
-
var
|
|
990
|
-
if (!(!
|
|
991
|
-
for (var
|
|
992
|
-
|
|
1073
|
+
run: function(e, i) {
|
|
1074
|
+
var s = c.hooks.all[e];
|
|
1075
|
+
if (!(!s || !s.length))
|
|
1076
|
+
for (var g = 0, d; d = s[g++]; )
|
|
1077
|
+
d(i);
|
|
993
1078
|
}
|
|
994
1079
|
},
|
|
995
|
-
Token:
|
|
1080
|
+
Token: k
|
|
996
1081
|
};
|
|
997
|
-
t.Prism =
|
|
998
|
-
function
|
|
999
|
-
this.type =
|
|
1082
|
+
t.Prism = c;
|
|
1083
|
+
function k(e, i, s, g) {
|
|
1084
|
+
this.type = e, this.content = i, this.alias = s, this.length = (g || "").length | 0;
|
|
1000
1085
|
}
|
|
1001
|
-
|
|
1002
|
-
if (typeof
|
|
1003
|
-
return
|
|
1004
|
-
if (Array.isArray(
|
|
1005
|
-
var
|
|
1006
|
-
return
|
|
1007
|
-
|
|
1008
|
-
}),
|
|
1086
|
+
k.stringify = function e(i, s) {
|
|
1087
|
+
if (typeof i == "string")
|
|
1088
|
+
return i;
|
|
1089
|
+
if (Array.isArray(i)) {
|
|
1090
|
+
var g = "";
|
|
1091
|
+
return i.forEach(function(T) {
|
|
1092
|
+
g += e(T, s);
|
|
1093
|
+
}), g;
|
|
1009
1094
|
}
|
|
1010
|
-
var
|
|
1011
|
-
type:
|
|
1012
|
-
content: i
|
|
1095
|
+
var d = {
|
|
1096
|
+
type: i.type,
|
|
1097
|
+
content: e(i.content, s),
|
|
1013
1098
|
tag: "span",
|
|
1014
|
-
classes: ["token",
|
|
1099
|
+
classes: ["token", i.type],
|
|
1015
1100
|
attributes: {},
|
|
1016
|
-
language:
|
|
1017
|
-
},
|
|
1018
|
-
|
|
1019
|
-
var
|
|
1020
|
-
for (var h in
|
|
1021
|
-
|
|
1022
|
-
return "<" +
|
|
1101
|
+
language: s
|
|
1102
|
+
}, b = i.alias;
|
|
1103
|
+
b && (Array.isArray(b) ? Array.prototype.push.apply(d.classes, b) : d.classes.push(b)), c.hooks.run("wrap", d);
|
|
1104
|
+
var S = "";
|
|
1105
|
+
for (var h in d.attributes)
|
|
1106
|
+
S += " " + h + '="' + (d.attributes[h] || "").replace(/"/g, """) + '"';
|
|
1107
|
+
return "<" + d.tag + ' class="' + d.classes.join(" ") + '"' + S + ">" + d.content + "</" + d.tag + ">";
|
|
1023
1108
|
};
|
|
1024
|
-
function
|
|
1025
|
-
|
|
1026
|
-
var
|
|
1027
|
-
if (
|
|
1028
|
-
var
|
|
1029
|
-
|
|
1109
|
+
function P(e, i, s, g) {
|
|
1110
|
+
e.lastIndex = i;
|
|
1111
|
+
var d = e.exec(s);
|
|
1112
|
+
if (d && g && d[1]) {
|
|
1113
|
+
var b = d[1].length;
|
|
1114
|
+
d.index += b, d[0] = d[0].slice(b);
|
|
1030
1115
|
}
|
|
1031
|
-
return
|
|
1116
|
+
return d;
|
|
1032
1117
|
}
|
|
1033
|
-
function
|
|
1034
|
-
for (var
|
|
1035
|
-
if (!(!
|
|
1036
|
-
var h =
|
|
1118
|
+
function x(e, i, s, g, d, b) {
|
|
1119
|
+
for (var S in s)
|
|
1120
|
+
if (!(!s.hasOwnProperty(S) || !s[S])) {
|
|
1121
|
+
var h = s[S];
|
|
1037
1122
|
h = Array.isArray(h) ? h : [h];
|
|
1038
|
-
for (var
|
|
1039
|
-
if (
|
|
1123
|
+
for (var T = 0; T < h.length; ++T) {
|
|
1124
|
+
if (b && b.cause == S + "," + T)
|
|
1040
1125
|
return;
|
|
1041
|
-
var
|
|
1042
|
-
if (
|
|
1043
|
-
var
|
|
1044
|
-
|
|
1126
|
+
var R = h[T], H = R.inside, Q = !!R.lookbehind, ee = !!R.greedy, ie = R.alias;
|
|
1127
|
+
if (ee && !R.pattern.global) {
|
|
1128
|
+
var ge = R.pattern.toString().match(/[imsuy]*$/)[0];
|
|
1129
|
+
R.pattern = RegExp(R.pattern.source, ge + "g");
|
|
1045
1130
|
}
|
|
1046
|
-
for (var
|
|
1047
|
-
var
|
|
1048
|
-
if (
|
|
1131
|
+
for (var te = R.pattern || R, L = g.next, z = d; L !== i.tail && !(b && z >= b.reach); z += L.value.length, L = L.next) {
|
|
1132
|
+
var N = L.value;
|
|
1133
|
+
if (i.length > e.length)
|
|
1049
1134
|
return;
|
|
1050
|
-
if (!(
|
|
1051
|
-
var
|
|
1052
|
-
if (
|
|
1053
|
-
if (
|
|
1135
|
+
if (!(N instanceof k)) {
|
|
1136
|
+
var W = 1, D;
|
|
1137
|
+
if (ee) {
|
|
1138
|
+
if (D = P(te, z, e, Q), !D || D.index >= e.length)
|
|
1054
1139
|
break;
|
|
1055
|
-
var
|
|
1056
|
-
for (
|
|
1057
|
-
L = L.next,
|
|
1058
|
-
if (
|
|
1140
|
+
var G = D.index, ne = D.index + D[0].length, j = z;
|
|
1141
|
+
for (j += L.value.length; G >= j; )
|
|
1142
|
+
L = L.next, j += L.value.length;
|
|
1143
|
+
if (j -= L.value.length, z = j, L.value instanceof k)
|
|
1059
1144
|
continue;
|
|
1060
|
-
for (var
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
} else if (
|
|
1145
|
+
for (var K = L; K !== i.tail && (j < ne || typeof K.value == "string"); K = K.next)
|
|
1146
|
+
W++, j += K.value.length;
|
|
1147
|
+
W--, N = e.slice(z, j), D.index -= z;
|
|
1148
|
+
} else if (D = P(te, 0, N, Q), !D)
|
|
1064
1149
|
continue;
|
|
1065
|
-
var
|
|
1066
|
-
|
|
1067
|
-
var
|
|
1068
|
-
|
|
1069
|
-
var
|
|
1070
|
-
if (L = $(
|
|
1071
|
-
var
|
|
1072
|
-
cause:
|
|
1073
|
-
reach:
|
|
1150
|
+
var G = D.index, Z = D[0], X = N.slice(0, G), re = N.slice(G + Z.length), V = z + N.length;
|
|
1151
|
+
b && V > b.reach && (b.reach = V);
|
|
1152
|
+
var I = L.prev;
|
|
1153
|
+
X && (I = $(i, I, X), z += X.length), F(i, I, W);
|
|
1154
|
+
var se = new k(S, H ? c.tokenize(Z, H) : Z, ie, Z);
|
|
1155
|
+
if (L = $(i, I, se), re && $(i, L, re), W > 1) {
|
|
1156
|
+
var Y = {
|
|
1157
|
+
cause: S + "," + T,
|
|
1158
|
+
reach: V
|
|
1074
1159
|
};
|
|
1075
|
-
|
|
1160
|
+
x(e, i, s, L.prev, z, Y), b && Y.reach > b.reach && (b.reach = Y.reach);
|
|
1076
1161
|
}
|
|
1077
1162
|
}
|
|
1078
1163
|
}
|
|
1079
1164
|
}
|
|
1080
1165
|
}
|
|
1081
1166
|
}
|
|
1082
|
-
function
|
|
1083
|
-
var
|
|
1084
|
-
|
|
1167
|
+
function w() {
|
|
1168
|
+
var e = { value: null, prev: null, next: null }, i = { value: null, prev: e, next: null };
|
|
1169
|
+
e.next = i, this.head = e, this.tail = i, this.length = 0;
|
|
1085
1170
|
}
|
|
1086
|
-
function $(
|
|
1087
|
-
var
|
|
1088
|
-
return
|
|
1171
|
+
function $(e, i, s) {
|
|
1172
|
+
var g = i.next, d = { value: s, prev: i, next: g };
|
|
1173
|
+
return i.next = d, g.prev = d, e.length++, d;
|
|
1089
1174
|
}
|
|
1090
|
-
function
|
|
1091
|
-
for (var
|
|
1092
|
-
|
|
1093
|
-
|
|
1175
|
+
function F(e, i, s) {
|
|
1176
|
+
for (var g = i.next, d = 0; d < s && g !== e.tail; d++)
|
|
1177
|
+
g = g.next;
|
|
1178
|
+
i.next = g, g.prev = i, e.length -= d;
|
|
1094
1179
|
}
|
|
1095
|
-
function
|
|
1096
|
-
for (var
|
|
1097
|
-
|
|
1098
|
-
return
|
|
1180
|
+
function E(e) {
|
|
1181
|
+
for (var i = [], s = e.head.next; s !== e.tail; )
|
|
1182
|
+
i.push(s.value), s = s.next;
|
|
1183
|
+
return i;
|
|
1099
1184
|
}
|
|
1100
1185
|
if (!t.document)
|
|
1101
|
-
return t.addEventListener && (
|
|
1102
|
-
var
|
|
1103
|
-
t.postMessage(
|
|
1104
|
-
}, !1)),
|
|
1105
|
-
var y =
|
|
1106
|
-
y && (
|
|
1107
|
-
function
|
|
1108
|
-
|
|
1186
|
+
return t.addEventListener && (c.disableWorkerMessageHandler || t.addEventListener("message", function(e) {
|
|
1187
|
+
var i = JSON.parse(e.data), s = i.language, g = i.code, d = i.immediateClose;
|
|
1188
|
+
t.postMessage(c.highlight(g, c.languages[s], s)), d && t.close();
|
|
1189
|
+
}, !1)), c;
|
|
1190
|
+
var y = c.util.currentScript();
|
|
1191
|
+
y && (c.filename = y.src, y.hasAttribute("data-manual") && (c.manual = !0));
|
|
1192
|
+
function p() {
|
|
1193
|
+
c.manual || c.highlightAll();
|
|
1109
1194
|
}
|
|
1110
|
-
if (!
|
|
1111
|
-
var
|
|
1112
|
-
|
|
1195
|
+
if (!c.manual) {
|
|
1196
|
+
var f = document.readyState;
|
|
1197
|
+
f === "loading" || f === "interactive" && y && y.defer ? document.addEventListener("DOMContentLoaded", p) : window.requestAnimationFrame ? window.requestAnimationFrame(p) : window.setTimeout(p, 16);
|
|
1113
1198
|
}
|
|
1114
|
-
return
|
|
1115
|
-
})(
|
|
1116
|
-
|
|
1199
|
+
return c;
|
|
1200
|
+
})(o);
|
|
1201
|
+
r.exports && (r.exports = n), typeof De < "u" && (De.Prism = n), n.languages.markup = {
|
|
1117
1202
|
comment: {
|
|
1118
1203
|
pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
|
|
1119
1204
|
greedy: !0
|
|
@@ -1190,9 +1275,9 @@ function Re() {
|
|
|
1190
1275
|
},
|
|
1191
1276
|
/&#x?[\da-f]{1,8};/i
|
|
1192
1277
|
]
|
|
1193
|
-
},
|
|
1278
|
+
}, 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(t) {
|
|
1194
1279
|
t.type === "entity" && (t.attributes.title = t.content.replace(/&/, "&"));
|
|
1195
|
-
}), Object.defineProperty(
|
|
1280
|
+
}), Object.defineProperty(n.languages.markup.tag, "addInlined", {
|
|
1196
1281
|
/**
|
|
1197
1282
|
* Adds an inlined language to markup.
|
|
1198
1283
|
*
|
|
@@ -1204,34 +1289,34 @@ function Re() {
|
|
|
1204
1289
|
* @example
|
|
1205
1290
|
* addInlined('style', 'css');
|
|
1206
1291
|
*/
|
|
1207
|
-
value: function(
|
|
1208
|
-
var
|
|
1209
|
-
|
|
1292
|
+
value: function(u, l) {
|
|
1293
|
+
var m = {};
|
|
1294
|
+
m["language-" + l] = {
|
|
1210
1295
|
pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
|
|
1211
1296
|
lookbehind: !0,
|
|
1212
|
-
inside:
|
|
1213
|
-
},
|
|
1214
|
-
var
|
|
1297
|
+
inside: n.languages[l]
|
|
1298
|
+
}, m.cdata = /^<!\[CDATA\[|\]\]>$/i;
|
|
1299
|
+
var c = {
|
|
1215
1300
|
"included-cdata": {
|
|
1216
1301
|
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
1217
|
-
inside:
|
|
1302
|
+
inside: m
|
|
1218
1303
|
}
|
|
1219
1304
|
};
|
|
1220
|
-
|
|
1305
|
+
c["language-" + l] = {
|
|
1221
1306
|
pattern: /[\s\S]+/,
|
|
1222
|
-
inside:
|
|
1307
|
+
inside: n.languages[l]
|
|
1223
1308
|
};
|
|
1224
|
-
var
|
|
1225
|
-
|
|
1309
|
+
var k = {};
|
|
1310
|
+
k[u] = {
|
|
1226
1311
|
pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
|
|
1227
|
-
return
|
|
1312
|
+
return u;
|
|
1228
1313
|
}), "i"),
|
|
1229
1314
|
lookbehind: !0,
|
|
1230
1315
|
greedy: !0,
|
|
1231
|
-
inside:
|
|
1232
|
-
},
|
|
1316
|
+
inside: c
|
|
1317
|
+
}, n.languages.insertBefore("markup", "cdata", k);
|
|
1233
1318
|
}
|
|
1234
|
-
}), Object.defineProperty(
|
|
1319
|
+
}), Object.defineProperty(n.languages.markup.tag, "addAttribute", {
|
|
1235
1320
|
/**
|
|
1236
1321
|
* Adds an pattern to highlight languages embedded in HTML attributes.
|
|
1237
1322
|
*
|
|
@@ -1243,8 +1328,8 @@ function Re() {
|
|
|
1243
1328
|
* @example
|
|
1244
1329
|
* addAttribute('style', 'css');
|
|
1245
1330
|
*/
|
|
1246
|
-
value: function(t,
|
|
1247
|
-
|
|
1331
|
+
value: function(t, u) {
|
|
1332
|
+
n.languages.markup.tag.inside["special-attr"].push({
|
|
1248
1333
|
pattern: RegExp(
|
|
1249
1334
|
/(^|["'\s])/.source + "(?:" + t + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
|
|
1250
1335
|
"i"
|
|
@@ -1258,8 +1343,8 @@ function Re() {
|
|
|
1258
1343
|
value: {
|
|
1259
1344
|
pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
|
|
1260
1345
|
lookbehind: !0,
|
|
1261
|
-
alias: [
|
|
1262
|
-
inside:
|
|
1346
|
+
alias: [u, "language-" + u],
|
|
1347
|
+
inside: n.languages[u]
|
|
1263
1348
|
},
|
|
1264
1349
|
punctuation: [
|
|
1265
1350
|
{
|
|
@@ -1273,12 +1358,12 @@ function Re() {
|
|
|
1273
1358
|
}
|
|
1274
1359
|
});
|
|
1275
1360
|
}
|
|
1276
|
-
}),
|
|
1277
|
-
var
|
|
1361
|
+
}), 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(t) {
|
|
1362
|
+
var u = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
|
1278
1363
|
t.languages.css = {
|
|
1279
1364
|
comment: /\/\*[\s\S]*?\*\//,
|
|
1280
1365
|
atrule: {
|
|
1281
|
-
pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" +
|
|
1366
|
+
pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + u.source + ")*?" + /(?:;|(?=\s*\{))/.source),
|
|
1282
1367
|
inside: {
|
|
1283
1368
|
rule: /^@[\w-]+/,
|
|
1284
1369
|
"selector-function-argument": {
|
|
@@ -1295,23 +1380,23 @@ function Re() {
|
|
|
1295
1380
|
},
|
|
1296
1381
|
url: {
|
|
1297
1382
|
// https://drafts.csswg.org/css-values-3/#urls
|
|
1298
|
-
pattern: RegExp("\\burl\\((?:" +
|
|
1383
|
+
pattern: RegExp("\\burl\\((?:" + u.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
|
|
1299
1384
|
greedy: !0,
|
|
1300
1385
|
inside: {
|
|
1301
1386
|
function: /^url/i,
|
|
1302
1387
|
punctuation: /^\(|\)$/,
|
|
1303
1388
|
string: {
|
|
1304
|
-
pattern: RegExp("^" +
|
|
1389
|
+
pattern: RegExp("^" + u.source + "$"),
|
|
1305
1390
|
alias: "url"
|
|
1306
1391
|
}
|
|
1307
1392
|
}
|
|
1308
1393
|
},
|
|
1309
1394
|
selector: {
|
|
1310
|
-
pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` +
|
|
1395
|
+
pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` + u.source + ")*(?=\\s*\\{)"),
|
|
1311
1396
|
lookbehind: !0
|
|
1312
1397
|
},
|
|
1313
1398
|
string: {
|
|
1314
|
-
pattern:
|
|
1399
|
+
pattern: u,
|
|
1315
1400
|
greedy: !0
|
|
1316
1401
|
},
|
|
1317
1402
|
property: {
|
|
@@ -1325,9 +1410,9 @@ function Re() {
|
|
|
1325
1410
|
},
|
|
1326
1411
|
punctuation: /[(){};:,]/
|
|
1327
1412
|
}, t.languages.css.atrule.inside.rest = t.languages.css;
|
|
1328
|
-
var
|
|
1329
|
-
|
|
1330
|
-
})(
|
|
1413
|
+
var l = t.languages.markup;
|
|
1414
|
+
l && (l.tag.addInlined("style", "css"), l.tag.addAttribute("style", "css"));
|
|
1415
|
+
})(n), n.languages.clike = {
|
|
1331
1416
|
comment: [
|
|
1332
1417
|
{
|
|
1333
1418
|
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
|
|
@@ -1357,9 +1442,9 @@ function Re() {
|
|
|
1357
1442
|
number: /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
|
|
1358
1443
|
operator: /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
|
|
1359
1444
|
punctuation: /[{}[\];(),.:]/
|
|
1360
|
-
},
|
|
1445
|
+
}, n.languages.javascript = n.languages.extend("clike", {
|
|
1361
1446
|
"class-name": [
|
|
1362
|
-
|
|
1447
|
+
n.languages.clike["class-name"],
|
|
1363
1448
|
{
|
|
1364
1449
|
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
|
|
1365
1450
|
lookbehind: !0
|
|
@@ -1390,7 +1475,7 @@ function Re() {
|
|
|
1390
1475
|
lookbehind: !0
|
|
1391
1476
|
},
|
|
1392
1477
|
operator: /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
|
|
1393
|
-
}),
|
|
1478
|
+
}), n.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/, n.languages.insertBefore("javascript", "keyword", {
|
|
1394
1479
|
regex: {
|
|
1395
1480
|
pattern: RegExp(
|
|
1396
1481
|
// lookbehind
|
|
@@ -1410,7 +1495,7 @@ function Re() {
|
|
|
1410
1495
|
pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
|
|
1411
1496
|
lookbehind: !0,
|
|
1412
1497
|
alias: "language-regex",
|
|
1413
|
-
inside:
|
|
1498
|
+
inside: n.languages.regex
|
|
1414
1499
|
},
|
|
1415
1500
|
"regex-delimiter": /^\/|\/$/,
|
|
1416
1501
|
"regex-flags": /^[a-z]+$/
|
|
@@ -1425,26 +1510,26 @@ function Re() {
|
|
|
1425
1510
|
{
|
|
1426
1511
|
pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
|
|
1427
1512
|
lookbehind: !0,
|
|
1428
|
-
inside:
|
|
1513
|
+
inside: n.languages.javascript
|
|
1429
1514
|
},
|
|
1430
1515
|
{
|
|
1431
1516
|
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
|
|
1432
1517
|
lookbehind: !0,
|
|
1433
|
-
inside:
|
|
1518
|
+
inside: n.languages.javascript
|
|
1434
1519
|
},
|
|
1435
1520
|
{
|
|
1436
1521
|
pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
|
|
1437
1522
|
lookbehind: !0,
|
|
1438
|
-
inside:
|
|
1523
|
+
inside: n.languages.javascript
|
|
1439
1524
|
},
|
|
1440
1525
|
{
|
|
1441
1526
|
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*\{)/,
|
|
1442
1527
|
lookbehind: !0,
|
|
1443
|
-
inside:
|
|
1528
|
+
inside: n.languages.javascript
|
|
1444
1529
|
}
|
|
1445
1530
|
],
|
|
1446
1531
|
constant: /\b[A-Z](?:[A-Z_]|\dx?)*\b/
|
|
1447
|
-
}),
|
|
1532
|
+
}), n.languages.insertBefore("javascript", "string", {
|
|
1448
1533
|
hashbang: {
|
|
1449
1534
|
pattern: /^#!.*/,
|
|
1450
1535
|
greedy: !0,
|
|
@@ -1466,7 +1551,7 @@ function Re() {
|
|
|
1466
1551
|
pattern: /^\$\{|\}$/,
|
|
1467
1552
|
alias: "punctuation"
|
|
1468
1553
|
},
|
|
1469
|
-
rest:
|
|
1554
|
+
rest: n.languages.javascript
|
|
1470
1555
|
}
|
|
1471
1556
|
},
|
|
1472
1557
|
string: /[\s\S]+/
|
|
@@ -1478,22 +1563,22 @@ function Re() {
|
|
|
1478
1563
|
greedy: !0,
|
|
1479
1564
|
alias: "property"
|
|
1480
1565
|
}
|
|
1481
|
-
}),
|
|
1566
|
+
}), n.languages.insertBefore("javascript", "operator", {
|
|
1482
1567
|
"literal-property": {
|
|
1483
1568
|
pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
|
|
1484
1569
|
lookbehind: !0,
|
|
1485
1570
|
alias: "property"
|
|
1486
1571
|
}
|
|
1487
|
-
}),
|
|
1572
|
+
}), n.languages.markup && (n.languages.markup.tag.addInlined("script", "javascript"), n.languages.markup.tag.addAttribute(
|
|
1488
1573
|
/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)/.source,
|
|
1489
1574
|
"javascript"
|
|
1490
|
-
)),
|
|
1491
|
-
if (typeof
|
|
1575
|
+
)), n.languages.js = n.languages.javascript, (function() {
|
|
1576
|
+
if (typeof n > "u" || typeof document > "u")
|
|
1492
1577
|
return;
|
|
1493
1578
|
Element.prototype.matches || (Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector);
|
|
1494
|
-
var t = "Loading…",
|
|
1495
|
-
return "✖ Error " + y + " while fetching file: " +
|
|
1496
|
-
},
|
|
1579
|
+
var t = "Loading…", u = function(y, p) {
|
|
1580
|
+
return "✖ Error " + y + " while fetching file: " + p;
|
|
1581
|
+
}, l = "✖ Error: File does not exist or is empty", m = {
|
|
1497
1582
|
js: "javascript",
|
|
1498
1583
|
py: "python",
|
|
1499
1584
|
rb: "ruby",
|
|
@@ -1503,56 +1588,56 @@ function Re() {
|
|
|
1503
1588
|
bat: "batch",
|
|
1504
1589
|
h: "c",
|
|
1505
1590
|
tex: "latex"
|
|
1506
|
-
},
|
|
1507
|
-
function $(y,
|
|
1508
|
-
var
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
},
|
|
1591
|
+
}, c = "data-src-status", k = "loading", P = "loaded", x = "failed", w = "pre[data-src]:not([" + c + '="' + P + '"]):not([' + c + '="' + k + '"])';
|
|
1592
|
+
function $(y, p, f) {
|
|
1593
|
+
var e = new XMLHttpRequest();
|
|
1594
|
+
e.open("GET", y, !0), e.onreadystatechange = function() {
|
|
1595
|
+
e.readyState == 4 && (e.status < 400 && e.responseText ? p(e.responseText) : e.status >= 400 ? f(u(e.status, e.statusText)) : f(l));
|
|
1596
|
+
}, e.send(null);
|
|
1512
1597
|
}
|
|
1513
|
-
function
|
|
1514
|
-
var
|
|
1515
|
-
if (
|
|
1516
|
-
var
|
|
1517
|
-
return
|
|
1598
|
+
function F(y) {
|
|
1599
|
+
var p = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(y || "");
|
|
1600
|
+
if (p) {
|
|
1601
|
+
var f = Number(p[1]), e = p[2], i = p[3];
|
|
1602
|
+
return e ? i ? [f, Number(i)] : [f, void 0] : [f, f];
|
|
1518
1603
|
}
|
|
1519
1604
|
}
|
|
1520
|
-
|
|
1521
|
-
y.selector += ", " +
|
|
1522
|
-
}),
|
|
1523
|
-
var
|
|
1605
|
+
n.hooks.add("before-highlightall", function(y) {
|
|
1606
|
+
y.selector += ", " + w;
|
|
1607
|
+
}), n.hooks.add("before-sanity-check", function(y) {
|
|
1608
|
+
var p = (
|
|
1524
1609
|
/** @type {HTMLPreElement} */
|
|
1525
1610
|
y.element
|
|
1526
1611
|
);
|
|
1527
|
-
if (
|
|
1528
|
-
y.code = "",
|
|
1529
|
-
var
|
|
1530
|
-
|
|
1531
|
-
var
|
|
1532
|
-
if (
|
|
1533
|
-
var
|
|
1534
|
-
|
|
1612
|
+
if (p.matches(w)) {
|
|
1613
|
+
y.code = "", p.setAttribute(c, k);
|
|
1614
|
+
var f = p.appendChild(document.createElement("CODE"));
|
|
1615
|
+
f.textContent = t;
|
|
1616
|
+
var e = p.getAttribute("data-src"), i = y.language;
|
|
1617
|
+
if (i === "none") {
|
|
1618
|
+
var s = (/\.(\w+)$/.exec(e) || [, "none"])[1];
|
|
1619
|
+
i = m[s] || s;
|
|
1535
1620
|
}
|
|
1536
|
-
|
|
1537
|
-
var
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
function(
|
|
1541
|
-
|
|
1542
|
-
var
|
|
1543
|
-
if (
|
|
1544
|
-
var
|
|
1545
|
-
h < 0 && (h +=
|
|
1546
|
-
`),
|
|
1621
|
+
n.util.setLanguage(f, i), n.util.setLanguage(p, i);
|
|
1622
|
+
var g = n.plugins.autoloader;
|
|
1623
|
+
g && g.loadLanguages(i), $(
|
|
1624
|
+
e,
|
|
1625
|
+
function(d) {
|
|
1626
|
+
p.setAttribute(c, P);
|
|
1627
|
+
var b = F(p.getAttribute("data-range"));
|
|
1628
|
+
if (b) {
|
|
1629
|
+
var S = d.split(/\r\n?|\n/g), h = b[0], T = b[1] == null ? S.length : b[1];
|
|
1630
|
+
h < 0 && (h += S.length), h = Math.max(0, Math.min(h - 1, S.length)), T < 0 && (T += S.length), T = Math.max(0, Math.min(T, S.length)), d = S.slice(h, T).join(`
|
|
1631
|
+
`), p.hasAttribute("data-start") || p.setAttribute("data-start", String(h + 1));
|
|
1547
1632
|
}
|
|
1548
|
-
|
|
1633
|
+
f.textContent = d, n.highlightElement(f);
|
|
1549
1634
|
},
|
|
1550
|
-
function(
|
|
1551
|
-
|
|
1635
|
+
function(d) {
|
|
1636
|
+
p.setAttribute(c, x), f.textContent = d;
|
|
1552
1637
|
}
|
|
1553
1638
|
);
|
|
1554
1639
|
}
|
|
1555
|
-
}),
|
|
1640
|
+
}), n.plugins.fileHighlight = {
|
|
1556
1641
|
/**
|
|
1557
1642
|
* Executes the File Highlight plugin for all matching `pre` elements under the given container.
|
|
1558
1643
|
*
|
|
@@ -1560,20 +1645,20 @@ function Re() {
|
|
|
1560
1645
|
*
|
|
1561
1646
|
* @param {ParentNode} [container=document]
|
|
1562
1647
|
*/
|
|
1563
|
-
highlight: function(
|
|
1564
|
-
for (var
|
|
1565
|
-
|
|
1648
|
+
highlight: function(p) {
|
|
1649
|
+
for (var f = (p || document).querySelectorAll(w), e = 0, i; i = f[e++]; )
|
|
1650
|
+
n.highlightElement(i);
|
|
1566
1651
|
}
|
|
1567
1652
|
};
|
|
1568
|
-
var
|
|
1569
|
-
|
|
1570
|
-
|
|
1653
|
+
var E = !1;
|
|
1654
|
+
n.fileHighlight = function() {
|
|
1655
|
+
E || (console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."), E = !0), n.plugins.fileHighlight.highlight.apply(this, arguments);
|
|
1571
1656
|
};
|
|
1572
1657
|
})();
|
|
1573
|
-
})(
|
|
1658
|
+
})(me)), me.exports;
|
|
1574
1659
|
}
|
|
1575
|
-
var
|
|
1576
|
-
const
|
|
1660
|
+
var tt = et();
|
|
1661
|
+
const Me = /* @__PURE__ */ Qe(tt);
|
|
1577
1662
|
Prism.languages.markup = {
|
|
1578
1663
|
comment: {
|
|
1579
1664
|
pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
|
|
@@ -1654,8 +1739,8 @@ Prism.languages.markup = {
|
|
|
1654
1739
|
};
|
|
1655
1740
|
Prism.languages.markup.tag.inside["attr-value"].inside.entity = Prism.languages.markup.entity;
|
|
1656
1741
|
Prism.languages.markup.doctype.inside["internal-subset"].inside = Prism.languages.markup;
|
|
1657
|
-
Prism.hooks.add("wrap", function(
|
|
1658
|
-
|
|
1742
|
+
Prism.hooks.add("wrap", function(r) {
|
|
1743
|
+
r.type === "entity" && (r.attributes.title = r.content.replace(/&/, "&"));
|
|
1659
1744
|
});
|
|
1660
1745
|
Object.defineProperty(Prism.languages.markup.tag, "addInlined", {
|
|
1661
1746
|
/**
|
|
@@ -1669,32 +1754,32 @@ Object.defineProperty(Prism.languages.markup.tag, "addInlined", {
|
|
|
1669
1754
|
* @example
|
|
1670
1755
|
* addInlined('style', 'css');
|
|
1671
1756
|
*/
|
|
1672
|
-
value: function(
|
|
1757
|
+
value: function(o, n) {
|
|
1673
1758
|
var t = {};
|
|
1674
|
-
t["language-" +
|
|
1759
|
+
t["language-" + n] = {
|
|
1675
1760
|
pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
|
|
1676
1761
|
lookbehind: !0,
|
|
1677
|
-
inside: Prism.languages[
|
|
1762
|
+
inside: Prism.languages[n]
|
|
1678
1763
|
}, t.cdata = /^<!\[CDATA\[|\]\]>$/i;
|
|
1679
|
-
var
|
|
1764
|
+
var u = {
|
|
1680
1765
|
"included-cdata": {
|
|
1681
1766
|
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
1682
1767
|
inside: t
|
|
1683
1768
|
}
|
|
1684
1769
|
};
|
|
1685
|
-
|
|
1770
|
+
u["language-" + n] = {
|
|
1686
1771
|
pattern: /[\s\S]+/,
|
|
1687
|
-
inside: Prism.languages[
|
|
1772
|
+
inside: Prism.languages[n]
|
|
1688
1773
|
};
|
|
1689
|
-
var
|
|
1690
|
-
|
|
1774
|
+
var l = {};
|
|
1775
|
+
l[o] = {
|
|
1691
1776
|
pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
|
|
1692
|
-
return
|
|
1777
|
+
return o;
|
|
1693
1778
|
}), "i"),
|
|
1694
1779
|
lookbehind: !0,
|
|
1695
1780
|
greedy: !0,
|
|
1696
|
-
inside:
|
|
1697
|
-
}, Prism.languages.insertBefore("markup", "cdata",
|
|
1781
|
+
inside: u
|
|
1782
|
+
}, Prism.languages.insertBefore("markup", "cdata", l);
|
|
1698
1783
|
}
|
|
1699
1784
|
});
|
|
1700
1785
|
Object.defineProperty(Prism.languages.markup.tag, "addAttribute", {
|
|
@@ -1709,10 +1794,10 @@ Object.defineProperty(Prism.languages.markup.tag, "addAttribute", {
|
|
|
1709
1794
|
* @example
|
|
1710
1795
|
* addAttribute('style', 'css');
|
|
1711
1796
|
*/
|
|
1712
|
-
value: function(
|
|
1797
|
+
value: function(r, o) {
|
|
1713
1798
|
Prism.languages.markup.tag.inside["special-attr"].push({
|
|
1714
1799
|
pattern: RegExp(
|
|
1715
|
-
/(^|["'\s])/.source + "(?:" +
|
|
1800
|
+
/(^|["'\s])/.source + "(?:" + r + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
|
|
1716
1801
|
"i"
|
|
1717
1802
|
),
|
|
1718
1803
|
lookbehind: !0,
|
|
@@ -1724,8 +1809,8 @@ Object.defineProperty(Prism.languages.markup.tag, "addAttribute", {
|
|
|
1724
1809
|
value: {
|
|
1725
1810
|
pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
|
|
1726
1811
|
lookbehind: !0,
|
|
1727
|
-
alias: [
|
|
1728
|
-
inside: Prism.languages[
|
|
1812
|
+
alias: [o, "language-" + o],
|
|
1813
|
+
inside: Prism.languages[o]
|
|
1729
1814
|
},
|
|
1730
1815
|
punctuation: [
|
|
1731
1816
|
{
|
|
@@ -1747,17 +1832,17 @@ Prism.languages.xml = Prism.languages.extend("markup", {});
|
|
|
1747
1832
|
Prism.languages.ssml = Prism.languages.xml;
|
|
1748
1833
|
Prism.languages.atom = Prism.languages.xml;
|
|
1749
1834
|
Prism.languages.rss = Prism.languages.xml;
|
|
1750
|
-
(function(
|
|
1751
|
-
var
|
|
1752
|
-
function
|
|
1753
|
-
return
|
|
1754
|
-
return
|
|
1755
|
-
}), RegExp(/((?:^|[^\\])(?:\\{2})*)/.source + "(?:" +
|
|
1835
|
+
(function(r) {
|
|
1836
|
+
var o = /(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;
|
|
1837
|
+
function n(x) {
|
|
1838
|
+
return x = x.replace(/<inner>/g, function() {
|
|
1839
|
+
return o;
|
|
1840
|
+
}), RegExp(/((?:^|[^\\])(?:\\{2})*)/.source + "(?:" + x + ")");
|
|
1756
1841
|
}
|
|
1757
|
-
var t = /(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,
|
|
1842
|
+
var t = /(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source, u = /\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g, function() {
|
|
1758
1843
|
return t;
|
|
1759
|
-
}),
|
|
1760
|
-
|
|
1844
|
+
}), l = /\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;
|
|
1845
|
+
r.languages.markdown = r.languages.extend("markup", {}), r.languages.insertBefore("markdown", "prolog", {
|
|
1761
1846
|
"front-matter-block": {
|
|
1762
1847
|
pattern: /(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,
|
|
1763
1848
|
lookbehind: !0,
|
|
@@ -1767,7 +1852,7 @@ Prism.languages.rss = Prism.languages.xml;
|
|
|
1767
1852
|
"front-matter": {
|
|
1768
1853
|
pattern: /\S+(?:\s+\S+)*/,
|
|
1769
1854
|
alias: ["yaml", "language-yaml"],
|
|
1770
|
-
inside:
|
|
1855
|
+
inside: r.languages.yaml
|
|
1771
1856
|
}
|
|
1772
1857
|
}
|
|
1773
1858
|
},
|
|
@@ -1777,33 +1862,33 @@ Prism.languages.rss = Prism.languages.xml;
|
|
|
1777
1862
|
alias: "punctuation"
|
|
1778
1863
|
},
|
|
1779
1864
|
table: {
|
|
1780
|
-
pattern: RegExp("^" +
|
|
1865
|
+
pattern: RegExp("^" + u + l + "(?:" + u + ")*", "m"),
|
|
1781
1866
|
inside: {
|
|
1782
1867
|
"table-data-rows": {
|
|
1783
|
-
pattern: RegExp("^(" +
|
|
1868
|
+
pattern: RegExp("^(" + u + l + ")(?:" + u + ")*$"),
|
|
1784
1869
|
lookbehind: !0,
|
|
1785
1870
|
inside: {
|
|
1786
1871
|
"table-data": {
|
|
1787
1872
|
pattern: RegExp(t),
|
|
1788
|
-
inside:
|
|
1873
|
+
inside: r.languages.markdown
|
|
1789
1874
|
},
|
|
1790
1875
|
punctuation: /\|/
|
|
1791
1876
|
}
|
|
1792
1877
|
},
|
|
1793
1878
|
"table-line": {
|
|
1794
|
-
pattern: RegExp("^(" +
|
|
1879
|
+
pattern: RegExp("^(" + u + ")" + l + "$"),
|
|
1795
1880
|
lookbehind: !0,
|
|
1796
1881
|
inside: {
|
|
1797
1882
|
punctuation: /\||:?-{3,}:?/
|
|
1798
1883
|
}
|
|
1799
1884
|
},
|
|
1800
1885
|
"table-header-row": {
|
|
1801
|
-
pattern: RegExp("^" +
|
|
1886
|
+
pattern: RegExp("^" + u + "$"),
|
|
1802
1887
|
inside: {
|
|
1803
1888
|
"table-header": {
|
|
1804
1889
|
pattern: RegExp(t),
|
|
1805
1890
|
alias: "important",
|
|
1806
|
-
inside:
|
|
1891
|
+
inside: r.languages.markdown
|
|
1807
1892
|
},
|
|
1808
1893
|
punctuation: /\|/
|
|
1809
1894
|
}
|
|
@@ -1897,7 +1982,7 @@ Prism.languages.rss = Prism.languages.xml;
|
|
|
1897
1982
|
// **strong**
|
|
1898
1983
|
// __strong__
|
|
1899
1984
|
// allow one nested instance of italic text using the same delimiter
|
|
1900
|
-
pattern:
|
|
1985
|
+
pattern: n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),
|
|
1901
1986
|
lookbehind: !0,
|
|
1902
1987
|
greedy: !0,
|
|
1903
1988
|
inside: {
|
|
@@ -1914,7 +1999,7 @@ Prism.languages.rss = Prism.languages.xml;
|
|
|
1914
1999
|
// *em*
|
|
1915
2000
|
// _em_
|
|
1916
2001
|
// allow one nested instance of bold text using the same delimiter
|
|
1917
|
-
pattern:
|
|
2002
|
+
pattern: n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),
|
|
1918
2003
|
lookbehind: !0,
|
|
1919
2004
|
greedy: !0,
|
|
1920
2005
|
inside: {
|
|
@@ -1931,7 +2016,7 @@ Prism.languages.rss = Prism.languages.xml;
|
|
|
1931
2016
|
// ~~strike through~~
|
|
1932
2017
|
// ~strike~
|
|
1933
2018
|
// eslint-disable-next-line regexp/strict
|
|
1934
|
-
pattern:
|
|
2019
|
+
pattern: n(/(~~?)(?:(?!~)<inner>)+\2/.source),
|
|
1935
2020
|
lookbehind: !0,
|
|
1936
2021
|
greedy: !0,
|
|
1937
2022
|
inside: {
|
|
@@ -1956,7 +2041,7 @@ Prism.languages.rss = Prism.languages.xml;
|
|
|
1956
2041
|
// [example](http://example.com "Optional title")
|
|
1957
2042
|
// [example][id]
|
|
1958
2043
|
// [example] [id]
|
|
1959
|
-
pattern:
|
|
2044
|
+
pattern: n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),
|
|
1960
2045
|
lookbehind: !0,
|
|
1961
2046
|
greedy: !0,
|
|
1962
2047
|
inside: {
|
|
@@ -1981,71 +2066,71 @@ Prism.languages.rss = Prism.languages.xml;
|
|
|
1981
2066
|
}
|
|
1982
2067
|
}
|
|
1983
2068
|
}
|
|
1984
|
-
}), ["url", "bold", "italic", "strike"].forEach(function(
|
|
1985
|
-
["url", "bold", "italic", "strike", "code-snippet"].forEach(function(
|
|
1986
|
-
|
|
2069
|
+
}), ["url", "bold", "italic", "strike"].forEach(function(x) {
|
|
2070
|
+
["url", "bold", "italic", "strike", "code-snippet"].forEach(function(w) {
|
|
2071
|
+
x !== w && (r.languages.markdown[x].inside.content.inside[w] = r.languages.markdown[w]);
|
|
1987
2072
|
});
|
|
1988
|
-
}),
|
|
1989
|
-
if (
|
|
2073
|
+
}), r.hooks.add("after-tokenize", function(x) {
|
|
2074
|
+
if (x.language !== "markdown" && x.language !== "md")
|
|
1990
2075
|
return;
|
|
1991
|
-
function
|
|
2076
|
+
function w($) {
|
|
1992
2077
|
if (!(!$ || typeof $ == "string"))
|
|
1993
|
-
for (var
|
|
1994
|
-
var y = $[
|
|
2078
|
+
for (var F = 0, E = $.length; F < E; F++) {
|
|
2079
|
+
var y = $[F];
|
|
1995
2080
|
if (y.type !== "code") {
|
|
1996
|
-
|
|
2081
|
+
w(y.content);
|
|
1997
2082
|
continue;
|
|
1998
2083
|
}
|
|
1999
|
-
var
|
|
2000
|
-
if (
|
|
2001
|
-
var
|
|
2002
|
-
|
|
2003
|
-
var
|
|
2004
|
-
|
|
2084
|
+
var p = y.content[1], f = y.content[3];
|
|
2085
|
+
if (p && f && p.type === "code-language" && f.type === "code-block" && typeof p.content == "string") {
|
|
2086
|
+
var e = p.content.replace(/\b#/g, "sharp").replace(/\b\+\+/g, "pp");
|
|
2087
|
+
e = (/[a-z][\w-]*/i.exec(e) || [""])[0].toLowerCase();
|
|
2088
|
+
var i = "language-" + e;
|
|
2089
|
+
f.alias ? typeof f.alias == "string" ? f.alias = [f.alias, i] : f.alias.push(i) : f.alias = [i];
|
|
2005
2090
|
}
|
|
2006
2091
|
}
|
|
2007
2092
|
}
|
|
2008
|
-
|
|
2009
|
-
}),
|
|
2010
|
-
if (
|
|
2011
|
-
for (var
|
|
2012
|
-
var
|
|
2093
|
+
w(x.tokens);
|
|
2094
|
+
}), r.hooks.add("wrap", function(x) {
|
|
2095
|
+
if (x.type === "code-block") {
|
|
2096
|
+
for (var w = "", $ = 0, F = x.classes.length; $ < F; $++) {
|
|
2097
|
+
var E = x.classes[$], y = /language-(.+)/.exec(E);
|
|
2013
2098
|
if (y) {
|
|
2014
|
-
|
|
2099
|
+
w = y[1];
|
|
2015
2100
|
break;
|
|
2016
2101
|
}
|
|
2017
2102
|
}
|
|
2018
|
-
var
|
|
2019
|
-
if (
|
|
2020
|
-
|
|
2021
|
-
else if (
|
|
2022
|
-
var
|
|
2023
|
-
|
|
2024
|
-
var
|
|
2025
|
-
|
|
2103
|
+
var p = r.languages[w];
|
|
2104
|
+
if (p)
|
|
2105
|
+
x.content = r.highlight(P(x.content), p, w);
|
|
2106
|
+
else if (w && w !== "none" && r.plugins.autoloader) {
|
|
2107
|
+
var f = "md-" + (/* @__PURE__ */ new Date()).valueOf() + "-" + Math.floor(Math.random() * 1e16);
|
|
2108
|
+
x.attributes.id = f, r.plugins.autoloader.loadLanguages(w, function() {
|
|
2109
|
+
var e = document.getElementById(f);
|
|
2110
|
+
e && (e.innerHTML = r.highlight(e.textContent, r.languages[w], w));
|
|
2026
2111
|
});
|
|
2027
2112
|
}
|
|
2028
2113
|
}
|
|
2029
2114
|
});
|
|
2030
|
-
var
|
|
2115
|
+
var m = RegExp(r.languages.markup.tag.pattern.source, "gi"), c = {
|
|
2031
2116
|
amp: "&",
|
|
2032
2117
|
lt: "<",
|
|
2033
2118
|
gt: ">",
|
|
2034
2119
|
quot: '"'
|
|
2035
|
-
},
|
|
2036
|
-
function
|
|
2037
|
-
var
|
|
2038
|
-
return
|
|
2039
|
-
if (
|
|
2040
|
-
var
|
|
2041
|
-
return
|
|
2120
|
+
}, k = String.fromCodePoint || String.fromCharCode;
|
|
2121
|
+
function P(x) {
|
|
2122
|
+
var w = x.replace(m, "");
|
|
2123
|
+
return w = w.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi, function($, F) {
|
|
2124
|
+
if (F = F.toLowerCase(), F[0] === "#") {
|
|
2125
|
+
var E;
|
|
2126
|
+
return F[1] === "x" ? E = parseInt(F.slice(2), 16) : E = Number(F.slice(1)), k(E);
|
|
2042
2127
|
} else {
|
|
2043
|
-
var y =
|
|
2128
|
+
var y = c[F];
|
|
2044
2129
|
return y || $;
|
|
2045
2130
|
}
|
|
2046
|
-
}),
|
|
2131
|
+
}), w;
|
|
2047
2132
|
}
|
|
2048
|
-
|
|
2133
|
+
r.languages.md = r.languages.markdown;
|
|
2049
2134
|
})(Prism);
|
|
2050
2135
|
Prism.languages.json = {
|
|
2051
2136
|
property: {
|
|
@@ -2072,20 +2157,20 @@ Prism.languages.json = {
|
|
|
2072
2157
|
}
|
|
2073
2158
|
};
|
|
2074
2159
|
Prism.languages.webmanifest = Prism.languages.json;
|
|
2075
|
-
(function(
|
|
2076
|
-
var
|
|
2160
|
+
(function(r) {
|
|
2161
|
+
var o = /[*&][^\s[\]{},]+/, n = /!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/, t = "(?:" + n.source + "(?:[ ]+" + o.source + ")?|" + o.source + "(?:[ ]+" + n.source + ")?)", u = /(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g, function() {
|
|
2077
2162
|
return /[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source;
|
|
2078
|
-
}),
|
|
2079
|
-
function
|
|
2080
|
-
|
|
2081
|
-
var
|
|
2163
|
+
}), l = /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;
|
|
2164
|
+
function m(c, k) {
|
|
2165
|
+
k = (k || "").replace(/m/g, "") + "m";
|
|
2166
|
+
var P = /([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g, function() {
|
|
2082
2167
|
return t;
|
|
2083
2168
|
}).replace(/<<value>>/g, function() {
|
|
2084
|
-
return
|
|
2169
|
+
return c;
|
|
2085
2170
|
});
|
|
2086
|
-
return RegExp(
|
|
2171
|
+
return RegExp(P, k);
|
|
2087
2172
|
}
|
|
2088
|
-
|
|
2173
|
+
r.languages.yaml = {
|
|
2089
2174
|
scalar: {
|
|
2090
2175
|
pattern: RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g, function() {
|
|
2091
2176
|
return t;
|
|
@@ -2098,7 +2183,7 @@ Prism.languages.webmanifest = Prism.languages.json;
|
|
|
2098
2183
|
pattern: RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g, function() {
|
|
2099
2184
|
return t;
|
|
2100
2185
|
}).replace(/<<key>>/g, function() {
|
|
2101
|
-
return "(?:" +
|
|
2186
|
+
return "(?:" + u + "|" + l + ")";
|
|
2102
2187
|
})),
|
|
2103
2188
|
lookbehind: !0,
|
|
2104
2189
|
greedy: !0,
|
|
@@ -2110,43 +2195,43 @@ Prism.languages.webmanifest = Prism.languages.json;
|
|
|
2110
2195
|
alias: "important"
|
|
2111
2196
|
},
|
|
2112
2197
|
datetime: {
|
|
2113
|
-
pattern:
|
|
2198
|
+
pattern: m(/\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*)?)?/.source),
|
|
2114
2199
|
lookbehind: !0,
|
|
2115
2200
|
alias: "number"
|
|
2116
2201
|
},
|
|
2117
2202
|
boolean: {
|
|
2118
|
-
pattern:
|
|
2203
|
+
pattern: m(/false|true/.source, "i"),
|
|
2119
2204
|
lookbehind: !0,
|
|
2120
2205
|
alias: "important"
|
|
2121
2206
|
},
|
|
2122
2207
|
null: {
|
|
2123
|
-
pattern:
|
|
2208
|
+
pattern: m(/null|~/.source, "i"),
|
|
2124
2209
|
lookbehind: !0,
|
|
2125
2210
|
alias: "important"
|
|
2126
2211
|
},
|
|
2127
2212
|
string: {
|
|
2128
|
-
pattern:
|
|
2213
|
+
pattern: m(l),
|
|
2129
2214
|
lookbehind: !0,
|
|
2130
2215
|
greedy: !0
|
|
2131
2216
|
},
|
|
2132
2217
|
number: {
|
|
2133
|
-
pattern:
|
|
2218
|
+
pattern: m(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source, "i"),
|
|
2134
2219
|
lookbehind: !0
|
|
2135
2220
|
},
|
|
2136
|
-
tag:
|
|
2137
|
-
important:
|
|
2221
|
+
tag: n,
|
|
2222
|
+
important: o,
|
|
2138
2223
|
punctuation: /---|[:[\]{}\-,|>?]|\.\.\./
|
|
2139
|
-
},
|
|
2224
|
+
}, r.languages.yml = r.languages.yaml;
|
|
2140
2225
|
})(Prism);
|
|
2141
|
-
function Oe(
|
|
2142
|
-
const
|
|
2143
|
-
return
|
|
2226
|
+
function Oe(r, o) {
|
|
2227
|
+
const n = Me.languages[o];
|
|
2228
|
+
return n ? Me.highlight(r, n, o) : nt(r);
|
|
2144
2229
|
}
|
|
2145
|
-
function
|
|
2146
|
-
return
|
|
2230
|
+
function nt(r) {
|
|
2231
|
+
return r.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
2147
2232
|
}
|
|
2148
|
-
function
|
|
2149
|
-
switch (
|
|
2233
|
+
function je(r) {
|
|
2234
|
+
switch (r) {
|
|
2150
2235
|
case "md":
|
|
2151
2236
|
return "markdown";
|
|
2152
2237
|
case "xml":
|
|
@@ -2159,20 +2244,25 @@ function ze(n) {
|
|
|
2159
2244
|
return null;
|
|
2160
2245
|
}
|
|
2161
2246
|
}
|
|
2162
|
-
function
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2247
|
+
function it(r, o) {
|
|
2248
|
+
const n = je(o);
|
|
2249
|
+
return n ? Oe(r, n) : ve(r);
|
|
2250
|
+
}
|
|
2251
|
+
function rt(r) {
|
|
2252
|
+
return (o) => {
|
|
2253
|
+
if (r === "pd") return Je(o);
|
|
2254
|
+
const n = je(r);
|
|
2255
|
+
return n ? Oe(o, n) : ve(o);
|
|
2167
2256
|
};
|
|
2168
2257
|
}
|
|
2169
|
-
function
|
|
2170
|
-
return
|
|
2258
|
+
function st(r, o = {}) {
|
|
2259
|
+
return Ve(r, o, rt);
|
|
2171
2260
|
}
|
|
2172
2261
|
export {
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2262
|
+
st as createPdEditor,
|
|
2263
|
+
ut as format,
|
|
2264
|
+
Je as highlightPd,
|
|
2265
|
+
ct as jsonToPdText,
|
|
2266
|
+
dt as pdToJsonText,
|
|
2267
|
+
it as prismHighlighter
|
|
2177
2268
|
};
|
|
2178
|
-
//# sourceMappingURL=index.js.map
|