@powerduck/md-editor 0.3.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/dist/index.mjs CHANGED
@@ -1,30 +1,65 @@
1
- import { Compartment as Mt, EditorState as Ot } from "@codemirror/state";
2
- import { EditorView as Ne, keymap as xt, lineNumbers as Be } from "@codemirror/view";
3
- import { history as It, defaultKeymap as Lt, historyKeymap as Dt } from "@codemirror/commands";
4
- import { markdown as Bt } from "@codemirror/lang-markdown";
5
- import { languages as Pt } from "@codemirror/language-data";
6
- import Ut from "markdown-it";
7
- import $t from "markdown-it-texmath";
8
- import Ft from "katex";
9
- class zt {
1
+ import { Compartment as Be, EditorState as $t } from "@codemirror/state";
2
+ import { EditorView as he, keymap as Pe, lineNumbers as $e } from "@codemirror/view";
3
+ import { history as Ut, defaultKeymap as Ft, historyKeymap as Ht } from "@codemirror/commands";
4
+ import { markdown as zt } from "@codemirror/lang-markdown";
5
+ import { languages as Kt } from "@codemirror/language-data";
6
+ import Gt from "markdown-it";
7
+ import Ue from "katex";
8
+ class qt {
10
9
  constructor(t, n) {
11
- this.lineNumbersCompartment = new Mt();
10
+ this.lineNumbersCompartment = new Be(), this.customKeymapCompartment = new Be(), this.onImageFile = n.onImageFile;
12
11
  const r = [
13
- It(),
14
- xt.of([...Lt, ...Dt]),
15
- Bt({ codeLanguages: Pt }),
16
- Ne.lineWrapping,
17
- this.lineNumbersCompartment.of(n.lineNumbers ? Be() : []),
18
- Ne.updateListener.of((a) => {
12
+ Ut(),
13
+ Pe.of([...Ft, ...Ht]),
14
+ this.customKeymapCompartment.of([]),
15
+ zt({ codeLanguages: Kt }),
16
+ he.lineWrapping,
17
+ this.lineNumbersCompartment.of(n.lineNumbers ? $e() : []),
18
+ he.updateListener.of((i) => {
19
19
  var c;
20
- a.docChanged && ((c = n.onChange) == null || c.call(n, a.state.doc.toString()));
20
+ i.docChanged && ((c = n.onChange) == null || c.call(n, i.state.doc.toString()));
21
+ }),
22
+ // Handle image paste
23
+ he.domEventHandlers({
24
+ paste: (i) => this.handlePaste(i),
25
+ drop: (i) => this.handleDrop(i)
21
26
  })
22
27
  ];
23
- this.view = new Ne({
24
- state: Ot.create({ doc: n.value ?? "", extensions: r }),
28
+ this.view = new he({
29
+ state: $t.create({ doc: n.value ?? "", extensions: r }),
25
30
  parent: t
26
31
  });
27
32
  }
33
+ handlePaste(t) {
34
+ var r, i;
35
+ const n = (r = t.clipboardData) == null ? void 0 : r.items;
36
+ if (!n) return !1;
37
+ for (const c of Array.from(n))
38
+ if (c.type.startsWith("image/")) {
39
+ const s = c.getAsFile();
40
+ if (s)
41
+ return (i = this.onImageFile) == null || i.call(this, s), t.preventDefault(), !0;
42
+ }
43
+ return !1;
44
+ }
45
+ handleDrop(t) {
46
+ var r, i;
47
+ const n = (r = t.dataTransfer) == null ? void 0 : r.files;
48
+ if (!n || n.length === 0) return !1;
49
+ for (const c of Array.from(n))
50
+ if (c.type.startsWith("image/"))
51
+ return (i = this.onImageFile) == null || i.call(this, c), t.preventDefault(), !0;
52
+ return !1;
53
+ }
54
+ /**
55
+ * Register custom keyboard shortcuts. Each entry is a CodeMirror keymap
56
+ * spec: { key: 'Mod-b', run: (view) => boolean }.
57
+ */
58
+ setKeymap(t) {
59
+ this.view.dispatch({
60
+ effects: this.customKeymapCompartment.reconfigure(Pe.of(t))
61
+ });
62
+ }
28
63
  getValue() {
29
64
  return this.view.state.doc.toString();
30
65
  }
@@ -35,7 +70,7 @@ class zt {
35
70
  }
36
71
  setLineNumbers(t) {
37
72
  this.view.dispatch({
38
- effects: this.lineNumbersCompartment.reconfigure(t ? Be() : [])
73
+ effects: this.lineNumbersCompartment.reconfigure(t ? $e() : [])
39
74
  });
40
75
  }
41
76
  insertAtCursor(t) {
@@ -45,6 +80,24 @@ class zt {
45
80
  selection: { anchor: n + t.length }
46
81
  }), this.view.focus();
47
82
  }
83
+ /**
84
+ * Wrap the current selection with prefix and suffix. If nothing is
85
+ * selected, insert prefix + placeholder + suffix and select the placeholder.
86
+ */
87
+ wrapSelection(t, n, r) {
88
+ const { from: i, to: c } = this.view.state.selection.main, o = this.view.state.doc.sliceString(i, c) || r, a = `${t}${o}${n}`;
89
+ this.view.dispatch({
90
+ changes: { from: i, to: c, insert: a },
91
+ selection: {
92
+ anchor: i + t.length,
93
+ head: i + t.length + o.length
94
+ }
95
+ }), this.view.focus();
96
+ }
97
+ getSelection() {
98
+ const { from: t, to: n } = this.view.state.selection.main;
99
+ return this.view.state.doc.sliceString(t, n);
100
+ }
48
101
  focus() {
49
102
  this.view.focus();
50
103
  }
@@ -52,60 +105,122 @@ class zt {
52
105
  this.view.destroy();
53
106
  }
54
107
  }
55
- function Ht(e) {
56
- e.use($t, {
57
- engine: Ft,
58
- delimiters: "dollars",
59
- katexOptions: {
60
- throwOnError: !1,
61
- strict: !1
108
+ const Yt = /^\$([^$\n]+?)\$/;
109
+ function Wt(e) {
110
+ return /^[\d.,]+$/.test(e.trim());
111
+ }
112
+ function Zt(e) {
113
+ e.block.ruler.before("fence", "math_block", (t, n, r, i) => {
114
+ const c = t.src.slice(t.bMarks[n], t.eMarks[n]);
115
+ if (!c.startsWith("$$")) return !1;
116
+ const s = c.match(/^\$\$(.+?)\$\$\s*$/);
117
+ if (s) {
118
+ if (i) return !0;
119
+ const m = t.push("math_block", "div", 0);
120
+ return m.content = s[1].trim(), m.markup = "$$", t.line = n + 1, !0;
62
121
  }
63
- });
122
+ let o = n + 1, a = !1;
123
+ for (; o < t.lineMax; ) {
124
+ if (t.src.slice(t.bMarks[o], t.eMarks[o]).trimEnd().endsWith("$$")) {
125
+ a = !0;
126
+ break;
127
+ }
128
+ o++;
129
+ }
130
+ if (!a) return !1;
131
+ if (i) return !0;
132
+ const l = t.src.slice(t.bMarks[n] + 2, t.eMarks[o] - 2).trim(), u = t.push("math_block", "div", 0);
133
+ return u.content = l, u.markup = "$$", t.line = o + 1, !0;
134
+ }), e.renderer.rules.math_block = (t, n) => {
135
+ var i;
136
+ const r = ((i = t[n]) == null ? void 0 : i.content) ?? "";
137
+ try {
138
+ return `<div class="md-editor-math-block">${Ue.renderToString(r, {
139
+ displayMode: !0,
140
+ throwOnError: !1,
141
+ strict: !1
142
+ })}</div>`;
143
+ } catch {
144
+ return `<div class="md-editor-math-block md-editor-math-error">${Fe(r)}</div>`;
145
+ }
146
+ }, e.inline.ruler.after("escape", "math_inline", (t, n) => {
147
+ if (t.src[t.pos] !== "$" || t.src[t.pos + 1] === "$") return !1;
148
+ const r = t.src.slice(t.pos).match(Yt);
149
+ if (!r) return !1;
150
+ const i = r[1] ?? "";
151
+ if (Wt(i)) return !1;
152
+ if (n) return !0;
153
+ const c = t.push("math_inline", "span", 0);
154
+ return c.content = i, c.markup = "$", t.pos += r[0].length, !0;
155
+ }), e.renderer.rules.math_inline = (t, n) => {
156
+ var i;
157
+ const r = ((i = t[n]) == null ? void 0 : i.content) ?? "";
158
+ try {
159
+ return Ue.renderToString(r, {
160
+ displayMode: !1,
161
+ throwOnError: !1,
162
+ strict: !1
163
+ });
164
+ } catch {
165
+ return `<span class="md-editor-math-error">$${Fe(r)}$</span>`;
166
+ }
167
+ };
64
168
  }
65
- let Kt = 0;
66
- function Gt(e) {
67
- const t = e.renderer.rules.fence ? e.renderer.rules.fence.bind(e.renderer.rules) : (n, r, a, c, i) => i.renderToken(n, r, a);
68
- e.renderer.rules.fence = (n, r, a, c, i) => {
69
- const s = n[r];
70
- if (!s) return t(n, r, a, c, i);
71
- if (s.info.trim().toLowerCase() === "mindmap") {
72
- const l = `md-editor-mindmap-${++Kt}`, u = encodeURIComponent(s.content);
169
+ function Fe(e) {
170
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
171
+ }
172
+ typeof globalThis.ResizeObserver > "u" && (globalThis.ResizeObserver = class {
173
+ observe() {
174
+ }
175
+ unobserve() {
176
+ }
177
+ disconnect() {
178
+ }
179
+ });
180
+ let Vt = 0;
181
+ function Xt(e) {
182
+ const t = e.renderer.rules.fence ? e.renderer.rules.fence.bind(e.renderer.rules) : (n, r, i, c, s) => s.renderToken(n, r, i);
183
+ e.renderer.rules.fence = (n, r, i, c, s) => {
184
+ const o = n[r];
185
+ if (!o) return t(n, r, i, c, s);
186
+ if (o.info.trim().toLowerCase() === "mindmap") {
187
+ const l = `md-editor-mindmap-${++Vt}`, u = encodeURIComponent(o.content);
73
188
  return `<div class="md-editor-mindmap" id="${l}" data-source="${u}"></div>`;
74
189
  }
75
- return t(n, r, a, c, i);
190
+ return t(n, r, i, c, s);
76
191
  };
77
192
  }
78
- const Yt = 600, Zt = 320;
79
- async function qt(e) {
193
+ const Qt = 600, Jt = 320;
194
+ async function jt(e) {
80
195
  const t = e.querySelectorAll(
81
196
  ".md-editor-mindmap:not([data-hydrated])"
82
197
  );
83
198
  if (t.length === 0) return;
84
- const { Transformer: n } = await import("markmap-lib"), r = await import("markmap-view"), a = r.Markmap ?? r.default;
85
- if (!a) return;
199
+ const { Transformer: n } = await import("markmap-lib"), r = await import("markmap-view"), i = r.Markmap ?? r.default;
200
+ if (!i) return;
86
201
  const c = new n();
87
- for (const i of Array.from(t)) {
88
- i.setAttribute("data-hydrated", "1");
89
- const s = decodeURIComponent(i.dataset.source ?? "") || "- Empty mindmap", { root: o } = c.transform(s);
90
- i.innerHTML = "";
91
- const l = i.clientWidth > 0 ? i.clientWidth : Yt, u = i.clientHeight > 0 ? i.clientHeight : Zt, f = document.createElementNS("http://www.w3.org/2000/svg", "svg");
92
- f.setAttribute("width", String(l)), f.setAttribute("height", String(u)), f.style.width = "100%", f.style.height = "100%", f.style.display = "block", i.appendChild(f), a.create(f, { autoFit: !0 }, o);
202
+ for (const s of Array.from(t)) {
203
+ s.setAttribute("data-hydrated", "1");
204
+ const o = decodeURIComponent(s.dataset.source ?? "") || "- Empty mindmap", { root: a } = c.transform(o);
205
+ s.innerHTML = "";
206
+ const l = s.clientWidth > 0 ? s.clientWidth : Qt, u = s.clientHeight > 0 ? s.clientHeight : Jt, m = document.createElementNS("http://www.w3.org/2000/svg", "svg");
207
+ m.setAttribute("width", String(l)), m.setAttribute("height", String(u)), m.style.width = "100%", m.style.height = "100%", m.style.display = "block", s.appendChild(m), i.create(m, { autoFit: !0 }, a);
93
208
  }
94
209
  }
95
- function Wt(e) {
210
+ function en(e) {
96
211
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
97
212
  }
98
- function qe(e) {
213
+ function et(e) {
99
214
  return e instanceof Map ? e.clear = e.delete = e.set = function() {
100
215
  throw new Error("map is read-only");
101
216
  } : e instanceof Set && (e.add = e.clear = e.delete = function() {
102
217
  throw new Error("set is read-only");
103
218
  }), Object.freeze(e), Object.getOwnPropertyNames(e).forEach((t) => {
104
219
  const n = e[t], r = typeof n;
105
- (r === "object" || r === "function") && !Object.isFrozen(n) && qe(n);
220
+ (r === "object" || r === "function") && !Object.isFrozen(n) && et(n);
106
221
  }), e;
107
222
  }
108
- class Pe {
223
+ class He {
109
224
  /**
110
225
  * @param {CompiledMode} mode
111
226
  */
@@ -116,7 +231,7 @@ class Pe {
116
231
  this.isMatchIgnored = !0;
117
232
  }
118
233
  }
119
- function We(e) {
234
+ function tt(e) {
120
235
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;");
121
236
  }
122
237
  function Q(e, ...t) {
@@ -124,24 +239,24 @@ function Q(e, ...t) {
124
239
  for (const r in e)
125
240
  n[r] = e[r];
126
241
  return t.forEach(function(r) {
127
- for (const a in r)
128
- n[a] = r[a];
242
+ for (const i in r)
243
+ n[i] = r[i];
129
244
  }), /** @type {T} */
130
245
  n;
131
246
  }
132
- const Xt = "</span>", Ue = (e) => !!e.scope, Vt = (e, { prefix: t }) => {
247
+ const tn = "</span>", ze = (e) => !!e.scope, nn = (e, { prefix: t }) => {
133
248
  if (e.startsWith("language:"))
134
249
  return e.replace("language:", "language-");
135
250
  if (e.includes(".")) {
136
251
  const n = e.split(".");
137
252
  return [
138
253
  `${t}${n.shift()}`,
139
- ...n.map((r, a) => `${r}${"_".repeat(a + 1)}`)
254
+ ...n.map((r, i) => `${r}${"_".repeat(i + 1)}`)
140
255
  ].join(" ");
141
256
  }
142
257
  return `${t}${e}`;
143
258
  };
144
- class Qt {
259
+ class rn {
145
260
  /**
146
261
  * Creates a new HTMLRenderer
147
262
  *
@@ -156,15 +271,15 @@ class Qt {
156
271
  *
157
272
  * @param {string} text */
158
273
  addText(t) {
159
- this.buffer += We(t);
274
+ this.buffer += tt(t);
160
275
  }
161
276
  /**
162
277
  * Adds a node open to the output stream (if needed)
163
278
  *
164
279
  * @param {Node} node */
165
280
  openNode(t) {
166
- if (!Ue(t)) return;
167
- const n = Vt(
281
+ if (!ze(t)) return;
282
+ const n = nn(
168
283
  t.scope,
169
284
  { prefix: this.classPrefix }
170
285
  );
@@ -175,7 +290,7 @@ class Qt {
175
290
  *
176
291
  * @param {Node} node */
177
292
  closeNode(t) {
178
- Ue(t) && (this.buffer += Xt);
293
+ ze(t) && (this.buffer += tn);
179
294
  }
180
295
  /**
181
296
  * returns the accumulated buffer
@@ -192,13 +307,13 @@ class Qt {
192
307
  this.buffer += `<span class="${t}">`;
193
308
  }
194
309
  }
195
- const $e = (e = {}) => {
310
+ const Ke = (e = {}) => {
196
311
  const t = { children: [] };
197
312
  return Object.assign(t, e), t;
198
313
  };
199
- class ke {
314
+ class Te {
200
315
  constructor() {
201
- this.rootNode = $e(), this.stack = [this.rootNode];
316
+ this.rootNode = Ke(), this.stack = [this.rootNode];
202
317
  }
203
318
  get top() {
204
319
  return this.stack[this.stack.length - 1];
@@ -212,7 +327,7 @@ class ke {
212
327
  }
213
328
  /** @param {string} scope */
214
329
  openNode(t) {
215
- const n = $e({ scope: t });
330
+ const n = Ke({ scope: t });
216
331
  this.add(n), this.stack.push(n);
217
332
  }
218
333
  closeNode() {
@@ -244,11 +359,11 @@ class ke {
244
359
  */
245
360
  static _collapse(t) {
246
361
  typeof t != "string" && t.children && (t.children.every((n) => typeof n == "string") ? t.children = [t.children.join("")] : t.children.forEach((n) => {
247
- ke._collapse(n);
362
+ Te._collapse(n);
248
363
  }));
249
364
  }
250
365
  }
251
- class Jt extends ke {
366
+ class sn extends Te {
252
367
  /**
253
368
  * @param {*} options
254
369
  */
@@ -277,42 +392,42 @@ class Jt extends ke {
277
392
  n && (r.scope = `language:${n}`), this.add(r);
278
393
  }
279
394
  toHTML() {
280
- return new Qt(this, this.options).value();
395
+ return new rn(this, this.options).value();
281
396
  }
282
397
  finalize() {
283
398
  return this.closeAllNodes(), !0;
284
399
  }
285
400
  }
286
- function le(e) {
401
+ function de(e) {
287
402
  return e ? typeof e == "string" ? e : e.source : null;
288
403
  }
289
- function Xe(e) {
404
+ function nt(e) {
290
405
  return te("(?=", e, ")");
291
406
  }
292
- function jt(e) {
407
+ function on(e) {
293
408
  return te("(?:", e, ")*");
294
409
  }
295
- function en(e) {
410
+ function an(e) {
296
411
  return te("(?:", e, ")?");
297
412
  }
298
413
  function te(...e) {
299
- return e.map((n) => le(n)).join("");
414
+ return e.map((n) => de(n)).join("");
300
415
  }
301
- function tn(e) {
416
+ function cn(e) {
302
417
  const t = e[e.length - 1];
303
418
  return typeof t == "object" && t.constructor === Object ? (e.splice(e.length - 1, 1), t) : {};
304
419
  }
305
- function _e(...e) {
306
- return "(" + (tn(e).capture ? "" : "?:") + e.map((r) => le(r)).join("|") + ")";
420
+ function ye(...e) {
421
+ return "(" + (cn(e).capture ? "" : "?:") + e.map((r) => de(r)).join("|") + ")";
307
422
  }
308
- function Ve(e) {
423
+ function rt(e) {
309
424
  return new RegExp(e.toString() + "|").exec("").length - 1;
310
425
  }
311
- function nn(e, t) {
426
+ function ln(e, t) {
312
427
  const n = e && e.exec(t);
313
428
  return n && n.index === 0;
314
429
  }
315
- const rn = new RegExp(_e(
430
+ const dn = new RegExp(ye(
316
431
  /\[(?:[^\\\]]|\\.)*\]/,
317
432
  // a character class, inside which ( and \ lose their meaning
318
433
  /\(\?<(?![=!])[^>]+>/,
@@ -330,20 +445,20 @@ function Ae(e, { joinWith: t }) {
330
445
  let n = 0;
331
446
  return e.map((r) => {
332
447
  n += 1;
333
- const a = n;
334
- let c = le(r), i = "";
448
+ const i = n;
449
+ let c = de(r), s = "";
335
450
  for (; c.length > 0; ) {
336
- const s = rn.exec(c);
337
- if (!s) {
338
- i += c;
451
+ const o = dn.exec(c);
452
+ if (!o) {
453
+ s += c;
339
454
  break;
340
455
  }
341
- i += c.substring(0, s.index), c = c.substring(s.index + s[0].length), s[0][0] === "\\" && s[1] ? i += "\\" + String(Number(s[1]) + a) : (i += s[0], (s[0] === "(" || /^\(\?[<']/.test(s[0])) && n++);
456
+ s += c.substring(0, o.index), c = c.substring(o.index + o[0].length), o[0][0] === "\\" && o[1] ? s += "\\" + String(Number(o[1]) + i) : (s += o[0], (o[0] === "(" || /^\(\?[<']/.test(o[0])) && n++);
342
457
  }
343
- return i;
458
+ return s;
344
459
  }).map((r) => `(${r})`).join(t);
345
460
  }
346
- const sn = /\b\B/, Qe = "[a-zA-Z]\\w*", Re = "[a-zA-Z_]\\w*", Je = "\\b\\d+(\\.\\d+)?", je = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)", et = "\\b(0b[01]+)", an = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", on = (e = {}) => {
461
+ const un = /\b\B/, it = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", st = "\\b\\d+(\\.\\d+)?", ot = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)", at = "\\b(0b[01]+)", pn = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", gn = (e = {}) => {
347
462
  const t = /^#![ ]*\//;
348
463
  return e.binary && (e.begin = te(
349
464
  t,
@@ -360,24 +475,24 @@ const sn = /\b\B/, Qe = "[a-zA-Z]\\w*", Re = "[a-zA-Z_]\\w*", Je = "\\b\\d+(\\.\
360
475
  n.index !== 0 && r.ignoreMatch();
361
476
  }
362
477
  }, e);
363
- }, de = {
478
+ }, ue = {
364
479
  begin: "\\\\[\\s\\S]",
365
480
  relevance: 0
366
- }, cn = {
481
+ }, hn = {
367
482
  scope: "string",
368
483
  begin: "'",
369
484
  end: "'",
370
485
  illegal: "\\n",
371
- contains: [de]
372
- }, ln = {
486
+ contains: [ue]
487
+ }, fn = {
373
488
  scope: "string",
374
489
  begin: '"',
375
490
  end: '"',
376
491
  illegal: "\\n",
377
- contains: [de]
378
- }, dn = {
492
+ contains: [ue]
493
+ }, mn = {
379
494
  begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/
380
- }, Ee = function(e, t, n = {}) {
495
+ }, we = function(e, t, n = {}) {
381
496
  const r = Q(
382
497
  {
383
498
  scope: "comment",
@@ -396,7 +511,7 @@ const sn = /\b\B/, Qe = "[a-zA-Z]\\w*", Re = "[a-zA-Z_]\\w*", Je = "\\b\\d+(\\.\
396
511
  excludeBegin: !0,
397
512
  relevance: 0
398
513
  });
399
- const a = _e(
514
+ const i = ye(
400
515
  // list of common 1 and 2 letter words in English
401
516
  "I",
402
517
  "a",
@@ -436,51 +551,51 @@ const sn = /\b\B/, Qe = "[a-zA-Z]\\w*", Re = "[a-zA-Z_]\\w*", Je = "\\b\\d+(\\.\
436
551
  /[ ]+/,
437
552
  // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */
438
553
  "(",
439
- a,
554
+ i,
440
555
  /[.]?[:]?([.][ ]|[ ])/,
441
556
  "){3}"
442
557
  )
443
558
  // look for 3 words in a row
444
559
  }
445
560
  ), r;
446
- }, un = Ee("//", "$"), gn = Ee("/\\*", "\\*/"), pn = Ee("#", "$"), hn = {
561
+ }, bn = we("//", "$"), _n = we("/\\*", "\\*/"), En = we("#", "$"), yn = {
447
562
  scope: "number",
448
- begin: Je,
563
+ begin: st,
449
564
  relevance: 0
450
- }, mn = {
565
+ }, wn = {
451
566
  scope: "number",
452
- begin: je,
567
+ begin: ot,
453
568
  relevance: 0
454
- }, bn = {
569
+ }, vn = {
455
570
  scope: "number",
456
- begin: et,
571
+ begin: at,
457
572
  relevance: 0
458
- }, fn = {
573
+ }, kn = {
459
574
  scope: "regexp",
460
575
  begin: /\/(?=[^/\n]*\/)/,
461
576
  end: /\/[gimuy]*/,
462
577
  contains: [
463
- de,
578
+ ue,
464
579
  {
465
580
  begin: /\[/,
466
581
  end: /\]/,
467
582
  relevance: 0,
468
- contains: [de]
583
+ contains: [ue]
469
584
  }
470
585
  ]
471
- }, _n = {
586
+ }, Nn = {
472
587
  scope: "title",
473
- begin: Qe,
588
+ begin: it,
474
589
  relevance: 0
475
- }, En = {
590
+ }, Sn = {
476
591
  scope: "title",
477
- begin: Re,
592
+ begin: Ce,
478
593
  relevance: 0
479
- }, yn = {
594
+ }, Tn = {
480
595
  // excludes method names from keyword processing
481
- begin: "\\.\\s*" + Re,
596
+ begin: "\\.\\s*" + Ce,
482
597
  relevance: 0
483
- }, wn = function(e) {
598
+ }, An = function(e) {
484
599
  return Object.assign(
485
600
  e,
486
601
  {
@@ -495,67 +610,67 @@ const sn = /\b\B/, Qe = "[a-zA-Z]\\w*", Re = "[a-zA-Z_]\\w*", Je = "\\b\\d+(\\.\
495
610
  }
496
611
  );
497
612
  };
498
- var pe = /* @__PURE__ */ Object.freeze({
613
+ var fe = /* @__PURE__ */ Object.freeze({
499
614
  __proto__: null,
500
- APOS_STRING_MODE: cn,
501
- BACKSLASH_ESCAPE: de,
502
- BINARY_NUMBER_MODE: bn,
503
- BINARY_NUMBER_RE: et,
504
- COMMENT: Ee,
505
- C_BLOCK_COMMENT_MODE: gn,
506
- C_LINE_COMMENT_MODE: un,
507
- C_NUMBER_MODE: mn,
508
- C_NUMBER_RE: je,
509
- END_SAME_AS_BEGIN: wn,
510
- HASH_COMMENT_MODE: pn,
511
- IDENT_RE: Qe,
512
- MATCH_NOTHING_RE: sn,
513
- METHOD_GUARD: yn,
514
- NUMBER_MODE: hn,
515
- NUMBER_RE: Je,
516
- PHRASAL_WORDS_MODE: dn,
517
- QUOTE_STRING_MODE: ln,
518
- REGEXP_MODE: fn,
519
- RE_STARTERS_RE: an,
520
- SHEBANG: on,
521
- TITLE_MODE: _n,
522
- UNDERSCORE_IDENT_RE: Re,
523
- UNDERSCORE_TITLE_MODE: En
615
+ APOS_STRING_MODE: hn,
616
+ BACKSLASH_ESCAPE: ue,
617
+ BINARY_NUMBER_MODE: vn,
618
+ BINARY_NUMBER_RE: at,
619
+ COMMENT: we,
620
+ C_BLOCK_COMMENT_MODE: _n,
621
+ C_LINE_COMMENT_MODE: bn,
622
+ C_NUMBER_MODE: wn,
623
+ C_NUMBER_RE: ot,
624
+ END_SAME_AS_BEGIN: An,
625
+ HASH_COMMENT_MODE: En,
626
+ IDENT_RE: it,
627
+ MATCH_NOTHING_RE: un,
628
+ METHOD_GUARD: Tn,
629
+ NUMBER_MODE: yn,
630
+ NUMBER_RE: st,
631
+ PHRASAL_WORDS_MODE: mn,
632
+ QUOTE_STRING_MODE: fn,
633
+ REGEXP_MODE: kn,
634
+ RE_STARTERS_RE: pn,
635
+ SHEBANG: gn,
636
+ TITLE_MODE: Nn,
637
+ UNDERSCORE_IDENT_RE: Ce,
638
+ UNDERSCORE_TITLE_MODE: Sn
524
639
  });
525
- function vn(e, t) {
640
+ function Cn(e, t) {
526
641
  e.input[e.index - 1] === "." && t.ignoreMatch();
527
642
  }
528
- function Nn(e, t) {
643
+ function Mn(e, t) {
529
644
  e.className !== void 0 && (e.scope = e.className, delete e.className);
530
645
  }
531
- function Tn(e, t) {
532
- t && e.beginKeywords && (e.begin = "\\b(" + e.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", e.__beforeBegin = vn, e.keywords = e.keywords || e.beginKeywords, delete e.beginKeywords, e.relevance === void 0 && (e.relevance = 0));
646
+ function Rn(e, t) {
647
+ t && e.beginKeywords && (e.begin = "\\b(" + e.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", e.__beforeBegin = Cn, e.keywords = e.keywords || e.beginKeywords, delete e.beginKeywords, e.relevance === void 0 && (e.relevance = 0));
533
648
  }
534
- function Sn(e, t) {
535
- Array.isArray(e.illegal) && (e.illegal = _e(...e.illegal));
649
+ function On(e, t) {
650
+ Array.isArray(e.illegal) && (e.illegal = ye(...e.illegal));
536
651
  }
537
- function kn(e, t) {
652
+ function xn(e, t) {
538
653
  if (e.match) {
539
654
  if (e.begin || e.end) throw new Error("begin & end are not supported with match");
540
655
  e.begin = e.match, delete e.match;
541
656
  }
542
657
  }
543
- function An(e, t) {
658
+ function In(e, t) {
544
659
  e.relevance === void 0 && (e.relevance = 1);
545
660
  }
546
- const Rn = (e, t) => {
661
+ const Ln = (e, t) => {
547
662
  if (!e.beforeMatch) return;
548
663
  if (e.starts) throw new Error("beforeMatch cannot be used with starts");
549
664
  const n = Object.assign({}, e);
550
665
  Object.keys(e).forEach((r) => {
551
666
  delete e[r];
552
- }), e.keywords = n.keywords, e.begin = te(n.beforeMatch, Xe(n.begin)), e.starts = {
667
+ }), e.keywords = n.keywords, e.begin = te(n.beforeMatch, nt(n.begin)), e.starts = {
553
668
  relevance: 0,
554
669
  contains: [
555
670
  Object.assign(n, { endsParent: !0 })
556
671
  ]
557
672
  }, e.relevance = 0, delete n.beforeMatch;
558
- }, Cn = [
673
+ }, Dn = [
559
674
  "of",
560
675
  "and",
561
676
  "for",
@@ -570,71 +685,71 @@ const Rn = (e, t) => {
570
685
  // common variable name
571
686
  "value"
572
687
  // common variable name
573
- ], Mn = "keyword";
574
- function tt(e, t, n = Mn) {
688
+ ], Bn = "keyword";
689
+ function ct(e, t, n = Bn) {
575
690
  const r = /* @__PURE__ */ Object.create(null);
576
- return typeof e == "string" ? a(n, e.split(" ")) : Array.isArray(e) ? a(n, e) : Object.keys(e).forEach(function(c) {
691
+ return typeof e == "string" ? i(n, e.split(" ")) : Array.isArray(e) ? i(n, e) : Object.keys(e).forEach(function(c) {
577
692
  Object.assign(
578
693
  r,
579
- tt(e[c], t, c)
694
+ ct(e[c], t, c)
580
695
  );
581
696
  }), r;
582
- function a(c, i) {
583
- t && (i = i.map((s) => s.toLowerCase())), i.forEach(function(s) {
584
- const o = s.split("|");
585
- r[o[0]] = [c, On(o[0], o[1])];
697
+ function i(c, s) {
698
+ t && (s = s.map((o) => o.toLowerCase())), s.forEach(function(o) {
699
+ const a = o.split("|");
700
+ r[a[0]] = [c, Pn(a[0], a[1])];
586
701
  });
587
702
  }
588
703
  }
589
- function On(e, t) {
590
- return t ? Number(t) : xn(e) ? 0 : 1;
704
+ function Pn(e, t) {
705
+ return t ? Number(t) : $n(e) ? 0 : 1;
591
706
  }
592
- function xn(e) {
593
- return Cn.includes(e.toLowerCase());
707
+ function $n(e) {
708
+ return Dn.includes(e.toLowerCase());
594
709
  }
595
- const Fe = {}, ee = (e) => {
710
+ const Ge = {}, ee = (e) => {
596
711
  console.error(e);
597
- }, ze = (e, ...t) => {
712
+ }, qe = (e, ...t) => {
598
713
  console.log(`WARN: ${e}`, ...t);
599
714
  }, ne = (e, t) => {
600
- Fe[`${e}/${t}`] || (console.log(`Deprecated as of ${e}. ${t}`), Fe[`${e}/${t}`] = !0);
601
- }, be = new Error();
602
- function nt(e, t, { key: n }) {
715
+ Ge[`${e}/${t}`] || (console.log(`Deprecated as of ${e}. ${t}`), Ge[`${e}/${t}`] = !0);
716
+ }, _e = new Error();
717
+ function lt(e, t, { key: n }) {
603
718
  let r = 0;
604
- const a = e[n], c = {}, i = {};
605
- for (let s = 1; s <= t.length; s++)
606
- i[s + r] = a[s], c[s + r] = !0, r += Ve(t[s - 1]);
607
- e[n] = i, e[n]._emit = c, e[n]._multi = !0;
719
+ const i = e[n], c = {}, s = {};
720
+ for (let o = 1; o <= t.length; o++)
721
+ s[o + r] = i[o], c[o + r] = !0, r += rt(t[o - 1]);
722
+ e[n] = s, e[n]._emit = c, e[n]._multi = !0;
608
723
  }
609
- function In(e) {
724
+ function Un(e) {
610
725
  if (Array.isArray(e.begin)) {
611
726
  if (e.skip || e.excludeBegin || e.returnBegin)
612
- throw ee("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), be;
727
+ throw ee("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), _e;
613
728
  if (typeof e.beginScope != "object" || e.beginScope === null)
614
- throw ee("beginScope must be object"), be;
615
- nt(e, e.begin, { key: "beginScope" }), e.begin = Ae(e.begin, { joinWith: "" });
729
+ throw ee("beginScope must be object"), _e;
730
+ lt(e, e.begin, { key: "beginScope" }), e.begin = Ae(e.begin, { joinWith: "" });
616
731
  }
617
732
  }
618
- function Ln(e) {
733
+ function Fn(e) {
619
734
  if (Array.isArray(e.end)) {
620
735
  if (e.skip || e.excludeEnd || e.returnEnd)
621
- throw ee("skip, excludeEnd, returnEnd not compatible with endScope: {}"), be;
736
+ throw ee("skip, excludeEnd, returnEnd not compatible with endScope: {}"), _e;
622
737
  if (typeof e.endScope != "object" || e.endScope === null)
623
- throw ee("endScope must be object"), be;
624
- nt(e, e.end, { key: "endScope" }), e.end = Ae(e.end, { joinWith: "" });
738
+ throw ee("endScope must be object"), _e;
739
+ lt(e, e.end, { key: "endScope" }), e.end = Ae(e.end, { joinWith: "" });
625
740
  }
626
741
  }
627
- function Dn(e) {
742
+ function Hn(e) {
628
743
  e.scope && typeof e.scope == "object" && e.scope !== null && (e.beginScope = e.scope, delete e.scope);
629
744
  }
630
- function Bn(e) {
631
- Dn(e), typeof e.beginScope == "string" && (e.beginScope = { _wrap: e.beginScope }), typeof e.endScope == "string" && (e.endScope = { _wrap: e.endScope }), In(e), Ln(e);
745
+ function zn(e) {
746
+ Hn(e), typeof e.beginScope == "string" && (e.beginScope = { _wrap: e.beginScope }), typeof e.endScope == "string" && (e.endScope = { _wrap: e.endScope }), Un(e), Fn(e);
632
747
  }
633
- function Pn(e) {
634
- function t(i, s) {
748
+ function Kn(e) {
749
+ function t(s, o) {
635
750
  return new RegExp(
636
- le(i),
637
- "m" + (e.case_insensitive ? "i" : "") + (e.unicodeRegex ? "u" : "") + (s ? "g" : "")
751
+ de(s),
752
+ "m" + (e.case_insensitive ? "i" : "") + (e.unicodeRegex ? "u" : "") + (o ? "g" : "")
638
753
  );
639
754
  }
640
755
  class n {
@@ -642,22 +757,22 @@ function Pn(e) {
642
757
  this.matchIndexes = {}, this.regexes = [], this.matchAt = 1, this.position = 0;
643
758
  }
644
759
  // @ts-ignore
645
- addRule(s, o) {
646
- o.position = this.position++, this.matchIndexes[this.matchAt] = o, this.regexes.push([o, s]), this.matchAt += Ve(s) + 1;
760
+ addRule(o, a) {
761
+ a.position = this.position++, this.matchIndexes[this.matchAt] = a, this.regexes.push([a, o]), this.matchAt += rt(o) + 1;
647
762
  }
648
763
  compile() {
649
764
  this.regexes.length === 0 && (this.exec = () => null);
650
- const s = this.regexes.map((o) => o[1]);
651
- this.matcherRe = t(Ae(s, { joinWith: "|" }), !0), this.lastIndex = 0;
765
+ const o = this.regexes.map((a) => a[1]);
766
+ this.matcherRe = t(Ae(o, { joinWith: "|" }), !0), this.lastIndex = 0;
652
767
  }
653
768
  /** @param {string} s */
654
- exec(s) {
769
+ exec(o) {
655
770
  this.matcherRe.lastIndex = this.lastIndex;
656
- const o = this.matcherRe.exec(s);
657
- if (!o)
771
+ const a = this.matcherRe.exec(o);
772
+ if (!a)
658
773
  return null;
659
- const l = o.findIndex((f, b) => b > 0 && f !== void 0), u = this.matchIndexes[l];
660
- return o.splice(0, l), Object.assign(o, u);
774
+ const l = a.findIndex((m, b) => b > 0 && m !== void 0), u = this.matchIndexes[l];
775
+ return a.splice(0, l), Object.assign(a, u);
661
776
  }
662
777
  }
663
778
  class r {
@@ -665,10 +780,10 @@ function Pn(e) {
665
780
  this.rules = [], this.multiRegexes = [], this.count = 0, this.lastIndex = 0, this.regexIndex = 0;
666
781
  }
667
782
  // @ts-ignore
668
- getMatcher(s) {
669
- if (this.multiRegexes[s]) return this.multiRegexes[s];
670
- const o = new n();
671
- return this.rules.slice(s).forEach(([l, u]) => o.addRule(l, u)), o.compile(), this.multiRegexes[s] = o, o;
783
+ getMatcher(o) {
784
+ if (this.multiRegexes[o]) return this.multiRegexes[o];
785
+ const a = new n();
786
+ return this.rules.slice(o).forEach(([l, u]) => a.addRule(l, u)), a.compile(), this.multiRegexes[o] = a, a;
672
787
  }
673
788
  resumingScanAtSamePosition() {
674
789
  return this.regexIndex !== 0;
@@ -677,59 +792,59 @@ function Pn(e) {
677
792
  this.regexIndex = 0;
678
793
  }
679
794
  // @ts-ignore
680
- addRule(s, o) {
681
- this.rules.push([s, o]), o.type === "begin" && this.count++;
795
+ addRule(o, a) {
796
+ this.rules.push([o, a]), a.type === "begin" && this.count++;
682
797
  }
683
798
  /** @param {string} s */
684
- exec(s) {
685
- const o = this.getMatcher(this.regexIndex);
686
- o.lastIndex = this.lastIndex;
687
- let l = o.exec(s);
799
+ exec(o) {
800
+ const a = this.getMatcher(this.regexIndex);
801
+ a.lastIndex = this.lastIndex;
802
+ let l = a.exec(o);
688
803
  if (this.resumingScanAtSamePosition() && !(l && l.index === this.lastIndex)) {
689
804
  const u = this.getMatcher(0);
690
- u.lastIndex = this.lastIndex + 1, l = u.exec(s);
805
+ u.lastIndex = this.lastIndex + 1, l = u.exec(o);
691
806
  }
692
807
  return l && (this.regexIndex += l.position + 1, this.regexIndex === this.count && this.considerAll()), l;
693
808
  }
694
809
  }
695
- function a(i) {
696
- const s = new r();
697
- return i.contains.forEach((o) => s.addRule(o.begin, { rule: o, type: "begin" })), i.terminatorEnd && s.addRule(i.terminatorEnd, { type: "end" }), i.illegal && s.addRule(i.illegal, { type: "illegal" }), s;
810
+ function i(s) {
811
+ const o = new r();
812
+ return s.contains.forEach((a) => o.addRule(a.begin, { rule: a, type: "begin" })), s.terminatorEnd && o.addRule(s.terminatorEnd, { type: "end" }), s.illegal && o.addRule(s.illegal, { type: "illegal" }), o;
698
813
  }
699
- function c(i, s) {
700
- const o = (
814
+ function c(s, o) {
815
+ const a = (
701
816
  /** @type CompiledMode */
702
- i
817
+ s
703
818
  );
704
- if (i.isCompiled) return o;
819
+ if (s.isCompiled) return a;
705
820
  [
706
- Nn,
821
+ Mn,
707
822
  // do this early so compiler extensions generally don't have to worry about
708
823
  // the distinction between match/begin
709
- kn,
710
- Bn,
711
- Rn
712
- ].forEach((u) => u(i, s)), e.compilerExtensions.forEach((u) => u(i, s)), i.__beforeBegin = null, [
713
- Tn,
824
+ xn,
825
+ zn,
826
+ Ln
827
+ ].forEach((u) => u(s, o)), e.compilerExtensions.forEach((u) => u(s, o)), s.__beforeBegin = null, [
828
+ Rn,
714
829
  // do this later so compiler extensions that come earlier have access to the
715
830
  // raw array if they wanted to perhaps manipulate it, etc.
716
- Sn,
831
+ On,
717
832
  // default to 1 relevance if not specified
718
- An
719
- ].forEach((u) => u(i, s)), i.isCompiled = !0;
833
+ In
834
+ ].forEach((u) => u(s, o)), s.isCompiled = !0;
720
835
  let l = null;
721
- return typeof i.keywords == "object" && i.keywords.$pattern && (i.keywords = Object.assign({}, i.keywords), l = i.keywords.$pattern, delete i.keywords.$pattern), l = l || /\w+/, i.keywords && (i.keywords = tt(i.keywords, e.case_insensitive)), o.keywordPatternRe = t(l, !0), s && (i.begin || (i.begin = /\B|\b/), o.beginRe = t(o.begin), !i.end && !i.endsWithParent && (i.end = /\B|\b/), i.end && (o.endRe = t(o.end)), o.terminatorEnd = le(o.end) || "", i.endsWithParent && s.terminatorEnd && (o.terminatorEnd += (i.end ? "|" : "") + s.terminatorEnd)), i.illegal && (o.illegalRe = t(
836
+ return typeof s.keywords == "object" && s.keywords.$pattern && (s.keywords = Object.assign({}, s.keywords), l = s.keywords.$pattern, delete s.keywords.$pattern), l = l || /\w+/, s.keywords && (s.keywords = ct(s.keywords, e.case_insensitive)), a.keywordPatternRe = t(l, !0), o && (s.begin || (s.begin = /\B|\b/), a.beginRe = t(a.begin), !s.end && !s.endsWithParent && (s.end = /\B|\b/), s.end && (a.endRe = t(a.end)), a.terminatorEnd = de(a.end) || "", s.endsWithParent && o.terminatorEnd && (a.terminatorEnd += (s.end ? "|" : "") + o.terminatorEnd)), s.illegal && (a.illegalRe = t(
722
837
  /** @type {RegExp | string} */
723
- i.illegal
724
- )), i.contains || (i.contains = []), i.contains = [].concat(...i.contains.map(function(u) {
725
- return Un(u === "self" ? i : u);
726
- })), i.contains.forEach(function(u) {
838
+ s.illegal
839
+ )), s.contains || (s.contains = []), s.contains = [].concat(...s.contains.map(function(u) {
840
+ return Gn(u === "self" ? s : u);
841
+ })), s.contains.forEach(function(u) {
727
842
  c(
728
843
  /** @type Mode */
729
844
  u,
730
- o
845
+ a
731
846
  );
732
- }), i.starts && c(i.starts, s), o.matcher = a(o), o;
847
+ }), s.starts && c(s.starts, o), a.matcher = i(a), a;
733
848
  }
734
849
  if (e.compilerExtensions || (e.compilerExtensions = []), e.contains && e.contains.includes("self"))
735
850
  throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");
@@ -738,25 +853,25 @@ function Pn(e) {
738
853
  e
739
854
  );
740
855
  }
741
- function rt(e) {
742
- return e ? e.endsWithParent || rt(e.starts) : !1;
856
+ function dt(e) {
857
+ return e ? e.endsWithParent || dt(e.starts) : !1;
743
858
  }
744
- function Un(e) {
859
+ function Gn(e) {
745
860
  return e.variants && !e.cachedVariants && (e.cachedVariants = e.variants.map(function(t) {
746
861
  return Q(e, { variants: null }, t);
747
- })), e.cachedVariants ? e.cachedVariants : rt(e) ? Q(e, { starts: e.starts ? Q(e.starts) : null }) : Object.isFrozen(e) ? Q(e) : e;
862
+ })), e.cachedVariants ? e.cachedVariants : dt(e) ? Q(e, { starts: e.starts ? Q(e.starts) : null }) : Object.isFrozen(e) ? Q(e) : e;
748
863
  }
749
- var $n = "11.12.0";
750
- class Fn extends Error {
864
+ var qn = "11.12.0";
865
+ class Yn extends Error {
751
866
  constructor(t, n) {
752
867
  super(t), this.name = "HTMLInjectionError", this.html = n;
753
868
  }
754
869
  }
755
- const Te = We, He = Q, Ke = Symbol("nomatch"), zn = 7, it = function(e) {
870
+ const Se = tt, Ye = Q, We = Symbol("nomatch"), Wn = 7, ut = function(e) {
756
871
  const t = /* @__PURE__ */ Object.create(null), n = /* @__PURE__ */ Object.create(null), r = [];
757
- let a = !0;
758
- const c = "Could not find the language '{}', did you forget to load/include a language module?", i = { disableAutodetect: !0, name: "Plain text", contains: [] };
759
- let s = {
872
+ let i = !0;
873
+ const c = "Could not find the language '{}', did you forget to load/include a language module?", s = { disableAutodetect: !0, name: "Plain text", contains: [] };
874
+ let o = {
760
875
  ignoreUnescapedHTML: !1,
761
876
  throwUnescapedHTML: !1,
762
877
  noHighlightRe: /^(no-?highlight)$/i,
@@ -766,339 +881,339 @@ const Te = We, He = Q, Ke = Symbol("nomatch"), zn = 7, it = function(e) {
766
881
  languages: null,
767
882
  // beta configuration options, subject to change, welcome to discuss
768
883
  // https://github.com/highlightjs/highlight.js/issues/1086
769
- __emitter: Jt
884
+ __emitter: sn
770
885
  };
771
- function o(d) {
772
- return s.noHighlightRe.test(d);
886
+ function a(d) {
887
+ return o.noHighlightRe.test(d);
773
888
  }
774
889
  function l(d) {
775
890
  let h = d.className + " ";
776
891
  h += d.parentNode ? d.parentNode.className : "";
777
- const p = s.languageDetectRe.exec(h);
778
- if (p) {
779
- const y = P(p[1]);
780
- return y || (ze(c.replace("{}", p[1])), ze("Falling back to no-highlight mode for this block.", d)), y ? p[1] : "no-highlight";
892
+ const g = o.languageDetectRe.exec(h);
893
+ if (g) {
894
+ const y = $(g[1]);
895
+ return y || (qe(c.replace("{}", g[1])), qe("Falling back to no-highlight mode for this block.", d)), y ? g[1] : "no-highlight";
781
896
  }
782
- return h.split(/\s+/).find((y) => o(y) || P(y));
897
+ return h.split(/\s+/).find((y) => a(y) || $(y));
783
898
  }
784
- function u(d, h, p) {
785
- let y = "", T = "";
786
- typeof h == "object" ? (y = d, p = h.ignoreIllegals, T = h.language) : (ne("10.7.0", "highlight(lang, code, ...args) has been deprecated."), ne("10.7.0", `Please use highlight(code, options) instead.
787
- https://github.com/highlightjs/highlight.js/issues/2277`), T = d, y = h), p === void 0 && (p = !0);
788
- const I = {
899
+ function u(d, h, g) {
900
+ let y = "", N = "";
901
+ typeof h == "object" ? (y = d, g = h.ignoreIllegals, N = h.language) : (ne("10.7.0", "highlight(lang, code, ...args) has been deprecated."), ne("10.7.0", `Please use highlight(code, options) instead.
902
+ https://github.com/highlightjs/highlight.js/issues/2277`), N = d, y = h), g === void 0 && (g = !0);
903
+ const L = {
789
904
  code: y,
790
- language: T
905
+ language: N
791
906
  };
792
- V("before:highlight", I);
793
- const H = I.result ? I.result : f(I.language, I.code, p);
794
- return H.code = I.code, V("after:highlight", H), H;
795
- }
796
- function f(d, h, p, y) {
797
- const T = /* @__PURE__ */ Object.create(null);
798
- function I(g, m) {
799
- return g.keywords[m];
907
+ X("before:highlight", L);
908
+ const z = L.result ? L.result : m(L.language, L.code, g);
909
+ return z.code = L.code, X("after:highlight", z), z;
910
+ }
911
+ function m(d, h, g, y) {
912
+ const N = /* @__PURE__ */ Object.create(null);
913
+ function L(p, f) {
914
+ return p.keywords[f];
800
915
  }
801
- function H() {
916
+ function z() {
802
917
  if (!E.keywords) {
803
- z.addText(C);
918
+ H.addText(M);
804
919
  return;
805
920
  }
806
- let g = 0;
921
+ let p = 0;
807
922
  E.keywordPatternRe.lastIndex = 0;
808
- let m = E.keywordPatternRe.exec(C), w = "";
809
- for (; m; ) {
810
- w += C.substring(g, m.index);
811
- const A = q.case_insensitive ? m[0].toLowerCase() : m[0], K = I(E, A);
923
+ let f = E.keywordPatternRe.exec(M), w = "";
924
+ for (; f; ) {
925
+ w += M.substring(p, f.index);
926
+ const A = W.case_insensitive ? f[0].toLowerCase() : f[0], K = L(E, A);
812
927
  if (K) {
813
- const [W, Rt] = K;
814
- if (z.addText(w), w = "", T[A] = (T[A] || 0) + 1, T[A] <= zn && (ge += Rt), W.startsWith("_"))
815
- w += m[0];
928
+ const [Z, Bt] = K;
929
+ if (H.addText(w), w = "", N[A] = (N[A] || 0) + 1, N[A] <= Wn && (ge += Bt), Z.startsWith("_"))
930
+ w += f[0];
816
931
  else {
817
- const Ct = q.classNameAliases[W] || W;
818
- Z(m[0], Ct);
932
+ const Pt = W.classNameAliases[Z] || Z;
933
+ Y(f[0], Pt);
819
934
  }
820
935
  } else
821
- w += m[0];
822
- g = E.keywordPatternRe.lastIndex, m = E.keywordPatternRe.exec(C);
936
+ w += f[0];
937
+ p = E.keywordPatternRe.lastIndex, f = E.keywordPatternRe.exec(M);
823
938
  }
824
- w += C.substring(g), z.addText(w);
939
+ w += M.substring(p), H.addText(w);
825
940
  }
826
- function Y() {
827
- if (C === "") return;
828
- let g = null;
941
+ function q() {
942
+ if (M === "") return;
943
+ let p = null;
829
944
  if (typeof E.subLanguage == "string") {
830
945
  if (!t[E.subLanguage]) {
831
- z.addText(C);
946
+ H.addText(M);
832
947
  return;
833
948
  }
834
- g = f(E.subLanguage, C, !0, De[E.subLanguage]), De[E.subLanguage] = /** @type {CompiledMode} */
835
- g._top;
949
+ p = m(E.subLanguage, M, !0, De[E.subLanguage]), De[E.subLanguage] = /** @type {CompiledMode} */
950
+ p._top;
836
951
  } else
837
- g = _(C, E.subLanguage.length ? E.subLanguage : null);
838
- E.relevance > 0 && (ge += g.relevance), z.__addSublanguage(g._emitter, g.language);
952
+ p = _(M, E.subLanguage.length ? E.subLanguage : null);
953
+ E.relevance > 0 && (ge += p.relevance), H.__addSublanguage(p._emitter, p.language);
839
954
  }
840
955
  function G() {
841
- E.subLanguage != null ? Y() : H(), C = "";
956
+ E.subLanguage != null ? q() : z(), M = "";
842
957
  }
843
- function Z(g, m) {
844
- g !== "" && (z.startScope(m), z.addText(g), z.endScope());
958
+ function Y(p, f) {
959
+ p !== "" && (H.startScope(f), H.addText(p), H.endScope());
845
960
  }
846
- function Oe(g, m) {
961
+ function Oe(p, f) {
847
962
  let w = 1;
848
- const A = m.length - 1;
963
+ const A = f.length - 1;
849
964
  for (; w <= A; ) {
850
- if (!g._emit[w]) {
965
+ if (!p._emit[w]) {
851
966
  w++;
852
967
  continue;
853
968
  }
854
- const K = q.classNameAliases[g[w]] || g[w], W = m[w];
855
- K ? Z(W, K) : (C = W, H(), C = ""), w++;
969
+ const K = W.classNameAliases[p[w]] || p[w], Z = f[w];
970
+ K ? Y(Z, K) : (M = Z, z(), M = ""), w++;
856
971
  }
857
972
  }
858
- function xe(g, m) {
859
- return g.scope && typeof g.scope == "string" && z.openNode(q.classNameAliases[g.scope] || g.scope), g.beginScope && (g.beginScope._wrap ? (Z(C, q.classNameAliases[g.beginScope._wrap] || g.beginScope._wrap), C = "") : g.beginScope._multi && (Oe(g.beginScope, m), C = "")), E = Object.create(g, { parent: { value: E } }), E;
973
+ function xe(p, f) {
974
+ return p.scope && typeof p.scope == "string" && H.openNode(W.classNameAliases[p.scope] || p.scope), p.beginScope && (p.beginScope._wrap ? (Y(M, W.classNameAliases[p.beginScope._wrap] || p.beginScope._wrap), M = "") : p.beginScope._multi && (Oe(p.beginScope, f), M = "")), E = Object.create(p, { parent: { value: E } }), E;
860
975
  }
861
- function Ie(g, m, w) {
862
- let A = nn(g.endRe, w);
976
+ function Ie(p, f, w) {
977
+ let A = ln(p.endRe, w);
863
978
  if (A) {
864
- if (g["on:end"]) {
865
- const K = new Pe(g);
866
- g["on:end"](m, K), K.isMatchIgnored && (A = !1);
979
+ if (p["on:end"]) {
980
+ const K = new He(p);
981
+ p["on:end"](f, K), K.isMatchIgnored && (A = !1);
867
982
  }
868
983
  if (A) {
869
- for (; g.endsParent && g.parent; )
870
- g = g.parent;
871
- return g;
984
+ for (; p.endsParent && p.parent; )
985
+ p = p.parent;
986
+ return p;
872
987
  }
873
988
  }
874
- if (g.endsWithParent)
875
- return Ie(g.parent, m, w);
989
+ if (p.endsWithParent)
990
+ return Ie(p.parent, f, w);
876
991
  }
877
- function Nt(g) {
878
- return E.matcher.regexIndex === 0 ? (C += g[0], 1) : (ve = !0, 0);
992
+ function Ot(p) {
993
+ return E.matcher.regexIndex === 0 ? (M += p[0], 1) : (Ne = !0, 0);
879
994
  }
880
- function Tt(g) {
881
- const m = g[0], w = g.rule, A = new Pe(w), K = [w.__beforeBegin, w["on:begin"]];
882
- for (const W of K)
883
- if (W && (W(g, A), A.isMatchIgnored))
884
- return Nt(m);
885
- return w.skip ? C += m : (w.excludeBegin && (C += m), G(), !w.returnBegin && !w.excludeBegin && (C = m)), xe(w, g), w.returnBegin ? 0 : m.length;
995
+ function xt(p) {
996
+ const f = p[0], w = p.rule, A = new He(w), K = [w.__beforeBegin, w["on:begin"]];
997
+ for (const Z of K)
998
+ if (Z && (Z(p, A), A.isMatchIgnored))
999
+ return Ot(f);
1000
+ return w.skip ? M += f : (w.excludeBegin && (M += f), G(), !w.returnBegin && !w.excludeBegin && (M = f)), xe(w, p), w.returnBegin ? 0 : f.length;
886
1001
  }
887
- function St(g) {
888
- const m = g[0], w = h.substring(g.index), A = Ie(E, g, w);
1002
+ function It(p) {
1003
+ const f = p[0], w = h.substring(p.index), A = Ie(E, p, w);
889
1004
  if (!A)
890
- return Ke;
1005
+ return We;
891
1006
  const K = E;
892
- E.endScope && E.endScope._wrap ? (G(), Z(m, E.endScope._wrap)) : E.endScope && E.endScope._multi ? (G(), Oe(E.endScope, g)) : K.skip ? C += m : (K.returnEnd || K.excludeEnd || (C += m), G(), K.excludeEnd && (C = m));
1007
+ E.endScope && E.endScope._wrap ? (G(), Y(f, E.endScope._wrap)) : E.endScope && E.endScope._multi ? (G(), Oe(E.endScope, p)) : K.skip ? M += f : (K.returnEnd || K.excludeEnd || (M += f), G(), K.excludeEnd && (M = f));
893
1008
  do
894
- E.scope && z.closeNode(), !E.skip && !E.subLanguage && (ge += E.relevance), E = E.parent;
1009
+ E.scope && H.closeNode(), !E.skip && !E.subLanguage && (ge += E.relevance), E = E.parent;
895
1010
  while (E !== A.parent);
896
- return A.starts && xe(A.starts, g), K.returnEnd ? 0 : m.length;
1011
+ return A.starts && xe(A.starts, p), K.returnEnd ? 0 : f.length;
897
1012
  }
898
- function kt() {
899
- const g = [];
900
- for (let m = E; m !== q; m = m.parent)
901
- m.scope && g.unshift(m.scope);
902
- g.forEach((m) => z.openNode(m));
1013
+ function Lt() {
1014
+ const p = [];
1015
+ for (let f = E; f !== W; f = f.parent)
1016
+ f.scope && p.unshift(f.scope);
1017
+ p.forEach((f) => H.openNode(f));
903
1018
  }
904
- let ue = {};
905
- function Le(g, m) {
906
- const w = m && m[0];
907
- if (C += g, w == null)
1019
+ let pe = {};
1020
+ function Le(p, f) {
1021
+ const w = f && f[0];
1022
+ if (M += p, w == null)
908
1023
  return G(), 0;
909
- if (ue.type === "begin" && m.type === "end" && ue.index === m.index && w === "") {
910
- if (C += h.slice(m.index, m.index + 1), !a) {
1024
+ if (pe.type === "begin" && f.type === "end" && pe.index === f.index && w === "") {
1025
+ if (M += h.slice(f.index, f.index + 1), !i) {
911
1026
  const A = new Error(`0 width match regex (${d})`);
912
- throw A.languageName = d, A.badRule = ue.rule, A;
1027
+ throw A.languageName = d, A.badRule = pe.rule, A;
913
1028
  }
914
1029
  return 1;
915
1030
  }
916
- if (ue = m, m.type === "begin")
917
- return Tt(m);
918
- if (m.type === "illegal" && !p) {
1031
+ if (pe = f, f.type === "begin")
1032
+ return xt(f);
1033
+ if (f.type === "illegal" && !g) {
919
1034
  const A = new Error('Illegal lexeme "' + w + '" for mode "' + (E.scope || "<unnamed>") + '"');
920
1035
  throw A.mode = E, A;
921
- } else if (m.type === "end") {
922
- const A = St(m);
923
- if (A !== Ke)
1036
+ } else if (f.type === "end") {
1037
+ const A = It(f);
1038
+ if (A !== We)
924
1039
  return A;
925
1040
  }
926
- if (m.type === "illegal" && w === "")
927
- return m.index === h.length || (C += `
1041
+ if (f.type === "illegal" && w === "")
1042
+ return f.index === h.length || (M += `
928
1043
  `), 1;
929
- if (we > 1e5 && we > m.index * 3)
1044
+ if (ke > 1e5 && ke > f.index * 3)
930
1045
  throw new Error("potential infinite loop, way more iterations than matches");
931
- return C += w, w.length;
1046
+ return M += w, w.length;
932
1047
  }
933
- const q = P(d);
934
- if (!q)
1048
+ const W = $(d);
1049
+ if (!W)
935
1050
  throw ee(c.replace("{}", d)), new Error('Unknown language: "' + d + '"');
936
- const At = Pn(q);
937
- let ye = "", E = y || At;
938
- const De = {}, z = new s.__emitter(s);
939
- kt();
940
- let C = "", ge = 0, j = 0, we = 0, ve = !1;
1051
+ const Dt = Kn(W);
1052
+ let ve = "", E = y || Dt;
1053
+ const De = {}, H = new o.__emitter(o);
1054
+ Lt();
1055
+ let M = "", ge = 0, j = 0, ke = 0, Ne = !1;
941
1056
  try {
942
- if (q.__emitTokens)
943
- q.__emitTokens(h, z);
1057
+ if (W.__emitTokens)
1058
+ W.__emitTokens(h, H);
944
1059
  else {
945
1060
  for (E.matcher.considerAll(); ; ) {
946
- we++, ve ? ve = !1 : E.matcher.considerAll(), E.matcher.lastIndex = j;
947
- const g = E.matcher.exec(h);
948
- if (!g) break;
949
- const m = h.substring(j, g.index), w = Le(m, g);
950
- j = g.index + w;
1061
+ ke++, Ne ? Ne = !1 : E.matcher.considerAll(), E.matcher.lastIndex = j;
1062
+ const p = E.matcher.exec(h);
1063
+ if (!p) break;
1064
+ const f = h.substring(j, p.index), w = Le(f, p);
1065
+ j = p.index + w;
951
1066
  }
952
1067
  Le(h.substring(j));
953
1068
  }
954
- return z.finalize(), ye = z.toHTML(), {
1069
+ return H.finalize(), ve = H.toHTML(), {
955
1070
  language: d,
956
- value: ye,
1071
+ value: ve,
957
1072
  relevance: ge,
958
1073
  illegal: !1,
959
- _emitter: z,
1074
+ _emitter: H,
960
1075
  _top: E
961
1076
  };
962
- } catch (g) {
963
- if (g.message && g.message.includes("Illegal"))
1077
+ } catch (p) {
1078
+ if (p.message && p.message.includes("Illegal"))
964
1079
  return {
965
1080
  language: d,
966
- value: Te(h),
1081
+ value: Se(h),
967
1082
  illegal: !0,
968
1083
  relevance: 0,
969
1084
  _illegalBy: {
970
- message: g.message,
1085
+ message: p.message,
971
1086
  index: j,
972
1087
  context: h.slice(j - 100, j + 100),
973
- mode: g.mode,
974
- resultSoFar: ye
1088
+ mode: p.mode,
1089
+ resultSoFar: ve
975
1090
  },
976
- _emitter: z
1091
+ _emitter: H
977
1092
  };
978
- if (a)
1093
+ if (i)
979
1094
  return {
980
1095
  language: d,
981
- value: Te(h),
1096
+ value: Se(h),
982
1097
  illegal: !1,
983
1098
  relevance: 0,
984
- errorRaised: g,
985
- _emitter: z,
1099
+ errorRaised: p,
1100
+ _emitter: H,
986
1101
  _top: E
987
1102
  };
988
- throw g;
1103
+ throw p;
989
1104
  }
990
1105
  }
991
1106
  function b(d) {
992
1107
  const h = {
993
- value: Te(d),
1108
+ value: Se(d),
994
1109
  illegal: !1,
995
1110
  relevance: 0,
996
- _top: i,
997
- _emitter: new s.__emitter(s)
1111
+ _top: s,
1112
+ _emitter: new o.__emitter(o)
998
1113
  };
999
1114
  return h._emitter.addText(d), h;
1000
1115
  }
1001
1116
  function _(d, h) {
1002
- h = h || s.languages || Object.keys(t);
1003
- const p = b(d), y = h.filter(P).filter(X).map(
1004
- (G) => f(G, d, !1)
1117
+ h = h || o.languages || Object.keys(t);
1118
+ const g = b(d), y = h.filter($).filter(V).map(
1119
+ (G) => m(G, d, !1)
1005
1120
  );
1006
- y.unshift(p);
1007
- const T = y.sort((G, Z) => {
1008
- if (G.relevance !== Z.relevance) return Z.relevance - G.relevance;
1009
- if (G.language && Z.language) {
1010
- if (P(G.language).supersetOf === Z.language)
1121
+ y.unshift(g);
1122
+ const N = y.sort((G, Y) => {
1123
+ if (G.relevance !== Y.relevance) return Y.relevance - G.relevance;
1124
+ if (G.language && Y.language) {
1125
+ if ($(G.language).supersetOf === Y.language)
1011
1126
  return 1;
1012
- if (P(Z.language).supersetOf === G.language)
1127
+ if ($(Y.language).supersetOf === G.language)
1013
1128
  return -1;
1014
1129
  }
1015
1130
  return 0;
1016
- }), [I, H] = T, Y = I;
1017
- return Y.secondBest = H, Y;
1131
+ }), [L, z] = N, q = L;
1132
+ return q.secondBest = z, q;
1018
1133
  }
1019
- function v(d, h, p) {
1020
- const y = h && n[h] || p;
1134
+ function v(d, h, g) {
1135
+ const y = h && n[h] || g;
1021
1136
  d.classList.add("hljs"), d.classList.add(`language-${y}`);
1022
1137
  }
1023
- function N(d) {
1138
+ function k(d) {
1024
1139
  let h = null;
1025
- const p = l(d);
1026
- if (o(p)) return;
1027
- if (V(
1140
+ const g = l(d);
1141
+ if (a(g)) return;
1142
+ if (X(
1028
1143
  "before:highlightElement",
1029
- { el: d, language: p }
1144
+ { el: d, language: g }
1030
1145
  ), d.dataset.highlighted) {
1031
1146
  console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.", d);
1032
1147
  return;
1033
1148
  }
1034
- if (d.children.length > 0 && (s.ignoreUnescapedHTML || (console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."), console.warn("https://github.com/highlightjs/highlight.js/wiki/security"), console.warn("The element with unescaped HTML:"), console.warn(d)), s.throwUnescapedHTML))
1035
- throw new Fn(
1149
+ if (d.children.length > 0 && (o.ignoreUnescapedHTML || (console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."), console.warn("https://github.com/highlightjs/highlight.js/wiki/security"), console.warn("The element with unescaped HTML:"), console.warn(d)), o.throwUnescapedHTML))
1150
+ throw new Yn(
1036
1151
  "One of your code blocks includes unescaped HTML.",
1037
1152
  d.innerHTML
1038
1153
  );
1039
1154
  h = d;
1040
- const y = h.textContent, T = p ? u(y, { language: p, ignoreIllegals: !0 }) : _(y);
1041
- d.innerHTML = T.value, d.dataset.highlighted = "yes", v(d, p, T.language), d.result = {
1042
- language: T.language,
1155
+ const y = h.textContent, N = g ? u(y, { language: g, ignoreIllegals: !0 }) : _(y);
1156
+ d.innerHTML = N.value, d.dataset.highlighted = "yes", v(d, g, N.language), d.result = {
1157
+ language: N.language,
1043
1158
  // TODO: remove with version 11.0
1044
- re: T.relevance,
1045
- relevance: T.relevance
1046
- }, T.secondBest && (d.secondBest = {
1047
- language: T.secondBest.language,
1048
- relevance: T.secondBest.relevance
1049
- }), V("after:highlightElement", { el: d, result: T, text: y });
1159
+ re: N.relevance,
1160
+ relevance: N.relevance
1161
+ }, N.secondBest && (d.secondBest = {
1162
+ language: N.secondBest.language,
1163
+ relevance: N.secondBest.relevance
1164
+ }), X("after:highlightElement", { el: d, result: N, text: y });
1050
1165
  }
1051
1166
  function S(d) {
1052
- s = He(s, d);
1167
+ o = Ye(o, d);
1053
1168
  }
1054
- const M = () => {
1055
- R(), ne("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
1169
+ const R = () => {
1170
+ C(), ne("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
1056
1171
  };
1057
- function L() {
1058
- R(), ne("10.6.0", "initHighlightingOnLoad() deprecated. Use highlightAll() now.");
1172
+ function D() {
1173
+ C(), ne("10.6.0", "initHighlightingOnLoad() deprecated. Use highlightAll() now.");
1059
1174
  }
1060
- let $ = !1;
1061
- function R() {
1175
+ let U = !1;
1176
+ function C() {
1062
1177
  function d() {
1063
- R();
1178
+ C();
1064
1179
  }
1065
1180
  if (document.readyState === "loading") {
1066
- $ || window.addEventListener("DOMContentLoaded", d, !1), $ = !0;
1181
+ U || window.addEventListener("DOMContentLoaded", d, !1), U = !0;
1067
1182
  return;
1068
1183
  }
1069
- document.querySelectorAll(s.cssSelector).forEach(N);
1184
+ document.querySelectorAll(o.cssSelector).forEach(k);
1070
1185
  }
1071
1186
  function O(d, h) {
1072
- let p = null;
1187
+ let g = null;
1073
1188
  try {
1074
- p = h(e);
1189
+ g = h(e);
1075
1190
  } catch (y) {
1076
- if (ee("Language definition for '{}' could not be registered.".replace("{}", d)), a)
1191
+ if (ee("Language definition for '{}' could not be registered.".replace("{}", d)), i)
1077
1192
  ee(y);
1078
1193
  else
1079
1194
  throw y;
1080
- p = i;
1195
+ g = s;
1081
1196
  }
1082
- p.name || (p.name = d), t[d] = p, p.rawDefinition = h.bind(null, e), p.aliases && F(p.aliases, { languageName: d });
1197
+ g.name || (g.name = d), t[d] = g, g.rawDefinition = h.bind(null, e), g.aliases && F(g.aliases, { languageName: d });
1083
1198
  }
1084
1199
  function x(d) {
1085
1200
  delete t[d];
1086
1201
  for (const h of Object.keys(n))
1087
1202
  n[h] === d && delete n[h];
1088
1203
  }
1089
- function B() {
1204
+ function P() {
1090
1205
  return Object.keys(t);
1091
1206
  }
1092
- function P(d) {
1207
+ function $(d) {
1093
1208
  return d = (d || "").toLowerCase(), t[d] || t[n[d]];
1094
1209
  }
1095
1210
  function F(d, { languageName: h }) {
1096
- typeof d == "string" && (d = [d]), d.forEach((p) => {
1097
- n[p.toLowerCase()] = h;
1211
+ typeof d == "string" && (d = [d]), d.forEach((g) => {
1212
+ n[g.toLowerCase()] = h;
1098
1213
  });
1099
1214
  }
1100
- function X(d) {
1101
- const h = P(d);
1215
+ function V(d) {
1216
+ const h = $(d);
1102
1217
  return h && !h.disableAutodetect;
1103
1218
  }
1104
1219
  function J(d) {
@@ -1115,58 +1230,58 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = d, y = h), p ===
1115
1230
  function se(d) {
1116
1231
  J(d), r.push(d);
1117
1232
  }
1118
- function ae(d) {
1233
+ function oe(d) {
1119
1234
  const h = r.indexOf(d);
1120
1235
  h !== -1 && r.splice(h, 1);
1121
1236
  }
1122
- function V(d, h) {
1123
- const p = d;
1237
+ function X(d, h) {
1238
+ const g = d;
1124
1239
  r.forEach(function(y) {
1125
- y[p] && y[p](h);
1240
+ y[g] && y[g](h);
1126
1241
  });
1127
1242
  }
1128
- function oe(d) {
1129
- return ne("10.7.0", "highlightBlock will be removed entirely in v12.0"), ne("10.7.0", "Please use highlightElement now."), N(d);
1243
+ function ae(d) {
1244
+ return ne("10.7.0", "highlightBlock will be removed entirely in v12.0"), ne("10.7.0", "Please use highlightElement now."), k(d);
1130
1245
  }
1131
1246
  Object.assign(e, {
1132
1247
  highlight: u,
1133
1248
  highlightAuto: _,
1134
- highlightAll: R,
1135
- highlightElement: N,
1249
+ highlightAll: C,
1250
+ highlightElement: k,
1136
1251
  // TODO: Remove with v12 API
1137
- highlightBlock: oe,
1252
+ highlightBlock: ae,
1138
1253
  configure: S,
1139
- initHighlighting: M,
1140
- initHighlightingOnLoad: L,
1254
+ initHighlighting: R,
1255
+ initHighlightingOnLoad: D,
1141
1256
  registerLanguage: O,
1142
1257
  unregisterLanguage: x,
1143
- listLanguages: B,
1144
- getLanguage: P,
1258
+ listLanguages: P,
1259
+ getLanguage: $,
1145
1260
  registerAliases: F,
1146
- autoDetection: X,
1147
- inherit: He,
1261
+ autoDetection: V,
1262
+ inherit: Ye,
1148
1263
  addPlugin: se,
1149
- removePlugin: ae
1264
+ removePlugin: oe
1150
1265
  }), e.debugMode = function() {
1151
- a = !1;
1266
+ i = !1;
1152
1267
  }, e.safeMode = function() {
1153
- a = !0;
1154
- }, e.versionString = $n, e.regex = {
1268
+ i = !0;
1269
+ }, e.versionString = qn, e.regex = {
1155
1270
  concat: te,
1156
- lookahead: Xe,
1157
- either: _e,
1158
- optional: en,
1159
- anyNumberOfTimes: jt
1271
+ lookahead: nt,
1272
+ either: ye,
1273
+ optional: an,
1274
+ anyNumberOfTimes: on
1160
1275
  };
1161
- for (const d in pe)
1162
- typeof pe[d] == "object" && qe(pe[d]);
1163
- return Object.assign(e, pe), e;
1164
- }, ie = it({});
1165
- ie.newInstance = () => it({});
1166
- var Hn = ie;
1276
+ for (const d in fe)
1277
+ typeof fe[d] == "object" && et(fe[d]);
1278
+ return Object.assign(e, fe), e;
1279
+ }, ie = ut({});
1280
+ ie.newInstance = () => ut({});
1281
+ var Zn = ie;
1167
1282
  ie.HighlightJS = ie;
1168
1283
  ie.default = ie;
1169
- const k = /* @__PURE__ */ Wt(Hn), Ge = "[A-Za-z$_][0-9A-Za-z$_]*", Kn = [
1284
+ const T = /* @__PURE__ */ en(Zn), Ze = "[A-Za-z$_][0-9A-Za-z$_]*", Vn = [
1170
1285
  "as",
1171
1286
  // for exports
1172
1287
  "in",
@@ -1211,14 +1326,14 @@ const k = /* @__PURE__ */ Wt(Hn), Ge = "[A-Za-z$_][0-9A-Za-z$_]*", Kn = [
1211
1326
  "extends",
1212
1327
  // It's reached stage 3, which is "recommended for implementation":
1213
1328
  "using"
1214
- ], Gn = [
1329
+ ], Xn = [
1215
1330
  "true",
1216
1331
  "false",
1217
1332
  "null",
1218
1333
  "undefined",
1219
1334
  "NaN",
1220
1335
  "Infinity"
1221
- ], st = [
1336
+ ], pt = [
1222
1337
  // Fundamental objects
1223
1338
  "Object",
1224
1339
  "Function",
@@ -1268,7 +1383,7 @@ const k = /* @__PURE__ */ Wt(Hn), Ge = "[A-Za-z$_][0-9A-Za-z$_]*", Kn = [
1268
1383
  "Intl",
1269
1384
  // WebAssembly
1270
1385
  "WebAssembly"
1271
- ], at = [
1386
+ ], gt = [
1272
1387
  "Error",
1273
1388
  "EvalError",
1274
1389
  "InternalError",
@@ -1277,7 +1392,7 @@ const k = /* @__PURE__ */ Wt(Hn), Ge = "[A-Za-z$_][0-9A-Za-z$_]*", Kn = [
1277
1392
  "SyntaxError",
1278
1393
  "TypeError",
1279
1394
  "URIError"
1280
- ], ot = [
1395
+ ], ht = [
1281
1396
  "setInterval",
1282
1397
  "setTimeout",
1283
1398
  "clearInterval",
@@ -1295,7 +1410,7 @@ const k = /* @__PURE__ */ Wt(Hn), Ge = "[A-Za-z$_][0-9A-Za-z$_]*", Kn = [
1295
1410
  "encodeURIComponent",
1296
1411
  "escape",
1297
1412
  "unescape"
1298
- ], Yn = [
1413
+ ], Qn = [
1299
1414
  "arguments",
1300
1415
  "this",
1301
1416
  "super",
@@ -1308,61 +1423,61 @@ const k = /* @__PURE__ */ Wt(Hn), Ge = "[A-Za-z$_][0-9A-Za-z$_]*", Kn = [
1308
1423
  "self",
1309
1424
  "global"
1310
1425
  // Node.js
1311
- ], Zn = [].concat(
1312
- ot,
1313
- st,
1314
- at
1426
+ ], Jn = [].concat(
1427
+ ht,
1428
+ pt,
1429
+ gt
1315
1430
  );
1316
- function ct(e) {
1317
- const t = e.regex, n = (p, { after: y }) => {
1318
- const T = "</" + p[0].slice(1);
1319
- return p.input.indexOf(T, y) !== -1;
1320
- }, r = Ge, a = {
1431
+ function ft(e) {
1432
+ const t = e.regex, n = (g, { after: y }) => {
1433
+ const N = "</" + g[0].slice(1);
1434
+ return g.input.indexOf(N, y) !== -1;
1435
+ }, r = Ze, i = {
1321
1436
  begin: "<>",
1322
1437
  end: "</>"
1323
- }, c = /<[A-Za-z0-9\\._:-]+\s*\/>/, i = {
1438
+ }, c = /<[A-Za-z0-9\\._:-]+\s*\/>/, s = {
1324
1439
  begin: /<[A-Za-z0-9\\._:-]+/,
1325
1440
  end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
1326
1441
  /**
1327
1442
  * @param {RegExpMatchArray} match
1328
1443
  * @param {CallbackResponse} response
1329
1444
  */
1330
- isTrulyOpeningTag: (p, y) => {
1331
- const T = p[0].length + p.index, I = p.input[T];
1445
+ isTrulyOpeningTag: (g, y) => {
1446
+ const N = g[0].length + g.index, L = g.input[N];
1332
1447
  if (
1333
1448
  // HTML should not include another raw `<` inside a tag
1334
1449
  // nested type?
1335
1450
  // `<Array<Array<number>>`, etc.
1336
- I === "<" || // the , gives away that this is not HTML
1451
+ L === "<" || // the , gives away that this is not HTML
1337
1452
  // `<T, A extends keyof T, V>`
1338
- I === ","
1453
+ L === ","
1339
1454
  ) {
1340
1455
  y.ignoreMatch();
1341
1456
  return;
1342
1457
  }
1343
- I === ">" && (n(p, { after: T }) || y.ignoreMatch());
1344
- let H;
1345
- const Y = p.input.substring(T);
1346
- if (H = Y.match(/^\s*=/)) {
1458
+ L === ">" && (n(g, { after: N }) || y.ignoreMatch());
1459
+ let z;
1460
+ const q = g.input.substring(N);
1461
+ if (z = q.match(/^\s*=/)) {
1347
1462
  y.ignoreMatch();
1348
1463
  return;
1349
1464
  }
1350
- if ((H = Y.match(/^\s+extends\s+/)) && H.index === 0) {
1465
+ if ((z = q.match(/^\s+extends\s+/)) && z.index === 0) {
1351
1466
  y.ignoreMatch();
1352
1467
  return;
1353
1468
  }
1354
1469
  }
1355
- }, s = {
1356
- $pattern: Ge,
1357
- keyword: Kn,
1358
- literal: Gn,
1359
- built_in: Zn,
1360
- "variable.language": Yn
1361
- }, o = "[0-9](_?[0-9])*", l = `\\.(${o})`, u = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", f = {
1470
+ }, o = {
1471
+ $pattern: Ze,
1472
+ keyword: Vn,
1473
+ literal: Xn,
1474
+ built_in: Jn,
1475
+ "variable.language": Qn
1476
+ }, a = "[0-9](_?[0-9])*", l = `\\.(${a})`, u = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", m = {
1362
1477
  className: "number",
1363
1478
  variants: [
1364
1479
  // DecimalLiteral
1365
- { begin: `(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${o})\\b` },
1480
+ { begin: `(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${a})\\b` },
1366
1481
  { begin: `\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b` },
1367
1482
  // DecimalBigIntegerLiteral
1368
1483
  { begin: "\\b(0|[1-9](_?[0-9])*)n\\b" },
@@ -1379,7 +1494,7 @@ function ct(e) {
1379
1494
  className: "subst",
1380
1495
  begin: "\\$\\{",
1381
1496
  end: "\\}",
1382
- keywords: s,
1497
+ keywords: o,
1383
1498
  contains: []
1384
1499
  // defined later
1385
1500
  }, _ = {
@@ -1406,7 +1521,7 @@ function ct(e) {
1406
1521
  ],
1407
1522
  subLanguage: "css"
1408
1523
  }
1409
- }, N = {
1524
+ }, k = {
1410
1525
  begin: ".?gql`",
1411
1526
  end: "",
1412
1527
  starts: {
@@ -1426,7 +1541,7 @@ function ct(e) {
1426
1541
  e.BACKSLASH_ESCAPE,
1427
1542
  b
1428
1543
  ]
1429
- }, L = {
1544
+ }, D = {
1430
1545
  className: "comment",
1431
1546
  variants: [
1432
1547
  e.COMMENT(
@@ -1471,37 +1586,37 @@ function ct(e) {
1471
1586
  e.C_BLOCK_COMMENT_MODE,
1472
1587
  e.C_LINE_COMMENT_MODE
1473
1588
  ]
1474
- }, $ = [
1589
+ }, U = [
1475
1590
  e.APOS_STRING_MODE,
1476
1591
  e.QUOTE_STRING_MODE,
1477
1592
  _,
1478
1593
  v,
1479
- N,
1594
+ k,
1480
1595
  S,
1481
1596
  // Skip numbers when they are part of a variable name
1482
1597
  { match: /\$\d+/ },
1483
- f
1598
+ m
1484
1599
  // This is intentional:
1485
1600
  // See https://github.com/highlightjs/highlight.js/issues/3288
1486
1601
  // hljs.REGEXP_MODE
1487
1602
  ];
1488
- b.contains = $.concat({
1603
+ b.contains = U.concat({
1489
1604
  // we need to pair up {} inside our subst to prevent
1490
1605
  // it from ending too early by matching another }
1491
1606
  begin: /\{/,
1492
1607
  end: /\}/,
1493
- keywords: s,
1608
+ keywords: o,
1494
1609
  contains: [
1495
1610
  "self"
1496
- ].concat($)
1611
+ ].concat(U)
1497
1612
  });
1498
- const R = [].concat(L, b.contains), O = R.concat([
1613
+ const C = [].concat(D, b.contains), O = C.concat([
1499
1614
  // eat recursive parens in sub expressions
1500
1615
  {
1501
1616
  begin: /(\s*)\(/,
1502
1617
  end: /\)/,
1503
- keywords: s,
1504
- contains: ["self"].concat(R)
1618
+ keywords: o,
1619
+ contains: ["self"].concat(C)
1505
1620
  }
1506
1621
  ]), x = {
1507
1622
  className: "params",
@@ -1511,9 +1626,9 @@ function ct(e) {
1511
1626
  end: /\)/,
1512
1627
  excludeBegin: !0,
1513
1628
  excludeEnd: !0,
1514
- keywords: s,
1629
+ keywords: o,
1515
1630
  contains: O
1516
- }, B = {
1631
+ }, P = {
1517
1632
  variants: [
1518
1633
  // class Car extends vehicle
1519
1634
  {
@@ -1546,7 +1661,7 @@ function ct(e) {
1546
1661
  }
1547
1662
  }
1548
1663
  ]
1549
- }, P = {
1664
+ }, $ = {
1550
1665
  relevance: 0,
1551
1666
  match: t.either(
1552
1667
  // Hard coded exceptions
@@ -1566,8 +1681,8 @@ function ct(e) {
1566
1681
  keywords: {
1567
1682
  _: [
1568
1683
  // se we still get relevance credit for JS library classes
1569
- ...st,
1570
- ...at
1684
+ ...pt,
1685
+ ...gt
1571
1686
  ]
1572
1687
  }
1573
1688
  }, F = {
@@ -1575,7 +1690,7 @@ function ct(e) {
1575
1690
  className: "meta",
1576
1691
  relevance: 10,
1577
1692
  begin: /^\s*['"]use (strict|asm)['"]/
1578
- }, X = {
1693
+ }, V = {
1579
1694
  variants: [
1580
1695
  {
1581
1696
  match: [
@@ -1605,24 +1720,24 @@ function ct(e) {
1605
1720
  match: /\b[A-Z][A-Z_0-9]+\b/,
1606
1721
  className: "variable.constant"
1607
1722
  };
1608
- function se(p) {
1609
- return t.concat("(?!", p.join("|"), ")");
1723
+ function se(g) {
1724
+ return t.concat("(?!", g.join("|"), ")");
1610
1725
  }
1611
- const ae = {
1726
+ const oe = {
1612
1727
  match: t.concat(
1613
1728
  /\b/,
1614
1729
  se([
1615
- ...ot,
1730
+ ...ht,
1616
1731
  "super",
1617
1732
  "import",
1618
1733
  "await"
1619
- ].map((p) => `${p}\\s*\\(`)),
1734
+ ].map((g) => `${g}\\s*\\(`)),
1620
1735
  r,
1621
1736
  t.lookahead(/\s*\(/)
1622
1737
  ),
1623
1738
  className: "title.function",
1624
1739
  relevance: 0
1625
- }, V = {
1740
+ }, X = {
1626
1741
  begin: t.concat(/\./, t.lookahead(
1627
1742
  t.concat(r, /(?![0-9A-Za-z$_(])/)
1628
1743
  )),
@@ -1631,7 +1746,7 @@ function ct(e) {
1631
1746
  keywords: "prototype",
1632
1747
  className: "property",
1633
1748
  relevance: 0
1634
- }, oe = {
1749
+ }, ae = {
1635
1750
  match: [
1636
1751
  /get|set/,
1637
1752
  /\s+/,
@@ -1672,9 +1787,9 @@ function ct(e) {
1672
1787
  return {
1673
1788
  name: "JavaScript",
1674
1789
  aliases: ["js", "jsx", "mjs", "cjs"],
1675
- keywords: s,
1790
+ keywords: o,
1676
1791
  // this will be extended by TypeScript
1677
- exports: { PARAMS_CONTAINS: O, CLASS_REFERENCE: P },
1792
+ exports: { PARAMS_CONTAINS: O, CLASS_REFERENCE: $ },
1678
1793
  illegal: /#(?![$_A-Za-z])/,
1679
1794
  contains: [
1680
1795
  e.SHEBANG({
@@ -1687,13 +1802,13 @@ function ct(e) {
1687
1802
  e.QUOTE_STRING_MODE,
1688
1803
  _,
1689
1804
  v,
1690
- N,
1805
+ k,
1691
1806
  S,
1692
- L,
1807
+ D,
1693
1808
  // Skip numbers when they are part of a variable name
1694
1809
  { match: /\$\d+/ },
1695
- f,
1696
- P,
1810
+ m,
1811
+ $,
1697
1812
  {
1698
1813
  scope: "attr",
1699
1814
  match: r + t.lookahead(":"),
@@ -1706,7 +1821,7 @@ function ct(e) {
1706
1821
  keywords: "return throw case",
1707
1822
  relevance: 0,
1708
1823
  contains: [
1709
- L,
1824
+ D,
1710
1825
  e.REGEXP_MODE,
1711
1826
  {
1712
1827
  className: "function",
@@ -1734,7 +1849,7 @@ function ct(e) {
1734
1849
  end: /\)/,
1735
1850
  excludeBegin: !0,
1736
1851
  excludeEnd: !0,
1737
- keywords: s,
1852
+ keywords: o,
1738
1853
  contains: O
1739
1854
  }
1740
1855
  ]
@@ -1753,21 +1868,21 @@ function ct(e) {
1753
1868
  {
1754
1869
  // JSX
1755
1870
  variants: [
1756
- { begin: a.begin, end: a.end },
1871
+ { begin: i.begin, end: i.end },
1757
1872
  { match: c },
1758
1873
  {
1759
- begin: i.begin,
1874
+ begin: s.begin,
1760
1875
  // we carefully check the opening tag to see if it truly
1761
1876
  // is a tag and not a false positive
1762
- "on:begin": i.isTrulyOpeningTag,
1763
- end: i.end
1877
+ "on:begin": s.isTrulyOpeningTag,
1878
+ end: s.end
1764
1879
  }
1765
1880
  ],
1766
1881
  subLanguage: "xml",
1767
1882
  contains: [
1768
1883
  {
1769
- begin: i.begin,
1770
- end: i.end,
1884
+ begin: s.begin,
1885
+ end: s.end,
1771
1886
  skip: !0,
1772
1887
  contains: ["self"]
1773
1888
  }
@@ -1775,7 +1890,7 @@ function ct(e) {
1775
1890
  }
1776
1891
  ]
1777
1892
  },
1778
- X,
1893
+ V,
1779
1894
  {
1780
1895
  // prevent this from getting swallowed up by function
1781
1896
  // since they appear "function like"
@@ -1799,7 +1914,7 @@ function ct(e) {
1799
1914
  match: /\.\.\./,
1800
1915
  relevance: 0
1801
1916
  },
1802
- V,
1917
+ X,
1803
1918
  // hack: prevents detection of keywords in some circumstances
1804
1919
  // .keyword()
1805
1920
  // $keyword = x
@@ -1812,10 +1927,10 @@ function ct(e) {
1812
1927
  className: { 1: "title.function" },
1813
1928
  contains: [x]
1814
1929
  },
1815
- ae,
1816
- J,
1817
- B,
1818
1930
  oe,
1931
+ J,
1932
+ P,
1933
+ ae,
1819
1934
  {
1820
1935
  match: /\$[(.]/
1821
1936
  // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
@@ -1823,7 +1938,7 @@ function ct(e) {
1823
1938
  ]
1824
1939
  };
1825
1940
  }
1826
- const fe = "[A-Za-z$_][0-9A-Za-z$_]*", lt = [
1941
+ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", mt = [
1827
1942
  "as",
1828
1943
  // for exports
1829
1944
  "in",
@@ -1868,14 +1983,14 @@ const fe = "[A-Za-z$_][0-9A-Za-z$_]*", lt = [
1868
1983
  "extends",
1869
1984
  // It's reached stage 3, which is "recommended for implementation":
1870
1985
  "using"
1871
- ], dt = [
1986
+ ], bt = [
1872
1987
  "true",
1873
1988
  "false",
1874
1989
  "null",
1875
1990
  "undefined",
1876
1991
  "NaN",
1877
1992
  "Infinity"
1878
- ], ut = [
1993
+ ], _t = [
1879
1994
  // Fundamental objects
1880
1995
  "Object",
1881
1996
  "Function",
@@ -1925,7 +2040,7 @@ const fe = "[A-Za-z$_][0-9A-Za-z$_]*", lt = [
1925
2040
  "Intl",
1926
2041
  // WebAssembly
1927
2042
  "WebAssembly"
1928
- ], gt = [
2043
+ ], Et = [
1929
2044
  "Error",
1930
2045
  "EvalError",
1931
2046
  "InternalError",
@@ -1934,7 +2049,7 @@ const fe = "[A-Za-z$_][0-9A-Za-z$_]*", lt = [
1934
2049
  "SyntaxError",
1935
2050
  "TypeError",
1936
2051
  "URIError"
1937
- ], pt = [
2052
+ ], yt = [
1938
2053
  "setInterval",
1939
2054
  "setTimeout",
1940
2055
  "clearInterval",
@@ -1952,7 +2067,7 @@ const fe = "[A-Za-z$_][0-9A-Za-z$_]*", lt = [
1952
2067
  "encodeURIComponent",
1953
2068
  "escape",
1954
2069
  "unescape"
1955
- ], ht = [
2070
+ ], wt = [
1956
2071
  "arguments",
1957
2072
  "this",
1958
2073
  "super",
@@ -1965,61 +2080,61 @@ const fe = "[A-Za-z$_][0-9A-Za-z$_]*", lt = [
1965
2080
  "self",
1966
2081
  "global"
1967
2082
  // Node.js
1968
- ], mt = [].concat(
1969
- pt,
1970
- ut,
1971
- gt
2083
+ ], vt = [].concat(
2084
+ yt,
2085
+ _t,
2086
+ Et
1972
2087
  );
1973
- function qn(e) {
1974
- const t = e.regex, n = (p, { after: y }) => {
1975
- const T = "</" + p[0].slice(1);
1976
- return p.input.indexOf(T, y) !== -1;
1977
- }, r = fe, a = {
2088
+ function jn(e) {
2089
+ const t = e.regex, n = (g, { after: y }) => {
2090
+ const N = "</" + g[0].slice(1);
2091
+ return g.input.indexOf(N, y) !== -1;
2092
+ }, r = Ee, i = {
1978
2093
  begin: "<>",
1979
2094
  end: "</>"
1980
- }, c = /<[A-Za-z0-9\\._:-]+\s*\/>/, i = {
2095
+ }, c = /<[A-Za-z0-9\\._:-]+\s*\/>/, s = {
1981
2096
  begin: /<[A-Za-z0-9\\._:-]+/,
1982
2097
  end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
1983
2098
  /**
1984
2099
  * @param {RegExpMatchArray} match
1985
2100
  * @param {CallbackResponse} response
1986
2101
  */
1987
- isTrulyOpeningTag: (p, y) => {
1988
- const T = p[0].length + p.index, I = p.input[T];
2102
+ isTrulyOpeningTag: (g, y) => {
2103
+ const N = g[0].length + g.index, L = g.input[N];
1989
2104
  if (
1990
2105
  // HTML should not include another raw `<` inside a tag
1991
2106
  // nested type?
1992
2107
  // `<Array<Array<number>>`, etc.
1993
- I === "<" || // the , gives away that this is not HTML
2108
+ L === "<" || // the , gives away that this is not HTML
1994
2109
  // `<T, A extends keyof T, V>`
1995
- I === ","
2110
+ L === ","
1996
2111
  ) {
1997
2112
  y.ignoreMatch();
1998
2113
  return;
1999
2114
  }
2000
- I === ">" && (n(p, { after: T }) || y.ignoreMatch());
2001
- let H;
2002
- const Y = p.input.substring(T);
2003
- if (H = Y.match(/^\s*=/)) {
2115
+ L === ">" && (n(g, { after: N }) || y.ignoreMatch());
2116
+ let z;
2117
+ const q = g.input.substring(N);
2118
+ if (z = q.match(/^\s*=/)) {
2004
2119
  y.ignoreMatch();
2005
2120
  return;
2006
2121
  }
2007
- if ((H = Y.match(/^\s+extends\s+/)) && H.index === 0) {
2122
+ if ((z = q.match(/^\s+extends\s+/)) && z.index === 0) {
2008
2123
  y.ignoreMatch();
2009
2124
  return;
2010
2125
  }
2011
2126
  }
2012
- }, s = {
2013
- $pattern: fe,
2014
- keyword: lt,
2015
- literal: dt,
2016
- built_in: mt,
2017
- "variable.language": ht
2018
- }, o = "[0-9](_?[0-9])*", l = `\\.(${o})`, u = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", f = {
2127
+ }, o = {
2128
+ $pattern: Ee,
2129
+ keyword: mt,
2130
+ literal: bt,
2131
+ built_in: vt,
2132
+ "variable.language": wt
2133
+ }, a = "[0-9](_?[0-9])*", l = `\\.(${a})`, u = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", m = {
2019
2134
  className: "number",
2020
2135
  variants: [
2021
2136
  // DecimalLiteral
2022
- { begin: `(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${o})\\b` },
2137
+ { begin: `(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${a})\\b` },
2023
2138
  { begin: `\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b` },
2024
2139
  // DecimalBigIntegerLiteral
2025
2140
  { begin: "\\b(0|[1-9](_?[0-9])*)n\\b" },
@@ -2036,7 +2151,7 @@ function qn(e) {
2036
2151
  className: "subst",
2037
2152
  begin: "\\$\\{",
2038
2153
  end: "\\}",
2039
- keywords: s,
2154
+ keywords: o,
2040
2155
  contains: []
2041
2156
  // defined later
2042
2157
  }, _ = {
@@ -2063,7 +2178,7 @@ function qn(e) {
2063
2178
  ],
2064
2179
  subLanguage: "css"
2065
2180
  }
2066
- }, N = {
2181
+ }, k = {
2067
2182
  begin: ".?gql`",
2068
2183
  end: "",
2069
2184
  starts: {
@@ -2083,7 +2198,7 @@ function qn(e) {
2083
2198
  e.BACKSLASH_ESCAPE,
2084
2199
  b
2085
2200
  ]
2086
- }, L = {
2201
+ }, D = {
2087
2202
  className: "comment",
2088
2203
  variants: [
2089
2204
  e.COMMENT(
@@ -2128,37 +2243,37 @@ function qn(e) {
2128
2243
  e.C_BLOCK_COMMENT_MODE,
2129
2244
  e.C_LINE_COMMENT_MODE
2130
2245
  ]
2131
- }, $ = [
2246
+ }, U = [
2132
2247
  e.APOS_STRING_MODE,
2133
2248
  e.QUOTE_STRING_MODE,
2134
2249
  _,
2135
2250
  v,
2136
- N,
2251
+ k,
2137
2252
  S,
2138
2253
  // Skip numbers when they are part of a variable name
2139
2254
  { match: /\$\d+/ },
2140
- f
2255
+ m
2141
2256
  // This is intentional:
2142
2257
  // See https://github.com/highlightjs/highlight.js/issues/3288
2143
2258
  // hljs.REGEXP_MODE
2144
2259
  ];
2145
- b.contains = $.concat({
2260
+ b.contains = U.concat({
2146
2261
  // we need to pair up {} inside our subst to prevent
2147
2262
  // it from ending too early by matching another }
2148
2263
  begin: /\{/,
2149
2264
  end: /\}/,
2150
- keywords: s,
2265
+ keywords: o,
2151
2266
  contains: [
2152
2267
  "self"
2153
- ].concat($)
2268
+ ].concat(U)
2154
2269
  });
2155
- const R = [].concat(L, b.contains), O = R.concat([
2270
+ const C = [].concat(D, b.contains), O = C.concat([
2156
2271
  // eat recursive parens in sub expressions
2157
2272
  {
2158
2273
  begin: /(\s*)\(/,
2159
2274
  end: /\)/,
2160
- keywords: s,
2161
- contains: ["self"].concat(R)
2275
+ keywords: o,
2276
+ contains: ["self"].concat(C)
2162
2277
  }
2163
2278
  ]), x = {
2164
2279
  className: "params",
@@ -2168,9 +2283,9 @@ function qn(e) {
2168
2283
  end: /\)/,
2169
2284
  excludeBegin: !0,
2170
2285
  excludeEnd: !0,
2171
- keywords: s,
2286
+ keywords: o,
2172
2287
  contains: O
2173
- }, B = {
2288
+ }, P = {
2174
2289
  variants: [
2175
2290
  // class Car extends vehicle
2176
2291
  {
@@ -2203,7 +2318,7 @@ function qn(e) {
2203
2318
  }
2204
2319
  }
2205
2320
  ]
2206
- }, P = {
2321
+ }, $ = {
2207
2322
  relevance: 0,
2208
2323
  match: t.either(
2209
2324
  // Hard coded exceptions
@@ -2223,8 +2338,8 @@ function qn(e) {
2223
2338
  keywords: {
2224
2339
  _: [
2225
2340
  // se we still get relevance credit for JS library classes
2226
- ...ut,
2227
- ...gt
2341
+ ..._t,
2342
+ ...Et
2228
2343
  ]
2229
2344
  }
2230
2345
  }, F = {
@@ -2232,7 +2347,7 @@ function qn(e) {
2232
2347
  className: "meta",
2233
2348
  relevance: 10,
2234
2349
  begin: /^\s*['"]use (strict|asm)['"]/
2235
- }, X = {
2350
+ }, V = {
2236
2351
  variants: [
2237
2352
  {
2238
2353
  match: [
@@ -2262,24 +2377,24 @@ function qn(e) {
2262
2377
  match: /\b[A-Z][A-Z_0-9]+\b/,
2263
2378
  className: "variable.constant"
2264
2379
  };
2265
- function se(p) {
2266
- return t.concat("(?!", p.join("|"), ")");
2380
+ function se(g) {
2381
+ return t.concat("(?!", g.join("|"), ")");
2267
2382
  }
2268
- const ae = {
2383
+ const oe = {
2269
2384
  match: t.concat(
2270
2385
  /\b/,
2271
2386
  se([
2272
- ...pt,
2387
+ ...yt,
2273
2388
  "super",
2274
2389
  "import",
2275
2390
  "await"
2276
- ].map((p) => `${p}\\s*\\(`)),
2391
+ ].map((g) => `${g}\\s*\\(`)),
2277
2392
  r,
2278
2393
  t.lookahead(/\s*\(/)
2279
2394
  ),
2280
2395
  className: "title.function",
2281
2396
  relevance: 0
2282
- }, V = {
2397
+ }, X = {
2283
2398
  begin: t.concat(/\./, t.lookahead(
2284
2399
  t.concat(r, /(?![0-9A-Za-z$_(])/)
2285
2400
  )),
@@ -2288,7 +2403,7 @@ function qn(e) {
2288
2403
  keywords: "prototype",
2289
2404
  className: "property",
2290
2405
  relevance: 0
2291
- }, oe = {
2406
+ }, ae = {
2292
2407
  match: [
2293
2408
  /get|set/,
2294
2409
  /\s+/,
@@ -2329,9 +2444,9 @@ function qn(e) {
2329
2444
  return {
2330
2445
  name: "JavaScript",
2331
2446
  aliases: ["js", "jsx", "mjs", "cjs"],
2332
- keywords: s,
2447
+ keywords: o,
2333
2448
  // this will be extended by TypeScript
2334
- exports: { PARAMS_CONTAINS: O, CLASS_REFERENCE: P },
2449
+ exports: { PARAMS_CONTAINS: O, CLASS_REFERENCE: $ },
2335
2450
  illegal: /#(?![$_A-Za-z])/,
2336
2451
  contains: [
2337
2452
  e.SHEBANG({
@@ -2344,13 +2459,13 @@ function qn(e) {
2344
2459
  e.QUOTE_STRING_MODE,
2345
2460
  _,
2346
2461
  v,
2347
- N,
2462
+ k,
2348
2463
  S,
2349
- L,
2464
+ D,
2350
2465
  // Skip numbers when they are part of a variable name
2351
2466
  { match: /\$\d+/ },
2352
- f,
2353
- P,
2467
+ m,
2468
+ $,
2354
2469
  {
2355
2470
  scope: "attr",
2356
2471
  match: r + t.lookahead(":"),
@@ -2363,7 +2478,7 @@ function qn(e) {
2363
2478
  keywords: "return throw case",
2364
2479
  relevance: 0,
2365
2480
  contains: [
2366
- L,
2481
+ D,
2367
2482
  e.REGEXP_MODE,
2368
2483
  {
2369
2484
  className: "function",
@@ -2391,7 +2506,7 @@ function qn(e) {
2391
2506
  end: /\)/,
2392
2507
  excludeBegin: !0,
2393
2508
  excludeEnd: !0,
2394
- keywords: s,
2509
+ keywords: o,
2395
2510
  contains: O
2396
2511
  }
2397
2512
  ]
@@ -2410,21 +2525,21 @@ function qn(e) {
2410
2525
  {
2411
2526
  // JSX
2412
2527
  variants: [
2413
- { begin: a.begin, end: a.end },
2528
+ { begin: i.begin, end: i.end },
2414
2529
  { match: c },
2415
2530
  {
2416
- begin: i.begin,
2531
+ begin: s.begin,
2417
2532
  // we carefully check the opening tag to see if it truly
2418
2533
  // is a tag and not a false positive
2419
- "on:begin": i.isTrulyOpeningTag,
2420
- end: i.end
2534
+ "on:begin": s.isTrulyOpeningTag,
2535
+ end: s.end
2421
2536
  }
2422
2537
  ],
2423
2538
  subLanguage: "xml",
2424
2539
  contains: [
2425
2540
  {
2426
- begin: i.begin,
2427
- end: i.end,
2541
+ begin: s.begin,
2542
+ end: s.end,
2428
2543
  skip: !0,
2429
2544
  contains: ["self"]
2430
2545
  }
@@ -2432,7 +2547,7 @@ function qn(e) {
2432
2547
  }
2433
2548
  ]
2434
2549
  },
2435
- X,
2550
+ V,
2436
2551
  {
2437
2552
  // prevent this from getting swallowed up by function
2438
2553
  // since they appear "function like"
@@ -2456,7 +2571,7 @@ function qn(e) {
2456
2571
  match: /\.\.\./,
2457
2572
  relevance: 0
2458
2573
  },
2459
- V,
2574
+ X,
2460
2575
  // hack: prevents detection of keywords in some circumstances
2461
2576
  // .keyword()
2462
2577
  // $keyword = x
@@ -2469,10 +2584,10 @@ function qn(e) {
2469
2584
  className: { 1: "title.function" },
2470
2585
  contains: [x]
2471
2586
  },
2472
- ae,
2473
- J,
2474
- B,
2475
2587
  oe,
2588
+ J,
2589
+ P,
2590
+ ae,
2476
2591
  {
2477
2592
  match: /\$[(.]/
2478
2593
  // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
@@ -2480,8 +2595,8 @@ function qn(e) {
2480
2595
  ]
2481
2596
  };
2482
2597
  }
2483
- function bt(e) {
2484
- const t = e.regex, n = qn(e), r = fe, a = [
2598
+ function kt(e) {
2599
+ const t = e.regex, n = jn(e), r = Ee, i = [
2485
2600
  "any",
2486
2601
  "void",
2487
2602
  "number",
@@ -2502,20 +2617,20 @@ function bt(e) {
2502
2617
  1: "keyword",
2503
2618
  3: "title.class"
2504
2619
  }
2505
- }, i = {
2620
+ }, s = {
2506
2621
  beginKeywords: "interface",
2507
2622
  end: /\{/,
2508
2623
  excludeEnd: !0,
2509
2624
  keywords: {
2510
2625
  keyword: "interface extends",
2511
- built_in: a
2626
+ built_in: i
2512
2627
  },
2513
2628
  contains: [n.exports.CLASS_REFERENCE]
2514
- }, s = {
2629
+ }, o = {
2515
2630
  className: "meta",
2516
2631
  relevance: 10,
2517
2632
  begin: /^\s*['"]use strict['"]/
2518
- }, o = [
2633
+ }, a = [
2519
2634
  "type",
2520
2635
  // "namespace",
2521
2636
  "interface",
@@ -2530,22 +2645,22 @@ function bt(e) {
2530
2645
  "override",
2531
2646
  "satisfies"
2532
2647
  ], l = {
2533
- $pattern: fe,
2534
- keyword: lt.concat(o),
2535
- literal: dt,
2536
- built_in: mt.concat(a),
2537
- "variable.language": ht
2648
+ $pattern: Ee,
2649
+ keyword: mt.concat(a),
2650
+ literal: bt,
2651
+ built_in: vt.concat(i),
2652
+ "variable.language": wt
2538
2653
  }, u = {
2539
2654
  className: "meta",
2540
2655
  begin: "@" + r
2541
- }, f = (N, S, M) => {
2542
- const L = N.contains.findIndex(($) => $.label === S);
2543
- if (L === -1)
2656
+ }, m = (k, S, R) => {
2657
+ const D = k.contains.findIndex((U) => U.label === S);
2658
+ if (D === -1)
2544
2659
  throw new Error("can not find mode to replace");
2545
- N.contains.splice(L, 1, M);
2660
+ k.contains.splice(D, 1, R);
2546
2661
  };
2547
2662
  Object.assign(n.keywords, l), n.exports.PARAMS_CONTAINS.push(u);
2548
- const b = n.contains.find((N) => N.scope === "attr"), _ = Object.assign(
2663
+ const b = n.contains.find((k) => k.scope === "attr"), _ = Object.assign(
2549
2664
  {},
2550
2665
  b,
2551
2666
  { match: t.concat(r, t.lookahead(/\s*\?:/)) }
@@ -2560,11 +2675,11 @@ function bt(e) {
2560
2675
  ]), n.contains = n.contains.concat([
2561
2676
  u,
2562
2677
  c,
2563
- i,
2678
+ s,
2564
2679
  _
2565
2680
  // Added for optional property assignment highlighting
2566
- ]), f(n, "shebang", e.SHEBANG()), f(n, "use_strict", s);
2567
- const v = n.contains.find((N) => N.label === "func.def");
2681
+ ]), m(n, "shebang", e.SHEBANG()), m(n, "use_strict", o);
2682
+ const v = n.contains.find((k) => k.label === "func.def");
2568
2683
  return v.relevance = 0, Object.assign(n, {
2569
2684
  name: "TypeScript",
2570
2685
  aliases: [
@@ -2575,7 +2690,7 @@ function bt(e) {
2575
2690
  ]
2576
2691
  }), n;
2577
2692
  }
2578
- function ft(e) {
2693
+ function Nt(e) {
2579
2694
  const t = e.regex, n = new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*", "u"), r = [
2580
2695
  "and",
2581
2696
  "as",
@@ -2612,7 +2727,7 @@ function ft(e) {
2612
2727
  "while",
2613
2728
  "with",
2614
2729
  "yield"
2615
- ], s = {
2730
+ ], o = {
2616
2731
  $pattern: /[A-Za-z]\w+|__\w+__/,
2617
2732
  keyword: r,
2618
2733
  built_in: [
@@ -2713,19 +2828,19 @@ function ft(e) {
2713
2828
  "Type",
2714
2829
  "Union"
2715
2830
  ]
2716
- }, o = {
2831
+ }, a = {
2717
2832
  className: "meta",
2718
2833
  begin: /^(>>>|\.\.\.) /
2719
2834
  }, l = {
2720
2835
  className: "subst",
2721
2836
  begin: /\{/,
2722
2837
  end: /\}/,
2723
- keywords: s,
2838
+ keywords: o,
2724
2839
  illegal: /#/
2725
2840
  }, u = {
2726
2841
  begin: /\{\{/,
2727
2842
  relevance: 0
2728
- }, f = {
2843
+ }, m = {
2729
2844
  className: "string",
2730
2845
  contains: [e.BACKSLASH_ESCAPE],
2731
2846
  variants: [
@@ -2734,7 +2849,7 @@ function ft(e) {
2734
2849
  end: /'''/,
2735
2850
  contains: [
2736
2851
  e.BACKSLASH_ESCAPE,
2737
- o
2852
+ a
2738
2853
  ],
2739
2854
  relevance: 10
2740
2855
  },
@@ -2743,7 +2858,7 @@ function ft(e) {
2743
2858
  end: /"""/,
2744
2859
  contains: [
2745
2860
  e.BACKSLASH_ESCAPE,
2746
- o
2861
+ a
2747
2862
  ],
2748
2863
  relevance: 10
2749
2864
  },
@@ -2752,7 +2867,7 @@ function ft(e) {
2752
2867
  end: /'''/,
2753
2868
  contains: [
2754
2869
  e.BACKSLASH_ESCAPE,
2755
- o,
2870
+ a,
2756
2871
  u,
2757
2872
  l
2758
2873
  ]
@@ -2762,7 +2877,7 @@ function ft(e) {
2762
2877
  end: /"""/,
2763
2878
  contains: [
2764
2879
  e.BACKSLASH_ESCAPE,
2765
- o,
2880
+ a,
2766
2881
  u,
2767
2882
  l
2768
2883
  ]
@@ -2806,7 +2921,7 @@ function ft(e) {
2806
2921
  e.APOS_STRING_MODE,
2807
2922
  e.QUOTE_STRING_MODE
2808
2923
  ]
2809
- }, b = "[0-9](_?[0-9])*", _ = `(\\b(${b}))?\\.(${b})|\\b(${b})\\.`, v = `\\b|${r.join("|")}`, N = {
2924
+ }, b = "[0-9](_?[0-9])*", _ = `(\\b(${b}))?\\.(${b})|\\b(${b})\\.`, v = `\\b|${r.join("|")}`, k = {
2810
2925
  className: "number",
2811
2926
  relevance: 0,
2812
2927
  variants: [
@@ -2854,7 +2969,7 @@ function ft(e) {
2854
2969
  className: "comment",
2855
2970
  begin: t.lookahead(/# type:/),
2856
2971
  end: /$/,
2857
- keywords: s,
2972
+ keywords: o,
2858
2973
  contains: [
2859
2974
  {
2860
2975
  // prevent keywords from coloring `type`
@@ -2867,7 +2982,7 @@ function ft(e) {
2867
2982
  endsWithParent: !0
2868
2983
  }
2869
2984
  ]
2870
- }, M = {
2985
+ }, R = {
2871
2986
  className: "params",
2872
2987
  variants: [
2873
2988
  // Exclude params in functions without params
@@ -2881,21 +2996,21 @@ function ft(e) {
2881
2996
  end: /\)/,
2882
2997
  excludeBegin: !0,
2883
2998
  excludeEnd: !0,
2884
- keywords: s,
2999
+ keywords: o,
2885
3000
  contains: [
2886
3001
  "self",
2887
- o,
2888
- N,
2889
- f,
3002
+ a,
3003
+ k,
3004
+ m,
2890
3005
  e.HASH_COMMENT_MODE
2891
3006
  ]
2892
3007
  }
2893
3008
  ]
2894
3009
  };
2895
3010
  return l.contains = [
2896
- f,
2897
- N,
2898
- o
3011
+ m,
3012
+ k,
3013
+ a
2899
3014
  ], {
2900
3015
  name: "Python",
2901
3016
  aliases: [
@@ -2904,11 +3019,11 @@ function ft(e) {
2904
3019
  "ipython"
2905
3020
  ],
2906
3021
  unicodeRegex: !0,
2907
- keywords: s,
3022
+ keywords: o,
2908
3023
  illegal: /(<\/|\?)|=>/,
2909
3024
  contains: [
2910
- o,
2911
- N,
3025
+ a,
3026
+ k,
2912
3027
  {
2913
3028
  // very common convention
2914
3029
  scope: "variable.language",
@@ -2921,7 +3036,7 @@ function ft(e) {
2921
3036
  relevance: 0
2922
3037
  },
2923
3038
  { match: /\bor\b/, scope: "keyword" },
2924
- f,
3039
+ m,
2925
3040
  S,
2926
3041
  e.HASH_COMMENT_MODE,
2927
3042
  {
@@ -2934,7 +3049,7 @@ function ft(e) {
2934
3049
  1: "keyword",
2935
3050
  3: "title.function"
2936
3051
  },
2937
- contains: [M]
3052
+ contains: [R]
2938
3053
  },
2939
3054
  {
2940
3055
  variants: [
@@ -2968,20 +3083,20 @@ function ft(e) {
2968
3083
  begin: /^[\t ]*@/,
2969
3084
  end: /(?=#)|$/,
2970
3085
  contains: [
2971
- N,
2972
- M,
2973
- f
3086
+ k,
3087
+ R,
3088
+ m
2974
3089
  ]
2975
3090
  }
2976
3091
  ]
2977
3092
  };
2978
3093
  }
2979
- const Wn = "([-+]?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)|NaN|[-+]?Infinity", Xn = {
3094
+ const er = "([-+]?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)|NaN|[-+]?Infinity", tr = {
2980
3095
  scope: "number",
2981
- match: Wn,
3096
+ match: er,
2982
3097
  relevance: 0
2983
3098
  };
2984
- function Vn(e) {
3099
+ function nr(e) {
2985
3100
  const t = {
2986
3101
  className: "attr",
2987
3102
  begin: /(("(\\.|[^\\"\r\n])*")|('(\\.|[^\\'\r\n])*'))(?=\s*:)/,
@@ -2994,7 +3109,7 @@ function Vn(e) {
2994
3109
  "true",
2995
3110
  "false",
2996
3111
  "null"
2997
- ], a = {
3112
+ ], i = {
2998
3113
  scope: "literal",
2999
3114
  beginKeywords: r.join(" ")
3000
3115
  };
@@ -3009,15 +3124,15 @@ function Vn(e) {
3009
3124
  n,
3010
3125
  e.APOS_STRING_MODE,
3011
3126
  e.QUOTE_STRING_MODE,
3012
- a,
3013
- Xn,
3127
+ i,
3128
+ tr,
3014
3129
  e.C_LINE_COMMENT_MODE,
3015
3130
  e.C_BLOCK_COMMENT_MODE
3016
3131
  ],
3017
3132
  illegal: "\\S"
3018
3133
  };
3019
3134
  }
3020
- function Ce(e) {
3135
+ function Me(e) {
3021
3136
  const t = e.regex, n = {}, r = {
3022
3137
  begin: /\$\{/,
3023
3138
  end: /\}/,
@@ -3042,7 +3157,7 @@ function Ce(e) {
3042
3157
  r
3043
3158
  ]
3044
3159
  });
3045
- const a = {
3160
+ const i = {
3046
3161
  className: "subst",
3047
3162
  begin: /\$\(/,
3048
3163
  end: /\)/,
@@ -3058,7 +3173,7 @@ function Ce(e) {
3058
3173
  2: "comment"
3059
3174
  }
3060
3175
  }
3061
- ), i = {
3176
+ ), s = {
3062
3177
  begin: /<<-?\s*(?=\w+)/,
3063
3178
  starts: { contains: [
3064
3179
  e.END_SAME_AS_BEGIN({
@@ -3067,18 +3182,18 @@ function Ce(e) {
3067
3182
  className: "string"
3068
3183
  })
3069
3184
  ] }
3070
- }, s = {
3185
+ }, o = {
3071
3186
  className: "string",
3072
3187
  begin: /"/,
3073
3188
  end: /"/,
3074
3189
  contains: [
3075
3190
  e.BACKSLASH_ESCAPE,
3076
3191
  n,
3077
- a
3192
+ i
3078
3193
  ]
3079
3194
  };
3080
- a.contains.push(s);
3081
- const o = {
3195
+ i.contains.push(o);
3196
+ const a = {
3082
3197
  match: /\\"/
3083
3198
  }, l = {
3084
3199
  className: "string",
@@ -3086,7 +3201,7 @@ function Ce(e) {
3086
3201
  end: /'/
3087
3202
  }, u = {
3088
3203
  match: /\\'/
3089
- }, f = {
3204
+ }, m = {
3090
3205
  begin: /\$?\(\(/,
3091
3206
  end: /\)\)/,
3092
3207
  contains: [
@@ -3116,7 +3231,7 @@ function Ce(e) {
3116
3231
  returnBegin: !0,
3117
3232
  contains: [e.inherit(e.TITLE_MODE, { begin: /\w[\w\d_]*/ })],
3118
3233
  relevance: 0
3119
- }, N = [
3234
+ }, k = [
3120
3235
  "if",
3121
3236
  "then",
3122
3237
  "else",
@@ -3137,7 +3252,7 @@ function Ce(e) {
3137
3252
  ], S = [
3138
3253
  "true",
3139
3254
  "false"
3140
- ], M = { match: /(\/[a-z._-]+)+/ }, L = [
3255
+ ], R = { match: /(\/[a-z._-]+)+/ }, D = [
3141
3256
  "break",
3142
3257
  "cd",
3143
3258
  "continue",
@@ -3156,7 +3271,7 @@ function Ce(e) {
3156
3271
  "trap",
3157
3272
  "umask",
3158
3273
  "unset"
3159
- ], $ = [
3274
+ ], U = [
3160
3275
  "alias",
3161
3276
  "bind",
3162
3277
  "builtin",
@@ -3179,7 +3294,7 @@ function Ce(e) {
3179
3294
  "typeset",
3180
3295
  "ulimit",
3181
3296
  "unalias"
3182
- ], R = [
3297
+ ], C = [
3183
3298
  "autoload",
3184
3299
  "bg",
3185
3300
  "bindkey",
@@ -3361,15 +3476,15 @@ function Ce(e) {
3361
3476
  ],
3362
3477
  keywords: {
3363
3478
  $pattern: /\b[a-z][a-z0-9._-]+\b/,
3364
- keyword: N,
3479
+ keyword: k,
3365
3480
  literal: S,
3366
3481
  built_in: [
3367
- ...L,
3368
- ...$,
3482
+ ...D,
3483
+ ...U,
3369
3484
  // Shell modifiers
3370
3485
  "set",
3371
3486
  "shopt",
3372
- ...R,
3487
+ ...C,
3373
3488
  ...O
3374
3489
  ]
3375
3490
  },
@@ -3379,19 +3494,19 @@ function Ce(e) {
3379
3494
  e.SHEBANG(),
3380
3495
  // to catch unknown shells but still highlight the shebang
3381
3496
  v,
3382
- f,
3497
+ m,
3383
3498
  c,
3384
- i,
3385
- M,
3386
3499
  s,
3500
+ R,
3387
3501
  o,
3502
+ a,
3388
3503
  l,
3389
3504
  u,
3390
3505
  n
3391
3506
  ]
3392
3507
  };
3393
3508
  }
3394
- const Qn = (e) => ({
3509
+ const rr = (e) => ({
3395
3510
  IMPORTANT: {
3396
3511
  scope: "meta",
3397
3512
  begin: "!important"
@@ -3428,7 +3543,7 @@ const Qn = (e) => ({
3428
3543
  className: "attr",
3429
3544
  begin: /--[A-Za-z_][A-Za-z0-9_-]*/
3430
3545
  }
3431
- }), Jn = [
3546
+ }), ir = [
3432
3547
  "a",
3433
3548
  "abbr",
3434
3549
  "address",
@@ -3506,7 +3621,7 @@ const Qn = (e) => ({
3506
3621
  "ul",
3507
3622
  "var",
3508
3623
  "video"
3509
- ], jn = [
3624
+ ], sr = [
3510
3625
  "defs",
3511
3626
  "g",
3512
3627
  "marker",
@@ -3548,10 +3663,10 @@ const Qn = (e) => ({
3548
3663
  "tspan",
3549
3664
  "foreignObject",
3550
3665
  "clipPath"
3551
- ], er = [
3552
- ...Jn,
3553
- ...jn
3554
- ], tr = [
3666
+ ], or = [
3667
+ ...ir,
3668
+ ...sr
3669
+ ], ar = [
3555
3670
  "any-hover",
3556
3671
  "any-pointer",
3557
3672
  "aspect-ratio",
@@ -3586,7 +3701,7 @@ const Qn = (e) => ({
3586
3701
  "max-width",
3587
3702
  "min-height",
3588
3703
  "max-height"
3589
- ].sort().reverse(), nr = [
3704
+ ].sort().reverse(), cr = [
3590
3705
  "active",
3591
3706
  "any-link",
3592
3707
  "blank",
@@ -3660,7 +3775,7 @@ const Qn = (e) => ({
3660
3775
  "visited",
3661
3776
  "where"
3662
3777
  // where()
3663
- ].sort().reverse(), rr = [
3778
+ ].sort().reverse(), lr = [
3664
3779
  "after",
3665
3780
  "backdrop",
3666
3781
  "before",
@@ -3675,7 +3790,7 @@ const Qn = (e) => ({
3675
3790
  "selection",
3676
3791
  "slotted",
3677
3792
  "spelling-error"
3678
- ].sort().reverse(), ir = [
3793
+ ].sort().reverse(), dr = [
3679
3794
  "accent-color",
3680
3795
  "align-content",
3681
3796
  "align-items",
@@ -4198,8 +4313,8 @@ const Qn = (e) => ({
4198
4313
  "z-index",
4199
4314
  "zoom"
4200
4315
  ].sort().reverse();
4201
- function sr(e) {
4202
- const t = e.regex, n = Qn(e), r = { begin: /-(webkit|moz|ms|o)-(?=[a-z])/ }, a = "and or not only", c = /@-?\w[\w]*(-\w+)*/, i = "[a-zA-Z-][a-zA-Z0-9_-]*", s = [
4316
+ function ur(e) {
4317
+ const t = e.regex, n = rr(e), r = { begin: /-(webkit|moz|ms|o)-(?=[a-z])/ }, i = "and or not only", c = /@-?\w[\w]*(-\w+)*/, s = "[a-zA-Z-][a-zA-Z0-9_-]*", o = [
4203
4318
  e.APOS_STRING_MODE,
4204
4319
  e.QUOTE_STRING_MODE
4205
4320
  ];
@@ -4226,15 +4341,15 @@ function sr(e) {
4226
4341
  },
4227
4342
  {
4228
4343
  className: "selector-class",
4229
- begin: "\\." + i,
4344
+ begin: "\\." + s,
4230
4345
  relevance: 0
4231
4346
  },
4232
4347
  n.ATTRIBUTE_SELECTOR_MODE,
4233
4348
  {
4234
4349
  className: "selector-pseudo",
4235
4350
  variants: [
4236
- { begin: ":(" + nr.join("|") + ")" },
4237
- { begin: ":(:)?(" + rr.join("|") + ")" }
4351
+ { begin: ":(" + cr.join("|") + ")" },
4352
+ { begin: ":(:)?(" + lr.join("|") + ")" }
4238
4353
  ]
4239
4354
  },
4240
4355
  // we may actually need this (12/2020)
@@ -4246,7 +4361,7 @@ function sr(e) {
4246
4361
  n.CSS_VARIABLE,
4247
4362
  {
4248
4363
  className: "attribute",
4249
- begin: "\\b(" + ir.join("|") + ")\\b"
4364
+ begin: "\\b(" + dr.join("|") + ")\\b"
4250
4365
  },
4251
4366
  // attribute values
4252
4367
  {
@@ -4258,7 +4373,7 @@ function sr(e) {
4258
4373
  n.IMPORTANT,
4259
4374
  n.CSS_NUMBER_MODE,
4260
4375
  n.UNICODE_RANGE,
4261
- ...s,
4376
+ ...o,
4262
4377
  // needed to highlight these as strings and to avoid issues with
4263
4378
  // illegal characters that might be inside urls that would trigger the
4264
4379
  // languages illegal stack
@@ -4269,7 +4384,7 @@ function sr(e) {
4269
4384
  // from keywords
4270
4385
  keywords: { built_in: "url data-uri" },
4271
4386
  contains: [
4272
- ...s,
4387
+ ...o,
4273
4388
  {
4274
4389
  className: "string",
4275
4390
  // any character other than `)` as in `url()` will be the start
@@ -4301,15 +4416,15 @@ function sr(e) {
4301
4416
  relevance: 0,
4302
4417
  keywords: {
4303
4418
  $pattern: /[a-z-]+/,
4304
- keyword: a,
4305
- attribute: tr.join(" ")
4419
+ keyword: i,
4420
+ attribute: ar.join(" ")
4306
4421
  },
4307
4422
  contains: [
4308
4423
  {
4309
4424
  begin: /[a-z-]+(?=:)/,
4310
4425
  className: "attribute"
4311
4426
  },
4312
- ...s,
4427
+ ...o,
4313
4428
  n.CSS_NUMBER_MODE
4314
4429
  ]
4315
4430
  }
@@ -4317,13 +4432,13 @@ function sr(e) {
4317
4432
  },
4318
4433
  {
4319
4434
  className: "selector-tag",
4320
- begin: "\\b(" + er.join("|") + ")\\b"
4435
+ begin: "\\b(" + or.join("|") + ")\\b"
4321
4436
  }
4322
4437
  ]
4323
4438
  };
4324
4439
  }
4325
- function Me(e) {
4326
- const t = e.regex, n = t.concat(/[\p{L}_]/u, t.optional(/[\p{L}0-9_.-]*:/u), /[\p{L}0-9_.-]*/u), r = /[\p{L}0-9._:-]+/u, a = {
4440
+ function Re(e) {
4441
+ const t = e.regex, n = t.concat(/[\p{L}_]/u, t.optional(/[\p{L}0-9_.-]*:/u), /[\p{L}0-9_.-]*/u), r = /[\p{L}0-9._:-]+/u, i = {
4327
4442
  className: "symbol",
4328
4443
  begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/
4329
4444
  }, c = {
@@ -4335,10 +4450,10 @@ function Me(e) {
4335
4450
  illegal: /\n/
4336
4451
  }
4337
4452
  ]
4338
- }, i = e.inherit(c, {
4453
+ }, s = e.inherit(c, {
4339
4454
  begin: /\(/,
4340
4455
  end: /\)/
4341
- }), s = e.inherit(e.APOS_STRING_MODE, { className: "string" }), o = e.inherit(e.QUOTE_STRING_MODE, { className: "string" }), l = {
4456
+ }), o = e.inherit(e.APOS_STRING_MODE, { className: "string" }), a = e.inherit(e.QUOTE_STRING_MODE, { className: "string" }), l = {
4342
4457
  endsWithParent: !0,
4343
4458
  illegal: /</,
4344
4459
  relevance: 0,
@@ -4359,12 +4474,12 @@ function Me(e) {
4359
4474
  {
4360
4475
  begin: /"/,
4361
4476
  end: /"/,
4362
- contains: [a]
4477
+ contains: [i]
4363
4478
  },
4364
4479
  {
4365
4480
  begin: /'/,
4366
4481
  end: /'/,
4367
- contains: [a]
4482
+ contains: [i]
4368
4483
  },
4369
4484
  { begin: /[^\s"'=<>`]+/ }
4370
4485
  ]
@@ -4397,9 +4512,9 @@ function Me(e) {
4397
4512
  relevance: 10,
4398
4513
  contains: [
4399
4514
  c,
4515
+ a,
4400
4516
  o,
4401
4517
  s,
4402
- i,
4403
4518
  {
4404
4519
  begin: /\[/,
4405
4520
  end: /\]/,
@@ -4410,9 +4525,9 @@ function Me(e) {
4410
4525
  end: />/,
4411
4526
  contains: [
4412
4527
  c,
4413
- i,
4414
- o,
4415
- s
4528
+ s,
4529
+ a,
4530
+ o
4416
4531
  ]
4417
4532
  }
4418
4533
  ]
@@ -4429,7 +4544,7 @@ function Me(e) {
4429
4544
  end: /\]\]>/,
4430
4545
  relevance: 10
4431
4546
  },
4432
- a,
4547
+ i,
4433
4548
  // xml processing instructions
4434
4549
  {
4435
4550
  className: "meta",
@@ -4439,7 +4554,7 @@ function Me(e) {
4439
4554
  begin: /<\?xml/,
4440
4555
  relevance: 10,
4441
4556
  contains: [
4442
- o
4557
+ a
4443
4558
  ]
4444
4559
  },
4445
4560
  {
@@ -4531,7 +4646,7 @@ function Me(e) {
4531
4646
  ]
4532
4647
  };
4533
4648
  }
4534
- function ar(e) {
4649
+ function pr(e) {
4535
4650
  const t = e.regex, n = e.COMMENT("--", "$"), r = {
4536
4651
  scope: "string",
4537
4652
  variants: [
@@ -4541,7 +4656,7 @@ function ar(e) {
4541
4656
  contains: [{ match: /''/ }]
4542
4657
  }
4543
4658
  ]
4544
- }, a = {
4659
+ }, i = {
4545
4660
  begin: /"/,
4546
4661
  end: /"/,
4547
4662
  contains: [{ match: /""/ }]
@@ -4551,12 +4666,12 @@ function ar(e) {
4551
4666
  // Not sure it's correct to call NULL literal, and clauses like IS [NOT] NULL look strange that way.
4552
4667
  // "null",
4553
4668
  "unknown"
4554
- ], i = [
4669
+ ], s = [
4555
4670
  "double precision",
4556
4671
  "large object",
4557
4672
  "with timezone",
4558
4673
  "without timezone"
4559
- ], s = [
4674
+ ], o = [
4560
4675
  "bigint",
4561
4676
  "binary",
4562
4677
  "blob",
@@ -4585,7 +4700,7 @@ function ar(e) {
4585
4700
  "varying",
4586
4701
  // modifier (character varying)
4587
4702
  "varbinary"
4588
- ], o = [
4703
+ ], a = [
4589
4704
  "add",
4590
4705
  "asc",
4591
4706
  "collation",
@@ -5047,7 +5162,7 @@ function ar(e) {
5047
5162
  "var_pop",
5048
5163
  "var_samp",
5049
5164
  "width_bucket"
5050
- ], f = [
5165
+ ], m = [
5051
5166
  "current_catalog",
5052
5167
  "current_date",
5053
5168
  "current_default_transform_group",
@@ -5082,37 +5197,37 @@ function ar(e) {
5082
5197
  "breadth first"
5083
5198
  ], _ = u, v = [
5084
5199
  ...l,
5085
- ...o
5086
- ].filter((O) => !u.includes(O)), N = {
5200
+ ...a
5201
+ ].filter((O) => !u.includes(O)), k = {
5087
5202
  scope: "variable",
5088
5203
  match: /@[a-z0-9][a-z0-9_]*/
5089
5204
  }, S = {
5090
5205
  scope: "operator",
5091
5206
  match: /[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,
5092
5207
  relevance: 0
5093
- }, M = {
5208
+ }, R = {
5094
5209
  match: t.concat(/\b/, t.either(..._), /\s*\(/),
5095
5210
  relevance: 0,
5096
5211
  keywords: { built_in: _ }
5097
5212
  };
5098
- function L(O) {
5213
+ function D(O) {
5099
5214
  return t.concat(
5100
5215
  /\b/,
5101
5216
  t.either(...O.map((x) => x.replace(/\s+/, "\\s+"))),
5102
5217
  /\b/
5103
5218
  );
5104
5219
  }
5105
- const $ = {
5220
+ const U = {
5106
5221
  scope: "keyword",
5107
- match: L(b),
5222
+ match: D(b),
5108
5223
  relevance: 0
5109
5224
  };
5110
- function R(O, {
5225
+ function C(O, {
5111
5226
  exceptions: x,
5112
- when: B
5227
+ when: P
5113
5228
  } = {}) {
5114
- const P = B;
5115
- return x = x || [], O.map((F) => F.match(/\|\d+$/) || x.includes(F) ? F : P(F) ? `${F}|0` : F);
5229
+ const $ = P;
5230
+ return x = x || [], O.map((F) => F.match(/\|\d+$/) || x.includes(F) ? F : $(F) ? `${F}|0` : F);
5116
5231
  }
5117
5232
  return {
5118
5233
  name: "SQL",
@@ -5121,21 +5236,21 @@ function ar(e) {
5121
5236
  illegal: /[{}]|<\//,
5122
5237
  keywords: {
5123
5238
  $pattern: /\b[\w\.]+/,
5124
- keyword: R(v, { when: (O) => O.length < 3 }),
5239
+ keyword: C(v, { when: (O) => O.length < 3 }),
5125
5240
  literal: c,
5126
- type: s,
5127
- built_in: f
5241
+ type: o,
5242
+ built_in: m
5128
5243
  },
5129
5244
  contains: [
5130
5245
  {
5131
5246
  scope: "type",
5132
- match: L(i)
5247
+ match: D(s)
5133
5248
  },
5134
- $,
5135
- M,
5136
- N,
5249
+ U,
5250
+ R,
5251
+ k,
5137
5252
  r,
5138
- a,
5253
+ i,
5139
5254
  e.C_NUMBER_MODE,
5140
5255
  e.C_BLOCK_COMMENT_MODE,
5141
5256
  n,
@@ -5143,7 +5258,7 @@ function ar(e) {
5143
5258
  ]
5144
5259
  };
5145
5260
  }
5146
- function _t(e) {
5261
+ function St(e) {
5147
5262
  const t = "true false yes no null", n = "[\\w#;/?:@&=+$,.~*'()[\\]]+", r = {
5148
5263
  className: "attr",
5149
5264
  variants: [
@@ -5158,7 +5273,7 @@ function _t(e) {
5158
5273
  begin: /'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/
5159
5274
  }
5160
5275
  ]
5161
- }, a = {
5276
+ }, i = {
5162
5277
  className: "template-variable",
5163
5278
  variants: [
5164
5279
  {
@@ -5184,7 +5299,7 @@ function _t(e) {
5184
5299
  relevance: 0
5185
5300
  }
5186
5301
  ]
5187
- }, i = {
5302
+ }, s = {
5188
5303
  className: "string",
5189
5304
  relevance: 0,
5190
5305
  variants: [
@@ -5196,9 +5311,9 @@ function _t(e) {
5196
5311
  ],
5197
5312
  contains: [
5198
5313
  e.BACKSLASH_ESCAPE,
5199
- a
5314
+ i
5200
5315
  ]
5201
- }, s = e.inherit(i, { variants: [
5316
+ }, o = e.inherit(s, { variants: [
5202
5317
  {
5203
5318
  begin: /'/,
5204
5319
  end: /'/,
@@ -5229,7 +5344,7 @@ function _t(e) {
5229
5344
  contains: [_],
5230
5345
  illegal: "\\n",
5231
5346
  relevance: 0
5232
- }, N = {
5347
+ }, k = {
5233
5348
  begin: "\\[",
5234
5349
  end: "\\]",
5235
5350
  contains: [_],
@@ -5312,24 +5427,24 @@ function _t(e) {
5312
5427
  relevance: 0
5313
5428
  },
5314
5429
  v,
5315
- N,
5430
+ k,
5316
5431
  c,
5317
- i
5318
- ], M = [...S];
5319
- return M.pop(), M.push(s), _.contains = M, {
5432
+ s
5433
+ ], R = [...S];
5434
+ return R.pop(), R.push(o), _.contains = R, {
5320
5435
  name: "YAML",
5321
5436
  case_insensitive: !0,
5322
5437
  aliases: ["yml"],
5323
5438
  contains: S
5324
5439
  };
5325
5440
  }
5326
- function Et(e) {
5441
+ function Tt(e) {
5327
5442
  const t = e.regex, n = {
5328
5443
  begin: /<\/?[A-Za-z_]/,
5329
5444
  end: ">",
5330
5445
  subLanguage: "xml",
5331
5446
  relevance: 0
5332
- }, r = { match: /^ {0,3}([-*_])[ \t]*(?:\1[ \t]*){2,}$/ }, a = {
5447
+ }, r = { match: /^ {0,3}([-*_])[ \t]*(?:\1[ \t]*){2,}$/ }, i = {
5333
5448
  className: "code",
5334
5449
  variants: [
5335
5450
  // TODO: fix to allow these to work with sublanguage also
@@ -5363,7 +5478,7 @@ function Et(e) {
5363
5478
  begin: "^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",
5364
5479
  end: "\\s+",
5365
5480
  excludeEnd: !0
5366
- }, i = {
5481
+ }, s = {
5367
5482
  begin: /^\[[^\n]+\]:/,
5368
5483
  returnBegin: !0,
5369
5484
  contains: [
@@ -5381,7 +5496,7 @@ function Et(e) {
5381
5496
  excludeBegin: !0
5382
5497
  }
5383
5498
  ]
5384
- }, s = /[A-Za-z][A-Za-z0-9+.-]*/, o = {
5499
+ }, o = /[A-Za-z][A-Za-z0-9+.-]*/, a = {
5385
5500
  variants: [
5386
5501
  // too much like nested array access in so many languages
5387
5502
  // to have any real relevance
@@ -5395,7 +5510,7 @@ function Et(e) {
5395
5510
  relevance: 2
5396
5511
  },
5397
5512
  {
5398
- begin: t.concat(/\[.+?\]\(/, s, /:\/\/.*?\)/),
5513
+ begin: t.concat(/\[.+?\]\(/, o, /:\/\/.*?\)/),
5399
5514
  relevance: 2
5400
5515
  },
5401
5516
  // relative urls
@@ -5469,19 +5584,19 @@ function Et(e) {
5469
5584
  relevance: 0
5470
5585
  }
5471
5586
  ]
5472
- }, f = e.inherit(l, { contains: [] }), b = e.inherit(u, { contains: [] });
5473
- l.contains.push(b), u.contains.push(f);
5587
+ }, m = e.inherit(l, { contains: [] }), b = e.inherit(u, { contains: [] });
5588
+ l.contains.push(b), u.contains.push(m);
5474
5589
  let _ = [
5475
5590
  n,
5476
- o
5591
+ a
5477
5592
  ];
5478
5593
  return [
5479
5594
  l,
5480
5595
  u,
5481
- f,
5596
+ m,
5482
5597
  b
5483
- ].forEach((M) => {
5484
- M.contains = M.contains.concat(_);
5598
+ ].forEach((R) => {
5599
+ R.contains = R.contains.concat(_);
5485
5600
  }), _ = _.concat(l, u), {
5486
5601
  name: "Markdown",
5487
5602
  aliases: [
@@ -5524,9 +5639,9 @@ function Et(e) {
5524
5639
  contains: _,
5525
5640
  end: "$"
5526
5641
  },
5527
- a,
5528
- o,
5529
5642
  i,
5643
+ a,
5644
+ s,
5530
5645
  {
5531
5646
  //https://spec.commonmark.org/0.31.2/#entity-references
5532
5647
  scope: "literal",
@@ -5535,7 +5650,7 @@ function Et(e) {
5535
5650
  ]
5536
5651
  };
5537
5652
  }
5538
- function or(e) {
5653
+ function gr(e) {
5539
5654
  const c = {
5540
5655
  keyword: [
5541
5656
  "break",
@@ -5688,17 +5803,17 @@ function or(e) {
5688
5803
  ]
5689
5804
  };
5690
5805
  }
5691
- function yt(e) {
5692
- const t = e.regex, n = /(r#)?/, r = t.concat(n, e.UNDERSCORE_IDENT_RE), a = t.concat(n, e.IDENT_RE), c = {
5806
+ function At(e) {
5807
+ const t = e.regex, n = /(r#)?/, r = t.concat(n, e.UNDERSCORE_IDENT_RE), i = t.concat(n, e.IDENT_RE), c = {
5693
5808
  scope: "title.function.invoke",
5694
5809
  relevance: 0,
5695
5810
  begin: t.concat(
5696
5811
  /\b/,
5697
5812
  /(?!(?:let|for|while|if|else|match)\b)/,
5698
- a,
5813
+ i,
5699
5814
  t.lookahead(/\s*\(/)
5700
5815
  )
5701
- }, i = "([ui](8|16|32|64|128|size)|f(16|32|64|128))?", s = [
5816
+ }, s = "([ui](8|16|32|64|128|size)|f(16|32|64|128))?", o = [
5702
5817
  "abstract",
5703
5818
  "as",
5704
5819
  "async",
@@ -5752,7 +5867,7 @@ function yt(e) {
5752
5867
  "where",
5753
5868
  "while",
5754
5869
  "yield"
5755
- ], o = [
5870
+ ], a = [
5756
5871
  "true",
5757
5872
  "false",
5758
5873
  "Some",
@@ -5858,8 +5973,8 @@ function yt(e) {
5858
5973
  keywords: {
5859
5974
  $pattern: e.IDENT_RE + "!?",
5860
5975
  type: u,
5861
- keyword: s,
5862
- literal: o,
5976
+ keyword: o,
5977
+ literal: a,
5863
5978
  built_in: l
5864
5979
  },
5865
5980
  illegal: "</",
@@ -5894,10 +6009,10 @@ function yt(e) {
5894
6009
  {
5895
6010
  scope: "number",
5896
6011
  variants: [
5897
- { begin: "\\b0b([01_]+)" + i },
5898
- { begin: "\\b0o([0-7_]+)" + i },
5899
- { begin: "\\b0x([A-Fa-f0-9_]+)" + i },
5900
- { begin: "\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)" + i }
6012
+ { begin: "\\b0b([01_]+)" + s },
6013
+ { begin: "\\b0o([0-7_]+)" + s },
6014
+ { begin: "\\b0x([A-Fa-f0-9_]+)" + s },
6015
+ { begin: "\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)" + s }
5901
6016
  ],
5902
6017
  relevance: 0
5903
6018
  },
@@ -6004,22 +6119,22 @@ function yt(e) {
6004
6119
  ]
6005
6120
  };
6006
6121
  }
6007
- var re = "[0-9](_*[0-9])*", he = `\\.(${re})`, me = "[0-9a-fA-F](_*[0-9a-fA-F])*", Ye = {
6122
+ var re = "[0-9](_*[0-9])*", me = `\\.(${re})`, be = "[0-9a-fA-F](_*[0-9a-fA-F])*", Ve = {
6008
6123
  className: "number",
6009
6124
  variants: [
6010
6125
  // DecimalFloatingPointLiteral
6011
6126
  // including ExponentPart
6012
- { begin: `(\\b(${re})((${he})|\\.)?|(${he}))[eE][+-]?(${re})[fFdD]?\\b` },
6127
+ { begin: `(\\b(${re})((${me})|\\.)?|(${me}))[eE][+-]?(${re})[fFdD]?\\b` },
6013
6128
  // excluding ExponentPart
6014
- { begin: `\\b(${re})((${he})[fFdD]?\\b|\\.([fFdD]\\b)?)` },
6015
- { begin: `(${he})[fFdD]?\\b` },
6129
+ { begin: `\\b(${re})((${me})[fFdD]?\\b|\\.([fFdD]\\b)?)` },
6130
+ { begin: `(${me})[fFdD]?\\b` },
6016
6131
  { begin: `\\b(${re})[fFdD]\\b` },
6017
6132
  // HexadecimalFloatingPointLiteral
6018
- { begin: `\\b0[xX]((${me})\\.?|(${me})?\\.(${me}))[pP][+-]?(${re})[fFdD]?\\b` },
6133
+ { begin: `\\b0[xX]((${be})\\.?|(${be})?\\.(${be}))[pP][+-]?(${re})[fFdD]?\\b` },
6019
6134
  // DecimalIntegerLiteral
6020
6135
  { begin: "\\b(0|[1-9](_*[0-9])*)[lL]?\\b" },
6021
6136
  // HexIntegerLiteral
6022
- { begin: `\\b0[xX](${me})[lL]?\\b` },
6137
+ { begin: `\\b0[xX](${be})[lL]?\\b` },
6023
6138
  // OctalIntegerLiteral
6024
6139
  { begin: "\\b0(_*[0-7])*[lL]?\\b" },
6025
6140
  // BinaryIntegerLiteral
@@ -6027,12 +6142,12 @@ var re = "[0-9](_*[0-9])*", he = `\\.(${re})`, me = "[0-9a-fA-F](_*[0-9a-fA-F])*
6027
6142
  ],
6028
6143
  relevance: 0
6029
6144
  };
6030
- function wt(e, t, n) {
6031
- return n === -1 ? "" : e.replace(t, (r) => wt(e, t, n - 1));
6145
+ function Ct(e, t, n) {
6146
+ return n === -1 ? "" : e.replace(t, (r) => Ct(e, t, n - 1));
6032
6147
  }
6033
- function cr(e) {
6034
- const t = e.regex, n = "[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*", r = "(?:(?:\\s*\\[\\s*])+)?", a = n + "<@@@>" + r, i = "(?:" + ("\\?(?:\\s+(?:extends|super)\\s+" + a + ")?") + "|" + a + ")", s = wt(
6035
- "(?:\\s*<\\s*" + i + "(?:\\s*,\\s*" + i + ")*\\s*>)?",
6148
+ function hr(e) {
6149
+ const t = e.regex, n = "[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*", r = "(?:(?:\\s*\\[\\s*])+)?", i = n + "<@@@>" + r, s = "(?:" + ("\\?(?:\\s+(?:extends|super)\\s+" + i + ")?") + "|" + i + ")", o = Ct(
6150
+ "(?:\\s*<\\s*" + s + "(?:\\s*,\\s*" + s + ")*\\s*>)?",
6036
6151
  /<@@@>/g,
6037
6152
  2
6038
6153
  ), b = {
@@ -6186,7 +6301,7 @@ function cr(e) {
6186
6301
  {
6187
6302
  begin: [
6188
6303
  n,
6189
- t.concat(s, r, /\s+/),
6304
+ t.concat(o, r, /\s+/),
6190
6305
  n,
6191
6306
  r,
6192
6307
  /\s*/,
@@ -6217,7 +6332,7 @@ function cr(e) {
6217
6332
  {
6218
6333
  begin: [
6219
6334
  n,
6220
- t.concat(s, r, /\s+/),
6335
+ t.concat(o, r, /\s+/),
6221
6336
  n,
6222
6337
  /\s*(?=\()/
6223
6338
  ],
@@ -6237,7 +6352,7 @@ function cr(e) {
6237
6352
  _,
6238
6353
  e.APOS_STRING_MODE,
6239
6354
  e.QUOTE_STRING_MODE,
6240
- Ye,
6355
+ Ve,
6241
6356
  e.C_BLOCK_COMMENT_MODE
6242
6357
  ]
6243
6358
  },
@@ -6245,13 +6360,13 @@ function cr(e) {
6245
6360
  e.C_BLOCK_COMMENT_MODE
6246
6361
  ]
6247
6362
  },
6248
- Ye,
6363
+ Ve,
6249
6364
  _
6250
6365
  ]
6251
6366
  };
6252
6367
  }
6253
- function lr(e) {
6254
- const t = e.regex, n = e.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] }), r = "decltype\\(auto\\)", a = "[a-zA-Z_]\\w*::", i = "(" + r + "|" + t.optional(a) + "[a-zA-Z_]\\w*" + t.optional("<[^<>]+>") + ")", s = t.concat(/\batomic_/, t.either(
6368
+ function fr(e) {
6369
+ const t = e.regex, n = e.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] }), r = "decltype\\(auto\\)", i = "[a-zA-Z_]\\w*::", s = "(" + r + "|" + t.optional(i) + "[a-zA-Z_]\\w*" + t.optional("<[^<>]+>") + ")", o = t.concat(/\batomic_/, t.either(
6255
6370
  "bool",
6256
6371
  "char",
6257
6372
  "schar",
@@ -6289,11 +6404,11 @@ function lr(e) {
6289
6404
  "ptrdiff_t",
6290
6405
  "intmax_t",
6291
6406
  "uintmax_t"
6292
- ), /\b/), o = {
6407
+ ), /\b/), a = {
6293
6408
  className: "type",
6294
6409
  variants: [
6295
6410
  { begin: "\\b[a-z\\d_]*_t\\b" },
6296
- { match: s }
6411
+ { match: o }
6297
6412
  ]
6298
6413
  }, u = {
6299
6414
  className: "string",
@@ -6318,7 +6433,7 @@ function lr(e) {
6318
6433
  end: /\)([^()\\\s"]{0,16})"/
6319
6434
  })
6320
6435
  ]
6321
- }, f = {
6436
+ }, m = {
6322
6437
  className: "number",
6323
6438
  variants: [
6324
6439
  { match: /\b(0b[01']+)/ },
@@ -6362,11 +6477,11 @@ function lr(e) {
6362
6477
  }, v = [
6363
6478
  b,
6364
6479
  _
6365
- ], N = {
6480
+ ], k = {
6366
6481
  className: "title",
6367
- begin: t.optional(a) + e.IDENT_RE,
6482
+ begin: t.optional(i) + e.IDENT_RE,
6368
6483
  relevance: 0
6369
- }, S = t.optional(a) + e.IDENT_RE + "\\s*\\(", M = 12, R = {
6484
+ }, S = t.optional(i) + e.IDENT_RE + "\\s*\\(", R = 12, C = {
6370
6485
  keyword: [
6371
6486
  "asm",
6372
6487
  "auto",
@@ -6452,10 +6567,10 @@ function lr(e) {
6452
6567
  built_in: "std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"
6453
6568
  }, O = [
6454
6569
  ...v,
6455
- o,
6570
+ a,
6456
6571
  n,
6457
6572
  e.C_BLOCK_COMMENT_MODE,
6458
- f,
6573
+ m,
6459
6574
  u
6460
6575
  ], x = {
6461
6576
  // This mode covers expression context where we can't expect a function
@@ -6475,35 +6590,35 @@ function lr(e) {
6475
6590
  end: /;/
6476
6591
  }
6477
6592
  ],
6478
- keywords: R,
6593
+ keywords: C,
6479
6594
  contains: O.concat([
6480
6595
  {
6481
6596
  begin: /\(/,
6482
6597
  end: /\)/,
6483
- keywords: R,
6598
+ keywords: C,
6484
6599
  contains: O.concat(["self"]),
6485
6600
  relevance: 0
6486
6601
  }
6487
6602
  ]),
6488
6603
  relevance: 0
6489
- }, B = {
6490
- begin: "(" + i + "[\\*&\\s]+){1," + M + "}" + S,
6604
+ }, P = {
6605
+ begin: "(" + s + "[\\*&\\s]+){1," + R + "}" + S,
6491
6606
  returnBegin: !0,
6492
6607
  end: /[{;=]/,
6493
6608
  excludeEnd: !0,
6494
- keywords: R,
6609
+ keywords: C,
6495
6610
  illegal: /[^\w\s\*&:<>.]/,
6496
6611
  contains: [
6497
6612
  {
6498
6613
  // to prevent it from being confused as the function title
6499
6614
  begin: r,
6500
- keywords: R,
6615
+ keywords: C,
6501
6616
  relevance: 0
6502
6617
  },
6503
6618
  {
6504
6619
  begin: S,
6505
6620
  returnBegin: !0,
6506
- contains: [e.inherit(N, { className: "title.function" })],
6621
+ contains: [e.inherit(k, { className: "title.function" })],
6507
6622
  relevance: 0
6508
6623
  },
6509
6624
  // allow for multiple declarations, e.g.:
@@ -6516,32 +6631,32 @@ function lr(e) {
6516
6631
  className: "params",
6517
6632
  begin: /\(/,
6518
6633
  end: /\)/,
6519
- keywords: R,
6634
+ keywords: C,
6520
6635
  relevance: 0,
6521
6636
  contains: [
6522
6637
  n,
6523
6638
  e.C_BLOCK_COMMENT_MODE,
6524
6639
  u,
6525
- f,
6526
- o,
6640
+ m,
6641
+ a,
6527
6642
  // Count matching parentheses.
6528
6643
  {
6529
6644
  begin: /\(/,
6530
6645
  end: /\)/,
6531
- keywords: R,
6646
+ keywords: C,
6532
6647
  relevance: 0,
6533
6648
  contains: [
6534
6649
  "self",
6535
6650
  n,
6536
6651
  e.C_BLOCK_COMMENT_MODE,
6537
6652
  u,
6538
- f,
6539
- o
6653
+ m,
6654
+ a
6540
6655
  ]
6541
6656
  }
6542
6657
  ]
6543
6658
  },
6544
- o,
6659
+ a,
6545
6660
  n,
6546
6661
  e.C_BLOCK_COMMENT_MODE,
6547
6662
  ...v
@@ -6550,20 +6665,20 @@ function lr(e) {
6550
6665
  return {
6551
6666
  name: "C",
6552
6667
  aliases: ["h"],
6553
- keywords: R,
6668
+ keywords: C,
6554
6669
  // Until differentiations are added between `c` and `cpp`, `c` will
6555
6670
  // not be auto-detected to avoid auto-detect conflicts between C and C++
6556
6671
  disableAutodetect: !0,
6557
6672
  illegal: "</",
6558
6673
  contains: [].concat(
6559
6674
  x,
6560
- B,
6675
+ P,
6561
6676
  O,
6562
6677
  [
6563
6678
  ...v,
6564
6679
  {
6565
6680
  begin: e.IDENT_RE + "::",
6566
- keywords: R
6681
+ keywords: C
6567
6682
  },
6568
6683
  {
6569
6684
  className: "class",
@@ -6579,12 +6694,12 @@ function lr(e) {
6579
6694
  exports: {
6580
6695
  preprocessor: _,
6581
6696
  strings: u,
6582
- keywords: R
6697
+ keywords: C
6583
6698
  }
6584
6699
  };
6585
6700
  }
6586
- function vt(e) {
6587
- const t = e.regex, n = e.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] }), r = "decltype\\(auto\\)", a = "[a-zA-Z_]\\w*::", i = "(?!struct)(" + r + "|" + t.optional(a) + "[a-zA-Z_]\\w*" + t.optional("<[^<>]+>") + ")", s = {
6701
+ function Mt(e) {
6702
+ const t = e.regex, n = e.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] }), r = "decltype\\(auto\\)", i = "[a-zA-Z_]\\w*::", s = "(?!struct)(" + r + "|" + t.optional(i) + "[a-zA-Z_]\\w*" + t.optional("<[^<>]+>") + ")", o = {
6588
6703
  className: "type",
6589
6704
  begin: "\\b[a-z\\d_]*_t\\b"
6590
6705
  }, l = {
@@ -6625,7 +6740,7 @@ function vt(e) {
6625
6740
  }
6626
6741
  ],
6627
6742
  relevance: 0
6628
- }, f = {
6743
+ }, m = {
6629
6744
  scope: "meta",
6630
6745
  begin: /#\s*include\b/,
6631
6746
  end: /$/,
@@ -6658,13 +6773,13 @@ function vt(e) {
6658
6773
  e.C_BLOCK_COMMENT_MODE
6659
6774
  ]
6660
6775
  }, _ = [
6661
- f,
6776
+ m,
6662
6777
  b
6663
6778
  ], v = {
6664
6779
  className: "title",
6665
- begin: t.optional(a) + e.IDENT_RE,
6780
+ begin: t.optional(i) + e.IDENT_RE,
6666
6781
  relevance: 0
6667
- }, N = t.optional(a) + e.IDENT_RE + "\\s*\\(", S = 12, M = [
6782
+ }, k = t.optional(i) + e.IDENT_RE + "\\s*\\(", S = 12, R = [
6668
6783
  "alignas",
6669
6784
  "alignof",
6670
6785
  "and",
@@ -6752,7 +6867,7 @@ function vt(e) {
6752
6867
  "while",
6753
6868
  "xor",
6754
6869
  "xor_eq"
6755
- ], L = [
6870
+ ], D = [
6756
6871
  "bool",
6757
6872
  "char",
6758
6873
  "char16_t",
@@ -6769,7 +6884,7 @@ function vt(e) {
6769
6884
  "signed",
6770
6885
  "const",
6771
6886
  "static"
6772
- ], $ = [
6887
+ ], U = [
6773
6888
  "any",
6774
6889
  "auto_ptr",
6775
6890
  "barrier",
@@ -6827,7 +6942,7 @@ function vt(e) {
6827
6942
  "weak_ptr",
6828
6943
  "wstring",
6829
6944
  "wstring_view"
6830
- ], R = [
6945
+ ], C = [
6831
6946
  "abort",
6832
6947
  "abs",
6833
6948
  "acos",
@@ -6928,9 +7043,9 @@ function vt(e) {
6928
7043
  "visit",
6929
7044
  "vprintf",
6930
7045
  "vsprintf"
6931
- ], B = {
6932
- type: L,
6933
- keyword: M,
7046
+ ], P = {
7047
+ type: D,
7048
+ keyword: R,
6934
7049
  literal: [
6935
7050
  "NULL",
6936
7051
  "false",
@@ -6939,29 +7054,29 @@ function vt(e) {
6939
7054
  "true"
6940
7055
  ],
6941
7056
  built_in: ["_Pragma"],
6942
- _type_hints: $
6943
- }, P = {
7057
+ _type_hints: U
7058
+ }, $ = {
6944
7059
  className: "function.dispatch",
6945
7060
  relevance: 0,
6946
7061
  keywords: {
6947
7062
  // Only for relevance, not highlighting.
6948
- _hint: R
7063
+ _hint: C
6949
7064
  },
6950
7065
  begin: t.concat(
6951
7066
  /\b/,
6952
- `(?!${M.join("|")})`,
7067
+ `(?!${R.join("|")})`,
6953
7068
  e.IDENT_RE,
6954
7069
  t.lookahead(/(<[^<>]+>|)\s*\(/)
6955
7070
  )
6956
7071
  }, F = [
6957
- P,
7072
+ $,
6958
7073
  ..._,
6959
- s,
7074
+ o,
6960
7075
  n,
6961
7076
  e.C_BLOCK_COMMENT_MODE,
6962
7077
  u,
6963
7078
  l
6964
- ], X = {
7079
+ ], V = {
6965
7080
  // This mode covers expression context where we can't expect a function
6966
7081
  // definition and shouldn't highlight anything that looks like one:
6967
7082
  // `return some()`, `else if()`, `(x*sum(1, 2))`
@@ -6979,12 +7094,12 @@ function vt(e) {
6979
7094
  end: /;/
6980
7095
  }
6981
7096
  ],
6982
- keywords: B,
7097
+ keywords: P,
6983
7098
  contains: F.concat([
6984
7099
  {
6985
7100
  begin: /\(/,
6986
7101
  end: /\)/,
6987
- keywords: B,
7102
+ keywords: P,
6988
7103
  contains: F.concat(["self"]),
6989
7104
  relevance: 0
6990
7105
  }
@@ -6992,21 +7107,21 @@ function vt(e) {
6992
7107
  relevance: 0
6993
7108
  }, J = {
6994
7109
  className: "function",
6995
- begin: "(" + i + "[\\*&\\s]+){1," + S + "}" + N,
7110
+ begin: "(" + s + "[\\*&\\s]+){1," + S + "}" + k,
6996
7111
  returnBegin: !0,
6997
7112
  end: /[{;=]/,
6998
7113
  excludeEnd: !0,
6999
- keywords: B,
7114
+ keywords: P,
7000
7115
  illegal: /[^\w\s\*&:<>.]/,
7001
7116
  contains: [
7002
7117
  {
7003
7118
  // to prevent it from being confused as the function title
7004
7119
  begin: r,
7005
- keywords: B,
7120
+ keywords: P,
7006
7121
  relevance: 0
7007
7122
  },
7008
7123
  {
7009
- begin: N,
7124
+ begin: k,
7010
7125
  returnBegin: !0,
7011
7126
  contains: [v],
7012
7127
  relevance: 0
@@ -7036,19 +7151,19 @@ function vt(e) {
7036
7151
  className: "params",
7037
7152
  begin: /\(/,
7038
7153
  end: /\)/,
7039
- keywords: B,
7154
+ keywords: P,
7040
7155
  relevance: 0,
7041
7156
  contains: [
7042
7157
  n,
7043
7158
  e.C_BLOCK_COMMENT_MODE,
7044
7159
  l,
7045
7160
  u,
7046
- s,
7161
+ o,
7047
7162
  // Count matching parentheses.
7048
7163
  {
7049
7164
  begin: /\(/,
7050
7165
  end: /\)/,
7051
- keywords: B,
7166
+ keywords: P,
7052
7167
  relevance: 0,
7053
7168
  contains: [
7054
7169
  "self",
@@ -7056,12 +7171,12 @@ function vt(e) {
7056
7171
  e.C_BLOCK_COMMENT_MODE,
7057
7172
  l,
7058
7173
  u,
7059
- s
7174
+ o
7060
7175
  ]
7061
7176
  }
7062
7177
  ]
7063
7178
  },
7064
- s,
7179
+ o,
7065
7180
  n,
7066
7181
  e.C_BLOCK_COMMENT_MODE,
7067
7182
  ..._
@@ -7078,13 +7193,13 @@ function vt(e) {
7078
7193
  "hxx",
7079
7194
  "cxx"
7080
7195
  ],
7081
- keywords: B,
7196
+ keywords: P,
7082
7197
  illegal: "</",
7083
7198
  classNameAliases: { "function.dispatch": "built_in" },
7084
7199
  contains: [].concat(
7085
- X,
7200
+ V,
7086
7201
  J,
7087
- P,
7202
+ $,
7088
7203
  F,
7089
7204
  [
7090
7205
  ..._,
@@ -7092,15 +7207,15 @@ function vt(e) {
7092
7207
  // containers: ie, `vector <int> rooms (9);`
7093
7208
  begin: "\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",
7094
7209
  end: ">",
7095
- keywords: B,
7210
+ keywords: P,
7096
7211
  contains: [
7097
7212
  "self",
7098
- s
7213
+ o
7099
7214
  ]
7100
7215
  },
7101
7216
  {
7102
7217
  begin: e.IDENT_RE + "::",
7103
- keywords: B
7218
+ keywords: P
7104
7219
  },
7105
7220
  {
7106
7221
  match: [
@@ -7118,63 +7233,63 @@ function vt(e) {
7118
7233
  )
7119
7234
  };
7120
7235
  }
7121
- k.registerLanguage("javascript", ct);
7122
- k.registerLanguage("js", ct);
7123
- k.registerLanguage("typescript", bt);
7124
- k.registerLanguage("ts", bt);
7125
- k.registerLanguage("python", ft);
7126
- k.registerLanguage("py", ft);
7127
- k.registerLanguage("json", Vn);
7128
- k.registerLanguage("bash", Ce);
7129
- k.registerLanguage("sh", Ce);
7130
- k.registerLanguage("shell", Ce);
7131
- k.registerLanguage("css", sr);
7132
- k.registerLanguage("xml", Me);
7133
- k.registerLanguage("html", Me);
7134
- k.registerLanguage("svg", Me);
7135
- k.registerLanguage("sql", ar);
7136
- k.registerLanguage("yaml", _t);
7137
- k.registerLanguage("yml", _t);
7138
- k.registerLanguage("markdown", Et);
7139
- k.registerLanguage("md", Et);
7140
- k.registerLanguage("go", or);
7141
- k.registerLanguage("rust", yt);
7142
- k.registerLanguage("rs", yt);
7143
- k.registerLanguage("java", cr);
7144
- k.registerLanguage("c", lr);
7145
- k.registerLanguage("cpp", vt);
7146
- k.registerLanguage("c++", vt);
7147
- const dr = /* @__PURE__ */ new Set(["mindmap"]);
7236
+ T.registerLanguage("javascript", ft);
7237
+ T.registerLanguage("js", ft);
7238
+ T.registerLanguage("typescript", kt);
7239
+ T.registerLanguage("ts", kt);
7240
+ T.registerLanguage("python", Nt);
7241
+ T.registerLanguage("py", Nt);
7242
+ T.registerLanguage("json", nr);
7243
+ T.registerLanguage("bash", Me);
7244
+ T.registerLanguage("sh", Me);
7245
+ T.registerLanguage("shell", Me);
7246
+ T.registerLanguage("css", ur);
7247
+ T.registerLanguage("xml", Re);
7248
+ T.registerLanguage("html", Re);
7249
+ T.registerLanguage("svg", Re);
7250
+ T.registerLanguage("sql", pr);
7251
+ T.registerLanguage("yaml", St);
7252
+ T.registerLanguage("yml", St);
7253
+ T.registerLanguage("markdown", Tt);
7254
+ T.registerLanguage("md", Tt);
7255
+ T.registerLanguage("go", gr);
7256
+ T.registerLanguage("rust", At);
7257
+ T.registerLanguage("rs", At);
7258
+ T.registerLanguage("java", hr);
7259
+ T.registerLanguage("c", fr);
7260
+ T.registerLanguage("cpp", Mt);
7261
+ T.registerLanguage("c++", Mt);
7262
+ const mr = /* @__PURE__ */ new Set(["mindmap"]);
7148
7263
  function ce(e) {
7149
7264
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
7150
7265
  }
7151
- function ur(e, t = {}) {
7152
- const n = new Set(t.reservedLanguages ?? dr), r = e.renderer.rules.fence ? e.renderer.rules.fence.bind(e.renderer.rules) : (a, c, i, s, o) => o.renderToken(a, c, i);
7153
- e.renderer.rules.fence = (a, c, i, s, o) => {
7154
- var N;
7155
- const l = a[c];
7156
- if (!l) return r(a, c, i, s, o);
7157
- const f = ((N = l.info.trim().split(/\s+/)[0]) == null ? void 0 : N.toLowerCase()) ?? "";
7158
- if (n.has(f))
7159
- return r(a, c, i, s, o);
7266
+ function br(e, t = {}) {
7267
+ const n = new Set(t.reservedLanguages ?? mr), r = e.renderer.rules.fence ? e.renderer.rules.fence.bind(e.renderer.rules) : (i, c, s, o, a) => a.renderToken(i, c, s);
7268
+ e.renderer.rules.fence = (i, c, s, o, a) => {
7269
+ var k;
7270
+ const l = i[c];
7271
+ if (!l) return r(i, c, s, o, a);
7272
+ const m = ((k = l.info.trim().split(/\s+/)[0]) == null ? void 0 : k.toLowerCase()) ?? "";
7273
+ if (n.has(m))
7274
+ return r(i, c, s, o, a);
7160
7275
  const b = l.content;
7161
- let _, v = f || "text";
7162
- if (f && k.getLanguage(f))
7276
+ let _, v = m || "text";
7277
+ if (m && T.getLanguage(m))
7163
7278
  try {
7164
- _ = k.highlight(b, { language: f, ignoreIllegals: !0 }).value;
7279
+ _ = T.highlight(b, { language: m, ignoreIllegals: !0 }).value;
7165
7280
  } catch {
7166
7281
  _ = ce(b);
7167
7282
  }
7168
- else if (f)
7283
+ else if (m)
7169
7284
  try {
7170
- const S = k.highlightAuto(b);
7171
- _ = S.value, v = S.language || f;
7285
+ const S = T.highlightAuto(b);
7286
+ _ = S.value, v = S.language || m;
7172
7287
  } catch {
7173
7288
  _ = ce(b);
7174
7289
  }
7175
7290
  else
7176
7291
  try {
7177
- const S = k.highlightAuto(b);
7292
+ const S = T.highlightAuto(b);
7178
7293
  _ = S.value, v = S.language || "text";
7179
7294
  } catch {
7180
7295
  _ = ce(b);
@@ -7182,56 +7297,100 @@ function ur(e, t = {}) {
7182
7297
  return `<div class="md-editor-codeblock"><div class="md-editor-codeblock-header"><span class="md-editor-codeblock-lights"><span class="md-editor-codeblock-dot md-editor-codeblock-dot--red"></span><span class="md-editor-codeblock-dot md-editor-codeblock-dot--yellow"></span><span class="md-editor-codeblock-dot md-editor-codeblock-dot--green"></span></span><span class="md-editor-codeblock-lang">${ce(v)}</span><button type="button" class="md-editor-codeblock-copy" aria-label="Copy code">Copy</button></div><pre class="md-editor-codeblock-pre"><code class="language-${ce(v)}">${_}</code></pre></div>`;
7183
7298
  };
7184
7299
  }
7185
- const gr = [".mp4", ".webm", ".ogg", ".mov", ".m4v", ".avi", ".mkv"], pr = [
7300
+ const _r = [".mp4", ".webm", ".ogg", ".mov", ".m4v", ".avi", ".mkv"], Er = [
7186
7301
  /(?:youtube\.com\/watch\?[^ ]*v=|youtu\.be\/|youtube\.com\/embed\/|youtube\.com\/shorts\/|youtube\.com\/v\/)([a-zA-Z0-9_-]{11})/,
7187
7302
  /^([a-zA-Z0-9_-]{11})$/
7188
7303
  ];
7189
- function hr(e) {
7304
+ function yr(e) {
7190
7305
  const t = e.trim();
7191
7306
  if (!t) return null;
7192
- for (const n of pr) {
7307
+ for (const n of Er) {
7193
7308
  const r = t.match(n);
7194
7309
  if (r && r[1]) return r[1];
7195
7310
  }
7196
7311
  return null;
7197
7312
  }
7198
- function mr(e, t = "YouTube video") {
7313
+ function wr(e, t = "YouTube video") {
7199
7314
  const n = `https://img.youtube.com/vi/${e}/hqdefault.jpg`, r = `https://www.youtube.com/watch?v=${e}`;
7200
7315
  return `[![${t}](${n})](${r})`;
7201
7316
  }
7202
- function br(e) {
7317
+ function vr(e) {
7203
7318
  const t = e.toLowerCase().split("?")[0] ?? "";
7204
- return gr.some((n) => t.endsWith(n));
7319
+ return _r.some((n) => t.endsWith(n));
7205
7320
  }
7206
- function fr(e, t = "image") {
7321
+ function Xe(e, t = "image") {
7207
7322
  return `![${t}](${e})`;
7208
7323
  }
7209
- function _r(e, t = "video") {
7324
+ function kr(e, t = "video") {
7210
7325
  return `![${t}](${e})`;
7211
7326
  }
7212
- function Er(e) {
7213
- const t = e.renderer.rules.image ? e.renderer.rules.image.bind(e.renderer.rules) : (n, r, a, c, i) => i.renderToken(n, r, a);
7214
- e.renderer.rules.image = (n, r, a, c, i) => {
7215
- const s = n[r];
7216
- if (!s) return t(n, r, a, c, i);
7217
- const o = s.attrGet("src") ?? "";
7218
- if (br(o)) {
7219
- const l = s.content || "";
7220
- return `<video src="${o}" controls class="md-editor-video" title="${l}">${l}</video>`;
7327
+ function Nr(e) {
7328
+ const t = e.renderer.rules.image ? e.renderer.rules.image.bind(e.renderer.rules) : (n, r, i, c, s) => s.renderToken(n, r, i);
7329
+ e.renderer.rules.image = (n, r, i, c, s) => {
7330
+ const o = n[r];
7331
+ if (!o) return t(n, r, i, c, s);
7332
+ const a = o.attrGet("src") ?? "";
7333
+ if (vr(a)) {
7334
+ const l = o.content || "";
7335
+ return `<video src="${a}" controls class="md-editor-video" title="${l}">${l}</video>`;
7221
7336
  }
7222
- return t(n, r, a, c, i);
7337
+ return t(n, r, i, c, s);
7223
7338
  };
7224
7339
  }
7225
- class yr {
7340
+ const Sr = /* @__PURE__ */ new Set(["notice", "info", "tip", "warning", "danger", "success"]), Tr = /^:::(\w+)(?:\s+(.+))?$/, Ar = /^:::\s*$/, Qe = {
7341
+ notice: "Notice",
7342
+ info: "Info",
7343
+ tip: "Tip",
7344
+ warning: "Warning",
7345
+ danger: "Danger",
7346
+ success: "Success"
7347
+ }, Cr = {
7348
+ notice: "i",
7349
+ info: "i",
7350
+ tip: "✓",
7351
+ warning: "!",
7352
+ danger: "✕",
7353
+ success: "✓"
7354
+ };
7355
+ function Mr(e) {
7356
+ e.block.ruler.before("fence", "tips_block", (t, n, r, i) => {
7357
+ const s = t.src.slice(t.bMarks[n], t.eMarks[n]).match(Tr);
7358
+ if (!s) return !1;
7359
+ const o = (s[1] ?? "").toLowerCase();
7360
+ if (!Sr.has(o)) return !1;
7361
+ let a = n + 1, l = !1;
7362
+ for (; a < r; ) {
7363
+ const v = t.src.slice(t.bMarks[a], t.eMarks[a]);
7364
+ if (Ar.test(v.trim())) {
7365
+ l = !0;
7366
+ break;
7367
+ }
7368
+ a++;
7369
+ }
7370
+ if (!l) return !1;
7371
+ if (i) return !0;
7372
+ const u = s[2] ?? Qe[o] ?? o, m = t.src.slice(t.bMarks[n + 1], t.eMarks[a]).trim(), b = e.render(m), _ = t.push("tips_block", "div", 0);
7373
+ return _.content = b, _.info = o, _.markup = u, t.line = a + 1, !0;
7374
+ }), e.renderer.rules.tips_block = (t, n) => {
7375
+ const r = t[n];
7376
+ if (!r) return "";
7377
+ const i = r.info ?? "notice", c = r.markup ?? Qe[i] ?? "Notice", s = Cr[i] ?? "i", o = r.content ?? "";
7378
+ return `<div class="md-editor-tip md-editor-tip--${i}"><div class="md-editor-tip-header"><span class="md-editor-tip-icon">${s}</span><span class="md-editor-tip-title">${Rr(c)}</span></div><div class="md-editor-tip-body">${o}</div></div>`;
7379
+ };
7380
+ }
7381
+ function Rr(e) {
7382
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
7383
+ }
7384
+ class Rt {
7226
7385
  constructor(t = {}) {
7227
- this.md = new Ut({
7386
+ this.md = new Gt({
7228
7387
  html: t.html ?? !1,
7229
7388
  linkify: !0,
7230
7389
  breaks: t.breaks ?? !1,
7231
7390
  typographer: !0
7232
- }), t.math !== !1 && Ht(this.md), this.mindmapEnabled = t.mindmap !== !1, this.mindmapEnabled && Gt(this.md), t.codeHighlight !== !1 && ur(this.md, {
7391
+ }), t.math !== !1 && Zt(this.md), this.mindmapEnabled = t.mindmap !== !1, this.mindmapEnabled && Xt(this.md), t.codeHighlight !== !1 && br(this.md, {
7233
7392
  reservedLanguages: this.mindmapEnabled ? ["mindmap"] : []
7234
- }), Er(this.md);
7393
+ }), t.tips !== !1 && Mr(this.md), Nr(this.md);
7235
7394
  }
7236
7395
  render(t) {
7237
7396
  return this.md.render(t || "");
@@ -7241,17 +7400,20 @@ class yr {
7241
7400
  * mindmap placeholders into real SVG diagrams.
7242
7401
  */
7243
7402
  async hydrate(t) {
7244
- this.mindmapEnabled && await qt(t);
7403
+ this.mindmapEnabled && await jt(t);
7245
7404
  }
7246
7405
  }
7247
- class wr {
7406
+ function Vr(e, t = {}) {
7407
+ return new Rt(t).render(e);
7408
+ }
7409
+ class Or {
7248
7410
  constructor(t) {
7249
7411
  this.buttons = /* @__PURE__ */ new Map(), this.el = document.createElement("div"), this.el.className = "md-editor-toolbar", this.el.setAttribute("role", "toolbar");
7250
7412
  for (const n of t) {
7251
7413
  const r = document.createElement("button");
7252
7414
  if (r.type = "button", r.className = "md-editor-toolbar-btn", n.toggle && r.classList.add("is-toggle"), n.active && r.classList.add("is-active"), r.title = n.title, r.setAttribute("aria-label", n.title), r.setAttribute("data-action", n.name), r.innerHTML = n.icon, r.addEventListener("click", () => n.handler(r)), this.buttons.set(n.name, r), this.el.appendChild(r), n.groupEnd) {
7253
- const a = document.createElement("span");
7254
- a.className = "md-editor-toolbar-sep", this.el.appendChild(a);
7415
+ const i = document.createElement("span");
7416
+ i.className = "md-editor-toolbar-sep", this.el.appendChild(i);
7255
7417
  }
7256
7418
  }
7257
7419
  }
@@ -7269,14 +7431,14 @@ class wr {
7269
7431
  this.buttons.clear(), this.el.remove();
7270
7432
  }
7271
7433
  }
7272
- function Ze(e) {
7434
+ function Je(e) {
7273
7435
  const t = e.trim();
7274
7436
  return {
7275
7437
  charCount: e.length,
7276
7438
  wordCount: t ? t.split(/\s+/).length : 0
7277
7439
  };
7278
7440
  }
7279
- class vr {
7441
+ class xr {
7280
7442
  constructor(t) {
7281
7443
  this.el = document.createElement("div"), this.el.className = "md-editor-statusbar", this.countEl = document.createElement("span"), this.blockEl = document.createElement("span"), this.blockEl.className = "md-editor-statusbar-muted", this.refreshBtn = document.createElement("button"), this.refreshBtn.type = "button", this.refreshBtn.className = "md-editor-statusbar-refresh", this.refreshBtn.textContent = "Refresh preview", this.refreshBtn.style.display = "none", this.refreshBtn.addEventListener("click", t.onRefreshPreview), this.el.appendChild(this.countEl), this.el.appendChild(this.blockEl), this.el.appendChild(this.refreshBtn);
7282
7444
  }
@@ -7287,56 +7449,56 @@ class vr {
7287
7449
  this.refreshBtn.onclick = null, this.el.remove();
7288
7450
  }
7289
7451
  }
7290
- const Nr = /^ {0,3}#{1,6}\s/, Tr = /^ {0,3}(`{3,}|~{3,})/;
7291
- function Sr(e) {
7452
+ const Ir = /^ {0,3}#{1,6}\s/, Lr = /^ {0,3}(`{3,}|~{3,})/;
7453
+ function Dr(e) {
7292
7454
  let t = 5381;
7293
7455
  for (let n = 0; n < e.length; n++)
7294
7456
  t = t * 33 ^ e.charCodeAt(n);
7295
7457
  return (t >>> 0).toString(36) + ":" + e.length;
7296
7458
  }
7297
- function kr(e) {
7298
- var s;
7459
+ function Br(e) {
7460
+ var o;
7299
7461
  const t = e.split(`
7300
7462
  `), n = [];
7301
- let r = [], a = !1, c = "";
7302
- for (const o of t) {
7303
- const l = o.match(Tr);
7463
+ let r = [], i = !1, c = "";
7464
+ for (const a of t) {
7465
+ const l = a.match(Lr);
7304
7466
  if (l) {
7305
- const u = ((s = l[1]) == null ? void 0 : s[0]) ?? "";
7306
- a ? u === c && (a = !1) : (a = !0, c = u), r.push(o);
7467
+ const u = ((o = l[1]) == null ? void 0 : o[0]) ?? "";
7468
+ i ? u === c && (i = !1) : (i = !0, c = u), r.push(a);
7307
7469
  continue;
7308
7470
  }
7309
- if (!a && Nr.test(o) && r.length > 0) {
7471
+ if (!i && Ir.test(a) && r.length > 0) {
7310
7472
  n.push(r.join(`
7311
- `)), r = [o];
7473
+ `)), r = [a];
7312
7474
  continue;
7313
7475
  }
7314
- r.push(o);
7476
+ r.push(a);
7315
7477
  }
7316
7478
  r.length > 0 && n.push(r.join(`
7317
7479
  `)), n.length === 0 && n.push("");
7318
- const i = /* @__PURE__ */ new Map();
7319
- return n.map((o) => {
7320
- const l = Sr(o), u = (i.get(l) ?? 0) + 1;
7321
- return i.set(l, u), { key: `${l}#${u}`, hash: l, source: o };
7480
+ const s = /* @__PURE__ */ new Map();
7481
+ return n.map((a) => {
7482
+ const l = Dr(a), u = (s.get(l) ?? 0) + 1;
7483
+ return s.set(l, u), { key: `${l}#${u}`, hash: l, source: a };
7322
7484
  });
7323
7485
  }
7324
- class Ar {
7486
+ class Pr {
7325
7487
  constructor(t, n, r = 800) {
7326
7488
  this.container = t, this.renderBlock = n, this.maxCacheEntries = r, this.nodeByKey = /* @__PURE__ */ new Map(), this.htmlByHash = /* @__PURE__ */ new Map(), this.prevBlocks = [];
7327
7489
  }
7328
7490
  update(t) {
7329
- const n = kr(t), r = document.createDocumentFragment(), a = /* @__PURE__ */ new Map();
7491
+ const n = Br(t), r = document.createDocumentFragment(), i = /* @__PURE__ */ new Map();
7330
7492
  let c = 0;
7331
- for (const i of n) {
7332
- let s = this.nodeByKey.get(i.key);
7333
- if (!s) {
7334
- let o = this.htmlByHash.get(i.hash);
7335
- o === void 0 && (o = this.renderBlock(i.source), this.htmlByHash.set(i.hash, o), c++), s = document.createElement("div"), s.className = "md-editor-block", s.dataset.blockKey = i.key, s.innerHTML = o;
7493
+ for (const s of n) {
7494
+ let o = this.nodeByKey.get(s.key);
7495
+ if (!o) {
7496
+ let a = this.htmlByHash.get(s.hash);
7497
+ a === void 0 && (a = this.renderBlock(s.source), this.htmlByHash.set(s.hash, a), c++), o = document.createElement("div"), o.className = "md-editor-block", o.dataset.blockKey = s.key, o.innerHTML = a;
7336
7498
  }
7337
- a.set(i.key, s), r.appendChild(s);
7499
+ i.set(s.key, o), r.appendChild(o);
7338
7500
  }
7339
- return this.container.innerHTML = "", this.container.appendChild(r), this.nodeByKey = a, this.prevBlocks = n, this.evictCacheIfNeeded(n), { rerenderedCount: c, totalCount: n.length };
7501
+ return this.container.innerHTML = "", this.container.appendChild(r), this.nodeByKey = i, this.prevBlocks = n, this.evictCacheIfNeeded(n), { rerenderedCount: c, totalCount: n.length };
7340
7502
  }
7341
7503
  /**
7342
7504
  * When the cache exceeds the limit, evict hashes that no longer appear in
@@ -7356,91 +7518,94 @@ class Ar {
7356
7518
  this.container.innerHTML = "", this.nodeByKey.clear(), this.htmlByHash.clear(), this.prevBlocks = [];
7357
7519
  }
7358
7520
  }
7359
- function Rr(e, t) {
7521
+ function $r(e, t) {
7360
7522
  let n, r;
7361
- const a = (...c) => {
7523
+ const i = (...c) => {
7362
7524
  r = c, n !== void 0 && clearTimeout(n), n = setTimeout(() => {
7363
7525
  n = void 0, r && e(...r);
7364
7526
  }, t);
7365
7527
  };
7366
- return a.cancel = () => {
7528
+ return i.cancel = () => {
7367
7529
  n !== void 0 && clearTimeout(n), n = void 0;
7368
- }, a.flush = () => {
7530
+ }, i.flush = () => {
7369
7531
  n !== void 0 && (clearTimeout(n), n = void 0, r && e(...r));
7370
- }, a;
7532
+ }, i;
7371
7533
  }
7372
- function Cr(e, t = 120, n = 600) {
7373
- const r = Math.max(0, e), a = Math.floor(r / 2e4) * 60;
7374
- return Math.min(n, t + a);
7534
+ function Ur(e, t = 120, n = 600) {
7535
+ const r = Math.max(0, e), i = Math.floor(r / 2e4) * 60;
7536
+ return Math.min(n, t + i);
7375
7537
  }
7376
- function $r(e, t = 300) {
7538
+ function Xr(e, t = 300) {
7377
7539
  const n = window;
7378
7540
  return typeof n.requestIdleCallback == "function" ? n.requestIdleCallback(e, { timeout: t }) : window.setTimeout(e, 0);
7379
7541
  }
7380
- function Fr(e) {
7542
+ function Qr(e) {
7381
7543
  const t = window;
7382
7544
  typeof t.cancelIdleCallback == "function" ? t.cancelIdleCallback(e) : clearTimeout(e);
7383
7545
  }
7384
- const U = (e) => `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">${e}</svg>`, D = {
7385
- bold: U(
7546
+ const B = (e) => `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">${e}</svg>`, I = {
7547
+ bold: B(
7386
7548
  '<path d="M4 3h4.2a2.4 2.4 0 0 1 0 4.8H4V3Z" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round"/><path d="M4 7.8h4.8a2.4 2.4 0 1 1 0 4.8H4V7.8Z" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round"/>'
7387
7549
  ),
7388
- italic: U(
7550
+ italic: B(
7389
7551
  '<path d="M9.5 3h-3M6.5 13h-3M8.2 3 5.8 13" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>'
7390
7552
  ),
7391
- heading: U(
7553
+ heading: B(
7392
7554
  '<path d="M3.5 3v10M11.5 3v10M3.5 8h8" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>'
7393
7555
  ),
7394
- link: U(
7556
+ link: B(
7395
7557
  '<path d="M6.8 9.2 9.2 6.8" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/><path d="M7.6 4.4 8.4 3.6a2.6 2.6 0 1 1 3.7 3.7l-.9.9M8.4 11.6l-.8.8a2.6 2.6 0 1 1-3.7-3.7l.9-.9" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>'
7396
7558
  ),
7397
- code: U(
7559
+ code: B(
7398
7560
  '<path d="M5.5 4.5 2 8l3.5 3.5M10.5 4.5 14 8l-3.5 3.5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>'
7399
7561
  ),
7400
- table: U(
7562
+ table: B(
7401
7563
  '<rect x="2.5" y="3" width="11" height="10" rx="1.2" stroke="currentColor" stroke-width="1.3"/><path d="M2.5 6.6h11M6.5 3v10" stroke="currentColor" stroke-width="1.3"/>'
7402
7564
  ),
7403
- sigma: U(
7565
+ sigma: B(
7404
7566
  '<path d="M11.5 3.5h-7l3.5 4.5-3.5 4.5h7" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round" stroke-linecap="round"/>'
7405
7567
  ),
7406
- mindmap: U(
7568
+ mindmap: B(
7407
7569
  '<circle cx="3.2" cy="8" r="1.6" stroke="currentColor" stroke-width="1.3"/><circle cx="12.2" cy="3.6" r="1.6" stroke="currentColor" stroke-width="1.3"/><circle cx="12.2" cy="12.4" r="1.6" stroke="currentColor" stroke-width="1.3"/><path d="M4.6 7.3 10.7 4.2M4.6 8.7l6.1 3.1" stroke="currentColor" stroke-width="1.3"/>'
7408
7570
  ),
7409
- eye: U(
7571
+ eye: B(
7410
7572
  '<path d="M1.5 8S4 3.5 8 3.5 14.5 8 14.5 8 12 12.5 8 12.5 1.5 8 1.5 8Z" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round"/><circle cx="8" cy="8" r="1.8" stroke="currentColor" stroke-width="1.3"/>'
7411
7573
  ),
7412
- refresh: U(
7574
+ refresh: B(
7413
7575
  '<path d="M13 8a5 5 0 1 1-1.6-3.7" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/><path d="M13 3v3.2H9.8" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>'
7414
7576
  ),
7415
- moon: U(
7577
+ moon: B(
7416
7578
  '<path d="M13 9.6A5.4 5.4 0 1 1 6.4 3a4.3 4.3 0 0 0 6.6 6.6Z" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round"/>'
7417
7579
  ),
7418
- sun: U(
7580
+ sun: B(
7419
7581
  '<circle cx="8" cy="8" r="3" stroke="currentColor" stroke-width="1.3"/><path d="M8 1.8v1.4M8 12.8v1.4M14.2 8h-1.4M3.2 8H1.8M12.4 3.6l-1 1M4.6 11.4l-1 1M12.4 12.4l-1-1M4.6 4.6l-1-1" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/>'
7420
7582
  ),
7421
- image: U(
7583
+ image: B(
7422
7584
  '<rect x="2.5" y="3" width="11" height="10" rx="1.2" stroke="currentColor" stroke-width="1.3"/><circle cx="5.5" cy="6" r="1" fill="currentColor"/><path d="m3 11 3.5-3 2.5 2.5 2-2 3 3" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/>'
7423
7585
  ),
7424
- video: U(
7586
+ video: B(
7425
7587
  '<rect x="2" y="4" width="8" height="8" rx="1.2" stroke="currentColor" stroke-width="1.3"/><path d="m10 7 4-2v6l-4-2" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round"/>'
7426
7588
  ),
7427
- youtube: U(
7589
+ youtube: B(
7428
7590
  '<rect x="2" y="4" width="12" height="8" rx="2" stroke="currentColor" stroke-width="1.3"/><path d="m7 6.5 3 1.5-3 1.5v-3Z" fill="currentColor"/>'
7429
7591
  ),
7430
- quote: U(
7592
+ quote: B(
7431
7593
  '<path d="M5 5h3v3H6c0 1.5.5 2.5 2 3v1.5c-2.5-.5-4-2-4-4.5V5Z" fill="currentColor"/><path d="M10 5h3v3h-2c0 1.5.5 2.5 2 3v1.5c-2.5-.5-4-2-4-4.5V5Z" fill="currentColor"/>'
7432
7594
  ),
7433
- list: U(
7595
+ list: B(
7434
7596
  '<circle cx="3.5" cy="4.5" r="1" fill="currentColor"/><circle cx="3.5" cy="8" r="1" fill="currentColor"/><circle cx="3.5" cy="11.5" r="1" fill="currentColor"/><path d="M6 4.5h7M6 8h7M6 11.5h7" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/>'
7435
7597
  ),
7436
- listOrdered: U(
7598
+ listOrdered: B(
7437
7599
  '<path d="M3 4h1.5M3 6h2M3.5 3v3" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/><path d="M3 8.5h2M3 10.5h2M3 8.5v2" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/><path d="M3 12.5h2l-2 2h2" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/><path d="M6.5 4.5h7M6.5 8h7M6.5 11.5h7" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/>'
7438
7600
  ),
7439
- hr: U(
7601
+ hr: B(
7440
7602
  '<path d="M2 8h12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>'
7603
+ ),
7604
+ help: B(
7605
+ '<circle cx="8" cy="8" r="6.2" stroke="currentColor" stroke-width="1.3"/><path d="M6.2 6.2a1.8 1.8 0 0 1 3.5.6c0 1.2-1.8 1.4-1.8 2.4" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/><circle cx="8" cy="11.2" r="0.6" fill="currentColor"/>'
7441
7606
  )
7442
7607
  };
7443
- class Se {
7608
+ class le {
7444
7609
  constructor(t, n) {
7445
7610
  this.inputs = /* @__PURE__ */ new Map(), this.destroyed = !1, this.anchor = t, this.config = n, this.el = document.createElement("div"), this.el.className = "md-editor-popup", this.el.setAttribute("role", "dialog"), this.el.setAttribute("aria-label", n.title), this.build(), this.onOutsideClick = (r) => {
7446
7611
  !this.el.contains(r.target) && r.target !== this.anchor && this.hide();
@@ -7453,24 +7618,24 @@ class Se {
7453
7618
  t.className = "md-editor-popup-header", t.textContent = this.config.title;
7454
7619
  const n = document.createElement("div");
7455
7620
  n.className = "md-editor-popup-body";
7456
- for (const i of this.config.fields) {
7457
- const s = document.createElement("div");
7458
- s.className = "md-editor-popup-field";
7459
- const o = document.createElement("label");
7460
- o.className = "md-editor-popup-label", o.textContent = i.label, o.setAttribute("for", `md-editor-popup-${i.name}`);
7621
+ for (const s of this.config.fields) {
7622
+ const o = document.createElement("div");
7623
+ o.className = "md-editor-popup-field";
7624
+ const a = document.createElement("label");
7625
+ a.className = "md-editor-popup-label", a.textContent = s.label, a.setAttribute("for", `md-editor-popup-${s.name}`);
7461
7626
  let l;
7462
- i.type === "textarea" ? (l = document.createElement("textarea"), l.rows = 2) : (l = document.createElement("input"), l.type = "text"), l.id = `md-editor-popup-${i.name}`, l.className = "md-editor-popup-input", i.placeholder && (l.placeholder = i.placeholder), i.required && (l.required = !0), s.appendChild(o), s.appendChild(l), n.appendChild(s), this.inputs.set(i.name, l);
7627
+ s.type === "textarea" ? (l = document.createElement("textarea"), l.rows = 2) : (l = document.createElement("input"), l.type = "text"), l.id = `md-editor-popup-${s.name}`, l.className = "md-editor-popup-input", s.placeholder && (l.placeholder = s.placeholder), s.required && (l.required = !0), o.appendChild(a), o.appendChild(l), n.appendChild(o), this.inputs.set(s.name, l);
7463
7628
  }
7464
7629
  const r = document.createElement("div");
7465
7630
  r.className = "md-editor-popup-footer";
7466
- const a = document.createElement("button");
7467
- a.type = "button", a.className = "md-editor-popup-btn md-editor-popup-btn--ghost", a.textContent = "Cancel", a.addEventListener("click", () => this.hide());
7631
+ const i = document.createElement("button");
7632
+ i.type = "button", i.className = "md-editor-popup-btn md-editor-popup-btn--ghost", i.textContent = "Cancel", i.addEventListener("click", () => this.hide());
7468
7633
  const c = document.createElement("button");
7469
- c.type = "button", c.className = "md-editor-popup-btn md-editor-popup-btn--primary", c.textContent = this.config.submitLabel ?? "Insert", c.addEventListener("click", () => this.submit()), r.appendChild(a), r.appendChild(c), this.el.appendChild(t), this.el.appendChild(n), this.el.appendChild(r);
7470
- for (const i of this.inputs.values())
7471
- i.tagName === "INPUT" && i.addEventListener("keydown", (s) => {
7472
- const o = s;
7473
- o.key === "Enter" && (o.preventDefault(), this.submit());
7634
+ c.type = "button", c.className = "md-editor-popup-btn md-editor-popup-btn--primary", c.textContent = this.config.submitLabel ?? "Insert", c.addEventListener("click", () => this.submit()), r.appendChild(i), r.appendChild(c), this.el.appendChild(t), this.el.appendChild(n), this.el.appendChild(r);
7635
+ for (const s of this.inputs.values())
7636
+ s.tagName === "INPUT" && s.addEventListener("keydown", (o) => {
7637
+ const a = o;
7638
+ a.key === "Enter" && (a.preventDefault(), this.submit());
7474
7639
  });
7475
7640
  }
7476
7641
  submit() {
@@ -7491,14 +7656,76 @@ class Se {
7491
7656
  position() {
7492
7657
  const t = this.anchor.getBoundingClientRect(), n = this.el.getBoundingClientRect();
7493
7658
  let r = t.left;
7494
- const a = t.bottom + 6;
7495
- r + n.width > window.innerWidth - 8 && (r = window.innerWidth - n.width - 8), r < 8 && (r = 8), this.el.style.left = `${r + window.scrollX}px`, this.el.style.top = `${a + window.scrollY}px`;
7659
+ const i = t.bottom + 6;
7660
+ r + n.width > window.innerWidth - 8 && (r = window.innerWidth - n.width - 8), r < 8 && (r = 8), this.el.style.left = `${r + window.scrollX}px`, this.el.style.top = `${i + window.scrollY}px`;
7496
7661
  }
7497
7662
  destroy() {
7498
7663
  this.hide(), this.destroyed = !0, this.inputs.clear();
7499
7664
  }
7500
7665
  }
7501
- const Mr = {
7666
+ const Fr = [
7667
+ { action: "bold", key: "Mod-b", description: "Bold" },
7668
+ { action: "italic", key: "Mod-i", description: "Italic" },
7669
+ { action: "heading", key: "Mod-Alt-1", description: "Heading" },
7670
+ { action: "link", key: "Mod-k", description: "Insert link" },
7671
+ { action: "code", key: "Mod-Alt-c", description: "Code block" },
7672
+ { action: "quote", key: "Mod-Shift-.", description: "Blockquote" },
7673
+ { action: "ul", key: "Mod-Shift-8", description: "Unordered list" },
7674
+ { action: "ol", key: "Mod-Shift-7", description: "Ordered list" },
7675
+ { action: "math", key: "Mod-Alt-m", description: "Math formula" },
7676
+ { action: "preview", key: "Mod-Alt-p", description: "Toggle preview" },
7677
+ { action: "theme", key: "Mod-Shift-l", description: "Toggle theme" }
7678
+ ];
7679
+ function Jr(e, t) {
7680
+ var a;
7681
+ const n = e.toLowerCase().split("-");
7682
+ let r = "", i = !1, c = !1, s = !1, o = !1;
7683
+ for (const l of n)
7684
+ switch (l) {
7685
+ case "mod":
7686
+ (a = navigator.platform) != null && a.toLowerCase().includes("mac") ? c = !0 : i = !0;
7687
+ break;
7688
+ case "ctrl":
7689
+ i = !0;
7690
+ break;
7691
+ case "meta":
7692
+ case "cmd":
7693
+ c = !0;
7694
+ break;
7695
+ case "alt":
7696
+ case "option":
7697
+ s = !0;
7698
+ break;
7699
+ case "shift":
7700
+ o = !0;
7701
+ break;
7702
+ default:
7703
+ r = l;
7704
+ }
7705
+ return !(t.ctrlKey !== i || t.metaKey !== c || t.altKey !== s || t.shiftKey !== o || t.key.toLowerCase() !== r);
7706
+ }
7707
+ function Hr(e) {
7708
+ var r;
7709
+ const t = ((r = navigator.platform) == null ? void 0 : r.toLowerCase().includes("mac")) ?? !1;
7710
+ return e.split("-").map((i) => {
7711
+ switch (i.toLowerCase()) {
7712
+ case "mod":
7713
+ return t ? "Cmd" : "Ctrl";
7714
+ case "ctrl":
7715
+ return "Ctrl";
7716
+ case "meta":
7717
+ case "cmd":
7718
+ return "Cmd";
7719
+ case "alt":
7720
+ return t ? "Option" : "Alt";
7721
+ case "shift":
7722
+ return "Shift";
7723
+ default:
7724
+ return i.toUpperCase();
7725
+ }
7726
+ }).join("+");
7727
+ }
7728
+ const je = {
7502
7729
  bold: ["**", "**", "bold text"],
7503
7730
  italic: ["_", "_", "italic text"],
7504
7731
  heading: ["## ", "", "Heading"],
@@ -7528,126 +7755,150 @@ const Mr = {
7528
7755
  ---
7529
7756
  `, "", ""]
7530
7757
  };
7531
- class zr {
7758
+ class jr {
7532
7759
  constructor(t, n = {}) {
7533
7760
  this.previewPane = null, this.incremental = null, this.toolbar = null, this.statusBar = null, this.activePopup = null, this.scheduledRender = null, this.scheduledWait = 0;
7534
7761
  const r = typeof t == "string" ? document.querySelector(t) : t;
7535
7762
  if (!r) throw new Error("MarkdownEditor: mount container not found");
7536
- this.container = r, this.mode = n.mode ?? "simple", this.theme = n.theme ?? "light", this.showPreview = n.preview ?? !0, this.autoPreview = n.autoPreview ?? !0, this.renderDebounceOpt = n.renderDebounce, this.onChange = n.onChange, this.container.classList.add("md-editor-root", `md-editor-mode-${this.mode}`), this.container.setAttribute("data-theme", this.theme), this.renderer = new yr({
7763
+ this.container = r, this.mode = n.mode ?? "simple", this.theme = n.theme ?? "light", this.showPreview = n.preview ?? !0, this.autoPreview = n.autoPreview ?? !0, this.renderDebounceOpt = n.renderDebounce, this.onChange = n.onChange, this.onImageUpload = n.onImageUpload, this.toolbarConfig = n.toolbar, this.shortcuts = Fr, this.container.classList.add("md-editor-root", `md-editor-mode-${this.mode}`), this.container.setAttribute("data-theme", this.theme), this.renderer = new Rt({
7537
7764
  math: n.math ?? !0,
7538
7765
  mindmap: n.mindmap ?? !0,
7539
- codeHighlight: n.codeHighlight ?? !0
7540
- }), this.buildLayout(), this.codeEditor = new zt(this.editorPane, {
7766
+ codeHighlight: n.codeHighlight ?? !0,
7767
+ tips: n.tips ?? !0
7768
+ }), this.buildLayout(), this.codeEditor = new qt(this.editorPane, {
7541
7769
  value: n.value ?? "",
7542
7770
  lineNumbers: this.mode === "complex",
7543
- onChange: (a) => {
7771
+ onChange: (i) => {
7544
7772
  var c;
7545
- (c = this.onChange) == null || c.call(this, a), this.autoPreview && this.requestPreviewRender(a), this.updateStatusBar(a);
7546
- }
7547
- }), this.mode === "complex" && (this.buildToolbar(), this.buildStatusBar()), this.previewPane && (this.previewPane.classList.add("markdown-body"), this.incremental = new Ar(
7773
+ (c = this.onChange) == null || c.call(this, i), this.autoPreview && this.requestPreviewRender(i), this.updateStatusBar(i);
7774
+ },
7775
+ onImageFile: (i) => this.handleImageFile(i)
7776
+ }), this.setupKeyboardShortcuts(), this.mode === "complex" && (this.buildToolbar(), this.buildStatusBar()), this.previewPane && (this.previewPane.classList.add("markdown-body"), this.incremental = new Pr(
7548
7777
  this.previewPane,
7549
- (a) => this.renderer.render(a)
7778
+ (i) => this.renderer.render(i)
7550
7779
  ), this.setupCopyHandler()), this.renderPreview(n.value ?? ""), this.updateStatusBar(n.value ?? "");
7551
7780
  }
7552
7781
  // ---------- Layout ----------
7553
7782
  buildLayout() {
7554
7783
  this.container.innerHTML = "", this.body = document.createElement("div"), this.body.className = "md-editor-body", this.editorPane = document.createElement("div"), this.editorPane.className = "md-editor-pane md-editor-source", this.body.appendChild(this.editorPane), this.showPreview && (this.previewPane = document.createElement("div"), this.previewPane.className = "md-editor-pane md-editor-preview", this.body.appendChild(this.previewPane)), this.container.appendChild(this.body);
7555
7784
  }
7785
+ // ---------- Toolbar ----------
7786
+ isActionVisible(t) {
7787
+ var n;
7788
+ return this.toolbarConfig ? Array.isArray(this.toolbarConfig) ? this.toolbarConfig.includes(t) : ((n = this.toolbarConfig[t]) == null ? void 0 : n.show) !== !1 : !0;
7789
+ }
7790
+ getActionLabel(t, n) {
7791
+ var r;
7792
+ return this.toolbarConfig && !Array.isArray(this.toolbarConfig) ? ((r = this.toolbarConfig[t]) == null ? void 0 : r.label) ?? n : n;
7793
+ }
7794
+ getActionIcon(t, n) {
7795
+ var r;
7796
+ return this.toolbarConfig && !Array.isArray(this.toolbarConfig) ? ((r = this.toolbarConfig[t]) == null ? void 0 : r.icon) ?? n : n;
7797
+ }
7556
7798
  buildToolbar() {
7557
- const t = [
7558
- { name: "heading", title: "Heading", icon: D.heading, handler: () => this.insertSnippet("heading") },
7559
- { name: "bold", title: "Bold", icon: D.bold, handler: () => this.insertSnippet("bold") },
7560
- {
7561
- name: "italic",
7562
- title: "Italic",
7563
- icon: D.italic,
7564
- handler: () => this.insertSnippet("italic"),
7565
- groupEnd: !0
7566
- },
7567
- { name: "link", title: "Link", icon: D.link, handler: () => this.insertSnippet("link") },
7568
- { name: "image", title: "Insert image", icon: D.image, handler: (n) => this.showImagePopup(n) },
7569
- { name: "video", title: "Insert video", icon: D.video, handler: (n) => this.showVideoPopup(n), groupEnd: !0 },
7570
- { name: "youtube", title: "Insert YouTube video", icon: D.youtube, handler: (n) => this.showYouTubePopup(n), groupEnd: !0 },
7571
- { name: "quote", title: "Quote", icon: D.quote, handler: () => this.insertSnippet("quote") },
7572
- { name: "ul", title: "Unordered list", icon: D.list, handler: () => this.insertSnippet("unorderedList") },
7573
- {
7574
- name: "ol",
7575
- title: "Ordered list",
7576
- icon: D.listOrdered,
7577
- handler: () => this.insertSnippet("orderedList"),
7578
- groupEnd: !0
7579
- },
7580
- { name: "code", title: "Code block", icon: D.code, handler: () => this.insertSnippet("code") },
7581
- {
7582
- name: "table",
7583
- title: "Table",
7584
- icon: D.table,
7585
- handler: () => this.insertSnippet("table"),
7586
- groupEnd: !0
7587
- },
7588
- { name: "math", title: "Math formula", icon: D.sigma, handler: () => this.insertSnippet("math") },
7589
- {
7590
- name: "mindmap",
7591
- title: "Insert mindmap",
7592
- icon: D.mindmap,
7593
- handler: () => this.insertSnippet("mindmapBlock"),
7594
- groupEnd: !0
7595
- },
7596
- { name: "hr", title: "Horizontal rule", icon: D.hr, handler: () => this.insertSnippet("hr"), groupEnd: !0 },
7597
- {
7598
- name: "preview",
7599
- title: "Toggle preview",
7600
- icon: D.eye,
7601
- toggle: !0,
7602
- active: this.showPreview,
7603
- handler: () => this.togglePreview()
7604
- },
7605
- {
7606
- name: "theme",
7607
- title: "Toggle theme",
7608
- icon: this.theme === "dark" ? D.sun : D.moon,
7609
- handler: () => this.setTheme(this.theme === "dark" ? "light" : "dark")
7610
- }
7611
- ];
7612
- this.toolbar = new wr(t), this.container.insertBefore(this.toolbar.el, this.body);
7799
+ const t = [], n = (r, i, c, s, o = {}) => {
7800
+ this.isActionVisible(r) && t.push({
7801
+ name: r,
7802
+ title: this.getActionLabel(r, i),
7803
+ icon: this.getActionIcon(r, c),
7804
+ handler: s,
7805
+ ...o
7806
+ });
7807
+ };
7808
+ n("heading", "Heading", I.heading, () => this.insertSnippet("heading")), n("bold", "Bold (Ctrl+B)", I.bold, () => this.wrapSnippet("bold")), n("italic", "Italic (Ctrl+I)", I.italic, () => this.wrapSnippet("italic"), { groupEnd: !0 }), n("link", "Link (Ctrl+K)", I.link, () => this.wrapSnippet("link")), n("image", "Insert image", I.image, (r) => this.showImagePopup(r)), n("video", "Insert video", I.video, (r) => this.showVideoPopup(r), { groupEnd: !0 }), n("youtube", "Insert YouTube video", I.youtube, (r) => this.showYouTubePopup(r), { groupEnd: !0 }), n("quote", "Quote", I.quote, () => this.insertSnippet("quote")), n("ul", "Unordered list", I.list, () => this.insertSnippet("unorderedList")), n("ol", "Ordered list", I.listOrdered, () => this.insertSnippet("orderedList"), { groupEnd: !0 }), n("code", "Code block", I.code, () => this.insertSnippet("code")), n("table", "Table", I.table, (r) => this.showTablePopup(r), { groupEnd: !0 }), n("math", "Math formula", I.sigma, () => this.wrapSnippet("math")), n("mindmap", "Insert mindmap", I.mindmap, () => this.insertSnippet("mindmapBlock"), { groupEnd: !0 }), n("hr", "Horizontal rule", I.hr, () => this.insertSnippet("hr")), n("tips", "Insert tip block", I.quote, () => this.insertTipBlock(), { groupEnd: !0 }), n("preview", "Toggle preview", I.eye, () => this.togglePreview(), {
7809
+ toggle: !0,
7810
+ active: this.showPreview
7811
+ }), n("help", "Keyboard shortcuts", I.help, (r) => this.showHelpPopup(r)), n(
7812
+ "theme",
7813
+ "Toggle theme",
7814
+ this.theme === "dark" ? I.sun : I.moon,
7815
+ () => this.setTheme(this.theme === "dark" ? "light" : "dark")
7816
+ ), this.toolbar = new Or(t), this.container.insertBefore(this.toolbar.el, this.body);
7613
7817
  }
7614
7818
  buildStatusBar() {
7615
- this.statusBar = new vr({
7819
+ this.statusBar = new xr({
7616
7820
  onRefreshPreview: () => this.renderPreview(this.codeEditor.getValue())
7617
7821
  }), this.container.appendChild(this.statusBar.el);
7618
7822
  }
7823
+ // ---------- Keyboard shortcuts ----------
7824
+ setupKeyboardShortcuts() {
7825
+ const t = this.shortcuts.map((n) => ({
7826
+ key: n.key,
7827
+ run: () => (this.executeAction(n.action), !0)
7828
+ }));
7829
+ this.codeEditor.setKeymap(t);
7830
+ }
7831
+ executeAction(t) {
7832
+ switch (t) {
7833
+ case "bold":
7834
+ this.wrapSnippet("bold");
7835
+ break;
7836
+ case "italic":
7837
+ this.wrapSnippet("italic");
7838
+ break;
7839
+ case "heading":
7840
+ this.insertSnippet("heading");
7841
+ break;
7842
+ case "link":
7843
+ this.wrapSnippet("link");
7844
+ break;
7845
+ case "code":
7846
+ this.insertSnippet("code");
7847
+ break;
7848
+ case "quote":
7849
+ this.insertSnippet("quote");
7850
+ break;
7851
+ case "ul":
7852
+ this.insertSnippet("unorderedList");
7853
+ break;
7854
+ case "ol":
7855
+ this.insertSnippet("orderedList");
7856
+ break;
7857
+ case "math":
7858
+ this.wrapSnippet("math");
7859
+ break;
7860
+ case "preview":
7861
+ this.togglePreview();
7862
+ break;
7863
+ case "theme":
7864
+ this.setTheme(this.theme === "dark" ? "light" : "dark");
7865
+ break;
7866
+ }
7867
+ }
7619
7868
  // ---------- Popup dialogs ----------
7620
7869
  showImagePopup(t) {
7621
- var n;
7622
- (n = this.activePopup) == null || n.destroy(), this.activePopup = new Se(t, {
7870
+ var r;
7871
+ (r = this.activePopup) == null || r.destroy();
7872
+ const n = typeof this.onImageUpload == "function";
7873
+ this.activePopup = new le(t, {
7623
7874
  title: "Insert image",
7624
7875
  fields: [
7625
- { name: "url", label: "Image URL", placeholder: "https://example.com/image.png", required: !0 },
7626
- { name: "alt", label: "Alt text", placeholder: "image description" }
7876
+ { name: "url", label: "Image URL", placeholder: "https://example.com/image.png" },
7877
+ ...n ? [{ name: "file", label: "Or paste/drop an image into the editor", type: "text", placeholder: "Upload via paste or drag-and-drop" }] : []
7627
7878
  ],
7628
- onSubmit: (r) => {
7629
- const a = r.url ?? "";
7630
- a && this.codeEditor.insertAtCursor(fr(a, r.alt || "image"));
7879
+ onSubmit: (i) => {
7880
+ const c = i.url ?? "";
7881
+ c && this.codeEditor.insertAtCursor(Xe(c, "image"));
7631
7882
  }
7632
7883
  }), this.activePopup.show();
7633
7884
  }
7634
7885
  showVideoPopup(t) {
7635
7886
  var n;
7636
- (n = this.activePopup) == null || n.destroy(), this.activePopup = new Se(t, {
7887
+ (n = this.activePopup) == null || n.destroy(), this.activePopup = new le(t, {
7637
7888
  title: "Insert video",
7638
7889
  fields: [
7639
7890
  { name: "url", label: "Video URL (.mp4, .webm, .ogg)", placeholder: "https://example.com/video.mp4", required: !0 },
7640
7891
  { name: "alt", label: "Title", placeholder: "video title" }
7641
7892
  ],
7642
7893
  onSubmit: (r) => {
7643
- const a = r.url ?? "";
7644
- a && this.codeEditor.insertAtCursor(_r(a, r.alt || "video"));
7894
+ const i = r.url ?? "";
7895
+ i && this.codeEditor.insertAtCursor(kr(i, r.alt || "video"));
7645
7896
  }
7646
7897
  }), this.activePopup.show();
7647
7898
  }
7648
7899
  showYouTubePopup(t) {
7649
7900
  var n;
7650
- (n = this.activePopup) == null || n.destroy(), this.activePopup = new Se(t, {
7901
+ (n = this.activePopup) == null || n.destroy(), this.activePopup = new le(t, {
7651
7902
  title: "Insert YouTube video",
7652
7903
  fields: [
7653
7904
  {
@@ -7658,32 +7909,102 @@ class zr {
7658
7909
  }
7659
7910
  ],
7660
7911
  onSubmit: (r) => {
7661
- const a = r.url ?? "", c = hr(a);
7662
- c && this.codeEditor.insertAtCursor(mr(c));
7912
+ const i = r.url ?? "", c = yr(i);
7913
+ c && this.codeEditor.insertAtCursor(wr(c));
7663
7914
  }
7664
7915
  }), this.activePopup.show();
7665
7916
  }
7917
+ showTablePopup(t) {
7918
+ var n;
7919
+ (n = this.activePopup) == null || n.destroy(), this.activePopup = new le(t, {
7920
+ title: "Insert table",
7921
+ fields: [
7922
+ { name: "rows", label: "Rows", placeholder: "3" },
7923
+ { name: "cols", label: "Columns", placeholder: "3" }
7924
+ ],
7925
+ submitLabel: "Insert",
7926
+ onSubmit: (r) => {
7927
+ const i = Math.max(1, Math.min(50, parseInt(r.rows ?? "3", 10) || 3)), c = Math.max(1, Math.min(20, parseInt(r.cols ?? "3", 10) || 3));
7928
+ this.codeEditor.insertAtCursor(this.generateTable(i, c));
7929
+ }
7930
+ }), this.activePopup.show();
7931
+ }
7932
+ generateTable(t, n) {
7933
+ const r = "| " + Array.from({ length: n }, (o, a) => `Col ${a + 1}`).join(" | ") + " |", i = "| " + Array.from({ length: n }, () => "---").join(" | ") + " |", c = Math.max(0, t - 1), s = Array.from(
7934
+ { length: c },
7935
+ () => "| " + Array.from({ length: n }, () => "content").join(" | ") + " |"
7936
+ ).join(`
7937
+ `);
7938
+ return c > 0 ? `${r}
7939
+ ${i}
7940
+ ${s}
7941
+ ` : `${r}
7942
+ ${i}
7943
+ `;
7944
+ }
7945
+ showHelpPopup(t) {
7946
+ var c;
7947
+ (c = this.activePopup) == null || c.destroy();
7948
+ const n = new le(t, {
7949
+ title: "Keyboard Shortcuts",
7950
+ fields: [],
7951
+ onSubmit: () => {
7952
+ }
7953
+ }), r = n.el.querySelector(".md-editor-popup-body");
7954
+ r && (r.innerHTML = '<div class="md-editor-help-list">' + this.shortcuts.map(
7955
+ (s) => `<div class="md-editor-help-row">
7956
+ <span class="md-editor-help-desc">${s.description}</span>
7957
+ <kbd class="md-editor-help-key">${Hr(s.key)}</kbd>
7958
+ </div>`
7959
+ ).join("") + "</div>");
7960
+ const i = n.el.querySelector(".md-editor-popup-footer");
7961
+ i && i.remove(), this.activePopup = n, this.activePopup.show();
7962
+ }
7963
+ // ---------- Image upload ----------
7964
+ async handleImageFile(t) {
7965
+ if (this.onImageUpload)
7966
+ try {
7967
+ const n = await this.onImageUpload(t);
7968
+ n && this.codeEditor.insertAtCursor(Xe(n, t.name.replace(/\.[^.]+$/, "") || "image"));
7969
+ } catch {
7970
+ }
7971
+ }
7972
+ // ---------- Tips block ----------
7973
+ insertTipBlock() {
7974
+ this.codeEditor.insertAtCursor(
7975
+ `:::tip Tip title
7976
+
7977
+ Your tip content here.
7978
+
7979
+ :::
7980
+ `
7981
+ );
7982
+ }
7666
7983
  // ---------- Copy button (event delegation) ----------
7667
7984
  setupCopyHandler() {
7668
7985
  this.previewPane && this.previewPane.addEventListener("click", (t) => {
7669
- var i;
7986
+ var s;
7670
7987
  const n = t.target.closest(".md-editor-codeblock-copy");
7671
7988
  if (!n) return;
7672
- const r = n.closest(".md-editor-codeblock"), a = r == null ? void 0 : r.querySelector("code");
7673
- if (!a) return;
7674
- const c = a.textContent ?? "";
7675
- (i = navigator.clipboard) != null && i.writeText && navigator.clipboard.writeText(c).then(() => {
7676
- const s = n.textContent;
7989
+ const r = n.closest(".md-editor-codeblock"), i = r == null ? void 0 : r.querySelector("code");
7990
+ if (!i) return;
7991
+ const c = i.textContent ?? "";
7992
+ (s = navigator.clipboard) != null && s.writeText && navigator.clipboard.writeText(c).then(() => {
7993
+ const o = n.textContent;
7677
7994
  n.textContent = "Copied!", n.classList.add("is-copied"), window.setTimeout(() => {
7678
- n.textContent = s, n.classList.remove("is-copied");
7995
+ n.textContent = o, n.classList.remove("is-copied");
7679
7996
  }, 2e3);
7680
7997
  });
7681
7998
  });
7682
7999
  }
7683
8000
  // ---------- Snippets ----------
7684
8001
  insertSnippet(t) {
7685
- const [n, r, a] = Mr[t];
7686
- this.codeEditor.insertAtCursor(`${n}${a}${r}`);
8002
+ const [n, r, i] = je[t];
8003
+ this.codeEditor.insertAtCursor(`${n}${i}${r}`);
8004
+ }
8005
+ wrapSnippet(t) {
8006
+ const [n, r, i] = je[t];
8007
+ this.codeEditor.wrapSelection(n, r, i);
7687
8008
  }
7688
8009
  togglePreview() {
7689
8010
  var n;
@@ -7693,22 +8014,22 @@ class zr {
7693
8014
  }
7694
8015
  // ---------- Render scheduling (performance core) ----------
7695
8016
  requestPreviewRender(t) {
7696
- var r, a;
7697
- const n = this.renderDebounceOpt === !1 ? 0 : this.renderDebounceOpt ?? Cr(t.length);
8017
+ var r, i;
8018
+ const n = this.renderDebounceOpt === !1 ? 0 : this.renderDebounceOpt ?? Ur(t.length);
7698
8019
  if (n === 0) {
7699
8020
  (r = this.scheduledRender) == null || r.cancel(), this.scheduledRender = null, this.renderPreview(t);
7700
8021
  return;
7701
8022
  }
7702
- (!this.scheduledRender || this.scheduledWait !== n) && ((a = this.scheduledRender) == null || a.cancel(), this.scheduledRender = Rr((c) => this.renderPreview(c), n), this.scheduledWait = n), this.scheduledRender(t);
8023
+ (!this.scheduledRender || this.scheduledWait !== n) && ((i = this.scheduledRender) == null || i.cancel(), this.scheduledRender = $r((c) => this.renderPreview(c), n), this.scheduledWait = n), this.scheduledRender(t);
7703
8024
  }
7704
8025
  renderPreview(t) {
7705
8026
  if (!this.previewPane || !this.incremental) return;
7706
8027
  const { totalCount: n } = this.incremental.update(t);
7707
8028
  if (this.renderer.hydrate(this.previewPane), this.statusBar) {
7708
- const { charCount: r, wordCount: a } = Ze(t);
8029
+ const { charCount: r, wordCount: i } = Je(t);
7709
8030
  this.statusBar.update({
7710
8031
  charCount: r,
7711
- wordCount: a,
8032
+ wordCount: i,
7712
8033
  blockCount: n,
7713
8034
  mode: this.mode,
7714
8035
  autoPreview: this.autoPreview
@@ -7716,13 +8037,13 @@ class zr {
7716
8037
  }
7717
8038
  }
7718
8039
  updateStatusBar(t) {
7719
- var a;
8040
+ var i;
7720
8041
  if (!this.statusBar) return;
7721
- const { charCount: n, wordCount: r } = Ze(t);
8042
+ const { charCount: n, wordCount: r } = Je(t);
7722
8043
  this.statusBar.update({
7723
8044
  charCount: n,
7724
8045
  wordCount: r,
7725
- blockCount: ((a = this.incremental) == null ? void 0 : a.getBlockCount()) ?? 0,
8046
+ blockCount: ((i = this.incremental) == null ? void 0 : i.getBlockCount()) ?? 0,
7726
8047
  mode: this.mode,
7727
8048
  autoPreview: this.autoPreview
7728
8049
  });
@@ -7738,7 +8059,6 @@ class zr {
7738
8059
  getHtml() {
7739
8060
  return this.renderer.render(this.getValue());
7740
8061
  }
7741
- /** Manually trigger a preview render (use when autoPreview is false). */
7742
8062
  renderNow() {
7743
8063
  var t;
7744
8064
  (t = this.scheduledRender) == null || t.cancel(), this.renderPreview(this.codeEditor.getValue());
@@ -7746,41 +8066,44 @@ class zr {
7746
8066
  setAutoPreview(t) {
7747
8067
  this.autoPreview = t, t && this.renderPreview(this.codeEditor.getValue()), this.updateStatusBar(this.codeEditor.getValue());
7748
8068
  }
7749
- /** Switch between simple and complex modes at runtime. */
7750
8069
  setMode(t) {
7751
- var n, r, a;
7752
- t !== this.mode && (this.mode = t, this.container.classList.remove("md-editor-mode-simple", "md-editor-mode-complex"), this.container.classList.add(`md-editor-mode-${t}`), this.codeEditor.setLineNumbers(t === "complex"), (n = this.toolbar) == null || n.destroy(), this.toolbar = null, (r = this.statusBar) == null || r.destroy(), this.statusBar = null, (a = this.activePopup) == null || a.destroy(), this.activePopup = null, t === "complex" && (this.buildToolbar(), this.buildStatusBar(), this.updateStatusBar(this.codeEditor.getValue())));
8070
+ var n, r, i;
8071
+ t !== this.mode && (this.mode = t, this.container.classList.remove("md-editor-mode-simple", "md-editor-mode-complex"), this.container.classList.add(`md-editor-mode-${t}`), this.codeEditor.setLineNumbers(t === "complex"), (n = this.toolbar) == null || n.destroy(), this.toolbar = null, (r = this.statusBar) == null || r.destroy(), this.statusBar = null, (i = this.activePopup) == null || i.destroy(), this.activePopup = null, t === "complex" && (this.buildToolbar(), this.buildStatusBar(), this.updateStatusBar(this.codeEditor.getValue())));
7753
8072
  }
7754
8073
  setTheme(t) {
7755
8074
  var n;
7756
- this.theme = t, this.container.setAttribute("data-theme", t), (n = this.toolbar) == null || n.setIcon("theme", t === "dark" ? D.sun : D.moon);
8075
+ this.theme = t, this.container.setAttribute("data-theme", t), (n = this.toolbar) == null || n.setIcon("theme", t === "dark" ? I.sun : I.moon);
7757
8076
  }
7758
8077
  focus() {
7759
8078
  this.codeEditor.focus();
7760
8079
  }
7761
8080
  destroy() {
7762
- var t, n, r, a, c;
7763
- (t = this.scheduledRender) == null || t.cancel(), this.scheduledRender = null, (n = this.activePopup) == null || n.destroy(), this.activePopup = null, this.codeEditor.destroy(), (r = this.toolbar) == null || r.destroy(), this.toolbar = null, (a = this.statusBar) == null || a.destroy(), this.statusBar = null, (c = this.incremental) == null || c.destroy(), this.incremental = null, this.container.innerHTML = "", this.container.classList.remove("md-editor-root", `md-editor-mode-${this.mode}`), this.container.removeAttribute("data-theme");
8081
+ var t, n, r, i, c;
8082
+ (t = this.scheduledRender) == null || t.cancel(), this.scheduledRender = null, (n = this.activePopup) == null || n.destroy(), this.activePopup = null, this.codeEditor.destroy(), (r = this.toolbar) == null || r.destroy(), this.toolbar = null, (i = this.statusBar) == null || i.destroy(), this.statusBar = null, (c = this.incremental) == null || c.destroy(), this.incremental = null, this.container.innerHTML = "", this.container.classList.remove("md-editor-root", `md-editor-mode-${this.mode}`), this.container.removeAttribute("data-theme");
7764
8083
  }
7765
8084
  }
7766
8085
  export {
7767
- zt as CodeEditor,
7768
- Ar as IncrementalRenderer,
7769
- zr as MarkdownEditor,
7770
- Se as Popup,
7771
- yr as Renderer,
7772
- vr as StatusBar,
7773
- wr as Toolbar,
7774
- Cr as adaptiveDebounceMs,
7775
- Fr as cancelIdle,
7776
- Ze as countText,
7777
- Rr as debounce,
7778
- hr as extractYouTubeId,
7779
- D as icons,
7780
- fr as imageMarkdown,
7781
- br as isVideoFile,
7782
- $r as scheduleIdle,
7783
- kr as splitIntoBlocks,
7784
- _r as videoMarkdown,
7785
- mr as youTubeEmbedMarkdown
8086
+ qt as CodeEditor,
8087
+ Fr as DEFAULT_SHORTCUTS,
8088
+ Pr as IncrementalRenderer,
8089
+ jr as MarkdownEditor,
8090
+ le as Popup,
8091
+ Rt as Renderer,
8092
+ xr as StatusBar,
8093
+ Or as Toolbar,
8094
+ Ur as adaptiveDebounceMs,
8095
+ Qr as cancelIdle,
8096
+ Je as countText,
8097
+ $r as debounce,
8098
+ yr as extractYouTubeId,
8099
+ Hr as formatShortcut,
8100
+ I as icons,
8101
+ Xe as imageMarkdown,
8102
+ vr as isVideoFile,
8103
+ Jr as matchShortcut,
8104
+ Vr as renderMarkdown,
8105
+ Xr as scheduleIdle,
8106
+ Br as splitIntoBlocks,
8107
+ kr as videoMarkdown,
8108
+ wr as youTubeEmbedMarkdown
7786
8109
  };