@powerduck/md-editor 0.10.0 → 0.10.2

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
@@ -47,17 +47,17 @@ class Zt {
47
47
  return !1;
48
48
  }
49
49
  findTrigger() {
50
- const { head: e } = this.view.state.selection.main, t = this.view.state.doc.lineAt(e), i = t.text, s = e - t.from;
51
- for (let a = s - 1; a >= 0; a--) {
52
- const r = i[a];
53
- if (r === "@") {
50
+ const { head: e } = this.view.state.selection.main, t = this.view.state.doc.lineAt(e), i = t.text, r = e - t.from;
51
+ for (let a = r - 1; a >= 0; a--) {
52
+ const s = i[a];
53
+ if (s === "@") {
54
54
  if (a === 0 || /\s|[^\w@]/.test(i[a - 1])) {
55
- const o = i.slice(a + 1, s);
55
+ const o = i.slice(a + 1, r);
56
56
  return /\s/.test(o) ? null : { from: t.from + a, query: o };
57
57
  }
58
58
  return null;
59
59
  }
60
- if (/\s/.test(r)) break;
60
+ if (/\s/.test(s)) break;
61
61
  }
62
62
  return null;
63
63
  }
@@ -72,9 +72,9 @@ class Zt {
72
72
  return;
73
73
  }
74
74
  try {
75
- const s = await this.options.onMentionSearch(e);
75
+ const r = await this.options.onMentionSearch(e);
76
76
  if (t || this.destroyed) return;
77
- this.items = s.slice(0, this.options.maxItems), this.selectedIndex = 0, this.items.length > 0 ? this.show() : this.hide();
77
+ this.items = r.slice(0, this.options.maxItems), this.selectedIndex = 0, this.items.length > 0 ? this.show() : this.hide();
78
78
  } catch {
79
79
  t || this.hide();
80
80
  }
@@ -88,13 +88,13 @@ class Zt {
88
88
  const a = i.target.closest(".md-editor-mention-item");
89
89
  if (!a) return;
90
90
  i.preventDefault(), i.stopPropagation();
91
- const r = Number(a.dataset.index);
92
- Number.isNaN(r) || this.selectItem(r);
91
+ const s = Number(a.dataset.index);
92
+ Number.isNaN(s) || this.selectItem(s);
93
93
  }), this.dropdown.addEventListener("mouseover", (i) => {
94
94
  const a = i.target.closest(".md-editor-mention-item");
95
95
  if (!a) return;
96
- const r = Number(a.dataset.index);
97
- !Number.isNaN(r) && r !== this.selectedIndex && (this.selectedIndex = r, this.updateActiveClass());
96
+ const s = Number(a.dataset.index);
97
+ !Number.isNaN(s) && s !== this.selectedIndex && (this.selectedIndex = s, this.updateActiveClass());
98
98
  });
99
99
  }
100
100
  this.renderDropdown(), this.positionDropdown();
@@ -104,17 +104,17 @@ class Zt {
104
104
  this.dropdown && (this.dropdown.innerHTML = "", this.items.forEach((e, t) => {
105
105
  const i = document.createElement("div");
106
106
  if (i.className = "md-editor-mention-item" + (t === this.selectedIndex ? " is-active" : ""), i.setAttribute("role", "option"), i.setAttribute("aria-selected", t === this.selectedIndex ? "true" : "false"), i.dataset.index = String(t), e.avatar) {
107
- const r = document.createElement("img");
108
- r.className = "md-editor-mention-avatar", r.src = e.avatar, r.alt = "", i.appendChild(r);
107
+ const s = document.createElement("img");
108
+ s.className = "md-editor-mention-avatar", s.src = e.avatar, s.alt = "", i.appendChild(s);
109
109
  }
110
- const s = document.createElement("div");
111
- s.className = "md-editor-mention-text";
110
+ const r = document.createElement("div");
111
+ r.className = "md-editor-mention-text";
112
112
  const a = document.createElement("div");
113
- if (a.className = "md-editor-mention-label", a.textContent = e.label, s.appendChild(a), e.description) {
114
- const r = document.createElement("div");
115
- r.className = "md-editor-mention-desc", r.textContent = e.description, s.appendChild(r);
113
+ if (a.className = "md-editor-mention-label", a.textContent = e.label, r.appendChild(a), e.description) {
114
+ const s = document.createElement("div");
115
+ s.className = "md-editor-mention-desc", s.textContent = e.description, r.appendChild(s);
116
116
  }
117
- i.appendChild(s), this.dropdown.appendChild(i);
117
+ i.appendChild(r), this.dropdown.appendChild(i);
118
118
  }));
119
119
  }
120
120
  /** Update the active-item CSS class without rebuilding the DOM. */
@@ -122,8 +122,8 @@ class Zt {
122
122
  if (!this.dropdown) return;
123
123
  const e = this.dropdown.children;
124
124
  for (let t = 0; t < e.length; t++) {
125
- const i = e[t], s = t === this.selectedIndex;
126
- i.classList.toggle("is-active", s), i.setAttribute("aria-selected", s ? "true" : "false");
125
+ const i = e[t], r = t === this.selectedIndex;
126
+ i.classList.toggle("is-active", r), i.setAttribute("aria-selected", r ? "true" : "false");
127
127
  }
128
128
  }
129
129
  positionDropdown() {
@@ -135,20 +135,24 @@ class Zt {
135
135
  e = null;
136
136
  }
137
137
  if (!e) {
138
- const r = this.view.dom.getBoundingClientRect();
139
- e = { top: r.top, bottom: r.top + 20, left: r.left };
138
+ const s = this.view.dom.getBoundingClientRect();
139
+ e = { top: s.top, bottom: s.top + 20, left: s.left };
140
140
  }
141
141
  const t = this.dropdown.getBoundingClientRect(), i = window.innerHeight;
142
- let s = e.bottom + 4, a = e.left;
143
- s + t.height > i - 8 && (s = e.top - t.height - 4), a = Math.max(8, Math.min(a, window.innerWidth - t.width - 8)), this.dropdown.style.top = `${s}px`, this.dropdown.style.left = `${a}px`;
142
+ let r = e.bottom + 4, a = e.left;
143
+ r + t.height > i - 8 && (r = e.top - t.height - 4), a = Math.max(8, Math.min(a, window.innerWidth - t.width - 8)), this.dropdown.style.top = `${r}px`, this.dropdown.style.left = `${a}px`;
144
144
  }
145
145
  selectItem(e) {
146
146
  const t = this.items[e], i = this.trigger;
147
147
  if (!t || !i) return;
148
- const s = this.options.onMentionSelect(t), a = i.from, r = this.activeHead;
148
+ const r = this.options.onMentionSelect(t);
149
+ this.options.onMentionSelect !== void 0 && !r.includes("](mention:") && r.startsWith("@") && console.warn(
150
+ "[md-editor] onMentionSelect returned plain '@" + t.label + "'. For badge rendering in the preview, return '[@" + t.label + "](mention:" + t.id + ")' instead, or omit onMentionSelect to use the default wrapper."
151
+ );
152
+ const a = i.from, s = this.activeHead;
149
153
  this.view.focus(), this.view.dispatch({
150
- changes: { from: a, to: r, insert: s },
151
- selection: { anchor: a + s.length }
154
+ changes: { from: a, to: s, insert: r },
155
+ selection: { anchor: a + r.length }
152
156
  }), this.hide();
153
157
  }
154
158
  hide() {
@@ -160,17 +164,17 @@ class Zt {
160
164
  }
161
165
  }
162
166
  function Vt(n) {
163
- const e = n.renderer.rules.link_open ?? ((s, a, r, o, c) => c.renderToken(s, a, r)), t = n.renderer.rules.link_close ?? ((s, a, r, o, c) => c.renderToken(s, a, r));
167
+ const e = n.renderer.rules.link_open ?? ((r, a, s, o, c) => c.renderToken(r, a, s)), t = n.renderer.rules.link_close ?? ((r, a, s, o, c) => c.renderToken(r, a, s));
164
168
  let i = !1;
165
- n.renderer.rules.link_open = (s, a, r, o, c) => {
166
- const l = s[a], d = (l == null ? void 0 : l.attrGet("href")) ?? "";
169
+ n.renderer.rules.link_open = (r, a, s, o, c) => {
170
+ const l = r[a], d = (l == null ? void 0 : l.attrGet("href")) ?? "";
167
171
  if (typeof d == "string" && d.startsWith("mention:")) {
168
172
  i = !0;
169
- const u = d.slice(8);
170
- return `<span class="md-editor-mention" data-mention-id="${Xt(u)}">`;
173
+ const h = d.slice(8);
174
+ return `<span class="md-editor-mention" data-mention-id="${Xt(h)}">`;
171
175
  }
172
- return i = !1, e(s, a, r, o, c);
173
- }, n.renderer.rules.link_close = (s, a, r, o, c) => i ? (i = !1, "</span>") : t(s, a, r, o, c);
176
+ return i = !1, e(r, a, s, o, c);
177
+ }, n.renderer.rules.link_close = (r, a, s, o, c) => i ? (i = !1, "</span>") : t(r, a, s, o, c);
174
178
  }
175
179
  function Xt(n) {
176
180
  return n.replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
@@ -182,12 +186,12 @@ async function Qt(n) {
182
186
  return Jt(t, n);
183
187
  }
184
188
  function Jt(n, e) {
185
- var c, l, d, u, p, m, y;
189
+ var c, l, d, h, p, m, b;
186
190
  const t = {}, i = new DOMParser().parseFromString(n, "text/html"), a = ((c = i.querySelector('meta[property="og:title"]')) == null ? void 0 : c.getAttribute("content")) ?? ((l = i.querySelector("title")) == null ? void 0 : l.textContent) ?? void 0;
187
191
  a && (t.title = a.trim());
188
- const r = ((d = i.querySelector('meta[property="og:description"]')) == null ? void 0 : d.getAttribute("content")) ?? ((u = i.querySelector('meta[name="description"]')) == null ? void 0 : u.getAttribute("content"));
189
- r && (t.description = r.trim());
190
- const o = ((p = i.querySelector('meta[property="og:image"]')) == null ? void 0 : p.getAttribute("content")) ?? ((m = i.querySelector('meta[property="og:image:secure_url"]')) == null ? void 0 : m.getAttribute("content")) ?? ((y = i.querySelector('meta[name="twitter:image"]')) == null ? void 0 : y.getAttribute("content"));
192
+ const s = ((d = i.querySelector('meta[property="og:description"]')) == null ? void 0 : d.getAttribute("content")) ?? ((h = i.querySelector('meta[name="description"]')) == null ? void 0 : h.getAttribute("content"));
193
+ s && (t.description = s.trim());
194
+ const o = ((p = i.querySelector('meta[property="og:image"]')) == null ? void 0 : p.getAttribute("content")) ?? ((m = i.querySelector('meta[property="og:image:secure_url"]')) == null ? void 0 : m.getAttribute("content")) ?? ((b = i.querySelector('meta[name="twitter:image"]')) == null ? void 0 : b.getAttribute("content"));
191
195
  return o && (t.thumbnail = o.startsWith("http") ? o : new URL(o, e).href), t;
192
196
  }
193
197
  class jt {
@@ -230,13 +234,13 @@ class jt {
230
234
  return !1;
231
235
  }
232
236
  findTrigger() {
233
- const { head: e } = this.view.state.selection.main, t = this.view.state.doc.lineAt(e), i = t.text, s = e - t.from, a = this.options.triggerChar;
234
- for (let r = s - 1; r >= 0; r--) {
235
- const o = i[r];
237
+ const { head: e } = this.view.state.selection.main, t = this.view.state.doc.lineAt(e), i = t.text, r = e - t.from, a = this.options.triggerChar;
238
+ for (let s = r - 1; s >= 0; s--) {
239
+ const o = i[s];
236
240
  if (o === a) {
237
- if (r === 0 || /\s/.test(i[r - 1])) {
238
- const c = i.slice(r + 1, s);
239
- return /\s/.test(c) ? null : { from: t.from + r, query: c };
241
+ if (s === 0 || /\s/.test(i[s - 1])) {
242
+ const c = i.slice(s + 1, r);
243
+ return /\s/.test(c) ? null : { from: t.from + s, query: c };
240
244
  }
241
245
  return null;
242
246
  }
@@ -255,9 +259,9 @@ class jt {
255
259
  return;
256
260
  }
257
261
  try {
258
- const s = await this.options.onDocSearch(e);
262
+ const r = await this.options.onDocSearch(e);
259
263
  if (t || this.destroyed) return;
260
- this.items = s.slice(0, this.options.maxItems), this.selectedIndex = 0, this.items.length > 0 ? this.show() : this.hide();
264
+ this.items = r.slice(0, this.options.maxItems), this.selectedIndex = 0, this.items.length > 0 ? this.show() : this.hide();
261
265
  } catch {
262
266
  t || this.hide();
263
267
  }
@@ -271,13 +275,13 @@ class jt {
271
275
  const a = i.target.closest(".md-editor-doclink-item");
272
276
  if (!a) return;
273
277
  i.preventDefault(), i.stopPropagation();
274
- const r = Number(a.dataset.index);
275
- Number.isNaN(r) || this.selectItem(r);
278
+ const s = Number(a.dataset.index);
279
+ Number.isNaN(s) || this.selectItem(s);
276
280
  }), this.dropdown.addEventListener("mouseover", (i) => {
277
281
  const a = i.target.closest(".md-editor-doclink-item");
278
282
  if (!a) return;
279
- const r = Number(a.dataset.index);
280
- !Number.isNaN(r) && r !== this.selectedIndex && (this.selectedIndex = r, this.updateActiveClass());
283
+ const s = Number(a.dataset.index);
284
+ !Number.isNaN(s) && s !== this.selectedIndex && (this.selectedIndex = s, this.updateActiveClass());
281
285
  });
282
286
  }
283
287
  this.renderDropdown(), this.positionDropdown();
@@ -290,21 +294,21 @@ class jt {
290
294
  const o = document.createElement("img");
291
295
  o.className = "md-editor-doclink-thumb-img", o.src = e.thumbnail, o.alt = "", i.appendChild(o);
292
296
  }
293
- const s = document.createElement("div");
294
- s.className = "md-editor-doclink-text";
297
+ const r = document.createElement("div");
298
+ r.className = "md-editor-doclink-text";
295
299
  const a = document.createElement("div");
296
- if (a.className = "md-editor-doclink-label", a.textContent = e.title, s.appendChild(a), e.description) {
300
+ if (a.className = "md-editor-doclink-label", a.textContent = e.title, r.appendChild(a), e.description) {
297
301
  const o = document.createElement("div");
298
- o.className = "md-editor-doclink-desc", o.textContent = e.description, s.appendChild(o);
302
+ o.className = "md-editor-doclink-desc", o.textContent = e.description, r.appendChild(o);
299
303
  }
300
- const r = document.createElement("div");
301
- r.className = "md-editor-doclink-url";
304
+ const s = document.createElement("div");
305
+ s.className = "md-editor-doclink-url";
302
306
  try {
303
- r.textContent = new URL(e.url).hostname;
307
+ s.textContent = new URL(e.url).hostname;
304
308
  } catch {
305
- r.textContent = e.url;
309
+ s.textContent = e.url;
306
310
  }
307
- s.appendChild(r), i.appendChild(s), this.dropdown.appendChild(i);
311
+ r.appendChild(s), i.appendChild(r), this.dropdown.appendChild(i);
308
312
  }));
309
313
  }
310
314
  /** Update the active-item CSS class without rebuilding the DOM. */
@@ -312,8 +316,8 @@ class jt {
312
316
  if (!this.dropdown) return;
313
317
  const e = this.dropdown.children;
314
318
  for (let t = 0; t < e.length; t++) {
315
- const i = e[t], s = t === this.selectedIndex;
316
- i.classList.toggle("is-active", s), i.setAttribute("aria-selected", s ? "true" : "false");
319
+ const i = e[t], r = t === this.selectedIndex;
320
+ i.classList.toggle("is-active", r), i.setAttribute("aria-selected", r ? "true" : "false");
317
321
  }
318
322
  }
319
323
  positionDropdown() {
@@ -325,24 +329,24 @@ class jt {
325
329
  e = null;
326
330
  }
327
331
  if (!e) {
328
- const r = this.view.dom.getBoundingClientRect();
329
- e = { top: r.top, bottom: r.top + 20, left: r.left };
332
+ const s = this.view.dom.getBoundingClientRect();
333
+ e = { top: s.top, bottom: s.top + 20, left: s.left };
330
334
  }
331
335
  const t = this.dropdown.getBoundingClientRect(), i = window.innerHeight;
332
- let s = e.bottom + 4, a = e.left;
333
- s + t.height > i - 8 && (s = e.top - t.height - 4), a = Math.max(8, Math.min(a, window.innerWidth - t.width - 8)), this.dropdown.style.top = `${s}px`, this.dropdown.style.left = `${a}px`;
336
+ let r = e.bottom + 4, a = e.left;
337
+ r + t.height > i - 8 && (r = e.top - t.height - 4), a = Math.max(8, Math.min(a, window.innerWidth - t.width - 8)), this.dropdown.style.top = `${r}px`, this.dropdown.style.left = `${a}px`;
334
338
  }
335
339
  async selectItem(e) {
336
340
  const t = this.items[e], i = this.trigger;
337
341
  if (!t || !i) return;
338
- const s = i.from, a = this.activeHead;
342
+ const r = i.from, a = this.activeHead;
339
343
  this.view.focus(), this.view.dispatch({
340
- changes: { from: s, to: a, insert: "" }
344
+ changes: { from: r, to: a, insert: "" }
341
345
  });
342
- const r = await this.buildInsertion(t);
346
+ const s = await this.buildInsertion(t);
343
347
  this.view.dispatch({
344
- changes: { from: s, insert: r },
345
- selection: { anchor: s + r.length }
348
+ changes: { from: r, insert: s },
349
+ selection: { anchor: r + s.length }
346
350
  }), this.hide();
347
351
  }
348
352
  /**
@@ -373,9 +377,9 @@ class jt {
373
377
  return `[${e.title}](${e.url})`;
374
378
  if (t === "card" && !a)
375
379
  return `[${e.title}](${e.url})`;
376
- const r = [`:::doc-link ${e.url}`];
377
- return r.push(`# ${i.title ?? e.title}`), i.thumbnail && r.push(`![thumbnail](${i.thumbnail})`), i.description && r.push(i.description), r.push(":::"), `
378
- ` + r.join(`
380
+ const s = [`:::doc-link ${e.url}`];
381
+ return s.push(`# ${i.title ?? e.title}`), i.thumbnail && s.push(`![thumbnail](${i.thumbnail})`), i.description && s.push(i.description), s.push(":::"), `
382
+ ` + s.join(`
379
383
  `) + `
380
384
  `;
381
385
  }
@@ -389,64 +393,64 @@ class jt {
389
393
  }
390
394
  const en = /^:::doc-link\s+(\S+)(?:\s+(.+))?$/, tn = /^:::\s*$/;
391
395
  function nn(n) {
392
- n.block.ruler.before("fence", "doclink_block", (e, t, i, s) => {
393
- const r = e.src.slice(e.bMarks[t], e.eMarks[t]).match(en);
394
- if (!r) return !1;
395
- const o = r[1] ?? "";
396
+ n.block.ruler.before("fence", "doclink_block", (e, t, i, r) => {
397
+ const s = e.src.slice(e.bMarks[t], e.eMarks[t]).match(en);
398
+ if (!s) return !1;
399
+ const o = s[1] ?? "";
396
400
  let c = t + 1, l = !1;
397
401
  for (; c < i; ) {
398
- const f = e.src.slice(e.bMarks[c], e.eMarks[c]);
399
- if (tn.test(f.trim())) {
402
+ const E = e.src.slice(e.bMarks[c], e.eMarks[c]);
403
+ if (tn.test(E.trim())) {
400
404
  l = !0;
401
405
  break;
402
406
  }
403
407
  c++;
404
408
  }
405
409
  if (!l) return !1;
406
- if (s) return !0;
410
+ if (r) return !0;
407
411
  const d = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).split(`
408
- `).map((f) => f.trim()).filter((f) => f.length > 0);
409
- let u = "", p = "";
412
+ `).map((E) => E.trim()).filter((E) => E.length > 0);
413
+ let h = "", p = "";
410
414
  const m = [];
411
- for (const f of d)
412
- if (f.startsWith("# "))
413
- u = f.slice(2).trim();
414
- else if (f.startsWith("![thumbnail](")) {
415
- const v = f.match(/^!\[thumbnail\]\((.+)\)$/);
416
- v && (p = v[1] ?? "");
415
+ for (const E of d)
416
+ if (E.startsWith("# "))
417
+ h = E.slice(2).trim();
418
+ else if (E.startsWith("![thumbnail](")) {
419
+ const N = E.match(/^!\[thumbnail\]\((.+)\)$/);
420
+ N && (p = N[1] ?? "");
417
421
  } else
418
- m.push(f);
419
- const y = e.push("doclink_block", "div", 0);
420
- return y.content = JSON.stringify({ url: o, title: u, thumbnail: p, description: m.join(" ") }), e.line = c + 1, !0;
422
+ m.push(E);
423
+ const b = e.push("doclink_block", "div", 0);
424
+ return b.content = JSON.stringify({ url: o, title: h, thumbnail: p, description: m.join(" ") }), e.line = c + 1, !0;
421
425
  }), n.renderer.rules.doclink_block = (e, t) => {
422
426
  const i = e[t];
423
427
  if (!i) return "";
424
- let s;
428
+ let r;
425
429
  try {
426
- s = JSON.parse(i.content);
430
+ r = JSON.parse(i.content);
427
431
  } catch {
428
432
  return "";
429
433
  }
430
- const { url: a, title: r, thumbnail: o, description: c } = s;
434
+ const { url: a, title: s, thumbnail: o, description: c } = r;
431
435
  let l = a;
432
436
  try {
433
437
  l = new URL(a).hostname;
434
438
  } catch {
435
439
  }
436
440
  const d = o ? `<div class="md-editor-doclink-card-thumb"><img src="${Fe(o)}" alt="" loading="lazy" /></div>` : "";
437
- return `<a class="md-editor-doclink-card" href="${Fe(a)}" target="_blank" rel="noopener noreferrer">` + d + `<div class="md-editor-doclink-card-body"><div class="md-editor-doclink-card-title">${Se(r)}</div>` + (c ? `<div class="md-editor-doclink-card-desc">${Se(c)}</div>` : "") + `<div class="md-editor-doclink-card-url">${Se(l)}</div></div></a>`;
441
+ return `<a class="md-editor-doclink-card" href="${Fe(a)}" target="_blank" rel="noopener noreferrer">` + d + `<div class="md-editor-doclink-card-body"><div class="md-editor-doclink-card-title">${Te(s)}</div>` + (c ? `<div class="md-editor-doclink-card-desc">${Te(c)}</div>` : "") + `<div class="md-editor-doclink-card-url">${Te(l)}</div></div></a>`;
438
442
  };
439
443
  }
440
- function Se(n) {
444
+ function Te(n) {
441
445
  return n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
442
446
  }
443
447
  function Fe(n) {
444
448
  return n.replace(/"/g, "&quot;").replace(/</g, "&lt;");
445
449
  }
446
- class sn {
450
+ class rn {
447
451
  constructor(e, t) {
448
- var s, a;
449
- this.lineNumbersCompartment = new Be(), this.customKeymapCompartment = new Be(), this.mention = null, this.docLink = null, this.onImageFile = t.onImageFile;
452
+ var r, a;
453
+ this.lineNumbersCompartment = new Be(), this.customKeymapCompartment = new Be(), this.mention = null, this.docLink = null, this.blurTimeout = null, this.destroyed = !1, this.onImageFile = t.onImageFile;
450
454
  const i = [
451
455
  zt(),
452
456
  $e.of([...Kt, ...Gt]),
@@ -454,50 +458,50 @@ class sn {
454
458
  qt({ codeLanguages: Wt }),
455
459
  ge.lineWrapping,
456
460
  this.lineNumbersCompartment.of(t.lineNumbers ? Ue() : []),
457
- ge.updateListener.of((r) => {
461
+ ge.updateListener.of((s) => {
458
462
  var o, c, l;
459
- (r.docChanged || r.selectionSet) && ((o = t.onChange) == null || o.call(t, r.state.doc.toString()), (c = this.mention) == null || c.update(), (l = this.docLink) == null || l.update());
463
+ s.docChanged && ((o = t.onChange) == null || o.call(t, s.state.doc.toString())), (s.docChanged || s.selectionSet) && ((c = this.mention) == null || c.update(), (l = this.docLink) == null || l.update());
460
464
  }),
461
465
  // Close dropdowns when the editor loses focus
462
466
  ge.domEventHandlers({
463
- paste: (r) => this.handlePaste(r),
464
- drop: (r) => this.handleDrop(r),
467
+ paste: (s) => this.handlePaste(s),
468
+ drop: (s) => this.handleDrop(s),
465
469
  blur: () => {
466
- window.setTimeout(() => {
467
- var r, o;
468
- this.view.dom.contains(document.activeElement) || ((r = this.mention) == null || r.hide(), (o = this.docLink) == null || o.hide());
470
+ this.blurTimeout = window.setTimeout(() => {
471
+ var s, o;
472
+ this.blurTimeout = null, !this.destroyed && (this.view.dom.contains(document.activeElement) || ((s = this.mention) == null || s.hide(), (o = this.docLink) == null || o.hide()));
469
473
  }, 150);
470
474
  },
471
- keydown: (r) => {
475
+ keydown: (s) => {
472
476
  var o, c;
473
- return !!((o = this.mention) != null && o.handleKey(r) || (c = this.docLink) != null && c.handleKey(r));
477
+ return !!((o = this.mention) != null && o.handleKey(s) || (c = this.docLink) != null && c.handleKey(s));
474
478
  }
475
479
  })
476
480
  ];
477
481
  this.view = new ge({
478
482
  state: Ft.create({ doc: t.value ?? "", extensions: i }),
479
483
  parent: e
480
- }), (s = t.mention) != null && s.onMentionSearch && (this.mention = new Zt(this.view, t.mention)), (a = t.docLink) != null && a.onDocSearch && (this.docLink = new jt(this.view, t.docLink));
484
+ }), (r = t.mention) != null && r.onMentionSearch && (this.mention = new Zt(this.view, t.mention)), (a = t.docLink) != null && a.onDocSearch && (this.docLink = new jt(this.view, t.docLink));
481
485
  }
482
486
  handlePaste(e) {
483
- var i, s;
487
+ var i, r;
484
488
  const t = (i = e.clipboardData) == null ? void 0 : i.items;
485
489
  if (!t) return !1;
486
490
  for (const a of Array.from(t))
487
491
  if (a.type.startsWith("image/")) {
488
- const r = a.getAsFile();
489
- if (r)
490
- return (s = this.onImageFile) == null || s.call(this, r), e.preventDefault(), !0;
492
+ const s = a.getAsFile();
493
+ if (s)
494
+ return (r = this.onImageFile) == null || r.call(this, s), e.preventDefault(), !0;
491
495
  }
492
496
  return !1;
493
497
  }
494
498
  handleDrop(e) {
495
- var i, s;
499
+ var i, r;
496
500
  const t = (i = e.dataTransfer) == null ? void 0 : i.files;
497
501
  if (!t || t.length === 0) return !1;
498
502
  for (const a of Array.from(t))
499
503
  if (a.type.startsWith("image/"))
500
- return (s = this.onImageFile) == null || s.call(this, a), e.preventDefault(), !0;
504
+ return (r = this.onImageFile) == null || r.call(this, a), e.preventDefault(), !0;
501
505
  return !1;
502
506
  }
503
507
  /**
@@ -534,12 +538,12 @@ class sn {
534
538
  * selected, insert prefix + placeholder + suffix and select the placeholder.
535
539
  */
536
540
  wrapSelection(e, t, i) {
537
- const { from: s, to: a } = this.view.state.selection.main, o = this.view.state.doc.sliceString(s, a) || i, c = `${e}${o}${t}`;
541
+ const { from: r, to: a } = this.view.state.selection.main, o = this.view.state.doc.sliceString(r, a) || i, c = `${e}${o}${t}`;
538
542
  this.view.dispatch({
539
- changes: { from: s, to: a, insert: c },
543
+ changes: { from: r, to: a, insert: c },
540
544
  selection: {
541
- anchor: s + e.length,
542
- head: s + e.length + o.length
545
+ anchor: r + e.length,
546
+ head: r + e.length + o.length
543
547
  }
544
548
  }), this.view.focus();
545
549
  }
@@ -553,21 +557,21 @@ class sn {
553
557
  * ordered list, etc. If nothing is selected, inserts prefix + placeholder.
554
558
  */
555
559
  wrapLines(e, t) {
556
- const { from: i, to: s } = this.view.state.selection.main;
557
- let a = this.view.state.doc.sliceString(i, s);
560
+ const { from: i, to: r } = this.view.state.selection.main;
561
+ let a = this.view.state.doc.sliceString(i, r);
558
562
  if (a) {
559
563
  const o = a.split(`
560
564
  `).map((c) => `${e}${c}`).join(`
561
565
  `);
562
566
  this.view.dispatch({
563
- changes: { from: i, to: s, insert: o },
567
+ changes: { from: i, to: r, insert: o },
564
568
  selection: { anchor: i, head: i + o.length }
565
569
  });
566
570
  } else {
567
- const r = this.view.state.doc.lineAt(i);
568
- a = r.text;
569
- const o = r.from, c = r.to, d = (a ? a.split(`
570
- `) : [t]).map((u) => `${e}${u}`).join(`
571
+ const s = this.view.state.doc.lineAt(i);
572
+ a = s.text;
573
+ const o = s.from, c = s.to, d = (a ? a.split(`
574
+ `) : [t]).map((h) => `${e}${h}`).join(`
571
575
  `);
572
576
  this.view.dispatch({
573
577
  changes: { from: o, to: c, insert: d },
@@ -598,34 +602,34 @@ class sn {
598
602
  * otherwise → check all. Plain lines or `- ` lists get `- [ ] ` prepended.
599
603
  */
600
604
  toggleTaskList() {
601
- const { from: e, to: t } = this.view.state.selection.main, i = this.view.state.doc.lineAt(e), s = this.view.state.doc.lineAt(t), a = [];
602
- for (let p = i.number; p <= s.number; p++)
605
+ const { from: e, to: t } = this.view.state.selection.main, i = this.view.state.doc.lineAt(e), r = this.view.state.doc.lineAt(t), a = [];
606
+ for (let p = i.number; p <= r.number; p++)
603
607
  a.push(this.view.state.doc.line(p).text);
604
- const r = /^- \[\s*(?:[xX])?\s*\](\s|$)/, o = /^- \[\s*\](\s|$)/, c = a.every((p) => r.test(p)), l = a.every((p) => o.test(p)), u = a.map((p) => c ? l ? p.replace(/^- \[\s*\](\s?)/, "- [x]$1") : p.replace(/^- \[\s*[xX]\s*\](\s?)/, "- [ ]$1") : /^-(\s|$)/.test(p) ? p.replace(/^-(\s?)/, "- [ ]$1") : `- [ ] ${p}`).join(`
608
+ const s = /^- \[\s*(?:[xX])?\s*\](\s|$)/, o = /^- \[\s*\](\s|$)/, c = a.every((p) => s.test(p)), l = a.every((p) => o.test(p)), h = a.map((p) => c ? l ? p.replace(/^- \[\s*\](\s?)/, "- [x]$1") : p.replace(/^- \[\s*[xX]\s*\](\s?)/, "- [ ]$1") : /^-(\s|$)/.test(p) ? p.replace(/^-(\s?)/, "- [ ]$1") : `- [ ] ${p}`).join(`
605
609
  `);
606
610
  this.view.dispatch({
607
- changes: { from: i.from, to: s.to, insert: u },
608
- selection: { anchor: i.from, head: i.from + u.length }
611
+ changes: { from: i.from, to: r.to, insert: h },
612
+ selection: { anchor: i.from, head: i.from + h.length }
609
613
  }), this.view.focus();
610
614
  }
611
615
  destroy() {
612
616
  var e, t;
613
- (e = this.mention) == null || e.destroy(), (t = this.docLink) == null || t.destroy(), this.view.destroy();
617
+ this.destroyed = !0, this.blurTimeout !== null && (window.clearTimeout(this.blurTimeout), this.blurTimeout = null), (e = this.mention) == null || e.destroy(), (t = this.docLink) == null || t.destroy(), this.view.destroy();
614
618
  }
615
619
  }
616
- const rn = /^\$([^$\n]+?)\$/;
620
+ const sn = /^\$([^$\n]+?)\$/;
617
621
  function on(n) {
618
622
  return /^[\d.,]+$/.test(n.trim());
619
623
  }
620
624
  function an(n) {
621
- n.block.ruler.before("fence", "math_block", (e, t, i, s) => {
625
+ n.block.ruler.before("fence", "math_block", (e, t, i, r) => {
622
626
  const a = e.src.slice(e.bMarks[t], e.eMarks[t]);
623
627
  if (!a.startsWith("$$")) return !1;
624
- const r = a.match(/^\$\$(.+?)\$\$\s*$/);
625
- if (r) {
626
- if (s) return !0;
627
- const u = e.push("math_block", "div", 0);
628
- return u.content = r[1].trim(), u.markup = "$$", e.line = t + 1, !0;
628
+ const s = a.match(/^\$\$(.+?)\$\$\s*$/);
629
+ if (s) {
630
+ if (r) return !0;
631
+ const h = e.push("math_block", "div", 0);
632
+ return h.content = s[1].trim(), h.markup = "$$", e.line = t + 1, !0;
629
633
  }
630
634
  let o = t + 1, c = !1;
631
635
  for (; o < e.lineMax; ) {
@@ -636,12 +640,12 @@ function an(n) {
636
640
  o++;
637
641
  }
638
642
  if (!c) return !1;
639
- if (s) return !0;
643
+ if (r) return !0;
640
644
  const l = e.src.slice(e.bMarks[t] + 2, e.eMarks[o] - 2).trim(), d = e.push("math_block", "div", 0);
641
645
  return d.content = l, d.markup = "$$", e.line = o + 1, !0;
642
646
  }), n.renderer.rules.math_block = (e, t) => {
643
- var s;
644
- const i = ((s = e[t]) == null ? void 0 : s.content) ?? "";
647
+ var r;
648
+ const i = ((r = e[t]) == null ? void 0 : r.content) ?? "";
645
649
  try {
646
650
  return `<div class="md-editor-math-block">${He.renderToString(i, {
647
651
  displayMode: !0,
@@ -653,16 +657,16 @@ function an(n) {
653
657
  }
654
658
  }, n.inline.ruler.after("escape", "math_inline", (e, t) => {
655
659
  if (e.src[e.pos] !== "$" || e.src[e.pos + 1] === "$") return !1;
656
- const i = e.src.slice(e.pos).match(rn);
660
+ const i = e.src.slice(e.pos).match(sn);
657
661
  if (!i) return !1;
658
- const s = i[1] ?? "";
659
- if (on(s)) return !1;
662
+ const r = i[1] ?? "";
663
+ if (on(r)) return !1;
660
664
  if (t) return !0;
661
665
  const a = e.push("math_inline", "span", 0);
662
- return a.content = s, a.markup = "$", e.pos += i[0].length, !0;
666
+ return a.content = r, a.markup = "$", e.pos += i[0].length, !0;
663
667
  }), n.renderer.rules.math_inline = (e, t) => {
664
- var s;
665
- const i = ((s = e[t]) == null ? void 0 : s.content) ?? "";
668
+ var r;
669
+ const i = ((r = e[t]) == null ? void 0 : r.content) ?? "";
666
670
  try {
667
671
  return He.renderToString(i, {
668
672
  displayMode: !1,
@@ -690,44 +694,44 @@ function cn(n) {
690
694
  n.block.ruler.before(
691
695
  "fence",
692
696
  "mindmap_fence",
693
- (t, i, s, a) => {
694
- const r = t.bMarks[i] + t.tShift[i], o = t.eMarks[i], l = t.src.slice(r, o).match(/^(`{3,})\s*mindmap\s*$/i);
697
+ (t, i, r, a) => {
698
+ const s = t.bMarks[i] + t.tShift[i], o = t.eMarks[i], l = t.src.slice(s, o).match(/^(`{3,})\s*mindmap\s*$/i);
695
699
  if (!l) return !1;
696
700
  if (a) return !0;
697
701
  const d = l[1].length;
698
- let u = i + 1, p = 1;
699
- for (; u < s; ) {
700
- const f = t.bMarks[u] + t.tShift[u], v = t.eMarks[u], O = t.src.slice(f, v).match(/^(`{3,})\s*(.*)$/);
702
+ let h = i + 1, p = 1;
703
+ for (; h < r; ) {
704
+ const E = t.bMarks[h] + t.tShift[h], N = t.eMarks[h], O = t.src.slice(E, N).match(/^(`{3,})\s*(.*)$/);
701
705
  if (O && O[1].length >= d) {
702
706
  if (O[2].trim())
703
707
  p++;
704
708
  else if (p--, p === 0) break;
705
709
  }
706
- u++;
710
+ h++;
707
711
  }
708
- const m = u < s ? u : s - 1, y = t.push("mindmap_block", "div", 0);
709
- return y.content = t.getLines(
712
+ const m = h < r ? h : r - 1, b = t.push("mindmap_block", "div", 0);
713
+ return b.content = t.getLines(
710
714
  i + 1,
711
715
  m,
712
716
  t.blkIndent,
713
717
  !0
714
- ), y.map = [i, m + 1], y.markup = l[1], y.info = "mindmap", t.line = m + 1, !0;
718
+ ), b.map = [i, m + 1], b.markup = l[1], b.info = "mindmap", t.line = m + 1, !0;
715
719
  }
716
720
  ), n.renderer.rules.mindmap_block = (t, i) => {
717
- const s = t[i];
718
- if (!s) return "";
719
- const a = `md-editor-mindmap-${++Ke}`, r = encodeURIComponent(s.content);
720
- return `<div class="md-editor-mindmap" id="${a}" data-source="${r}"></div>`;
721
+ const r = t[i];
722
+ if (!r) return "";
723
+ const a = `md-editor-mindmap-${++Ke}`, s = encodeURIComponent(r.content);
724
+ return `<div class="md-editor-mindmap" id="${a}" data-source="${s}"></div>`;
721
725
  };
722
- const e = n.renderer.rules.fence ? n.renderer.rules.fence.bind(n.renderer.rules) : (t, i, s, a, r) => r.renderToken(t, i, s);
723
- n.renderer.rules.fence = (t, i, s, a, r) => {
726
+ const e = n.renderer.rules.fence ? n.renderer.rules.fence.bind(n.renderer.rules) : (t, i, r, a, s) => s.renderToken(t, i, r);
727
+ n.renderer.rules.fence = (t, i, r, a, s) => {
724
728
  const o = t[i];
725
- if (!o) return e(t, i, s, a, r);
729
+ if (!o) return e(t, i, r, a, s);
726
730
  if (o.info.trim().toLowerCase() === "mindmap") {
727
731
  const l = `md-editor-mindmap-${++Ke}`, d = encodeURIComponent(o.content);
728
732
  return `<div class="md-editor-mindmap" id="${l}" data-source="${d}"></div>`;
729
733
  }
730
- return e(t, i, s, a, r);
734
+ return e(t, i, r, a, s);
731
735
  };
732
736
  }
733
737
  const ln = 600, dn = 320;
@@ -736,37 +740,48 @@ async function un(n) {
736
740
  ".md-editor-mindmap:not([data-hydrated])"
737
741
  );
738
742
  if (e.length === 0) return;
739
- const { Transformer: t } = await import("markmap-lib"), i = await import("markmap-view"), s = i.Markmap ?? i.default;
740
- if (!s) return;
741
- const a = new t();
742
- for (const r of Array.from(e)) {
743
- r.setAttribute("data-hydrated", "1");
744
- const o = decodeURIComponent(r.dataset.source ?? "") || "- Empty mindmap", { root: c } = a.transform(o);
745
- r.innerHTML = "";
746
- const l = r.clientWidth > 0 ? r.clientWidth : ln, d = r.clientHeight > 0 ? r.clientHeight : dn, u = document.createElementNS("http://www.w3.org/2000/svg", "svg");
747
- u.setAttribute("width", String(l)), u.setAttribute("height", String(d)), u.style.width = "100%", u.style.height = "100%", u.style.display = "block", r.appendChild(u);
748
- const p = s.create(u, { autoFit: !1 }, c), m = () => {
749
- try {
750
- const f = u.querySelector("g");
751
- if (f) {
752
- const v = f.getAttribute("transform") || "";
753
- (!v || v.includes("NaN")) && f.setAttribute(
754
- "transform",
755
- `translate(40, ${d / 2}) scale(1)`
756
- );
743
+ let t, i;
744
+ try {
745
+ t = (await import("markmap-lib")).Transformer;
746
+ const s = await import("markmap-view");
747
+ i = s.Markmap ?? s.default;
748
+ } catch {
749
+ return;
750
+ }
751
+ if (!i || !t) return;
752
+ const r = new t();
753
+ for (const a of Array.from(e))
754
+ try {
755
+ a.setAttribute("data-hydrated", "1");
756
+ const s = decodeURIComponent(a.dataset.source ?? "") || "- Empty mindmap", { root: o } = r.transform(s);
757
+ a.innerHTML = "";
758
+ const c = a.clientWidth > 0 ? a.clientWidth : ln, l = a.clientHeight > 0 ? a.clientHeight : dn, d = document.createElementNS("http://www.w3.org/2000/svg", "svg");
759
+ d.setAttribute("width", String(c)), d.setAttribute("height", String(l)), d.style.width = "100%", d.style.height = "100%", d.style.display = "block", a.appendChild(d);
760
+ const h = i.create(d, { autoFit: !1 }, o), p = () => {
761
+ try {
762
+ const b = d.querySelector("g");
763
+ if (b) {
764
+ const E = b.getAttribute("transform") || "";
765
+ (!E || E.includes("NaN")) && b.setAttribute(
766
+ "transform",
767
+ `translate(40, ${l / 2}) scale(1)`
768
+ );
769
+ }
770
+ } catch {
757
771
  }
758
- } catch {
759
- }
760
- };
761
- m(), (typeof requestAnimationFrame == "function" ? requestAnimationFrame : (f) => setTimeout(f, 16))(() => {
762
- var f;
763
- try {
764
- const v = u.getBoundingClientRect();
765
- v.width > 0 && v.height > 0 && ((f = p.fit) == null || f.call(p), m());
766
- } catch {
767
- }
768
- });
769
- }
772
+ };
773
+ p(), (typeof requestAnimationFrame == "function" ? requestAnimationFrame : (b) => setTimeout(b, 16))(() => {
774
+ var b;
775
+ try {
776
+ if (!a.isConnected) return;
777
+ const E = d.getBoundingClientRect();
778
+ E.width > 0 && E.height > 0 && ((b = h.fit) == null || b.call(h), p());
779
+ } catch {
780
+ }
781
+ });
782
+ } catch {
783
+ a.removeAttribute("data-hydrated");
784
+ }
770
785
  }
771
786
  function hn(n) {
772
787
  return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
@@ -792,7 +807,7 @@ class Ge {
792
807
  this.isMatchIgnored = !0;
793
808
  }
794
809
  }
795
- function st(n) {
810
+ function rt(n) {
796
811
  return n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;");
797
812
  }
798
813
  function J(n, ...e) {
@@ -800,8 +815,8 @@ function J(n, ...e) {
800
815
  for (const i in n)
801
816
  t[i] = n[i];
802
817
  return e.forEach(function(i) {
803
- for (const s in i)
804
- t[s] = i[s];
818
+ for (const r in i)
819
+ t[r] = i[r];
805
820
  }), /** @type {T} */
806
821
  t;
807
822
  }
@@ -812,7 +827,7 @@ const pn = "</span>", qe = (n) => !!n.scope, gn = (n, { prefix: e }) => {
812
827
  const t = n.split(".");
813
828
  return [
814
829
  `${e}${t.shift()}`,
815
- ...t.map((i, s) => `${i}${"_".repeat(s + 1)}`)
830
+ ...t.map((i, r) => `${i}${"_".repeat(r + 1)}`)
816
831
  ].join(" ");
817
832
  }
818
833
  return `${e}${n}`;
@@ -832,7 +847,7 @@ class mn {
832
847
  *
833
848
  * @param {string} text */
834
849
  addText(e) {
835
- this.buffer += st(e);
850
+ this.buffer += rt(e);
836
851
  }
837
852
  /**
838
853
  * Adds a node open to the output stream (if needed)
@@ -962,7 +977,7 @@ class fn extends Ae {
962
977
  function de(n) {
963
978
  return n ? typeof n == "string" ? n : n.source : null;
964
979
  }
965
- function rt(n) {
980
+ function st(n) {
966
981
  return ne("(?=", n, ")");
967
982
  }
968
983
  function bn(n) {
@@ -1006,17 +1021,17 @@ function xe(n, { joinWith: e }) {
1006
1021
  let t = 0;
1007
1022
  return n.map((i) => {
1008
1023
  t += 1;
1009
- const s = t;
1010
- let a = de(i), r = "";
1024
+ const r = t;
1025
+ let a = de(i), s = "";
1011
1026
  for (; a.length > 0; ) {
1012
1027
  const o = wn.exec(a);
1013
1028
  if (!o) {
1014
- r += a;
1029
+ s += a;
1015
1030
  break;
1016
1031
  }
1017
- r += a.substring(0, o.index), a = a.substring(o.index + o[0].length), o[0][0] === "\\" && o[1] ? r += "\\" + String(Number(o[1]) + s) : (r += o[0], (o[0] === "(" || /^\(\?[<']/.test(o[0])) && t++);
1032
+ s += a.substring(0, o.index), a = a.substring(o.index + o[0].length), o[0][0] === "\\" && o[1] ? s += "\\" + String(Number(o[1]) + r) : (s += o[0], (o[0] === "(" || /^\(\?[<']/.test(o[0])) && t++);
1018
1033
  }
1019
- return r;
1034
+ return s;
1020
1035
  }).map((i) => `(${i})`).join(e);
1021
1036
  }
1022
1037
  const vn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\\d+)?", lt = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)", dt = "\\b(0b[01]+)", kn = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", Nn = (n = {}) => {
@@ -1039,13 +1054,13 @@ const vn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
1039
1054
  }, ue = {
1040
1055
  begin: "\\\\[\\s\\S]",
1041
1056
  relevance: 0
1042
- }, Sn = {
1057
+ }, Tn = {
1043
1058
  scope: "string",
1044
1059
  begin: "'",
1045
1060
  end: "'",
1046
1061
  illegal: "\\n",
1047
1062
  contains: [ue]
1048
- }, Tn = {
1063
+ }, Sn = {
1049
1064
  scope: "string",
1050
1065
  begin: '"',
1051
1066
  end: '"',
@@ -1072,7 +1087,7 @@ const vn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
1072
1087
  excludeBegin: !0,
1073
1088
  relevance: 0
1074
1089
  });
1075
- const s = ye(
1090
+ const r = ye(
1076
1091
  // list of common 1 and 2 letter words in English
1077
1092
  "I",
1078
1093
  "a",
@@ -1112,7 +1127,7 @@ const vn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
1112
1127
  /[ ]+/,
1113
1128
  // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */
1114
1129
  "(",
1115
- s,
1130
+ r,
1116
1131
  /[.]?[:]?([.][ ]|[ ])/,
1117
1132
  "){3}"
1118
1133
  )
@@ -1173,7 +1188,7 @@ const vn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
1173
1188
  };
1174
1189
  var me = /* @__PURE__ */ Object.freeze({
1175
1190
  __proto__: null,
1176
- APOS_STRING_MODE: Sn,
1191
+ APOS_STRING_MODE: Tn,
1177
1192
  BACKSLASH_ESCAPE: ue,
1178
1193
  BINARY_NUMBER_MODE: In,
1179
1194
  BINARY_NUMBER_RE: dt,
@@ -1190,7 +1205,7 @@ var me = /* @__PURE__ */ Object.freeze({
1190
1205
  NUMBER_MODE: Rn,
1191
1206
  NUMBER_RE: ct,
1192
1207
  PHRASAL_WORDS_MODE: An,
1193
- QUOTE_STRING_MODE: Tn,
1208
+ QUOTE_STRING_MODE: Sn,
1194
1209
  REGEXP_MODE: Ln,
1195
1210
  RE_STARTERS_RE: kn,
1196
1211
  SHEBANG: Nn,
@@ -1225,7 +1240,7 @@ const qn = (n, e) => {
1225
1240
  const t = Object.assign({}, n);
1226
1241
  Object.keys(n).forEach((i) => {
1227
1242
  delete n[i];
1228
- }), n.keywords = t.keywords, n.begin = ne(t.beforeMatch, rt(t.begin)), n.starts = {
1243
+ }), n.keywords = t.keywords, n.begin = ne(t.beforeMatch, st(t.begin)), n.starts = {
1229
1244
  relevance: 0,
1230
1245
  contains: [
1231
1246
  Object.assign(t, { endsParent: !0 })
@@ -1249,14 +1264,14 @@ const qn = (n, e) => {
1249
1264
  ], Yn = "keyword";
1250
1265
  function ut(n, e, t = Yn) {
1251
1266
  const i = /* @__PURE__ */ Object.create(null);
1252
- return typeof n == "string" ? s(t, n.split(" ")) : Array.isArray(n) ? s(t, n) : Object.keys(n).forEach(function(a) {
1267
+ return typeof n == "string" ? r(t, n.split(" ")) : Array.isArray(n) ? r(t, n) : Object.keys(n).forEach(function(a) {
1253
1268
  Object.assign(
1254
1269
  i,
1255
1270
  ut(n[a], e, a)
1256
1271
  );
1257
1272
  }), i;
1258
- function s(a, r) {
1259
- e && (r = r.map((o) => o.toLowerCase())), r.forEach(function(o) {
1273
+ function r(a, s) {
1274
+ e && (s = s.map((o) => o.toLowerCase())), s.forEach(function(o) {
1260
1275
  const c = o.split("|");
1261
1276
  i[c[0]] = [a, Zn(c[0], c[1])];
1262
1277
  });
@@ -1277,10 +1292,10 @@ const Ye = {}, te = (n) => {
1277
1292
  }, _e = new Error();
1278
1293
  function ht(n, e, { key: t }) {
1279
1294
  let i = 0;
1280
- const s = n[t], a = {}, r = {};
1295
+ const r = n[t], a = {}, s = {};
1281
1296
  for (let o = 1; o <= e.length; o++)
1282
- r[o + i] = s[o], a[o + i] = !0, i += ot(e[o - 1]);
1283
- n[t] = r, n[t]._emit = a, n[t]._multi = !0;
1297
+ s[o + i] = r[o], a[o + i] = !0, i += ot(e[o - 1]);
1298
+ n[t] = s, n[t]._emit = a, n[t]._multi = !0;
1284
1299
  }
1285
1300
  function Xn(n) {
1286
1301
  if (Array.isArray(n.begin)) {
@@ -1307,9 +1322,9 @@ function jn(n) {
1307
1322
  Jn(n), typeof n.beginScope == "string" && (n.beginScope = { _wrap: n.beginScope }), typeof n.endScope == "string" && (n.endScope = { _wrap: n.endScope }), Xn(n), Qn(n);
1308
1323
  }
1309
1324
  function ei(n) {
1310
- function e(r, o) {
1325
+ function e(s, o) {
1311
1326
  return new RegExp(
1312
- de(r),
1327
+ de(s),
1313
1328
  "m" + (n.case_insensitive ? "i" : "") + (n.unicodeRegex ? "u" : "") + (o ? "g" : "")
1314
1329
  );
1315
1330
  }
@@ -1332,7 +1347,7 @@ function ei(n) {
1332
1347
  const c = this.matcherRe.exec(o);
1333
1348
  if (!c)
1334
1349
  return null;
1335
- const l = c.findIndex((u, p) => p > 0 && u !== void 0), d = this.matchIndexes[l];
1350
+ const l = c.findIndex((h, p) => p > 0 && h !== void 0), d = this.matchIndexes[l];
1336
1351
  return c.splice(0, l), Object.assign(c, d);
1337
1352
  }
1338
1353
  }
@@ -1368,16 +1383,16 @@ function ei(n) {
1368
1383
  return l && (this.regexIndex += l.position + 1, this.regexIndex === this.count && this.considerAll()), l;
1369
1384
  }
1370
1385
  }
1371
- function s(r) {
1386
+ function r(s) {
1372
1387
  const o = new i();
1373
- return r.contains.forEach((c) => o.addRule(c.begin, { rule: c, type: "begin" })), r.terminatorEnd && o.addRule(r.terminatorEnd, { type: "end" }), r.illegal && o.addRule(r.illegal, { type: "illegal" }), o;
1388
+ return s.contains.forEach((c) => o.addRule(c.begin, { rule: c, type: "begin" })), s.terminatorEnd && o.addRule(s.terminatorEnd, { type: "end" }), s.illegal && o.addRule(s.illegal, { type: "illegal" }), o;
1374
1389
  }
1375
- function a(r, o) {
1390
+ function a(s, o) {
1376
1391
  const c = (
1377
1392
  /** @type CompiledMode */
1378
- r
1393
+ s
1379
1394
  );
1380
- if (r.isCompiled) return c;
1395
+ if (s.isCompiled) return c;
1381
1396
  [
1382
1397
  Hn,
1383
1398
  // do this early so compiler extensions generally don't have to worry about
@@ -1385,27 +1400,27 @@ function ei(n) {
1385
1400
  Kn,
1386
1401
  jn,
1387
1402
  qn
1388
- ].forEach((d) => d(r, o)), n.compilerExtensions.forEach((d) => d(r, o)), r.__beforeBegin = null, [
1403
+ ].forEach((d) => d(s, o)), n.compilerExtensions.forEach((d) => d(s, o)), s.__beforeBegin = null, [
1389
1404
  Fn,
1390
1405
  // do this later so compiler extensions that come earlier have access to the
1391
1406
  // raw array if they wanted to perhaps manipulate it, etc.
1392
1407
  zn,
1393
1408
  // default to 1 relevance if not specified
1394
1409
  Gn
1395
- ].forEach((d) => d(r, o)), r.isCompiled = !0;
1410
+ ].forEach((d) => d(s, o)), s.isCompiled = !0;
1396
1411
  let l = null;
1397
- return typeof r.keywords == "object" && r.keywords.$pattern && (r.keywords = Object.assign({}, r.keywords), l = r.keywords.$pattern, delete r.keywords.$pattern), l = l || /\w+/, r.keywords && (r.keywords = ut(r.keywords, n.case_insensitive)), c.keywordPatternRe = e(l, !0), o && (r.begin || (r.begin = /\B|\b/), c.beginRe = e(c.begin), !r.end && !r.endsWithParent && (r.end = /\B|\b/), r.end && (c.endRe = e(c.end)), c.terminatorEnd = de(c.end) || "", r.endsWithParent && o.terminatorEnd && (c.terminatorEnd += (r.end ? "|" : "") + o.terminatorEnd)), r.illegal && (c.illegalRe = e(
1412
+ 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 = ut(s.keywords, n.case_insensitive)), c.keywordPatternRe = e(l, !0), o && (s.begin || (s.begin = /\B|\b/), c.beginRe = e(c.begin), !s.end && !s.endsWithParent && (s.end = /\B|\b/), s.end && (c.endRe = e(c.end)), c.terminatorEnd = de(c.end) || "", s.endsWithParent && o.terminatorEnd && (c.terminatorEnd += (s.end ? "|" : "") + o.terminatorEnd)), s.illegal && (c.illegalRe = e(
1398
1413
  /** @type {RegExp | string} */
1399
- r.illegal
1400
- )), r.contains || (r.contains = []), r.contains = [].concat(...r.contains.map(function(d) {
1401
- return ti(d === "self" ? r : d);
1402
- })), r.contains.forEach(function(d) {
1414
+ s.illegal
1415
+ )), s.contains || (s.contains = []), s.contains = [].concat(...s.contains.map(function(d) {
1416
+ return ti(d === "self" ? s : d);
1417
+ })), s.contains.forEach(function(d) {
1403
1418
  a(
1404
1419
  /** @type Mode */
1405
1420
  d,
1406
1421
  c
1407
1422
  );
1408
- }), r.starts && a(r.starts, o), c.matcher = s(c), c;
1423
+ }), s.starts && a(s.starts, o), c.matcher = r(c), c;
1409
1424
  }
1410
1425
  if (n.compilerExtensions || (n.compilerExtensions = []), n.contains && n.contains.includes("self"))
1411
1426
  throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");
@@ -1428,10 +1443,10 @@ class ii extends Error {
1428
1443
  super(e), this.name = "HTMLInjectionError", this.html = t;
1429
1444
  }
1430
1445
  }
1431
- const Te = st, Ve = J, Xe = Symbol("nomatch"), si = 7, gt = function(n) {
1446
+ const Se = rt, Ve = J, Xe = Symbol("nomatch"), ri = 7, gt = function(n) {
1432
1447
  const e = /* @__PURE__ */ Object.create(null), t = /* @__PURE__ */ Object.create(null), i = [];
1433
- let s = !0;
1434
- const a = "Could not find the language '{}', did you forget to load/include a language module?", r = { disableAutodetect: !0, name: "Plain text", contains: [] };
1448
+ let r = !0;
1449
+ const a = "Could not find the language '{}', did you forget to load/include a language module?", s = { disableAutodetect: !0, name: "Plain text", contains: [] };
1435
1450
  let o = {
1436
1451
  ignoreUnescapedHTML: !1,
1437
1452
  throwUnescapedHTML: !1,
@@ -1444,35 +1459,35 @@ const Te = st, Ve = J, Xe = Symbol("nomatch"), si = 7, gt = function(n) {
1444
1459
  // https://github.com/highlightjs/highlight.js/issues/1086
1445
1460
  __emitter: fn
1446
1461
  };
1447
- function c(h) {
1448
- return o.noHighlightRe.test(h);
1449
- }
1450
- function l(h) {
1451
- let _ = h.className + " ";
1452
- _ += h.parentNode ? h.parentNode.className : "";
1453
- const b = o.languageDetectRe.exec(_);
1454
- if (b) {
1455
- const k = $(b[1]);
1456
- return k || (Ze(a.replace("{}", b[1])), Ze("Falling back to no-highlight mode for this block.", h)), k ? b[1] : "no-highlight";
1462
+ function c(u) {
1463
+ return o.noHighlightRe.test(u);
1464
+ }
1465
+ function l(u) {
1466
+ let _ = u.className + " ";
1467
+ _ += u.parentNode ? u.parentNode.className : "";
1468
+ const f = o.languageDetectRe.exec(_);
1469
+ if (f) {
1470
+ const v = $(f[1]);
1471
+ return v || (Ze(a.replace("{}", f[1])), Ze("Falling back to no-highlight mode for this block.", u)), v ? f[1] : "no-highlight";
1457
1472
  }
1458
- return _.split(/\s+/).find((k) => c(k) || $(k));
1473
+ return _.split(/\s+/).find((v) => c(v) || $(v));
1459
1474
  }
1460
- function d(h, _, b) {
1461
- let k = "", S = "";
1462
- typeof _ == "object" ? (k = h, b = _.ignoreIllegals, S = _.language) : (ie("10.7.0", "highlight(lang, code, ...args) has been deprecated."), ie("10.7.0", `Please use highlight(code, options) instead.
1463
- https://github.com/highlightjs/highlight.js/issues/2277`), S = h, k = _), b === void 0 && (b = !0);
1475
+ function d(u, _, f) {
1476
+ let v = "", T = "";
1477
+ typeof _ == "object" ? (v = u, f = _.ignoreIllegals, T = _.language) : (ie("10.7.0", "highlight(lang, code, ...args) has been deprecated."), ie("10.7.0", `Please use highlight(code, options) instead.
1478
+ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, v = _), f === void 0 && (f = !0);
1464
1479
  const P = {
1465
- code: k,
1466
- language: S
1480
+ code: v,
1481
+ language: T
1467
1482
  };
1468
1483
  X("before:highlight", P);
1469
- const z = P.result ? P.result : u(P.language, P.code, b);
1484
+ const z = P.result ? P.result : h(P.language, P.code, f);
1470
1485
  return z.code = P.code, X("after:highlight", z), z;
1471
1486
  }
1472
- function u(h, _, b, k) {
1473
- const S = /* @__PURE__ */ Object.create(null);
1474
- function P(g, E) {
1475
- return g.keywords[E];
1487
+ function h(u, _, f, v) {
1488
+ const T = /* @__PURE__ */ Object.create(null);
1489
+ function P(g, y) {
1490
+ return g.keywords[y];
1476
1491
  }
1477
1492
  function z() {
1478
1493
  if (!w.keywords) {
@@ -1481,23 +1496,23 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, k = _), b ===
1481
1496
  }
1482
1497
  let g = 0;
1483
1498
  w.keywordPatternRe.lastIndex = 0;
1484
- let E = w.keywordPatternRe.exec(M), N = "";
1485
- for (; E; ) {
1486
- N += M.substring(g, E.index);
1487
- const x = Y.case_insensitive ? E[0].toLowerCase() : E[0], K = P(w, x);
1499
+ let y = w.keywordPatternRe.exec(M), k = "";
1500
+ for (; y; ) {
1501
+ k += M.substring(g, y.index);
1502
+ const x = Y.case_insensitive ? y[0].toLowerCase() : y[0], K = P(w, x);
1488
1503
  if (K) {
1489
1504
  const [Z, Ut] = K;
1490
- if (F.addText(N), N = "", S[x] = (S[x] || 0) + 1, S[x] <= si && (pe += Ut), Z.startsWith("_"))
1491
- N += E[0];
1505
+ if (F.addText(k), k = "", T[x] = (T[x] || 0) + 1, T[x] <= ri && (pe += Ut), Z.startsWith("_"))
1506
+ k += y[0];
1492
1507
  else {
1493
1508
  const Ht = Y.classNameAliases[Z] || Z;
1494
- W(E[0], Ht);
1509
+ W(y[0], Ht);
1495
1510
  }
1496
1511
  } else
1497
- N += E[0];
1498
- g = w.keywordPatternRe.lastIndex, E = w.keywordPatternRe.exec(M);
1512
+ k += y[0];
1513
+ g = w.keywordPatternRe.lastIndex, y = w.keywordPatternRe.exec(M);
1499
1514
  }
1500
- N += M.substring(g), F.addText(N);
1515
+ k += M.substring(g), F.addText(k);
1501
1516
  }
1502
1517
  function q() {
1503
1518
  if (M === "") return;
@@ -1507,7 +1522,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, k = _), b ===
1507
1522
  F.addText(M);
1508
1523
  return;
1509
1524
  }
1510
- g = u(w.subLanguage, M, !0, Pe[w.subLanguage]), Pe[w.subLanguage] = /** @type {CompiledMode} */
1525
+ g = h(w.subLanguage, M, !0, Pe[w.subLanguage]), Pe[w.subLanguage] = /** @type {CompiledMode} */
1511
1526
  g._top;
1512
1527
  } else
1513
1528
  g = m(M, w.subLanguage.length ? w.subLanguage : null);
@@ -1516,30 +1531,30 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, k = _), b ===
1516
1531
  function G() {
1517
1532
  w.subLanguage != null ? q() : z(), M = "";
1518
1533
  }
1519
- function W(g, E) {
1520
- g !== "" && (F.startScope(E), F.addText(g), F.endScope());
1534
+ function W(g, y) {
1535
+ g !== "" && (F.startScope(y), F.addText(g), F.endScope());
1521
1536
  }
1522
- function Oe(g, E) {
1523
- let N = 1;
1524
- const x = E.length - 1;
1525
- for (; N <= x; ) {
1526
- if (!g._emit[N]) {
1527
- N++;
1537
+ function Oe(g, y) {
1538
+ let k = 1;
1539
+ const x = y.length - 1;
1540
+ for (; k <= x; ) {
1541
+ if (!g._emit[k]) {
1542
+ k++;
1528
1543
  continue;
1529
1544
  }
1530
- const K = Y.classNameAliases[g[N]] || g[N], Z = E[N];
1531
- K ? W(Z, K) : (M = Z, z(), M = ""), N++;
1545
+ const K = Y.classNameAliases[g[k]] || g[k], Z = y[k];
1546
+ K ? W(Z, K) : (M = Z, z(), M = ""), k++;
1532
1547
  }
1533
1548
  }
1534
- function Ie(g, E) {
1535
- return g.scope && typeof g.scope == "string" && F.openNode(Y.classNameAliases[g.scope] || g.scope), g.beginScope && (g.beginScope._wrap ? (W(M, Y.classNameAliases[g.beginScope._wrap] || g.beginScope._wrap), M = "") : g.beginScope._multi && (Oe(g.beginScope, E), M = "")), w = Object.create(g, { parent: { value: w } }), w;
1549
+ function Ie(g, y) {
1550
+ return g.scope && typeof g.scope == "string" && F.openNode(Y.classNameAliases[g.scope] || g.scope), g.beginScope && (g.beginScope._wrap ? (W(M, Y.classNameAliases[g.beginScope._wrap] || g.beginScope._wrap), M = "") : g.beginScope._multi && (Oe(g.beginScope, y), M = "")), w = Object.create(g, { parent: { value: w } }), w;
1536
1551
  }
1537
- function Le(g, E, N) {
1538
- let x = yn(g.endRe, N);
1552
+ function Le(g, y, k) {
1553
+ let x = yn(g.endRe, k);
1539
1554
  if (x) {
1540
1555
  if (g["on:end"]) {
1541
1556
  const K = new Ge(g);
1542
- g["on:end"](E, K), K.isMatchIgnored && (x = !1);
1557
+ g["on:end"](y, K), K.isMatchIgnored && (x = !1);
1543
1558
  }
1544
1559
  if (x) {
1545
1560
  for (; g.endsParent && g.parent; )
@@ -1548,69 +1563,69 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, k = _), b ===
1548
1563
  }
1549
1564
  }
1550
1565
  if (g.endsWithParent)
1551
- return Le(g.parent, E, N);
1566
+ return Le(g.parent, y, k);
1552
1567
  }
1553
1568
  function Lt(g) {
1554
1569
  return w.matcher.regexIndex === 0 ? (M += g[0], 1) : (Ne = !0, 0);
1555
1570
  }
1556
1571
  function Dt(g) {
1557
- const E = g[0], N = g.rule, x = new Ge(N), K = [N.__beforeBegin, N["on:begin"]];
1572
+ const y = g[0], k = g.rule, x = new Ge(k), K = [k.__beforeBegin, k["on:begin"]];
1558
1573
  for (const Z of K)
1559
1574
  if (Z && (Z(g, x), x.isMatchIgnored))
1560
- return Lt(E);
1561
- return N.skip ? M += E : (N.excludeBegin && (M += E), G(), !N.returnBegin && !N.excludeBegin && (M = E)), Ie(N, g), N.returnBegin ? 0 : E.length;
1575
+ return Lt(y);
1576
+ return k.skip ? M += y : (k.excludeBegin && (M += y), G(), !k.returnBegin && !k.excludeBegin && (M = y)), Ie(k, g), k.returnBegin ? 0 : y.length;
1562
1577
  }
1563
1578
  function Pt(g) {
1564
- const E = g[0], N = _.substring(g.index), x = Le(w, g, N);
1579
+ const y = g[0], k = _.substring(g.index), x = Le(w, g, k);
1565
1580
  if (!x)
1566
1581
  return Xe;
1567
1582
  const K = w;
1568
- w.endScope && w.endScope._wrap ? (G(), W(E, w.endScope._wrap)) : w.endScope && w.endScope._multi ? (G(), Oe(w.endScope, g)) : K.skip ? M += E : (K.returnEnd || K.excludeEnd || (M += E), G(), K.excludeEnd && (M = E));
1583
+ w.endScope && w.endScope._wrap ? (G(), W(y, w.endScope._wrap)) : w.endScope && w.endScope._multi ? (G(), Oe(w.endScope, g)) : K.skip ? M += y : (K.returnEnd || K.excludeEnd || (M += y), G(), K.excludeEnd && (M = y));
1569
1584
  do
1570
1585
  w.scope && F.closeNode(), !w.skip && !w.subLanguage && (pe += w.relevance), w = w.parent;
1571
1586
  while (w !== x.parent);
1572
- return x.starts && Ie(x.starts, g), K.returnEnd ? 0 : E.length;
1587
+ return x.starts && Ie(x.starts, g), K.returnEnd ? 0 : y.length;
1573
1588
  }
1574
1589
  function Bt() {
1575
1590
  const g = [];
1576
- for (let E = w; E !== Y; E = E.parent)
1577
- E.scope && g.unshift(E.scope);
1578
- g.forEach((E) => F.openNode(E));
1591
+ for (let y = w; y !== Y; y = y.parent)
1592
+ y.scope && g.unshift(y.scope);
1593
+ g.forEach((y) => F.openNode(y));
1579
1594
  }
1580
1595
  let he = {};
1581
- function De(g, E) {
1582
- const N = E && E[0];
1583
- if (M += g, N == null)
1596
+ function De(g, y) {
1597
+ const k = y && y[0];
1598
+ if (M += g, k == null)
1584
1599
  return G(), 0;
1585
- if (he.type === "begin" && E.type === "end" && he.index === E.index && N === "") {
1586
- if (M += _.slice(E.index, E.index + 1), !s) {
1587
- const x = new Error(`0 width match regex (${h})`);
1588
- throw x.languageName = h, x.badRule = he.rule, x;
1600
+ if (he.type === "begin" && y.type === "end" && he.index === y.index && k === "") {
1601
+ if (M += _.slice(y.index, y.index + 1), !r) {
1602
+ const x = new Error(`0 width match regex (${u})`);
1603
+ throw x.languageName = u, x.badRule = he.rule, x;
1589
1604
  }
1590
1605
  return 1;
1591
1606
  }
1592
- if (he = E, E.type === "begin")
1593
- return Dt(E);
1594
- if (E.type === "illegal" && !b) {
1595
- const x = new Error('Illegal lexeme "' + N + '" for mode "' + (w.scope || "<unnamed>") + '"');
1607
+ if (he = y, y.type === "begin")
1608
+ return Dt(y);
1609
+ if (y.type === "illegal" && !f) {
1610
+ const x = new Error('Illegal lexeme "' + k + '" for mode "' + (w.scope || "<unnamed>") + '"');
1596
1611
  throw x.mode = w, x;
1597
- } else if (E.type === "end") {
1598
- const x = Pt(E);
1612
+ } else if (y.type === "end") {
1613
+ const x = Pt(y);
1599
1614
  if (x !== Xe)
1600
1615
  return x;
1601
1616
  }
1602
- if (E.type === "illegal" && N === "")
1603
- return E.index === _.length || (M += `
1617
+ if (y.type === "illegal" && k === "")
1618
+ return y.index === _.length || (M += `
1604
1619
  `), 1;
1605
- if (ke > 1e5 && ke > E.index * 3)
1620
+ if (ke > 1e5 && ke > y.index * 3)
1606
1621
  throw new Error("potential infinite loop, way more iterations than matches");
1607
- return M += N, N.length;
1622
+ return M += k, k.length;
1608
1623
  }
1609
- const Y = $(h);
1624
+ const Y = $(u);
1610
1625
  if (!Y)
1611
- throw te(a.replace("{}", h)), new Error('Unknown language: "' + h + '"');
1626
+ throw te(a.replace("{}", u)), new Error('Unknown language: "' + u + '"');
1612
1627
  const $t = ei(Y);
1613
- let ve = "", w = k || $t;
1628
+ let ve = "", w = v || $t;
1614
1629
  const Pe = {}, F = new o.__emitter(o);
1615
1630
  Bt();
1616
1631
  let M = "", pe = 0, ee = 0, ke = 0, Ne = !1;
@@ -1622,13 +1637,13 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, k = _), b ===
1622
1637
  ke++, Ne ? Ne = !1 : w.matcher.considerAll(), w.matcher.lastIndex = ee;
1623
1638
  const g = w.matcher.exec(_);
1624
1639
  if (!g) break;
1625
- const E = _.substring(ee, g.index), N = De(E, g);
1626
- ee = g.index + N;
1640
+ const y = _.substring(ee, g.index), k = De(y, g);
1641
+ ee = g.index + k;
1627
1642
  }
1628
1643
  De(_.substring(ee));
1629
1644
  }
1630
1645
  return F.finalize(), ve = F.toHTML(), {
1631
- language: h,
1646
+ language: u,
1632
1647
  value: ve,
1633
1648
  relevance: pe,
1634
1649
  illegal: !1,
@@ -1638,8 +1653,8 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, k = _), b ===
1638
1653
  } catch (g) {
1639
1654
  if (g.message && g.message.includes("Illegal"))
1640
1655
  return {
1641
- language: h,
1642
- value: Te(_),
1656
+ language: u,
1657
+ value: Se(_),
1643
1658
  illegal: !0,
1644
1659
  relevance: 0,
1645
1660
  _illegalBy: {
@@ -1651,10 +1666,10 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, k = _), b ===
1651
1666
  },
1652
1667
  _emitter: F
1653
1668
  };
1654
- if (s)
1669
+ if (r)
1655
1670
  return {
1656
- language: h,
1657
- value: Te(_),
1671
+ language: u,
1672
+ value: Se(_),
1658
1673
  illegal: !1,
1659
1674
  relevance: 0,
1660
1675
  errorRaised: g,
@@ -1664,23 +1679,23 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, k = _), b ===
1664
1679
  throw g;
1665
1680
  }
1666
1681
  }
1667
- function p(h) {
1682
+ function p(u) {
1668
1683
  const _ = {
1669
- value: Te(h),
1684
+ value: Se(u),
1670
1685
  illegal: !1,
1671
1686
  relevance: 0,
1672
- _top: r,
1687
+ _top: s,
1673
1688
  _emitter: new o.__emitter(o)
1674
1689
  };
1675
- return _._emitter.addText(h), _;
1690
+ return _._emitter.addText(u), _;
1676
1691
  }
1677
- function m(h, _) {
1692
+ function m(u, _) {
1678
1693
  _ = _ || o.languages || Object.keys(e);
1679
- const b = p(h), k = _.filter($).filter(V).map(
1680
- (G) => u(G, h, !1)
1694
+ const f = p(u), v = _.filter($).filter(V).map(
1695
+ (G) => h(G, u, !1)
1681
1696
  );
1682
- k.unshift(b);
1683
- const S = k.sort((G, W) => {
1697
+ v.unshift(f);
1698
+ const T = v.sort((G, W) => {
1684
1699
  if (G.relevance !== W.relevance) return W.relevance - G.relevance;
1685
1700
  if (G.language && W.language) {
1686
1701
  if ($(G.language).supersetOf === W.language)
@@ -1689,45 +1704,45 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, k = _), b ===
1689
1704
  return -1;
1690
1705
  }
1691
1706
  return 0;
1692
- }), [P, z] = S, q = P;
1707
+ }), [P, z] = T, q = P;
1693
1708
  return q.secondBest = z, q;
1694
1709
  }
1695
- function y(h, _, b) {
1696
- const k = _ && t[_] || b;
1697
- h.classList.add("hljs"), h.classList.add(`language-${k}`);
1710
+ function b(u, _, f) {
1711
+ const v = _ && t[_] || f;
1712
+ u.classList.add("hljs"), u.classList.add(`language-${v}`);
1698
1713
  }
1699
- function f(h) {
1714
+ function E(u) {
1700
1715
  let _ = null;
1701
- const b = l(h);
1702
- if (c(b)) return;
1716
+ const f = l(u);
1717
+ if (c(f)) return;
1703
1718
  if (X(
1704
1719
  "before:highlightElement",
1705
- { el: h, language: b }
1706
- ), h.dataset.highlighted) {
1707
- console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.", h);
1720
+ { el: u, language: f }
1721
+ ), u.dataset.highlighted) {
1722
+ console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.", u);
1708
1723
  return;
1709
1724
  }
1710
- if (h.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(h)), o.throwUnescapedHTML))
1725
+ if (u.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(u)), o.throwUnescapedHTML))
1711
1726
  throw new ii(
1712
1727
  "One of your code blocks includes unescaped HTML.",
1713
- h.innerHTML
1728
+ u.innerHTML
1714
1729
  );
1715
- _ = h;
1716
- const k = _.textContent, S = b ? d(k, { language: b, ignoreIllegals: !0 }) : m(k);
1717
- h.innerHTML = S.value, h.dataset.highlighted = "yes", y(h, b, S.language), h.result = {
1718
- language: S.language,
1730
+ _ = u;
1731
+ const v = _.textContent, T = f ? d(v, { language: f, ignoreIllegals: !0 }) : m(v);
1732
+ u.innerHTML = T.value, u.dataset.highlighted = "yes", b(u, f, T.language), u.result = {
1733
+ language: T.language,
1719
1734
  // TODO: remove with version 11.0
1720
- re: S.relevance,
1721
- relevance: S.relevance
1722
- }, S.secondBest && (h.secondBest = {
1723
- language: S.secondBest.language,
1724
- relevance: S.secondBest.relevance
1725
- }), X("after:highlightElement", { el: h, result: S, text: k });
1735
+ re: T.relevance,
1736
+ relevance: T.relevance
1737
+ }, T.secondBest && (u.secondBest = {
1738
+ language: T.secondBest.language,
1739
+ relevance: T.secondBest.relevance
1740
+ }), X("after:highlightElement", { el: u, result: T, text: v });
1726
1741
  }
1727
- function v(h) {
1728
- o = Ve(o, h);
1742
+ function N(u) {
1743
+ o = Ve(o, u);
1729
1744
  }
1730
- const T = () => {
1745
+ const S = () => {
1731
1746
  C(), ie("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
1732
1747
  };
1733
1748
  function O() {
@@ -1735,84 +1750,84 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, k = _), b ===
1735
1750
  }
1736
1751
  let U = !1;
1737
1752
  function C() {
1738
- function h() {
1753
+ function u() {
1739
1754
  C();
1740
1755
  }
1741
1756
  if (document.readyState === "loading") {
1742
- U || window.addEventListener("DOMContentLoaded", h, !1), U = !0;
1757
+ U || window.addEventListener("DOMContentLoaded", u, !1), U = !0;
1743
1758
  return;
1744
1759
  }
1745
- document.querySelectorAll(o.cssSelector).forEach(f);
1760
+ document.querySelectorAll(o.cssSelector).forEach(E);
1746
1761
  }
1747
- function I(h, _) {
1748
- let b = null;
1762
+ function I(u, _) {
1763
+ let f = null;
1749
1764
  try {
1750
- b = _(n);
1751
- } catch (k) {
1752
- if (te("Language definition for '{}' could not be registered.".replace("{}", h)), s)
1753
- te(k);
1765
+ f = _(n);
1766
+ } catch (v) {
1767
+ if (te("Language definition for '{}' could not be registered.".replace("{}", u)), r)
1768
+ te(v);
1754
1769
  else
1755
- throw k;
1756
- b = r;
1770
+ throw v;
1771
+ f = s;
1757
1772
  }
1758
- b.name || (b.name = h), e[h] = b, b.rawDefinition = _.bind(null, n), b.aliases && H(b.aliases, { languageName: h });
1773
+ f.name || (f.name = u), e[u] = f, f.rawDefinition = _.bind(null, n), f.aliases && H(f.aliases, { languageName: u });
1759
1774
  }
1760
- function D(h) {
1761
- delete e[h];
1775
+ function D(u) {
1776
+ delete e[u];
1762
1777
  for (const _ of Object.keys(t))
1763
- t[_] === h && delete t[_];
1778
+ t[_] === u && delete t[_];
1764
1779
  }
1765
1780
  function B() {
1766
1781
  return Object.keys(e);
1767
1782
  }
1768
- function $(h) {
1769
- return h = (h || "").toLowerCase(), e[h] || e[t[h]];
1783
+ function $(u) {
1784
+ return u = (u || "").toLowerCase(), e[u] || e[t[u]];
1770
1785
  }
1771
- function H(h, { languageName: _ }) {
1772
- typeof h == "string" && (h = [h]), h.forEach((b) => {
1773
- t[b.toLowerCase()] = _;
1786
+ function H(u, { languageName: _ }) {
1787
+ typeof u == "string" && (u = [u]), u.forEach((f) => {
1788
+ t[f.toLowerCase()] = _;
1774
1789
  });
1775
1790
  }
1776
- function V(h) {
1777
- const _ = $(h);
1791
+ function V(u) {
1792
+ const _ = $(u);
1778
1793
  return _ && !_.disableAutodetect;
1779
1794
  }
1780
- function j(h) {
1781
- h["before:highlightBlock"] && !h["before:highlightElement"] && (h["before:highlightElement"] = (_) => {
1782
- h["before:highlightBlock"](
1795
+ function j(u) {
1796
+ u["before:highlightBlock"] && !u["before:highlightElement"] && (u["before:highlightElement"] = (_) => {
1797
+ u["before:highlightBlock"](
1783
1798
  Object.assign({ block: _.el }, _)
1784
1799
  );
1785
- }), h["after:highlightBlock"] && !h["after:highlightElement"] && (h["after:highlightElement"] = (_) => {
1786
- h["after:highlightBlock"](
1800
+ }), u["after:highlightBlock"] && !u["after:highlightElement"] && (u["after:highlightElement"] = (_) => {
1801
+ u["after:highlightBlock"](
1787
1802
  Object.assign({ block: _.el }, _)
1788
1803
  );
1789
1804
  });
1790
1805
  }
1791
- function oe(h) {
1792
- j(h), i.push(h);
1806
+ function oe(u) {
1807
+ j(u), i.push(u);
1793
1808
  }
1794
- function ae(h) {
1795
- const _ = i.indexOf(h);
1809
+ function ae(u) {
1810
+ const _ = i.indexOf(u);
1796
1811
  _ !== -1 && i.splice(_, 1);
1797
1812
  }
1798
- function X(h, _) {
1799
- const b = h;
1800
- i.forEach(function(k) {
1801
- k[b] && k[b](_);
1813
+ function X(u, _) {
1814
+ const f = u;
1815
+ i.forEach(function(v) {
1816
+ v[f] && v[f](_);
1802
1817
  });
1803
1818
  }
1804
- function ce(h) {
1805
- return ie("10.7.0", "highlightBlock will be removed entirely in v12.0"), ie("10.7.0", "Please use highlightElement now."), f(h);
1819
+ function ce(u) {
1820
+ return ie("10.7.0", "highlightBlock will be removed entirely in v12.0"), ie("10.7.0", "Please use highlightElement now."), E(u);
1806
1821
  }
1807
1822
  Object.assign(n, {
1808
1823
  highlight: d,
1809
1824
  highlightAuto: m,
1810
1825
  highlightAll: C,
1811
- highlightElement: f,
1826
+ highlightElement: E,
1812
1827
  // TODO: Remove with v12 API
1813
1828
  highlightBlock: ce,
1814
- configure: v,
1815
- initHighlighting: T,
1829
+ configure: N,
1830
+ initHighlighting: S,
1816
1831
  initHighlightingOnLoad: O,
1817
1832
  registerLanguage: I,
1818
1833
  unregisterLanguage: D,
@@ -1824,25 +1839,25 @@ https://github.com/highlightjs/highlight.js/issues/2277`), S = h, k = _), b ===
1824
1839
  addPlugin: oe,
1825
1840
  removePlugin: ae
1826
1841
  }), n.debugMode = function() {
1827
- s = !1;
1842
+ r = !1;
1828
1843
  }, n.safeMode = function() {
1829
- s = !0;
1844
+ r = !0;
1830
1845
  }, n.versionString = ni, n.regex = {
1831
1846
  concat: ne,
1832
- lookahead: rt,
1847
+ lookahead: st,
1833
1848
  either: ye,
1834
1849
  optional: _n,
1835
1850
  anyNumberOfTimes: bn
1836
1851
  };
1837
- for (const h in me)
1838
- typeof me[h] == "object" && it(me[h]);
1852
+ for (const u in me)
1853
+ typeof me[u] == "object" && it(me[u]);
1839
1854
  return Object.assign(n, me), n;
1840
- }, re = gt({});
1841
- re.newInstance = () => gt({});
1842
- var ri = re;
1843
- re.HighlightJS = re;
1844
- re.default = re;
1845
- const A = /* @__PURE__ */ hn(ri), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", oi = [
1855
+ }, se = gt({});
1856
+ se.newInstance = () => gt({});
1857
+ var si = se;
1858
+ se.HighlightJS = se;
1859
+ se.default = se;
1860
+ const A = /* @__PURE__ */ hn(si), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", oi = [
1846
1861
  "as",
1847
1862
  // for exports
1848
1863
  "in",
@@ -1990,21 +2005,21 @@ const A = /* @__PURE__ */ hn(ri), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", oi = [
1990
2005
  ft
1991
2006
  );
1992
2007
  function _t(n) {
1993
- const e = n.regex, t = (b, { after: k }) => {
1994
- const S = "</" + b[0].slice(1);
1995
- return b.input.indexOf(S, k) !== -1;
1996
- }, i = Qe, s = {
2008
+ const e = n.regex, t = (f, { after: v }) => {
2009
+ const T = "</" + f[0].slice(1);
2010
+ return f.input.indexOf(T, v) !== -1;
2011
+ }, i = Qe, r = {
1997
2012
  begin: "<>",
1998
2013
  end: "</>"
1999
- }, a = /<[A-Za-z0-9\\._:-]+\s*\/>/, r = {
2014
+ }, a = /<[A-Za-z0-9\\._:-]+\s*\/>/, s = {
2000
2015
  begin: /<[A-Za-z0-9\\._:-]+/,
2001
2016
  end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
2002
2017
  /**
2003
2018
  * @param {RegExpMatchArray} match
2004
2019
  * @param {CallbackResponse} response
2005
2020
  */
2006
- isTrulyOpeningTag: (b, k) => {
2007
- const S = b[0].length + b.index, P = b.input[S];
2021
+ isTrulyOpeningTag: (f, v) => {
2022
+ const T = f[0].length + f.index, P = f.input[T];
2008
2023
  if (
2009
2024
  // HTML should not include another raw `<` inside a tag
2010
2025
  // nested type?
@@ -2013,18 +2028,18 @@ function _t(n) {
2013
2028
  // `<T, A extends keyof T, V>`
2014
2029
  P === ","
2015
2030
  ) {
2016
- k.ignoreMatch();
2031
+ v.ignoreMatch();
2017
2032
  return;
2018
2033
  }
2019
- P === ">" && (t(b, { after: S }) || k.ignoreMatch());
2034
+ P === ">" && (t(f, { after: T }) || v.ignoreMatch());
2020
2035
  let z;
2021
- const q = b.input.substring(S);
2036
+ const q = f.input.substring(T);
2022
2037
  if (z = q.match(/^\s*=/)) {
2023
- k.ignoreMatch();
2038
+ v.ignoreMatch();
2024
2039
  return;
2025
2040
  }
2026
2041
  if ((z = q.match(/^\s+extends\s+/)) && z.index === 0) {
2027
- k.ignoreMatch();
2042
+ v.ignoreMatch();
2028
2043
  return;
2029
2044
  }
2030
2045
  }
@@ -2034,7 +2049,7 @@ function _t(n) {
2034
2049
  literal: ai,
2035
2050
  built_in: li,
2036
2051
  "variable.language": ci
2037
- }, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", u = {
2052
+ }, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", h = {
2038
2053
  className: "number",
2039
2054
  variants: [
2040
2055
  // DecimalLiteral
@@ -2070,7 +2085,7 @@ function _t(n) {
2070
2085
  ],
2071
2086
  subLanguage: "xml"
2072
2087
  }
2073
- }, y = {
2088
+ }, b = {
2074
2089
  begin: ".?css`",
2075
2090
  end: "",
2076
2091
  starts: {
@@ -2082,7 +2097,7 @@ function _t(n) {
2082
2097
  ],
2083
2098
  subLanguage: "css"
2084
2099
  }
2085
- }, f = {
2100
+ }, E = {
2086
2101
  begin: ".?gql`",
2087
2102
  end: "",
2088
2103
  starts: {
@@ -2094,7 +2109,7 @@ function _t(n) {
2094
2109
  ],
2095
2110
  subLanguage: "graphql"
2096
2111
  }
2097
- }, v = {
2112
+ }, N = {
2098
2113
  className: "string",
2099
2114
  begin: "`",
2100
2115
  end: "`",
@@ -2151,12 +2166,12 @@ function _t(n) {
2151
2166
  n.APOS_STRING_MODE,
2152
2167
  n.QUOTE_STRING_MODE,
2153
2168
  m,
2154
- y,
2155
- f,
2156
- v,
2169
+ b,
2170
+ E,
2171
+ N,
2157
2172
  // Skip numbers when they are part of a variable name
2158
2173
  { match: /\$\d+/ },
2159
- u
2174
+ h
2160
2175
  // This is intentional:
2161
2176
  // See https://github.com/highlightjs/highlight.js/issues/3288
2162
2177
  // hljs.REGEXP_MODE
@@ -2281,8 +2296,8 @@ function _t(n) {
2281
2296
  match: /\b[A-Z][A-Z_0-9]+\b/,
2282
2297
  className: "variable.constant"
2283
2298
  };
2284
- function oe(b) {
2285
- return e.concat("(?!", b.join("|"), ")");
2299
+ function oe(f) {
2300
+ return e.concat("(?!", f.join("|"), ")");
2286
2301
  }
2287
2302
  const ae = {
2288
2303
  match: e.concat(
@@ -2292,7 +2307,7 @@ function _t(n) {
2292
2307
  "super",
2293
2308
  "import",
2294
2309
  "await"
2295
- ].map((b) => `${b}\\s*\\(`)),
2310
+ ].map((f) => `${f}\\s*\\(`)),
2296
2311
  i,
2297
2312
  e.lookahead(/\s*\(/)
2298
2313
  ),
@@ -2325,7 +2340,7 @@ function _t(n) {
2325
2340
  },
2326
2341
  D
2327
2342
  ]
2328
- }, h = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + n.UNDERSCORE_IDENT_RE + ")\\s*=>", _ = {
2343
+ }, u = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + n.UNDERSCORE_IDENT_RE + ")\\s*=>", _ = {
2329
2344
  match: [
2330
2345
  /const|var|let/,
2331
2346
  /\s+/,
@@ -2334,7 +2349,7 @@ function _t(n) {
2334
2349
  /=\s*/,
2335
2350
  /(async\s*)?/,
2336
2351
  // async is optional
2337
- e.lookahead(h)
2352
+ e.lookahead(u)
2338
2353
  ],
2339
2354
  keywords: "async",
2340
2355
  className: {
@@ -2362,13 +2377,13 @@ function _t(n) {
2362
2377
  n.APOS_STRING_MODE,
2363
2378
  n.QUOTE_STRING_MODE,
2364
2379
  m,
2365
- y,
2366
- f,
2367
- v,
2380
+ b,
2381
+ E,
2382
+ N,
2368
2383
  O,
2369
2384
  // Skip numbers when they are part of a variable name
2370
2385
  { match: /\$\d+/ },
2371
- u,
2386
+ h,
2372
2387
  $,
2373
2388
  {
2374
2389
  scope: "attr",
@@ -2389,7 +2404,7 @@ function _t(n) {
2389
2404
  // we have to count the parens to make sure we actually have the
2390
2405
  // correct bounding ( ) before the =>. There could be any number of
2391
2406
  // sub-expressions inside also surrounded by parens.
2392
- begin: h,
2407
+ begin: u,
2393
2408
  returnBegin: !0,
2394
2409
  end: "\\s*=>",
2395
2410
  contains: [
@@ -2429,21 +2444,21 @@ function _t(n) {
2429
2444
  {
2430
2445
  // JSX
2431
2446
  variants: [
2432
- { begin: s.begin, end: s.end },
2447
+ { begin: r.begin, end: r.end },
2433
2448
  { match: a },
2434
2449
  {
2435
- begin: r.begin,
2450
+ begin: s.begin,
2436
2451
  // we carefully check the opening tag to see if it truly
2437
2452
  // is a tag and not a false positive
2438
- "on:begin": r.isTrulyOpeningTag,
2439
- end: r.end
2453
+ "on:begin": s.isTrulyOpeningTag,
2454
+ end: s.end
2440
2455
  }
2441
2456
  ],
2442
2457
  subLanguage: "xml",
2443
2458
  contains: [
2444
2459
  {
2445
- begin: r.begin,
2446
- end: r.end,
2460
+ begin: s.begin,
2461
+ end: s.end,
2447
2462
  skip: !0,
2448
2463
  contains: ["self"]
2449
2464
  }
@@ -2641,27 +2656,27 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
2641
2656
  "self",
2642
2657
  "global"
2643
2658
  // Node.js
2644
- ], St = [].concat(
2659
+ ], Tt = [].concat(
2645
2660
  kt,
2646
2661
  wt,
2647
2662
  vt
2648
2663
  );
2649
2664
  function di(n) {
2650
- const e = n.regex, t = (b, { after: k }) => {
2651
- const S = "</" + b[0].slice(1);
2652
- return b.input.indexOf(S, k) !== -1;
2653
- }, i = Ee, s = {
2665
+ const e = n.regex, t = (f, { after: v }) => {
2666
+ const T = "</" + f[0].slice(1);
2667
+ return f.input.indexOf(T, v) !== -1;
2668
+ }, i = Ee, r = {
2654
2669
  begin: "<>",
2655
2670
  end: "</>"
2656
- }, a = /<[A-Za-z0-9\\._:-]+\s*\/>/, r = {
2671
+ }, a = /<[A-Za-z0-9\\._:-]+\s*\/>/, s = {
2657
2672
  begin: /<[A-Za-z0-9\\._:-]+/,
2658
2673
  end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
2659
2674
  /**
2660
2675
  * @param {RegExpMatchArray} match
2661
2676
  * @param {CallbackResponse} response
2662
2677
  */
2663
- isTrulyOpeningTag: (b, k) => {
2664
- const S = b[0].length + b.index, P = b.input[S];
2678
+ isTrulyOpeningTag: (f, v) => {
2679
+ const T = f[0].length + f.index, P = f.input[T];
2665
2680
  if (
2666
2681
  // HTML should not include another raw `<` inside a tag
2667
2682
  // nested type?
@@ -2670,18 +2685,18 @@ function di(n) {
2670
2685
  // `<T, A extends keyof T, V>`
2671
2686
  P === ","
2672
2687
  ) {
2673
- k.ignoreMatch();
2688
+ v.ignoreMatch();
2674
2689
  return;
2675
2690
  }
2676
- P === ">" && (t(b, { after: S }) || k.ignoreMatch());
2691
+ P === ">" && (t(f, { after: T }) || v.ignoreMatch());
2677
2692
  let z;
2678
- const q = b.input.substring(S);
2693
+ const q = f.input.substring(T);
2679
2694
  if (z = q.match(/^\s*=/)) {
2680
- k.ignoreMatch();
2695
+ v.ignoreMatch();
2681
2696
  return;
2682
2697
  }
2683
2698
  if ((z = q.match(/^\s+extends\s+/)) && z.index === 0) {
2684
- k.ignoreMatch();
2699
+ v.ignoreMatch();
2685
2700
  return;
2686
2701
  }
2687
2702
  }
@@ -2689,9 +2704,9 @@ function di(n) {
2689
2704
  $pattern: Ee,
2690
2705
  keyword: Et,
2691
2706
  literal: yt,
2692
- built_in: St,
2707
+ built_in: Tt,
2693
2708
  "variable.language": Nt
2694
- }, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", u = {
2709
+ }, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", h = {
2695
2710
  className: "number",
2696
2711
  variants: [
2697
2712
  // DecimalLiteral
@@ -2727,7 +2742,7 @@ function di(n) {
2727
2742
  ],
2728
2743
  subLanguage: "xml"
2729
2744
  }
2730
- }, y = {
2745
+ }, b = {
2731
2746
  begin: ".?css`",
2732
2747
  end: "",
2733
2748
  starts: {
@@ -2739,7 +2754,7 @@ function di(n) {
2739
2754
  ],
2740
2755
  subLanguage: "css"
2741
2756
  }
2742
- }, f = {
2757
+ }, E = {
2743
2758
  begin: ".?gql`",
2744
2759
  end: "",
2745
2760
  starts: {
@@ -2751,7 +2766,7 @@ function di(n) {
2751
2766
  ],
2752
2767
  subLanguage: "graphql"
2753
2768
  }
2754
- }, v = {
2769
+ }, N = {
2755
2770
  className: "string",
2756
2771
  begin: "`",
2757
2772
  end: "`",
@@ -2808,12 +2823,12 @@ function di(n) {
2808
2823
  n.APOS_STRING_MODE,
2809
2824
  n.QUOTE_STRING_MODE,
2810
2825
  m,
2811
- y,
2812
- f,
2813
- v,
2826
+ b,
2827
+ E,
2828
+ N,
2814
2829
  // Skip numbers when they are part of a variable name
2815
2830
  { match: /\$\d+/ },
2816
- u
2831
+ h
2817
2832
  // This is intentional:
2818
2833
  // See https://github.com/highlightjs/highlight.js/issues/3288
2819
2834
  // hljs.REGEXP_MODE
@@ -2938,8 +2953,8 @@ function di(n) {
2938
2953
  match: /\b[A-Z][A-Z_0-9]+\b/,
2939
2954
  className: "variable.constant"
2940
2955
  };
2941
- function oe(b) {
2942
- return e.concat("(?!", b.join("|"), ")");
2956
+ function oe(f) {
2957
+ return e.concat("(?!", f.join("|"), ")");
2943
2958
  }
2944
2959
  const ae = {
2945
2960
  match: e.concat(
@@ -2949,7 +2964,7 @@ function di(n) {
2949
2964
  "super",
2950
2965
  "import",
2951
2966
  "await"
2952
- ].map((b) => `${b}\\s*\\(`)),
2967
+ ].map((f) => `${f}\\s*\\(`)),
2953
2968
  i,
2954
2969
  e.lookahead(/\s*\(/)
2955
2970
  ),
@@ -2982,7 +2997,7 @@ function di(n) {
2982
2997
  },
2983
2998
  D
2984
2999
  ]
2985
- }, h = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + n.UNDERSCORE_IDENT_RE + ")\\s*=>", _ = {
3000
+ }, u = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + n.UNDERSCORE_IDENT_RE + ")\\s*=>", _ = {
2986
3001
  match: [
2987
3002
  /const|var|let/,
2988
3003
  /\s+/,
@@ -2991,7 +3006,7 @@ function di(n) {
2991
3006
  /=\s*/,
2992
3007
  /(async\s*)?/,
2993
3008
  // async is optional
2994
- e.lookahead(h)
3009
+ e.lookahead(u)
2995
3010
  ],
2996
3011
  keywords: "async",
2997
3012
  className: {
@@ -3019,13 +3034,13 @@ function di(n) {
3019
3034
  n.APOS_STRING_MODE,
3020
3035
  n.QUOTE_STRING_MODE,
3021
3036
  m,
3022
- y,
3023
- f,
3024
- v,
3037
+ b,
3038
+ E,
3039
+ N,
3025
3040
  O,
3026
3041
  // Skip numbers when they are part of a variable name
3027
3042
  { match: /\$\d+/ },
3028
- u,
3043
+ h,
3029
3044
  $,
3030
3045
  {
3031
3046
  scope: "attr",
@@ -3046,7 +3061,7 @@ function di(n) {
3046
3061
  // we have to count the parens to make sure we actually have the
3047
3062
  // correct bounding ( ) before the =>. There could be any number of
3048
3063
  // sub-expressions inside also surrounded by parens.
3049
- begin: h,
3064
+ begin: u,
3050
3065
  returnBegin: !0,
3051
3066
  end: "\\s*=>",
3052
3067
  contains: [
@@ -3086,21 +3101,21 @@ function di(n) {
3086
3101
  {
3087
3102
  // JSX
3088
3103
  variants: [
3089
- { begin: s.begin, end: s.end },
3104
+ { begin: r.begin, end: r.end },
3090
3105
  { match: a },
3091
3106
  {
3092
- begin: r.begin,
3107
+ begin: s.begin,
3093
3108
  // we carefully check the opening tag to see if it truly
3094
3109
  // is a tag and not a false positive
3095
- "on:begin": r.isTrulyOpeningTag,
3096
- end: r.end
3110
+ "on:begin": s.isTrulyOpeningTag,
3111
+ end: s.end
3097
3112
  }
3098
3113
  ],
3099
3114
  subLanguage: "xml",
3100
3115
  contains: [
3101
3116
  {
3102
- begin: r.begin,
3103
- end: r.end,
3117
+ begin: s.begin,
3118
+ end: s.end,
3104
3119
  skip: !0,
3105
3120
  contains: ["self"]
3106
3121
  }
@@ -3156,8 +3171,8 @@ function di(n) {
3156
3171
  ]
3157
3172
  };
3158
3173
  }
3159
- function Tt(n) {
3160
- const e = n.regex, t = di(n), i = Ee, s = [
3174
+ function St(n) {
3175
+ const e = n.regex, t = di(n), i = Ee, r = [
3161
3176
  "any",
3162
3177
  "void",
3163
3178
  "number",
@@ -3178,13 +3193,13 @@ function Tt(n) {
3178
3193
  1: "keyword",
3179
3194
  3: "title.class"
3180
3195
  }
3181
- }, r = {
3196
+ }, s = {
3182
3197
  beginKeywords: "interface",
3183
3198
  end: /\{/,
3184
3199
  excludeEnd: !0,
3185
3200
  keywords: {
3186
3201
  keyword: "interface extends",
3187
- built_in: s
3202
+ built_in: r
3188
3203
  },
3189
3204
  contains: [t.exports.CLASS_REFERENCE]
3190
3205
  }, o = {
@@ -3209,19 +3224,19 @@ function Tt(n) {
3209
3224
  $pattern: Ee,
3210
3225
  keyword: Et.concat(c),
3211
3226
  literal: yt,
3212
- built_in: St.concat(s),
3227
+ built_in: Tt.concat(r),
3213
3228
  "variable.language": Nt
3214
3229
  }, d = {
3215
3230
  className: "meta",
3216
3231
  begin: "@" + i
3217
- }, u = (f, v, T) => {
3218
- const O = f.contains.findIndex((U) => U.label === v);
3232
+ }, h = (E, N, S) => {
3233
+ const O = E.contains.findIndex((U) => U.label === N);
3219
3234
  if (O === -1)
3220
3235
  throw new Error("can not find mode to replace");
3221
- f.contains.splice(O, 1, T);
3236
+ E.contains.splice(O, 1, S);
3222
3237
  };
3223
3238
  Object.assign(t.keywords, l), t.exports.PARAMS_CONTAINS.push(d);
3224
- const p = t.contains.find((f) => f.scope === "attr"), m = Object.assign(
3239
+ const p = t.contains.find((E) => E.scope === "attr"), m = Object.assign(
3225
3240
  {},
3226
3241
  p,
3227
3242
  { match: e.concat(i, e.lookahead(/\s*\?:/)) }
@@ -3236,12 +3251,12 @@ function Tt(n) {
3236
3251
  ]), t.contains = t.contains.concat([
3237
3252
  d,
3238
3253
  a,
3239
- r,
3254
+ s,
3240
3255
  m
3241
3256
  // Added for optional property assignment highlighting
3242
- ]), u(t, "shebang", n.SHEBANG()), u(t, "use_strict", o);
3243
- const y = t.contains.find((f) => f.label === "func.def");
3244
- return y.relevance = 0, Object.assign(t, {
3257
+ ]), h(t, "shebang", n.SHEBANG()), h(t, "use_strict", o);
3258
+ const b = t.contains.find((E) => E.label === "func.def");
3259
+ return b.relevance = 0, Object.assign(t, {
3245
3260
  name: "TypeScript",
3246
3261
  aliases: [
3247
3262
  "ts",
@@ -3401,7 +3416,7 @@ function At(n) {
3401
3416
  }, d = {
3402
3417
  begin: /\{\{/,
3403
3418
  relevance: 0
3404
- }, u = {
3419
+ }, h = {
3405
3420
  className: "string",
3406
3421
  contains: [n.BACKSLASH_ESCAPE],
3407
3422
  variants: [
@@ -3482,7 +3497,7 @@ function At(n) {
3482
3497
  n.APOS_STRING_MODE,
3483
3498
  n.QUOTE_STRING_MODE
3484
3499
  ]
3485
- }, p = "[0-9](_?[0-9])*", m = `(\\b(${p}))?\\.(${p})|\\b(${p})\\.`, y = `\\b|${i.join("|")}`, f = {
3500
+ }, p = "[0-9](_?[0-9])*", m = `(\\b(${p}))?\\.(${p})|\\b(${p})\\.`, b = `\\b|${i.join("|")}`, E = {
3486
3501
  className: "number",
3487
3502
  relevance: 0,
3488
3503
  variants: [
@@ -3497,7 +3512,7 @@ function At(n) {
3497
3512
  // because both MUST contain a decimal point and so cannot be confused with
3498
3513
  // the interior part of an identifier
3499
3514
  {
3500
- begin: `(\\b(${p})|(${m}))[eE][+-]?(${p})[jJ]?(?=${y})`
3515
+ begin: `(\\b(${p})|(${m}))[eE][+-]?(${p})[jJ]?(?=${b})`
3501
3516
  },
3502
3517
  {
3503
3518
  begin: `(${m})[jJ]?`
@@ -3509,24 +3524,24 @@ function At(n) {
3509
3524
  // decinteger is optionally imaginary
3510
3525
  // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals
3511
3526
  {
3512
- begin: `\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${y})`
3527
+ begin: `\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${b})`
3513
3528
  },
3514
3529
  {
3515
- begin: `\\b0[bB](_?[01])+[lL]?(?=${y})`
3530
+ begin: `\\b0[bB](_?[01])+[lL]?(?=${b})`
3516
3531
  },
3517
3532
  {
3518
- begin: `\\b0[oO](_?[0-7])+[lL]?(?=${y})`
3533
+ begin: `\\b0[oO](_?[0-7])+[lL]?(?=${b})`
3519
3534
  },
3520
3535
  {
3521
- begin: `\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${y})`
3536
+ begin: `\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${b})`
3522
3537
  },
3523
3538
  // imagnumber (digitpart-based)
3524
3539
  // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals
3525
3540
  {
3526
- begin: `\\b(${p})[jJ](?=${y})`
3541
+ begin: `\\b(${p})[jJ](?=${b})`
3527
3542
  }
3528
3543
  ]
3529
- }, v = {
3544
+ }, N = {
3530
3545
  className: "comment",
3531
3546
  begin: e.lookahead(/# type:/),
3532
3547
  end: /$/,
@@ -3543,7 +3558,7 @@ function At(n) {
3543
3558
  endsWithParent: !0
3544
3559
  }
3545
3560
  ]
3546
- }, T = {
3561
+ }, S = {
3547
3562
  className: "params",
3548
3563
  variants: [
3549
3564
  // Exclude params in functions without params
@@ -3561,16 +3576,16 @@ function At(n) {
3561
3576
  contains: [
3562
3577
  "self",
3563
3578
  c,
3564
- f,
3565
- u,
3579
+ E,
3580
+ h,
3566
3581
  n.HASH_COMMENT_MODE
3567
3582
  ]
3568
3583
  }
3569
3584
  ]
3570
3585
  };
3571
3586
  return l.contains = [
3572
- u,
3573
- f,
3587
+ h,
3588
+ E,
3574
3589
  c
3575
3590
  ], {
3576
3591
  name: "Python",
@@ -3584,7 +3599,7 @@ function At(n) {
3584
3599
  illegal: /(<\/|\?)|=>/,
3585
3600
  contains: [
3586
3601
  c,
3587
- f,
3602
+ E,
3588
3603
  {
3589
3604
  // very common convention
3590
3605
  scope: "variable.language",
@@ -3597,8 +3612,8 @@ function At(n) {
3597
3612
  relevance: 0
3598
3613
  },
3599
3614
  { match: /\bor\b/, scope: "keyword" },
3600
- u,
3601
- v,
3615
+ h,
3616
+ N,
3602
3617
  n.HASH_COMMENT_MODE,
3603
3618
  {
3604
3619
  match: [
@@ -3610,7 +3625,7 @@ function At(n) {
3610
3625
  1: "keyword",
3611
3626
  3: "title.function"
3612
3627
  },
3613
- contains: [T]
3628
+ contains: [S]
3614
3629
  },
3615
3630
  {
3616
3631
  variants: [
@@ -3644,9 +3659,9 @@ function At(n) {
3644
3659
  begin: /^[\t ]*@/,
3645
3660
  end: /(?=#)|$/,
3646
3661
  contains: [
3647
- f,
3648
- T,
3649
- u
3662
+ E,
3663
+ S,
3664
+ h
3650
3665
  ]
3651
3666
  }
3652
3667
  ]
@@ -3670,7 +3685,7 @@ function pi(n) {
3670
3685
  "true",
3671
3686
  "false",
3672
3687
  "null"
3673
- ], s = {
3688
+ ], r = {
3674
3689
  scope: "literal",
3675
3690
  beginKeywords: i.join(" ")
3676
3691
  };
@@ -3685,7 +3700,7 @@ function pi(n) {
3685
3700
  t,
3686
3701
  n.APOS_STRING_MODE,
3687
3702
  n.QUOTE_STRING_MODE,
3688
- s,
3703
+ r,
3689
3704
  hi,
3690
3705
  n.C_LINE_COMMENT_MODE,
3691
3706
  n.C_BLOCK_COMMENT_MODE
@@ -3718,7 +3733,7 @@ function Me(n) {
3718
3733
  i
3719
3734
  ]
3720
3735
  });
3721
- const s = {
3736
+ const r = {
3722
3737
  className: "subst",
3723
3738
  begin: /\$\(/,
3724
3739
  end: /\)/,
@@ -3734,7 +3749,7 @@ function Me(n) {
3734
3749
  2: "comment"
3735
3750
  }
3736
3751
  }
3737
- ), r = {
3752
+ ), s = {
3738
3753
  begin: /<<-?\s*(?=\w+)/,
3739
3754
  starts: { contains: [
3740
3755
  n.END_SAME_AS_BEGIN({
@@ -3750,10 +3765,10 @@ function Me(n) {
3750
3765
  contains: [
3751
3766
  n.BACKSLASH_ESCAPE,
3752
3767
  t,
3753
- s
3768
+ r
3754
3769
  ]
3755
3770
  };
3756
- s.contains.push(o);
3771
+ r.contains.push(o);
3757
3772
  const c = {
3758
3773
  match: /\\"/
3759
3774
  }, l = {
@@ -3762,7 +3777,7 @@ function Me(n) {
3762
3777
  end: /'/
3763
3778
  }, d = {
3764
3779
  match: /\\'/
3765
- }, u = {
3780
+ }, h = {
3766
3781
  begin: /\$?\(\(/,
3767
3782
  end: /\)\)/,
3768
3783
  contains: [
@@ -3786,13 +3801,13 @@ function Me(n) {
3786
3801
  ], m = n.SHEBANG({
3787
3802
  binary: `(${p.join("|")})`,
3788
3803
  relevance: 10
3789
- }), y = {
3804
+ }), b = {
3790
3805
  className: "function",
3791
3806
  begin: /\w[\w\d_]*\s*\(\s*\)\s*\{/,
3792
3807
  returnBegin: !0,
3793
3808
  contains: [n.inherit(n.TITLE_MODE, { begin: /\w[\w\d_]*/ })],
3794
3809
  relevance: 0
3795
- }, f = [
3810
+ }, E = [
3796
3811
  "if",
3797
3812
  "then",
3798
3813
  "else",
@@ -3810,10 +3825,10 @@ function Me(n) {
3810
3825
  "coproc",
3811
3826
  "function",
3812
3827
  "select"
3813
- ], v = [
3828
+ ], N = [
3814
3829
  "true",
3815
3830
  "false"
3816
- ], T = { match: /(\/[a-z._-]+)+/ }, O = [
3831
+ ], S = { match: /(\/[a-z._-]+)+/ }, O = [
3817
3832
  "break",
3818
3833
  "cd",
3819
3834
  "continue",
@@ -4037,8 +4052,8 @@ function Me(n) {
4037
4052
  ],
4038
4053
  keywords: {
4039
4054
  $pattern: /\b[a-z][a-z0-9._-]+\b/,
4040
- keyword: f,
4041
- literal: v,
4055
+ keyword: E,
4056
+ literal: N,
4042
4057
  built_in: [
4043
4058
  ...O,
4044
4059
  ...U,
@@ -4054,11 +4069,11 @@ function Me(n) {
4054
4069
  // to catch known shells and boost relevancy
4055
4070
  n.SHEBANG(),
4056
4071
  // to catch unknown shells but still highlight the shebang
4057
- y,
4058
- u,
4072
+ b,
4073
+ h,
4059
4074
  a,
4060
- r,
4061
- T,
4075
+ s,
4076
+ S,
4062
4077
  o,
4063
4078
  c,
4064
4079
  l,
@@ -4875,7 +4890,7 @@ const gi = (n) => ({
4875
4890
  "zoom"
4876
4891
  ].sort().reverse();
4877
4892
  function vi(n) {
4878
- const e = n.regex, t = gi(n), i = { begin: /-(webkit|moz|ms|o)-(?=[a-z])/ }, s = "and or not only", a = /@-?\w[\w]*(-\w+)*/, r = "[a-zA-Z-][a-zA-Z0-9_-]*", o = [
4893
+ const e = n.regex, t = gi(n), i = { begin: /-(webkit|moz|ms|o)-(?=[a-z])/ }, r = "and or not only", a = /@-?\w[\w]*(-\w+)*/, s = "[a-zA-Z-][a-zA-Z0-9_-]*", o = [
4879
4894
  n.APOS_STRING_MODE,
4880
4895
  n.QUOTE_STRING_MODE
4881
4896
  ];
@@ -4902,7 +4917,7 @@ function vi(n) {
4902
4917
  },
4903
4918
  {
4904
4919
  className: "selector-class",
4905
- begin: "\\." + r,
4920
+ begin: "\\." + s,
4906
4921
  relevance: 0
4907
4922
  },
4908
4923
  t.ATTRIBUTE_SELECTOR_MODE,
@@ -4977,7 +4992,7 @@ function vi(n) {
4977
4992
  relevance: 0,
4978
4993
  keywords: {
4979
4994
  $pattern: /[a-z-]+/,
4980
- keyword: s,
4995
+ keyword: r,
4981
4996
  attribute: _i.join(" ")
4982
4997
  },
4983
4998
  contains: [
@@ -4999,7 +5014,7 @@ function vi(n) {
4999
5014
  };
5000
5015
  }
5001
5016
  function Re(n) {
5002
- const e = n.regex, t = e.concat(/[\p{L}_]/u, e.optional(/[\p{L}0-9_.-]*:/u), /[\p{L}0-9_.-]*/u), i = /[\p{L}0-9._:-]+/u, s = {
5017
+ const e = n.regex, t = e.concat(/[\p{L}_]/u, e.optional(/[\p{L}0-9_.-]*:/u), /[\p{L}0-9_.-]*/u), i = /[\p{L}0-9._:-]+/u, r = {
5003
5018
  className: "symbol",
5004
5019
  begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/
5005
5020
  }, a = {
@@ -5011,7 +5026,7 @@ function Re(n) {
5011
5026
  illegal: /\n/
5012
5027
  }
5013
5028
  ]
5014
- }, r = n.inherit(a, {
5029
+ }, s = n.inherit(a, {
5015
5030
  begin: /\(/,
5016
5031
  end: /\)/
5017
5032
  }), o = n.inherit(n.APOS_STRING_MODE, { className: "string" }), c = n.inherit(n.QUOTE_STRING_MODE, { className: "string" }), l = {
@@ -5035,12 +5050,12 @@ function Re(n) {
5035
5050
  {
5036
5051
  begin: /"/,
5037
5052
  end: /"/,
5038
- contains: [s]
5053
+ contains: [r]
5039
5054
  },
5040
5055
  {
5041
5056
  begin: /'/,
5042
5057
  end: /'/,
5043
- contains: [s]
5058
+ contains: [r]
5044
5059
  },
5045
5060
  { begin: /[^\s"'=<>`]+/ }
5046
5061
  ]
@@ -5075,7 +5090,7 @@ function Re(n) {
5075
5090
  a,
5076
5091
  c,
5077
5092
  o,
5078
- r,
5093
+ s,
5079
5094
  {
5080
5095
  begin: /\[/,
5081
5096
  end: /\]/,
@@ -5086,7 +5101,7 @@ function Re(n) {
5086
5101
  end: />/,
5087
5102
  contains: [
5088
5103
  a,
5089
- r,
5104
+ s,
5090
5105
  c,
5091
5106
  o
5092
5107
  ]
@@ -5105,7 +5120,7 @@ function Re(n) {
5105
5120
  end: /\]\]>/,
5106
5121
  relevance: 10
5107
5122
  },
5108
- s,
5123
+ r,
5109
5124
  // xml processing instructions
5110
5125
  {
5111
5126
  className: "meta",
@@ -5217,7 +5232,7 @@ function ki(n) {
5217
5232
  contains: [{ match: /''/ }]
5218
5233
  }
5219
5234
  ]
5220
- }, s = {
5235
+ }, r = {
5221
5236
  begin: /"/,
5222
5237
  end: /"/,
5223
5238
  contains: [{ match: /""/ }]
@@ -5227,7 +5242,7 @@ function ki(n) {
5227
5242
  // Not sure it's correct to call NULL literal, and clauses like IS [NOT] NULL look strange that way.
5228
5243
  // "null",
5229
5244
  "unknown"
5230
- ], r = [
5245
+ ], s = [
5231
5246
  "double precision",
5232
5247
  "large object",
5233
5248
  "with timezone",
@@ -5723,7 +5738,7 @@ function ki(n) {
5723
5738
  "var_pop",
5724
5739
  "var_samp",
5725
5740
  "width_bucket"
5726
- ], u = [
5741
+ ], h = [
5727
5742
  "current_catalog",
5728
5743
  "current_date",
5729
5744
  "current_default_transform_group",
@@ -5756,17 +5771,17 @@ function ki(n) {
5756
5771
  "nulls last",
5757
5772
  "depth first",
5758
5773
  "breadth first"
5759
- ], m = d, y = [
5774
+ ], m = d, b = [
5760
5775
  ...l,
5761
5776
  ...c
5762
- ].filter((I) => !d.includes(I)), f = {
5777
+ ].filter((I) => !d.includes(I)), E = {
5763
5778
  scope: "variable",
5764
5779
  match: /@[a-z0-9][a-z0-9_]*/
5765
- }, v = {
5780
+ }, N = {
5766
5781
  scope: "operator",
5767
5782
  match: /[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,
5768
5783
  relevance: 0
5769
- }, T = {
5784
+ }, S = {
5770
5785
  match: e.concat(/\b/, e.either(...m), /\s*\(/),
5771
5786
  relevance: 0,
5772
5787
  keywords: { built_in: m }
@@ -5797,25 +5812,25 @@ function ki(n) {
5797
5812
  illegal: /[{}]|<\//,
5798
5813
  keywords: {
5799
5814
  $pattern: /\b[\w\.]+/,
5800
- keyword: C(y, { when: (I) => I.length < 3 }),
5815
+ keyword: C(b, { when: (I) => I.length < 3 }),
5801
5816
  literal: a,
5802
5817
  type: o,
5803
- built_in: u
5818
+ built_in: h
5804
5819
  },
5805
5820
  contains: [
5806
5821
  {
5807
5822
  scope: "type",
5808
- match: O(r)
5823
+ match: O(s)
5809
5824
  },
5810
5825
  U,
5811
- T,
5812
- f,
5826
+ S,
5827
+ E,
5813
5828
  i,
5814
- s,
5829
+ r,
5815
5830
  n.C_NUMBER_MODE,
5816
5831
  n.C_BLOCK_COMMENT_MODE,
5817
5832
  t,
5818
- v
5833
+ N
5819
5834
  ]
5820
5835
  };
5821
5836
  }
@@ -5834,7 +5849,7 @@ function xt(n) {
5834
5849
  begin: /'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/
5835
5850
  }
5836
5851
  ]
5837
- }, s = {
5852
+ }, r = {
5838
5853
  className: "template-variable",
5839
5854
  variants: [
5840
5855
  {
@@ -5860,7 +5875,7 @@ function xt(n) {
5860
5875
  relevance: 0
5861
5876
  }
5862
5877
  ]
5863
- }, r = {
5878
+ }, s = {
5864
5879
  className: "string",
5865
5880
  relevance: 0,
5866
5881
  variants: [
@@ -5872,9 +5887,9 @@ function xt(n) {
5872
5887
  ],
5873
5888
  contains: [
5874
5889
  n.BACKSLASH_ESCAPE,
5875
- s
5890
+ r
5876
5891
  ]
5877
- }, o = n.inherit(r, { variants: [
5892
+ }, o = n.inherit(s, { variants: [
5878
5893
  {
5879
5894
  begin: /'/,
5880
5895
  end: /'/,
@@ -5899,19 +5914,19 @@ function xt(n) {
5899
5914
  excludeEnd: !0,
5900
5915
  keywords: e,
5901
5916
  relevance: 0
5902
- }, y = {
5917
+ }, b = {
5903
5918
  begin: /\{/,
5904
5919
  end: /\}/,
5905
5920
  contains: [m],
5906
5921
  illegal: "\\n",
5907
5922
  relevance: 0
5908
- }, f = {
5923
+ }, E = {
5909
5924
  begin: "\\[",
5910
5925
  end: "\\]",
5911
5926
  contains: [m],
5912
5927
  illegal: "\\n",
5913
5928
  relevance: 0
5914
- }, v = [
5929
+ }, N = [
5915
5930
  i,
5916
5931
  {
5917
5932
  className: "meta",
@@ -5987,16 +6002,16 @@ function xt(n) {
5987
6002
  begin: n.C_NUMBER_RE + "\\b",
5988
6003
  relevance: 0
5989
6004
  },
5990
- y,
5991
- f,
6005
+ b,
6006
+ E,
5992
6007
  a,
5993
- r
5994
- ], T = [...v];
5995
- return T.pop(), T.push(o), m.contains = T, {
6008
+ s
6009
+ ], S = [...N];
6010
+ return S.pop(), S.push(o), m.contains = S, {
5996
6011
  name: "YAML",
5997
6012
  case_insensitive: !0,
5998
6013
  aliases: ["yml"],
5999
- contains: v
6014
+ contains: N
6000
6015
  };
6001
6016
  }
6002
6017
  function Ct(n) {
@@ -6005,7 +6020,7 @@ function Ct(n) {
6005
6020
  end: ">",
6006
6021
  subLanguage: "xml",
6007
6022
  relevance: 0
6008
- }, i = { match: /^ {0,3}([-*_])[ \t]*(?:\1[ \t]*){2,}$/ }, s = {
6023
+ }, i = { match: /^ {0,3}([-*_])[ \t]*(?:\1[ \t]*){2,}$/ }, r = {
6009
6024
  className: "code",
6010
6025
  variants: [
6011
6026
  // TODO: fix to allow these to work with sublanguage also
@@ -6039,7 +6054,7 @@ function Ct(n) {
6039
6054
  begin: "^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",
6040
6055
  end: "\\s+",
6041
6056
  excludeEnd: !0
6042
- }, r = {
6057
+ }, s = {
6043
6058
  begin: /^\[[^\n]+\]:/,
6044
6059
  returnBegin: !0,
6045
6060
  contains: [
@@ -6145,8 +6160,8 @@ function Ct(n) {
6145
6160
  relevance: 0
6146
6161
  }
6147
6162
  ]
6148
- }, u = n.inherit(l, { contains: [] }), p = n.inherit(d, { contains: [] });
6149
- l.contains.push(p), d.contains.push(u);
6163
+ }, h = n.inherit(l, { contains: [] }), p = n.inherit(d, { contains: [] });
6164
+ l.contains.push(p), d.contains.push(h);
6150
6165
  let m = [
6151
6166
  t,
6152
6167
  c
@@ -6154,10 +6169,10 @@ function Ct(n) {
6154
6169
  return [
6155
6170
  l,
6156
6171
  d,
6157
- u,
6172
+ h,
6158
6173
  p
6159
- ].forEach((T) => {
6160
- T.contains = T.contains.concat(m);
6174
+ ].forEach((S) => {
6175
+ S.contains = S.contains.concat(m);
6161
6176
  }), m = m.concat(l, d), {
6162
6177
  name: "Markdown",
6163
6178
  aliases: [
@@ -6200,9 +6215,9 @@ function Ct(n) {
6200
6215
  contains: m,
6201
6216
  end: "$"
6202
6217
  },
6203
- s,
6204
- c,
6205
6218
  r,
6219
+ c,
6220
+ s,
6206
6221
  {
6207
6222
  //https://spec.commonmark.org/0.31.2/#entity-references
6208
6223
  scope: "literal",
@@ -6365,16 +6380,16 @@ function Ni(n) {
6365
6380
  };
6366
6381
  }
6367
6382
  function Mt(n) {
6368
- const e = n.regex, t = /(r#)?/, i = e.concat(t, n.UNDERSCORE_IDENT_RE), s = e.concat(t, n.IDENT_RE), a = {
6383
+ const e = n.regex, t = /(r#)?/, i = e.concat(t, n.UNDERSCORE_IDENT_RE), r = e.concat(t, n.IDENT_RE), a = {
6369
6384
  scope: "title.function.invoke",
6370
6385
  relevance: 0,
6371
6386
  begin: e.concat(
6372
6387
  /\b/,
6373
6388
  /(?!(?:let|for|while|if|else|match)\b)/,
6374
- s,
6389
+ r,
6375
6390
  e.lookahead(/\s*\(/)
6376
6391
  )
6377
- }, r = "([ui](8|16|32|64|128|size)|f(16|32|64|128))?", o = [
6392
+ }, s = "([ui](8|16|32|64|128|size)|f(16|32|64|128))?", o = [
6378
6393
  "abstract",
6379
6394
  "as",
6380
6395
  "async",
@@ -6570,10 +6585,10 @@ function Mt(n) {
6570
6585
  {
6571
6586
  scope: "number",
6572
6587
  variants: [
6573
- { begin: "\\b0b([01_]+)" + r },
6574
- { begin: "\\b0o([0-7_]+)" + r },
6575
- { begin: "\\b0x([A-Fa-f0-9_]+)" + r },
6576
- { begin: "\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)" + r }
6588
+ { begin: "\\b0b([01_]+)" + s },
6589
+ { begin: "\\b0o([0-7_]+)" + s },
6590
+ { begin: "\\b0x([A-Fa-f0-9_]+)" + s },
6591
+ { begin: "\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)" + s }
6577
6592
  ],
6578
6593
  relevance: 0
6579
6594
  },
@@ -6680,18 +6695,18 @@ function Mt(n) {
6680
6695
  ]
6681
6696
  };
6682
6697
  }
6683
- var se = "[0-9](_*[0-9])*", fe = `\\.(${se})`, be = "[0-9a-fA-F](_*[0-9a-fA-F])*", Je = {
6698
+ var re = "[0-9](_*[0-9])*", fe = `\\.(${re})`, be = "[0-9a-fA-F](_*[0-9a-fA-F])*", Je = {
6684
6699
  className: "number",
6685
6700
  variants: [
6686
6701
  // DecimalFloatingPointLiteral
6687
6702
  // including ExponentPart
6688
- { begin: `(\\b(${se})((${fe})|\\.)?|(${fe}))[eE][+-]?(${se})[fFdD]?\\b` },
6703
+ { begin: `(\\b(${re})((${fe})|\\.)?|(${fe}))[eE][+-]?(${re})[fFdD]?\\b` },
6689
6704
  // excluding ExponentPart
6690
- { begin: `\\b(${se})((${fe})[fFdD]?\\b|\\.([fFdD]\\b)?)` },
6705
+ { begin: `\\b(${re})((${fe})[fFdD]?\\b|\\.([fFdD]\\b)?)` },
6691
6706
  { begin: `(${fe})[fFdD]?\\b` },
6692
- { begin: `\\b(${se})[fFdD]\\b` },
6707
+ { begin: `\\b(${re})[fFdD]\\b` },
6693
6708
  // HexadecimalFloatingPointLiteral
6694
- { begin: `\\b0[xX]((${be})\\.?|(${be})?\\.(${be}))[pP][+-]?(${se})[fFdD]?\\b` },
6709
+ { begin: `\\b0[xX]((${be})\\.?|(${be})?\\.(${be}))[pP][+-]?(${re})[fFdD]?\\b` },
6695
6710
  // DecimalIntegerLiteral
6696
6711
  { begin: "\\b(0|[1-9](_*[0-9])*)[lL]?\\b" },
6697
6712
  // HexIntegerLiteral
@@ -6706,9 +6721,9 @@ var se = "[0-9](_*[0-9])*", fe = `\\.(${se})`, be = "[0-9a-fA-F](_*[0-9a-fA-F])*
6706
6721
  function Rt(n, e, t) {
6707
6722
  return t === -1 ? "" : n.replace(e, (i) => Rt(n, e, t - 1));
6708
6723
  }
6709
- function Si(n) {
6710
- const e = n.regex, t = "[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*", i = "(?:(?:\\s*\\[\\s*])+)?", s = t + "<@@@>" + i, r = "(?:" + ("\\?(?:\\s+(?:extends|super)\\s+" + s + ")?") + "|" + s + ")", o = Rt(
6711
- "(?:\\s*<\\s*" + r + "(?:\\s*,\\s*" + r + ")*\\s*>)?",
6724
+ function Ti(n) {
6725
+ const e = n.regex, t = "[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*", i = "(?:(?:\\s*\\[\\s*])+)?", r = t + "<@@@>" + i, s = "(?:" + ("\\?(?:\\s+(?:extends|super)\\s+" + r + ")?") + "|" + r + ")", o = Rt(
6726
+ "(?:\\s*<\\s*" + s + "(?:\\s*,\\s*" + s + ")*\\s*>)?",
6712
6727
  /<@@@>/g,
6713
6728
  2
6714
6729
  ), p = {
@@ -6788,7 +6803,7 @@ function Si(n) {
6788
6803
  // allow nested () inside our annotation
6789
6804
  }
6790
6805
  ]
6791
- }, y = {
6806
+ }, b = {
6792
6807
  className: "params",
6793
6808
  begin: /\(/,
6794
6809
  end: /\)/,
@@ -6885,7 +6900,7 @@ function Si(n) {
6885
6900
  3: "title.class"
6886
6901
  },
6887
6902
  contains: [
6888
- y,
6903
+ b,
6889
6904
  n.C_LINE_COMMENT_MODE,
6890
6905
  n.C_BLOCK_COMMENT_MODE
6891
6906
  ]
@@ -6926,8 +6941,8 @@ function Si(n) {
6926
6941
  ]
6927
6942
  };
6928
6943
  }
6929
- function Ti(n) {
6930
- const e = n.regex, t = n.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] }), i = "decltype\\(auto\\)", s = "[a-zA-Z_]\\w*::", r = "(" + i + "|" + e.optional(s) + "[a-zA-Z_]\\w*" + e.optional("<[^<>]+>") + ")", o = e.concat(/\batomic_/, e.either(
6944
+ function Si(n) {
6945
+ const e = n.regex, t = n.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] }), i = "decltype\\(auto\\)", r = "[a-zA-Z_]\\w*::", s = "(" + i + "|" + e.optional(r) + "[a-zA-Z_]\\w*" + e.optional("<[^<>]+>") + ")", o = e.concat(/\batomic_/, e.either(
6931
6946
  "bool",
6932
6947
  "char",
6933
6948
  "schar",
@@ -6994,7 +7009,7 @@ function Ti(n) {
6994
7009
  end: /\)([^()\\\s"]{0,16})"/
6995
7010
  })
6996
7011
  ]
6997
- }, u = {
7012
+ }, h = {
6998
7013
  className: "number",
6999
7014
  variants: [
7000
7015
  { match: /\b(0b[01']+)/ },
@@ -7035,14 +7050,14 @@ function Ti(n) {
7035
7050
  t,
7036
7051
  n.C_BLOCK_COMMENT_MODE
7037
7052
  ]
7038
- }, y = [
7053
+ }, b = [
7039
7054
  p,
7040
7055
  m
7041
- ], f = {
7056
+ ], E = {
7042
7057
  className: "title",
7043
- begin: e.optional(s) + n.IDENT_RE,
7058
+ begin: e.optional(r) + n.IDENT_RE,
7044
7059
  relevance: 0
7045
- }, v = e.optional(s) + n.IDENT_RE + "\\s*\\(", T = 12, C = {
7060
+ }, N = e.optional(r) + n.IDENT_RE + "\\s*\\(", S = 12, C = {
7046
7061
  keyword: [
7047
7062
  "asm",
7048
7063
  "auto",
@@ -7127,11 +7142,11 @@ function Ti(n) {
7127
7142
  // TODO: apply hinting work similar to what was done in cpp.js
7128
7143
  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"
7129
7144
  }, I = [
7130
- ...y,
7145
+ ...b,
7131
7146
  c,
7132
7147
  t,
7133
7148
  n.C_BLOCK_COMMENT_MODE,
7134
- u,
7149
+ h,
7135
7150
  d
7136
7151
  ], D = {
7137
7152
  // This mode covers expression context where we can't expect a function
@@ -7163,7 +7178,7 @@ function Ti(n) {
7163
7178
  ]),
7164
7179
  relevance: 0
7165
7180
  }, B = {
7166
- begin: "(" + r + "[\\*&\\s]+){1," + T + "}" + v,
7181
+ begin: "(" + s + "[\\*&\\s]+){1," + S + "}" + N,
7167
7182
  returnBegin: !0,
7168
7183
  end: /[{;=]/,
7169
7184
  excludeEnd: !0,
@@ -7177,9 +7192,9 @@ function Ti(n) {
7177
7192
  relevance: 0
7178
7193
  },
7179
7194
  {
7180
- begin: v,
7195
+ begin: N,
7181
7196
  returnBegin: !0,
7182
- contains: [n.inherit(f, { className: "title.function" })],
7197
+ contains: [n.inherit(E, { className: "title.function" })],
7183
7198
  relevance: 0
7184
7199
  },
7185
7200
  // allow for multiple declarations, e.g.:
@@ -7198,7 +7213,7 @@ function Ti(n) {
7198
7213
  t,
7199
7214
  n.C_BLOCK_COMMENT_MODE,
7200
7215
  d,
7201
- u,
7216
+ h,
7202
7217
  c,
7203
7218
  // Count matching parentheses.
7204
7219
  {
@@ -7211,7 +7226,7 @@ function Ti(n) {
7211
7226
  t,
7212
7227
  n.C_BLOCK_COMMENT_MODE,
7213
7228
  d,
7214
- u,
7229
+ h,
7215
7230
  c
7216
7231
  ]
7217
7232
  }
@@ -7220,7 +7235,7 @@ function Ti(n) {
7220
7235
  c,
7221
7236
  t,
7222
7237
  n.C_BLOCK_COMMENT_MODE,
7223
- ...y
7238
+ ...b
7224
7239
  ]
7225
7240
  };
7226
7241
  return {
@@ -7236,7 +7251,7 @@ function Ti(n) {
7236
7251
  B,
7237
7252
  I,
7238
7253
  [
7239
- ...y,
7254
+ ...b,
7240
7255
  {
7241
7256
  begin: n.IDENT_RE + "::",
7242
7257
  keywords: C
@@ -7260,7 +7275,7 @@ function Ti(n) {
7260
7275
  };
7261
7276
  }
7262
7277
  function Ot(n) {
7263
- const e = n.regex, t = n.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] }), i = "decltype\\(auto\\)", s = "[a-zA-Z_]\\w*::", r = "(?!struct)(" + i + "|" + e.optional(s) + "[a-zA-Z_]\\w*" + e.optional("<[^<>]+>") + ")", o = {
7278
+ const e = n.regex, t = n.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] }), i = "decltype\\(auto\\)", r = "[a-zA-Z_]\\w*::", s = "(?!struct)(" + i + "|" + e.optional(r) + "[a-zA-Z_]\\w*" + e.optional("<[^<>]+>") + ")", o = {
7264
7279
  className: "type",
7265
7280
  begin: "\\b[a-z\\d_]*_t\\b"
7266
7281
  }, l = {
@@ -7301,7 +7316,7 @@ function Ot(n) {
7301
7316
  }
7302
7317
  ],
7303
7318
  relevance: 0
7304
- }, u = {
7319
+ }, h = {
7305
7320
  scope: "meta",
7306
7321
  begin: /#\s*include\b/,
7307
7322
  end: /$/,
@@ -7334,13 +7349,13 @@ function Ot(n) {
7334
7349
  n.C_BLOCK_COMMENT_MODE
7335
7350
  ]
7336
7351
  }, m = [
7337
- u,
7352
+ h,
7338
7353
  p
7339
- ], y = {
7354
+ ], b = {
7340
7355
  className: "title",
7341
- begin: e.optional(s) + n.IDENT_RE,
7356
+ begin: e.optional(r) + n.IDENT_RE,
7342
7357
  relevance: 0
7343
- }, f = e.optional(s) + n.IDENT_RE + "\\s*\\(", v = 12, T = [
7358
+ }, E = e.optional(r) + n.IDENT_RE + "\\s*\\(", N = 12, S = [
7344
7359
  "alignas",
7345
7360
  "alignof",
7346
7361
  "and",
@@ -7606,7 +7621,7 @@ function Ot(n) {
7606
7621
  "vsprintf"
7607
7622
  ], B = {
7608
7623
  type: O,
7609
- keyword: T,
7624
+ keyword: S,
7610
7625
  literal: [
7611
7626
  "NULL",
7612
7627
  "false",
@@ -7625,7 +7640,7 @@ function Ot(n) {
7625
7640
  },
7626
7641
  begin: e.concat(
7627
7642
  /\b/,
7628
- `(?!${T.join("|")})`,
7643
+ `(?!${S.join("|")})`,
7629
7644
  n.IDENT_RE,
7630
7645
  e.lookahead(/(<[^<>]+>|)\s*\(/)
7631
7646
  )
@@ -7668,7 +7683,7 @@ function Ot(n) {
7668
7683
  relevance: 0
7669
7684
  }, j = {
7670
7685
  className: "function",
7671
- begin: "(" + r + "[\\*&\\s]+){1," + v + "}" + f,
7686
+ begin: "(" + s + "[\\*&\\s]+){1," + N + "}" + E,
7672
7687
  returnBegin: !0,
7673
7688
  end: /[{;=]/,
7674
7689
  excludeEnd: !0,
@@ -7682,9 +7697,9 @@ function Ot(n) {
7682
7697
  relevance: 0
7683
7698
  },
7684
7699
  {
7685
- begin: f,
7700
+ begin: E,
7686
7701
  returnBegin: !0,
7687
- contains: [y],
7702
+ contains: [b],
7688
7703
  relevance: 0
7689
7704
  },
7690
7705
  // needed because we do not have look-behind on the below rule
@@ -7796,8 +7811,8 @@ function Ot(n) {
7796
7811
  }
7797
7812
  A.registerLanguage("javascript", _t);
7798
7813
  A.registerLanguage("js", _t);
7799
- A.registerLanguage("typescript", Tt);
7800
- A.registerLanguage("ts", Tt);
7814
+ A.registerLanguage("typescript", St);
7815
+ A.registerLanguage("ts", St);
7801
7816
  A.registerLanguage("python", At);
7802
7817
  A.registerLanguage("py", At);
7803
7818
  A.registerLanguage("json", pi);
@@ -7816,8 +7831,8 @@ A.registerLanguage("md", Ct);
7816
7831
  A.registerLanguage("go", Ni);
7817
7832
  A.registerLanguage("rust", Mt);
7818
7833
  A.registerLanguage("rs", Mt);
7819
- A.registerLanguage("java", Si);
7820
- A.registerLanguage("c", Ti);
7834
+ A.registerLanguage("java", Ti);
7835
+ A.registerLanguage("c", Si);
7821
7836
  A.registerLanguage("cpp", Ot);
7822
7837
  A.registerLanguage("c++", Ot);
7823
7838
  const Ai = /* @__PURE__ */ new Set(["mindmap"]);
@@ -7825,40 +7840,40 @@ function le(n) {
7825
7840
  return n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
7826
7841
  }
7827
7842
  function xi(n, e = {}) {
7828
- const t = new Set(e.reservedLanguages ?? Ai), i = n.renderer.rules.fence ? n.renderer.rules.fence.bind(n.renderer.rules) : (s, a, r, o, c) => c.renderToken(s, a, r);
7829
- n.renderer.rules.fence = (s, a, r, o, c) => {
7830
- var f;
7831
- const l = s[a];
7832
- if (!l) return i(s, a, r, o, c);
7833
- const u = ((f = l.info.trim().split(/\s+/)[0]) == null ? void 0 : f.toLowerCase()) ?? "";
7834
- if (t.has(u))
7835
- return i(s, a, r, o, c);
7843
+ const t = new Set(e.reservedLanguages ?? Ai), i = n.renderer.rules.fence ? n.renderer.rules.fence.bind(n.renderer.rules) : (r, a, s, o, c) => c.renderToken(r, a, s);
7844
+ n.renderer.rules.fence = (r, a, s, o, c) => {
7845
+ var E;
7846
+ const l = r[a];
7847
+ if (!l) return i(r, a, s, o, c);
7848
+ const h = ((E = l.info.trim().split(/\s+/)[0]) == null ? void 0 : E.toLowerCase()) ?? "";
7849
+ if (t.has(h))
7850
+ return i(r, a, s, o, c);
7836
7851
  const p = l.content;
7837
- let m, y = u || "text";
7838
- if (u && A.getLanguage(u))
7852
+ let m, b = h || "text";
7853
+ if (h && A.getLanguage(h))
7839
7854
  try {
7840
7855
  m = A.highlight(p, {
7841
- language: u,
7856
+ language: h,
7842
7857
  ignoreIllegals: !0
7843
7858
  }).value;
7844
7859
  } catch {
7845
7860
  m = le(p);
7846
7861
  }
7847
- else if (u)
7862
+ else if (h)
7848
7863
  try {
7849
- const v = A.highlightAuto(p);
7850
- m = v.value, y = v.language || u;
7864
+ const N = A.highlightAuto(p);
7865
+ m = N.value, b = N.language || h;
7851
7866
  } catch {
7852
7867
  m = le(p);
7853
7868
  }
7854
7869
  else
7855
7870
  try {
7856
- const v = A.highlightAuto(p);
7857
- m = v.value, y = v.language || "text";
7871
+ const N = A.highlightAuto(p);
7872
+ m = N.value, b = N.language || "text";
7858
7873
  } catch {
7859
7874
  m = le(p);
7860
7875
  }
7861
- 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">${le(y)}</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-${le(y)}">${m}</code></pre></div>`;
7876
+ 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">${le(b)}</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-${le(b)}">${m}</code></pre></div>`;
7862
7877
  };
7863
7878
  }
7864
7879
  const Ci = [".mp4", ".webm", ".ogg", ".mov", ".m4v", ".avi", ".mkv"], Mi = [
@@ -7889,16 +7904,16 @@ function Li(n, e = "video") {
7889
7904
  return `![${e}](${n})`;
7890
7905
  }
7891
7906
  function Di(n) {
7892
- const e = n.renderer.rules.image ? n.renderer.rules.image.bind(n.renderer.rules) : (t, i, s, a, r) => r.renderToken(t, i, s);
7893
- n.renderer.rules.image = (t, i, s, a, r) => {
7907
+ const e = n.renderer.rules.image ? n.renderer.rules.image.bind(n.renderer.rules) : (t, i, r, a, s) => s.renderToken(t, i, r);
7908
+ n.renderer.rules.image = (t, i, r, a, s) => {
7894
7909
  const o = t[i];
7895
- if (!o) return e(t, i, s, a, r);
7910
+ if (!o) return e(t, i, r, a, s);
7896
7911
  const c = o.attrGet("src") ?? "";
7897
7912
  if (Ii(c)) {
7898
7913
  const l = o.content || "";
7899
7914
  return `<video src="${c}" controls class="md-editor-video" title="${l}">${l}</video>`;
7900
7915
  }
7901
- return e(t, i, s, a, r);
7916
+ return e(t, i, r, a, s);
7902
7917
  };
7903
7918
  }
7904
7919
  const Pi = /* @__PURE__ */ new Set([
@@ -7924,29 +7939,29 @@ const Pi = /* @__PURE__ */ new Set([
7924
7939
  success: "✓"
7925
7940
  };
7926
7941
  function Hi(n) {
7927
- n.block.ruler.before("fence", "tips_block", (e, t, i, s) => {
7928
- const r = e.src.slice(e.bMarks[t], e.eMarks[t]).match(Bi);
7929
- if (!r) return !1;
7930
- const o = (r[1] ?? "").toLowerCase();
7942
+ n.block.ruler.before("fence", "tips_block", (e, t, i, r) => {
7943
+ const s = e.src.slice(e.bMarks[t], e.eMarks[t]).match(Bi);
7944
+ if (!s) return !1;
7945
+ const o = (s[1] ?? "").toLowerCase();
7931
7946
  if (!Pi.has(o)) return !1;
7932
7947
  let c = t + 1, l = !1;
7933
7948
  for (; c < i; ) {
7934
- const y = e.src.slice(e.bMarks[c], e.eMarks[c]);
7935
- if ($i.test(y.trim())) {
7949
+ const b = e.src.slice(e.bMarks[c], e.eMarks[c]);
7950
+ if ($i.test(b.trim())) {
7936
7951
  l = !0;
7937
7952
  break;
7938
7953
  }
7939
7954
  c++;
7940
7955
  }
7941
7956
  if (!l) return !1;
7942
- if (s) return !0;
7943
- const d = r[2] ?? et[o] ?? o, u = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).trim(), p = n.render(u), m = e.push("tips_block", "div", 0);
7957
+ if (r) return !0;
7958
+ const d = s[2] ?? et[o] ?? o, h = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).trim(), p = n.render(h), m = e.push("tips_block", "div", 0);
7944
7959
  return m.content = p, m.info = o, m.markup = d, e.line = c + 1, !0;
7945
7960
  }), n.renderer.rules.tips_block = (e, t) => {
7946
7961
  const i = e[t];
7947
7962
  if (!i) return "";
7948
- const s = i.info ?? "notice", a = i.markup ?? et[s] ?? "Notice", r = Ui[s] ?? "i", o = i.content ?? "";
7949
- return `<div class="md-editor-tip md-editor-tip--${s}"><div class="md-editor-tip-header"><span class="md-editor-tip-icon">${r}</span><span class="md-editor-tip-title">${Fi(a)}</span></div><div class="md-editor-tip-body">${o}</div></div>`;
7963
+ const r = i.info ?? "notice", a = i.markup ?? et[r] ?? "Notice", s = Ui[r] ?? "i", o = i.content ?? "";
7964
+ return `<div class="md-editor-tip md-editor-tip--${r}"><div class="md-editor-tip-header"><span class="md-editor-tip-icon">${s}</span><span class="md-editor-tip-title">${Fi(a)}</span></div><div class="md-editor-tip-body">${o}</div></div>`;
7950
7965
  };
7951
7966
  }
7952
7967
  function Fi(n) {
@@ -7954,33 +7969,33 @@ function Fi(n) {
7954
7969
  }
7955
7970
  function zi(n) {
7956
7971
  const e = n.renderer.rules.list_item_open;
7957
- n.renderer.rules.list_item_open = (t, i, s, a, r) => {
7972
+ n.renderer.rules.list_item_open = (t, i, r, a, s) => {
7958
7973
  var l, d;
7959
7974
  const o = t[i];
7960
7975
  if (!o)
7961
- return e ? e(t, i, s, a, r) : r.renderToken(t, i, s);
7976
+ return e ? e(t, i, r, a, s) : s.renderToken(t, i, r);
7962
7977
  let c;
7963
- for (let u = i + 1; u < t.length && u < i + 6; u++) {
7964
- if (((l = t[u]) == null ? void 0 : l.type) === "inline") {
7965
- c = t[u];
7978
+ for (let h = i + 1; h < t.length && h < i + 6; h++) {
7979
+ if (((l = t[h]) == null ? void 0 : l.type) === "inline") {
7980
+ c = t[h];
7966
7981
  break;
7967
7982
  }
7968
- if (((d = t[u]) == null ? void 0 : d.type) === "list_item_close") break;
7983
+ if (((d = t[h]) == null ? void 0 : d.type) === "list_item_close") break;
7969
7984
  }
7970
7985
  if (c && c.content) {
7971
- const u = c.content, p = /^\[\s*\]\s/.test(u), m = /^\[\s*[xX]\s*\]\s/.test(u);
7986
+ const h = c.content, p = /^\[\s*\]\s/.test(h), m = /^\[\s*[xX]\s*\]\s/.test(h);
7972
7987
  if (p || m) {
7973
- const y = /^\[\s*(?:[xX])?\s*\]\s/;
7974
- if (c.content = u.replace(y, ""), c.children && c.children.length > 0) {
7975
- const T = c.children[0];
7976
- T && T.type === "text" && (T.content = T.content.replace(y, ""));
7988
+ const b = /^\[\s*(?:[xX])?\s*\]\s/;
7989
+ if (c.content = h.replace(b, ""), c.children && c.children.length > 0) {
7990
+ const S = c.children[0];
7991
+ S && S.type === "text" && (S.content = S.content.replace(b, ""));
7977
7992
  }
7978
7993
  o.attrSet("class", "task-list-item");
7979
- const f = `<input type="checkbox" disabled${p ? " checked" : ""} /> `;
7980
- return (e ? e(t, i, s, a, r) : r.renderToken(t, i, s)) + f;
7994
+ const E = `<input type="checkbox" disabled${p ? " checked" : ""} /> `;
7995
+ return (e ? e(t, i, r, a, s) : s.renderToken(t, i, r)) + E;
7981
7996
  }
7982
7997
  }
7983
- return e ? e(t, i, s, a, r) : r.renderToken(t, i, s);
7998
+ return e ? e(t, i, r, a, s) : s.renderToken(t, i, r);
7984
7999
  };
7985
8000
  }
7986
8001
  class It {
@@ -8002,10 +8017,14 @@ class It {
8002
8017
  * mindmap placeholders into real SVG diagrams.
8003
8018
  */
8004
8019
  async hydrate(e) {
8005
- this.mindmapEnabled && await un(e);
8020
+ if (this.mindmapEnabled)
8021
+ try {
8022
+ await un(e);
8023
+ } catch {
8024
+ }
8006
8025
  }
8007
8026
  }
8008
- function ds(n, e = {}) {
8027
+ function dr(n, e = {}) {
8009
8028
  return new It(e).render(n);
8010
8029
  }
8011
8030
  class Ki {
@@ -8013,11 +8032,11 @@ class Ki {
8013
8032
  this.buttons = /* @__PURE__ */ new Map(), this.el = document.createElement("div"), this.el.className = "md-editor-toolbar", this.el.setAttribute("role", "toolbar");
8014
8033
  for (const t of e) {
8015
8034
  const i = document.createElement("button");
8016
- if (i.type = "button", i.className = "md-editor-toolbar-btn", t.toggle && i.classList.add("is-toggle"), t.active && i.classList.add("is-active"), i.title = t.title, i.setAttribute("aria-label", t.title), i.setAttribute("data-action", t.name), i.innerHTML = t.icon, i.addEventListener("mousedown", (s) => {
8017
- s.preventDefault(), s.stopPropagation(), t.handler(i);
8035
+ if (i.type = "button", i.className = "md-editor-toolbar-btn", t.toggle && i.classList.add("is-toggle"), t.active && i.classList.add("is-active"), i.title = t.title, i.setAttribute("aria-label", t.title), i.setAttribute("data-action", t.name), i.innerHTML = t.icon, i.addEventListener("mousedown", (r) => {
8036
+ r.preventDefault(), r.stopPropagation(), t.handler(i);
8018
8037
  }), this.buttons.set(t.name, i), this.el.appendChild(i), t.groupEnd) {
8019
- const s = document.createElement("span");
8020
- s.className = "md-editor-toolbar-sep", this.el.appendChild(s);
8038
+ const r = document.createElement("span");
8039
+ r.className = "md-editor-toolbar-sep", this.el.appendChild(r);
8021
8040
  }
8022
8041
  }
8023
8042
  }
@@ -8063,15 +8082,15 @@ function Xi(n) {
8063
8082
  function Qi(n) {
8064
8083
  const e = n.split(`
8065
8084
  `), t = [];
8066
- let i = [], s = !1, a = "", r = 0, o = !1;
8085
+ let i = [], r = !1, a = "", s = 0, o = !1;
8067
8086
  for (const l of e) {
8068
8087
  const d = l.match(Wi);
8069
8088
  if (d) {
8070
- const u = d[1] ?? "", p = u[0] ?? "", m = u.length;
8071
- s ? p === a && m >= r && Yi.test(l) && (s = !1) : (s = !0, a = p, r = m), i.push(l);
8089
+ const h = d[1] ?? "", p = h[0] ?? "", m = h.length;
8090
+ r ? p === a && m >= s && Yi.test(l) && (r = !1) : (r = !0, a = p, s = m), i.push(l);
8072
8091
  continue;
8073
8092
  }
8074
- if (s || (!o && Zi.test(l) ? o = !0 : o && Vi.test(l) && (o = !1)), !s && !o && qi.test(l) && i.length > 0) {
8093
+ if (r || (!o && Zi.test(l) ? o = !0 : o && Vi.test(l) && (o = !1)), !r && !o && qi.test(l) && i.length > 0) {
8075
8094
  t.push(i.join(`
8076
8095
  `)), i = [l];
8077
8096
  continue;
@@ -8082,8 +8101,8 @@ function Qi(n) {
8082
8101
  `)), t.length === 0 && t.push("");
8083
8102
  const c = /* @__PURE__ */ new Map();
8084
8103
  return t.map((l) => {
8085
- const d = Xi(l), u = (c.get(d) ?? 0) + 1;
8086
- return c.set(d, u), { key: `${d}#${u}`, hash: d, source: l };
8104
+ const d = Xi(l), h = (c.get(d) ?? 0) + 1;
8105
+ return c.set(d, h), { key: `${d}#${h}`, hash: d, source: l };
8087
8106
  });
8088
8107
  }
8089
8108
  class Ji {
@@ -8091,17 +8110,25 @@ class Ji {
8091
8110
  this.container = e, this.renderBlock = t, this.maxCacheEntries = i, this.nodeByKey = /* @__PURE__ */ new Map(), this.htmlByHash = /* @__PURE__ */ new Map(), this.prevBlocks = [];
8092
8111
  }
8093
8112
  update(e) {
8094
- const t = Qi(e), i = document.createDocumentFragment(), s = /* @__PURE__ */ new Map();
8113
+ const t = Qi(e), i = document.createDocumentFragment(), r = /* @__PURE__ */ new Map();
8095
8114
  let a = 0;
8096
- for (const r of t) {
8097
- let o = this.nodeByKey.get(r.key);
8115
+ for (const s of t) {
8116
+ let o = this.nodeByKey.get(s.key);
8098
8117
  if (!o) {
8099
- let c = this.htmlByHash.get(r.hash);
8100
- c === void 0 && (c = this.renderBlock(r.source), this.htmlByHash.set(r.hash, c), a++), o = document.createElement("div"), o.className = "md-editor-block", o.dataset.blockKey = r.key, o.innerHTML = c;
8118
+ let c = this.htmlByHash.get(s.hash);
8119
+ if (c === void 0) {
8120
+ try {
8121
+ c = this.renderBlock(s.source);
8122
+ } catch {
8123
+ c = `<pre>${this.escapeHtml(s.source)}</pre>`;
8124
+ }
8125
+ this.htmlByHash.set(s.hash, c), a++;
8126
+ }
8127
+ o = document.createElement("div"), o.className = "md-editor-block", o.dataset.blockKey = s.key, o.innerHTML = c;
8101
8128
  }
8102
- s.set(r.key, o), i.appendChild(o);
8129
+ r.set(s.key, o), i.appendChild(o);
8103
8130
  }
8104
- return this.container.innerHTML = "", this.container.appendChild(i), this.nodeByKey = s, this.prevBlocks = t, this.evictCacheIfNeeded(t), { rerenderedCount: a, totalCount: t.length };
8131
+ return this.container.innerHTML = "", this.container.appendChild(i), this.nodeByKey = r, this.prevBlocks = t, this.evictCacheIfNeeded(t), { rerenderedCount: a, totalCount: t.length };
8105
8132
  }
8106
8133
  /**
8107
8134
  * When the cache exceeds the limit, evict hashes that no longer appear in
@@ -8117,32 +8144,35 @@ class Ji {
8117
8144
  getBlockCount() {
8118
8145
  return this.prevBlocks.length;
8119
8146
  }
8147
+ escapeHtml(e) {
8148
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
8149
+ }
8120
8150
  destroy() {
8121
8151
  this.container.innerHTML = "", this.nodeByKey.clear(), this.htmlByHash.clear(), this.prevBlocks = [];
8122
8152
  }
8123
8153
  }
8124
8154
  function ji(n, e) {
8125
8155
  let t, i;
8126
- const s = (...a) => {
8156
+ const r = (...a) => {
8127
8157
  i = a, t !== void 0 && clearTimeout(t), t = setTimeout(() => {
8128
8158
  t = void 0, i && n(...i);
8129
8159
  }, e);
8130
8160
  };
8131
- return s.cancel = () => {
8161
+ return r.cancel = () => {
8132
8162
  t !== void 0 && clearTimeout(t), t = void 0;
8133
- }, s.flush = () => {
8163
+ }, r.flush = () => {
8134
8164
  t !== void 0 && (clearTimeout(t), t = void 0, i && n(...i));
8135
- }, s;
8165
+ }, r;
8136
8166
  }
8137
- function es(n, e = 120, t = 600) {
8138
- const i = Math.max(0, n), s = Math.floor(i / 2e4) * 60;
8139
- return Math.min(t, e + s);
8167
+ function er(n, e = 120, t = 600) {
8168
+ const i = Math.max(0, n), r = Math.floor(i / 2e4) * 60;
8169
+ return Math.min(t, e + r);
8140
8170
  }
8141
- function us(n, e = 300) {
8171
+ function ur(n, e = 300) {
8142
8172
  const t = window;
8143
8173
  return typeof t.requestIdleCallback == "function" ? t.requestIdleCallback(n, { timeout: e }) : window.setTimeout(n, 0);
8144
8174
  }
8145
- function hs(n) {
8175
+ function hr(n) {
8146
8176
  const e = window;
8147
8177
  typeof e.cancelIdleCallback == "function" ? e.cancelIdleCallback(n) : clearTimeout(n);
8148
8178
  }
@@ -8227,8 +8257,8 @@ const L = (n) => `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xm
8227
8257
  class Q {
8228
8258
  constructor(e, t) {
8229
8259
  this.inputs = /* @__PURE__ */ new Map(), this.destroyed = !1, this.anchor = e, this.config = t, this.el = document.createElement("div"), this.el.className = "md-editor-popup", this.el.setAttribute("role", "dialog"), this.el.setAttribute("aria-label", t.title), t.theme && this.el.setAttribute("data-theme", t.theme), this.build(), this.onOutsideClick = (i) => {
8230
- const s = i.target;
8231
- !this.el.contains(s) && !this.anchor.contains(s) && this.hide();
8260
+ const r = i.target;
8261
+ !this.el.contains(r) && !this.anchor.contains(r) && this.hide();
8232
8262
  }, this.onKeyDown = (i) => {
8233
8263
  i.key === "Escape" && this.hide();
8234
8264
  };
@@ -8238,22 +8268,22 @@ class Q {
8238
8268
  e.className = "md-editor-popup-header", e.textContent = this.config.title;
8239
8269
  const t = document.createElement("div");
8240
8270
  t.className = "md-editor-popup-body";
8241
- for (const r of this.config.fields) {
8271
+ for (const s of this.config.fields) {
8242
8272
  const o = document.createElement("div");
8243
8273
  o.className = "md-editor-popup-field";
8244
8274
  const c = document.createElement("label");
8245
- c.className = "md-editor-popup-label", c.textContent = r.label, c.setAttribute("for", `md-editor-popup-${r.name}`);
8275
+ c.className = "md-editor-popup-label", c.textContent = s.label, c.setAttribute("for", `md-editor-popup-${s.name}`);
8246
8276
  let l;
8247
- r.type === "textarea" ? (l = document.createElement("textarea"), l.rows = 2) : (l = document.createElement("input"), l.type = "text"), l.id = `md-editor-popup-${r.name}`, l.className = "md-editor-popup-input", r.placeholder && (l.placeholder = r.placeholder), r.required && (l.required = !0), o.appendChild(c), o.appendChild(l), t.appendChild(o), this.inputs.set(r.name, l);
8277
+ 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(c), o.appendChild(l), t.appendChild(o), this.inputs.set(s.name, l);
8248
8278
  }
8249
8279
  const i = document.createElement("div");
8250
8280
  i.className = "md-editor-popup-footer";
8251
- const s = document.createElement("button");
8252
- s.type = "button", s.className = "md-editor-popup-btn md-editor-popup-btn--ghost", s.textContent = "Cancel", s.addEventListener("click", () => this.hide());
8281
+ const r = document.createElement("button");
8282
+ r.type = "button", r.className = "md-editor-popup-btn md-editor-popup-btn--ghost", r.textContent = "Cancel", r.addEventListener("click", () => this.hide());
8253
8283
  const a = document.createElement("button");
8254
- a.type = "button", a.className = "md-editor-popup-btn md-editor-popup-btn--primary", a.textContent = this.config.submitLabel ?? "Insert", a.addEventListener("click", () => this.submit()), i.appendChild(s), i.appendChild(a), this.el.appendChild(e), this.el.appendChild(t), this.el.appendChild(i);
8255
- for (const r of this.inputs.values())
8256
- r.tagName === "INPUT" && r.addEventListener("keydown", (o) => {
8284
+ a.type = "button", a.className = "md-editor-popup-btn md-editor-popup-btn--primary", a.textContent = this.config.submitLabel ?? "Insert", a.addEventListener("click", () => this.submit()), i.appendChild(r), i.appendChild(a), this.el.appendChild(e), this.el.appendChild(t), this.el.appendChild(i);
8285
+ for (const s of this.inputs.values())
8286
+ s.tagName === "INPUT" && s.addEventListener("keydown", (o) => {
8257
8287
  const c = o;
8258
8288
  c.key === "Enter" && (c.preventDefault(), this.submit());
8259
8289
  });
@@ -8276,14 +8306,14 @@ class Q {
8276
8306
  position() {
8277
8307
  const e = this.anchor.getBoundingClientRect(), t = this.el.getBoundingClientRect();
8278
8308
  let i = e.left;
8279
- const s = e.bottom + 6;
8280
- i + t.width > window.innerWidth - 8 && (i = window.innerWidth - t.width - 8), i < 8 && (i = 8), this.el.style.left = `${i + window.scrollX}px`, this.el.style.top = `${s + window.scrollY}px`;
8309
+ const r = e.bottom + 6;
8310
+ i + t.width > window.innerWidth - 8 && (i = window.innerWidth - t.width - 8), i < 8 && (i = 8), this.el.style.left = `${i + window.scrollX}px`, this.el.style.top = `${r + window.scrollY}px`;
8281
8311
  }
8282
8312
  destroy() {
8283
8313
  this.hide(), this.destroyed = !0, this.inputs.clear();
8284
8314
  }
8285
8315
  }
8286
- const ts = [
8316
+ const tr = [
8287
8317
  { action: "bold", key: "Mod-b", description: "Bold" },
8288
8318
  { action: "italic", key: "Mod-i", description: "Italic" },
8289
8319
  { action: "heading", key: "Mod-Alt-1", description: "Heading" },
@@ -8297,17 +8327,17 @@ const ts = [
8297
8327
  { action: "preview", key: "Mod-Alt-p", description: "Toggle preview" },
8298
8328
  { action: "theme", key: "Mod-Shift-l", description: "Toggle theme" }
8299
8329
  ];
8300
- function ps(n, e) {
8330
+ function pr(n, e) {
8301
8331
  var c;
8302
8332
  const t = n.toLowerCase().split("-");
8303
- let i = "", s = !1, a = !1, r = !1, o = !1;
8333
+ let i = "", r = !1, a = !1, s = !1, o = !1;
8304
8334
  for (const l of t)
8305
8335
  switch (l) {
8306
8336
  case "mod":
8307
- (c = navigator.platform) != null && c.toLowerCase().includes("mac") ? a = !0 : s = !0;
8337
+ (c = navigator.platform) != null && c.toLowerCase().includes("mac") ? a = !0 : r = !0;
8308
8338
  break;
8309
8339
  case "ctrl":
8310
- s = !0;
8340
+ r = !0;
8311
8341
  break;
8312
8342
  case "meta":
8313
8343
  case "cmd":
@@ -8315,7 +8345,7 @@ function ps(n, e) {
8315
8345
  break;
8316
8346
  case "alt":
8317
8347
  case "option":
8318
- r = !0;
8348
+ s = !0;
8319
8349
  break;
8320
8350
  case "shift":
8321
8351
  o = !0;
@@ -8323,13 +8353,13 @@ function ps(n, e) {
8323
8353
  default:
8324
8354
  i = l;
8325
8355
  }
8326
- return !(e.ctrlKey !== s || e.metaKey !== a || e.altKey !== r || e.shiftKey !== o || e.key.toLowerCase() !== i);
8356
+ return !(e.ctrlKey !== r || e.metaKey !== a || e.altKey !== s || e.shiftKey !== o || e.key.toLowerCase() !== i);
8327
8357
  }
8328
- function gs(n) {
8358
+ function gr(n) {
8329
8359
  var i;
8330
8360
  const e = ((i = navigator.platform) == null ? void 0 : i.toLowerCase().includes("mac")) ?? !1;
8331
- return n.split("-").map((s) => {
8332
- switch (s.toLowerCase()) {
8361
+ return n.split("-").map((r) => {
8362
+ switch (r.toLowerCase()) {
8333
8363
  case "mod":
8334
8364
  return e ? "Cmd" : "Ctrl";
8335
8365
  case "ctrl":
@@ -8342,36 +8372,36 @@ function gs(n) {
8342
8372
  case "shift":
8343
8373
  return "Shift";
8344
8374
  default:
8345
- return s.toUpperCase();
8375
+ return r.toUpperCase();
8346
8376
  }
8347
8377
  }).join("+");
8348
8378
  }
8349
- function ns(n) {
8379
+ function nr(n) {
8350
8380
  var i;
8351
8381
  const e = ((i = navigator.platform) == null ? void 0 : i.toLowerCase().includes("mac")) ?? !1;
8352
- return n.split("-").map((s) => {
8353
- let a = s, r = "";
8354
- switch (s.toLowerCase()) {
8382
+ return n.split("-").map((r) => {
8383
+ let a = r, s = "";
8384
+ switch (r.toLowerCase()) {
8355
8385
  case "mod":
8356
- a = e ? "Cmd" : "Ctrl", r = e ? "⌘" : "";
8386
+ a = e ? "Cmd" : "Ctrl", s = e ? "⌘" : "";
8357
8387
  break;
8358
8388
  case "ctrl":
8359
- a = "Ctrl", r = e ? "⌃" : "";
8389
+ a = "Ctrl", s = e ? "⌃" : "";
8360
8390
  break;
8361
8391
  case "meta":
8362
8392
  case "cmd":
8363
- a = "Cmd", r = "⌘";
8393
+ a = "Cmd", s = "⌘";
8364
8394
  break;
8365
8395
  case "alt":
8366
- a = e ? "Option" : "Alt", r = e ? "⌥" : "";
8396
+ a = e ? "Option" : "Alt", s = e ? "⌥" : "";
8367
8397
  break;
8368
8398
  case "shift":
8369
- a = "Shift", r = "⇧";
8399
+ a = "Shift", s = "⇧";
8370
8400
  break;
8371
8401
  default:
8372
- a = s.toUpperCase();
8402
+ a = r.toUpperCase();
8373
8403
  }
8374
- return `<kbd class="md-editor-kbd">${r ? `<span class="md-editor-kbd-symbol">${r}</span>` : ""}<span>${a}</span></kbd>`;
8404
+ return `<kbd class="md-editor-kbd">${s ? `<span class="md-editor-kbd-symbol">${s}</span>` : ""}<span>${a}</span></kbd>`;
8375
8405
  }).join('<span class="md-editor-kbd-plus">+</span>');
8376
8406
  }
8377
8407
  const nt = {
@@ -8401,29 +8431,29 @@ const nt = {
8401
8431
  ---
8402
8432
  `, "", ""]
8403
8433
  };
8404
- class ms {
8434
+ class mr {
8405
8435
  constructor(e, t = {}) {
8406
8436
  this.previewPane = null, this.incremental = null, this.toolbar = null, this.statusBar = null, this.activePopup = null, this.scheduledRender = null, this.scheduledWait = 0;
8407
8437
  const i = typeof e == "string" ? document.querySelector(e) : e;
8408
8438
  if (!i) throw new Error("MarkdownEditor: mount container not found");
8409
- this.container = i, this.mode = t.mode ?? "simple", this.theme = t.theme ?? "light", this.showPreview = t.preview ?? !0, this.autoPreview = t.autoPreview ?? !0, this.renderDebounceOpt = t.renderDebounce, this.onChange = t.onChange, this.onImageUpload = t.onImageUpload, this.toolbarConfig = t.toolbar, this.shortcuts = ts, this.container.classList.add("md-editor-root", `md-editor-mode-${this.mode}`), this.container.setAttribute("data-theme", this.theme), this.renderer = new It({
8439
+ this.container = i, this.mode = t.mode ?? "simple", this.theme = t.theme ?? "light", this.showPreview = t.preview ?? !0, this.autoPreview = t.autoPreview ?? !0, this.renderDebounceOpt = t.renderDebounce, this.onChange = t.onChange, this.onImageUpload = t.onImageUpload, this.toolbarConfig = t.toolbar, this.shortcuts = tr, this.container.classList.add("md-editor-root", `md-editor-mode-${this.mode}`), this.container.setAttribute("data-theme", this.theme), this.renderer = new It({
8410
8440
  math: t.math ?? !0,
8411
8441
  mindmap: t.mindmap ?? !0,
8412
8442
  codeHighlight: t.codeHighlight ?? !0,
8413
8443
  tips: t.tips ?? !0
8414
- }), this.buildLayout(), this.codeEditor = new sn(this.editorPane, {
8444
+ }), this.buildLayout(), this.codeEditor = new rn(this.editorPane, {
8415
8445
  value: t.value ?? "",
8416
8446
  lineNumbers: this.mode === "complex",
8417
- onChange: (s) => {
8447
+ onChange: (r) => {
8418
8448
  var a;
8419
- (a = this.onChange) == null || a.call(this, s), this.autoPreview && this.requestPreviewRender(s), this.updateStatusBar(s);
8449
+ (a = this.onChange) == null || a.call(this, r), this.autoPreview && this.requestPreviewRender(r), this.updateStatusBar(r);
8420
8450
  },
8421
- onImageFile: (s) => this.handleImageFile(s),
8451
+ onImageFile: (r) => this.handleImageFile(r),
8422
8452
  mention: t.mention,
8423
8453
  docLink: t.docLink
8424
8454
  }), this.setupKeyboardShortcuts(), this.mode === "complex" && (this.buildToolbar(), this.buildStatusBar()), this.previewPane && (this.previewPane.classList.add("markdown-body"), this.incremental = new Ji(
8425
8455
  this.previewPane,
8426
- (s) => this.renderer.render(s)
8456
+ (r) => this.renderer.render(r)
8427
8457
  ), this.setupCopyHandler()), this.renderPreview(t.value ?? ""), this.updateStatusBar(t.value ?? "");
8428
8458
  }
8429
8459
  // ---------- Layout ----------
@@ -8444,12 +8474,12 @@ class ms {
8444
8474
  return this.toolbarConfig && !Array.isArray(this.toolbarConfig) ? ((i = this.toolbarConfig[e]) == null ? void 0 : i.icon) ?? t : t;
8445
8475
  }
8446
8476
  buildToolbar() {
8447
- const e = [], t = (i, s, a, r, o = {}) => {
8477
+ const e = [], t = (i, r, a, s, o = {}) => {
8448
8478
  this.isActionVisible(i) && e.push({
8449
8479
  name: i,
8450
- title: this.getActionLabel(i, s),
8480
+ title: this.getActionLabel(i, r),
8451
8481
  icon: this.getActionIcon(i, a),
8452
- handler: r,
8482
+ handler: s,
8453
8483
  ...o
8454
8484
  });
8455
8485
  };
@@ -8528,8 +8558,8 @@ class ms {
8528
8558
  { name: "url", label: "Image URL", placeholder: "https://example.com/image.png" },
8529
8559
  ...t ? [{ name: "file", label: "Or paste/drop an image into the editor", type: "text", placeholder: "Upload via paste or drag-and-drop" }] : []
8530
8560
  ],
8531
- onSubmit: (s) => {
8532
- const a = s.url ?? "";
8561
+ onSubmit: (r) => {
8562
+ const a = r.url ?? "";
8533
8563
  a && this.codeEditor.insertAtCursor(je(a, "image"));
8534
8564
  }
8535
8565
  }), this.activePopup.show();
@@ -8544,8 +8574,8 @@ class ms {
8544
8574
  { name: "alt", label: "Title", placeholder: "video title" }
8545
8575
  ],
8546
8576
  onSubmit: (i) => {
8547
- const s = i.url ?? "";
8548
- s && this.codeEditor.insertAtCursor(Li(s, i.alt || "video"));
8577
+ const r = i.url ?? "";
8578
+ r && this.codeEditor.insertAtCursor(Li(r, i.alt || "video"));
8549
8579
  }
8550
8580
  }), this.activePopup.show();
8551
8581
  }
@@ -8563,7 +8593,7 @@ class ms {
8563
8593
  }
8564
8594
  ],
8565
8595
  onSubmit: (i) => {
8566
- const s = i.url ?? "", a = Ri(s);
8596
+ const r = i.url ?? "", a = Ri(r);
8567
8597
  a && this.codeEditor.insertAtCursor(Oi(a));
8568
8598
  }
8569
8599
  }), this.activePopup.show();
@@ -8579,22 +8609,22 @@ class ms {
8579
8609
  ],
8580
8610
  submitLabel: "Insert",
8581
8611
  onSubmit: (i) => {
8582
- const s = Math.max(1, Math.min(50, parseInt(i.rows ?? "3", 10) || 3)), a = Math.max(1, Math.min(20, parseInt(i.cols ?? "3", 10) || 3));
8583
- this.codeEditor.insertAtCursor(this.generateTable(s, a));
8612
+ const r = Math.max(1, Math.min(50, parseInt(i.rows ?? "3", 10) || 3)), a = Math.max(1, Math.min(20, parseInt(i.cols ?? "3", 10) || 3));
8613
+ this.codeEditor.insertAtCursor(this.generateTable(r, a));
8584
8614
  }
8585
8615
  }), this.activePopup.show();
8586
8616
  }
8587
8617
  generateTable(e, t) {
8588
- const i = "| " + Array.from({ length: t }, (o, c) => `Col ${c + 1}`).join(" | ") + " |", s = "| " + Array.from({ length: t }, () => "---").join(" | ") + " |", a = Math.max(0, e - 1), r = Array.from(
8618
+ const i = "| " + Array.from({ length: t }, (o, c) => `Col ${c + 1}`).join(" | ") + " |", r = "| " + Array.from({ length: t }, () => "---").join(" | ") + " |", a = Math.max(0, e - 1), s = Array.from(
8589
8619
  { length: a },
8590
8620
  () => "| " + Array.from({ length: t }, () => "content").join(" | ") + " |"
8591
8621
  ).join(`
8592
8622
  `);
8593
8623
  return a > 0 ? `${i}
8594
- ${s}
8595
8624
  ${r}
8596
- ` : `${i}
8597
8625
  ${s}
8626
+ ` : `${i}
8627
+ ${r}
8598
8628
  `;
8599
8629
  }
8600
8630
  showHelpPopup(e) {
@@ -8608,7 +8638,7 @@ ${s}
8608
8638
  }
8609
8639
  }), i = t.el.querySelector(".md-editor-popup-body");
8610
8640
  if (i) {
8611
- const r = [
8641
+ const s = [
8612
8642
  { label: "Task list", hint: "- [ ] checked / - [x] unchecked" },
8613
8643
  { label: "@mention", hint: "Type @ then pick a user from the dropdown" },
8614
8644
  { label: "Document link", hint: "Type / then pick a document" },
@@ -8619,17 +8649,17 @@ ${s}
8619
8649
  i.innerHTML = '<div class="md-editor-help-list">' + this.shortcuts.map(
8620
8650
  (o) => `<div class="md-editor-help-row">
8621
8651
  <span class="md-editor-help-desc">${o.description}</span>
8622
- <span class="md-editor-help-keys">${ns(o.key)}</span>
8652
+ <span class="md-editor-help-keys">${nr(o.key)}</span>
8623
8653
  </div>`
8624
- ).join("") + '</div><div class="md-editor-help-section-title">Syntax</div><div class="md-editor-help-list">' + r.map(
8654
+ ).join("") + '</div><div class="md-editor-help-section-title">Syntax</div><div class="md-editor-help-list">' + s.map(
8625
8655
  (o) => `<div class="md-editor-help-row">
8626
8656
  <span class="md-editor-help-desc">${o.label}</span>
8627
8657
  <span class="md-editor-help-syntax">${o.hint}</span>
8628
8658
  </div>`
8629
8659
  ).join("") + "</div>";
8630
8660
  }
8631
- const s = t.el.querySelector(".md-editor-popup-footer");
8632
- s && s.remove(), this.activePopup = t, this.activePopup.show();
8661
+ const r = t.el.querySelector(".md-editor-popup-footer");
8662
+ r && r.remove(), this.activePopup = t, this.activePopup.show();
8633
8663
  }
8634
8664
  // ---------- Image upload ----------
8635
8665
  async handleImageFile(e) {
@@ -8642,8 +8672,8 @@ ${s}
8642
8672
  }
8643
8673
  // ---------- Tips / callout dropdown ----------
8644
8674
  showTipsPopup(e) {
8645
- var r;
8646
- (r = this.activePopup) == null || r.destroy();
8675
+ var s;
8676
+ (s = this.activePopup) == null || s.destroy();
8647
8677
  const t = [
8648
8678
  { key: "notice", label: "Notice", color: "#0969da" },
8649
8679
  { key: "info", label: "Info", color: "#0969da" },
@@ -8657,8 +8687,8 @@ ${s}
8657
8687
  fields: [],
8658
8688
  onSubmit: () => {
8659
8689
  }
8660
- }), s = i.el.querySelector(".md-editor-popup-body");
8661
- if (s) {
8690
+ }), r = i.el.querySelector(".md-editor-popup-body");
8691
+ if (r) {
8662
8692
  const o = document.createElement("div");
8663
8693
  o.className = "md-editor-tips-grid";
8664
8694
  for (const c of t) {
@@ -8674,15 +8704,15 @@ Your ${c.key.toLowerCase()} content here.
8674
8704
  ), i.hide();
8675
8705
  }), o.appendChild(l);
8676
8706
  }
8677
- s.innerHTML = "", s.appendChild(o);
8707
+ r.innerHTML = "", r.appendChild(o);
8678
8708
  }
8679
8709
  const a = i.el.querySelector(".md-editor-popup-footer");
8680
8710
  a && a.remove(), this.activePopup = i, this.activePopup.show();
8681
8711
  }
8682
8712
  // ---------- Math formula template dropdown ----------
8683
8713
  showMathPopup(e) {
8684
- var r;
8685
- (r = this.activePopup) == null || r.destroy();
8714
+ var s;
8715
+ (s = this.activePopup) == null || s.destroy();
8686
8716
  const t = [
8687
8717
  { label: "Inline formula", snippet: "$E=mc^2$", hint: "Inline $...$" },
8688
8718
  { label: "Block formula", snippet: `$$
@@ -8707,8 +8737,8 @@ $$
8707
8737
  fields: [],
8708
8738
  onSubmit: () => {
8709
8739
  }
8710
- }), s = i.el.querySelector(".md-editor-popup-body");
8711
- if (s) {
8740
+ }), r = i.el.querySelector(".md-editor-popup-body");
8741
+ if (r) {
8712
8742
  const o = document.createElement("div");
8713
8743
  o.className = "md-editor-template-grid";
8714
8744
  for (const c of t) {
@@ -8717,15 +8747,15 @@ $$
8717
8747
  this.codeEditor.insertAtCursor(c.snippet), i.hide();
8718
8748
  }), o.appendChild(l);
8719
8749
  }
8720
- s.innerHTML = "", s.appendChild(o);
8750
+ r.innerHTML = "", r.appendChild(o);
8721
8751
  }
8722
8752
  const a = i.el.querySelector(".md-editor-popup-footer");
8723
8753
  a && a.remove(), this.activePopup = i, this.activePopup.show();
8724
8754
  }
8725
8755
  // ---------- Mindmap template dropdown ----------
8726
8756
  showMindmapPopup(e) {
8727
- var r;
8728
- (r = this.activePopup) == null || r.destroy();
8757
+ var s;
8758
+ (s = this.activePopup) == null || s.destroy();
8729
8759
  const t = [
8730
8760
  {
8731
8761
  label: "Simple",
@@ -8797,8 +8827,8 @@ $$
8797
8827
  fields: [],
8798
8828
  onSubmit: () => {
8799
8829
  }
8800
- }), s = i.el.querySelector(".md-editor-popup-body");
8801
- if (s) {
8830
+ }), r = i.el.querySelector(".md-editor-popup-body");
8831
+ if (r) {
8802
8832
  const o = document.createElement("div");
8803
8833
  o.className = "md-editor-template-grid";
8804
8834
  for (const c of t) {
@@ -8807,7 +8837,7 @@ $$
8807
8837
  this.codeEditor.insertAtCursor(c.snippet), i.hide();
8808
8838
  }), o.appendChild(l);
8809
8839
  }
8810
- s.innerHTML = "", s.appendChild(o);
8840
+ r.innerHTML = "", r.appendChild(o);
8811
8841
  }
8812
8842
  const a = i.el.querySelector(".md-editor-popup-footer");
8813
8843
  a && a.remove(), this.activePopup = i, this.activePopup.show();
@@ -8817,21 +8847,21 @@ $$
8817
8847
  this.previewPane && this.previewPane.addEventListener("click", (e) => {
8818
8848
  const t = e.target.closest(".md-editor-codeblock-copy");
8819
8849
  if (!t) return;
8820
- const i = t.closest(".md-editor-codeblock"), s = i == null ? void 0 : i.querySelector("code");
8821
- if (!s) return;
8822
- const a = s.textContent ?? "";
8850
+ const i = t.closest(".md-editor-codeblock"), r = i == null ? void 0 : i.querySelector("code");
8851
+ if (!r) return;
8852
+ const a = r.textContent ?? "";
8823
8853
  this.copyToClipboard(a, t);
8824
8854
  });
8825
8855
  }
8826
8856
  copyToClipboard(e, t) {
8827
- var s;
8857
+ var r;
8828
8858
  const i = () => {
8829
8859
  const a = t.textContent;
8830
8860
  t.textContent = "Copied!", t.classList.add("is-copied"), window.setTimeout(() => {
8831
8861
  t.textContent = a, t.classList.remove("is-copied");
8832
8862
  }, 2e3);
8833
8863
  };
8834
- (s = navigator.clipboard) != null && s.writeText ? navigator.clipboard.writeText(e).then(i).catch(() => {
8864
+ (r = navigator.clipboard) != null && r.writeText ? navigator.clipboard.writeText(e).then(i).catch(() => {
8835
8865
  this.fallbackCopy(e, i);
8836
8866
  }) : this.fallbackCopy(e, i);
8837
8867
  }
@@ -8839,19 +8869,22 @@ $$
8839
8869
  try {
8840
8870
  const i = document.createElement("textarea");
8841
8871
  i.value = e, i.style.position = "fixed", i.style.opacity = "0", document.body.appendChild(i), i.select();
8842
- const s = document.execCommand("copy");
8843
- document.body.removeChild(i), s && t();
8872
+ const r = document.execCommand("copy");
8873
+ document.body.removeChild(i), r && t();
8844
8874
  } catch {
8845
8875
  }
8846
8876
  }
8877
+ escapeHtml(e) {
8878
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
8879
+ }
8847
8880
  // ---------- Snippets ----------
8848
8881
  insertSnippet(e) {
8849
- const [t, i, s] = nt[e];
8850
- this.codeEditor.insertAtCursor(`${t}${s}${i}`);
8882
+ const [t, i, r] = nt[e];
8883
+ this.codeEditor.insertAtCursor(`${t}${r}${i}`);
8851
8884
  }
8852
8885
  wrapSnippet(e) {
8853
- const [t, i, s] = nt[e];
8854
- this.codeEditor.wrapSelection(t, i, s);
8886
+ const [t, i, r] = nt[e];
8887
+ this.codeEditor.wrapSelection(t, i, r);
8855
8888
  }
8856
8889
  togglePreview() {
8857
8890
  var t;
@@ -8861,22 +8894,28 @@ $$
8861
8894
  }
8862
8895
  // ---------- Render scheduling (performance core) ----------
8863
8896
  requestPreviewRender(e) {
8864
- var i, s;
8865
- const t = this.renderDebounceOpt === !1 ? 0 : this.renderDebounceOpt ?? es(e.length);
8897
+ var i, r;
8898
+ const t = this.renderDebounceOpt === !1 ? 0 : this.renderDebounceOpt ?? er(e.length);
8866
8899
  if (t === 0) {
8867
8900
  (i = this.scheduledRender) == null || i.cancel(), this.scheduledRender = null, this.renderPreview(e);
8868
8901
  return;
8869
8902
  }
8870
- (!this.scheduledRender || this.scheduledWait !== t) && ((s = this.scheduledRender) == null || s.cancel(), this.scheduledRender = ji((a) => this.renderPreview(a), t), this.scheduledWait = t), this.scheduledRender(e);
8903
+ (!this.scheduledRender || this.scheduledWait !== t) && ((r = this.scheduledRender) == null || r.cancel(), this.scheduledRender = ji((a) => this.renderPreview(a), t), this.scheduledWait = t), this.scheduledRender(e);
8871
8904
  }
8872
8905
  renderPreview(e) {
8873
8906
  if (!this.previewPane || !this.incremental) return;
8874
- const { totalCount: t } = this.incremental.update(e);
8875
- if (this.renderer.hydrate(this.previewPane), this.statusBar) {
8876
- const { charCount: i, wordCount: s } = tt(e);
8907
+ let t = 0;
8908
+ try {
8909
+ t = this.incremental.update(e).totalCount;
8910
+ } catch {
8911
+ this.previewPane.innerHTML = `<pre style="padding:16px;white-space:pre-wrap;word-break:break-word;">${this.escapeHtml(e)}</pre>`;
8912
+ }
8913
+ if (this.renderer.hydrate(this.previewPane).catch(() => {
8914
+ }), this.statusBar) {
8915
+ const { charCount: i, wordCount: r } = tt(e);
8877
8916
  this.statusBar.update({
8878
8917
  charCount: i,
8879
- wordCount: s,
8918
+ wordCount: r,
8880
8919
  blockCount: t,
8881
8920
  mode: this.mode,
8882
8921
  autoPreview: this.autoPreview
@@ -8884,13 +8923,13 @@ $$
8884
8923
  }
8885
8924
  }
8886
8925
  updateStatusBar(e) {
8887
- var s;
8926
+ var r;
8888
8927
  if (!this.statusBar) return;
8889
8928
  const { charCount: t, wordCount: i } = tt(e);
8890
8929
  this.statusBar.update({
8891
8930
  charCount: t,
8892
8931
  wordCount: i,
8893
- blockCount: ((s = this.incremental) == null ? void 0 : s.getBlockCount()) ?? 0,
8932
+ blockCount: ((r = this.incremental) == null ? void 0 : r.getBlockCount()) ?? 0,
8894
8933
  mode: this.mode,
8895
8934
  autoPreview: this.autoPreview
8896
8935
  });
@@ -8914,8 +8953,8 @@ $$
8914
8953
  this.autoPreview = e, e && this.renderPreview(this.codeEditor.getValue()), this.updateStatusBar(this.codeEditor.getValue());
8915
8954
  }
8916
8955
  setMode(e) {
8917
- var t, i, s;
8918
- e !== this.mode && (this.mode = e, this.container.classList.remove("md-editor-mode-simple", "md-editor-mode-complex"), this.container.classList.add(`md-editor-mode-${e}`), this.codeEditor.setLineNumbers(e === "complex"), (t = this.toolbar) == null || t.destroy(), this.toolbar = null, (i = this.statusBar) == null || i.destroy(), this.statusBar = null, (s = this.activePopup) == null || s.destroy(), this.activePopup = null, e === "complex" && (this.buildToolbar(), this.buildStatusBar(), this.updateStatusBar(this.codeEditor.getValue())));
8956
+ var t, i, r;
8957
+ e !== this.mode && (this.mode = e, this.container.classList.remove("md-editor-mode-simple", "md-editor-mode-complex"), this.container.classList.add(`md-editor-mode-${e}`), this.codeEditor.setLineNumbers(e === "complex"), (t = this.toolbar) == null || t.destroy(), this.toolbar = null, (i = this.statusBar) == null || i.destroy(), this.statusBar = null, (r = this.activePopup) == null || r.destroy(), this.activePopup = null, e === "complex" && (this.buildToolbar(), this.buildStatusBar(), this.updateStatusBar(this.codeEditor.getValue())));
8919
8958
  }
8920
8959
  setTheme(e) {
8921
8960
  var t;
@@ -8925,32 +8964,32 @@ $$
8925
8964
  this.codeEditor.focus();
8926
8965
  }
8927
8966
  destroy() {
8928
- var e, t, i, s, a;
8929
- (e = this.scheduledRender) == null || e.cancel(), this.scheduledRender = null, (t = this.activePopup) == null || t.destroy(), this.activePopup = null, this.codeEditor.destroy(), (i = this.toolbar) == null || i.destroy(), this.toolbar = null, (s = this.statusBar) == null || s.destroy(), this.statusBar = null, (a = this.incremental) == null || a.destroy(), this.incremental = null, this.container.innerHTML = "", this.container.classList.remove("md-editor-root", `md-editor-mode-${this.mode}`), this.container.removeAttribute("data-theme");
8967
+ var e, t, i, r, a;
8968
+ (e = this.scheduledRender) == null || e.cancel(), this.scheduledRender = null, (t = this.activePopup) == null || t.destroy(), this.activePopup = null, this.codeEditor.destroy(), (i = this.toolbar) == null || i.destroy(), this.toolbar = null, (r = this.statusBar) == null || r.destroy(), this.statusBar = null, (a = this.incremental) == null || a.destroy(), this.incremental = null, this.container.innerHTML = "", this.container.classList.remove("md-editor-root", `md-editor-mode-${this.mode}`), this.container.removeAttribute("data-theme");
8930
8969
  }
8931
8970
  }
8932
8971
  export {
8933
- sn as CodeEditor,
8934
- ts as DEFAULT_SHORTCUTS,
8972
+ rn as CodeEditor,
8973
+ tr as DEFAULT_SHORTCUTS,
8935
8974
  Ji as IncrementalRenderer,
8936
- ms as MarkdownEditor,
8975
+ mr as MarkdownEditor,
8937
8976
  Q as Popup,
8938
8977
  It as Renderer,
8939
8978
  Gi as StatusBar,
8940
8979
  Ki as Toolbar,
8941
- es as adaptiveDebounceMs,
8942
- hs as cancelIdle,
8980
+ er as adaptiveDebounceMs,
8981
+ hr as cancelIdle,
8943
8982
  tt as countText,
8944
8983
  ji as debounce,
8945
8984
  Ri as extractYouTubeId,
8946
- gs as formatShortcut,
8947
- ns as formatShortcutHtml,
8985
+ gr as formatShortcut,
8986
+ nr as formatShortcutHtml,
8948
8987
  R as icons,
8949
8988
  je as imageMarkdown,
8950
8989
  Ii as isVideoFile,
8951
- ps as matchShortcut,
8952
- ds as renderMarkdown,
8953
- us as scheduleIdle,
8990
+ pr as matchShortcut,
8991
+ dr as renderMarkdown,
8992
+ ur as scheduleIdle,
8954
8993
  Qi as splitIntoBlocks,
8955
8994
  Li as videoMarkdown,
8956
8995
  Oi as youTubeEmbedMarkdown