@powerduck/md-editor 0.9.1 → 0.9.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
@@ -35,9 +35,9 @@ class Zt {
35
35
  if (!this.dropdown || this.items.length === 0) return !1;
36
36
  switch (e.key) {
37
37
  case "ArrowDown":
38
- return e.preventDefault(), this.selectedIndex = (this.selectedIndex + 1) % this.items.length, this.renderDropdown(), !0;
38
+ return e.preventDefault(), this.selectedIndex = (this.selectedIndex + 1) % this.items.length, this.updateActiveClass(), !0;
39
39
  case "ArrowUp":
40
- return e.preventDefault(), this.selectedIndex = (this.selectedIndex - 1 + this.items.length) % this.items.length, this.renderDropdown(), !0;
40
+ return e.preventDefault(), this.selectedIndex = (this.selectedIndex - 1 + this.items.length) % this.items.length, this.updateActiveClass(), !0;
41
41
  case "Enter":
42
42
  case "Tab":
43
43
  return e.preventDefault(), this.selectItem(this.selectedIndex), !0;
@@ -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, r = e - t.from;
51
- for (let a = r - 1; a >= 0; a--) {
52
- const s = i[a];
53
- if (s === "@") {
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 === "@") {
54
54
  if (a === 0 || /\s|[^\w@]/.test(i[a - 1])) {
55
- const o = i.slice(a + 1, r);
55
+ const o = i.slice(a + 1, s);
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(s)) break;
60
+ if (/\s/.test(r)) 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 r = await this.options.onMentionSearch(e);
75
+ const s = await this.options.onMentionSearch(e);
76
76
  if (t || this.destroyed) return;
77
- this.items = r.slice(0, this.options.maxItems), this.selectedIndex = 0, this.items.length > 0 ? this.show() : this.hide();
77
+ this.items = s.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
  }
@@ -84,7 +84,18 @@ class Zt {
84
84
  if (this.activeHead = this.view.state.selection.main.head, !this.dropdown) {
85
85
  this.dropdown = document.createElement("div"), this.dropdown.className = "md-editor-mention-dropdown", this.dropdown.setAttribute("role", "listbox");
86
86
  const e = this.view.dom.closest(".md-editor-root"), t = (e == null ? void 0 : e.getAttribute("data-theme")) ?? "light";
87
- this.dropdown.setAttribute("data-theme", t), document.body.appendChild(this.dropdown);
87
+ this.dropdown.setAttribute("data-theme", t), document.body.appendChild(this.dropdown), this.dropdown.addEventListener("mousedown", (i) => {
88
+ const a = i.target.closest(".md-editor-mention-item");
89
+ if (!a) return;
90
+ i.preventDefault(), i.stopPropagation();
91
+ const r = Number(a.dataset.index);
92
+ Number.isNaN(r) || this.selectItem(r);
93
+ }), this.dropdown.addEventListener("mouseover", (i) => {
94
+ const a = i.target.closest(".md-editor-mention-item");
95
+ if (!a) return;
96
+ const r = Number(a.dataset.index);
97
+ !Number.isNaN(r) && r !== this.selectedIndex && (this.selectedIndex = r, this.updateActiveClass());
98
+ });
88
99
  }
89
100
  this.renderDropdown(), this.positionDropdown();
90
101
  }
@@ -92,41 +103,52 @@ class Zt {
92
103
  renderDropdown() {
93
104
  this.dropdown && (this.dropdown.innerHTML = "", this.items.forEach((e, t) => {
94
105
  const i = document.createElement("div");
95
- 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"), e.avatar) {
96
- const s = document.createElement("img");
97
- s.className = "md-editor-mention-avatar", s.src = e.avatar, s.alt = "", i.appendChild(s);
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);
98
109
  }
99
- const r = document.createElement("div");
100
- r.className = "md-editor-mention-text";
110
+ const s = document.createElement("div");
111
+ s.className = "md-editor-mention-text";
101
112
  const a = document.createElement("div");
102
- if (a.className = "md-editor-mention-label", a.textContent = e.label, r.appendChild(a), e.description) {
103
- const s = document.createElement("div");
104
- s.className = "md-editor-mention-desc", s.textContent = e.description, r.appendChild(s);
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);
105
116
  }
106
- i.appendChild(r), i.addEventListener("mousedown", (s) => {
107
- s.preventDefault(), s.stopPropagation(), this.selectItem(t);
108
- }), i.addEventListener("click", (s) => {
109
- s.preventDefault(), s.stopPropagation(), this.selectItem(t);
110
- }), i.addEventListener("mouseenter", () => {
111
- this.selectedIndex = t, this.renderDropdown();
112
- }), this.dropdown.appendChild(i);
117
+ i.appendChild(s), this.dropdown.appendChild(i);
113
118
  }));
114
119
  }
120
+ /** Update the active-item CSS class without rebuilding the DOM. */
121
+ updateActiveClass() {
122
+ if (!this.dropdown) return;
123
+ const e = this.dropdown.children;
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");
127
+ }
128
+ }
115
129
  positionDropdown() {
116
130
  if (!this.dropdown || !this.trigger) return;
117
- const e = this.view.coordsAtPos(this.trigger.from);
118
- if (!e) return;
131
+ let e = null;
132
+ try {
133
+ e = this.view.coordsAtPos(this.trigger.from);
134
+ } catch {
135
+ e = null;
136
+ }
137
+ if (!e) {
138
+ const r = this.view.dom.getBoundingClientRect();
139
+ e = { top: r.top, bottom: r.top + 20, left: r.left };
140
+ }
119
141
  const t = this.dropdown.getBoundingClientRect(), i = window.innerHeight;
120
- let r = e.bottom + 4, a = e.left;
121
- 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`;
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`;
122
144
  }
123
145
  selectItem(e) {
124
146
  const t = this.items[e], i = this.trigger;
125
147
  if (!t || !i) return;
126
- const r = this.options.onMentionSelect(t), a = i.from, s = this.activeHead;
148
+ const s = this.options.onMentionSelect(t), a = i.from, r = this.activeHead;
127
149
  this.view.focus(), this.view.dispatch({
128
- changes: { from: a, to: s, insert: r },
129
- selection: { anchor: a + r.length }
150
+ changes: { from: a, to: r, insert: s },
151
+ selection: { anchor: a + s.length }
130
152
  }), this.hide();
131
153
  }
132
154
  hide() {
@@ -147,8 +169,8 @@ function Xt(n, e) {
147
169
  var c, l, d, h, p, m, y;
148
170
  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;
149
171
  a && (t.title = a.trim());
150
- 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"));
151
- s && (t.description = s.trim());
172
+ const r = ((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"));
173
+ r && (t.description = r.trim());
152
174
  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"));
153
175
  return o && (t.thumbnail = o.startsWith("http") ? o : new URL(o, e).href), t;
154
176
  }
@@ -180,9 +202,9 @@ class Qt {
180
202
  if (!this.dropdown || this.items.length === 0) return !1;
181
203
  switch (e.key) {
182
204
  case "ArrowDown":
183
- return e.preventDefault(), this.selectedIndex = (this.selectedIndex + 1) % this.items.length, this.renderDropdown(), !0;
205
+ return e.preventDefault(), this.selectedIndex = (this.selectedIndex + 1) % this.items.length, this.updateActiveClass(), !0;
184
206
  case "ArrowUp":
185
- return e.preventDefault(), this.selectedIndex = (this.selectedIndex - 1 + this.items.length) % this.items.length, this.renderDropdown(), !0;
207
+ return e.preventDefault(), this.selectedIndex = (this.selectedIndex - 1 + this.items.length) % this.items.length, this.updateActiveClass(), !0;
186
208
  case "Enter":
187
209
  case "Tab":
188
210
  return e.preventDefault(), this.selectItem(this.selectedIndex), !0;
@@ -192,13 +214,13 @@ class Qt {
192
214
  return !1;
193
215
  }
194
216
  findTrigger() {
195
- 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;
196
- for (let s = r - 1; s >= 0; s--) {
197
- const o = i[s];
217
+ 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;
218
+ for (let r = s - 1; r >= 0; r--) {
219
+ const o = i[r];
198
220
  if (o === a) {
199
- if (s === 0 || /\s/.test(i[s - 1])) {
200
- const c = i.slice(s + 1, r);
201
- return /\s/.test(c) ? null : { from: t.from + s, query: c };
221
+ if (r === 0 || /\s/.test(i[r - 1])) {
222
+ const c = i.slice(r + 1, s);
223
+ return /\s/.test(c) ? null : { from: t.from + r, query: c };
202
224
  }
203
225
  return null;
204
226
  }
@@ -217,9 +239,9 @@ class Qt {
217
239
  return;
218
240
  }
219
241
  try {
220
- const r = await this.options.onDocSearch(e);
242
+ const s = await this.options.onDocSearch(e);
221
243
  if (t || this.destroyed) return;
222
- this.items = r.slice(0, this.options.maxItems), this.selectedIndex = 0, this.items.length > 0 ? this.show() : this.hide();
244
+ this.items = s.slice(0, this.options.maxItems), this.selectedIndex = 0, this.items.length > 0 ? this.show() : this.hide();
223
245
  } catch {
224
246
  t || this.hide();
225
247
  }
@@ -229,7 +251,18 @@ class Qt {
229
251
  if (this.activeHead = this.view.state.selection.main.head, !this.dropdown) {
230
252
  this.dropdown = document.createElement("div"), this.dropdown.className = "md-editor-doclink-dropdown", this.dropdown.setAttribute("role", "listbox");
231
253
  const e = this.view.dom.closest(".md-editor-root"), t = (e == null ? void 0 : e.getAttribute("data-theme")) ?? "light";
232
- this.dropdown.setAttribute("data-theme", t), document.body.appendChild(this.dropdown);
254
+ this.dropdown.setAttribute("data-theme", t), document.body.appendChild(this.dropdown), this.dropdown.addEventListener("mousedown", (i) => {
255
+ const a = i.target.closest(".md-editor-doclink-item");
256
+ if (!a) return;
257
+ i.preventDefault(), i.stopPropagation();
258
+ const r = Number(a.dataset.index);
259
+ Number.isNaN(r) || this.selectItem(r);
260
+ }), this.dropdown.addEventListener("mouseover", (i) => {
261
+ const a = i.target.closest(".md-editor-doclink-item");
262
+ if (!a) return;
263
+ const r = Number(a.dataset.index);
264
+ !Number.isNaN(r) && r !== this.selectedIndex && (this.selectedIndex = r, this.updateActiveClass());
265
+ });
233
266
  }
234
267
  this.renderDropdown(), this.positionDropdown();
235
268
  }
@@ -237,52 +270,63 @@ class Qt {
237
270
  renderDropdown() {
238
271
  this.dropdown && (this.dropdown.innerHTML = "", this.items.forEach((e, t) => {
239
272
  const i = document.createElement("div");
240
- if (i.className = "md-editor-doclink-item" + (t === this.selectedIndex ? " is-active" : ""), i.setAttribute("role", "option"), i.setAttribute("aria-selected", t === this.selectedIndex ? "true" : "false"), e.thumbnail) {
273
+ if (i.className = "md-editor-doclink-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.thumbnail) {
241
274
  const o = document.createElement("img");
242
275
  o.className = "md-editor-doclink-thumb-img", o.src = e.thumbnail, o.alt = "", i.appendChild(o);
243
276
  }
244
- const r = document.createElement("div");
245
- r.className = "md-editor-doclink-text";
277
+ const s = document.createElement("div");
278
+ s.className = "md-editor-doclink-text";
246
279
  const a = document.createElement("div");
247
- if (a.className = "md-editor-doclink-label", a.textContent = e.title, r.appendChild(a), e.description) {
280
+ if (a.className = "md-editor-doclink-label", a.textContent = e.title, s.appendChild(a), e.description) {
248
281
  const o = document.createElement("div");
249
- o.className = "md-editor-doclink-desc", o.textContent = e.description, r.appendChild(o);
282
+ o.className = "md-editor-doclink-desc", o.textContent = e.description, s.appendChild(o);
250
283
  }
251
- const s = document.createElement("div");
252
- s.className = "md-editor-doclink-url";
284
+ const r = document.createElement("div");
285
+ r.className = "md-editor-doclink-url";
253
286
  try {
254
- s.textContent = new URL(e.url).hostname;
287
+ r.textContent = new URL(e.url).hostname;
255
288
  } catch {
256
- s.textContent = e.url;
289
+ r.textContent = e.url;
257
290
  }
258
- r.appendChild(s), i.appendChild(r), i.addEventListener("mousedown", (o) => {
259
- o.preventDefault(), o.stopPropagation(), this.selectItem(t);
260
- }), i.addEventListener("click", (o) => {
261
- o.preventDefault(), o.stopPropagation(), this.selectItem(t);
262
- }), i.addEventListener("mouseenter", () => {
263
- this.selectedIndex = t, this.renderDropdown();
264
- }), this.dropdown.appendChild(i);
291
+ s.appendChild(r), i.appendChild(s), this.dropdown.appendChild(i);
265
292
  }));
266
293
  }
294
+ /** Update the active-item CSS class without rebuilding the DOM. */
295
+ updateActiveClass() {
296
+ if (!this.dropdown) return;
297
+ const e = this.dropdown.children;
298
+ for (let t = 0; t < e.length; t++) {
299
+ const i = e[t], s = t === this.selectedIndex;
300
+ i.classList.toggle("is-active", s), i.setAttribute("aria-selected", s ? "true" : "false");
301
+ }
302
+ }
267
303
  positionDropdown() {
268
304
  if (!this.dropdown || !this.trigger) return;
269
- const e = this.view.coordsAtPos(this.trigger.from);
270
- if (!e) return;
305
+ let e = null;
306
+ try {
307
+ e = this.view.coordsAtPos(this.trigger.from);
308
+ } catch {
309
+ e = null;
310
+ }
311
+ if (!e) {
312
+ const r = this.view.dom.getBoundingClientRect();
313
+ e = { top: r.top, bottom: r.top + 20, left: r.left };
314
+ }
271
315
  const t = this.dropdown.getBoundingClientRect(), i = window.innerHeight;
272
- let r = e.bottom + 4, a = e.left;
273
- 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`;
316
+ let s = e.bottom + 4, a = e.left;
317
+ 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`;
274
318
  }
275
319
  async selectItem(e) {
276
320
  const t = this.items[e], i = this.trigger;
277
321
  if (!t || !i) return;
278
- const r = i.from, a = this.activeHead;
322
+ const s = i.from, a = this.activeHead;
279
323
  this.view.focus(), this.view.dispatch({
280
- changes: { from: r, to: a, insert: "" }
324
+ changes: { from: s, to: a, insert: "" }
281
325
  });
282
- const s = await this.buildInsertion(t);
326
+ const r = await this.buildInsertion(t);
283
327
  this.view.dispatch({
284
- changes: { from: r, insert: s },
285
- selection: { anchor: r + s.length }
328
+ changes: { from: s, insert: r },
329
+ selection: { anchor: s + r.length }
286
330
  }), this.hide();
287
331
  }
288
332
  /**
@@ -313,9 +357,9 @@ class Qt {
313
357
  return `[${e.title}](${e.url})`;
314
358
  if (t === "card" && !a)
315
359
  return `[${e.title}](${e.url})`;
316
- const s = [`:::doc-link ${e.url}`];
317
- return s.push(`# ${i.title ?? e.title}`), i.thumbnail && s.push(`![thumbnail](${i.thumbnail})`), i.description && s.push(i.description), s.push(":::"), `
318
- ` + s.join(`
360
+ const r = [`:::doc-link ${e.url}`];
361
+ return r.push(`# ${i.title ?? e.title}`), i.thumbnail && r.push(`![thumbnail](${i.thumbnail})`), i.description && r.push(i.description), r.push(":::"), `
362
+ ` + r.join(`
319
363
  `) + `
320
364
  `;
321
365
  }
@@ -329,10 +373,10 @@ class Qt {
329
373
  }
330
374
  const Jt = /^:::doc-link\s+(\S+)(?:\s+(.+))?$/, jt = /^:::\s*$/;
331
375
  function en(n) {
332
- n.block.ruler.before("fence", "doclink_block", (e, t, i, r) => {
333
- const s = e.src.slice(e.bMarks[t], e.eMarks[t]).match(Jt);
334
- if (!s) return !1;
335
- const o = s[1] ?? "";
376
+ n.block.ruler.before("fence", "doclink_block", (e, t, i, s) => {
377
+ const r = e.src.slice(e.bMarks[t], e.eMarks[t]).match(Jt);
378
+ if (!r) return !1;
379
+ const o = r[1] ?? "";
336
380
  let c = t + 1, l = !1;
337
381
  for (; c < i; ) {
338
382
  const f = e.src.slice(e.bMarks[c], e.eMarks[c]);
@@ -343,7 +387,7 @@ function en(n) {
343
387
  c++;
344
388
  }
345
389
  if (!l) return !1;
346
- if (r) return !0;
390
+ if (s) return !0;
347
391
  const d = e.src.slice(e.bMarks[t + 1], e.bMarks[c]).split(`
348
392
  `).map((f) => f.trim()).filter((f) => f.length > 0);
349
393
  let h = "", p = "";
@@ -361,23 +405,23 @@ function en(n) {
361
405
  }), n.renderer.rules.doclink_block = (e, t) => {
362
406
  const i = e[t];
363
407
  if (!i) return "";
364
- let r;
408
+ let s;
365
409
  try {
366
- r = JSON.parse(i.content);
410
+ s = JSON.parse(i.content);
367
411
  } catch {
368
412
  return "";
369
413
  }
370
- const { url: a, title: s, thumbnail: o, description: c } = r;
414
+ const { url: a, title: r, thumbnail: o, description: c } = s;
371
415
  let l = a;
372
416
  try {
373
417
  l = new URL(a).hostname;
374
418
  } catch {
375
419
  }
376
420
  const d = o ? `<div class="md-editor-doclink-card-thumb"><img src="${Fe(o)}" alt="" loading="lazy" /></div>` : "";
377
- return `<a class="md-editor-doclink-card" href="${Fe(a)}" target="_blank" rel="noopener noreferrer"><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>` + d + "</a>";
421
+ return `<a class="md-editor-doclink-card" href="${Fe(a)}" target="_blank" rel="noopener noreferrer"><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>` + d + "</a>";
378
422
  };
379
423
  }
380
- function Te(n) {
424
+ function Se(n) {
381
425
  return n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
382
426
  }
383
427
  function Fe(n) {
@@ -385,7 +429,7 @@ function Fe(n) {
385
429
  }
386
430
  class tn {
387
431
  constructor(e, t) {
388
- var r, a;
432
+ var s, a;
389
433
  this.lineNumbersCompartment = new Be(), this.customKeymapCompartment = new Be(), this.mention = null, this.docLink = null, this.onImageFile = t.onImageFile;
390
434
  const i = [
391
435
  zt(),
@@ -394,50 +438,50 @@ class tn {
394
438
  qt({ codeLanguages: Wt }),
395
439
  ge.lineWrapping,
396
440
  this.lineNumbersCompartment.of(t.lineNumbers ? Ue() : []),
397
- ge.updateListener.of((s) => {
441
+ ge.updateListener.of((r) => {
398
442
  var o, c, l;
399
- (s.docChanged || s.selectionSet) && ((o = t.onChange) == null || o.call(t, s.state.doc.toString()), (c = this.mention) == null || c.update(), (l = this.docLink) == null || l.update());
443
+ (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());
400
444
  }),
401
445
  // Close dropdowns when the editor loses focus
402
446
  ge.domEventHandlers({
403
- paste: (s) => this.handlePaste(s),
404
- drop: (s) => this.handleDrop(s),
447
+ paste: (r) => this.handlePaste(r),
448
+ drop: (r) => this.handleDrop(r),
405
449
  blur: () => {
406
450
  window.setTimeout(() => {
407
- var s, o;
408
- this.view.dom.contains(document.activeElement) || ((s = this.mention) == null || s.hide(), (o = this.docLink) == null || o.hide());
451
+ var r, o;
452
+ this.view.dom.contains(document.activeElement) || ((r = this.mention) == null || r.hide(), (o = this.docLink) == null || o.hide());
409
453
  }, 150);
410
454
  },
411
- keydown: (s) => {
455
+ keydown: (r) => {
412
456
  var o, c;
413
- return !!((o = this.mention) != null && o.handleKey(s) || (c = this.docLink) != null && c.handleKey(s));
457
+ return !!((o = this.mention) != null && o.handleKey(r) || (c = this.docLink) != null && c.handleKey(r));
414
458
  }
415
459
  })
416
460
  ];
417
461
  this.view = new ge({
418
462
  state: Ft.create({ doc: t.value ?? "", extensions: i }),
419
463
  parent: e
420
- }), (r = t.mention) != null && r.onMentionSearch && (this.mention = new Zt(this.view, t.mention)), (a = t.docLink) != null && a.onDocSearch && (this.docLink = new Qt(this.view, t.docLink));
464
+ }), (s = t.mention) != null && s.onMentionSearch && (this.mention = new Zt(this.view, t.mention)), (a = t.docLink) != null && a.onDocSearch && (this.docLink = new Qt(this.view, t.docLink));
421
465
  }
422
466
  handlePaste(e) {
423
- var i, r;
467
+ var i, s;
424
468
  const t = (i = e.clipboardData) == null ? void 0 : i.items;
425
469
  if (!t) return !1;
426
470
  for (const a of Array.from(t))
427
471
  if (a.type.startsWith("image/")) {
428
- const s = a.getAsFile();
429
- if (s)
430
- return (r = this.onImageFile) == null || r.call(this, s), e.preventDefault(), !0;
472
+ const r = a.getAsFile();
473
+ if (r)
474
+ return (s = this.onImageFile) == null || s.call(this, r), e.preventDefault(), !0;
431
475
  }
432
476
  return !1;
433
477
  }
434
478
  handleDrop(e) {
435
- var i, r;
479
+ var i, s;
436
480
  const t = (i = e.dataTransfer) == null ? void 0 : i.files;
437
481
  if (!t || t.length === 0) return !1;
438
482
  for (const a of Array.from(t))
439
483
  if (a.type.startsWith("image/"))
440
- return (r = this.onImageFile) == null || r.call(this, a), e.preventDefault(), !0;
484
+ return (s = this.onImageFile) == null || s.call(this, a), e.preventDefault(), !0;
441
485
  return !1;
442
486
  }
443
487
  /**
@@ -474,12 +518,12 @@ class tn {
474
518
  * selected, insert prefix + placeholder + suffix and select the placeholder.
475
519
  */
476
520
  wrapSelection(e, t, i) {
477
- const { from: r, to: a } = this.view.state.selection.main, o = this.view.state.doc.sliceString(r, a) || i, c = `${e}${o}${t}`;
521
+ const { from: s, to: a } = this.view.state.selection.main, o = this.view.state.doc.sliceString(s, a) || i, c = `${e}${o}${t}`;
478
522
  this.view.dispatch({
479
- changes: { from: r, to: a, insert: c },
523
+ changes: { from: s, to: a, insert: c },
480
524
  selection: {
481
- anchor: r + e.length,
482
- head: r + e.length + o.length
525
+ anchor: s + e.length,
526
+ head: s + e.length + o.length
483
527
  }
484
528
  }), this.view.focus();
485
529
  }
@@ -493,20 +537,20 @@ class tn {
493
537
  * ordered list, etc. If nothing is selected, inserts prefix + placeholder.
494
538
  */
495
539
  wrapLines(e, t) {
496
- const { from: i, to: r } = this.view.state.selection.main;
497
- let a = this.view.state.doc.sliceString(i, r);
540
+ const { from: i, to: s } = this.view.state.selection.main;
541
+ let a = this.view.state.doc.sliceString(i, s);
498
542
  if (a) {
499
543
  const o = a.split(`
500
544
  `).map((c) => `${e}${c}`).join(`
501
545
  `);
502
546
  this.view.dispatch({
503
- changes: { from: i, to: r, insert: o },
547
+ changes: { from: i, to: s, insert: o },
504
548
  selection: { anchor: i, head: i + o.length }
505
549
  });
506
550
  } else {
507
- const s = this.view.state.doc.lineAt(i);
508
- a = s.text;
509
- const o = s.from, c = s.to, d = (a ? a.split(`
551
+ const r = this.view.state.doc.lineAt(i);
552
+ a = r.text;
553
+ const o = r.from, c = r.to, d = (a ? a.split(`
510
554
  `) : [t]).map((h) => `${e}${h}`).join(`
511
555
  `);
512
556
  this.view.dispatch({
@@ -538,13 +582,13 @@ class tn {
538
582
  * otherwise → check all. Plain lines or `- ` lists get `- [ ] ` prepended.
539
583
  */
540
584
  toggleTaskList() {
541
- 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 = [];
542
- for (let p = i.number; p <= r.number; p++)
585
+ 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 = [];
586
+ for (let p = i.number; p <= s.number; p++)
543
587
  a.push(this.view.state.doc.line(p).text);
544
- 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(`
588
+ const r = /^- \[\s*(?:[xX])?\s*\](\s|$)/, o = /^- \[\s*\](\s|$)/, c = a.every((p) => r.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(`
545
589
  `);
546
590
  this.view.dispatch({
547
- changes: { from: i.from, to: r.to, insert: h },
591
+ changes: { from: i.from, to: s.to, insert: h },
548
592
  selection: { anchor: i.from, head: i.from + h.length }
549
593
  }), this.view.focus();
550
594
  }
@@ -554,18 +598,18 @@ class tn {
554
598
  }
555
599
  }
556
600
  const nn = /^\$([^$\n]+?)\$/;
557
- function rn(n) {
601
+ function sn(n) {
558
602
  return /^[\d.,]+$/.test(n.trim());
559
603
  }
560
- function sn(n) {
561
- n.block.ruler.before("fence", "math_block", (e, t, i, r) => {
604
+ function rn(n) {
605
+ n.block.ruler.before("fence", "math_block", (e, t, i, s) => {
562
606
  const a = e.src.slice(e.bMarks[t], e.eMarks[t]);
563
607
  if (!a.startsWith("$$")) return !1;
564
- const s = a.match(/^\$\$(.+?)\$\$\s*$/);
565
- if (s) {
566
- if (r) return !0;
608
+ const r = a.match(/^\$\$(.+?)\$\$\s*$/);
609
+ if (r) {
610
+ if (s) return !0;
567
611
  const h = e.push("math_block", "div", 0);
568
- return h.content = s[1].trim(), h.markup = "$$", e.line = t + 1, !0;
612
+ return h.content = r[1].trim(), h.markup = "$$", e.line = t + 1, !0;
569
613
  }
570
614
  let o = t + 1, c = !1;
571
615
  for (; o < e.lineMax; ) {
@@ -576,12 +620,12 @@ function sn(n) {
576
620
  o++;
577
621
  }
578
622
  if (!c) return !1;
579
- if (r) return !0;
623
+ if (s) return !0;
580
624
  const l = e.src.slice(e.bMarks[t] + 2, e.eMarks[o] - 2).trim(), d = e.push("math_block", "div", 0);
581
625
  return d.content = l, d.markup = "$$", e.line = o + 1, !0;
582
626
  }), n.renderer.rules.math_block = (e, t) => {
583
- var r;
584
- const i = ((r = e[t]) == null ? void 0 : r.content) ?? "";
627
+ var s;
628
+ const i = ((s = e[t]) == null ? void 0 : s.content) ?? "";
585
629
  try {
586
630
  return `<div class="md-editor-math-block">${He.renderToString(i, {
587
631
  displayMode: !0,
@@ -595,14 +639,14 @@ function sn(n) {
595
639
  if (e.src[e.pos] !== "$" || e.src[e.pos + 1] === "$") return !1;
596
640
  const i = e.src.slice(e.pos).match(nn);
597
641
  if (!i) return !1;
598
- const r = i[1] ?? "";
599
- if (rn(r)) return !1;
642
+ const s = i[1] ?? "";
643
+ if (sn(s)) return !1;
600
644
  if (t) return !0;
601
645
  const a = e.push("math_inline", "span", 0);
602
- return a.content = r, a.markup = "$", e.pos += i[0].length, !0;
646
+ return a.content = s, a.markup = "$", e.pos += i[0].length, !0;
603
647
  }), n.renderer.rules.math_inline = (e, t) => {
604
- var r;
605
- const i = ((r = e[t]) == null ? void 0 : r.content) ?? "";
648
+ var s;
649
+ const i = ((s = e[t]) == null ? void 0 : s.content) ?? "";
606
650
  try {
607
651
  return He.renderToString(i, {
608
652
  displayMode: !1,
@@ -630,13 +674,13 @@ function on(n) {
630
674
  n.block.ruler.before(
631
675
  "fence",
632
676
  "mindmap_fence",
633
- (t, i, r, a) => {
634
- const s = t.bMarks[i] + t.tShift[i], o = t.eMarks[i], l = t.src.slice(s, o).match(/^(`{3,})\s*mindmap\s*$/i);
677
+ (t, i, s, a) => {
678
+ const r = t.bMarks[i] + t.tShift[i], o = t.eMarks[i], l = t.src.slice(r, o).match(/^(`{3,})\s*mindmap\s*$/i);
635
679
  if (!l) return !1;
636
680
  if (a) return !0;
637
681
  const d = l[1].length;
638
682
  let h = i + 1, p = 1;
639
- for (; h < r; ) {
683
+ for (; h < s; ) {
640
684
  const f = t.bMarks[h] + t.tShift[h], v = t.eMarks[h], O = t.src.slice(f, v).match(/^(`{3,})\s*(.*)$/);
641
685
  if (O && O[1].length >= d) {
642
686
  if (O[2].trim())
@@ -645,7 +689,7 @@ function on(n) {
645
689
  }
646
690
  h++;
647
691
  }
648
- const m = h < r ? h : r - 1, y = t.push("mindmap_block", "div", 0);
692
+ const m = h < s ? h : s - 1, y = t.push("mindmap_block", "div", 0);
649
693
  return y.content = t.getLines(
650
694
  i + 1,
651
695
  m,
@@ -654,20 +698,20 @@ function on(n) {
654
698
  ), y.map = [i, m + 1], y.markup = l[1], y.info = "mindmap", t.line = m + 1, !0;
655
699
  }
656
700
  ), n.renderer.rules.mindmap_block = (t, i) => {
657
- const r = t[i];
658
- if (!r) return "";
659
- const a = `md-editor-mindmap-${++Ke}`, s = encodeURIComponent(r.content);
660
- return `<div class="md-editor-mindmap" id="${a}" data-source="${s}"></div>`;
701
+ const s = t[i];
702
+ if (!s) return "";
703
+ const a = `md-editor-mindmap-${++Ke}`, r = encodeURIComponent(s.content);
704
+ return `<div class="md-editor-mindmap" id="${a}" data-source="${r}"></div>`;
661
705
  };
662
- const e = n.renderer.rules.fence ? n.renderer.rules.fence.bind(n.renderer.rules) : (t, i, r, a, s) => s.renderToken(t, i, r);
663
- n.renderer.rules.fence = (t, i, r, a, s) => {
706
+ const e = n.renderer.rules.fence ? n.renderer.rules.fence.bind(n.renderer.rules) : (t, i, s, a, r) => r.renderToken(t, i, s);
707
+ n.renderer.rules.fence = (t, i, s, a, r) => {
664
708
  const o = t[i];
665
- if (!o) return e(t, i, r, a, s);
709
+ if (!o) return e(t, i, s, a, r);
666
710
  if (o.info.trim().toLowerCase() === "mindmap") {
667
711
  const l = `md-editor-mindmap-${++Ke}`, d = encodeURIComponent(o.content);
668
712
  return `<div class="md-editor-mindmap" id="${l}" data-source="${d}"></div>`;
669
713
  }
670
- return e(t, i, r, a, s);
714
+ return e(t, i, s, a, r);
671
715
  };
672
716
  }
673
717
  const an = 600, cn = 320;
@@ -676,16 +720,16 @@ async function ln(n) {
676
720
  ".md-editor-mindmap:not([data-hydrated])"
677
721
  );
678
722
  if (e.length === 0) return;
679
- const { Transformer: t } = await import("markmap-lib"), i = await import("markmap-view"), r = i.Markmap ?? i.default;
680
- if (!r) return;
723
+ const { Transformer: t } = await import("markmap-lib"), i = await import("markmap-view"), s = i.Markmap ?? i.default;
724
+ if (!s) return;
681
725
  const a = new t();
682
- for (const s of Array.from(e)) {
683
- s.setAttribute("data-hydrated", "1");
684
- const o = decodeURIComponent(s.dataset.source ?? "") || "- Empty mindmap", { root: c } = a.transform(o);
685
- s.innerHTML = "";
686
- const l = s.clientWidth > 0 ? s.clientWidth : an, d = s.clientHeight > 0 ? s.clientHeight : cn, h = document.createElementNS("http://www.w3.org/2000/svg", "svg");
687
- h.setAttribute("width", String(l)), h.setAttribute("height", String(d)), h.style.width = "100%", h.style.height = "100%", h.style.display = "block", s.appendChild(h);
688
- const p = r.create(h, { autoFit: !1 }, c), m = () => {
726
+ for (const r of Array.from(e)) {
727
+ r.setAttribute("data-hydrated", "1");
728
+ const o = decodeURIComponent(r.dataset.source ?? "") || "- Empty mindmap", { root: c } = a.transform(o);
729
+ r.innerHTML = "";
730
+ const l = r.clientWidth > 0 ? r.clientWidth : an, d = r.clientHeight > 0 ? r.clientHeight : cn, h = document.createElementNS("http://www.w3.org/2000/svg", "svg");
731
+ h.setAttribute("width", String(l)), h.setAttribute("height", String(d)), h.style.width = "100%", h.style.height = "100%", h.style.display = "block", r.appendChild(h);
732
+ const p = s.create(h, { autoFit: !1 }, c), m = () => {
689
733
  try {
690
734
  const f = h.querySelector("g");
691
735
  if (f) {
@@ -732,7 +776,7 @@ class Ge {
732
776
  this.isMatchIgnored = !0;
733
777
  }
734
778
  }
735
- function rt(n) {
779
+ function st(n) {
736
780
  return n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;");
737
781
  }
738
782
  function Q(n, ...e) {
@@ -740,8 +784,8 @@ function Q(n, ...e) {
740
784
  for (const i in n)
741
785
  t[i] = n[i];
742
786
  return e.forEach(function(i) {
743
- for (const r in i)
744
- t[r] = i[r];
787
+ for (const s in i)
788
+ t[s] = i[s];
745
789
  }), /** @type {T} */
746
790
  t;
747
791
  }
@@ -752,7 +796,7 @@ const un = "</span>", qe = (n) => !!n.scope, hn = (n, { prefix: e }) => {
752
796
  const t = n.split(".");
753
797
  return [
754
798
  `${e}${t.shift()}`,
755
- ...t.map((i, r) => `${i}${"_".repeat(r + 1)}`)
799
+ ...t.map((i, s) => `${i}${"_".repeat(s + 1)}`)
756
800
  ].join(" ");
757
801
  }
758
802
  return `${e}${n}`;
@@ -772,7 +816,7 @@ class pn {
772
816
  *
773
817
  * @param {string} text */
774
818
  addText(e) {
775
- this.buffer += rt(e);
819
+ this.buffer += st(e);
776
820
  }
777
821
  /**
778
822
  * Adds a node open to the output stream (if needed)
@@ -902,7 +946,7 @@ class gn extends Ae {
902
946
  function de(n) {
903
947
  return n ? typeof n == "string" ? n : n.source : null;
904
948
  }
905
- function st(n) {
949
+ function rt(n) {
906
950
  return te("(?=", n, ")");
907
951
  }
908
952
  function mn(n) {
@@ -946,17 +990,17 @@ function xe(n, { joinWith: e }) {
946
990
  let t = 0;
947
991
  return n.map((i) => {
948
992
  t += 1;
949
- const r = t;
950
- let a = de(i), s = "";
993
+ const s = t;
994
+ let a = de(i), r = "";
951
995
  for (; a.length > 0; ) {
952
996
  const o = En.exec(a);
953
997
  if (!o) {
954
- s += a;
998
+ r += a;
955
999
  break;
956
1000
  }
957
- 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++);
1001
+ 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++);
958
1002
  }
959
- return s;
1003
+ return r;
960
1004
  }).map((i) => `(${i})`).join(e);
961
1005
  }
962
1006
  const yn = /\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]+)", wn = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", vn = (n = {}) => {
@@ -991,7 +1035,7 @@ const yn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
991
1035
  end: '"',
992
1036
  illegal: "\\n",
993
1037
  contains: [ue]
994
- }, Tn = {
1038
+ }, Sn = {
995
1039
  begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/
996
1040
  }, we = function(n, e, t = {}) {
997
1041
  const i = Q(
@@ -1012,7 +1056,7 @@ const yn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
1012
1056
  excludeBegin: !0,
1013
1057
  relevance: 0
1014
1058
  });
1015
- const r = ye(
1059
+ const s = ye(
1016
1060
  // list of common 1 and 2 letter words in English
1017
1061
  "I",
1018
1062
  "a",
@@ -1052,14 +1096,14 @@ const yn = /\b\B/, at = "[a-zA-Z]\\w*", Ce = "[a-zA-Z_]\\w*", ct = "\\b\\d+(\\.\
1052
1096
  /[ ]+/,
1053
1097
  // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */
1054
1098
  "(",
1055
- r,
1099
+ s,
1056
1100
  /[.]?[:]?([.][ ]|[ ])/,
1057
1101
  "){3}"
1058
1102
  )
1059
1103
  // look for 3 words in a row
1060
1104
  }
1061
1105
  ), i;
1062
- }, Sn = we("//", "$"), An = we("/\\*", "\\*/"), xn = we("#", "$"), Cn = {
1106
+ }, Tn = we("//", "$"), An = we("/\\*", "\\*/"), xn = we("#", "$"), Cn = {
1063
1107
  scope: "number",
1064
1108
  begin: ct,
1065
1109
  relevance: 0
@@ -1119,7 +1163,7 @@ var me = /* @__PURE__ */ Object.freeze({
1119
1163
  BINARY_NUMBER_RE: dt,
1120
1164
  COMMENT: we,
1121
1165
  C_BLOCK_COMMENT_MODE: An,
1122
- C_LINE_COMMENT_MODE: Sn,
1166
+ C_LINE_COMMENT_MODE: Tn,
1123
1167
  C_NUMBER_MODE: Mn,
1124
1168
  C_NUMBER_RE: lt,
1125
1169
  END_SAME_AS_BEGIN: Pn,
@@ -1129,7 +1173,7 @@ var me = /* @__PURE__ */ Object.freeze({
1129
1173
  METHOD_GUARD: Dn,
1130
1174
  NUMBER_MODE: Cn,
1131
1175
  NUMBER_RE: ct,
1132
- PHRASAL_WORDS_MODE: Tn,
1176
+ PHRASAL_WORDS_MODE: Sn,
1133
1177
  QUOTE_STRING_MODE: Nn,
1134
1178
  REGEXP_MODE: On,
1135
1179
  RE_STARTERS_RE: wn,
@@ -1165,7 +1209,7 @@ const Kn = (n, e) => {
1165
1209
  const t = Object.assign({}, n);
1166
1210
  Object.keys(n).forEach((i) => {
1167
1211
  delete n[i];
1168
- }), n.keywords = t.keywords, n.begin = te(t.beforeMatch, st(t.begin)), n.starts = {
1212
+ }), n.keywords = t.keywords, n.begin = te(t.beforeMatch, rt(t.begin)), n.starts = {
1169
1213
  relevance: 0,
1170
1214
  contains: [
1171
1215
  Object.assign(t, { endsParent: !0 })
@@ -1189,14 +1233,14 @@ const Kn = (n, e) => {
1189
1233
  ], qn = "keyword";
1190
1234
  function ut(n, e, t = qn) {
1191
1235
  const i = /* @__PURE__ */ Object.create(null);
1192
- return typeof n == "string" ? r(t, n.split(" ")) : Array.isArray(n) ? r(t, n) : Object.keys(n).forEach(function(a) {
1236
+ return typeof n == "string" ? s(t, n.split(" ")) : Array.isArray(n) ? s(t, n) : Object.keys(n).forEach(function(a) {
1193
1237
  Object.assign(
1194
1238
  i,
1195
1239
  ut(n[a], e, a)
1196
1240
  );
1197
1241
  }), i;
1198
- function r(a, s) {
1199
- e && (s = s.map((o) => o.toLowerCase())), s.forEach(function(o) {
1242
+ function s(a, r) {
1243
+ e && (r = r.map((o) => o.toLowerCase())), r.forEach(function(o) {
1200
1244
  const c = o.split("|");
1201
1245
  i[c[0]] = [a, Wn(c[0], c[1])];
1202
1246
  });
@@ -1217,10 +1261,10 @@ const Ye = {}, ee = (n) => {
1217
1261
  }, _e = new Error();
1218
1262
  function ht(n, e, { key: t }) {
1219
1263
  let i = 0;
1220
- const r = n[t], a = {}, s = {};
1264
+ const s = n[t], a = {}, r = {};
1221
1265
  for (let o = 1; o <= e.length; o++)
1222
- s[o + i] = r[o], a[o + i] = !0, i += ot(e[o - 1]);
1223
- n[t] = s, n[t]._emit = a, n[t]._multi = !0;
1266
+ r[o + i] = s[o], a[o + i] = !0, i += ot(e[o - 1]);
1267
+ n[t] = r, n[t]._emit = a, n[t]._multi = !0;
1224
1268
  }
1225
1269
  function Zn(n) {
1226
1270
  if (Array.isArray(n.begin)) {
@@ -1247,9 +1291,9 @@ function Qn(n) {
1247
1291
  Xn(n), typeof n.beginScope == "string" && (n.beginScope = { _wrap: n.beginScope }), typeof n.endScope == "string" && (n.endScope = { _wrap: n.endScope }), Zn(n), Vn(n);
1248
1292
  }
1249
1293
  function Jn(n) {
1250
- function e(s, o) {
1294
+ function e(r, o) {
1251
1295
  return new RegExp(
1252
- de(s),
1296
+ de(r),
1253
1297
  "m" + (n.case_insensitive ? "i" : "") + (n.unicodeRegex ? "u" : "") + (o ? "g" : "")
1254
1298
  );
1255
1299
  }
@@ -1308,16 +1352,16 @@ function Jn(n) {
1308
1352
  return l && (this.regexIndex += l.position + 1, this.regexIndex === this.count && this.considerAll()), l;
1309
1353
  }
1310
1354
  }
1311
- function r(s) {
1355
+ function s(r) {
1312
1356
  const o = new i();
1313
- 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;
1357
+ 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;
1314
1358
  }
1315
- function a(s, o) {
1359
+ function a(r, o) {
1316
1360
  const c = (
1317
1361
  /** @type CompiledMode */
1318
- s
1362
+ r
1319
1363
  );
1320
- if (s.isCompiled) return c;
1364
+ if (r.isCompiled) return c;
1321
1365
  [
1322
1366
  $n,
1323
1367
  // do this early so compiler extensions generally don't have to worry about
@@ -1325,27 +1369,27 @@ function Jn(n) {
1325
1369
  Fn,
1326
1370
  Qn,
1327
1371
  Kn
1328
- ].forEach((d) => d(s, o)), n.compilerExtensions.forEach((d) => d(s, o)), s.__beforeBegin = null, [
1372
+ ].forEach((d) => d(r, o)), n.compilerExtensions.forEach((d) => d(r, o)), r.__beforeBegin = null, [
1329
1373
  Un,
1330
1374
  // do this later so compiler extensions that come earlier have access to the
1331
1375
  // raw array if they wanted to perhaps manipulate it, etc.
1332
1376
  Hn,
1333
1377
  // default to 1 relevance if not specified
1334
1378
  zn
1335
- ].forEach((d) => d(s, o)), s.isCompiled = !0;
1379
+ ].forEach((d) => d(r, o)), r.isCompiled = !0;
1336
1380
  let l = null;
1337
- 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(
1381
+ 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(
1338
1382
  /** @type {RegExp | string} */
1339
- s.illegal
1340
- )), s.contains || (s.contains = []), s.contains = [].concat(...s.contains.map(function(d) {
1341
- return jn(d === "self" ? s : d);
1342
- })), s.contains.forEach(function(d) {
1383
+ r.illegal
1384
+ )), r.contains || (r.contains = []), r.contains = [].concat(...r.contains.map(function(d) {
1385
+ return jn(d === "self" ? r : d);
1386
+ })), r.contains.forEach(function(d) {
1343
1387
  a(
1344
1388
  /** @type Mode */
1345
1389
  d,
1346
1390
  c
1347
1391
  );
1348
- }), s.starts && a(s.starts, o), c.matcher = r(c), c;
1392
+ }), r.starts && a(r.starts, o), c.matcher = s(c), c;
1349
1393
  }
1350
1394
  if (n.compilerExtensions || (n.compilerExtensions = []), n.contains && n.contains.includes("self"))
1351
1395
  throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");
@@ -1368,10 +1412,10 @@ class ti extends Error {
1368
1412
  super(e), this.name = "HTMLInjectionError", this.html = t;
1369
1413
  }
1370
1414
  }
1371
- const Se = rt, Ve = Q, Xe = Symbol("nomatch"), ni = 7, gt = function(n) {
1415
+ const Te = st, Ve = Q, Xe = Symbol("nomatch"), ni = 7, gt = function(n) {
1372
1416
  const e = /* @__PURE__ */ Object.create(null), t = /* @__PURE__ */ Object.create(null), i = [];
1373
- let r = !0;
1374
- const a = "Could not find the language '{}', did you forget to load/include a language module?", s = { disableAutodetect: !0, name: "Plain text", contains: [] };
1417
+ let s = !0;
1418
+ const a = "Could not find the language '{}', did you forget to load/include a language module?", r = { disableAutodetect: !0, name: "Plain text", contains: [] };
1375
1419
  let o = {
1376
1420
  ignoreUnescapedHTML: !1,
1377
1421
  throwUnescapedHTML: !1,
@@ -1398,19 +1442,19 @@ const Se = rt, Ve = Q, Xe = Symbol("nomatch"), ni = 7, gt = function(n) {
1398
1442
  return _.split(/\s+/).find((k) => c(k) || $(k));
1399
1443
  }
1400
1444
  function d(u, _, b) {
1401
- let k = "", T = "";
1402
- typeof _ == "object" ? (k = u, b = _.ignoreIllegals, T = _.language) : (ne("10.7.0", "highlight(lang, code, ...args) has been deprecated."), ne("10.7.0", `Please use highlight(code, options) instead.
1403
- https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b === void 0 && (b = !0);
1445
+ let k = "", S = "";
1446
+ typeof _ == "object" ? (k = u, b = _.ignoreIllegals, S = _.language) : (ne("10.7.0", "highlight(lang, code, ...args) has been deprecated."), ne("10.7.0", `Please use highlight(code, options) instead.
1447
+ https://github.com/highlightjs/highlight.js/issues/2277`), S = u, k = _), b === void 0 && (b = !0);
1404
1448
  const P = {
1405
1449
  code: k,
1406
- language: T
1450
+ language: S
1407
1451
  };
1408
1452
  X("before:highlight", P);
1409
1453
  const z = P.result ? P.result : h(P.language, P.code, b);
1410
1454
  return z.code = P.code, X("after:highlight", z), z;
1411
1455
  }
1412
1456
  function h(u, _, b, k) {
1413
- const T = /* @__PURE__ */ Object.create(null);
1457
+ const S = /* @__PURE__ */ Object.create(null);
1414
1458
  function P(g, E) {
1415
1459
  return g.keywords[E];
1416
1460
  }
@@ -1427,7 +1471,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
1427
1471
  const x = Y.case_insensitive ? E[0].toLowerCase() : E[0], K = P(w, x);
1428
1472
  if (K) {
1429
1473
  const [Z, Ut] = K;
1430
- if (F.addText(N), N = "", T[x] = (T[x] || 0) + 1, T[x] <= ni && (pe += Ut), Z.startsWith("_"))
1474
+ if (F.addText(N), N = "", S[x] = (S[x] || 0) + 1, S[x] <= ni && (pe += Ut), Z.startsWith("_"))
1431
1475
  N += E[0];
1432
1476
  else {
1433
1477
  const Ht = Y.classNameAliases[Z] || Z;
@@ -1523,7 +1567,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
1523
1567
  if (M += g, N == null)
1524
1568
  return G(), 0;
1525
1569
  if (he.type === "begin" && E.type === "end" && he.index === E.index && N === "") {
1526
- if (M += _.slice(E.index, E.index + 1), !r) {
1570
+ if (M += _.slice(E.index, E.index + 1), !s) {
1527
1571
  const x = new Error(`0 width match regex (${u})`);
1528
1572
  throw x.languageName = u, x.badRule = he.rule, x;
1529
1573
  }
@@ -1579,7 +1623,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
1579
1623
  if (g.message && g.message.includes("Illegal"))
1580
1624
  return {
1581
1625
  language: u,
1582
- value: Se(_),
1626
+ value: Te(_),
1583
1627
  illegal: !0,
1584
1628
  relevance: 0,
1585
1629
  _illegalBy: {
@@ -1591,10 +1635,10 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
1591
1635
  },
1592
1636
  _emitter: F
1593
1637
  };
1594
- if (r)
1638
+ if (s)
1595
1639
  return {
1596
1640
  language: u,
1597
- value: Se(_),
1641
+ value: Te(_),
1598
1642
  illegal: !1,
1599
1643
  relevance: 0,
1600
1644
  errorRaised: g,
@@ -1606,10 +1650,10 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
1606
1650
  }
1607
1651
  function p(u) {
1608
1652
  const _ = {
1609
- value: Se(u),
1653
+ value: Te(u),
1610
1654
  illegal: !1,
1611
1655
  relevance: 0,
1612
- _top: s,
1656
+ _top: r,
1613
1657
  _emitter: new o.__emitter(o)
1614
1658
  };
1615
1659
  return _._emitter.addText(u), _;
@@ -1620,7 +1664,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
1620
1664
  (G) => h(G, u, !1)
1621
1665
  );
1622
1666
  k.unshift(b);
1623
- const T = k.sort((G, W) => {
1667
+ const S = k.sort((G, W) => {
1624
1668
  if (G.relevance !== W.relevance) return W.relevance - G.relevance;
1625
1669
  if (G.language && W.language) {
1626
1670
  if ($(G.language).supersetOf === W.language)
@@ -1629,7 +1673,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
1629
1673
  return -1;
1630
1674
  }
1631
1675
  return 0;
1632
- }), [P, z] = T, q = P;
1676
+ }), [P, z] = S, q = P;
1633
1677
  return q.secondBest = z, q;
1634
1678
  }
1635
1679
  function y(u, _, b) {
@@ -1653,21 +1697,21 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
1653
1697
  u.innerHTML
1654
1698
  );
1655
1699
  _ = u;
1656
- const k = _.textContent, T = b ? d(k, { language: b, ignoreIllegals: !0 }) : m(k);
1657
- u.innerHTML = T.value, u.dataset.highlighted = "yes", y(u, b, T.language), u.result = {
1658
- language: T.language,
1700
+ const k = _.textContent, S = b ? d(k, { language: b, ignoreIllegals: !0 }) : m(k);
1701
+ u.innerHTML = S.value, u.dataset.highlighted = "yes", y(u, b, S.language), u.result = {
1702
+ language: S.language,
1659
1703
  // TODO: remove with version 11.0
1660
- re: T.relevance,
1661
- relevance: T.relevance
1662
- }, T.secondBest && (u.secondBest = {
1663
- language: T.secondBest.language,
1664
- relevance: T.secondBest.relevance
1665
- }), X("after:highlightElement", { el: u, result: T, text: k });
1704
+ re: S.relevance,
1705
+ relevance: S.relevance
1706
+ }, S.secondBest && (u.secondBest = {
1707
+ language: S.secondBest.language,
1708
+ relevance: S.secondBest.relevance
1709
+ }), X("after:highlightElement", { el: u, result: S, text: k });
1666
1710
  }
1667
1711
  function v(u) {
1668
1712
  o = Ve(o, u);
1669
1713
  }
1670
- const S = () => {
1714
+ const T = () => {
1671
1715
  C(), ne("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
1672
1716
  };
1673
1717
  function O() {
@@ -1689,11 +1733,11 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
1689
1733
  try {
1690
1734
  b = _(n);
1691
1735
  } catch (k) {
1692
- if (ee("Language definition for '{}' could not be registered.".replace("{}", u)), r)
1736
+ if (ee("Language definition for '{}' could not be registered.".replace("{}", u)), s)
1693
1737
  ee(k);
1694
1738
  else
1695
1739
  throw k;
1696
- b = s;
1740
+ b = r;
1697
1741
  }
1698
1742
  b.name || (b.name = u), e[u] = b, b.rawDefinition = _.bind(null, n), b.aliases && H(b.aliases, { languageName: u });
1699
1743
  }
@@ -1752,7 +1796,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
1752
1796
  // TODO: Remove with v12 API
1753
1797
  highlightBlock: ce,
1754
1798
  configure: v,
1755
- initHighlighting: S,
1799
+ initHighlighting: T,
1756
1800
  initHighlightingOnLoad: O,
1757
1801
  registerLanguage: I,
1758
1802
  unregisterLanguage: D,
@@ -1764,12 +1808,12 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
1764
1808
  addPlugin: oe,
1765
1809
  removePlugin: ae
1766
1810
  }), n.debugMode = function() {
1767
- r = !1;
1811
+ s = !1;
1768
1812
  }, n.safeMode = function() {
1769
- r = !0;
1813
+ s = !0;
1770
1814
  }, n.versionString = ei, n.regex = {
1771
1815
  concat: te,
1772
- lookahead: st,
1816
+ lookahead: rt,
1773
1817
  either: ye,
1774
1818
  optional: fn,
1775
1819
  anyNumberOfTimes: mn
@@ -1777,12 +1821,12 @@ https://github.com/highlightjs/highlight.js/issues/2277`), T = u, k = _), b ===
1777
1821
  for (const u in me)
1778
1822
  typeof me[u] == "object" && it(me[u]);
1779
1823
  return Object.assign(n, me), n;
1780
- }, se = gt({});
1781
- se.newInstance = () => gt({});
1782
- var ii = se;
1783
- se.HighlightJS = se;
1784
- se.default = se;
1785
- const A = /* @__PURE__ */ dn(ii), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", ri = [
1824
+ }, re = gt({});
1825
+ re.newInstance = () => gt({});
1826
+ var ii = re;
1827
+ re.HighlightJS = re;
1828
+ re.default = re;
1829
+ const A = /* @__PURE__ */ dn(ii), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", si = [
1786
1830
  "as",
1787
1831
  // for exports
1788
1832
  "in",
@@ -1827,7 +1871,7 @@ const A = /* @__PURE__ */ dn(ii), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", ri = [
1827
1871
  "extends",
1828
1872
  // It's reached stage 3, which is "recommended for implementation":
1829
1873
  "using"
1830
- ], si = [
1874
+ ], ri = [
1831
1875
  "true",
1832
1876
  "false",
1833
1877
  "null",
@@ -1931,12 +1975,12 @@ const A = /* @__PURE__ */ dn(ii), Qe = "[A-Za-z$_][0-9A-Za-z$_]*", ri = [
1931
1975
  );
1932
1976
  function _t(n) {
1933
1977
  const e = n.regex, t = (b, { after: k }) => {
1934
- const T = "</" + b[0].slice(1);
1935
- return b.input.indexOf(T, k) !== -1;
1936
- }, i = Qe, r = {
1978
+ const S = "</" + b[0].slice(1);
1979
+ return b.input.indexOf(S, k) !== -1;
1980
+ }, i = Qe, s = {
1937
1981
  begin: "<>",
1938
1982
  end: "</>"
1939
- }, a = /<[A-Za-z0-9\\._:-]+\s*\/>/, s = {
1983
+ }, a = /<[A-Za-z0-9\\._:-]+\s*\/>/, r = {
1940
1984
  begin: /<[A-Za-z0-9\\._:-]+/,
1941
1985
  end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
1942
1986
  /**
@@ -1944,7 +1988,7 @@ function _t(n) {
1944
1988
  * @param {CallbackResponse} response
1945
1989
  */
1946
1990
  isTrulyOpeningTag: (b, k) => {
1947
- const T = b[0].length + b.index, P = b.input[T];
1991
+ const S = b[0].length + b.index, P = b.input[S];
1948
1992
  if (
1949
1993
  // HTML should not include another raw `<` inside a tag
1950
1994
  // nested type?
@@ -1956,9 +2000,9 @@ function _t(n) {
1956
2000
  k.ignoreMatch();
1957
2001
  return;
1958
2002
  }
1959
- P === ">" && (t(b, { after: T }) || k.ignoreMatch());
2003
+ P === ">" && (t(b, { after: S }) || k.ignoreMatch());
1960
2004
  let z;
1961
- const q = b.input.substring(T);
2005
+ const q = b.input.substring(S);
1962
2006
  if (z = q.match(/^\s*=/)) {
1963
2007
  k.ignoreMatch();
1964
2008
  return;
@@ -1970,8 +2014,8 @@ function _t(n) {
1970
2014
  }
1971
2015
  }, o = {
1972
2016
  $pattern: Qe,
1973
- keyword: ri,
1974
- literal: si,
2017
+ keyword: si,
2018
+ literal: ri,
1975
2019
  built_in: ai,
1976
2020
  "variable.language": oi
1977
2021
  }, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", h = {
@@ -2369,21 +2413,21 @@ function _t(n) {
2369
2413
  {
2370
2414
  // JSX
2371
2415
  variants: [
2372
- { begin: r.begin, end: r.end },
2416
+ { begin: s.begin, end: s.end },
2373
2417
  { match: a },
2374
2418
  {
2375
- begin: s.begin,
2419
+ begin: r.begin,
2376
2420
  // we carefully check the opening tag to see if it truly
2377
2421
  // is a tag and not a false positive
2378
- "on:begin": s.isTrulyOpeningTag,
2379
- end: s.end
2422
+ "on:begin": r.isTrulyOpeningTag,
2423
+ end: r.end
2380
2424
  }
2381
2425
  ],
2382
2426
  subLanguage: "xml",
2383
2427
  contains: [
2384
2428
  {
2385
- begin: s.begin,
2386
- end: s.end,
2429
+ begin: r.begin,
2430
+ end: r.end,
2387
2431
  skip: !0,
2388
2432
  contains: ["self"]
2389
2433
  }
@@ -2581,19 +2625,19 @@ const Ee = "[A-Za-z$_][0-9A-Za-z$_]*", Et = [
2581
2625
  "self",
2582
2626
  "global"
2583
2627
  // Node.js
2584
- ], Tt = [].concat(
2628
+ ], St = [].concat(
2585
2629
  kt,
2586
2630
  wt,
2587
2631
  vt
2588
2632
  );
2589
2633
  function ci(n) {
2590
2634
  const e = n.regex, t = (b, { after: k }) => {
2591
- const T = "</" + b[0].slice(1);
2592
- return b.input.indexOf(T, k) !== -1;
2593
- }, i = Ee, r = {
2635
+ const S = "</" + b[0].slice(1);
2636
+ return b.input.indexOf(S, k) !== -1;
2637
+ }, i = Ee, s = {
2594
2638
  begin: "<>",
2595
2639
  end: "</>"
2596
- }, a = /<[A-Za-z0-9\\._:-]+\s*\/>/, s = {
2640
+ }, a = /<[A-Za-z0-9\\._:-]+\s*\/>/, r = {
2597
2641
  begin: /<[A-Za-z0-9\\._:-]+/,
2598
2642
  end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
2599
2643
  /**
@@ -2601,7 +2645,7 @@ function ci(n) {
2601
2645
  * @param {CallbackResponse} response
2602
2646
  */
2603
2647
  isTrulyOpeningTag: (b, k) => {
2604
- const T = b[0].length + b.index, P = b.input[T];
2648
+ const S = b[0].length + b.index, P = b.input[S];
2605
2649
  if (
2606
2650
  // HTML should not include another raw `<` inside a tag
2607
2651
  // nested type?
@@ -2613,9 +2657,9 @@ function ci(n) {
2613
2657
  k.ignoreMatch();
2614
2658
  return;
2615
2659
  }
2616
- P === ">" && (t(b, { after: T }) || k.ignoreMatch());
2660
+ P === ">" && (t(b, { after: S }) || k.ignoreMatch());
2617
2661
  let z;
2618
- const q = b.input.substring(T);
2662
+ const q = b.input.substring(S);
2619
2663
  if (z = q.match(/^\s*=/)) {
2620
2664
  k.ignoreMatch();
2621
2665
  return;
@@ -2629,7 +2673,7 @@ function ci(n) {
2629
2673
  $pattern: Ee,
2630
2674
  keyword: Et,
2631
2675
  literal: yt,
2632
- built_in: Tt,
2676
+ built_in: St,
2633
2677
  "variable.language": Nt
2634
2678
  }, c = "[0-9](_?[0-9])*", l = `\\.(${c})`, d = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", h = {
2635
2679
  className: "number",
@@ -3026,21 +3070,21 @@ function ci(n) {
3026
3070
  {
3027
3071
  // JSX
3028
3072
  variants: [
3029
- { begin: r.begin, end: r.end },
3073
+ { begin: s.begin, end: s.end },
3030
3074
  { match: a },
3031
3075
  {
3032
- begin: s.begin,
3076
+ begin: r.begin,
3033
3077
  // we carefully check the opening tag to see if it truly
3034
3078
  // is a tag and not a false positive
3035
- "on:begin": s.isTrulyOpeningTag,
3036
- end: s.end
3079
+ "on:begin": r.isTrulyOpeningTag,
3080
+ end: r.end
3037
3081
  }
3038
3082
  ],
3039
3083
  subLanguage: "xml",
3040
3084
  contains: [
3041
3085
  {
3042
- begin: s.begin,
3043
- end: s.end,
3086
+ begin: r.begin,
3087
+ end: r.end,
3044
3088
  skip: !0,
3045
3089
  contains: ["self"]
3046
3090
  }
@@ -3096,8 +3140,8 @@ function ci(n) {
3096
3140
  ]
3097
3141
  };
3098
3142
  }
3099
- function St(n) {
3100
- const e = n.regex, t = ci(n), i = Ee, r = [
3143
+ function Tt(n) {
3144
+ const e = n.regex, t = ci(n), i = Ee, s = [
3101
3145
  "any",
3102
3146
  "void",
3103
3147
  "number",
@@ -3118,13 +3162,13 @@ function St(n) {
3118
3162
  1: "keyword",
3119
3163
  3: "title.class"
3120
3164
  }
3121
- }, s = {
3165
+ }, r = {
3122
3166
  beginKeywords: "interface",
3123
3167
  end: /\{/,
3124
3168
  excludeEnd: !0,
3125
3169
  keywords: {
3126
3170
  keyword: "interface extends",
3127
- built_in: r
3171
+ built_in: s
3128
3172
  },
3129
3173
  contains: [t.exports.CLASS_REFERENCE]
3130
3174
  }, o = {
@@ -3149,16 +3193,16 @@ function St(n) {
3149
3193
  $pattern: Ee,
3150
3194
  keyword: Et.concat(c),
3151
3195
  literal: yt,
3152
- built_in: Tt.concat(r),
3196
+ built_in: St.concat(s),
3153
3197
  "variable.language": Nt
3154
3198
  }, d = {
3155
3199
  className: "meta",
3156
3200
  begin: "@" + i
3157
- }, h = (f, v, S) => {
3201
+ }, h = (f, v, T) => {
3158
3202
  const O = f.contains.findIndex((U) => U.label === v);
3159
3203
  if (O === -1)
3160
3204
  throw new Error("can not find mode to replace");
3161
- f.contains.splice(O, 1, S);
3205
+ f.contains.splice(O, 1, T);
3162
3206
  };
3163
3207
  Object.assign(t.keywords, l), t.exports.PARAMS_CONTAINS.push(d);
3164
3208
  const p = t.contains.find((f) => f.scope === "attr"), m = Object.assign(
@@ -3176,7 +3220,7 @@ function St(n) {
3176
3220
  ]), t.contains = t.contains.concat([
3177
3221
  d,
3178
3222
  a,
3179
- s,
3223
+ r,
3180
3224
  m
3181
3225
  // Added for optional property assignment highlighting
3182
3226
  ]), h(t, "shebang", n.SHEBANG()), h(t, "use_strict", o);
@@ -3483,7 +3527,7 @@ function At(n) {
3483
3527
  endsWithParent: !0
3484
3528
  }
3485
3529
  ]
3486
- }, S = {
3530
+ }, T = {
3487
3531
  className: "params",
3488
3532
  variants: [
3489
3533
  // Exclude params in functions without params
@@ -3550,7 +3594,7 @@ function At(n) {
3550
3594
  1: "keyword",
3551
3595
  3: "title.function"
3552
3596
  },
3553
- contains: [S]
3597
+ contains: [T]
3554
3598
  },
3555
3599
  {
3556
3600
  variants: [
@@ -3585,7 +3629,7 @@ function At(n) {
3585
3629
  end: /(?=#)|$/,
3586
3630
  contains: [
3587
3631
  f,
3588
- S,
3632
+ T,
3589
3633
  h
3590
3634
  ]
3591
3635
  }
@@ -3610,7 +3654,7 @@ function ui(n) {
3610
3654
  "true",
3611
3655
  "false",
3612
3656
  "null"
3613
- ], r = {
3657
+ ], s = {
3614
3658
  scope: "literal",
3615
3659
  beginKeywords: i.join(" ")
3616
3660
  };
@@ -3625,7 +3669,7 @@ function ui(n) {
3625
3669
  t,
3626
3670
  n.APOS_STRING_MODE,
3627
3671
  n.QUOTE_STRING_MODE,
3628
- r,
3672
+ s,
3629
3673
  di,
3630
3674
  n.C_LINE_COMMENT_MODE,
3631
3675
  n.C_BLOCK_COMMENT_MODE
@@ -3658,7 +3702,7 @@ function Me(n) {
3658
3702
  i
3659
3703
  ]
3660
3704
  });
3661
- const r = {
3705
+ const s = {
3662
3706
  className: "subst",
3663
3707
  begin: /\$\(/,
3664
3708
  end: /\)/,
@@ -3674,7 +3718,7 @@ function Me(n) {
3674
3718
  2: "comment"
3675
3719
  }
3676
3720
  }
3677
- ), s = {
3721
+ ), r = {
3678
3722
  begin: /<<-?\s*(?=\w+)/,
3679
3723
  starts: { contains: [
3680
3724
  n.END_SAME_AS_BEGIN({
@@ -3690,10 +3734,10 @@ function Me(n) {
3690
3734
  contains: [
3691
3735
  n.BACKSLASH_ESCAPE,
3692
3736
  t,
3693
- r
3737
+ s
3694
3738
  ]
3695
3739
  };
3696
- r.contains.push(o);
3740
+ s.contains.push(o);
3697
3741
  const c = {
3698
3742
  match: /\\"/
3699
3743
  }, l = {
@@ -3753,7 +3797,7 @@ function Me(n) {
3753
3797
  ], v = [
3754
3798
  "true",
3755
3799
  "false"
3756
- ], S = { match: /(\/[a-z._-]+)+/ }, O = [
3800
+ ], T = { match: /(\/[a-z._-]+)+/ }, O = [
3757
3801
  "break",
3758
3802
  "cd",
3759
3803
  "continue",
@@ -3997,8 +4041,8 @@ function Me(n) {
3997
4041
  y,
3998
4042
  h,
3999
4043
  a,
4000
- s,
4001
- S,
4044
+ r,
4045
+ T,
4002
4046
  o,
4003
4047
  c,
4004
4048
  l,
@@ -4815,7 +4859,7 @@ const hi = (n) => ({
4815
4859
  "zoom"
4816
4860
  ].sort().reverse();
4817
4861
  function yi(n) {
4818
- const e = n.regex, t = hi(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 = [
4862
+ const e = n.regex, t = hi(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 = [
4819
4863
  n.APOS_STRING_MODE,
4820
4864
  n.QUOTE_STRING_MODE
4821
4865
  ];
@@ -4842,7 +4886,7 @@ function yi(n) {
4842
4886
  },
4843
4887
  {
4844
4888
  className: "selector-class",
4845
- begin: "\\." + s,
4889
+ begin: "\\." + r,
4846
4890
  relevance: 0
4847
4891
  },
4848
4892
  t.ATTRIBUTE_SELECTOR_MODE,
@@ -4917,7 +4961,7 @@ function yi(n) {
4917
4961
  relevance: 0,
4918
4962
  keywords: {
4919
4963
  $pattern: /[a-z-]+/,
4920
- keyword: r,
4964
+ keyword: s,
4921
4965
  attribute: fi.join(" ")
4922
4966
  },
4923
4967
  contains: [
@@ -4939,7 +4983,7 @@ function yi(n) {
4939
4983
  };
4940
4984
  }
4941
4985
  function Re(n) {
4942
- 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 = {
4986
+ 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 = {
4943
4987
  className: "symbol",
4944
4988
  begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/
4945
4989
  }, a = {
@@ -4951,7 +4995,7 @@ function Re(n) {
4951
4995
  illegal: /\n/
4952
4996
  }
4953
4997
  ]
4954
- }, s = n.inherit(a, {
4998
+ }, r = n.inherit(a, {
4955
4999
  begin: /\(/,
4956
5000
  end: /\)/
4957
5001
  }), o = n.inherit(n.APOS_STRING_MODE, { className: "string" }), c = n.inherit(n.QUOTE_STRING_MODE, { className: "string" }), l = {
@@ -4975,12 +5019,12 @@ function Re(n) {
4975
5019
  {
4976
5020
  begin: /"/,
4977
5021
  end: /"/,
4978
- contains: [r]
5022
+ contains: [s]
4979
5023
  },
4980
5024
  {
4981
5025
  begin: /'/,
4982
5026
  end: /'/,
4983
- contains: [r]
5027
+ contains: [s]
4984
5028
  },
4985
5029
  { begin: /[^\s"'=<>`]+/ }
4986
5030
  ]
@@ -5015,7 +5059,7 @@ function Re(n) {
5015
5059
  a,
5016
5060
  c,
5017
5061
  o,
5018
- s,
5062
+ r,
5019
5063
  {
5020
5064
  begin: /\[/,
5021
5065
  end: /\]/,
@@ -5026,7 +5070,7 @@ function Re(n) {
5026
5070
  end: />/,
5027
5071
  contains: [
5028
5072
  a,
5029
- s,
5073
+ r,
5030
5074
  c,
5031
5075
  o
5032
5076
  ]
@@ -5045,7 +5089,7 @@ function Re(n) {
5045
5089
  end: /\]\]>/,
5046
5090
  relevance: 10
5047
5091
  },
5048
- r,
5092
+ s,
5049
5093
  // xml processing instructions
5050
5094
  {
5051
5095
  className: "meta",
@@ -5157,7 +5201,7 @@ function wi(n) {
5157
5201
  contains: [{ match: /''/ }]
5158
5202
  }
5159
5203
  ]
5160
- }, r = {
5204
+ }, s = {
5161
5205
  begin: /"/,
5162
5206
  end: /"/,
5163
5207
  contains: [{ match: /""/ }]
@@ -5167,7 +5211,7 @@ function wi(n) {
5167
5211
  // Not sure it's correct to call NULL literal, and clauses like IS [NOT] NULL look strange that way.
5168
5212
  // "null",
5169
5213
  "unknown"
5170
- ], s = [
5214
+ ], r = [
5171
5215
  "double precision",
5172
5216
  "large object",
5173
5217
  "with timezone",
@@ -5706,7 +5750,7 @@ function wi(n) {
5706
5750
  scope: "operator",
5707
5751
  match: /[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,
5708
5752
  relevance: 0
5709
- }, S = {
5753
+ }, T = {
5710
5754
  match: e.concat(/\b/, e.either(...m), /\s*\(/),
5711
5755
  relevance: 0,
5712
5756
  keywords: { built_in: m }
@@ -5745,13 +5789,13 @@ function wi(n) {
5745
5789
  contains: [
5746
5790
  {
5747
5791
  scope: "type",
5748
- match: O(s)
5792
+ match: O(r)
5749
5793
  },
5750
5794
  U,
5751
- S,
5795
+ T,
5752
5796
  f,
5753
5797
  i,
5754
- r,
5798
+ s,
5755
5799
  n.C_NUMBER_MODE,
5756
5800
  n.C_BLOCK_COMMENT_MODE,
5757
5801
  t,
@@ -5774,7 +5818,7 @@ function xt(n) {
5774
5818
  begin: /'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/
5775
5819
  }
5776
5820
  ]
5777
- }, r = {
5821
+ }, s = {
5778
5822
  className: "template-variable",
5779
5823
  variants: [
5780
5824
  {
@@ -5800,7 +5844,7 @@ function xt(n) {
5800
5844
  relevance: 0
5801
5845
  }
5802
5846
  ]
5803
- }, s = {
5847
+ }, r = {
5804
5848
  className: "string",
5805
5849
  relevance: 0,
5806
5850
  variants: [
@@ -5812,9 +5856,9 @@ function xt(n) {
5812
5856
  ],
5813
5857
  contains: [
5814
5858
  n.BACKSLASH_ESCAPE,
5815
- r
5859
+ s
5816
5860
  ]
5817
- }, o = n.inherit(s, { variants: [
5861
+ }, o = n.inherit(r, { variants: [
5818
5862
  {
5819
5863
  begin: /'/,
5820
5864
  end: /'/,
@@ -5930,9 +5974,9 @@ function xt(n) {
5930
5974
  y,
5931
5975
  f,
5932
5976
  a,
5933
- s
5934
- ], S = [...v];
5935
- return S.pop(), S.push(o), m.contains = S, {
5977
+ r
5978
+ ], T = [...v];
5979
+ return T.pop(), T.push(o), m.contains = T, {
5936
5980
  name: "YAML",
5937
5981
  case_insensitive: !0,
5938
5982
  aliases: ["yml"],
@@ -5945,7 +5989,7 @@ function Ct(n) {
5945
5989
  end: ">",
5946
5990
  subLanguage: "xml",
5947
5991
  relevance: 0
5948
- }, i = { match: /^ {0,3}([-*_])[ \t]*(?:\1[ \t]*){2,}$/ }, r = {
5992
+ }, i = { match: /^ {0,3}([-*_])[ \t]*(?:\1[ \t]*){2,}$/ }, s = {
5949
5993
  className: "code",
5950
5994
  variants: [
5951
5995
  // TODO: fix to allow these to work with sublanguage also
@@ -5979,7 +6023,7 @@ function Ct(n) {
5979
6023
  begin: "^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",
5980
6024
  end: "\\s+",
5981
6025
  excludeEnd: !0
5982
- }, s = {
6026
+ }, r = {
5983
6027
  begin: /^\[[^\n]+\]:/,
5984
6028
  returnBegin: !0,
5985
6029
  contains: [
@@ -6096,8 +6140,8 @@ function Ct(n) {
6096
6140
  d,
6097
6141
  h,
6098
6142
  p
6099
- ].forEach((S) => {
6100
- S.contains = S.contains.concat(m);
6143
+ ].forEach((T) => {
6144
+ T.contains = T.contains.concat(m);
6101
6145
  }), m = m.concat(l, d), {
6102
6146
  name: "Markdown",
6103
6147
  aliases: [
@@ -6140,9 +6184,9 @@ function Ct(n) {
6140
6184
  contains: m,
6141
6185
  end: "$"
6142
6186
  },
6143
- r,
6144
- c,
6145
6187
  s,
6188
+ c,
6189
+ r,
6146
6190
  {
6147
6191
  //https://spec.commonmark.org/0.31.2/#entity-references
6148
6192
  scope: "literal",
@@ -6305,16 +6349,16 @@ function vi(n) {
6305
6349
  };
6306
6350
  }
6307
6351
  function Mt(n) {
6308
- const e = n.regex, t = /(r#)?/, i = e.concat(t, n.UNDERSCORE_IDENT_RE), r = e.concat(t, n.IDENT_RE), a = {
6352
+ const e = n.regex, t = /(r#)?/, i = e.concat(t, n.UNDERSCORE_IDENT_RE), s = e.concat(t, n.IDENT_RE), a = {
6309
6353
  scope: "title.function.invoke",
6310
6354
  relevance: 0,
6311
6355
  begin: e.concat(
6312
6356
  /\b/,
6313
6357
  /(?!(?:let|for|while|if|else|match)\b)/,
6314
- r,
6358
+ s,
6315
6359
  e.lookahead(/\s*\(/)
6316
6360
  )
6317
- }, s = "([ui](8|16|32|64|128|size)|f(16|32|64|128))?", o = [
6361
+ }, r = "([ui](8|16|32|64|128|size)|f(16|32|64|128))?", o = [
6318
6362
  "abstract",
6319
6363
  "as",
6320
6364
  "async",
@@ -6510,10 +6554,10 @@ function Mt(n) {
6510
6554
  {
6511
6555
  scope: "number",
6512
6556
  variants: [
6513
- { begin: "\\b0b([01_]+)" + s },
6514
- { begin: "\\b0o([0-7_]+)" + s },
6515
- { begin: "\\b0x([A-Fa-f0-9_]+)" + s },
6516
- { begin: "\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)" + s }
6557
+ { begin: "\\b0b([01_]+)" + r },
6558
+ { begin: "\\b0o([0-7_]+)" + r },
6559
+ { begin: "\\b0x([A-Fa-f0-9_]+)" + r },
6560
+ { begin: "\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)" + r }
6517
6561
  ],
6518
6562
  relevance: 0
6519
6563
  },
@@ -6620,18 +6664,18 @@ function Mt(n) {
6620
6664
  ]
6621
6665
  };
6622
6666
  }
6623
- var re = "[0-9](_*[0-9])*", fe = `\\.(${re})`, be = "[0-9a-fA-F](_*[0-9a-fA-F])*", Je = {
6667
+ var se = "[0-9](_*[0-9])*", fe = `\\.(${se})`, be = "[0-9a-fA-F](_*[0-9a-fA-F])*", Je = {
6624
6668
  className: "number",
6625
6669
  variants: [
6626
6670
  // DecimalFloatingPointLiteral
6627
6671
  // including ExponentPart
6628
- { begin: `(\\b(${re})((${fe})|\\.)?|(${fe}))[eE][+-]?(${re})[fFdD]?\\b` },
6672
+ { begin: `(\\b(${se})((${fe})|\\.)?|(${fe}))[eE][+-]?(${se})[fFdD]?\\b` },
6629
6673
  // excluding ExponentPart
6630
- { begin: `\\b(${re})((${fe})[fFdD]?\\b|\\.([fFdD]\\b)?)` },
6674
+ { begin: `\\b(${se})((${fe})[fFdD]?\\b|\\.([fFdD]\\b)?)` },
6631
6675
  { begin: `(${fe})[fFdD]?\\b` },
6632
- { begin: `\\b(${re})[fFdD]\\b` },
6676
+ { begin: `\\b(${se})[fFdD]\\b` },
6633
6677
  // HexadecimalFloatingPointLiteral
6634
- { begin: `\\b0[xX]((${be})\\.?|(${be})?\\.(${be}))[pP][+-]?(${re})[fFdD]?\\b` },
6678
+ { begin: `\\b0[xX]((${be})\\.?|(${be})?\\.(${be}))[pP][+-]?(${se})[fFdD]?\\b` },
6635
6679
  // DecimalIntegerLiteral
6636
6680
  { begin: "\\b(0|[1-9](_*[0-9])*)[lL]?\\b" },
6637
6681
  // HexIntegerLiteral
@@ -6647,8 +6691,8 @@ function Rt(n, e, t) {
6647
6691
  return t === -1 ? "" : n.replace(e, (i) => Rt(n, e, t - 1));
6648
6692
  }
6649
6693
  function ki(n) {
6650
- 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(
6651
- "(?:\\s*<\\s*" + s + "(?:\\s*,\\s*" + s + ")*\\s*>)?",
6694
+ 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(
6695
+ "(?:\\s*<\\s*" + r + "(?:\\s*,\\s*" + r + ")*\\s*>)?",
6652
6696
  /<@@@>/g,
6653
6697
  2
6654
6698
  ), p = {
@@ -6867,7 +6911,7 @@ function ki(n) {
6867
6911
  };
6868
6912
  }
6869
6913
  function Ni(n) {
6870
- 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(
6914
+ 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(
6871
6915
  "bool",
6872
6916
  "char",
6873
6917
  "schar",
@@ -6980,9 +7024,9 @@ function Ni(n) {
6980
7024
  m
6981
7025
  ], f = {
6982
7026
  className: "title",
6983
- begin: e.optional(r) + n.IDENT_RE,
7027
+ begin: e.optional(s) + n.IDENT_RE,
6984
7028
  relevance: 0
6985
- }, v = e.optional(r) + n.IDENT_RE + "\\s*\\(", S = 12, C = {
7029
+ }, v = e.optional(s) + n.IDENT_RE + "\\s*\\(", T = 12, C = {
6986
7030
  keyword: [
6987
7031
  "asm",
6988
7032
  "auto",
@@ -7103,7 +7147,7 @@ function Ni(n) {
7103
7147
  ]),
7104
7148
  relevance: 0
7105
7149
  }, B = {
7106
- begin: "(" + s + "[\\*&\\s]+){1," + S + "}" + v,
7150
+ begin: "(" + r + "[\\*&\\s]+){1," + T + "}" + v,
7107
7151
  returnBegin: !0,
7108
7152
  end: /[{;=]/,
7109
7153
  excludeEnd: !0,
@@ -7200,7 +7244,7 @@ function Ni(n) {
7200
7244
  };
7201
7245
  }
7202
7246
  function Ot(n) {
7203
- 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 = {
7247
+ 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 = {
7204
7248
  className: "type",
7205
7249
  begin: "\\b[a-z\\d_]*_t\\b"
7206
7250
  }, l = {
@@ -7278,9 +7322,9 @@ function Ot(n) {
7278
7322
  p
7279
7323
  ], y = {
7280
7324
  className: "title",
7281
- begin: e.optional(r) + n.IDENT_RE,
7325
+ begin: e.optional(s) + n.IDENT_RE,
7282
7326
  relevance: 0
7283
- }, f = e.optional(r) + n.IDENT_RE + "\\s*\\(", v = 12, S = [
7327
+ }, f = e.optional(s) + n.IDENT_RE + "\\s*\\(", v = 12, T = [
7284
7328
  "alignas",
7285
7329
  "alignof",
7286
7330
  "and",
@@ -7546,7 +7590,7 @@ function Ot(n) {
7546
7590
  "vsprintf"
7547
7591
  ], B = {
7548
7592
  type: O,
7549
- keyword: S,
7593
+ keyword: T,
7550
7594
  literal: [
7551
7595
  "NULL",
7552
7596
  "false",
@@ -7565,7 +7609,7 @@ function Ot(n) {
7565
7609
  },
7566
7610
  begin: e.concat(
7567
7611
  /\b/,
7568
- `(?!${S.join("|")})`,
7612
+ `(?!${T.join("|")})`,
7569
7613
  n.IDENT_RE,
7570
7614
  e.lookahead(/(<[^<>]+>|)\s*\(/)
7571
7615
  )
@@ -7608,7 +7652,7 @@ function Ot(n) {
7608
7652
  relevance: 0
7609
7653
  }, J = {
7610
7654
  className: "function",
7611
- begin: "(" + s + "[\\*&\\s]+){1," + v + "}" + f,
7655
+ begin: "(" + r + "[\\*&\\s]+){1," + v + "}" + f,
7612
7656
  returnBegin: !0,
7613
7657
  end: /[{;=]/,
7614
7658
  excludeEnd: !0,
@@ -7736,8 +7780,8 @@ function Ot(n) {
7736
7780
  }
7737
7781
  A.registerLanguage("javascript", _t);
7738
7782
  A.registerLanguage("js", _t);
7739
- A.registerLanguage("typescript", St);
7740
- A.registerLanguage("ts", St);
7783
+ A.registerLanguage("typescript", Tt);
7784
+ A.registerLanguage("ts", Tt);
7741
7785
  A.registerLanguage("python", At);
7742
7786
  A.registerLanguage("py", At);
7743
7787
  A.registerLanguage("json", ui);
@@ -7760,19 +7804,19 @@ A.registerLanguage("java", ki);
7760
7804
  A.registerLanguage("c", Ni);
7761
7805
  A.registerLanguage("cpp", Ot);
7762
7806
  A.registerLanguage("c++", Ot);
7763
- const Ti = /* @__PURE__ */ new Set(["mindmap"]);
7807
+ const Si = /* @__PURE__ */ new Set(["mindmap"]);
7764
7808
  function le(n) {
7765
7809
  return n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
7766
7810
  }
7767
- function Si(n, e = {}) {
7768
- const t = new Set(e.reservedLanguages ?? Ti), i = n.renderer.rules.fence ? n.renderer.rules.fence.bind(n.renderer.rules) : (r, a, s, o, c) => c.renderToken(r, a, s);
7769
- n.renderer.rules.fence = (r, a, s, o, c) => {
7811
+ function Ti(n, e = {}) {
7812
+ const t = new Set(e.reservedLanguages ?? Si), i = n.renderer.rules.fence ? n.renderer.rules.fence.bind(n.renderer.rules) : (s, a, r, o, c) => c.renderToken(s, a, r);
7813
+ n.renderer.rules.fence = (s, a, r, o, c) => {
7770
7814
  var f;
7771
- const l = r[a];
7772
- if (!l) return i(r, a, s, o, c);
7815
+ const l = s[a];
7816
+ if (!l) return i(s, a, r, o, c);
7773
7817
  const h = ((f = l.info.trim().split(/\s+/)[0]) == null ? void 0 : f.toLowerCase()) ?? "";
7774
7818
  if (t.has(h))
7775
- return i(r, a, s, o, c);
7819
+ return i(s, a, r, o, c);
7776
7820
  const p = l.content;
7777
7821
  let m, y = h || "text";
7778
7822
  if (h && A.getLanguage(h))
@@ -7829,16 +7873,16 @@ function Oi(n, e = "video") {
7829
7873
  return `![${e}](${n})`;
7830
7874
  }
7831
7875
  function Ii(n) {
7832
- const e = n.renderer.rules.image ? n.renderer.rules.image.bind(n.renderer.rules) : (t, i, r, a, s) => s.renderToken(t, i, r);
7833
- n.renderer.rules.image = (t, i, r, a, s) => {
7876
+ const e = n.renderer.rules.image ? n.renderer.rules.image.bind(n.renderer.rules) : (t, i, s, a, r) => r.renderToken(t, i, s);
7877
+ n.renderer.rules.image = (t, i, s, a, r) => {
7834
7878
  const o = t[i];
7835
- if (!o) return e(t, i, r, a, s);
7879
+ if (!o) return e(t, i, s, a, r);
7836
7880
  const c = o.attrGet("src") ?? "";
7837
7881
  if (Ri(c)) {
7838
7882
  const l = o.content || "";
7839
7883
  return `<video src="${c}" controls class="md-editor-video" title="${l}">${l}</video>`;
7840
7884
  }
7841
- return e(t, i, r, a, s);
7885
+ return e(t, i, s, a, r);
7842
7886
  };
7843
7887
  }
7844
7888
  const Li = /* @__PURE__ */ new Set([
@@ -7864,10 +7908,10 @@ const Li = /* @__PURE__ */ new Set([
7864
7908
  success: "✓"
7865
7909
  };
7866
7910
  function $i(n) {
7867
- n.block.ruler.before("fence", "tips_block", (e, t, i, r) => {
7868
- const s = e.src.slice(e.bMarks[t], e.eMarks[t]).match(Di);
7869
- if (!s) return !1;
7870
- const o = (s[1] ?? "").toLowerCase();
7911
+ n.block.ruler.before("fence", "tips_block", (e, t, i, s) => {
7912
+ const r = e.src.slice(e.bMarks[t], e.eMarks[t]).match(Di);
7913
+ if (!r) return !1;
7914
+ const o = (r[1] ?? "").toLowerCase();
7871
7915
  if (!Li.has(o)) return !1;
7872
7916
  let c = t + 1, l = !1;
7873
7917
  for (; c < i; ) {
@@ -7879,14 +7923,14 @@ function $i(n) {
7879
7923
  c++;
7880
7924
  }
7881
7925
  if (!l) return !1;
7882
- if (r) return !0;
7883
- 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);
7926
+ if (s) return !0;
7927
+ const d = r[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);
7884
7928
  return m.content = p, m.info = o, m.markup = d, e.line = c + 1, !0;
7885
7929
  }), n.renderer.rules.tips_block = (e, t) => {
7886
7930
  const i = e[t];
7887
7931
  if (!i) return "";
7888
- const r = i.info ?? "notice", a = i.markup ?? et[r] ?? "Notice", s = Bi[r] ?? "i", o = i.content ?? "";
7889
- 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">${Ui(a)}</span></div><div class="md-editor-tip-body">${o}</div></div>`;
7932
+ const s = i.info ?? "notice", a = i.markup ?? et[s] ?? "Notice", r = Bi[s] ?? "i", o = i.content ?? "";
7933
+ 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">${Ui(a)}</span></div><div class="md-editor-tip-body">${o}</div></div>`;
7890
7934
  };
7891
7935
  }
7892
7936
  function Ui(n) {
@@ -7894,11 +7938,11 @@ function Ui(n) {
7894
7938
  }
7895
7939
  function Hi(n) {
7896
7940
  const e = n.renderer.rules.list_item_open;
7897
- n.renderer.rules.list_item_open = (t, i, r, a, s) => {
7941
+ n.renderer.rules.list_item_open = (t, i, s, a, r) => {
7898
7942
  var l, d;
7899
7943
  const o = t[i];
7900
7944
  if (!o)
7901
- return e ? e(t, i, r, a, s) : s.renderToken(t, i, r);
7945
+ return e ? e(t, i, s, a, r) : r.renderToken(t, i, s);
7902
7946
  let c;
7903
7947
  for (let h = i + 1; h < t.length && h < i + 6; h++) {
7904
7948
  if (((l = t[h]) == null ? void 0 : l.type) === "inline") {
@@ -7912,15 +7956,15 @@ function Hi(n) {
7912
7956
  if (p || m) {
7913
7957
  const y = /^\[\s*(?:[xX])?\s*\]\s/;
7914
7958
  if (c.content = h.replace(y, ""), c.children && c.children.length > 0) {
7915
- const S = c.children[0];
7916
- S && S.type === "text" && (S.content = S.content.replace(y, ""));
7959
+ const T = c.children[0];
7960
+ T && T.type === "text" && (T.content = T.content.replace(y, ""));
7917
7961
  }
7918
7962
  o.attrSet("class", "task-list-item");
7919
7963
  const f = `<input type="checkbox" disabled${p ? " checked" : ""} /> `;
7920
- return (e ? e(t, i, r, a, s) : s.renderToken(t, i, r)) + f;
7964
+ return (e ? e(t, i, s, a, r) : r.renderToken(t, i, s)) + f;
7921
7965
  }
7922
7966
  }
7923
- return e ? e(t, i, r, a, s) : s.renderToken(t, i, r);
7967
+ return e ? e(t, i, s, a, r) : r.renderToken(t, i, s);
7924
7968
  };
7925
7969
  }
7926
7970
  class It {
@@ -7930,7 +7974,7 @@ class It {
7930
7974
  linkify: !0,
7931
7975
  breaks: e.breaks ?? !1,
7932
7976
  typographer: !0
7933
- }), e.math !== !1 && sn(this.md), this.mindmapEnabled = e.mindmap !== !1, this.mindmapEnabled && on(this.md), e.codeHighlight !== !1 && Si(this.md, {
7977
+ }), e.math !== !1 && rn(this.md), this.mindmapEnabled = e.mindmap !== !1, this.mindmapEnabled && on(this.md), e.codeHighlight !== !1 && Ti(this.md, {
7934
7978
  reservedLanguages: this.mindmapEnabled ? ["mindmap"] : []
7935
7979
  }), e.tips !== !1 && $i(this.md), Hi(this.md), en(this.md), Ii(this.md);
7936
7980
  }
@@ -7945,7 +7989,7 @@ class It {
7945
7989
  this.mindmapEnabled && await ln(e);
7946
7990
  }
7947
7991
  }
7948
- function or(n, e = {}) {
7992
+ function os(n, e = {}) {
7949
7993
  return new It(e).render(n);
7950
7994
  }
7951
7995
  class Fi {
@@ -7953,11 +7997,11 @@ class Fi {
7953
7997
  this.buttons = /* @__PURE__ */ new Map(), this.el = document.createElement("div"), this.el.className = "md-editor-toolbar", this.el.setAttribute("role", "toolbar");
7954
7998
  for (const t of e) {
7955
7999
  const i = document.createElement("button");
7956
- 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) => {
7957
- r.preventDefault(), r.stopPropagation(), t.handler(i);
8000
+ 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) => {
8001
+ s.preventDefault(), s.stopPropagation(), t.handler(i);
7958
8002
  }), this.buttons.set(t.name, i), this.el.appendChild(i), t.groupEnd) {
7959
- const r = document.createElement("span");
7960
- r.className = "md-editor-toolbar-sep", this.el.appendChild(r);
8003
+ const s = document.createElement("span");
8004
+ s.className = "md-editor-toolbar-sep", this.el.appendChild(s);
7961
8005
  }
7962
8006
  }
7963
8007
  }
@@ -8003,15 +8047,15 @@ function Wi(n) {
8003
8047
  function Yi(n) {
8004
8048
  const e = n.split(`
8005
8049
  `), t = [];
8006
- let i = [], r = !1, a = "", s = 0;
8050
+ let i = [], s = !1, a = "", r = 0;
8007
8051
  for (const c of e) {
8008
8052
  const l = c.match(Gi);
8009
8053
  if (l) {
8010
8054
  const d = l[1] ?? "", h = d[0] ?? "", p = d.length;
8011
- r ? h === a && p >= s && qi.test(c) && (r = !1) : (r = !0, a = h, s = p), i.push(c);
8055
+ s ? h === a && p >= r && qi.test(c) && (s = !1) : (s = !0, a = h, r = p), i.push(c);
8012
8056
  continue;
8013
8057
  }
8014
- if (!r && Ki.test(c) && i.length > 0) {
8058
+ if (!s && Ki.test(c) && i.length > 0) {
8015
8059
  t.push(i.join(`
8016
8060
  `)), i = [c];
8017
8061
  continue;
@@ -8031,17 +8075,17 @@ class Zi {
8031
8075
  this.container = e, this.renderBlock = t, this.maxCacheEntries = i, this.nodeByKey = /* @__PURE__ */ new Map(), this.htmlByHash = /* @__PURE__ */ new Map(), this.prevBlocks = [];
8032
8076
  }
8033
8077
  update(e) {
8034
- const t = Yi(e), i = document.createDocumentFragment(), r = /* @__PURE__ */ new Map();
8078
+ const t = Yi(e), i = document.createDocumentFragment(), s = /* @__PURE__ */ new Map();
8035
8079
  let a = 0;
8036
- for (const s of t) {
8037
- let o = this.nodeByKey.get(s.key);
8080
+ for (const r of t) {
8081
+ let o = this.nodeByKey.get(r.key);
8038
8082
  if (!o) {
8039
- let c = this.htmlByHash.get(s.hash);
8040
- c === void 0 && (c = this.renderBlock(s.source), this.htmlByHash.set(s.hash, c), a++), o = document.createElement("div"), o.className = "md-editor-block", o.dataset.blockKey = s.key, o.innerHTML = c;
8083
+ let c = this.htmlByHash.get(r.hash);
8084
+ 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;
8041
8085
  }
8042
- r.set(s.key, o), i.appendChild(o);
8086
+ s.set(r.key, o), i.appendChild(o);
8043
8087
  }
8044
- return this.container.innerHTML = "", this.container.appendChild(i), this.nodeByKey = r, this.prevBlocks = t, this.evictCacheIfNeeded(t), { rerenderedCount: a, totalCount: t.length };
8088
+ return this.container.innerHTML = "", this.container.appendChild(i), this.nodeByKey = s, this.prevBlocks = t, this.evictCacheIfNeeded(t), { rerenderedCount: a, totalCount: t.length };
8045
8089
  }
8046
8090
  /**
8047
8091
  * When the cache exceeds the limit, evict hashes that no longer appear in
@@ -8063,26 +8107,26 @@ class Zi {
8063
8107
  }
8064
8108
  function Vi(n, e) {
8065
8109
  let t, i;
8066
- const r = (...a) => {
8110
+ const s = (...a) => {
8067
8111
  i = a, t !== void 0 && clearTimeout(t), t = setTimeout(() => {
8068
8112
  t = void 0, i && n(...i);
8069
8113
  }, e);
8070
8114
  };
8071
- return r.cancel = () => {
8115
+ return s.cancel = () => {
8072
8116
  t !== void 0 && clearTimeout(t), t = void 0;
8073
- }, r.flush = () => {
8117
+ }, s.flush = () => {
8074
8118
  t !== void 0 && (clearTimeout(t), t = void 0, i && n(...i));
8075
- }, r;
8119
+ }, s;
8076
8120
  }
8077
8121
  function Xi(n, e = 120, t = 600) {
8078
- const i = Math.max(0, n), r = Math.floor(i / 2e4) * 60;
8079
- return Math.min(t, e + r);
8122
+ const i = Math.max(0, n), s = Math.floor(i / 2e4) * 60;
8123
+ return Math.min(t, e + s);
8080
8124
  }
8081
- function ar(n, e = 300) {
8125
+ function as(n, e = 300) {
8082
8126
  const t = window;
8083
8127
  return typeof t.requestIdleCallback == "function" ? t.requestIdleCallback(n, { timeout: e }) : window.setTimeout(n, 0);
8084
8128
  }
8085
- function cr(n) {
8129
+ function cs(n) {
8086
8130
  const e = window;
8087
8131
  typeof e.cancelIdleCallback == "function" ? e.cancelIdleCallback(n) : clearTimeout(n);
8088
8132
  }
@@ -8167,8 +8211,8 @@ const L = (n) => `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xm
8167
8211
  class ie {
8168
8212
  constructor(e, t) {
8169
8213
  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) => {
8170
- const r = i.target;
8171
- !this.el.contains(r) && !this.anchor.contains(r) && this.hide();
8214
+ const s = i.target;
8215
+ !this.el.contains(s) && !this.anchor.contains(s) && this.hide();
8172
8216
  }, this.onKeyDown = (i) => {
8173
8217
  i.key === "Escape" && this.hide();
8174
8218
  };
@@ -8178,22 +8222,22 @@ class ie {
8178
8222
  e.className = "md-editor-popup-header", e.textContent = this.config.title;
8179
8223
  const t = document.createElement("div");
8180
8224
  t.className = "md-editor-popup-body";
8181
- for (const s of this.config.fields) {
8225
+ for (const r of this.config.fields) {
8182
8226
  const o = document.createElement("div");
8183
8227
  o.className = "md-editor-popup-field";
8184
8228
  const c = document.createElement("label");
8185
- c.className = "md-editor-popup-label", c.textContent = s.label, c.setAttribute("for", `md-editor-popup-${s.name}`);
8229
+ c.className = "md-editor-popup-label", c.textContent = r.label, c.setAttribute("for", `md-editor-popup-${r.name}`);
8186
8230
  let l;
8187
- 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);
8231
+ 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);
8188
8232
  }
8189
8233
  const i = document.createElement("div");
8190
8234
  i.className = "md-editor-popup-footer";
8191
- const r = document.createElement("button");
8192
- r.type = "button", r.className = "md-editor-popup-btn md-editor-popup-btn--ghost", r.textContent = "Cancel", r.addEventListener("click", () => this.hide());
8235
+ const s = document.createElement("button");
8236
+ s.type = "button", s.className = "md-editor-popup-btn md-editor-popup-btn--ghost", s.textContent = "Cancel", s.addEventListener("click", () => this.hide());
8193
8237
  const a = document.createElement("button");
8194
- 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);
8195
- for (const s of this.inputs.values())
8196
- s.tagName === "INPUT" && s.addEventListener("keydown", (o) => {
8238
+ 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);
8239
+ for (const r of this.inputs.values())
8240
+ r.tagName === "INPUT" && r.addEventListener("keydown", (o) => {
8197
8241
  const c = o;
8198
8242
  c.key === "Enter" && (c.preventDefault(), this.submit());
8199
8243
  });
@@ -8216,8 +8260,8 @@ class ie {
8216
8260
  position() {
8217
8261
  const e = this.anchor.getBoundingClientRect(), t = this.el.getBoundingClientRect();
8218
8262
  let i = e.left;
8219
- const r = e.bottom + 6;
8220
- 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`;
8263
+ const s = e.bottom + 6;
8264
+ 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`;
8221
8265
  }
8222
8266
  destroy() {
8223
8267
  this.hide(), this.destroyed = !0, this.inputs.clear();
@@ -8237,17 +8281,17 @@ const Qi = [
8237
8281
  { action: "preview", key: "Mod-Alt-p", description: "Toggle preview" },
8238
8282
  { action: "theme", key: "Mod-Shift-l", description: "Toggle theme" }
8239
8283
  ];
8240
- function lr(n, e) {
8284
+ function ls(n, e) {
8241
8285
  var c;
8242
8286
  const t = n.toLowerCase().split("-");
8243
- let i = "", r = !1, a = !1, s = !1, o = !1;
8287
+ let i = "", s = !1, a = !1, r = !1, o = !1;
8244
8288
  for (const l of t)
8245
8289
  switch (l) {
8246
8290
  case "mod":
8247
- (c = navigator.platform) != null && c.toLowerCase().includes("mac") ? a = !0 : r = !0;
8291
+ (c = navigator.platform) != null && c.toLowerCase().includes("mac") ? a = !0 : s = !0;
8248
8292
  break;
8249
8293
  case "ctrl":
8250
- r = !0;
8294
+ s = !0;
8251
8295
  break;
8252
8296
  case "meta":
8253
8297
  case "cmd":
@@ -8255,7 +8299,7 @@ function lr(n, e) {
8255
8299
  break;
8256
8300
  case "alt":
8257
8301
  case "option":
8258
- s = !0;
8302
+ r = !0;
8259
8303
  break;
8260
8304
  case "shift":
8261
8305
  o = !0;
@@ -8263,13 +8307,13 @@ function lr(n, e) {
8263
8307
  default:
8264
8308
  i = l;
8265
8309
  }
8266
- return !(e.ctrlKey !== r || e.metaKey !== a || e.altKey !== s || e.shiftKey !== o || e.key.toLowerCase() !== i);
8310
+ return !(e.ctrlKey !== s || e.metaKey !== a || e.altKey !== r || e.shiftKey !== o || e.key.toLowerCase() !== i);
8267
8311
  }
8268
- function dr(n) {
8312
+ function ds(n) {
8269
8313
  var i;
8270
8314
  const e = ((i = navigator.platform) == null ? void 0 : i.toLowerCase().includes("mac")) ?? !1;
8271
- return n.split("-").map((r) => {
8272
- switch (r.toLowerCase()) {
8315
+ return n.split("-").map((s) => {
8316
+ switch (s.toLowerCase()) {
8273
8317
  case "mod":
8274
8318
  return e ? "Cmd" : "Ctrl";
8275
8319
  case "ctrl":
@@ -8282,36 +8326,36 @@ function dr(n) {
8282
8326
  case "shift":
8283
8327
  return "Shift";
8284
8328
  default:
8285
- return r.toUpperCase();
8329
+ return s.toUpperCase();
8286
8330
  }
8287
8331
  }).join("+");
8288
8332
  }
8289
8333
  function Ji(n) {
8290
8334
  var i;
8291
8335
  const e = ((i = navigator.platform) == null ? void 0 : i.toLowerCase().includes("mac")) ?? !1;
8292
- return n.split("-").map((r) => {
8293
- let a = r, s = "";
8294
- switch (r.toLowerCase()) {
8336
+ return n.split("-").map((s) => {
8337
+ let a = s, r = "";
8338
+ switch (s.toLowerCase()) {
8295
8339
  case "mod":
8296
- a = e ? "Cmd" : "Ctrl", s = e ? "⌘" : "";
8340
+ a = e ? "Cmd" : "Ctrl", r = e ? "⌘" : "";
8297
8341
  break;
8298
8342
  case "ctrl":
8299
- a = "Ctrl", s = e ? "⌃" : "";
8343
+ a = "Ctrl", r = e ? "⌃" : "";
8300
8344
  break;
8301
8345
  case "meta":
8302
8346
  case "cmd":
8303
- a = "Cmd", s = "⌘";
8347
+ a = "Cmd", r = "⌘";
8304
8348
  break;
8305
8349
  case "alt":
8306
- a = e ? "Option" : "Alt", s = e ? "⌥" : "";
8350
+ a = e ? "Option" : "Alt", r = e ? "⌥" : "";
8307
8351
  break;
8308
8352
  case "shift":
8309
- a = "Shift", s = "⇧";
8353
+ a = "Shift", r = "⇧";
8310
8354
  break;
8311
8355
  default:
8312
- a = r.toUpperCase();
8356
+ a = s.toUpperCase();
8313
8357
  }
8314
- return `<kbd class="md-editor-kbd">${s ? `<span class="md-editor-kbd-symbol">${s}</span>` : ""}<span>${a}</span></kbd>`;
8358
+ return `<kbd class="md-editor-kbd">${r ? `<span class="md-editor-kbd-symbol">${r}</span>` : ""}<span>${a}</span></kbd>`;
8315
8359
  }).join('<span class="md-editor-kbd-plus">+</span>');
8316
8360
  }
8317
8361
  const nt = {
@@ -8341,7 +8385,7 @@ const nt = {
8341
8385
  ---
8342
8386
  `, "", ""]
8343
8387
  };
8344
- class ur {
8388
+ class us {
8345
8389
  constructor(e, t = {}) {
8346
8390
  this.previewPane = null, this.incremental = null, this.toolbar = null, this.statusBar = null, this.activePopup = null, this.scheduledRender = null, this.scheduledWait = 0;
8347
8391
  const i = typeof e == "string" ? document.querySelector(e) : e;
@@ -8354,16 +8398,16 @@ class ur {
8354
8398
  }), this.buildLayout(), this.codeEditor = new tn(this.editorPane, {
8355
8399
  value: t.value ?? "",
8356
8400
  lineNumbers: this.mode === "complex",
8357
- onChange: (r) => {
8401
+ onChange: (s) => {
8358
8402
  var a;
8359
- (a = this.onChange) == null || a.call(this, r), this.autoPreview && this.requestPreviewRender(r), this.updateStatusBar(r);
8403
+ (a = this.onChange) == null || a.call(this, s), this.autoPreview && this.requestPreviewRender(s), this.updateStatusBar(s);
8360
8404
  },
8361
- onImageFile: (r) => this.handleImageFile(r),
8405
+ onImageFile: (s) => this.handleImageFile(s),
8362
8406
  mention: t.mention,
8363
8407
  docLink: t.docLink
8364
8408
  }), this.setupKeyboardShortcuts(), this.mode === "complex" && (this.buildToolbar(), this.buildStatusBar()), this.previewPane && (this.previewPane.classList.add("markdown-body"), this.incremental = new Zi(
8365
8409
  this.previewPane,
8366
- (r) => this.renderer.render(r)
8410
+ (s) => this.renderer.render(s)
8367
8411
  ), this.setupCopyHandler()), this.renderPreview(t.value ?? ""), this.updateStatusBar(t.value ?? "");
8368
8412
  }
8369
8413
  // ---------- Layout ----------
@@ -8384,12 +8428,12 @@ class ur {
8384
8428
  return this.toolbarConfig && !Array.isArray(this.toolbarConfig) ? ((i = this.toolbarConfig[e]) == null ? void 0 : i.icon) ?? t : t;
8385
8429
  }
8386
8430
  buildToolbar() {
8387
- const e = [], t = (i, r, a, s, o = {}) => {
8431
+ const e = [], t = (i, s, a, r, o = {}) => {
8388
8432
  this.isActionVisible(i) && e.push({
8389
8433
  name: i,
8390
- title: this.getActionLabel(i, r),
8434
+ title: this.getActionLabel(i, s),
8391
8435
  icon: this.getActionIcon(i, a),
8392
- handler: s,
8436
+ handler: r,
8393
8437
  ...o
8394
8438
  });
8395
8439
  };
@@ -8468,8 +8512,8 @@ class ur {
8468
8512
  { name: "url", label: "Image URL", placeholder: "https://example.com/image.png" },
8469
8513
  ...t ? [{ name: "file", label: "Or paste/drop an image into the editor", type: "text", placeholder: "Upload via paste or drag-and-drop" }] : []
8470
8514
  ],
8471
- onSubmit: (r) => {
8472
- const a = r.url ?? "";
8515
+ onSubmit: (s) => {
8516
+ const a = s.url ?? "";
8473
8517
  a && this.codeEditor.insertAtCursor(je(a, "image"));
8474
8518
  }
8475
8519
  }), this.activePopup.show();
@@ -8484,8 +8528,8 @@ class ur {
8484
8528
  { name: "alt", label: "Title", placeholder: "video title" }
8485
8529
  ],
8486
8530
  onSubmit: (i) => {
8487
- const r = i.url ?? "";
8488
- r && this.codeEditor.insertAtCursor(Oi(r, i.alt || "video"));
8531
+ const s = i.url ?? "";
8532
+ s && this.codeEditor.insertAtCursor(Oi(s, i.alt || "video"));
8489
8533
  }
8490
8534
  }), this.activePopup.show();
8491
8535
  }
@@ -8503,7 +8547,7 @@ class ur {
8503
8547
  }
8504
8548
  ],
8505
8549
  onSubmit: (i) => {
8506
- const r = i.url ?? "", a = Ci(r);
8550
+ const s = i.url ?? "", a = Ci(s);
8507
8551
  a && this.codeEditor.insertAtCursor(Mi(a));
8508
8552
  }
8509
8553
  }), this.activePopup.show();
@@ -8519,22 +8563,22 @@ class ur {
8519
8563
  ],
8520
8564
  submitLabel: "Insert",
8521
8565
  onSubmit: (i) => {
8522
- 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));
8523
- this.codeEditor.insertAtCursor(this.generateTable(r, a));
8566
+ 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));
8567
+ this.codeEditor.insertAtCursor(this.generateTable(s, a));
8524
8568
  }
8525
8569
  }), this.activePopup.show();
8526
8570
  }
8527
8571
  generateTable(e, t) {
8528
- 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(
8572
+ 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(
8529
8573
  { length: a },
8530
8574
  () => "| " + Array.from({ length: t }, () => "content").join(" | ") + " |"
8531
8575
  ).join(`
8532
8576
  `);
8533
8577
  return a > 0 ? `${i}
8534
- ${r}
8535
8578
  ${s}
8536
- ` : `${i}
8537
8579
  ${r}
8580
+ ` : `${i}
8581
+ ${s}
8538
8582
  `;
8539
8583
  }
8540
8584
  showHelpPopup(e) {
@@ -8548,7 +8592,7 @@ ${r}
8548
8592
  }
8549
8593
  }), i = t.el.querySelector(".md-editor-popup-body");
8550
8594
  if (i) {
8551
- const s = [
8595
+ const r = [
8552
8596
  { label: "Task list", hint: "- [ ] checked / - [x] unchecked" },
8553
8597
  { label: "@mention", hint: "Type @ then pick a user from the dropdown" },
8554
8598
  { label: "Document link", hint: "Type / then pick a document" },
@@ -8561,15 +8605,15 @@ ${r}
8561
8605
  <span class="md-editor-help-desc">${o.description}</span>
8562
8606
  <span class="md-editor-help-keys">${Ji(o.key)}</span>
8563
8607
  </div>`
8564
- ).join("") + '</div><div class="md-editor-help-section-title">Syntax</div><div class="md-editor-help-list">' + s.map(
8608
+ ).join("") + '</div><div class="md-editor-help-section-title">Syntax</div><div class="md-editor-help-list">' + r.map(
8565
8609
  (o) => `<div class="md-editor-help-row">
8566
8610
  <span class="md-editor-help-desc">${o.label}</span>
8567
8611
  <span class="md-editor-help-syntax">${o.hint}</span>
8568
8612
  </div>`
8569
8613
  ).join("") + "</div>";
8570
8614
  }
8571
- const r = t.el.querySelector(".md-editor-popup-footer");
8572
- r && r.remove(), this.activePopup = t, this.activePopup.show();
8615
+ const s = t.el.querySelector(".md-editor-popup-footer");
8616
+ s && s.remove(), this.activePopup = t, this.activePopup.show();
8573
8617
  }
8574
8618
  // ---------- Image upload ----------
8575
8619
  async handleImageFile(e) {
@@ -8582,8 +8626,8 @@ ${r}
8582
8626
  }
8583
8627
  // ---------- Tips / callout dropdown ----------
8584
8628
  showTipsPopup(e) {
8585
- var s;
8586
- (s = this.activePopup) == null || s.destroy();
8629
+ var r;
8630
+ (r = this.activePopup) == null || r.destroy();
8587
8631
  const t = [
8588
8632
  { key: "notice", label: "Notice", color: "#0969da" },
8589
8633
  { key: "info", label: "Info", color: "#0969da" },
@@ -8597,8 +8641,8 @@ ${r}
8597
8641
  fields: [],
8598
8642
  onSubmit: () => {
8599
8643
  }
8600
- }), r = i.el.querySelector(".md-editor-popup-body");
8601
- if (r) {
8644
+ }), s = i.el.querySelector(".md-editor-popup-body");
8645
+ if (s) {
8602
8646
  const o = document.createElement("div");
8603
8647
  o.className = "md-editor-tips-grid";
8604
8648
  for (const c of t) {
@@ -8614,7 +8658,7 @@ Your ${c.key.toLowerCase()} content here.
8614
8658
  ), i.hide();
8615
8659
  }), o.appendChild(l);
8616
8660
  }
8617
- r.innerHTML = "", r.appendChild(o);
8661
+ s.innerHTML = "", s.appendChild(o);
8618
8662
  }
8619
8663
  const a = i.el.querySelector(".md-editor-popup-footer");
8620
8664
  a && a.remove(), this.activePopup = i, this.activePopup.show();
@@ -8624,21 +8668,21 @@ Your ${c.key.toLowerCase()} content here.
8624
8668
  this.previewPane && this.previewPane.addEventListener("click", (e) => {
8625
8669
  const t = e.target.closest(".md-editor-codeblock-copy");
8626
8670
  if (!t) return;
8627
- const i = t.closest(".md-editor-codeblock"), r = i == null ? void 0 : i.querySelector("code");
8628
- if (!r) return;
8629
- const a = r.textContent ?? "";
8671
+ const i = t.closest(".md-editor-codeblock"), s = i == null ? void 0 : i.querySelector("code");
8672
+ if (!s) return;
8673
+ const a = s.textContent ?? "";
8630
8674
  this.copyToClipboard(a, t);
8631
8675
  });
8632
8676
  }
8633
8677
  copyToClipboard(e, t) {
8634
- var r;
8678
+ var s;
8635
8679
  const i = () => {
8636
8680
  const a = t.textContent;
8637
8681
  t.textContent = "Copied!", t.classList.add("is-copied"), window.setTimeout(() => {
8638
8682
  t.textContent = a, t.classList.remove("is-copied");
8639
8683
  }, 2e3);
8640
8684
  };
8641
- (r = navigator.clipboard) != null && r.writeText ? navigator.clipboard.writeText(e).then(i).catch(() => {
8685
+ (s = navigator.clipboard) != null && s.writeText ? navigator.clipboard.writeText(e).then(i).catch(() => {
8642
8686
  this.fallbackCopy(e, i);
8643
8687
  }) : this.fallbackCopy(e, i);
8644
8688
  }
@@ -8646,19 +8690,19 @@ Your ${c.key.toLowerCase()} content here.
8646
8690
  try {
8647
8691
  const i = document.createElement("textarea");
8648
8692
  i.value = e, i.style.position = "fixed", i.style.opacity = "0", document.body.appendChild(i), i.select();
8649
- const r = document.execCommand("copy");
8650
- document.body.removeChild(i), r && t();
8693
+ const s = document.execCommand("copy");
8694
+ document.body.removeChild(i), s && t();
8651
8695
  } catch {
8652
8696
  }
8653
8697
  }
8654
8698
  // ---------- Snippets ----------
8655
8699
  insertSnippet(e) {
8656
- const [t, i, r] = nt[e];
8657
- this.codeEditor.insertAtCursor(`${t}${r}${i}`);
8700
+ const [t, i, s] = nt[e];
8701
+ this.codeEditor.insertAtCursor(`${t}${s}${i}`);
8658
8702
  }
8659
8703
  wrapSnippet(e) {
8660
- const [t, i, r] = nt[e];
8661
- this.codeEditor.wrapSelection(t, i, r);
8704
+ const [t, i, s] = nt[e];
8705
+ this.codeEditor.wrapSelection(t, i, s);
8662
8706
  }
8663
8707
  togglePreview() {
8664
8708
  var t;
@@ -8668,22 +8712,22 @@ Your ${c.key.toLowerCase()} content here.
8668
8712
  }
8669
8713
  // ---------- Render scheduling (performance core) ----------
8670
8714
  requestPreviewRender(e) {
8671
- var i, r;
8715
+ var i, s;
8672
8716
  const t = this.renderDebounceOpt === !1 ? 0 : this.renderDebounceOpt ?? Xi(e.length);
8673
8717
  if (t === 0) {
8674
8718
  (i = this.scheduledRender) == null || i.cancel(), this.scheduledRender = null, this.renderPreview(e);
8675
8719
  return;
8676
8720
  }
8677
- (!this.scheduledRender || this.scheduledWait !== t) && ((r = this.scheduledRender) == null || r.cancel(), this.scheduledRender = Vi((a) => this.renderPreview(a), t), this.scheduledWait = t), this.scheduledRender(e);
8721
+ (!this.scheduledRender || this.scheduledWait !== t) && ((s = this.scheduledRender) == null || s.cancel(), this.scheduledRender = Vi((a) => this.renderPreview(a), t), this.scheduledWait = t), this.scheduledRender(e);
8678
8722
  }
8679
8723
  renderPreview(e) {
8680
8724
  if (!this.previewPane || !this.incremental) return;
8681
8725
  const { totalCount: t } = this.incremental.update(e);
8682
8726
  if (this.renderer.hydrate(this.previewPane), this.statusBar) {
8683
- const { charCount: i, wordCount: r } = tt(e);
8727
+ const { charCount: i, wordCount: s } = tt(e);
8684
8728
  this.statusBar.update({
8685
8729
  charCount: i,
8686
- wordCount: r,
8730
+ wordCount: s,
8687
8731
  blockCount: t,
8688
8732
  mode: this.mode,
8689
8733
  autoPreview: this.autoPreview
@@ -8691,13 +8735,13 @@ Your ${c.key.toLowerCase()} content here.
8691
8735
  }
8692
8736
  }
8693
8737
  updateStatusBar(e) {
8694
- var r;
8738
+ var s;
8695
8739
  if (!this.statusBar) return;
8696
8740
  const { charCount: t, wordCount: i } = tt(e);
8697
8741
  this.statusBar.update({
8698
8742
  charCount: t,
8699
8743
  wordCount: i,
8700
- blockCount: ((r = this.incremental) == null ? void 0 : r.getBlockCount()) ?? 0,
8744
+ blockCount: ((s = this.incremental) == null ? void 0 : s.getBlockCount()) ?? 0,
8701
8745
  mode: this.mode,
8702
8746
  autoPreview: this.autoPreview
8703
8747
  });
@@ -8721,8 +8765,8 @@ Your ${c.key.toLowerCase()} content here.
8721
8765
  this.autoPreview = e, e && this.renderPreview(this.codeEditor.getValue()), this.updateStatusBar(this.codeEditor.getValue());
8722
8766
  }
8723
8767
  setMode(e) {
8724
- var t, i, r;
8725
- 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())));
8768
+ var t, i, s;
8769
+ 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())));
8726
8770
  }
8727
8771
  setTheme(e) {
8728
8772
  var t;
@@ -8732,32 +8776,32 @@ Your ${c.key.toLowerCase()} content here.
8732
8776
  this.codeEditor.focus();
8733
8777
  }
8734
8778
  destroy() {
8735
- var e, t, i, r, a;
8736
- (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");
8779
+ var e, t, i, s, a;
8780
+ (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");
8737
8781
  }
8738
8782
  }
8739
8783
  export {
8740
8784
  tn as CodeEditor,
8741
8785
  Qi as DEFAULT_SHORTCUTS,
8742
8786
  Zi as IncrementalRenderer,
8743
- ur as MarkdownEditor,
8787
+ us as MarkdownEditor,
8744
8788
  ie as Popup,
8745
8789
  It as Renderer,
8746
8790
  zi as StatusBar,
8747
8791
  Fi as Toolbar,
8748
8792
  Xi as adaptiveDebounceMs,
8749
- cr as cancelIdle,
8793
+ cs as cancelIdle,
8750
8794
  tt as countText,
8751
8795
  Vi as debounce,
8752
8796
  Ci as extractYouTubeId,
8753
- dr as formatShortcut,
8797
+ ds as formatShortcut,
8754
8798
  Ji as formatShortcutHtml,
8755
8799
  R as icons,
8756
8800
  je as imageMarkdown,
8757
8801
  Ri as isVideoFile,
8758
- lr as matchShortcut,
8759
- or as renderMarkdown,
8760
- ar as scheduleIdle,
8802
+ ls as matchShortcut,
8803
+ os as renderMarkdown,
8804
+ as as scheduleIdle,
8761
8805
  Yi as splitIntoBlocks,
8762
8806
  Oi as videoMarkdown,
8763
8807
  Mi as youTubeEmbedMarkdown