autumnnote 2.2.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -141,7 +141,7 @@ function me(e, t) {
141
141
  };
142
142
  return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
143
143
  }
144
- function he(e, t) {
144
+ function D(e, t) {
145
145
  e.style.cursor = "grab";
146
146
  let n = (n) => {
147
147
  if (n.button !== 0 || n.target.closest("button, input, select, textarea, a")) return;
@@ -163,7 +163,7 @@ function he(e, t) {
163
163
  }
164
164
  //#endregion
165
165
  //#region src/js/core/range.js
166
- var ge = class {
166
+ var he = class {
167
167
  constructor(e, t, n, r) {
168
168
  this.sc = e, this.so = t, this.ec = n, this.eo = r;
169
169
  }
@@ -199,44 +199,44 @@ var ge = class {
199
199
  this.toNativeRange().insertNode(e);
200
200
  }
201
201
  };
202
- function _e(e) {
203
- return new ge(e.startContainer, e.startOffset, e.endContainer, e.endOffset);
202
+ function ge(e) {
203
+ return new he(e.startContainer, e.startOffset, e.endContainer, e.endOffset);
204
204
  }
205
- function ve(e) {
205
+ function _e(e) {
206
206
  let t = globalThis.getSelection();
207
207
  if (!t || t.rangeCount === 0) return null;
208
208
  let n = t.getRangeAt(0);
209
- return e && !e.contains(n.commonAncestorContainer) ? null : _e(n);
209
+ return e && !e.contains(n.commonAncestorContainer) ? null : ge(n);
210
210
  }
211
- function ye(e) {
212
- return new ge(e, 0, e, e.childNodes.length);
211
+ function ve(e) {
212
+ return new he(e, 0, e, e.childNodes.length);
213
213
  }
214
- function be(e, t = 0) {
215
- return new ge(e, t, e, t);
214
+ function ye(e, t = 0) {
215
+ return new he(e, t, e, t);
216
216
  }
217
- function xe(e) {
217
+ function be(e) {
218
218
  let t = globalThis.getSelection();
219
219
  return !t || t.rangeCount === 0 ? !1 : e.contains(t.getRangeAt(0).commonAncestorContainer);
220
220
  }
221
- function Se(e) {
221
+ function xe(e) {
222
222
  let t = globalThis.getSelection();
223
223
  if (!t || t.rangeCount === 0) {
224
224
  e(null);
225
225
  return;
226
226
  }
227
227
  let n = t.getRangeAt(0).cloneRange();
228
- e(_e(n)), t.removeAllRanges(), t.addRange(n);
228
+ e(ge(n)), t.removeAllRanges(), t.addRange(n);
229
229
  }
230
- function Ce(e, t) {
230
+ function Se(e, t) {
231
231
  return [e, e.splitText(t)];
232
232
  }
233
233
  //#endregion
234
234
  //#region src/js/editing/Style.js
235
- function D(e, t = null) {
235
+ function O(e, t = null) {
236
236
  return document.execCommand(e, !1, t);
237
237
  }
238
- var we = () => D("bold"), Te = () => D("italic");
239
- function Ee() {
238
+ var Ce = () => O("bold"), we = () => O("italic");
239
+ function Te() {
240
240
  let e = globalThis.getSelection();
241
241
  if (!e?.rangeCount) return;
242
242
  let t = e.getRangeAt(0).commonAncestorContainer;
@@ -248,9 +248,9 @@ function Ee() {
248
248
  n.remove();
249
249
  return;
250
250
  }
251
- D("underline");
251
+ O("underline");
252
252
  }
253
- function De() {
253
+ function Ee() {
254
254
  let e = globalThis.getSelection();
255
255
  if (!e?.rangeCount) return;
256
256
  let t = e.getRangeAt(0).startContainer;
@@ -262,10 +262,10 @@ function De() {
262
262
  n.remove();
263
263
  return;
264
264
  }
265
- D("strikeThrough");
265
+ O("strikeThrough");
266
266
  }
267
- var Oe = () => D("superscript"), ke = () => D("subscript"), Ae = (e) => D("foreColor", e), je = (e) => D("hiliteColor", e), Me = (e) => D("fontName", e);
268
- function Ne(e, t = document) {
267
+ var De = () => O("superscript"), Oe = () => O("subscript"), ke = (e) => O("foreColor", e), Ae = (e) => O("hiliteColor", e), je = (e) => O("fontName", e);
268
+ function Me(e, t = document) {
269
269
  let n = globalThis.getSelection(), r = !n?.rangeCount || n.getRangeAt(0).collapsed;
270
270
  if (r && n?.rangeCount > 0) {
271
271
  try {
@@ -278,7 +278,7 @@ function Ne(e, t = document) {
278
278
  } catch {}
279
279
  return;
280
280
  }
281
- D("fontSize", "7");
281
+ O("fontSize", "7");
282
282
  let i = t instanceof HTMLElement ? t : document, a = [];
283
283
  if (i.querySelectorAll("font[size=\"7\"]").forEach((t) => {
284
284
  let n = document.createElement("span");
@@ -292,21 +292,21 @@ function Ne(e, t = document) {
292
292
  } catch {}
293
293
  }
294
294
  }
295
- var Pe = (e) => D("formatBlock", `<${e}>`), Fe = () => D("justifyLeft"), Ie = () => D("justifyCenter"), Le = () => D("justifyRight"), Re = () => D("justifyFull"), ze = () => D("indent");
296
- function Be() {
295
+ var Ne = (e) => O("formatBlock", `<${e}>`), Pe = () => O("justifyLeft"), Fe = () => O("justifyCenter"), Ie = () => O("justifyRight"), Le = () => O("justifyFull"), Re = () => O("indent");
296
+ function ze() {
297
297
  let e = globalThis.getSelection();
298
298
  if (e?.rangeCount) {
299
299
  let t = e.getRangeAt(0).commonAncestorContainer;
300
300
  t.nodeType === 3 && (t = t.parentElement);
301
301
  let n = t?.closest(".an-checklist li");
302
302
  if (n) {
303
- Ve(n);
303
+ Be(n);
304
304
  return;
305
305
  }
306
306
  }
307
- D("outdent");
307
+ O("outdent");
308
308
  }
309
- function Ve(e) {
309
+ function Be(e) {
310
310
  let t = e.closest(".an-checklist");
311
311
  if (!t) return;
312
312
  let n = Array.from(t.children), r = n.indexOf(e), i = n.slice(r + 1), a = document.createElement("p");
@@ -323,24 +323,24 @@ function Ve(e) {
323
323
  n && (n.removeAllRanges(), n.addRange(e));
324
324
  } catch {}
325
325
  }
326
- function He() {
326
+ function Ve() {
327
327
  let e = globalThis.getSelection();
328
328
  if (!e?.rangeCount) return null;
329
329
  let t = e.getRangeAt(0).commonAncestorContainer;
330
330
  return t.nodeType === 3 && (t = t.parentElement), t?.closest("ul, ol") || null;
331
331
  }
332
- function Ue(e) {
332
+ function He(e) {
333
333
  e.classList.remove("an-checklist"), e.querySelectorAll("input[type=\"checkbox\"]").forEach((e) => e.remove());
334
334
  }
335
- function We() {
336
- let e = He();
337
- e ? e.classList.contains("an-checklist") ? (Ue(e), e.tagName === "OL" && O(e, "ul")) : e.tagName === "OL" ? O(e, "ul") : D("insertUnorderedList") : D("insertUnorderedList");
335
+ function Ue() {
336
+ let e = Ve();
337
+ e ? e.classList.contains("an-checklist") ? (He(e), e.tagName === "OL" && Je(e, "ul")) : e.tagName === "OL" ? Je(e, "ul") : O("insertUnorderedList") : O("insertUnorderedList");
338
338
  }
339
- function Ge() {
340
- let e = He();
341
- e ? e.classList.contains("an-checklist") ? (Ue(e), O(e, "ol")) : e.tagName === "UL" ? O(e, "ol") : D("insertOrderedList") : D("insertOrderedList");
339
+ function We() {
340
+ let e = Ve();
341
+ e ? e.classList.contains("an-checklist") ? (He(e), Je(e, "ol")) : e.tagName === "UL" ? Je(e, "ol") : O("insertOrderedList") : O("insertOrderedList");
342
342
  }
343
- function Ke(e) {
343
+ function Ge(e) {
344
344
  let t = globalThis.getSelection();
345
345
  if (!t || t.rangeCount === 0) return;
346
346
  let n = t.getRangeAt(0), r = /* @__PURE__ */ new Set([
@@ -383,7 +383,7 @@ function Ke(e) {
383
383
  t.style.lineHeight = e;
384
384
  });
385
385
  }
386
- function qe(e) {
386
+ function Ke(e) {
387
387
  let t = globalThis.getSelection();
388
388
  if (!t?.rangeCount) return;
389
389
  let n = t.getRangeAt(0), r = n.commonAncestorContainer;
@@ -415,7 +415,7 @@ function qe(e) {
415
415
  }
416
416
  }
417
417
  }
418
- function Je() {
418
+ function qe() {
419
419
  let e = globalThis.getSelection();
420
420
  if (!e?.rangeCount) return !1;
421
421
  let t = e.getRangeAt(0).startContainer;
@@ -423,7 +423,7 @@ function Je() {
423
423
  let n = t?.closest("code");
424
424
  return !!(n && !n.closest("pre"));
425
425
  }
426
- function O(e, t) {
426
+ function Je(e, t) {
427
427
  let n = document.createElement(t);
428
428
  for (let t of e.attributes) n.setAttribute(t.name, t.value);
429
429
  for (; e.firstChild;) n.appendChild(e.firstChild);
@@ -456,7 +456,7 @@ function Xe() {
456
456
  }
457
457
  }
458
458
  } else {
459
- let t = O(r, "ul");
459
+ let t = Je(r, "ul");
460
460
  t.classList.add("an-checklist"), Ye(t);
461
461
  let n = t.querySelector("li");
462
462
  if (n) {
@@ -559,13 +559,13 @@ function $e(e) {
559
559
  function et(e) {
560
560
  return Qe.get(e);
561
561
  }
562
- var tt = k("bold", "bold", "Bold (Ctrl+B)", () => we(), () => document.queryCommandState("bold")), nt = k("italic", "italic", "Italic (Ctrl+I)", () => Te(), () => document.queryCommandState("italic")), rt = k("underline", "underline", "Underline (Ctrl+U)", () => Ee(), () => {
562
+ var tt = k("bold", "bold", "Bold (Ctrl+B)", () => Ce(), () => document.queryCommandState("bold")), nt = k("italic", "italic", "Italic (Ctrl+I)", () => we(), () => document.queryCommandState("italic")), rt = k("underline", "underline", "Underline (Ctrl+U)", () => Te(), () => {
563
563
  if (document.queryCommandState("underline")) return !0;
564
564
  let e = globalThis.getSelection();
565
565
  if (!e?.rangeCount) return !1;
566
566
  let t = e.getRangeAt(0).startContainer;
567
567
  return t.nodeType === 3 && (t = t.parentElement), !!t?.closest("u");
568
- }), it = k("strikethrough", "strikethrough", "Strikethrough", () => De(), () => document.queryCommandState("strikeThrough")), at = k("superscript", "superscript", "Superscript", () => Oe(), () => document.queryCommandState("superscript")), ot = k("subscript", "subscript", "Subscript", () => ke(), () => document.queryCommandState("subscript")), st = k("alignLeft", "align-left", "Align Left", () => Fe()), ct = k("alignCenter", "align-center", "Align Center", () => Ie()), lt = k("alignRight", "align-right", "Align Right", () => Le()), ut = k("alignJustify", "align-justify", "Justify", () => Re()), dt = k("ul", "list-ul", "Unordered List", () => We()), ft = k("ol", "list-ol", "Ordered List", () => Ge()), pt = k("indent", "indent", "Indent", () => ze()), mt = k("outdent", "outdent", "Outdent", () => Be()), ht = k("undo", "undo", "Undo (Ctrl+Z)", (e) => e.invoke("editor.undo"), void 0, (e) => !e.invoke("editor.canUndo")), gt = k("redo", "redo", "Redo (Ctrl+Y)", (e) => e.invoke("editor.redo"), void 0, (e) => !e.invoke("editor.canRedo")), _t = k("hr", "minus", "Horizontal Rule", () => D("insertHorizontalRule")), vt = k("link", "link", "Insert Link", (e) => e.invoke("linkDialog.show")), yt = k("image", "image", "Insert Image", (e) => e.invoke("imageDialog.show")), bt = k("video", "video", "Insert Video", (e) => e.invoke("videoDialog.show")), xt = k("emoji", "emoji", "Insert Emoji", (e) => e.invoke("emojiDialog.show")), St = k("icon", "icon", "Insert FA Icon", (e) => e.invoke("iconDialog.show")), Ct = {
568
+ }), it = k("strikethrough", "strikethrough", "Strikethrough", () => Ee(), () => document.queryCommandState("strikeThrough")), at = k("superscript", "superscript", "Superscript", () => De(), () => document.queryCommandState("superscript")), ot = k("subscript", "subscript", "Subscript", () => Oe(), () => document.queryCommandState("subscript")), st = k("alignLeft", "align-left", "Align Left", () => Pe()), ct = k("alignCenter", "align-center", "Align Center", () => Fe()), lt = k("alignRight", "align-right", "Align Right", () => Ie()), ut = k("alignJustify", "align-justify", "Justify", () => Le()), dt = k("ul", "list-ul", "Unordered List", () => Ue()), ft = k("ol", "list-ol", "Ordered List", () => We()), pt = k("indent", "indent", "Indent", () => Re()), mt = k("outdent", "outdent", "Outdent", () => ze()), ht = k("undo", "undo", "Undo (Ctrl+Z)", (e) => e.invoke("editor.undo"), void 0, (e) => !e.invoke("editor.canUndo")), gt = k("redo", "redo", "Redo (Ctrl+Y)", (e) => e.invoke("editor.redo"), void 0, (e) => !e.invoke("editor.canRedo")), _t = k("hr", "minus", "Horizontal Rule", () => O("insertHorizontalRule")), vt = k("link", "link", "Insert Link", (e) => e.invoke("linkDialog.show")), yt = k("image", "image", "Insert Image", (e) => e.invoke("imageDialog.show")), bt = k("video", "video", "Insert Video", (e) => e.invoke("videoDialog.show")), xt = k("emoji", "emoji", "Insert Emoji", (e) => e.invoke("emojiDialog.show")), St = k("icon", "icon", "Insert FA Icon", (e) => e.invoke("iconDialog.show")), Ct = {
569
569
  name: "table",
570
570
  type: "grid",
571
571
  icon: "table",
@@ -596,7 +596,7 @@ var tt = k("bold", "bold", "Bold (Ctrl+B)", () => we(), () => document.queryComm
596
596
  "48px",
597
597
  "72px"
598
598
  ],
599
- action: (e, t) => Ne(t, e.layoutInfo.editable),
599
+ action: (e, t) => Me(t, e.layoutInfo.editable),
600
600
  getValue: (e) => {
601
601
  try {
602
602
  let t = globalThis.getSelection();
@@ -612,14 +612,14 @@ var tt = k("bold", "bold", "Bold (Ctrl+B)", () => we(), () => document.queryComm
612
612
  return "";
613
613
  }
614
614
  }
615
- }, Tt = k("removeFormat", "remove-format", "Remove Format", () => D("removeFormat")), Et = k("direction", "direction", "Toggle Text Direction (LTR / RTL)", (e) => {
615
+ }, Tt = k("removeFormat", "remove-format", "Remove Format", () => O("removeFormat")), Et = k("direction", "direction", "Toggle Text Direction (LTR / RTL)", (e) => {
616
616
  let t = e.layoutInfo.editable, n = (t.getAttribute("dir") || "ltr") === "ltr" ? "rtl" : "ltr";
617
617
  t.setAttribute("dir", n), t.style.textAlign = n === "rtl" ? "right" : "left", e.invoke("editor.afterCommand");
618
618
  }), Dt = {
619
619
  name: "fontFamily",
620
620
  type: "select",
621
621
  tooltip: "Font Family",
622
- action: (e, t) => Me(t),
622
+ action: (e, t) => je(t),
623
623
  getValue: () => {
624
624
  try {
625
625
  return document.queryCommandValue("fontName") || "";
@@ -671,7 +671,7 @@ var tt = k("bold", "bold", "Bold (Ctrl+B)", () => we(), () => document.queryComm
671
671
  label: "Code"
672
672
  }
673
673
  ],
674
- action: (e, t) => Pe(t),
674
+ action: (e, t) => Ne(t),
675
675
  getValue: () => {
676
676
  try {
677
677
  let e = document.queryCommandValue("formatBlock").toLowerCase().replace(/[<>]/g, "");
@@ -695,7 +695,7 @@ var tt = k("bold", "bold", "Bold (Ctrl+B)", () => we(), () => document.queryComm
695
695
  "2.5",
696
696
  "3.0"
697
697
  ],
698
- action: (e, t) => Ke(t),
698
+ action: (e, t) => Ge(t),
699
699
  getValue: () => {
700
700
  try {
701
701
  let e = globalThis.getSelection();
@@ -721,20 +721,20 @@ var tt = k("bold", "bold", "Bold (Ctrl+B)", () => we(), () => document.queryComm
721
721
  return "";
722
722
  }
723
723
  }
724
- }, At = k("codeview", "code", "HTML Code View", (e) => e.invoke("codeview.toggle"), (e) => e.invoke("codeview.isActive")), jt = k("fullscreen", "expand", "Fullscreen", (e) => e.invoke("fullscreen.toggle"), (e) => e.invoke("fullscreen.isActive")), Mt = k("shortcuts", "keyboard", "Keyboard Shortcuts (Ctrl+Shift+/)", (e) => e.invoke("shortcutsDialog.show")), Nt = k("find", "search", "Find (Ctrl+F)", (e) => e.invoke("findReplace.show", "find")), Pt = k("findReplace", "find-replace", "Find & Replace (Ctrl+H)", (e) => e.invoke("findReplace.show", "replace")), Ft = k("inlineCode", "inline-code", "Inline Code (Ctrl+`)", (e) => e.invoke("editor.inlineCode"), () => Je()), It = k("checklist", "checklist", "Checklist", (e) => e.invoke("editor.toggleChecklist"), () => Ze()), Lt = k("print", "print", "Print", (e) => e.invoke("editor.print")), Rt = {
724
+ }, At = k("codeview", "code", "HTML Code View", (e) => e.invoke("codeview.toggle"), (e) => e.invoke("codeview.isActive")), jt = k("fullscreen", "expand", "Fullscreen", (e) => e.invoke("fullscreen.toggle"), (e) => e.invoke("fullscreen.isActive")), Mt = k("shortcuts", "keyboard", "Keyboard Shortcuts (Ctrl+Shift+/)", (e) => e.invoke("shortcutsDialog.show")), Nt = k("find", "search", "Find (Ctrl+F)", (e) => e.invoke("findReplace.show", "find")), Pt = k("findReplace", "find-replace", "Find & Replace (Ctrl+H)", (e) => e.invoke("findReplace.show", "replace")), Ft = k("inlineCode", "inline-code", "Inline Code (Ctrl+`)", (e) => e.invoke("editor.inlineCode"), () => qe()), It = k("checklist", "checklist", "Checklist", (e) => e.invoke("editor.toggleChecklist"), () => Ze()), Lt = k("print", "print", "Print", (e) => e.invoke("editor.print")), Rt = {
725
725
  name: "foreColor",
726
726
  type: "colorpicker",
727
727
  icon: "foreColor",
728
728
  tooltip: "Text Color",
729
729
  defaultColor: "#e11d48",
730
- action: (e, t) => Ae(t)
730
+ action: (e, t) => ke(t)
731
731
  }, zt = {
732
732
  name: "backColor",
733
733
  type: "colorpicker",
734
734
  icon: "backColor",
735
735
  tooltip: "Highlight Color",
736
736
  defaultColor: "#fbbf24",
737
- action: (e, t) => je(t)
737
+ action: (e, t) => Ae(t)
738
738
  }, Bt = [
739
739
  [
740
740
  Ot,
@@ -1405,7 +1405,7 @@ function M(e, { allowIframes: t = !1 } = {}) {
1405
1405
  "AUDIO",
1406
1406
  "SOURCE"
1407
1407
  ].includes(e.tagName), i = e.tagName === "IMG";
1408
- if (!(t.name === "srcset" ? an(n, { allowData: i }) : sn(n, {
1408
+ if (!(t.name === "srcset" ? an(n, { allowData: i }) : cn(n, {
1409
1409
  media: r,
1410
1410
  allowData: i
1411
1411
  }))) {
@@ -1445,7 +1445,7 @@ function an(e, { allowData: t = !1 } = {}) {
1445
1445
  for (let e of n) {
1446
1446
  if (/^[\d.]+[xw],?$/i.test(e)) continue;
1447
1447
  let n = e.replace(/,+$/, "");
1448
- if (n && !sn(n, {
1448
+ if (n && !cn(n, {
1449
1449
  media: !0,
1450
1450
  allowData: t
1451
1451
  })) return !1;
@@ -1462,14 +1462,14 @@ function on(e) {
1462
1462
  return !1;
1463
1463
  }
1464
1464
  }
1465
- function N(e, { allowData: t = !1, media: n = t } = {}) {
1465
+ function sn(e, { allowData: t = !1, media: n = t } = {}) {
1466
1466
  let r = (e || "").trim();
1467
- return !r && e == null ? null : sn(r, {
1467
+ return !r && e == null ? null : cn(r, {
1468
1468
  media: n,
1469
1469
  allowData: t
1470
1470
  }) ? e : null;
1471
1471
  }
1472
- function sn(e, { media: t = !1, allowData: n = !1 } = {}) {
1472
+ function cn(e, { media: t = !1, allowData: n = !1 } = {}) {
1473
1473
  let r = (e || "").trim();
1474
1474
  if (!r || n && tn.test(r)) return !0;
1475
1475
  try {
@@ -1481,7 +1481,7 @@ function sn(e, { media: t = !1, allowData: n = !1 } = {}) {
1481
1481
  }
1482
1482
  //#endregion
1483
1483
  //#region src/js/renderer.js
1484
- function cn(e, t) {
1484
+ function ln(e, t) {
1485
1485
  let n = w("div", { class: "an-container" }), r = w("div", {
1486
1486
  class: "an-editable",
1487
1487
  contenteditable: t.readOnly ? "false" : "true",
@@ -1504,7 +1504,7 @@ function cn(e, t) {
1504
1504
  }
1505
1505
  //#endregion
1506
1506
  //#region src/js/editing/History.js
1507
- var ln = class {
1507
+ var un = class {
1508
1508
  constructor(e, t = 100, n = 10 * 1024 * 1024) {
1509
1509
  this.editable = e, this._limit = t, this._maxBytes = n, this._bytes = 0, this.stack = [], this.stackOffset = -1, this._savePoint();
1510
1510
  }
@@ -1625,7 +1625,7 @@ var ln = class {
1625
1625
  };
1626
1626
  //#endregion
1627
1627
  //#region src/js/editing/Table.js
1628
- function un(e, t, n = {}) {
1628
+ function dn(e, t, n = {}) {
1629
1629
  let { headerRow: r = !1 } = n, i = w("table", { class: "an-table" });
1630
1630
  if (r && t > 0) {
1631
1631
  let t = w("thead"), n = w("tr");
@@ -1647,9 +1647,9 @@ function un(e, t, n = {}) {
1647
1647
  }
1648
1648
  return i;
1649
1649
  }
1650
- function dn(e, t, n = {}) {
1650
+ function fn(e, t, n = {}) {
1651
1651
  if (e <= 0 || t <= 0) return;
1652
- let r = un(e, t, n), i = globalThis.getSelection();
1652
+ let r = dn(e, t, n), i = globalThis.getSelection();
1653
1653
  if (!i || i.rangeCount === 0) return;
1654
1654
  let a = i.getRangeAt(0);
1655
1655
  try {
@@ -1690,7 +1690,7 @@ function dn(e, t, n = {}) {
1690
1690
  }
1691
1691
  //#endregion
1692
1692
  //#region src/js/core/key.js
1693
- var P = {
1693
+ var N = {
1694
1694
  BACKSPACE: "Backspace",
1695
1695
  TAB: "Tab",
1696
1696
  ENTER: "Enter",
@@ -1729,16 +1729,16 @@ var P = {
1729
1729
  SLASH: "/",
1730
1730
  PERIOD: "."
1731
1731
  };
1732
- function F(e, t) {
1732
+ function P(e, t) {
1733
1733
  return e.key === t || e.key === t.toUpperCase();
1734
1734
  }
1735
- function I(e, t) {
1736
- return (e.ctrlKey || e.metaKey) && F(e, t);
1735
+ function F(e, t) {
1736
+ return (e.ctrlKey || e.metaKey) && P(e, t);
1737
1737
  }
1738
1738
  //#endregion
1739
1739
  //#region src/js/editing/Typing.js
1740
- var fn = /\bfa-/, L = (e) => !!(e?.nodeName === "I" && fn.test(e.className || "")), pn = (e) => e?.nodeType === Node.TEXT_NODE && (e.textContent === "​" || e.textContent === "");
1741
- function mn(e, t) {
1740
+ var pn = /\bfa-/, I = (e) => !!(e?.nodeName === "I" && pn.test(e.className || "")), mn = (e) => e?.nodeType === Node.TEXT_NODE && (e.textContent === "​" || e.textContent === "");
1741
+ function hn(e, t) {
1742
1742
  try {
1743
1743
  let n = document.createRange();
1744
1744
  return n.setStart(e.startContainer, e.startOffset), n.setEnd(t, t.childNodes.length), n.extractContents();
@@ -1746,21 +1746,21 @@ function mn(e, t) {
1746
1746
  return document.createDocumentFragment();
1747
1747
  }
1748
1748
  }
1749
- function hn(e, t, n = {}) {
1749
+ function gn(e, t, n = {}) {
1750
1750
  let r = (e) => {
1751
1751
  let t = globalThis.getSelection();
1752
1752
  if (!t) return !1;
1753
1753
  let n = document.createRange();
1754
1754
  return e(n), n.collapse(!0), t.removeAllRanges(), t.addRange(n), !0;
1755
1755
  };
1756
- if (F(e, P.BACKSPACE)) {
1756
+ if (P(e, N.BACKSPACE)) {
1757
1757
  let t = globalThis.getSelection();
1758
1758
  if (t?.rangeCount > 0) {
1759
1759
  let n = t.getRangeAt(0);
1760
1760
  if (n.collapsed && n.startContainer.nodeType === Node.TEXT_NODE) {
1761
1761
  let r = n.startContainer;
1762
- if (n.startOffset === 0 && L(r.previousSibling)) return e.preventDefault(), r.previousSibling.remove(), !0;
1763
- if (n.startOffset === 1 && r.textContent === "​" && L(r.previousSibling)) {
1762
+ if (n.startOffset === 0 && I(r.previousSibling)) return e.preventDefault(), r.previousSibling.remove(), !0;
1763
+ if (n.startOffset === 1 && r.textContent === "​" && I(r.previousSibling)) {
1764
1764
  e.preventDefault();
1765
1765
  let n = r.parentNode, i = r.previousSibling, a = i.previousSibling;
1766
1766
  i.remove(), r.remove();
@@ -1771,17 +1771,17 @@ function hn(e, t, n = {}) {
1771
1771
  }
1772
1772
  return !1;
1773
1773
  }
1774
- if (F(e, P.LEFT) || F(e, P.RIGHT)) {
1774
+ if (P(e, N.LEFT) || P(e, N.RIGHT)) {
1775
1775
  let t = globalThis.getSelection();
1776
1776
  if (!t || t.rangeCount === 0) return !1;
1777
1777
  let n = t.getRangeAt(0);
1778
1778
  if (!n.collapsed) return !1;
1779
- let i = n.startContainer, a = F(e, P.LEFT);
1779
+ let i = n.startContainer, a = P(e, N.LEFT);
1780
1780
  if (i.nodeType === Node.TEXT_NODE) {
1781
1781
  let t = i;
1782
- if (a && n.startOffset === 1 && t.textContent === "​" && L(t.previousSibling) || a && n.startOffset === 0 && L(t.previousSibling)) return e.preventDefault(), r((e) => e.setStartBefore(t.previousSibling));
1783
- if (a && n.startOffset === 0 && pn(t.previousSibling) && L(t.previousSibling.previousSibling)) return e.preventDefault(), r((e) => e.setStartBefore(t.previousSibling.previousSibling));
1784
- if (!a && n.startOffset === t.textContent.length && L(t.nextSibling)) {
1782
+ if (a && n.startOffset === 1 && t.textContent === "​" && I(t.previousSibling) || a && n.startOffset === 0 && I(t.previousSibling)) return e.preventDefault(), r((e) => e.setStartBefore(t.previousSibling));
1783
+ if (a && n.startOffset === 0 && mn(t.previousSibling) && I(t.previousSibling.previousSibling)) return e.preventDefault(), r((e) => e.setStartBefore(t.previousSibling.previousSibling));
1784
+ if (!a && n.startOffset === t.textContent.length && I(t.nextSibling)) {
1785
1785
  let n = t.nextSibling, i = n.nextSibling;
1786
1786
  if (e.preventDefault(), i?.nodeType === Node.TEXT_NODE) {
1787
1787
  let e = +!!(i.textContent || "").startsWith("​");
@@ -1789,7 +1789,7 @@ function hn(e, t, n = {}) {
1789
1789
  }
1790
1790
  return r((e) => e.setStartAfter(n));
1791
1791
  }
1792
- if (!a && n.startOffset === t.textContent.length && pn(t.nextSibling) && L(t.nextSibling.nextSibling)) {
1792
+ if (!a && n.startOffset === t.textContent.length && mn(t.nextSibling) && I(t.nextSibling.nextSibling)) {
1793
1793
  let n = t.nextSibling.nextSibling, i = n.nextSibling;
1794
1794
  if (e.preventDefault(), i?.nodeType === Node.TEXT_NODE) {
1795
1795
  let e = +!!(i.textContent || "").startsWith("​");
@@ -1802,12 +1802,12 @@ function hn(e, t, n = {}) {
1802
1802
  let t = i;
1803
1803
  if (a && n.startOffset > 0) {
1804
1804
  let i = t.childNodes[n.startOffset - 1];
1805
- if (L(i)) return e.preventDefault(), r((e) => e.setStartBefore(i));
1806
- if (pn(i) && L(i.previousSibling)) return e.preventDefault(), r((e) => e.setStartBefore(i.previousSibling));
1805
+ if (I(i)) return e.preventDefault(), r((e) => e.setStartBefore(i));
1806
+ if (mn(i) && I(i.previousSibling)) return e.preventDefault(), r((e) => e.setStartBefore(i.previousSibling));
1807
1807
  }
1808
1808
  if (!a && n.startOffset < t.childNodes.length) {
1809
1809
  let i = t.childNodes[n.startOffset];
1810
- if (L(i)) {
1810
+ if (I(i)) {
1811
1811
  let t = i.nextSibling;
1812
1812
  if (e.preventDefault(), t?.nodeType === Node.TEXT_NODE) {
1813
1813
  let e = +!!(t.textContent || "").startsWith("​");
@@ -1815,7 +1815,7 @@ function hn(e, t, n = {}) {
1815
1815
  }
1816
1816
  return r((e) => e.setStartAfter(i));
1817
1817
  }
1818
- if (pn(i) && L(i.nextSibling)) {
1818
+ if (mn(i) && I(i.nextSibling)) {
1819
1819
  let t = i.nextSibling, n = t.nextSibling;
1820
1820
  if (e.preventDefault(), n?.nodeType === Node.TEXT_NODE) {
1821
1821
  let e = +!!(n.textContent || "").startsWith("​");
@@ -1826,17 +1826,17 @@ function hn(e, t, n = {}) {
1826
1826
  }
1827
1827
  }
1828
1828
  }
1829
- if (F(e, P.TAB)) {
1830
- let r = ve(t);
1829
+ if (P(e, N.TAB)) {
1830
+ let r = _e(t);
1831
1831
  if (!r) return !1;
1832
1832
  let i = C(r.sc, t);
1833
- if (i && _(i)) return e.preventDefault(), e.shiftKey ? Be() : D("indent"), !0;
1834
- if (i?.nodeName.toUpperCase() === "PRE") return e.shiftKey ? !1 : (e.preventDefault(), D("insertText", " ".repeat(n.tabSize || 4)), !0);
1835
- if (n.tabSize) return e.shiftKey ? !1 : (e.preventDefault(), D("insertText", " ".repeat(n.tabSize)), !0);
1833
+ if (i && _(i)) return e.preventDefault(), e.shiftKey ? ze() : O("indent"), !0;
1834
+ if (i?.nodeName.toUpperCase() === "PRE") return e.shiftKey ? !1 : (e.preventDefault(), O("insertText", " ".repeat(n.tabSize || 4)), !0);
1835
+ if (n.tabSize) return e.shiftKey ? !1 : (e.preventDefault(), O("insertText", " ".repeat(n.tabSize)), !0);
1836
1836
  }
1837
- if (F(e, P.ENTER) && e.shiftKey) return e.preventDefault(), D("insertLineBreak"), !0;
1838
- if (F(e, P.ENTER) && !e.shiftKey) {
1839
- let n = ve(t);
1837
+ if (P(e, N.ENTER) && e.shiftKey) return e.preventDefault(), O("insertLineBreak"), !0;
1838
+ if (P(e, N.ENTER) && !e.shiftKey) {
1839
+ let n = _e(t);
1840
1840
  if (!n) return !1;
1841
1841
  let r = n.sc, i = r.nodeType === 3 ? r.parentElement : r;
1842
1842
  if (i?.nodeName === "I" && /\bfa-/.test(i.className || "")) {
@@ -1869,7 +1869,7 @@ function hn(e, t, n = {}) {
1869
1869
  if (r.deleteContents(), n.rangeCount === 0 || !o.isConnected) return !0;
1870
1870
  r = n.getRangeAt(0);
1871
1871
  }
1872
- let i = mn(r, o), a = document.createElement("li"), s = document.createElement("input");
1872
+ let i = hn(r, o), a = document.createElement("li"), s = document.createElement("input");
1873
1873
  s.type = "checkbox", s.setAttribute("contenteditable", "false"), a.appendChild(s), i.textContent.replace(/[\u00a0\u200B]/g, "").length > 0 && a.appendChild(i);
1874
1874
  let c = a.childNodes[1];
1875
1875
  c?.nodeType !== Node.TEXT_NODE && (c = document.createTextNode("​"), a.appendChild(c)), o.after(a);
@@ -1877,29 +1877,49 @@ function hn(e, t, n = {}) {
1877
1877
  return l.setStart(c, 0), l.collapse(!0), n.removeAllRanges(), n.addRange(l), !0;
1878
1878
  }
1879
1879
  let s = C(n.sc, t);
1880
- if (s?.nodeName.toUpperCase() === "PRE") return e.preventDefault(), D("insertText", "\n"), !0;
1880
+ if (s?.nodeName.toUpperCase() === "PRE") return e.preventDefault(), O("insertText", "\n"), !0;
1881
1881
  if (s?.nodeName.toUpperCase() === "BLOCKQUOTE") {
1882
1882
  let t = n.toNativeRange();
1883
- if (t.setEnd(s, s.childNodes.length), t.toString() === "" && n.isCollapsed()) return e.preventDefault(), D("formatBlock", "<p>"), !0;
1883
+ if (t.setEnd(s, s.childNodes.length), t.toString() === "" && n.isCollapsed()) return e.preventDefault(), O("formatBlock", "<p>"), !0;
1884
1884
  }
1885
1885
  }
1886
1886
  return !1;
1887
1887
  }
1888
1888
  //#endregion
1889
1889
  //#region src/js/core/markdown.js
1890
- function gn(e) {
1891
- return vn(new DOMParser().parseFromString(`<body>${e || ""}</body>`, "text/html").body).replace(/\n{3,}/g, "\n\n").trim();
1890
+ function _n(e) {
1891
+ return wn(new DOMParser().parseFromString(`<body>${e || ""}</body>`, "text/html").body).replace(/\n{3,}/g, "\n\n").trim();
1892
1892
  }
1893
- function _n(e, t) {
1893
+ function vn(e, t) {
1894
1894
  return Array.from(e.children).filter((e) => e.tagName === t.toUpperCase());
1895
1895
  }
1896
- function vn(e, t = 0) {
1897
- if (e.nodeType === 3) return e.textContent.replace(/\s+/g, " ");
1896
+ function yn(e) {
1897
+ return e.replaceAll("\\", "\\\\").replace(/&(?=#\d+;|#[xX][0-9a-fA-F]+;|[a-zA-Z][a-zA-Z0-9]*;)/g, "&amp;").replace(/!(?=\[)/g, String.raw`\!`).replace(/([`*[\]])/g, String.raw`\$1`).replace(/(?<!\w)_|_(?!\w)/g, String.raw`\_`).replace(/~(?=~)|(?<=~)~/g, String.raw`\~`);
1898
+ }
1899
+ function bn(e) {
1900
+ return /^\s*(?:-{2,}|={2,}|\*{3,}|_{3,}|(?:[-*_] +){2,}[-*_])\s*$/.test(e) ? e.replace(/[-=*_]/, (e) => `\\${e}`) : e.replace(/^(\s*)(#{1,6})(?=\s|$)/, (e, t, n) => `${t}\\${n}`).replace(/^(\s*)>/, (e, t) => `${t}\\>`).replace(/^(\s*)([-*+])(?=\s)/, (e, t, n) => `${t}\\${n}`).replace(/^(\s*)(\d+)([.)])(?=\s)/, (e, t, n, r) => `${t}${n}\\${r}`);
1901
+ }
1902
+ function xn(e) {
1903
+ return e.split("\n").map(bn).join("\n");
1904
+ }
1905
+ function Sn(e, t) {
1906
+ let n = " ".repeat(t + 1);
1907
+ return wn(e, t + 1).trim().split("\n").map((e, t) => t === 0 || e.trim() === "" || e.startsWith(n) ? e : n + e).join("\n");
1908
+ }
1909
+ function Cn(e, t) {
1910
+ let n = e.getAttribute(t) || "", r = /[\s()]/.test(n) ? `<${n}>` : n, i = e.getAttribute("title");
1911
+ return i ? `${r} "${i.replaceAll("\"", String.raw`\"`)}"` : r;
1912
+ }
1913
+ function wn(e, t = 0) {
1914
+ if (e.nodeType === 3) {
1915
+ let t = e.textContent.replace(/\s+/g, " ");
1916
+ return e.parentElement?.closest("pre, code") ? t : yn(t);
1917
+ }
1898
1918
  if (e.nodeType !== 1) return "";
1899
- let n = e, r = n.nodeName.toLowerCase(), i = () => Array.from(n.childNodes).map((e) => vn(e, t)).join("");
1919
+ let n = e, r = n.nodeName.toLowerCase(), i = () => Array.from(n.childNodes).map((e) => wn(e, t)).join("");
1900
1920
  switch (r) {
1901
1921
  case "p":
1902
- case "div": return `\n\n${i()}\n\n`;
1922
+ case "div": return `\n\n${xn(i())}\n\n`;
1903
1923
  case "br": return " \n";
1904
1924
  case "h1": return `\n\n# ${i()}\n\n`;
1905
1925
  case "h2": return `\n\n## ${i()}\n\n`;
@@ -1921,7 +1941,11 @@ function vn(e, t = 0) {
1921
1941
  let e = n.getAttribute("style") || "";
1922
1942
  return /\b(color|background-color|font-size)\s*:/.test(e) ? `<span style="${z(e)}">${i()}</span>` : i();
1923
1943
  }
1924
- case "code": return n.closest("pre") ? i() : `\`${i()}\``;
1944
+ case "code": {
1945
+ if (n.closest("pre")) return i();
1946
+ let e = i(), t = Math.max(0, ...Array.from(e.matchAll(/`+/g), (e) => e[0].length)), r = "`".repeat(t + 1), a = /^`|`$/.test(e) ? " " : "";
1947
+ return `${r}${a}${e}${a}${r}`;
1948
+ }
1925
1949
  case "pre": {
1926
1950
  let e = n.querySelector("code"), t = /language-(\S+)/.exec(e?.className || "");
1927
1951
  return `\n\n\`\`\`${t ? t[1] : ""}\n${(e || n).textContent || ""}\n\`\`\`\n\n`;
@@ -1930,68 +1954,113 @@ function vn(e, t = 0) {
1930
1954
  let e = i().trim().split("\n");
1931
1955
  return `\n\n${e.filter((t, n) => t.trim() !== "" || (e[n - 1] ?? "").trim() !== "").map((e) => e.trim() === "" ? ">" : `> ${e}`).join("\n")}\n\n`;
1932
1956
  }
1933
- case "a": {
1934
- let e = n.getAttribute("href") || "";
1935
- return `[${i()}](${e})`;
1936
- }
1937
- case "img": {
1938
- let e = n.getAttribute("src") || "";
1939
- return `![${n.getAttribute("alt") || ""}](${e})`;
1940
- }
1957
+ case "a": return `[${i()}](${Cn(n, "href")})`;
1958
+ case "img": return `![${yn(n.getAttribute("alt") || "")}](${Cn(n, "src")})`;
1941
1959
  case "ul": {
1942
- let e = _n(n, "li");
1960
+ let e = vn(n, "li");
1943
1961
  if (!e.length) return i();
1944
1962
  let r = " ".repeat(t), a = n.classList.contains("an-checklist"), o = e.map((e) => {
1945
- let n = _n(e, "input").find((e) => e.getAttribute("type") === "checkbox"), i = "- ";
1946
- return (a || n) && (i = n && n.checked ? "- [x] " : "- [ ] "), `${r}${i}${vn(e, t + 1).trim()}`;
1963
+ let n = vn(e, "input").find((e) => e.getAttribute("type") === "checkbox"), i = "- ";
1964
+ return (a || n) && (i = n && n.checked ? "- [x] " : "- [ ] "), `${r}${i}${Sn(e, t)}`;
1947
1965
  }).join("\n");
1948
1966
  return t === 0 ? `\n\n${o}\n\n` : `\n${o}`;
1949
1967
  }
1950
1968
  case "ol": {
1951
- let e = _n(n, "li");
1969
+ let e = vn(n, "li");
1952
1970
  if (!e.length) return i();
1953
- let r = " ".repeat(t), a = e.map((e, n) => `${r}${n + 1}. ${vn(e, t + 1).trim()}`).join("\n");
1954
- return t === 0 ? `\n\n${a}\n\n` : `\n${a}`;
1971
+ let r = " ".repeat(t), a = Number.parseInt(n.getAttribute("start") || "1", 10), o = Number.isFinite(a) ? a : 1, s = e.map((e, n) => `${r}${o + n}. ${Sn(e, t)}`).join("\n");
1972
+ return t === 0 ? `\n\n${s}\n\n` : `\n${s}`;
1955
1973
  }
1956
1974
  case "li": return i();
1957
1975
  case "hr": return "\n\n---\n\n";
1958
1976
  case "table": {
1959
1977
  let e = Array.from(n.querySelectorAll("tr"));
1960
1978
  if (!e.length) return i();
1961
- let t = !!_n(n, "thead")[0] || e[0].children.length > 0 && Array.from(e[0].children).every((e) => e.tagName === "TH"), r = e.map((e) => Array.from(e.querySelectorAll("th, td")).map((e) => e.textContent.trim().replaceAll("|", String.raw`\|`))), a = Math.max(...r.map((e) => e.length)), o = (e) => {
1979
+ let t = !!vn(n, "thead")[0] || e[0].children.length > 0 && Array.from(e[0].children).every((e) => e.tagName === "TH"), r = e.map((e) => Array.from(e.querySelectorAll("th, td")).map((e) => yn(e.textContent.trim()).replaceAll("|", String.raw`\|`))), a = Math.max(...r.map((e) => e.length)), o = (e) => {
1962
1980
  let t = [...e];
1963
1981
  for (; t.length < a;) t.push("");
1964
1982
  return t;
1965
- }, s = +!!t, c = t ? o(r[0]) : Array(a).fill(""), l = "\n\n";
1966
- l += `| ${c.join(" | ")} |\n`, l += `| ${Array(a).fill("---").join(" | ")} |\n`;
1967
- for (let e = s; e < r.length; e++) l += `| ${o(r[e]).join(" | ")} |\n`;
1968
- return l + "\n";
1983
+ }, s = +!!t, c = t ? o(r[0]) : Array(a).fill(""), l = Array.from({ length: a }, (t, n) => {
1984
+ let r = e[0]?.children[n], i = /text-align:\s*(left|center|right)/.exec(r?.getAttribute("style") || "")?.[1];
1985
+ return i === "center" ? ":---:" : i === "right" ? "---:" : i === "left" ? ":---" : "---";
1986
+ }), u = "\n\n";
1987
+ u += `| ${c.join(" | ")} |\n`, u += `| ${l.join(" | ")} |\n`;
1988
+ for (let e = s; e < r.length; e++) u += `| ${o(r[e]).join(" | ")} |\n`;
1989
+ return u + "\n";
1969
1990
  }
1970
1991
  default: return i();
1971
1992
  }
1972
1993
  }
1973
- function yn(e) {
1974
- return /^#{1,6} [^\s]|^[ \t]*[-*+] [^\s]|^[ \t]*\d+\. [^\s]|^> ?[^\s]|^```|^\*{2}[^*\n]+\*{2}/m.test(e) || /^.+\n=+\s*$/m.test(e) || /^.+\n-{2,}\s*$/m.test(e) || /^---\s*\n(?:[\s\S]*?\n)?(?:---|\.\.\.)\s*(?:\n|$)/.test(e) || /^\|.+\|[ \t]*\n\|[ \t:|-]+\|/m.test(e);
1994
+ function Tn(e) {
1995
+ return String(e ?? "").replace(/^/, "");
1996
+ }
1997
+ function En(e) {
1998
+ let t = Tn(e);
1999
+ return /^#{1,6} [^\s]|^[ \t]*[-*+] [^\s]|^[ \t]*\d+[.)] [^\s]|^> ?[^\s]|^ {0,3}(?:`{3,}|~{3,})|^\*{2}[^*\n]+\*{2}/m.test(t) || /^.+\n=+\s*$/m.test(t) || /^.+\n-{2,}\s*$/m.test(t) || /^---\s*\n(?:[\s\S]*?\n)?(?:---|\.\.\.)\s*(?:\n|$)/.test(t) || /^\|.+\|[ \t]*\n\|[ \t:|-]+\|/m.test(t) || /^[^\n|]*\|[^\n]*\n[ \t]*:?-+:?[ \t]*(?:\|[ \t]*:?-+:?[ \t]*)+$/m.test(t) || /!?\[[^\]\n]*\]\([^)\n]*\)/.test(t) && /`[^`\n]+`|\*\*[^*\n]+\*\*|^#{1,6} |^[-*+] /m.test(t);
1975
2000
  }
1976
- var bn = /^ {0,3}>( ?)(.*)$/, xn = /^ {0,3}([-*_])( *\1){2,}\s*$/, Sn = "";
1977
- function Cn(e) {
1978
- let t = e.replaceAll("\r\n", "\n").replaceAll("\r", "\n").split("\n");
1979
- t = Dn(t);
1980
- let n = On(t);
1981
- return t = n.clean, Tn = n.linkDefs, En = n.footnoteIds, wn(t);
2001
+ var Dn = /^ {0,3}>( ?)(.*)$/, On = /^(?: {4}|\t)\s*\S/, kn = /^( {0,3})(`{3,}|~{3,})[ \t]*(.*)$/;
2002
+ function An(e) {
2003
+ let t = kn.exec(e);
2004
+ if (!t) return null;
2005
+ let [, n, r, i] = t;
2006
+ return r[0] === "`" && i.includes("`") ? null : {
2007
+ marker: r[0],
2008
+ length: r.length,
2009
+ indent: n.length,
2010
+ lang: i.trim().split(/\s+/)[0] || ""
2011
+ };
1982
2012
  }
1983
- function wn(e) {
2013
+ function jn(e, t) {
2014
+ let n = 0, r = 0;
2015
+ for (; r < e.length && n < t;) {
2016
+ if (e[r] === " ") {
2017
+ n += 1, r += 1;
2018
+ continue;
2019
+ }
2020
+ if (e[r] === " ") {
2021
+ let e = 4 - n % 4;
2022
+ if (n + e > t) break;
2023
+ n += e, r += 1;
2024
+ continue;
2025
+ }
2026
+ break;
2027
+ }
2028
+ return e.slice(r);
2029
+ }
2030
+ var Mn = /^ {0,3}([-*_])( *\1){2,}\s*$/, Nn = "";
2031
+ function Pn(e) {
2032
+ let t = Tn(e).replaceAll("\r\n", "\n").replaceAll("\r", "\n").split("\n");
2033
+ t = Rn(t);
2034
+ let n = zn(t);
2035
+ return t = n.clean, In = n.linkDefs, Ln = n.footnoteIds, Fn(t);
2036
+ }
2037
+ function Fn(e) {
1984
2038
  let t = [], n = 0;
1985
2039
  for (; n < e.length;) {
1986
- let r = e[n], i = /^```(\S*)$/.exec(r);
2040
+ let r = e[n], i = An(r);
1987
2041
  if (i) {
1988
- let r = i[1], a = [];
1989
- for (n++; n < e.length && !e[n].startsWith("```");) a.push(zn(e[n])), n++;
1990
- let o = r ? ` class="language-${z(r)}"` : "";
2042
+ let r = RegExp(`^ {0,3}\\${i.marker}{${i.length},}[ \t]*$`), a = [];
2043
+ for (n++; n < e.length && !r.test(e[n]);) a.push(nr(jn(e[n], i.indent))), n++;
2044
+ let o = i.lang ? ` class="language-${z(i.lang)}"` : "";
1991
2045
  t.push(`<pre><code${o}>${a.join("\n")}</code></pre>`), n++;
1992
2046
  continue;
1993
2047
  }
1994
- if (r.trim() && !xn.test(r) && !/^#{1,6} /.test(r) && n + 1 < e.length) {
2048
+ if (On.test(r)) {
2049
+ let r = [];
2050
+ for (; n < e.length && (On.test(e[n]) || e[n].trim() === "");) {
2051
+ if (e[n].trim() === "") {
2052
+ let t = n;
2053
+ for (; t < e.length && e[t].trim() === "";) t++;
2054
+ if (t >= e.length || !On.test(e[t])) break;
2055
+ for (; n < t; n++) r.push("");
2056
+ continue;
2057
+ }
2058
+ r.push(nr(jn(e[n], 4))), n++;
2059
+ }
2060
+ t.push(`<pre><code>${r.join("\n")}</code></pre>`);
2061
+ continue;
2062
+ }
2063
+ if (r.trim() && !Mn.test(r) && !/^#{1,6} /.test(r) && n + 1 < e.length) {
1995
2064
  if (/^=+\s*$/.test(e[n + 1])) {
1996
2065
  t.push(`<h1>${R(r.trim())}</h1>`), n += 2;
1997
2066
  continue;
@@ -2001,7 +2070,7 @@ function wn(e) {
2001
2070
  continue;
2002
2071
  }
2003
2072
  }
2004
- if (xn.test(r)) {
2073
+ if (Mn.test(r)) {
2005
2074
  t.push("<hr>"), n++;
2006
2075
  continue;
2007
2076
  }
@@ -2011,19 +2080,19 @@ function wn(e) {
2011
2080
  t.push(`<h${e}>${R(r)}</h${e}>`), n++;
2012
2081
  continue;
2013
2082
  }
2014
- if (bn.test(r)) {
2083
+ if (Dn.test(r)) {
2015
2084
  let r = [];
2016
- for (; n < e.length && bn.test(e[n]);) r.push(bn.exec(e[n])[2]), n++;
2017
- t.push(`<blockquote>${wn(r)}</blockquote>`);
2085
+ for (; n < e.length && Dn.test(e[n]);) r.push(Dn.exec(e[n])[2]), n++;
2086
+ t.push(`<blockquote>${Fn(r)}</blockquote>`);
2018
2087
  continue;
2019
2088
  }
2020
2089
  if (/^[-*+] /.test(r)) {
2021
- let { html: r, endIdx: i } = jn(e, n);
2090
+ let { html: r, endIdx: i } = Un(e, n);
2022
2091
  t.push(r), n = i;
2023
2092
  continue;
2024
2093
  }
2025
- if (/^\d+\. /.test(r)) {
2026
- let { html: r, endIdx: i } = jn(e, n);
2094
+ if (/^\d+[.)] /.test(r)) {
2095
+ let { html: r, endIdx: i } = Un(e, n);
2027
2096
  t.push(r), n = i;
2028
2097
  continue;
2029
2098
  }
@@ -2031,23 +2100,23 @@ function wn(e) {
2031
2100
  n++;
2032
2101
  continue;
2033
2102
  }
2034
- if (/^\|.+\|/.test(r) && n + 1 < e.length && /^\|[\s|:-]+\|/.test(e[n + 1])) {
2035
- let i = An(r), a = An(e[n + 1]).map((e) => e.startsWith(":") && e.endsWith(":") ? "center" : e.endsWith(":") ? "right" : e.startsWith(":") ? "left" : null);
2103
+ if (Hn(e, n)) {
2104
+ let i = L(r), a = L(e[n + 1]).map((e) => e.startsWith(":") && e.endsWith(":") ? "center" : e.endsWith(":") ? "right" : e.startsWith(":") ? "left" : null);
2036
2105
  n += 2;
2037
2106
  let o = [];
2038
- for (; n < e.length && /^\|.+\|/.test(e[n]);) o.push(An(e[n])), n++;
2107
+ for (; n < e.length && e[n].trim() !== "" && Vn(e[n]) > 1;) o.push(L(e[n])), n++;
2039
2108
  let s = (e, t, n) => `<${e}${n ? ` style="text-align:${n}"` : ""}>${R(t)}</${e}>`, c = `<thead><tr>${i.map((e, t) => s("th", e, a[t])).join("")}</tr></thead>`, l = o.length ? `<tbody>${o.map((e) => `<tr>${e.map((e, t) => s("td", e, a[t])).join("")}</tr>`).join("")}</tbody>` : "";
2040
2109
  t.push(`<table>${c}${l}</table>`);
2041
2110
  continue;
2042
2111
  }
2043
2112
  let o = [];
2044
- for (; n < e.length && e[n].trim() !== "" && !/^(#{1,6} |[-*+] |\d+\. |```)/.test(e[n]) && !bn.test(e[n]) && !xn.test(e[n]) && !/^\|.+\|/.test(e[n]) && !(n + 1 < e.length && /^=+\s*$/.test(e[n + 1])) && !(n + 1 < e.length && /^-{2,}\s*$/.test(e[n + 1]));) o.push(e[n]), n++;
2045
- o.length && t.push(`<p>${R(kn(o)).replaceAll(Sn, "<br>")}</p>`);
2113
+ for (; n < e.length && e[n].trim() !== "" && !/^(#{1,6} |[-*+] |\d+[.)] )/.test(e[n]) && !An(e[n]) && !Dn.test(e[n]) && !Mn.test(e[n]) && !Hn(e, n) && !(n + 1 < e.length && /^=+\s*$/.test(e[n + 1])) && !(n + 1 < e.length && /^-{2,}\s*$/.test(e[n + 1]));) o.push(e[n]), n++;
2114
+ o.length && t.push(`<p>${R(Bn(o)).replaceAll(Nn, "<br>")}</p>`);
2046
2115
  }
2047
2116
  return t.join("");
2048
2117
  }
2049
- var Tn = /* @__PURE__ */ new Map(), En = /* @__PURE__ */ new Set();
2050
- function Dn(e) {
2118
+ var In = /* @__PURE__ */ new Map(), Ln = /* @__PURE__ */ new Set();
2119
+ function Rn(e) {
2051
2120
  if ((e[0] || "").trim() !== "---") return e;
2052
2121
  let t = -1;
2053
2122
  for (let n = 1; n < e.length; n++) {
@@ -2061,14 +2130,18 @@ function Dn(e) {
2061
2130
  let n = t + 1;
2062
2131
  return e[n] !== void 0 && e[n].trim() === "" && n++, e.slice(n);
2063
2132
  }
2064
- function On(e) {
2133
+ function zn(e) {
2065
2134
  let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = [], i = !1, a = /^\[([^\]]+)\]:\s*(\S+)(?:\s+"([^"]*)")?\s*$/, o = /^\[\^([^\]]+)\]:\s*(.+)$/;
2066
2135
  for (let s of e) {
2067
- if (/^```/.test(s)) {
2068
- i = !i, r.push(s);
2136
+ if (i) {
2137
+ /^ {0,3}(?:`{3,}|~{3,})[ \t]*$/.test(s) && (i = !1), r.push(s);
2069
2138
  continue;
2070
2139
  }
2071
- if (!i) {
2140
+ if (An(s)) {
2141
+ i = !0, r.push(s);
2142
+ continue;
2143
+ }
2144
+ {
2072
2145
  let e = o.exec(s);
2073
2146
  if (e) {
2074
2147
  n.add(e[1]);
@@ -2091,23 +2164,33 @@ function On(e) {
2091
2164
  footnoteIds: n
2092
2165
  };
2093
2166
  }
2094
- function kn(e) {
2167
+ function Bn(e) {
2095
2168
  let t = "";
2096
2169
  for (let n = 0; n < e.length; n++) {
2097
- let r = n === e.length - 1, i = e[n];
2170
+ let r = n === e.length - 1, i = e[n].replace(/^[ \t]+/, "");
2098
2171
  if (!r && /\\$/.test(i)) {
2099
- t += i.replace(/\\$/, "") + Sn;
2172
+ t += i.replace(/\\$/, "") + Nn;
2100
2173
  continue;
2101
2174
  }
2102
2175
  if (!r && / {2,}$/.test(i)) {
2103
- t += i.replace(/ {2,}$/, "") + Sn;
2176
+ t += i.replace(/ {2,}$/, "") + Nn;
2104
2177
  continue;
2105
2178
  }
2106
2179
  t += i + (r ? "" : " ");
2107
2180
  }
2108
2181
  return t;
2109
2182
  }
2110
- function An(e) {
2183
+ function Vn(e) {
2184
+ return L(e).length;
2185
+ }
2186
+ function Hn(e, t) {
2187
+ let n = e[t], r = e[t + 1];
2188
+ if (r === void 0 || !n.includes("|")) return !1;
2189
+ if (/^\|.+\|/.test(n)) return /^\|[\s|:-]+\|/.test(r);
2190
+ let i = L(r);
2191
+ return i.length < 2 || !i.every((e) => /^:?-+:?$/.test(e)) ? !1 : Vn(n) === i.length;
2192
+ }
2193
+ function L(e) {
2111
2194
  let t = e.replace(/^\|/, "").replace(/\|$/, ""), n = [], r = "";
2112
2195
  for (let e = 0; e < t.length; e++) {
2113
2196
  if (t[e] === "\\" && t[e + 1] === "|") {
@@ -2122,12 +2205,12 @@ function An(e) {
2122
2205
  }
2123
2206
  return n.push(r), n.map((e) => e.trim());
2124
2207
  }
2125
- function jn(e, t) {
2126
- let n = e[t].match(/^(\s*)/)[1].length, r = /^\s*\d+\. /.test(e[t]), i = [], a = null, o = !1, s = !1, c = t;
2208
+ function Un(e, t) {
2209
+ let n = e[t].match(/^(\s*)/)[1].length, r = /^\s*\d+[.)] /.test(e[t]), i = [], a = null, o = !1, s = !1, c = t;
2127
2210
  for (; c < e.length;) {
2128
2211
  let t = e[c];
2129
2212
  if (t.trim() === "") {
2130
- let t = e[c + 1], a = t === void 0 ? -1 : t.match(/^(\s*)/)[1].length, l = t !== void 0 && /^\s*(?:[-*+]|\d+\.) /.test(t) && /^\s*\d+\. /.test(t) === r && a === n, u = t !== void 0 && t.trim() !== "" && a > n;
2213
+ let t = e[c + 1], a = t === void 0 ? -1 : t.match(/^(\s*)/)[1].length, l = t !== void 0 && /^\s*(?:[-*+]|\d+[.)]) /.test(t) && /^\s*\d+[.)] /.test(t) === r && a === n, u = t !== void 0 && t.trim() !== "" && a > n;
2131
2214
  if (!i.length || !l && !u) break;
2132
2215
  o = !0, s = !0, c++;
2133
2216
  continue;
@@ -2135,8 +2218,8 @@ function jn(e, t) {
2135
2218
  let l = t.match(/^(\s*)/)[1].length;
2136
2219
  if (l < n) break;
2137
2220
  if (l === n) {
2138
- if (!/^\s*(?:[-*+]|\d+\.) /.test(t) || /^\s*\d+\. /.test(t) !== r) break;
2139
- let e = r ? t.replace(/^\s*\d+\. /, "") : t.replace(/^\s*[-*+] /, ""), n = !r && /^\[[ xX]\]\s+/.test(e);
2221
+ if (!/^\s*(?:[-*+]|\d+[.)]) /.test(t) || /^\s*\d+[.)] /.test(t) !== r) break;
2222
+ let e = r ? t.replace(/^\s*\d+[.)] /, "") : t.replace(/^\s*[-*+] /, ""), n = !r && /^\[[ xX]\]\s+/.test(e);
2140
2223
  if (a === null && (a = n), n !== a) break;
2141
2224
  let o = n && e[1].toLowerCase() === "x", l = n ? e.replace(/^\[[ xX]\]\s+/, "") : e;
2142
2225
  i.push({
@@ -2150,8 +2233,8 @@ function jn(e, t) {
2150
2233
  c++;
2151
2234
  continue;
2152
2235
  }
2153
- if (/^\s*(?:[-*+]|\d+\.) /.test(t)) {
2154
- let t = jn(e, c);
2236
+ if (/^\s*(?:[-*+]|\d+[.)]) /.test(t)) {
2237
+ let t = Un(e, c);
2155
2238
  i[i.length - 1].sub += t.html, c = t.endIdx, s = !1;
2156
2239
  } else if (s) i[i.length - 1].paras.push(t.trim()), s = !1, c++;
2157
2240
  else {
@@ -2160,7 +2243,7 @@ function jn(e, t) {
2160
2243
  }
2161
2244
  }
2162
2245
  }
2163
- let l = !r && a === !0, u = r ? /^\s*(\d+)\. /.exec(e[t]) : null, d = u ? Number.parseInt(u[1], 10) : 1, f = r ? d === 1 ? "<ol>" : `<ol start="${d}">` : l ? "<ul class=\"an-checklist\">" : "<ul>", p = r ? "</ol>" : "</ul>";
2246
+ let l = !r && a === !0, u = r ? /^\s*(\d+)[.)] /.exec(e[t]) : null, d = u ? Number.parseInt(u[1], 10) : 1, f = r ? d === 1 ? "<ol>" : `<ol start="${d}">` : l ? "<ul class=\"an-checklist\">" : "<ul>", p = r ? "</ol>" : "</ul>";
2164
2247
  return {
2165
2248
  html: `${f}${i.map(({ paras: e, isCB: t, checked: n, sub: r }) => {
2166
2249
  let i = t ? `<input type="checkbox" contenteditable="false"${n ? " checked" : ""}>` : "";
@@ -2169,73 +2252,679 @@ function jn(e, t) {
2169
2252
  endIdx: c
2170
2253
  };
2171
2254
  }
2172
- var Mn = /\\([*_`#[\]()>\\~|])/g, Nn = "\0";
2173
- function Pn(e) {
2255
+ var Wn = /\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g, Gn = "\0";
2256
+ function Kn(e) {
2174
2257
  let t = [];
2175
2258
  return {
2176
- text: e.replace(Mn, (e, n) => (t.push(n), `${Nn}${t.length - 1}${Nn}`)),
2259
+ text: e.replace(Wn, (e, n) => (t.push(n), `${Gn}${t.length - 1}${Gn}`)),
2177
2260
  literals: t
2178
2261
  };
2179
2262
  }
2180
- function Fn(e, t) {
2181
- return e.replace(RegExp(`${Nn}(\\d+)${Nn}`, "g"), (e, n) => zn(t[Number(n)]));
2263
+ function qn(e, t) {
2264
+ return e.replace(RegExp(`${Gn}(\\d+)${Gn}`, "g"), (e, n) => nr(t[Number(n)]));
2265
+ }
2266
+ var Jn = String.raw`(&lt;.*?&gt;(?:\s+(?:"[^"]*"|'[^']*'))?|[^)]*)`, Yn = new RegExp(String.raw`!\[([^\]]*)\]\(${Jn}\)`, "g"), Xn = new RegExp(String.raw`\[([^\]]+)\]\(${Jn}\)`, "g");
2267
+ function Zn(e) {
2268
+ let t = e.trim(), n = /^&lt;([^]*?)&gt;\s*(?:"([^"]*)"|'([^']*)')?\s*$/.exec(t);
2269
+ if (n) return {
2270
+ href: n[1],
2271
+ title: n[2] ?? n[3] ?? ""
2272
+ };
2273
+ let r = /^(\S+)\s+(?:"([^"]*)"|'([^']*)')\s*$/.exec(t);
2274
+ return r ? {
2275
+ href: r[1],
2276
+ title: r[2] ?? r[3] ?? ""
2277
+ } : {
2278
+ href: t,
2279
+ title: ""
2280
+ };
2182
2281
  }
2183
- function In(e) {
2184
- return e = e.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, (e, t, n) => `<img src="${Bn(n)}" alt="${Bn(t)}" class="an-image">`), e = e.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (e, t, n) => `<a href="${Bn(n)}">${t}</a>`), e = e.replace(/\[([^\]]+)\]\[([^\]]*)\]/g, (e, t, n) => {
2185
- let r = Tn.get(Vn(n || t).trim().toLowerCase());
2282
+ function Qn(e) {
2283
+ return e = e.replace(Yn, (e, t, n) => {
2284
+ let { href: r, title: i } = Zn(n), a = i ? ` title="${B(i)}"` : "";
2285
+ return `<img src="${B(r)}" alt="${B(t)}"${a} class="an-image">`;
2286
+ }), e = e.replace(Xn, (e, t, n) => {
2287
+ let { href: r, title: i } = Zn(n), a = i ? ` title="${B(i)}"` : "";
2288
+ return `<a href="${B(r)}"${a}>${t}</a>`;
2289
+ }), e = e.replace(/\[([^\]]+)\]\[([^\]]*)\]/g, (e, t, n) => {
2290
+ let r = In.get(rr(n || t).trim().toLowerCase());
2186
2291
  if (!r) return e;
2187
2292
  let i = r.title ? ` title="${z(r.title)}"` : "";
2188
2293
  return `<a href="${z(r.href)}"${i}>${t}</a>`;
2189
2294
  }), e = e.replace(/\[([^\]]+)\]/g, (e, t) => {
2190
- let n = Tn.get(Vn(t).trim().toLowerCase());
2295
+ let n = In.get(rr(t).trim().toLowerCase());
2191
2296
  if (!n) return e;
2192
2297
  let r = n.title ? ` title="${z(n.title)}"` : "";
2193
2298
  return `<a href="${z(n.href)}"${r}>${t}</a>`;
2194
- }), e = e.replace(/\[\^([^\]]+)\]/g, (e, t) => En.has(Vn(t)) ? `<sup>[${t}]</sup>` : e), e;
2299
+ }), e = e.replace(/\[\^([^\]]+)\]/g, (e, t) => Ln.has(rr(t)) ? `<sup>[${t}]</sup>` : e), e;
2195
2300
  }
2196
- function Ln(e) {
2197
- return e = e.replace(/&lt;(https?:\/\/[^\s&]+?)&gt;/g, (e, t) => `<a href="${Bn(t)}">${t}</a>`), e = e.replace(/(^|[\s(])(https?:\/\/[^\s()]+)/g, (e, t, n) => {
2301
+ function $n(e) {
2302
+ return e = e.replace(/&lt;(https?:\/\/[^\s&]+?)&gt;/g, (e, t) => `<a href="${B(t)}">${t}</a>`), e = e.replace(/&lt;([\w.!#$%&'*+/=?^`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+)&gt;/g, (e, t) => `<a href="mailto:${B(t)}">${t}</a>`), e = e.replace(/(^|[\s(])(https?:\/\/[^\s()]+)/g, (e, t, n) => {
2198
2303
  let r = /[.,;:!?)]+$/.exec(n), i = r ? n.slice(0, -r[0].length) : n;
2199
2304
  if (!i) return e;
2200
2305
  let a = r ? r[0] : "";
2201
- return `${t}<a href="${Bn(i)}">${i}</a>${a}`;
2306
+ return `${t}<a href="${B(i)}">${i}</a>${a}`;
2202
2307
  }), e;
2203
2308
  }
2204
- function Rn(e) {
2309
+ function er(e) {
2205
2310
  return e = e.replace(/\*{3}([^*\n]+?)\*{3}/g, (e, t) => `<strong><em>${t}</em></strong>`), e = e.replace(/(?<!\w)_{3}([^_\n]+?)_{3}(?!\w)/g, (e, t) => `<strong><em>${t}</em></strong>`), e = e.replace(/\*{2}([^*\n]+?)\*{2}/g, (e, t) => `<strong>${t}</strong>`), e = e.replace(/(?<!\w)_{2}([^_\n]+?)_{2}(?!\w)/g, (e, t) => `<strong>${t}</strong>`), e = e.replace(/\*([^*\n]+?)\*/g, (e, t) => `<em>${t}</em>`), e = e.replace(/(?<!\w)_([^_\n]+?)_(?!\w)/g, (e, t) => `<em>${t}</em>`), e = e.replace(/~~([^~\n]+?)~~/g, (e, t) => `<del>${t}</del>`), e = e.replace(/``([\s\S]*?)``/g, (e, t) => `<code>${t}</code>`), e = e.replace(/`([^`]+)`/g, (e, t) => `<code>${t}</code>`), e;
2206
2311
  }
2207
2312
  function R(e) {
2208
- let { text: t, literals: n } = Pn(e), r = zn(t);
2209
- return r = In(r), r = Ln(r), r = Rn(r), Fn(r, n);
2313
+ let { text: t, literals: n } = Kn(e), r = nr(t);
2314
+ return r = Qn(r), r = $n(r), r = er(r), qn(r, n);
2210
2315
  }
2211
- function zn(e) {
2212
- return String(e).replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
2316
+ var tr = /&(?!#\d+;|#[xX][0-9a-fA-F]+;|[a-zA-Z][a-zA-Z0-9]*;)/g;
2317
+ function nr(e) {
2318
+ return String(e).replace(tr, "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
2213
2319
  }
2214
2320
  function z(e) {
2215
2321
  return String(e).replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("'", "&#39;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
2216
2322
  }
2217
- function Bn(e) {
2323
+ function B(e) {
2218
2324
  return String(e).replaceAll("\"", "&quot;").replaceAll("'", "&#39;");
2219
2325
  }
2220
- function Vn(e) {
2326
+ function rr(e) {
2221
2327
  return String(e).replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
2222
2328
  }
2223
2329
  //#endregion
2224
2330
  //#region src/js/core/detectLang.js
2225
- function Hn(e) {
2331
+ var ir = 5, ar = 2, or = [
2332
+ ["typescript", "javascript"],
2333
+ ["scss", "css"],
2334
+ ["cpp", "c"]
2335
+ ], sr = [
2336
+ {
2337
+ lang: "php",
2338
+ w: 10,
2339
+ re: /<\?php\b|<\?=/
2340
+ },
2341
+ {
2342
+ lang: "bash",
2343
+ w: 10,
2344
+ re: /^#!.*\/(?:ba|z|da|fi|k)?sh\b/m
2345
+ },
2346
+ {
2347
+ lang: "rust",
2348
+ w: 10,
2349
+ re: /\b(?:println!|print!|format!|vec!|panic!)\s*[([]/
2350
+ },
2351
+ {
2352
+ lang: "go",
2353
+ w: 10,
2354
+ re: /\bfmt\.(?:Print|Println|Printf|Sprintf|Errorf|Fprintf)\s*\(/
2355
+ },
2356
+ {
2357
+ lang: "java",
2358
+ w: 10,
2359
+ re: /\bSystem\.out\.(?:print|println)\s*\(/
2360
+ },
2361
+ {
2362
+ lang: "csharp",
2363
+ w: 10,
2364
+ re: /\bConsole\.(?:Write|WriteLine)\s*\(/
2365
+ },
2366
+ {
2367
+ lang: "cpp",
2368
+ w: 10,
2369
+ re: /\b(?:cout|cerr)\s*<<|\bcin\s*>>|\busing\s+namespace\s+std\b|\bstd::\w/
2370
+ },
2371
+ {
2372
+ lang: "python",
2373
+ w: 10,
2374
+ re: /\bdef[ \t]+\w+[ \t]*\([^)]*\)[ \t]*(?:->[^:\n]*)?:|\bif[ \t]+__name__[ \t]*==[ \t]*['"]__main__['"]/
2375
+ },
2376
+ {
2377
+ lang: "html",
2378
+ w: 10,
2379
+ re: /^\s*<!DOCTYPE\s+html/i
2380
+ },
2381
+ {
2382
+ lang: "xml",
2383
+ w: 10,
2384
+ re: /^\s*<\?xml\s/i
2385
+ },
2386
+ {
2387
+ lang: "javascript",
2388
+ w: 6,
2389
+ re: /\bconsole\.(?:log|error|warn|info|debug)\s*\(/
2390
+ },
2391
+ {
2392
+ lang: "javascript",
2393
+ w: 6,
2394
+ re: /\b(?:const|let)\s+\w+\s*=|(?:^|\n)\s*var\s+\w+\s*=/
2395
+ },
2396
+ {
2397
+ lang: "javascript",
2398
+ w: 8,
2399
+ re: /\bexport\s+(?:default|const|function|class|async|\{|\*)|\bmodule\.exports\b|\brequire\s*\(\s*['"]/
2400
+ },
2401
+ {
2402
+ lang: "javascript",
2403
+ w: 5,
2404
+ re: /\bfunction(?:[ \t]+\w+)?[ \t]*\([^)]*\)[ \t]*\{|=>[ \t]*[{([`\w'"]/
2405
+ },
2406
+ {
2407
+ lang: "javascript",
2408
+ w: 5,
2409
+ re: /\bimport\b[^'"\n]*[ \t]from[ \t]*['"]/
2410
+ },
2411
+ {
2412
+ lang: "javascript",
2413
+ w: 4,
2414
+ re: /\.(?:map|filter|forEach|reduce|then|catch|find|some|every)\s*\(/
2415
+ },
2416
+ {
2417
+ lang: "javascript",
2418
+ w: 4,
2419
+ re: /\b(?:document|window|globalThis)\.\w/
2420
+ },
2421
+ {
2422
+ lang: "javascript",
2423
+ w: 4,
2424
+ re: /\baddEventListener\s*\(|\bquerySelector(?:All)?\s*\(|\bgetElementById\s*\(/
2425
+ },
2426
+ {
2427
+ lang: "javascript",
2428
+ w: 3,
2429
+ re: /\.(?:innerHTML|textContent|classList|dataset|style)\b|\bJSON\.(?:parse|stringify)\s*\(/
2430
+ },
2431
+ {
2432
+ lang: "javascript",
2433
+ w: 4,
2434
+ re: /\bawait\s+\w|\basync\s+(?:function|\(|\w+\s*=>)|\bnew\s+Promise\s*\(/
2435
+ },
2436
+ {
2437
+ lang: "javascript",
2438
+ w: 3,
2439
+ re: /\bReact\.|\buseState\s*\(|\buseEffect\s*\(/
2440
+ },
2441
+ {
2442
+ lang: "typescript",
2443
+ w: 8,
2444
+ re: /\binterface\s+\w+(?:<[^>]*>)?\s*(?:extends\s[\w<>, ]+)?\{/
2445
+ },
2446
+ {
2447
+ lang: "typescript",
2448
+ w: 8,
2449
+ re: /\btype\s+\w+(?:<[^>]*>)?\s*=/
2450
+ },
2451
+ {
2452
+ lang: "typescript",
2453
+ w: 7,
2454
+ re: /:\s*(?:string|number|boolean|void|never|any|unknown|object)\b/
2455
+ },
2456
+ {
2457
+ lang: "typescript",
2458
+ w: 6,
2459
+ re: /\benum\s+\w+\s*\{|\breadonly\s+\w|\bimplements\s+\w|\bnamespace\s+\w+\s*\{/
2460
+ },
2461
+ {
2462
+ lang: "typescript",
2463
+ w: 6,
2464
+ re: /\b(?:private|public|protected)\s+(?:readonly\s+)?\w+\s*[:?]/
2465
+ },
2466
+ {
2467
+ lang: "typescript",
2468
+ w: 5,
2469
+ re: /\)\s*:\s*[A-Z]\w*(?:<[^>]*>)?\s*(?:\{|=>)|\)\s*:\s*(?:string|number|boolean|void)\b/
2470
+ },
2471
+ {
2472
+ lang: "typescript",
2473
+ w: 4,
2474
+ re: /\bfunction\s+\w+\s*<[^>]+>\s*\(|\bas\s+(?:const\b|[A-Z]\w*)/
2475
+ },
2476
+ {
2477
+ lang: "typescript",
2478
+ w: 3,
2479
+ re: /\w\?\s*:\s*\w|\bimport\s+type\b|\bsatisfies\b/
2480
+ },
2481
+ {
2482
+ lang: "python",
2483
+ w: 6,
2484
+ re: /(?:^|\n)\s*(?:from\s+[\w.]+\s+import\s|import\s+\w+(?:\s*,\s*\w+)*\s*$)/m
2485
+ },
2486
+ {
2487
+ lang: "python",
2488
+ w: 6,
2489
+ re: /(?:^|\n)\s*class\s+\w+(?:\([\w., ]*\))?\s*:/
2490
+ },
2491
+ {
2492
+ lang: "python",
2493
+ w: 5,
2494
+ re: /(?:^|\n)\s*(?:with|elif|except|finally|async\s+def)\b[^\n]*:/
2495
+ },
2496
+ {
2497
+ lang: "python",
2498
+ w: 5,
2499
+ re: /\bself\.\w|\b__init__\b|\bf["'][^"']*\{/
2500
+ },
2501
+ {
2502
+ lang: "python",
2503
+ w: 4,
2504
+ re: /(?:^|\n)[ \t]*for[ \t]+\w+[ \t]+in[ \t][^\n:]*:|\bfor[ \t]+\w+[ \t]+in[ \t]+range[ \t]*\(/
2505
+ },
2506
+ {
2507
+ lang: "python",
2508
+ w: 4,
2509
+ re: /\bprint\s*\(|\blen\s*\(|\brange\s*\(/
2510
+ },
2511
+ {
2512
+ lang: "python",
2513
+ w: 3,
2514
+ re: /\[[^\]\n]*\bfor\s+\w+\s+in\s[^\]\n]*\]|\bNone\b|\bTrue\b|\bFalse\b/
2515
+ },
2516
+ {
2517
+ lang: "python",
2518
+ w: 3,
2519
+ re: /\*\*\w|\bdict[ \t]*\(|\blambda(?:[ \t]+\w+)?[ \t]*:/
2520
+ },
2521
+ {
2522
+ lang: "go",
2523
+ w: 8,
2524
+ re: /(?:^|\n)\s*package\s+\w+\s*$/m
2525
+ },
2526
+ {
2527
+ lang: "go",
2528
+ w: 6,
2529
+ re: /\btype\s+\w+\s+struct\s*\{|\btype\s+\w+\s+interface\s*\{/
2530
+ },
2531
+ {
2532
+ lang: "go",
2533
+ w: 6,
2534
+ re: /\bfunc(?:[ \t]*\([^)]*\))?(?:[ \t]+\w+)?[ \t]*\([^)]*\)[^\n{]{0,40}\{/
2535
+ },
2536
+ {
2537
+ lang: "go",
2538
+ w: 5,
2539
+ re: /\bif\s+err\s*!=\s*nil\b|\berr\s*:=\s|\bdefer\s+\w/
2540
+ },
2541
+ {
2542
+ lang: "go",
2543
+ w: 4,
2544
+ re: /\w+\s*:=\s*\S|\bchan\s+\w|\bgo\s+func\b|\bnil\b/
2545
+ },
2546
+ {
2547
+ lang: "rust",
2548
+ w: 7,
2549
+ re: /\bfn[ \t]+\w+(?:<[^>]*>)?[ \t]*\([^)]*\)[^\n{]{0,40}\{/
2550
+ },
2551
+ {
2552
+ lang: "rust",
2553
+ w: 7,
2554
+ re: /\blet\s+mut\s+\w|\bpub\s+(?:fn|struct|enum|mod|use)\b|\bimpl\s+\w/
2555
+ },
2556
+ {
2557
+ lang: "rust",
2558
+ w: 5,
2559
+ re: /\buse\s+(?:std|crate|self|super)::|\bmatch\s+\w+\s*\{[^}]*=>/
2560
+ },
2561
+ {
2562
+ lang: "rust",
2563
+ w: 4,
2564
+ re: /\b(?:Option|Result|Vec|Box|Rc|Arc|HashMap)\s*<|&(?:mut\s+)?self\b|\b\w+::<|->\s*Result</
2565
+ },
2566
+ {
2567
+ lang: "rust",
2568
+ w: 3,
2569
+ re: /\b(?:i8|i16|i32|i64|u8|u16|u32|u64|usize|isize|f32|f64)\b|\bunwrap\s*\(\)|\bderive\s*\(/
2570
+ },
2571
+ {
2572
+ lang: "java",
2573
+ w: 7,
2574
+ re: /\b(?:public|private|protected)\s+(?:static\s+)?(?:final\s+)?(?:void|int|long|double|boolean|String|[A-Z]\w*(?:<[^>]*>)?)\s+\w+\s*[({]/
2575
+ },
2576
+ {
2577
+ lang: "java",
2578
+ w: 7,
2579
+ re: /\bimport\s+(?:java|javax|org\.springframework)\.[\w.]+;/
2580
+ },
2581
+ {
2582
+ lang: "java",
2583
+ w: 6,
2584
+ re: /@(?:Override|Autowired|Component|Service|Controller|RestController|Entity|Test|SpringBootApplication)\b/
2585
+ },
2586
+ {
2587
+ lang: "java",
2588
+ w: 5,
2589
+ re: /\bnew\s+(?:ArrayList|HashMap|HashSet|LinkedList|StringBuilder)\s*<[^>]*>\s*\(|\bthrows\s+\w*Exception/
2590
+ },
2591
+ {
2592
+ lang: "java",
2593
+ w: 4,
2594
+ re: /\bpublic\s+(?:class|interface|enum)\s+\w|\bextends\s+\w+\s*\{|\bList<\w|\bMap<\w/
2595
+ },
2596
+ {
2597
+ lang: "csharp",
2598
+ w: 8,
2599
+ re: /\busing\s+System(?:\.[\w.]+)?\s*;|\bnamespace\s+[\w.]+\s*[{;]/
2600
+ },
2601
+ {
2602
+ lang: "csharp",
2603
+ w: 8,
2604
+ re: /\{\s*get;\s*(?:private\s+)?set;\s*\}|\b(?:public|private|protected|internal)\s+(?:static\s+)?async\s+Task(?:<[^>]*>)?\s+\w/
2605
+ },
2606
+ {
2607
+ lang: "csharp",
2608
+ w: 6,
2609
+ re: /\basync\s+Task(?:<[^>]*>)?\s+\w|\bawait\s+\w+\.\w+Async\s*\(/
2610
+ },
2611
+ {
2612
+ lang: "csharp",
2613
+ w: 5,
2614
+ re: /\bIEnumerable<|\bvar\s+\w+\s*=\s*new\s+\w|\bpublic\s+override\b|\[\s*(?:HttpGet|HttpPost|Serializable|Required)\s*\]/
2615
+ },
2616
+ {
2617
+ lang: "csharp",
2618
+ w: 3,
2619
+ re: /\.(?:Select|Where|FirstOrDefault|ToList|Any)\s*\(|\bstring\[\]\s+args\b/
2620
+ },
2621
+ {
2622
+ lang: "kotlin",
2623
+ w: 8,
2624
+ re: /\bfun\s+\w+\s*\([^)]*\)\s*(?::\s*[\w<>?.]+\s*)?[={]|\bdata\s+class\s+\w/
2625
+ },
2626
+ {
2627
+ lang: "kotlin",
2628
+ w: 6,
2629
+ re: /\bval[ \t]+\w+(?:[ \t]*:[ \t]*[\w<>?.]+)?[ \t]*=|\bcompanion[ \t]+object\b|\bsuspend[ \t]+fun\b/
2630
+ },
2631
+ {
2632
+ lang: "kotlin",
2633
+ w: 4,
2634
+ re: /\bprintln\s*\(|\bwhen\s*\([^)]*\)\s*\{|\bobject\s+\w+\s*[:{]|\?:\s*\w/
2635
+ },
2636
+ {
2637
+ lang: "swift",
2638
+ w: 8,
2639
+ re: /\bguard\s+(?:let|var)\s[^\n]*\belse\b|\bfunc\s+\w+\s*\([^)]*\)\s*(?:async\s+)?(?:throws\s+)?->\s*[\w<>?[\]]/
2640
+ },
2641
+ {
2642
+ lang: "swift",
2643
+ w: 6,
2644
+ re: /\bprotocol[ \t]+\w+[^\n{]{0,40}\{|\bextension[ \t]+\w+[^\n{]{0,40}\{|\bimport[ \t]+(?:SwiftUI|UIKit|Foundation)\b/
2645
+ },
2646
+ {
2647
+ lang: "swift",
2648
+ w: 6,
2649
+ re: /\b(?:let|var)\s+\w+\s*:\s*(?:Int|String|Double|Float|Bool|Character|Any|\[[A-Z])|@(?:State|Binding|Published|IBOutlet|objc)\b/
2650
+ },
2651
+ {
2652
+ lang: "swift",
2653
+ w: 4,
2654
+ re: /\\\(\w|\bif[ \t]+let[ \t]+\w|\bstruct[ \t]+\w+[ \t]*:[ \t]*View\b|\bfunc[ \t]+\w+[ \t]*\([^)]*:[ \t]*[A-Z]/
2655
+ },
2656
+ {
2657
+ lang: "swift",
2658
+ w: 3,
2659
+ re: /\?\?\s*\w|\b\w+\?\.\w|\bself\.\w+\s*=/
2660
+ },
2661
+ {
2662
+ lang: "cpp",
2663
+ w: 8,
2664
+ re: /#include\s*<(?:iostream|vector|map|set|algorithm|string|memory|utility)>/
2665
+ },
2666
+ {
2667
+ lang: "cpp",
2668
+ w: 6,
2669
+ re: /\btemplate\s*<\s*(?:typename|class)\b|\bnullptr\b|\bnamespace\s+\w+\s*\{/
2670
+ },
2671
+ {
2672
+ lang: "c",
2673
+ w: 8,
2674
+ re: /#include\s*<(?:stdio|stdlib|string|math|time|ctype|unistd)\.h>/
2675
+ },
2676
+ {
2677
+ lang: "c",
2678
+ w: 6,
2679
+ re: /\b(?:printf|scanf|malloc|calloc|free|memcpy|strlen)\s*\(/
2680
+ },
2681
+ {
2682
+ lang: "c",
2683
+ w: 4,
2684
+ re: /\bint\s+main\s*\(\s*(?:void|int\s+argc|\)\s*\{)/
2685
+ },
2686
+ {
2687
+ lang: "c",
2688
+ w: 3,
2689
+ re: /\btypedef\s+struct\b|\bsizeof\s*\(|\bNULL\b/
2690
+ },
2691
+ {
2692
+ lang: "ruby",
2693
+ w: 8,
2694
+ re: /\bdo[ \t]*\|[ \t]*\w[\w, ]*\|/
2695
+ },
2696
+ {
2697
+ lang: "ruby",
2698
+ w: 7,
2699
+ re: /\battr_(?:accessor|reader|writer)\s+:|\brequire(?:_relative)?\s+['"]|\bputs\s+\S/
2700
+ },
2701
+ {
2702
+ lang: "ruby",
2703
+ w: 4,
2704
+ re: /(?:^|\n)[ \t]*def[ \t]+\w/
2705
+ },
2706
+ {
2707
+ lang: "ruby",
2708
+ w: 4,
2709
+ re: /(?:^|\n)[ \t]*end[ \t]*$/m
2710
+ },
2711
+ {
2712
+ lang: "ruby",
2713
+ w: 4,
2714
+ re: /\bnil\?\b|\b\w+\.new\b|=>\s*['"\w]|\bmodule\s+[A-Z]\w*\s*$/m
2715
+ },
2716
+ {
2717
+ lang: "ruby",
2718
+ w: 3,
2719
+ re: /:\w+[ \t]*=>|\bend[ \t]*$/m
2720
+ },
2721
+ {
2722
+ lang: "php",
2723
+ w: 7,
2724
+ re: /\$this->\w|\bfunction\s+\w+\s*\([^)]*\$\w/
2725
+ },
2726
+ {
2727
+ lang: "php",
2728
+ w: 6,
2729
+ re: /\$\w+\s*=\s*\S|\bforeach\s*\(\s*\$\w+\s+as\s+\$/
2730
+ },
2731
+ {
2732
+ lang: "php",
2733
+ w: 5,
2734
+ re: /\becho[ \t][^;\n]*[$'"]|\bnamespace[ \t]+[\w\\]+;|\buse[ \t]+[\w\\]+\\\w+;/
2735
+ },
2736
+ {
2737
+ lang: "php",
2738
+ w: 8,
2739
+ re: /\b(?:public|private|protected)\s+(?:static\s+)?function\s+\w/
2740
+ },
2741
+ {
2742
+ lang: "php",
2743
+ w: 3,
2744
+ re: /->\w+\s*\(|::\w+\s*\(/
2745
+ },
2746
+ {
2747
+ lang: "html",
2748
+ w: 7,
2749
+ re: /<(?:html|head|body|nav|section|article|header|footer|main|form)\b[^>]*>/i
2750
+ },
2751
+ {
2752
+ lang: "html",
2753
+ w: 5,
2754
+ re: /<(?:div|p|span|a|img|ul|ol|li|table|tr|td|input|button|h[1-6])\b[^>]*>[\s\S]*<\/(?:div|p|span|a|ul|ol|li|table|tr|td|button|h[1-6])>/i
2755
+ },
2756
+ {
2757
+ lang: "html",
2758
+ w: 4,
2759
+ re: /<\w+\s+(?:class|id|href|src|type|style)\s*=\s*["']/i
2760
+ },
2761
+ {
2762
+ lang: "xml",
2763
+ w: 6,
2764
+ re: /\bxmlns(?::\w+)?\s*=\s*["']|<\/\w+:\w+>|<\w+:\w+[\s>]/
2765
+ },
2766
+ {
2767
+ lang: "json",
2768
+ w: 8,
2769
+ re: /^\s*[{[][\s\S]*"[\w-]+"\s*:\s*(?:"[^"]*"|-?\d|\{|\[|true|false|null)/
2770
+ },
2771
+ {
2772
+ lang: "json",
2773
+ w: 3,
2774
+ re: /^\s*\{[\s\S]*\}\s*$|^\s*\[[\s\S]*\]\s*$/
2775
+ },
2776
+ {
2777
+ lang: "yaml",
2778
+ w: 8,
2779
+ re: /^---\s*$/m
2780
+ },
2781
+ {
2782
+ lang: "yaml",
2783
+ w: 6,
2784
+ re: /^[ \t]*-\s+\w+\s*:\s*\S/m
2785
+ },
2786
+ {
2787
+ lang: "yaml",
2788
+ w: 5,
2789
+ re: /^[a-z_][\w-]*[ \t]*:(?:[ \t]*$|[ \t]+(?:[|>][-+]?[ \t]*$|['"\w[{]))/im
2790
+ },
2791
+ {
2792
+ lang: "yaml",
2793
+ w: 4,
2794
+ re: /^[ \t]+[a-z_][\w-]*[ \t]*:[ \t]*\S/im
2795
+ },
2796
+ {
2797
+ lang: "yaml",
2798
+ w: 3,
2799
+ re: /^[ \t]*-\s+\S/m
2800
+ },
2801
+ {
2802
+ lang: "markdown",
2803
+ w: 7,
2804
+ re: /^#{1,6}\s+\S/m
2805
+ },
2806
+ {
2807
+ lang: "markdown",
2808
+ w: 6,
2809
+ re: /^```|^\|[^\n|]+\|[^\n]*\n\s*\|[\s:|-]+\|/m
2810
+ },
2811
+ {
2812
+ lang: "markdown",
2813
+ w: 4,
2814
+ re: /\[[^\]\n]+\]\([^)\n]+\)|!\[[^\]\n]*\]\(/
2815
+ },
2816
+ {
2817
+ lang: "markdown",
2818
+ w: 3,
2819
+ re: /\*\*[^*\n]+\*\*|^>\s+\S|^[-*+]\s+\S/m
2820
+ },
2821
+ {
2822
+ lang: "sql",
2823
+ w: 9,
2824
+ re: /(?:^|\n)\s*(?:SELECT\s+[\w*]|INSERT\s+INTO\s|UPDATE\s+\w+\s+SET\s|DELETE\s+FROM\s)/i
2825
+ },
2826
+ {
2827
+ lang: "sql",
2828
+ w: 8,
2829
+ re: /(?:^|\n)\s*(?:CREATE|ALTER|DROP)\s+(?:TABLE|DATABASE|INDEX|VIEW|SCHEMA)\b/i
2830
+ },
2831
+ {
2832
+ lang: "sql",
2833
+ w: 4,
2834
+ re: /\b(?:INNER|LEFT|RIGHT|FULL)\s+(?:OUTER\s+)?JOIN\b|\bGROUP\s+BY\b|\bORDER\s+BY\b|\bWITH\s+\w+\s+AS\s*\(/i
2835
+ },
2836
+ {
2837
+ lang: "scss",
2838
+ w: 9,
2839
+ re: /^[ \t]*\$[\w-]+[ \t]*:[^;\n]+;|@(?:mixin|include|extend|use|forward)[ \t]+[\w"'-]/m
2840
+ },
2841
+ {
2842
+ lang: "scss",
2843
+ w: 7,
2844
+ re: /^[ \t]*&[\s.:[&>+~]|#\{[^}]*\}/m
2845
+ },
2846
+ {
2847
+ lang: "scss",
2848
+ w: 4,
2849
+ re: /^[ \t]*\/\/[ \t]*\S/m
2850
+ },
2851
+ {
2852
+ lang: "css",
2853
+ w: 6,
2854
+ re: /^[ \t]*(?!(?:export|import|return|function|const|let|var|val|if|else|for|while|switch|case|class|new|public|private|protected|internal|def|func|fun|fn|pub|package|type|interface|enum|struct|impl|trait|mod|use|using|namespace|module|data|object|async|await|guard|extension|protocol|template|typedef)\b)[.#]?[\w-]+[^{}\n]{0,60}\{[^{}:]*:[^{};]+[;}]/m
2855
+ },
2856
+ {
2857
+ lang: "css",
2858
+ w: 5,
2859
+ re: /@(?:media|supports|keyframes|font-face|import|charset)\b/
2860
+ },
2861
+ {
2862
+ lang: "css",
2863
+ w: 4,
2864
+ re: /:\s*(?:#[\da-f]{3,8}|\d+(?:px|rem|em|%|vh|vw)|flex|grid|block|none|absolute|relative)\s*[;}]/i
2865
+ },
2866
+ {
2867
+ lang: "css",
2868
+ w: 3,
2869
+ re: /::?(?:hover|focus|active|before|after|first-child|last-child|nth-child)\b/
2870
+ },
2871
+ {
2872
+ lang: "bash",
2873
+ w: 7,
2874
+ re: /(?:^|\n|&&|\|\|)\s*(?:sudo\s+)?(?:apt(?:-get)?|yum|brew|npm|pnpm|yarn|pip3?|docker|kubectl|git|systemctl|curl|wget|chmod|chown|mkdir|rm|cp|mv|tar|ssh|scp)\s+[\w./-]/
2875
+ },
2876
+ {
2877
+ lang: "bash",
2878
+ w: 6,
2879
+ re: /^\s*(?:export|source|alias)\s+\w+|^\s*\w+=\S+\s*$/m
2880
+ },
2881
+ {
2882
+ lang: "bash",
2883
+ w: 6,
2884
+ re: /\bfi[ \t]*$|(?:^|\n)[ \t]*(?:if|for|while)[ \t][^\n]*;[ \t]*(?:then|do)\b|(?:^|\n)[ \t]*done\b/m
2885
+ },
2886
+ {
2887
+ lang: "bash",
2888
+ w: 5,
2889
+ re: /\$\{?\w+\}?[/:]|"\$\w|\becho\s+["'$]|\$\(\w/
2890
+ },
2891
+ {
2892
+ lang: "bash",
2893
+ w: 4,
2894
+ re: /(?:^|\n|\|)\s*(?:grep|awk|sed|cat|ls|cd|pwd|find|xargs|head|tail|sort|uniq|wc)\s+[-\w$'"./]/
2895
+ },
2896
+ {
2897
+ lang: "bash",
2898
+ w: 3,
2899
+ re: /\s\|[ \t]*\w|\s&&\s|\s2>&1|\s-[\w-]+\s/
2900
+ }
2901
+ ], cr = 4e3;
2902
+ function lr(e) {
2903
+ if (e.length <= cr) return e;
2904
+ let t = e.slice(0, cr), n = t.lastIndexOf("\n");
2905
+ return n > 0 ? t.slice(0, n) : t;
2906
+ }
2907
+ function ur(e) {
2226
2908
  if (!e?.trim()) return null;
2227
- let t = e.trim();
2228
- return /(:\s*(string|number|boolean|void|never|any|unknown)\b|interface\s+\w+\s*\{|type\s+\w+\s*[=<(]|<\w+>\s*[;,)]|readonly\s+\w|enum\s+\w+\s*\{|\?\s*:\s*\w|as\s+\w+\s*[;,)\]])/.test(t) ? "typescript" : /\bprintln!\s*\(|\bprint!\s*\(|\bfn\s+\w+\s*(<[^>]*>)?\s*\(|\blet\s+mut\s|\bpub\s+fn\s|\buse\s+std::|\bimpl\s+\w+|\bOption<|\bResult<\w+/.test(t) ? "rust" : /(<\?php\b|<\?=|\becho\s+.*\$\w|\$this->|\$\w+\s*=\s*\w|\bforeach\s*\(\s*\$|Illuminate\\)/.test(t) ? "php" : /\bpublic\s+(class|static|void|int|String)\s+\w|System\.out\.(print|println)\s*\(|@(Override|Autowired|Component|Service|Controller)\b|import\s+java\.(util|io|lang|net)\.|throws\s+\w+Exception/.test(t) ? "java" : /\bfun\s+\w+\s*\(|\bdata\s+class\s+\w+|\bcompanion\s+object\b|\bval\s+\w+\s*:\s*\w|\bprintln\s*\(/.test(t) ? "kotlin" : /\bguard\s+(let|var)\b|\bprotocol\s+\w+\s*\{|\bextension\s+\w+|\bfunc\s+\w+[^(]*\([^)]*\)\s*->\s*\w|\blet\s+\w+\s*:\s*[A-Z]\w*|\bSwiftUI\b/.test(t) ? "swift" : /\bpackage\s+\w+\b|\bfmt\.(Print|Println|Sprintf|Errorf|Fprintf)\s*\(|:=\s*\w|\bgoroutine\b|\bchan\s+\w|\bgo\s+func\b/.test(t) ? "go" : /\b(const\s+\w|let\s+\w+\s*=|var\s+\w+\s*=|function\s+\w|\=>\s*[{(]|import\s+.*\bfrom\b\s*['"]|require\s*\(|console\.(log|error|warn|info)|document\.\w|window\.\w|async\s+function|\bPromise\b|React\.|useState\s*\(|\.then\s*\()/.test(t) ? "javascript" : /^<!DOCTYPE html/i.test(t) || /<(html|head|body|div|section|article|nav|p|a|img|ul|ol|li|table|form|input|button|script|style)\b[^>]*>/i.test(t) ? "html" : /(^|\n)\s*(\/\/\s+\S|&[:.[\w]|\$\w+\s*:|@(mixin|include|extend|each|if|for|use|forward)\b|#\{)/.test(t) && /[\w#.*&[\]:(),>+~ -]+\s*\{/.test(t) ? "scss" : /(^|\n)\s*[\w#.*:[\]&, +-]+\s*\{[^}]*[\w-]+\s*:[^{}:;]+[;}\n]/m.test(t) && !/<\w|function\s|def\s|:\s*(string|number)/.test(t) ? "css" : /^\s*[{[]/.test(t) && /"\w[\w\s-]*"\s*:/.test(t) && !/\bfunction\b|\bdef\b/.test(t) ? "json" : /(^|\n)\s*(SELECT\s|INSERT\s+INTO|UPDATE\s+\w|DELETE\s+FROM|CREATE\s+(TABLE|DATABASE|INDEX|VIEW)|DROP\s+(TABLE|DATABASE)|ALTER\s+TABLE|WITH\s+\w+\s+AS\s*\()/im.test(t) ? "sql" : /\bdef\s+\w+\s*\([^)]*\)\s*:|(^|\n)\s*class\s+\w+.*:\s*$|(^|\n)\s*import\s+\w|(^|\n)\s*from\s+\w+\s+import\s+|\bprint\s*\(|if\s+__name__\s*==\s*['"]__main__['"]/m.test(t) ? "python" : /\bputs\s+\S|\battr_(accessor|reader|writer)\s|\.each\s+do\s*\|\w+\s*\||\bdo\s*\|\w+\s*\|.*\bend\b|\bdef\s+\w+[^:]*\n[\s\S]*?\bend\b/.test(t) ? "ruby" : /^#!.*\/(ba|z|da|fi|k)?sh\b/m.test(t) || /\b(echo\s+["']|grep\s+|awk\s+|sed\s+['"\\/-]|chmod\s+|sudo\s+|apt(-get)?\s+install|brew\s+install|npm\s+(install|run|start|build)|pip\s+(install|3\s)|docker\s+(run|build|compose)|kubectl\s+|git\s+(clone|add|commit|push|pull|checkout))\b/.test(t) ? "bash" : /\bcout\s*<<|\bcin\s*>>|using\s+namespace\s+std\b|std::\w|\btemplate\s*<\w|\b#include\s*<(iostream|vector|map|set|algorithm|string|memory)>/.test(t) ? "cpp" : /\busing\s+System\b|Console\.(Write|WriteLine)\s*\(|\bget;\s*set;|\basync\s+Task[<\s]|IEnumerable<|\bLINQ\b|\.Select\s*\(|\.Where\s*\(/.test(t) ? "csharp" : /\b#include\s*<(stdio|stdlib|string|math|time|ctype)\.h>|\bprintf\s*\(|\bscanf\s*\(|int\s+main\s*\(\s*(void|int\s+argc)|\bmalloc\s*\(|\bfree\s*\(/.test(t) && !/namespace|cout|cin|std::/.test(t) ? "c" : /^<\?xml\s/i.test(t) || /xmlns:|<\/[\w:]+>/.test(t) ? "xml" : null;
2909
+ let t = lr(e.trim()), n = /* @__PURE__ */ new Map();
2910
+ for (let { lang: e, re: r, w: i } of sr) r.test(t) && n.set(e, (n.get(e) || 0) + i);
2911
+ if (n.size === 0) return null;
2912
+ for (let [e, t] of or) {
2913
+ let r = n.get(e);
2914
+ r && n.set(e, r + (n.get(t) || 0));
2915
+ }
2916
+ let r = [...n.entries()].sort((e, t) => t[1] - e[1]), [i, a] = r[0], o = r[1]?.[1] ?? 0;
2917
+ return a < ir || a - o < ar ? null : i;
2229
2918
  }
2230
2919
  //#endregion
2231
2920
  //#region src/js/module/Editor.js
2232
- var Un = class {
2921
+ var dr = class {
2233
2922
  constructor(e) {
2234
2923
  this.context = e, this.options = e.options, this._history = null, this._disposers = [], this._snapshotTimer = null;
2235
2924
  }
2236
2925
  initialize() {
2237
2926
  let e = this.context.layoutInfo.editable;
2238
- return this._history = new ln(e, this.options.historyLimit || 100, this.options.historyMaxBytes || 10 * 1024 * 1024), this._bindEvents(e), this;
2927
+ return this._history = new un(e, this.options.historyLimit || 100, this.options.historyMaxBytes || 10 * 1024 * 1024), this._bindEvents(e), this;
2239
2928
  }
2240
2929
  destroy() {
2241
2930
  this._disposers.forEach((e) => e()), this._disposers = [], this._history = null, clearTimeout(this._snapshotTimer), this._snapshotTimer = null;
@@ -2312,32 +3001,32 @@ var Un = class {
2312
3001
  }
2313
3002
  _onKeydown(e) {
2314
3003
  let t = this.context.layoutInfo.editable;
2315
- if (!hn(e, t, this.options)) {
2316
- if (I(e, "z") && !e.shiftKey) {
3004
+ if (!gn(e, t, this.options)) {
3005
+ if (F(e, "z") && !e.shiftKey) {
2317
3006
  e.preventDefault(), this.undo();
2318
3007
  return;
2319
3008
  }
2320
- if (I(e, "z") && e.shiftKey || I(e, "y")) {
3009
+ if (F(e, "z") && e.shiftKey || F(e, "y")) {
2321
3010
  e.preventDefault(), this.redo();
2322
3011
  return;
2323
3012
  }
2324
- if (I(e, "b")) {
3013
+ if (F(e, "b")) {
2325
3014
  e.preventDefault(), this.bold();
2326
3015
  return;
2327
3016
  }
2328
- if (I(e, "i")) {
3017
+ if (F(e, "i")) {
2329
3018
  e.preventDefault(), this.italic();
2330
3019
  return;
2331
3020
  }
2332
- if (I(e, "u")) {
3021
+ if (F(e, "u")) {
2333
3022
  e.preventDefault(), this.underline();
2334
3023
  return;
2335
3024
  }
2336
- if (I(e, "k")) {
3025
+ if (F(e, "k")) {
2337
3026
  e.preventDefault(), this.context.invoke("linkDialog.show");
2338
3027
  return;
2339
3028
  }
2340
- if (I(e, "v") && e.shiftKey) {
3029
+ if (F(e, "v") && e.shiftKey) {
2341
3030
  this.context.invoke("clipboard.setForcePlain", !0);
2342
3031
  return;
2343
3032
  }
@@ -2345,11 +3034,11 @@ var Un = class {
2345
3034
  e.preventDefault(), this.context.invoke("shortcutsDialog.show");
2346
3035
  return;
2347
3036
  }
2348
- if (I(e, "f")) {
3037
+ if (F(e, "f")) {
2349
3038
  e.preventDefault(), this.context.invoke("findReplace.show", "find");
2350
3039
  return;
2351
3040
  }
2352
- I(e, "h") && (e.preventDefault(), this.context.invoke("findReplace.show", "replace")), I(e, "`") && (e.preventDefault(), this.inlineCode());
3041
+ F(e, "h") && (e.preventDefault(), this.context.invoke("findReplace.show", "replace")), F(e, "`") && (e.preventDefault(), this.inlineCode());
2353
3042
  }
2354
3043
  }
2355
3044
  _enforceLimit(e) {
@@ -2421,16 +3110,16 @@ var Un = class {
2421
3110
  return !e && !t;
2422
3111
  }
2423
3112
  insertHTML(e) {
2424
- e && (D("insertHTML", M(e)), this.afterCommand());
3113
+ e && (O("insertHTML", M(e)), this.afterCommand());
2425
3114
  }
2426
3115
  insertText(e) {
2427
- e && (D("insertText", e), this.afterCommand());
3116
+ e && (O("insertText", e), this.afterCommand());
2428
3117
  }
2429
3118
  setMarkdown(e) {
2430
- this.setHTML(Cn(e || ""));
3119
+ this.setHTML(Pn(e || ""));
2431
3120
  }
2432
3121
  getMarkdown() {
2433
- return gn(this.getHTML());
3122
+ return _n(this.getHTML());
2434
3123
  }
2435
3124
  undo() {
2436
3125
  this._history && (this._flushPendingSnapshot(), this._history.undo(), this.context.invoke("toolbar.refresh"), this.context.invoke("statusbar.update"), this.context.triggerEvent("change", this.getHTML()));
@@ -2460,49 +3149,49 @@ var Un = class {
2460
3149
  return !e || !this._history ? !1 : (this._history._restoreSelection(e), !0);
2461
3150
  }
2462
3151
  bold() {
2463
- we(), this.afterCommand();
3152
+ Ce(), this.afterCommand();
2464
3153
  }
2465
3154
  italic() {
2466
- Te(), this.afterCommand();
3155
+ we(), this.afterCommand();
2467
3156
  }
2468
3157
  underline() {
2469
- Ee(), this.afterCommand();
3158
+ Te(), this.afterCommand();
2470
3159
  }
2471
3160
  strikethrough() {
2472
- De(), this.afterCommand();
3161
+ Ee(), this.afterCommand();
2473
3162
  }
2474
3163
  superscript() {
2475
- Oe(), this.afterCommand();
3164
+ De(), this.afterCommand();
2476
3165
  }
2477
3166
  subscript() {
2478
- ke(), this.afterCommand();
3167
+ Oe(), this.afterCommand();
2479
3168
  }
2480
3169
  justifyLeft() {
2481
- Fe(), this.afterCommand();
3170
+ Pe(), this.afterCommand();
2482
3171
  }
2483
3172
  justifyCenter() {
2484
- Ie(), this.afterCommand();
3173
+ Fe(), this.afterCommand();
2485
3174
  }
2486
3175
  justifyRight() {
2487
- Le(), this.afterCommand();
3176
+ Ie(), this.afterCommand();
2488
3177
  }
2489
3178
  justifyFull() {
2490
- Re(), this.afterCommand();
3179
+ Le(), this.afterCommand();
2491
3180
  }
2492
3181
  indent() {
2493
- ze(), this.afterCommand();
3182
+ Re(), this.afterCommand();
2494
3183
  }
2495
3184
  outdent() {
2496
- Be(), this.afterCommand();
3185
+ ze(), this.afterCommand();
2497
3186
  }
2498
3187
  insertUL() {
2499
- We(), this.afterCommand();
3188
+ Ue(), this.afterCommand();
2500
3189
  }
2501
3190
  insertOL() {
2502
- Ge(), this.afterCommand();
3191
+ We(), this.afterCommand();
2503
3192
  }
2504
3193
  inlineCode() {
2505
- qe(this.context.layoutInfo.editable), this.afterCommand();
3194
+ Ke(this.context.layoutInfo.editable), this.afterCommand();
2506
3195
  }
2507
3196
  toggleChecklist() {
2508
3197
  Xe(), this.afterCommand();
@@ -2511,12 +3200,12 @@ var Un = class {
2511
3200
  this.context.print();
2512
3201
  }
2513
3202
  formatBlock(e) {
2514
- if (Pe(e), e === "pre") {
3203
+ if (Ne(e), e === "pre") {
2515
3204
  let e = globalThis.getSelection();
2516
3205
  if (e?.rangeCount > 0) {
2517
3206
  let t = e.getRangeAt(0).commonAncestorContainer, n = t.nodeType === 1 ? t.closest("pre") : t.parentElement?.closest("pre");
2518
3207
  if (n && !n.dataset.language) {
2519
- let e = Hn(n.textContent || "");
3208
+ let e = ur(n.textContent || "");
2520
3209
  if (e) {
2521
3210
  this.context.invoke("codeTooltip.applyLanguage", n, e);
2522
3211
  return;
@@ -2527,55 +3216,55 @@ var Un = class {
2527
3216
  this.afterCommand();
2528
3217
  }
2529
3218
  foreColor(e) {
2530
- Ae(e), this.afterCommand();
3219
+ ke(e), this.afterCommand();
2531
3220
  }
2532
3221
  backColor(e) {
2533
- je(e), this.afterCommand();
3222
+ Ae(e), this.afterCommand();
2534
3223
  }
2535
3224
  fontName(e) {
2536
- Me(e), this.afterCommand();
3225
+ je(e), this.afterCommand();
2537
3226
  }
2538
3227
  fontSize(e) {
2539
- Ne(e, this.context.layoutInfo.editable), this.afterCommand();
3228
+ Me(e, this.context.layoutInfo.editable), this.afterCommand();
2540
3229
  }
2541
3230
  insertHr() {
2542
- D("insertHorizontalRule"), this.afterCommand();
3231
+ O("insertHorizontalRule"), this.afterCommand();
2543
3232
  }
2544
3233
  insertLink(e, t, n = !1) {
2545
3234
  let r = globalThis.getSelection();
2546
3235
  if (!r || r.rangeCount === 0) return;
2547
- let i = N(e);
3236
+ let i = sn(e);
2548
3237
  if (i) {
2549
3238
  if (r.toString().trim().length > 0) {
2550
- if (D("createLink", i), n) {
3239
+ if (O("createLink", i), n) {
2551
3240
  let e = this._getClosestAnchor();
2552
3241
  e && (e.setAttribute("target", "_blank"), e.setAttribute("rel", "noopener noreferrer"));
2553
3242
  }
2554
3243
  } else {
2555
3244
  let e = this._escapeAttr(t || i);
2556
- D("insertHTML", `<a href="${this._escapeAttr(i)}"${n ? " target=\"_blank\" rel=\"noopener noreferrer\"" : ""}>${e}</a>`);
3245
+ O("insertHTML", `<a href="${this._escapeAttr(i)}"${n ? " target=\"_blank\" rel=\"noopener noreferrer\"" : ""}>${e}</a>`);
2557
3246
  }
2558
3247
  this.afterCommand();
2559
3248
  }
2560
3249
  }
2561
3250
  unlink() {
2562
- D("unlink"), this.afterCommand();
3251
+ O("unlink"), this.afterCommand();
2563
3252
  }
2564
3253
  insertImage(e, t = "", n = "") {
2565
- let r = N(e, { allowData: !0 });
3254
+ let r = sn(e, { allowData: !0 });
2566
3255
  if (!r) return;
2567
3256
  let i = {
2568
3257
  left: "float:left;margin:0 1em 1em 0",
2569
3258
  center: "display:block;margin:0 auto",
2570
3259
  right: "float:right;margin:0 0 1em 1em"
2571
3260
  }[n] || "", a = i ? ` style="${i}"` : "";
2572
- D("insertHTML", `<img src="${this._escapeAttr(r)}" alt="${this._escapeAttr(t)}" class="an-image"${a}>`), this.afterCommand();
3261
+ O("insertHTML", `<img src="${this._escapeAttr(r)}" alt="${this._escapeAttr(t)}" class="an-image"${a}>`), this.afterCommand();
2573
3262
  }
2574
3263
  insertVideo(e) {
2575
- e && (D("insertHTML", e), this.afterCommand());
3264
+ e && (O("insertHTML", e), this.afterCommand());
2576
3265
  }
2577
3266
  insertTable(e, t) {
2578
- dn(e, t, { headerRow: this.context.options.tableHeaderRow }), this.afterCommand();
3267
+ fn(e, t, { headerRow: this.context.options.tableHeaderRow }), this.afterCommand();
2579
3268
  }
2580
3269
  _getClosestAnchor() {
2581
3270
  let e = globalThis.getSelection();
@@ -2590,44 +3279,44 @@ var Un = class {
2590
3279
  _escapeAttr(e) {
2591
3280
  return String(e ?? "").replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
2592
3281
  }
2593
- }, Wn = (e) => typeof e == "string" ? et(e) : e, Gn = null, Kn = "stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"", B = (e) => `<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" ${Kn} style="display:block">${e}</svg>`, V = /* @__PURE__ */ new Map([
2594
- ["bold", B("<path d=\"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z\"/><path d=\"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z\"/>")],
2595
- ["italic", B("<line x1=\"19\" y1=\"4\" x2=\"10\" y2=\"4\"/><line x1=\"14\" y1=\"20\" x2=\"5\" y2=\"20\"/><line x1=\"15\" y1=\"4\" x2=\"9\" y2=\"20\"/>")],
2596
- ["underline", B("<path d=\"M6 3v7a6 6 0 0 0 6 6 6 6 0 0 0 6-6V3\"/><line x1=\"4\" y1=\"21\" x2=\"20\" y2=\"21\"/>")],
2597
- ["strikethrough", B("<path d=\"M17.3 12H6.7\"/><path d=\"M10 6.5C10 5.1 11.1 4 12.5 4c1.4 0 2.5 1.1 2.5 2.5 0 .8-.4 1.5-1 2\"/><path d=\"M14 17.5C14 19 12.9 20 11.5 20 10.1 20 9 18.9 9 17.5c0-.8.4-1.5 1-2\"/>")],
2598
- ["superscript", B("<path d=\"m4 19 8-8\"/><path d=\"m12 19-8-8\"/><path d=\"M20 12h-4c0-1.5.44-2 1.5-2.5S20 8.33 20 7.25C20 6 19 5 17.5 5S15 6 15 7\"/>")],
2599
- ["subscript", B("<path d=\"m4 5 8 8\"/><path d=\"m12 5-8 8\"/><path d=\"M20 21h-4c0-1.5.44-2 1.5-2.5S20 17.33 20 16.25C20 15 19 14 17.5 14S15 15 15 16\"/>")],
2600
- ["align-left", B("<line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"/><line x1=\"15\" y1=\"12\" x2=\"3\" y2=\"12\"/><line x1=\"17\" y1=\"18\" x2=\"3\" y2=\"18\"/>")],
2601
- ["align-center", B("<line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"/><line x1=\"18\" y1=\"12\" x2=\"6\" y2=\"12\"/><line x1=\"21\" y1=\"18\" x2=\"3\" y2=\"18\"/>")],
2602
- ["align-right", B("<line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"/><line x1=\"21\" y1=\"12\" x2=\"9\" y2=\"12\"/><line x1=\"21\" y1=\"18\" x2=\"7\" y2=\"18\"/>")],
2603
- ["align-justify", B("<line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"/><line x1=\"21\" y1=\"12\" x2=\"3\" y2=\"12\"/><line x1=\"21\" y1=\"18\" x2=\"3\" y2=\"18\"/>")],
2604
- ["list-ul", B("<line x1=\"9\" y1=\"6\" x2=\"20\" y2=\"6\"/><line x1=\"9\" y1=\"12\" x2=\"20\" y2=\"12\"/><line x1=\"9\" y1=\"18\" x2=\"20\" y2=\"18\"/><circle cx=\"4\" cy=\"6\" r=\"1\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"4\" cy=\"12\" r=\"1\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"4\" cy=\"18\" r=\"1\" fill=\"currentColor\" stroke=\"none\"/>")],
2605
- ["list-ol", B("<line x1=\"10\" y1=\"6\" x2=\"21\" y2=\"6\"/><line x1=\"10\" y1=\"12\" x2=\"21\" y2=\"12\"/><line x1=\"10\" y1=\"18\" x2=\"21\" y2=\"18\"/><path d=\"M4 6h1V3\"/><path d=\"M4 10h2l-2 2h2\"/><path d=\"M4 16.5A1.5 1.5 0 0 1 5.5 15a1.5 1.5 0 0 1 0 3H4\"/>")],
2606
- ["indent", B("<polyline points=\"3 8 7 12 3 16\"/><line x1=\"21\" y1=\"12\" x2=\"11\" y2=\"12\"/><line x1=\"21\" y1=\"6\" x2=\"11\" y2=\"6\"/><line x1=\"21\" y1=\"18\" x2=\"11\" y2=\"18\"/>")],
2607
- ["outdent", B("<polyline points=\"7 8 3 12 7 16\"/><line x1=\"21\" y1=\"12\" x2=\"11\" y2=\"12\"/><line x1=\"21\" y1=\"6\" x2=\"11\" y2=\"6\"/><line x1=\"21\" y1=\"18\" x2=\"11\" y2=\"18\"/>")],
2608
- ["undo", B("<path d=\"M3 7v6h6\"/><path d=\"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13\"/>")],
2609
- ["redo", B("<path d=\"M21 7v6h-6\"/><path d=\"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3L21 13\"/>")],
2610
- ["minus", B("<line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/>")],
2611
- ["link", B("<path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"/><path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"/>")],
2612
- ["image", B("<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><circle cx=\"8.5\" cy=\"8.5\" r=\"1.5\"/><polyline points=\"21 15 16 10 5 21\"/>")],
2613
- ["video", B("<polygon points=\"23 7 16 12 23 17 23 7\"/><rect x=\"1\" y=\"5\" width=\"15\" height=\"14\" rx=\"2\"/>")],
2614
- ["table", B("<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"1\"/><line x1=\"3\" y1=\"9\" x2=\"21\" y2=\"9\"/><line x1=\"3\" y1=\"15\" x2=\"21\" y2=\"15\"/><line x1=\"9\" y1=\"3\" x2=\"9\" y2=\"21\"/><line x1=\"15\" y1=\"3\" x2=\"15\" y2=\"21\"/>")],
2615
- ["emoji", B("<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M8.5 14.5s1.5 2.5 3.5 2.5 3.5-2.5 3.5-2.5\"/><circle cx=\"9\" cy=\"9\" r=\"1.5\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"15\" cy=\"9\" r=\"1.5\" fill=\"currentColor\" stroke=\"none\"/>")],
2616
- ["icon", B("<circle cx=\"8\" cy=\"8\" r=\"3\"/><circle cx=\"16\" cy=\"8\" r=\"3\"/><rect x=\"5\" y=\"13\" width=\"6\" height=\"6\" rx=\"1\"/><rect x=\"13\" y=\"13\" width=\"6\" height=\"6\" rx=\"1\"/>")],
2617
- ["code", B("<polyline points=\"16 18 22 12 16 6\"/><polyline points=\"8 6 2 12 8 18\"/>")],
2618
- ["expand", B("<polyline points=\"15 3 21 3 21 9\"/><polyline points=\"9 21 3 21 3 15\"/><line x1=\"21\" y1=\"3\" x2=\"14\" y2=\"10\"/><line x1=\"3\" y1=\"21\" x2=\"10\" y2=\"14\"/>")],
2619
- ["foreColor", B("<path d=\"M4 20L12 4L20 20\"/><line x1=\"7.5\" y1=\"14\" x2=\"16.5\" y2=\"14\"/>")],
2620
- ["backColor", B("<path d=\"M3 21v-4l9-9 4 4-9 9z\"/><path d=\"M12 8l4 4\"/>")],
2621
- ["keyboard", B("<rect x=\"2\" y=\"6\" width=\"20\" height=\"12\" rx=\"2\"/><line x1=\"6\" y1=\"10\" x2=\"6\" y2=\"10\" stroke-width=\"2.5\"/><line x1=\"10\" y1=\"10\" x2=\"10\" y2=\"10\" stroke-width=\"2.5\"/><line x1=\"14\" y1=\"10\" x2=\"14\" y2=\"10\" stroke-width=\"2.5\"/><line x1=\"18\" y1=\"10\" x2=\"18\" y2=\"10\" stroke-width=\"2.5\"/><line x1=\"8\" y1=\"14\" x2=\"16\" y2=\"14\" stroke-width=\"2\"/>")],
2622
- ["caption", B("<rect x=\"3\" y=\"3\" width=\"18\" height=\"11\" rx=\"2\"/><line x1=\"6\" y1=\"18\" x2=\"18\" y2=\"18\"/><line x1=\"9\" y1=\"21\" x2=\"15\" y2=\"21\"/>")],
2623
- ["remove-format", B("<path d=\"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21\"/><path d=\"M22 21H7\"/><path d=\"m5 11 9 9\"/>")],
2624
- ["direction", B("<path d=\"M12 20V4\"/><path d=\"m9 7-3 3 3 3\"/><path d=\"M4 10h8\"/><path d=\"m15 7 3 3-3 3\"/><path d=\"M20 10h-8\"/>")],
2625
- ["search", B("<circle cx=\"11\" cy=\"11\" r=\"7\"/><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"/>")],
2626
- ["find-replace", B("<circle cx=\"10\" cy=\"10\" r=\"6\"/><line x1=\"18\" y1=\"18\" x2=\"14.35\" y2=\"14.35\"/><path d=\"M16 19h6\"/><path d=\"M19 16v6\"/>")],
2627
- ["inline-code", B("<path d=\"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1\"/><path d=\"M16 3h1a2 2 0 0 1 2 2v5c0 1.1.9 2 2 2a2 2 0 0 1-2 2v5a2 2 0 0 1-2 2h-1\"/>")],
2628
- ["checklist", B("<rect x=\"3\" y=\"4\" width=\"5\" height=\"5\" rx=\"1\"/><path d=\"m4 6.5 1 1 2-2\"/><rect x=\"3\" y=\"13\" width=\"5\" height=\"5\" rx=\"1\"/><line x1=\"10\" y1=\"6.5\" x2=\"21\" y2=\"6.5\"/><line x1=\"10\" y1=\"15.5\" x2=\"21\" y2=\"15.5\"/>")],
2629
- ["print", B("<path d=\"M6 9V2h12v7\"/><path d=\"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2\"/><rect x=\"6\" y=\"14\" width=\"12\" height=\"8\"/>")]
2630
- ]), qn = /* @__PURE__ */ new Map([
3282
+ }, fr = (e) => typeof e == "string" ? et(e) : e, pr = null, mr = "stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"", V = (e) => `<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" ${mr} style="display:block">${e}</svg>`, H = /* @__PURE__ */ new Map([
3283
+ ["bold", V("<path d=\"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z\"/><path d=\"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z\"/>")],
3284
+ ["italic", V("<line x1=\"19\" y1=\"4\" x2=\"10\" y2=\"4\"/><line x1=\"14\" y1=\"20\" x2=\"5\" y2=\"20\"/><line x1=\"15\" y1=\"4\" x2=\"9\" y2=\"20\"/>")],
3285
+ ["underline", V("<path d=\"M6 3v7a6 6 0 0 0 6 6 6 6 0 0 0 6-6V3\"/><line x1=\"4\" y1=\"21\" x2=\"20\" y2=\"21\"/>")],
3286
+ ["strikethrough", V("<path d=\"M17.3 12H6.7\"/><path d=\"M10 6.5C10 5.1 11.1 4 12.5 4c1.4 0 2.5 1.1 2.5 2.5 0 .8-.4 1.5-1 2\"/><path d=\"M14 17.5C14 19 12.9 20 11.5 20 10.1 20 9 18.9 9 17.5c0-.8.4-1.5 1-2\"/>")],
3287
+ ["superscript", V("<path d=\"m4 19 8-8\"/><path d=\"m12 19-8-8\"/><path d=\"M20 12h-4c0-1.5.44-2 1.5-2.5S20 8.33 20 7.25C20 6 19 5 17.5 5S15 6 15 7\"/>")],
3288
+ ["subscript", V("<path d=\"m4 5 8 8\"/><path d=\"m12 5-8 8\"/><path d=\"M20 21h-4c0-1.5.44-2 1.5-2.5S20 17.33 20 16.25C20 15 19 14 17.5 14S15 15 15 16\"/>")],
3289
+ ["align-left", V("<line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"/><line x1=\"15\" y1=\"12\" x2=\"3\" y2=\"12\"/><line x1=\"17\" y1=\"18\" x2=\"3\" y2=\"18\"/>")],
3290
+ ["align-center", V("<line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"/><line x1=\"18\" y1=\"12\" x2=\"6\" y2=\"12\"/><line x1=\"21\" y1=\"18\" x2=\"3\" y2=\"18\"/>")],
3291
+ ["align-right", V("<line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"/><line x1=\"21\" y1=\"12\" x2=\"9\" y2=\"12\"/><line x1=\"21\" y1=\"18\" x2=\"7\" y2=\"18\"/>")],
3292
+ ["align-justify", V("<line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"/><line x1=\"21\" y1=\"12\" x2=\"3\" y2=\"12\"/><line x1=\"21\" y1=\"18\" x2=\"3\" y2=\"18\"/>")],
3293
+ ["list-ul", V("<line x1=\"9\" y1=\"6\" x2=\"20\" y2=\"6\"/><line x1=\"9\" y1=\"12\" x2=\"20\" y2=\"12\"/><line x1=\"9\" y1=\"18\" x2=\"20\" y2=\"18\"/><circle cx=\"4\" cy=\"6\" r=\"1\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"4\" cy=\"12\" r=\"1\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"4\" cy=\"18\" r=\"1\" fill=\"currentColor\" stroke=\"none\"/>")],
3294
+ ["list-ol", V("<line x1=\"10\" y1=\"6\" x2=\"21\" y2=\"6\"/><line x1=\"10\" y1=\"12\" x2=\"21\" y2=\"12\"/><line x1=\"10\" y1=\"18\" x2=\"21\" y2=\"18\"/><path d=\"M4 6h1V3\"/><path d=\"M4 10h2l-2 2h2\"/><path d=\"M4 16.5A1.5 1.5 0 0 1 5.5 15a1.5 1.5 0 0 1 0 3H4\"/>")],
3295
+ ["indent", V("<polyline points=\"3 8 7 12 3 16\"/><line x1=\"21\" y1=\"12\" x2=\"11\" y2=\"12\"/><line x1=\"21\" y1=\"6\" x2=\"11\" y2=\"6\"/><line x1=\"21\" y1=\"18\" x2=\"11\" y2=\"18\"/>")],
3296
+ ["outdent", V("<polyline points=\"7 8 3 12 7 16\"/><line x1=\"21\" y1=\"12\" x2=\"11\" y2=\"12\"/><line x1=\"21\" y1=\"6\" x2=\"11\" y2=\"6\"/><line x1=\"21\" y1=\"18\" x2=\"11\" y2=\"18\"/>")],
3297
+ ["undo", V("<path d=\"M3 7v6h6\"/><path d=\"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13\"/>")],
3298
+ ["redo", V("<path d=\"M21 7v6h-6\"/><path d=\"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3L21 13\"/>")],
3299
+ ["minus", V("<line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/>")],
3300
+ ["link", V("<path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"/><path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"/>")],
3301
+ ["image", V("<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><circle cx=\"8.5\" cy=\"8.5\" r=\"1.5\"/><polyline points=\"21 15 16 10 5 21\"/>")],
3302
+ ["video", V("<polygon points=\"23 7 16 12 23 17 23 7\"/><rect x=\"1\" y=\"5\" width=\"15\" height=\"14\" rx=\"2\"/>")],
3303
+ ["table", V("<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"1\"/><line x1=\"3\" y1=\"9\" x2=\"21\" y2=\"9\"/><line x1=\"3\" y1=\"15\" x2=\"21\" y2=\"15\"/><line x1=\"9\" y1=\"3\" x2=\"9\" y2=\"21\"/><line x1=\"15\" y1=\"3\" x2=\"15\" y2=\"21\"/>")],
3304
+ ["emoji", V("<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M8.5 14.5s1.5 2.5 3.5 2.5 3.5-2.5 3.5-2.5\"/><circle cx=\"9\" cy=\"9\" r=\"1.5\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"15\" cy=\"9\" r=\"1.5\" fill=\"currentColor\" stroke=\"none\"/>")],
3305
+ ["icon", V("<circle cx=\"8\" cy=\"8\" r=\"3\"/><circle cx=\"16\" cy=\"8\" r=\"3\"/><rect x=\"5\" y=\"13\" width=\"6\" height=\"6\" rx=\"1\"/><rect x=\"13\" y=\"13\" width=\"6\" height=\"6\" rx=\"1\"/>")],
3306
+ ["code", V("<polyline points=\"16 18 22 12 16 6\"/><polyline points=\"8 6 2 12 8 18\"/>")],
3307
+ ["expand", V("<polyline points=\"15 3 21 3 21 9\"/><polyline points=\"9 21 3 21 3 15\"/><line x1=\"21\" y1=\"3\" x2=\"14\" y2=\"10\"/><line x1=\"3\" y1=\"21\" x2=\"10\" y2=\"14\"/>")],
3308
+ ["foreColor", V("<path d=\"M4 20L12 4L20 20\"/><line x1=\"7.5\" y1=\"14\" x2=\"16.5\" y2=\"14\"/>")],
3309
+ ["backColor", V("<path d=\"M3 21v-4l9-9 4 4-9 9z\"/><path d=\"M12 8l4 4\"/>")],
3310
+ ["keyboard", V("<rect x=\"2\" y=\"6\" width=\"20\" height=\"12\" rx=\"2\"/><line x1=\"6\" y1=\"10\" x2=\"6\" y2=\"10\" stroke-width=\"2.5\"/><line x1=\"10\" y1=\"10\" x2=\"10\" y2=\"10\" stroke-width=\"2.5\"/><line x1=\"14\" y1=\"10\" x2=\"14\" y2=\"10\" stroke-width=\"2.5\"/><line x1=\"18\" y1=\"10\" x2=\"18\" y2=\"10\" stroke-width=\"2.5\"/><line x1=\"8\" y1=\"14\" x2=\"16\" y2=\"14\" stroke-width=\"2\"/>")],
3311
+ ["caption", V("<rect x=\"3\" y=\"3\" width=\"18\" height=\"11\" rx=\"2\"/><line x1=\"6\" y1=\"18\" x2=\"18\" y2=\"18\"/><line x1=\"9\" y1=\"21\" x2=\"15\" y2=\"21\"/>")],
3312
+ ["remove-format", V("<path d=\"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21\"/><path d=\"M22 21H7\"/><path d=\"m5 11 9 9\"/>")],
3313
+ ["direction", V("<path d=\"M12 20V4\"/><path d=\"m9 7-3 3 3 3\"/><path d=\"M4 10h8\"/><path d=\"m15 7 3 3-3 3\"/><path d=\"M20 10h-8\"/>")],
3314
+ ["search", V("<circle cx=\"11\" cy=\"11\" r=\"7\"/><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"/>")],
3315
+ ["find-replace", V("<circle cx=\"10\" cy=\"10\" r=\"6\"/><line x1=\"18\" y1=\"18\" x2=\"14.35\" y2=\"14.35\"/><path d=\"M16 19h6\"/><path d=\"M19 16v6\"/>")],
3316
+ ["inline-code", V("<path d=\"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1\"/><path d=\"M16 3h1a2 2 0 0 1 2 2v5c0 1.1.9 2 2 2a2 2 0 0 1-2 2v5a2 2 0 0 1-2 2h-1\"/>")],
3317
+ ["checklist", V("<rect x=\"3\" y=\"4\" width=\"5\" height=\"5\" rx=\"1\"/><path d=\"m4 6.5 1 1 2-2\"/><rect x=\"3\" y=\"13\" width=\"5\" height=\"5\" rx=\"1\"/><line x1=\"10\" y1=\"6.5\" x2=\"21\" y2=\"6.5\"/><line x1=\"10\" y1=\"15.5\" x2=\"21\" y2=\"15.5\"/>")],
3318
+ ["print", V("<path d=\"M6 9V2h12v7\"/><path d=\"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2\"/><rect x=\"6\" y=\"14\" width=\"12\" height=\"8\"/>")]
3319
+ ]), hr = /* @__PURE__ */ new Map([
2631
3320
  ["bold", "fa-bold"],
2632
3321
  ["italic", "fa-italic"],
2633
3322
  ["underline", "fa-underline"],
@@ -2661,7 +3350,7 @@ var Un = class {
2661
3350
  ["inline-code", "fa-code"],
2662
3351
  ["checklist", "fa-list-check"],
2663
3352
  ["print", "fa-print"]
2664
- ]), Jn = class {
3353
+ ]), gr = class {
2665
3354
  constructor(e) {
2666
3355
  this.context = e, this.options = e.options, this.el = null, this._disposers = [], this._colorPickerClosers = [], this._refreshRaf = null;
2667
3356
  }
@@ -2671,7 +3360,7 @@ var Un = class {
2671
3360
  role: "toolbar",
2672
3361
  "aria-orientation": "horizontal",
2673
3362
  "aria-label": "Editor toolbar"
2674
- }), this._faReady = this._detectFontAwesome(), this._buildButtons(), this._initRovingFocus(), this._btnMap = new Map((this.options.toolbar || []).flat().map(Wn).filter(Boolean).map((e) => [e.name, e])), this;
3363
+ }), this._faReady = this._detectFontAwesome(), this._buildButtons(), this._initRovingFocus(), this._btnMap = new Map((this.options.toolbar || []).flat().map(fr).filter(Boolean).map((e) => [e.name, e])), this;
2675
3364
  }
2676
3365
  destroy() {
2677
3366
  this._refreshRaf && cancelAnimationFrame(this._refreshRaf), this._refreshRaf = null, this._disposers.forEach((e) => e()), this._disposers = [], this.el?.parentNode && this.el.remove(), this.el = null;
@@ -2681,7 +3370,7 @@ var Un = class {
2681
3370
  e.forEach((e) => {
2682
3371
  let n = w("div", { class: "an-btn-group" });
2683
3372
  e.forEach((e) => {
2684
- let t = Wn(e);
3373
+ let t = fr(e);
2685
3374
  if (!t) {
2686
3375
  console.warn(`[AutumnNote] Toolbar: button "${e}" not found in registry. Skipped.`);
2687
3376
  return;
@@ -2900,9 +3589,9 @@ var Un = class {
2900
3589
  ...typeof e.isActive == "function" ? { "aria-pressed": "false" } : {}
2901
3590
  }), n = this.options.fontAwesomeClass || "fas";
2902
3591
  if (this._faReady) {
2903
- let r = qn.get(e.icon) || qn.get(e.name) || null;
2904
- r ? t.innerHTML = `<i class="${n} ${r}" aria-hidden="true"></i>` : V.has(e.icon) ? t.innerHTML = V.get(e.icon) : t.textContent = e.icon || e.name;
2905
- } else V.has(e.icon) ? t.innerHTML = V.get(e.icon) : V.has(e.name) ? t.innerHTML = V.get(e.name) : t.textContent = e.icon || e.name;
3592
+ let r = hr.get(e.icon) || hr.get(e.name) || null;
3593
+ r ? t.innerHTML = `<i class="${n} ${r}" aria-hidden="true"></i>` : H.has(e.icon) ? t.innerHTML = H.get(e.icon) : t.textContent = e.icon || e.name;
3594
+ } else H.has(e.icon) ? t.innerHTML = H.get(e.icon) : H.has(e.name) ? t.innerHTML = H.get(e.name) : t.textContent = e.icon || e.name;
2906
3595
  let r = E(t, "click", (t) => {
2907
3596
  t.preventDefault(), this.context.invoke("editor.focus"), e.action(this.context), this.context.invoke("editor.afterCommand"), this.refresh();
2908
3597
  });
@@ -2946,10 +3635,10 @@ var Un = class {
2946
3635
  }
2947
3636
  _detectFontAwesome() {
2948
3637
  if (!this.options.useFontAwesome) return !1;
2949
- if (Gn !== null) return Gn;
2950
- if (document.querySelector(".fa, .fas, .far, .fal, .fab, .fa-solid")) return Gn = !0, !0;
3638
+ if (pr !== null) return pr;
3639
+ if (document.querySelector(".fa, .fas, .far, .fal, .fab, .fa-solid")) return pr = !0, !0;
2951
3640
  let e = Array.from(document.querySelectorAll("link[rel=\"stylesheet\"]")).filter((e) => e.id !== "an-fontawesome-css").map((e) => e.href || "").join(" ");
2952
- return Gn = /fontawesome|font-awesome|use\.fontawesome|all\.css/.test(e), Gn;
3641
+ return pr = /fontawesome|font-awesome|use\.fontawesome|all\.css/.test(e), pr;
2953
3642
  }
2954
3643
  refresh() {
2955
3644
  this._refreshRaf && cancelAnimationFrame(this._refreshRaf), this._refreshRaf = requestAnimationFrame(() => {
@@ -2982,27 +3671,27 @@ var Un = class {
2982
3671
  this.el && (this.el.style.display = "none");
2983
3672
  }
2984
3673
  rebuild() {
2985
- this._refreshRaf &&= (cancelAnimationFrame(this._refreshRaf), null), this._disposers.forEach((e) => e()), this._disposers = [], this.el && (this.el.innerHTML = ""), this._faReady = this._detectFontAwesome(), this._buildButtons(), this._initRovingFocus(), this._btnMap = new Map((this.options.toolbar || []).flat().map(Wn).filter(Boolean).map((e) => [e.name, e])), this.refresh();
3674
+ this._refreshRaf &&= (cancelAnimationFrame(this._refreshRaf), null), this._disposers.forEach((e) => e()), this._disposers = [], this.el && (this.el.innerHTML = ""), this._faReady = this._detectFontAwesome(), this._buildButtons(), this._initRovingFocus(), this._btnMap = new Map((this.options.toolbar || []).flat().map(fr).filter(Boolean).map((e) => [e.name, e])), this.refresh();
2986
3675
  }
2987
- }, Yn = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "word" }) : null;
2988
- function Xn(e) {
3676
+ }, _r = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "word" }) : null;
3677
+ function vr(e) {
2989
3678
  let t = e.trim();
2990
3679
  if (!t) return 0;
2991
- if (Yn) {
3680
+ if (_r) {
2992
3681
  let e = 0;
2993
- for (let n of Yn.segment(t)) n.isWordLike && e++;
3682
+ for (let n of _r.segment(t)) n.isWordLike && e++;
2994
3683
  return e;
2995
3684
  }
2996
3685
  return t.split(/\s+/).length;
2997
3686
  }
2998
- function Zn(e, t, n) {
3687
+ function yr(e, t, n) {
2999
3688
  if (!n) {
3000
3689
  e.classList.remove("an-count-warn", "an-count-exceeded");
3001
3690
  return;
3002
3691
  }
3003
3692
  t > n ? (e.classList.add("an-count-exceeded"), e.classList.remove("an-count-warn")) : t >= n * .9 ? (e.classList.add("an-count-warn"), e.classList.remove("an-count-exceeded")) : e.classList.remove("an-count-warn", "an-count-exceeded");
3004
3693
  }
3005
- var Qn = class {
3694
+ var br = class {
3006
3695
  constructor(e) {
3007
3696
  this.context = e, this.options = e.options, this.el = null, this._disposers = [], this._wordCountEl = null, this._charCountEl = null;
3008
3697
  }
@@ -3055,17 +3744,17 @@ var Qn = class {
3055
3744
  }
3056
3745
  update() {
3057
3746
  if (!this._wordCountEl || !this._charCountEl) return;
3058
- let e = this.context.layoutInfo.editable.textContent || "", t = Xn(e), n = e.replaceAll("\n", "").length, r = this.options.maxWords || 0, i = this.options.maxChars || 0, a = this.context.locale.statusbar;
3059
- this._wordCountEl.textContent = r ? a.wordsLimit(t, r) : a.words(t), this._charCountEl.textContent = i ? a.charsLimit(n, i) : a.chars(n), Zn(this._wordCountEl, t, r), Zn(this._charCountEl, n, i);
3747
+ let e = this.context.layoutInfo.editable.textContent || "", t = vr(e), n = e.replaceAll("\n", "").length, r = this.options.maxWords || 0, i = this.options.maxChars || 0, a = this.context.locale.statusbar;
3748
+ this._wordCountEl.textContent = r ? a.wordsLimit(t, r) : a.words(t), this._charCountEl.textContent = i ? a.charsLimit(n, i) : a.chars(n), yr(this._wordCountEl, t, r), yr(this._charCountEl, n, i);
3060
3749
  }
3061
3750
  getWordCount() {
3062
3751
  let e = this.context.layoutInfo.editable;
3063
- return Xn(e.innerText || "");
3752
+ return vr(e.innerText || "");
3064
3753
  }
3065
3754
  getCharCount() {
3066
3755
  return (this.context.layoutInfo.editable.innerText || "").replaceAll("\n", "").length;
3067
3756
  }
3068
- }, $n = class {
3757
+ }, xr = class {
3069
3758
  constructor(e) {
3070
3759
  this.context = e, this.options = e.options, this._disposers = [];
3071
3760
  }
@@ -3177,20 +3866,20 @@ var Qn = class {
3177
3866
  text: t.getData("text/plain") || "",
3178
3867
  html: t.types.includes("text/html") ? t.getData("text/html") : null
3179
3868
  }), n || this.options.pasteAsPlainText) {
3180
- e.preventDefault(), D("insertHTML", t.getData("text/plain").split(/\r?\n/).map((e) => `<p>${this._escapeHTML(e) || "<br>"}</p>`).join("")), this.context.invoke("editor.afterCommand");
3869
+ e.preventDefault(), O("insertHTML", t.getData("text/plain").split(/\r?\n/).map((e) => `<p>${this._escapeHTML(e) || "<br>"}</p>`).join("")), this.context.invoke("editor.afterCommand");
3181
3870
  return;
3182
3871
  }
3183
3872
  if (this.options.markdownPaste !== !1) {
3184
3873
  let n = t.types.includes("text/html"), r = n ? t.getData("text/html") : "", i = !n || this._isTriviallyPlainHtml(r), a = t.getData("text/plain");
3185
- if (a && i && yn(a)) {
3186
- e.preventDefault(), D("insertHTML", M(Cn(a))), this.context.invoke("editor.afterCommand");
3874
+ if (a && i && En(a)) {
3875
+ e.preventDefault(), O("insertHTML", M(Pn(a))), this.context.invoke("editor.afterCommand");
3187
3876
  return;
3188
3877
  }
3189
3878
  }
3190
3879
  if (this.options.pasteCleanHTML !== !1 && t.types.includes("text/html")) {
3191
3880
  e.preventDefault();
3192
3881
  let n = t.getData("text/html"), r = /<[a-z]+:[a-z]/i.test(n) || /class="Mso/i.test(n) || /\bmso-/i.test(n), i = /class="[^"]*\b(?:x[a-z0-9]{6,}|r-[a-z0-9]{3,})\b/.test(n), a = n;
3193
- r ? a = this._cleanWordHtml(a) : i && (a = this._cleanSocialHtml(a)), a = this._normalizeExternalTaskLists(a), a = M(a), this.options.pasteStripAttributes && (a = this._stripAttributes(a)), D("insertHTML", a), this.context.invoke("editor.afterCommand");
3882
+ r ? a = this._cleanWordHtml(a) : i && (a = this._cleanSocialHtml(a)), a = this._normalizeExternalTaskLists(a), a = M(a), this.options.pasteStripAttributes && (a = this._stripAttributes(a)), O("insertHTML", a), this.context.invoke("editor.afterCommand");
3194
3883
  }
3195
3884
  }
3196
3885
  _onDragover(e) {
@@ -3222,7 +3911,7 @@ var Qn = class {
3222
3911
  }
3223
3912
  let n = new FileReader();
3224
3913
  n.onload = (e) => {
3225
- D("insertHTML", M(Cn(e.target.result || ""))), this.context.invoke("editor.afterCommand");
3914
+ O("insertHTML", M(Pn(e.target.result || ""))), this.context.invoke("editor.afterCommand");
3226
3915
  }, n.onerror = () => {
3227
3916
  let t = `Failed to read dropped markdown file "${e.name}".`;
3228
3917
  console.warn(`[AutumnNote] ${t}`), this.context.triggerEvent("pasteError", { message: t });
@@ -3324,7 +4013,7 @@ var Qn = class {
3324
4013
  _escapeHTML(e) {
3325
4014
  return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&#039;");
3326
4015
  }
3327
- }, er = class {
4016
+ }, Sr = class {
3328
4017
  constructor(e) {
3329
4018
  this.context = e, this.options = e.options, this._disposers = [];
3330
4019
  }
@@ -3341,7 +4030,7 @@ var Qn = class {
3341
4030
  let e = this.context.layoutInfo.editable, t = document.activeElement === e, n = !(e.textContent.replaceAll("​", "").trim().length > 0) && !e.querySelector("img, table, hr, .an-video-wrapper");
3342
4031
  e.classList.toggle("an-placeholder", n && !t);
3343
4032
  }
3344
- }, tr = class {
4033
+ }, Cr = class {
3345
4034
  constructor(e) {
3346
4035
  this.context = e, this.options = e.options, this._active = !1, this._textarea = null, this._disposers = [];
3347
4036
  }
@@ -3386,13 +4075,13 @@ var Qn = class {
3386
4075
  return /^<[^/!][^>]*[^/]>/.test(r) && !t.test(r) && !/^<(br|hr|img|input|link|meta)/.test(r) && n++, i;
3387
4076
  }).filter(Boolean).join("\n");
3388
4077
  }
3389
- }, nr = class {
4078
+ }, wr = class {
3390
4079
  constructor(e) {
3391
4080
  this.context = e, this._active = !1, this._disposers = [], this._prevHeight = "";
3392
4081
  }
3393
4082
  initialize() {
3394
4083
  let e = E(document, "keydown", (e) => {
3395
- this._active && F(e, P.ESCAPE) && this.deactivate();
4084
+ this._active && P(e, N.ESCAPE) && this.deactivate();
3396
4085
  });
3397
4086
  return this._disposers.push(e), this;
3398
4087
  }
@@ -3415,7 +4104,7 @@ var Qn = class {
3415
4104
  let e = this.context.layoutInfo.container;
3416
4105
  e.classList.remove("an-fullscreen"), e.style.height = this._prevHeight, document.body.style.overflow = "", this._active = !1, this.context.invoke("toolbar.refresh");
3417
4106
  }
3418
- }, H = class {
4107
+ }, U = class {
3419
4108
  constructor(e) {
3420
4109
  this.context = e, this.options = e.options, this._dialog = null, this._disposers = [], this._savedRange = null, this._firstInput = null, this._removeTrap = null;
3421
4110
  }
@@ -3429,7 +4118,7 @@ var Qn = class {
3429
4118
  this._disposers.forEach((e) => e()), this._disposers = [], this._dialog?.parentNode && this._dialog.remove(), this._dialog = null;
3430
4119
  }
3431
4120
  _saveRange() {
3432
- Se((e) => {
4121
+ xe((e) => {
3433
4122
  this._savedRange = e;
3434
4123
  });
3435
4124
  }
@@ -3448,7 +4137,7 @@ var Qn = class {
3448
4137
  }), i = w("div", { class: "an-dialog-box" }), a = w("div", { class: "an-dialog-header" }), o = w("span", { class: "an-dialog-icon" });
3449
4138
  o.innerHTML = t;
3450
4139
  let s = w("h3", { class: "an-dialog-title" });
3451
- s.textContent = n, a.appendChild(o), a.appendChild(s), i.appendChild(a), r.appendChild(i), he(a, i);
4140
+ s.textContent = n, a.appendChild(o), a.appendChild(s), i.appendChild(a), r.appendChild(i), D(a, i);
3452
4141
  let c = E(r, "click", (e) => {
3453
4142
  e.target === r && this._close();
3454
4143
  });
@@ -3471,12 +4160,12 @@ var Qn = class {
3471
4160
  let o = E(i, "click", n), s = E(a, "click", () => this._close());
3472
4161
  return this._disposers.push(o, s), r;
3473
4162
  }
3474
- }, rr = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"/><path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"/></svg>", ir = class extends H {
4163
+ }, Tr = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"/><path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"/></svg>", Er = class extends U {
3475
4164
  show() {
3476
4165
  this._saveRange(), this._prefill(), this._open();
3477
4166
  }
3478
4167
  _buildDialog() {
3479
- let e = this.context.locale.linkDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, rr, e.title), r = w("label", { class: "an-label" });
4168
+ let e = this.context.locale.linkDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, Tr, e.title), r = w("label", { class: "an-label" });
3480
4169
  r.textContent = e.url;
3481
4170
  let i = w("input", {
3482
4171
  type: "url",
@@ -3546,12 +4235,12 @@ var Qn = class {
3546
4235
  }
3547
4236
  this._savedRange && this._savedRange.select(), this.context.invoke("editor.insertLink", e, t, n), this._close();
3548
4237
  }
3549
- }, ar = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><circle cx=\"8.5\" cy=\"8.5\" r=\"1.5\"/><polyline points=\"21 15 16 10 5 21\"/></svg>", or = class extends H {
4238
+ }, Dr = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><circle cx=\"8.5\" cy=\"8.5\" r=\"1.5\"/><polyline points=\"21 15 16 10 5 21\"/></svg>", Or = class extends U {
3550
4239
  show({ beforeInsert: e } = {}) {
3551
4240
  this._beforeInsert = typeof e == "function" ? e : null, this._saveRange(), this._urlInput.value = "", this._altInput.value = "", this._fileInput && (this._fileInput.value = ""), this._open();
3552
4241
  }
3553
4242
  _buildDialog() {
3554
- let e = this.context.locale.imageDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, ar, e.title), r = w("label", { class: "an-label" });
4243
+ let e = this.context.locale.imageDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, Dr, e.title), r = w("label", { class: "an-label" });
3555
4244
  r.textContent = e.imageUrl;
3556
4245
  let i = w("input", {
3557
4246
  type: "url",
@@ -3678,12 +4367,12 @@ var Qn = class {
3678
4367
  _close() {
3679
4368
  this._beforeInsert = null, super._close();
3680
4369
  }
3681
- }, sr = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polygon points=\"23 7 16 12 23 17 23 7\"/><rect x=\"1\" y=\"5\" width=\"15\" height=\"14\" rx=\"2\"/></svg>", cr = class extends H {
4370
+ }, kr = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polygon points=\"23 7 16 12 23 17 23 7\"/><rect x=\"1\" y=\"5\" width=\"15\" height=\"14\" rx=\"2\"/></svg>", Ar = class extends U {
3682
4371
  show() {
3683
4372
  this._saveRange(), this._urlInput.value = "", this._widthInput.value = "560", this._hintEl.textContent = "", this._open();
3684
4373
  }
3685
4374
  _buildDialog() {
3686
- let e = this.context.locale.videoDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, sr, e.title), r = w("label", { class: "an-label" });
4375
+ let e = this.context.locale.videoDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, kr, e.title), r = w("label", { class: "an-label" });
3687
4376
  r.textContent = e.videoUrl;
3688
4377
  let i = w("input", {
3689
4378
  type: "url",
@@ -3729,7 +4418,7 @@ var Qn = class {
3729
4418
  this._savedRange && this._savedRange.select(), this.context.invoke("editor.insertVideo", n), this._close();
3730
4419
  }
3731
4420
  _parseVideoUrl(e) {
3732
- if (!e || !N(e, { media: !0 })) return null;
4421
+ if (!e || !sn(e, { media: !0 })) return null;
3733
4422
  let t = /(?:youtube\.com\/watch\?(?:.*&)?v=|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/.exec(e);
3734
4423
  if (t) return {
3735
4424
  type: "YouTube",
@@ -3761,10 +4450,10 @@ var Qn = class {
3761
4450
  return `<div class="an-video-wrapper" style="position:relative;display:block;width:${t}px;max-width:100%"><iframe src="${n.embedUrl}" width="${t}" height="${r}" title="${e}" frameborder="0" allowfullscreen allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" style="display:block;max-width:100%"></iframe><div class="an-video-shield"></div></div>`;
3762
4451
  }
3763
4452
  if (n?.type === "Direct video") return `<div class="an-video-wrapper" style="position:relative;display:block;width:${t}px;max-width:100%"><video src="${n.embedUrl.replaceAll("\"", "%22")}" width="${t}" height="${r}" controls style="display:block;max-width:100%"></video><div class="an-video-shield"></div></div>`;
3764
- let i = N(e, { media: !0 });
4453
+ let i = sn(e, { media: !0 });
3765
4454
  return i ? `<div class="an-video-wrapper" style="position:relative;display:block;width:${t}px;max-width:100%"><video src="${i.replaceAll("\"", "%22")}" width="${t}" height="${r}" controls style="display:block;max-width:100%"></video><div class="an-video-shield"></div></div>` : null;
3766
4455
  }
3767
- }, lr = [
4456
+ }, jr = [
3768
4457
  {
3769
4458
  pos: "nw",
3770
4459
  cursor: "nw-resize"
@@ -3797,7 +4486,7 @@ var Qn = class {
3797
4486
  pos: "w",
3798
4487
  cursor: "w-resize"
3799
4488
  }
3800
- ], ur = class {
4489
+ ], Mr = class {
3801
4490
  constructor(e) {
3802
4491
  this.context = e, this._active = null, this._overlay = null, this._disposers = [], this._positionRaf = null, this._lastOverlayPos = null;
3803
4492
  }
@@ -3850,7 +4539,7 @@ var Qn = class {
3850
4539
  }
3851
4540
  _buildOverlay() {
3852
4541
  let e = document.createElement("div");
3853
- return e.className = this._overlayClass, e.style.display = "none", lr.forEach(({ pos: t }) => {
4542
+ return e.className = this._overlayClass, e.style.display = "none", jr.forEach(({ pos: t }) => {
3854
4543
  let n = document.createElement("div");
3855
4544
  n.className = `an-resize-handle an-resize-${t}`, n.dataset.handle = t, this._disposers.push(E(n, "pointerdown", (e) => {
3856
4545
  e.preventDefault(), e.stopPropagation(), this._startResize(e, t);
@@ -3907,7 +4596,7 @@ var Qn = class {
3907
4596
  };
3908
4597
  document.addEventListener("pointermove", p), document.addEventListener("pointerup", h), document.addEventListener("pointercancel", h), this._dragDisposers = [m];
3909
4598
  }
3910
- }, dr = class extends ur {
4599
+ }, Nr = class extends Mr {
3911
4600
  get _overlayClass() {
3912
4601
  return "an-image-resizer";
3913
4602
  }
@@ -3936,7 +4625,7 @@ var Qn = class {
3936
4625
  getActiveImage() {
3937
4626
  return this._active;
3938
4627
  }
3939
- }, fr = class extends ur {
4628
+ }, Pr = class extends Mr {
3940
4629
  get _overlayClass() {
3941
4630
  return "an-video-resizer";
3942
4631
  }
@@ -3972,12 +4661,12 @@ var Qn = class {
3972
4661
  getActiveWrapper() {
3973
4662
  return this._active;
3974
4663
  }
3975
- }, pr = {
4664
+ }, Fr = {
3976
4665
  open: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\"/><polyline points=\"15 3 21 3 21 9\"/><line x1=\"10\" y1=\"14\" x2=\"21\" y2=\"3\"/></svg>",
3977
4666
  edit: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"/><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"/></svg>",
3978
4667
  unlink: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18.84 12.25l1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71\"/><path d=\"M5.17 11.75l-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71\"/><line x1=\"8\" y1=\"2\" x2=\"8\" y2=\"5\"/><line x1=\"2\" y1=\"8\" x2=\"5\" y2=\"8\"/><line x1=\"16\" y1=\"19\" x2=\"16\" y2=\"22\"/><line x1=\"19\" y1=\"16\" x2=\"22\" y2=\"16\"/></svg>",
3979
4668
  copy: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\"/><path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"/></svg>"
3980
- }, mr = 120, hr = 200, gr = class {
4669
+ }, Ir = 120, Lr = 200, Rr = class {
3981
4670
  constructor(e) {
3982
4671
  this.context = e, this._el = null, this._activeAnchor = null, this._showTimer = null, this._hideTimer = null, this._disposers = [];
3983
4672
  }
@@ -4001,7 +4690,7 @@ var Qn = class {
4001
4690
  role: "toolbar",
4002
4691
  "aria-label": e.ariaLabel
4003
4692
  });
4004
- return t.style.display = "none", this._urlLabel = w("span", { class: "an-link-tooltip-url" }), t.appendChild(this._urlLabel), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._openBtn = this._makeBtn(pr.open, e.openLink, () => this._openLink()), this._copyBtn = this._makeBtn(pr.copy, e.copyUrl, () => this._copyLink()), this._editBtn = this._makeBtn(pr.edit, e.editLink, () => this._editLink()), this._unlinkBtn = this._makeBtn(pr.unlink, e.removeLink, () => this._unlink()), t.appendChild(this._openBtn), t.appendChild(this._copyBtn), t.appendChild(this._editBtn), t.appendChild(this._unlinkBtn), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
4693
+ return t.style.display = "none", this._urlLabel = w("span", { class: "an-link-tooltip-url" }), t.appendChild(this._urlLabel), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._openBtn = this._makeBtn(Fr.open, e.openLink, () => this._openLink()), this._copyBtn = this._makeBtn(Fr.copy, e.copyUrl, () => this._copyLink()), this._editBtn = this._makeBtn(Fr.edit, e.editLink, () => this._editLink()), this._unlinkBtn = this._makeBtn(Fr.unlink, e.removeLink, () => this._unlink()), t.appendChild(this._openBtn), t.appendChild(this._copyBtn), t.appendChild(this._editBtn), t.appendChild(this._unlinkBtn), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
4005
4694
  }
4006
4695
  _makeBtn(e, t, n) {
4007
4696
  let r = w("button", {
@@ -4016,12 +4705,12 @@ var Qn = class {
4016
4705
  _scheduleShow(e) {
4017
4706
  this._activeAnchor === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
4018
4707
  this._activeAnchor = e, this._show(e);
4019
- }, mr));
4708
+ }, Ir));
4020
4709
  }
4021
4710
  _scheduleHide() {
4022
4711
  clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => {
4023
4712
  this._hide();
4024
- }, hr));
4713
+ }, Lr));
4025
4714
  }
4026
4715
  _show(e) {
4027
4716
  let t = this.context.layoutInfo.container.classList.contains("an-disabled"), n = e.getAttribute("href") || "";
@@ -4070,7 +4759,7 @@ var Qn = class {
4070
4759
  let t = globalThis.getSelection(), n = document.createRange();
4071
4760
  n.selectNode(e), t.removeAllRanges(), t.addRange(n), document.execCommand("unlink"), this.context.invoke("editor.afterCommand");
4072
4761
  }
4073
- }, _r = class {
4762
+ }, zr = class {
4074
4763
  constructor(e) {
4075
4764
  this.context = e, this.options = e.options, this._el = null, this._active = null, this._showTimer = null, this._hideTimer = null, this._disposers = [];
4076
4765
  }
@@ -4111,7 +4800,7 @@ var Qn = class {
4111
4800
  let t = e.getBoundingClientRect(), n = this._el.offsetWidth || 220, r = this._el.offsetHeight || 32, i = t.bottom + 6, a = t.left + (t.width - n) / 2;
4112
4801
  i + r > globalThis.innerHeight - 6 && (i = t.top - r - 6), a + n > globalThis.innerWidth - 6 && (a = globalThis.innerWidth - n - 6), a < 6 && (a = 6), this._el.style.top = `${i}px`, this._el.style.left = `${a}px`;
4113
4802
  }
4114
- }, U = {
4803
+ }, W = {
4115
4804
  floatLeft: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"2\" y=\"4\" width=\"8\" height=\"8\" rx=\"1\"/><line x1=\"12\" y1=\"6\" x2=\"22\" y2=\"6\"/><line x1=\"12\" y1=\"9\" x2=\"22\" y2=\"9\"/><line x1=\"12\" y1=\"12\" x2=\"22\" y2=\"12\"/><line x1=\"2\" y1=\"16\" x2=\"22\" y2=\"16\"/><line x1=\"2\" y1=\"20\" x2=\"18\" y2=\"20\"/></svg>",
4116
4805
  floatRight: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"14\" y=\"4\" width=\"8\" height=\"8\" rx=\"1\"/><line x1=\"2\" y1=\"6\" x2=\"12\" y2=\"6\"/><line x1=\"2\" y1=\"9\" x2=\"12\" y2=\"9\"/><line x1=\"2\" y1=\"12\" x2=\"12\" y2=\"12\"/><line x1=\"2\" y1=\"16\" x2=\"22\" y2=\"16\"/><line x1=\"2\" y1=\"20\" x2=\"18\" y2=\"20\"/></svg>",
4117
4806
  floatNone: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"3\" width=\"8\" height=\"8\" rx=\"1\"/><line x1=\"3\" y1=\"15\" x2=\"21\" y2=\"15\"/><line x1=\"3\" y1=\"19\" x2=\"17\" y2=\"19\"/></svg>",
@@ -4122,7 +4811,7 @@ var Qn = class {
4122
4811
  rotateLeft: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\"/><polyline points=\"3 3 3 8 8 8\"/></svg>",
4123
4812
  rotateRight: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M21 12a9 9 0 1 1-9-9 9.75 9.75 0 0 1 6.74 2.74L21 8\"/><polyline points=\"21 3 21 8 16 8\"/></svg>",
4124
4813
  crop: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"6 2 6 18 22 18\"/><polyline points=\"2 6 18 6 18 22\"/></svg>"
4125
- }, vr = class extends _r {
4814
+ }, Br = class extends zr {
4126
4815
  initialize() {
4127
4816
  this._el = this._buildTooltip(), document.body.appendChild(this._el);
4128
4817
  let e = this.context.layoutInfo.editable;
@@ -4147,7 +4836,7 @@ var Qn = class {
4147
4836
  role: "toolbar",
4148
4837
  "aria-label": e.ariaLabel
4149
4838
  });
4150
- return t.style.display = "none", this._label = w("span", { class: "an-link-tooltip-url" }), this._label.textContent = e.label, t.appendChild(this._label), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._floatLeftBtn = this._makeBtn(U.floatLeft, e.floatLeft, () => this._setFloat("left")), this._floatNoneBtn = this._makeBtn(U.floatNone, e.noFloat, () => this._setFloat("")), this._alignCenterBtn = this._makeBtn(U.alignCenter, e.alignCenter, () => this._setCenter()), this._floatRightBtn = this._makeBtn(U.floatRight, e.floatRight, () => this._setFloat("right")), t.appendChild(this._floatLeftBtn), t.appendChild(this._floatNoneBtn), t.appendChild(this._alignCenterBtn), t.appendChild(this._floatRightBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._originalBtn = this._makeBtn(U.originalSize, e.originalSize, () => this._resetSize()), t.appendChild(this._originalBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), t.appendChild(this._makeBtn(U.rotateLeft, e.rotateLeft, () => this._rotate(-90))), t.appendChild(this._makeBtn(U.rotateRight, e.rotateRight, () => this._rotate(90))), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._cropBtn = this._makeBtn(U.crop, e.cropImage, () => this._crop()), t.appendChild(this._cropBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._captionBtn = this._makeBtn(U.caption, e.addCaption, () => this._toggleCaption()), t.appendChild(this._captionBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._deleteBtn = this._makeBtn(U.deleteImg, e.deleteImage, () => this._delete(), !0), t.appendChild(this._deleteBtn), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
4839
+ return t.style.display = "none", this._label = w("span", { class: "an-link-tooltip-url" }), this._label.textContent = e.label, t.appendChild(this._label), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._floatLeftBtn = this._makeBtn(W.floatLeft, e.floatLeft, () => this._setFloat("left")), this._floatNoneBtn = this._makeBtn(W.floatNone, e.noFloat, () => this._setFloat("")), this._alignCenterBtn = this._makeBtn(W.alignCenter, e.alignCenter, () => this._setCenter()), this._floatRightBtn = this._makeBtn(W.floatRight, e.floatRight, () => this._setFloat("right")), t.appendChild(this._floatLeftBtn), t.appendChild(this._floatNoneBtn), t.appendChild(this._alignCenterBtn), t.appendChild(this._floatRightBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._originalBtn = this._makeBtn(W.originalSize, e.originalSize, () => this._resetSize()), t.appendChild(this._originalBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), t.appendChild(this._makeBtn(W.rotateLeft, e.rotateLeft, () => this._rotate(-90))), t.appendChild(this._makeBtn(W.rotateRight, e.rotateRight, () => this._rotate(90))), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._cropBtn = this._makeBtn(W.crop, e.cropImage, () => this._crop()), t.appendChild(this._cropBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._captionBtn = this._makeBtn(W.caption, e.addCaption, () => this._toggleCaption()), t.appendChild(this._captionBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._deleteBtn = this._makeBtn(W.deleteImg, e.deleteImage, () => this._delete(), !0), t.appendChild(this._deleteBtn), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
4151
4840
  }
4152
4841
  _setFloat(e) {
4153
4842
  let t = this._active;
@@ -4214,7 +4903,7 @@ var Qn = class {
4214
4903
  let a = globalThis.getSelection();
4215
4904
  a && (a.removeAllRanges(), a.addRange(i)), this.context.invoke("editor.afterCommand"), this.context.invoke("imageResizer.updateOverlay"), this._hide();
4216
4905
  }
4217
- }, W = {
4906
+ }, G = {
4218
4907
  floatLeft: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"2\" y=\"4\" width=\"8\" height=\"8\" rx=\"1\"/><line x1=\"12\" y1=\"6\" x2=\"22\" y2=\"6\"/><line x1=\"12\" y1=\"9\" x2=\"22\" y2=\"9\"/><line x1=\"12\" y1=\"12\" x2=\"22\" y2=\"12\"/><line x1=\"2\" y1=\"16\" x2=\"22\" y2=\"16\"/><line x1=\"2\" y1=\"20\" x2=\"18\" y2=\"20\"/></svg>",
4219
4908
  floatRight: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"14\" y=\"4\" width=\"8\" height=\"8\" rx=\"1\"/><line x1=\"2\" y1=\"6\" x2=\"12\" y2=\"6\"/><line x1=\"2\" y1=\"9\" x2=\"12\" y2=\"9\"/><line x1=\"2\" y1=\"12\" x2=\"12\" y2=\"12\"/><line x1=\"2\" y1=\"16\" x2=\"22\" y2=\"16\"/><line x1=\"2\" y1=\"20\" x2=\"18\" y2=\"20\"/></svg>",
4220
4909
  floatNone: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"3\" width=\"8\" height=\"8\" rx=\"1\"/><line x1=\"3\" y1=\"15\" x2=\"21\" y2=\"15\"/><line x1=\"3\" y1=\"19\" x2=\"17\" y2=\"19\"/></svg>",
@@ -4222,7 +4911,7 @@ var Qn = class {
4222
4911
  originalSize: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"15 3 21 3 21 9\"/><polyline points=\"9 21 3 21 3 15\"/><line x1=\"21\" y1=\"3\" x2=\"14\" y2=\"10\"/><line x1=\"3\" y1=\"21\" x2=\"10\" y2=\"14\"/></svg>",
4223
4912
  deleteVideo: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"3 6 5 6 21 6\"/><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2\"/></svg>",
4224
4913
  preview: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polygon points=\"5 3 19 12 5 21 5 3\"/></svg>"
4225
- }, yr = class extends _r {
4914
+ }, Vr = class extends zr {
4226
4915
  initialize() {
4227
4916
  this._el = this._buildTooltip(), document.body.appendChild(this._el);
4228
4917
  let e = this.context.layoutInfo.editable;
@@ -4253,7 +4942,7 @@ var Qn = class {
4253
4942
  role: "toolbar",
4254
4943
  "aria-label": e.ariaLabel
4255
4944
  });
4256
- return t.style.display = "none", this._label = w("span", { class: "an-link-tooltip-url" }), this._label.textContent = e.label, t.appendChild(this._label), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._floatLeftBtn = this._makeBtn(W.floatLeft, e.floatLeft, () => this._setFloat("left")), this._floatNoneBtn = this._makeBtn(W.floatNone, e.noFloat, () => this._setFloat("")), this._alignCenterBtn = this._makeBtn(W.alignCenter, e.alignCenter, () => this._setCenter()), this._floatRightBtn = this._makeBtn(W.floatRight, e.floatRight, () => this._setFloat("right")), t.appendChild(this._floatLeftBtn), t.appendChild(this._floatNoneBtn), t.appendChild(this._alignCenterBtn), t.appendChild(this._floatRightBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._originalBtn = this._makeBtn(W.originalSize, e.originalSize, () => this._resetSize()), t.appendChild(this._originalBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._previewBtn = this._makeBtn(W.preview, e.previewVideo, () => this._togglePreview()), t.appendChild(this._previewBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._deleteBtn = this._makeBtn(W.deleteVideo, e.deleteVideo, () => this._delete(), !0), t.appendChild(this._deleteBtn), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
4945
+ return t.style.display = "none", this._label = w("span", { class: "an-link-tooltip-url" }), this._label.textContent = e.label, t.appendChild(this._label), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._floatLeftBtn = this._makeBtn(G.floatLeft, e.floatLeft, () => this._setFloat("left")), this._floatNoneBtn = this._makeBtn(G.floatNone, e.noFloat, () => this._setFloat("")), this._alignCenterBtn = this._makeBtn(G.alignCenter, e.alignCenter, () => this._setCenter()), this._floatRightBtn = this._makeBtn(G.floatRight, e.floatRight, () => this._setFloat("right")), t.appendChild(this._floatLeftBtn), t.appendChild(this._floatNoneBtn), t.appendChild(this._alignCenterBtn), t.appendChild(this._floatRightBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._originalBtn = this._makeBtn(G.originalSize, e.originalSize, () => this._resetSize()), t.appendChild(this._originalBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._previewBtn = this._makeBtn(G.preview, e.previewVideo, () => this._togglePreview()), t.appendChild(this._previewBtn), t.appendChild(w("div", { class: "an-link-tooltip-sep" })), this._deleteBtn = this._makeBtn(G.deleteVideo, e.deleteVideo, () => this._delete(), !0), t.appendChild(this._deleteBtn), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
4257
4946
  }
4258
4947
  _setFloat(e) {
4259
4948
  let t = this._active;
@@ -4300,7 +4989,7 @@ var Qn = class {
4300
4989
  }
4301
4990
  this._previewBtn.classList.remove("an-link-tooltip-btn--copied"), this._previewBtn.title = this.context.locale.tooltips.video.previewVideo, this._previewClickOff &&= (document.removeEventListener("mousedown", this._previewClickOff, !0), null);
4302
4991
  }
4303
- }, G = {
4992
+ }, K = {
4304
4993
  rowAbove: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"1\"/><line x1=\"3\" y1=\"12\" x2=\"21\" y2=\"12\"/><path d=\"M12 3v7\"/><path d=\"M9 7l3-4 3 4\"/></svg>",
4305
4994
  rowBelow: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"1\"/><line x1=\"3\" y1=\"12\" x2=\"21\" y2=\"12\"/><path d=\"M12 12v7\"/><path d=\"M9 17l3 4 3-4\"/></svg>",
4306
4995
  deleteRow: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"1\"/><line x1=\"3\" y1=\"12\" x2=\"21\" y2=\"12\"/><line x1=\"15\" y1=\"15\" x2=\"21\" y2=\"21\"/><line x1=\"21\" y1=\"15\" x2=\"15\" y2=\"21\"/></svg>",
@@ -4328,7 +5017,7 @@ var Qn = class {
4328
5017
  };
4329
5018
  //#endregion
4330
5019
  //#region src/js/module/table-grid.js
4331
- function K(e) {
5020
+ function Hr(e) {
4332
5021
  let t = e.closest("tr");
4333
5022
  if (!t) return -1;
4334
5023
  let n = 0;
@@ -4347,7 +5036,7 @@ function q(e, t) {
4347
5036
  }
4348
5037
  return null;
4349
5038
  }
4350
- function br(e, t) {
5039
+ function Ur(e, t) {
4351
5040
  let n = 0;
4352
5041
  for (let r of e.cells) if (n += r.colSpan || 1, n > t) {
4353
5042
  let e = r.nextElementSibling;
@@ -4355,7 +5044,7 @@ function br(e, t) {
4355
5044
  }
4356
5045
  return null;
4357
5046
  }
4358
- function xr(e) {
5047
+ function Wr(e) {
4359
5048
  let t = Array.from(e.rows), n = {}, r = /* @__PURE__ */ new WeakMap();
4360
5049
  return t.forEach((e, t) => {
4361
5050
  n[t] || (n[t] = {});
@@ -4382,7 +5071,7 @@ function xr(e) {
4382
5071
  }
4383
5072
  //#endregion
4384
5073
  //#region src/js/module/TableTooltip.js
4385
- var Sr = 120, Cr = 200, wr = [
5074
+ var Gr = 120, Kr = 200, qr = [
4386
5075
  "#000000",
4387
5076
  "#434343",
4388
5077
  "#666666",
@@ -4407,7 +5096,7 @@ var Sr = 120, Cr = 200, wr = [
4407
5096
  "#c9daf8",
4408
5097
  "#d9d2e9",
4409
5098
  "#ead1dc"
4410
- ], Tr = class {
5099
+ ], Jr = class {
4411
5100
  constructor(e) {
4412
5101
  this.context = e, this._el = null, this._activeTable = null, this._activeCell = null, this._showTimer = null, this._hideTimer = null, this._disposers = [], this._sizePopover = null, this._sizeApply = null, this._sizeTitleEl = null, this._sizeInputEl = null, this._shadePopover = null, this._shadeTitleEl = null, this._shadeColorStrip = null, this._borderColorPopover = null, this._borderColorTitleEl = null, this._borderColorStrip = null, this._borderColorNoBtn = null, this._selectMode = !1, this._selectedCells = [], this._selectStart = null, this._selectDragging = !1, this._selectBtn = null, this._editable = null;
4413
5102
  }
@@ -4465,7 +5154,7 @@ var Sr = 120, Cr = 200, wr = [
4465
5154
  });
4466
5155
  }), E(e, "mousedown", (e) => {
4467
5156
  if (!this.context.layoutInfo.container.classList.contains("an-disabled") && !(!t || !n)) {
4468
- if (r = !0, i = n, a = e.clientX, o = e.clientY, f = t.closest("table"), i === "col") l = K(t) + (t.colSpan || 1) - 1, u = l >= 0 ? Array.from(f.querySelectorAll("tr")).map((e) => q(e, l)).filter(Boolean).filter((e) => (e.colSpan || 1) === 1) : [], s = u.length > 0 ? u[0].offsetWidth : Math.max(30, Math.round(t.offsetWidth / (t.colSpan || 1))), document.body.style.cursor = "col-resize";
5157
+ if (r = !0, i = n, a = e.clientX, o = e.clientY, f = t.closest("table"), i === "col") l = Hr(t) + (t.colSpan || 1) - 1, u = l >= 0 ? Array.from(f.querySelectorAll("tr")).map((e) => q(e, l)).filter(Boolean).filter((e) => (e.colSpan || 1) === 1) : [], s = u.length > 0 ? u[0].offsetWidth : Math.max(30, Math.round(t.offsetWidth / (t.colSpan || 1))), document.body.style.cursor = "col-resize";
4469
5158
  else {
4470
5159
  let e = t.closest("tr"), n = (e ? Array.from(f.rows).indexOf(e) : 0) + (t.rowSpan || 1) - 1;
4471
5160
  d = f.rows[n] || e, c = d ? d.offsetHeight : 40, document.body.style.cursor = "row-resize";
@@ -4497,27 +5186,27 @@ var Sr = 120, Cr = 200, wr = [
4497
5186
  role: "toolbar",
4498
5187
  "aria-label": e.ariaLabel
4499
5188
  });
4500
- t.style.display = "none", this._label = w("span", { class: "an-link-tooltip-url" }), this._label.textContent = e.label, t.appendChild(this._label), t.appendChild(this._sep()), this._selectBtn = this._makeBtn(G.selectCells, e.selectCells, () => this._toggleSelectMode()), t.appendChild(this._selectBtn), t.appendChild(this._sep()), t.appendChild(this._makeBtn(G.rowAbove, e.addRowAbove, () => this._addRow("above"))), t.appendChild(this._makeBtn(G.rowBelow, e.addRowBelow, () => this._addRow("below"))), t.appendChild(this._makeBtn(G.deleteRow, e.deleteRow, () => this._deleteRow())), t.appendChild(this._sep()), t.appendChild(this._makeBtn(G.colLeft, e.addColumnLeft, () => this._addColumn("left"))), t.appendChild(this._makeBtn(G.colRight, e.addColumnRight, () => this._addColumn("right"))), t.appendChild(this._makeBtn(G.deleteCol, e.deleteColumn, () => this._deleteColumn())), t.appendChild(this._makeBtn(G.sortAsc, e.sortAsc, () => this._sortColumn("asc"))), t.appendChild(this._makeBtn(G.sortDesc, e.sortDesc, () => this._sortColumn("desc"))), t.appendChild(this._sep()), t.appendChild(this._makeBtn(G.mergeCells, e.mergeCells, () => this._mergeCells())), t.appendChild(this._makeBtn(G.unmergeCells, e.unmergeCells, () => this._unmergeCells())), t.appendChild(this._sep()), t.appendChild(this._makeBtn(G.alignLeft, e.cellAlignLeft, () => this._applyCellAlign("left"))), t.appendChild(this._makeBtn(G.alignCenter, e.cellAlignCenter, () => this._applyCellAlign("center"))), t.appendChild(this._makeBtn(G.alignRight, e.cellAlignRight, () => this._applyCellAlign("right"))), t.appendChild(this._makeBtn(G.alignJustify, e.cellAlignJustify, () => this._applyCellAlign("justify"))), t.appendChild(this._makeBtn(G.headerRow, e.toggleHeaderRow, () => this._toggleHeaderRow())), t.appendChild(this._sep());
5189
+ t.style.display = "none", this._label = w("span", { class: "an-link-tooltip-url" }), this._label.textContent = e.label, t.appendChild(this._label), t.appendChild(this._sep()), this._selectBtn = this._makeBtn(K.selectCells, e.selectCells, () => this._toggleSelectMode()), t.appendChild(this._selectBtn), t.appendChild(this._sep()), t.appendChild(this._makeBtn(K.rowAbove, e.addRowAbove, () => this._addRow("above"))), t.appendChild(this._makeBtn(K.rowBelow, e.addRowBelow, () => this._addRow("below"))), t.appendChild(this._makeBtn(K.deleteRow, e.deleteRow, () => this._deleteRow())), t.appendChild(this._sep()), t.appendChild(this._makeBtn(K.colLeft, e.addColumnLeft, () => this._addColumn("left"))), t.appendChild(this._makeBtn(K.colRight, e.addColumnRight, () => this._addColumn("right"))), t.appendChild(this._makeBtn(K.deleteCol, e.deleteColumn, () => this._deleteColumn())), t.appendChild(this._makeBtn(K.sortAsc, e.sortAsc, () => this._sortColumn("asc"))), t.appendChild(this._makeBtn(K.sortDesc, e.sortDesc, () => this._sortColumn("desc"))), t.appendChild(this._sep()), t.appendChild(this._makeBtn(K.mergeCells, e.mergeCells, () => this._mergeCells())), t.appendChild(this._makeBtn(K.unmergeCells, e.unmergeCells, () => this._unmergeCells())), t.appendChild(this._sep()), t.appendChild(this._makeBtn(K.alignLeft, e.cellAlignLeft, () => this._applyCellAlign("left"))), t.appendChild(this._makeBtn(K.alignCenter, e.cellAlignCenter, () => this._applyCellAlign("center"))), t.appendChild(this._makeBtn(K.alignRight, e.cellAlignRight, () => this._applyCellAlign("right"))), t.appendChild(this._makeBtn(K.alignJustify, e.cellAlignJustify, () => this._applyCellAlign("justify"))), t.appendChild(this._makeBtn(K.headerRow, e.toggleHeaderRow, () => this._toggleHeaderRow())), t.appendChild(this._sep());
4501
5190
  let n = w("button", {
4502
5191
  type: "button",
4503
5192
  class: "an-link-tooltip-btn an-link-tooltip-btn--shade",
4504
5193
  title: e.cellBackground
4505
5194
  }), r = w("span", { class: "an-bubble-btn-svg" });
4506
- r.innerHTML = G.cellShade;
5195
+ r.innerHTML = K.cellShade;
4507
5196
  let i = w("span", { class: "an-link-tooltip-color-strip" });
4508
5197
  n.appendChild(r), n.appendChild(i), this._shadeColorStrip = i, this._disposers.push(E(n, "click", (e) => {
4509
5198
  e.preventDefault(), e.stopPropagation(), this._openCellShadePopover();
4510
- })), t.appendChild(n), t.appendChild(this._sep()), t.appendChild(this._makeBtn(G.colWidth, e.columnWidth, () => this._openSizePopover("col"))), t.appendChild(this._makeBtn(G.rowHeight, e.rowHeight, () => this._openSizePopover("row"))), t.appendChild(this._makeBtn(G.tableBorder, e.tableBorderWidth, () => this._openSizePopover("border"))), t.appendChild(this._makeBtn(G.cellPadding, e.cellPadding, () => this._openSizePopover("cellPadding")));
5199
+ })), t.appendChild(n), t.appendChild(this._sep()), t.appendChild(this._makeBtn(K.colWidth, e.columnWidth, () => this._openSizePopover("col"))), t.appendChild(this._makeBtn(K.rowHeight, e.rowHeight, () => this._openSizePopover("row"))), t.appendChild(this._makeBtn(K.tableBorder, e.tableBorderWidth, () => this._openSizePopover("border"))), t.appendChild(this._makeBtn(K.cellPadding, e.cellPadding, () => this._openSizePopover("cellPadding")));
4511
5200
  let a = w("button", {
4512
5201
  type: "button",
4513
5202
  class: "an-link-tooltip-btn an-link-tooltip-btn--shade",
4514
5203
  title: e.tableBorderColor
4515
5204
  }), o = w("span", { class: "an-bubble-btn-svg" });
4516
- o.innerHTML = G.borderColor;
5205
+ o.innerHTML = K.borderColor;
4517
5206
  let s = w("span", { class: "an-link-tooltip-color-strip" });
4518
5207
  return a.appendChild(o), a.appendChild(s), this._borderColorStrip = s, this._disposers.push(E(a, "click", (e) => {
4519
5208
  e.preventDefault(), e.stopPropagation(), this._openBorderColorPopover();
4520
- })), t.appendChild(a), t.appendChild(this._sep()), t.appendChild(this._makeBtn(G.deleteTable, e.deleteTable, () => this._deleteTable(), !0)), t.appendChild(this._sep()), t.appendChild(this._makeBtn(G.exportCSV, e.exportCSV, () => this._exportTableCSV())), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => {
5209
+ })), t.appendChild(a), t.appendChild(this._sep()), t.appendChild(this._makeBtn(K.deleteTable, e.deleteTable, () => this._deleteTable(), !0)), t.appendChild(this._sep()), t.appendChild(this._makeBtn(K.exportCSV, e.exportCSV, () => this._exportTableCSV())), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => {
4521
5210
  this._selectMode || this._sizePopover && this._sizePopover.style.display !== "none" || this._shadePopover && this._shadePopover.style.display !== "none" || this._borderColorPopover && this._borderColorPopover.style.display !== "none" || this._scheduleHide();
4522
5211
  })), t;
4523
5212
  }
@@ -4537,10 +5226,10 @@ var Sr = 120, Cr = 200, wr = [
4537
5226
  _scheduleShow(e) {
4538
5227
  this._activeTable === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
4539
5228
  this._activeTable = e, this._show();
4540
- }, Sr));
5229
+ }, Gr));
4541
5230
  }
4542
5231
  _scheduleHide() {
4543
- clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => this._hide(), Cr));
5232
+ clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => this._hide(), Kr));
4544
5233
  }
4545
5234
  _show() {
4546
5235
  this._activeTable && (this._el.style.display = "flex", this._syncShadeStrip(), this._syncBorderColorStrip(), requestAnimationFrame(() => {
@@ -4589,7 +5278,7 @@ var Sr = 120, Cr = 200, wr = [
4589
5278
  if (!t || e === t) return [e];
4590
5279
  let n = e.closest("table");
4591
5280
  if (!n?.contains(t)) return [e];
4592
- let { gridMap: r, cellPos: i } = xr(n), a = i.get(e), o = i.get(t);
5281
+ let { gridMap: r, cellPos: i } = Wr(n), a = i.get(e), o = i.get(t);
4593
5282
  if (!a || !o) return [e];
4594
5283
  let s = Math.min(a.r, o.r), c = Math.max(a.r + a.rs - 1, o.r + o.rs - 1), l = Math.min(a.c, o.c), u = Math.max(a.c + a.cs - 1, o.c + o.cs - 1), d = !0;
4595
5284
  for (; d;) {
@@ -4637,7 +5326,7 @@ var Sr = 120, Cr = 200, wr = [
4637
5326
  if (!t.length) return;
4638
5327
  let n = t[0].closest("table");
4639
5328
  if (!n) return;
4640
- let r = t.map((e) => K(e)), i = e === "left" ? Math.min(...r) : Math.max(...r), a = Array.from(n.querySelectorAll("tr")), o = a.map((t) => e === "left" ? q(t, i) : br(t, i)), s = a.map((e) => e.closest("thead") !== null);
5329
+ let r = t.map((e) => Hr(e)), i = e === "left" ? Math.min(...r) : Math.max(...r), a = Array.from(n.querySelectorAll("tr")), o = a.map((t) => e === "left" ? q(t, i) : Ur(t, i)), s = a.map((e) => e.closest("thead") !== null);
4641
5330
  a.forEach((e, t) => {
4642
5331
  e.insertBefore(w(s[t] ? "th" : "td", {}, ["\xA0"]), o[t]);
4643
5332
  }), requestAnimationFrame(() => this._positionNear(this._activeTable)), this.context.invoke("editor.afterCommand");
@@ -4657,7 +5346,7 @@ var Sr = 120, Cr = 200, wr = [
4657
5346
  if (!t) return;
4658
5347
  let n = Array.from(t.querySelectorAll("tr"));
4659
5348
  if (n[0] && n[0].cells.length <= 1) return;
4660
- let r = [...new Set(e.map((e) => K(e)))];
5349
+ let r = [...new Set(e.map((e) => Hr(e)))];
4661
5350
  if (r.length >= (n[0]?.cells.length ?? 1)) return;
4662
5351
  let i = [];
4663
5352
  r.forEach((e) => {
@@ -4685,7 +5374,7 @@ var Sr = 120, Cr = 200, wr = [
4685
5374
  }
4686
5375
  }), n.length < 2) return;
4687
5376
  }
4688
- let { gridMap: r, cellPos: i } = xr(t), a = Infinity, o = -Infinity, s = Infinity, c = -Infinity;
5377
+ let { gridMap: r, cellPos: i } = Wr(t), a = Infinity, o = -Infinity, s = Infinity, c = -Infinity;
4689
5378
  if (n.forEach((e) => {
4690
5379
  let t = i.get(e);
4691
5380
  t && (t.r < a && (a = t.r), t.r + t.rs - 1 > o && (o = t.r + t.rs - 1), t.c < s && (s = t.c), t.c + t.cs - 1 > c && (c = t.c + t.cs - 1));
@@ -4724,7 +5413,7 @@ var Sr = 120, Cr = 200, wr = [
4724
5413
  _unmergeOne(e, t) {
4725
5414
  let n = e.colSpan || 1, r = e.rowSpan || 1;
4726
5415
  if (n === 1 && r === 1) return;
4727
- let { cellPos: i } = xr(t), a = i.get(e);
5416
+ let { cellPos: i } = Wr(t), a = i.get(e);
4728
5417
  if (!a) return;
4729
5418
  let { r: o, c: s } = a, c = Array.from(t.rows), l = e.tagName.toLowerCase();
4730
5419
  if (e.rowSpan = 1, e.colSpan = 1, e.style.verticalAlign = "", n > 1) {
@@ -4811,7 +5500,7 @@ var Sr = 120, Cr = 200, wr = [
4811
5500
  let i = t.closest("table");
4812
5501
  if (i) {
4813
5502
  if (n) {
4814
- let t = [...new Set(r.map((e) => K(e)))], n = Array.from(i.querySelectorAll("tr"));
5503
+ let t = [...new Set(r.map((e) => Hr(e)))], n = Array.from(i.querySelectorAll("tr"));
4815
5504
  t.forEach((t) => {
4816
5505
  n.forEach((n) => {
4817
5506
  let r = q(n, t);
@@ -4841,7 +5530,7 @@ var Sr = 120, Cr = 200, wr = [
4841
5530
  let a = w("div", { class: "an-size-popover-title" });
4842
5531
  i.appendChild(a);
4843
5532
  let o = w("div", { class: "an-context-color-palette" });
4844
- wr.forEach((e) => {
5533
+ qr.forEach((e) => {
4845
5534
  let n = w("div", {
4846
5535
  class: "an-context-color-swatch",
4847
5536
  title: e
@@ -4961,7 +5650,7 @@ var Sr = 120, Cr = 200, wr = [
4961
5650
  if (!t) return;
4962
5651
  let n = this._getCell();
4963
5652
  if (!n) return;
4964
- let r = K(n);
5653
+ let r = Hr(n);
4965
5654
  if (r === -1) return;
4966
5655
  let i = t.querySelector("tbody") || t, a = Array.from(i.querySelectorAll(":scope > tr"));
4967
5656
  a.length < 2 || (a.sort((t, n) => {
@@ -4986,13 +5675,43 @@ var Sr = 120, Cr = 200, wr = [
4986
5675
  let t = Array.from(e.querySelectorAll("tr")).map((e) => Array.from(e.querySelectorAll("td, th")).map((e) => `"${(e.textContent || "").trim().replace(/"/g, "\"\"")}"`).join(",")).join("\n"), n = new Blob(["" + t], { type: "text/csv;charset=utf-8;" }), r = URL.createObjectURL(n), i = document.createElement("a");
4987
5676
  i.href = r, i.download = "table.csv", i.style.display = "none", document.body.appendChild(i), i.click(), i.remove(), URL.revokeObjectURL(r);
4988
5677
  }
4989
- }, Er = 100, Dr = 180, Or = /language-(\S+)/, kr = {
5678
+ }, Yr = 100, Xr = 180, Zr = /language-(\S+)/, Qr = {
4990
5679
  copy: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\"/><path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"/></svg>",
4991
5680
  wrapOn: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\"/><path d=\"M3 12h15a3 3 0 0 1 0 6H3\"/><polyline points=\"6 15 3 18 6 21\"/></svg>",
4992
5681
  toParagraph: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M13 4v16\"/><path d=\"M17 4v16\"/><path d=\"M9 4h8a4 4 0 0 1 0 8H9V4z\"/></svg>",
4993
5682
  deleteCode: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"3 6 5 6 21 6\"/><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2\"/></svg>",
4994
5683
  lineNumbers: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"10\" y1=\"6\" x2=\"21\" y2=\"6\"/><line x1=\"10\" y1=\"12\" x2=\"21\" y2=\"12\"/><line x1=\"10\" y1=\"18\" x2=\"21\" y2=\"18\"/><path d=\"M4 6h1v4\"/><path d=\"M4 10h2\"/><path d=\"M6 18H4c0-1 2-2 2-3s-1-2-2-2\"/></svg>"
4995
- }, Ar = class {
5684
+ }, $r = [
5685
+ ["", "Plain text"],
5686
+ ["javascript", "JavaScript"],
5687
+ ["typescript", "TypeScript"],
5688
+ ["python", "Python"],
5689
+ ["html", "HTML"],
5690
+ ["css", "CSS"],
5691
+ ["scss", "SCSS"],
5692
+ ["json", "JSON"],
5693
+ ["yaml", "YAML"],
5694
+ ["markdown", "Markdown"],
5695
+ ["xml", "XML"],
5696
+ ["bash", "Bash / Shell"],
5697
+ ["sql", "SQL"],
5698
+ ["java", "Java"],
5699
+ ["csharp", "C#"],
5700
+ ["php", "PHP"],
5701
+ ["ruby", "Ruby"],
5702
+ ["go", "Go"],
5703
+ ["rust", "Rust"],
5704
+ ["cpp", "C++"],
5705
+ ["c", "C"],
5706
+ ["kotlin", "Kotlin"],
5707
+ ["swift", "Swift"]
5708
+ ];
5709
+ function ei(e, t) {
5710
+ [...e.classList].forEach((t) => {
5711
+ t.startsWith("language-") && e.classList.remove(t);
5712
+ }), t && e.classList.add(`language-${t}`);
5713
+ }
5714
+ var ti = class {
4996
5715
  constructor(e) {
4997
5716
  this.context = e, this._el = null, this._activePre = null, this._showTimer = null, this._hideTimer = null, this._disposers = [], this._copyBtn = null, this._wrapBtn = null, this._lineNumbersBtn = null, this._langSelect = null, this._prismScript = null;
4998
5717
  }
@@ -5024,32 +5743,10 @@ var Sr = 120, Cr = 200, wr = [
5024
5743
  class: "an-code-lang-select",
5025
5744
  title: e.syntaxLanguage,
5026
5745
  "aria-label": e.syntaxAriaLabel
5027
- }), [
5028
- ["", "Plain text"],
5029
- ["javascript", "JavaScript"],
5030
- ["typescript", "TypeScript"],
5031
- ["python", "Python"],
5032
- ["html", "HTML"],
5033
- ["css", "CSS"],
5034
- ["scss", "SCSS"],
5035
- ["json", "JSON"],
5036
- ["xml", "XML"],
5037
- ["bash", "Bash / Shell"],
5038
- ["sql", "SQL"],
5039
- ["java", "Java"],
5040
- ["csharp", "C#"],
5041
- ["php", "PHP"],
5042
- ["ruby", "Ruby"],
5043
- ["go", "Go"],
5044
- ["rust", "Rust"],
5045
- ["cpp", "C++"],
5046
- ["c", "C"],
5047
- ["kotlin", "Kotlin"],
5048
- ["swift", "Swift"]
5049
- ].forEach(([e, t]) => {
5746
+ }), $r.forEach(([e, t]) => {
5050
5747
  let n = w("option", { value: e });
5051
5748
  n.textContent = t, this._langSelect.appendChild(n);
5052
- }), this._disposers.push(E(this._langSelect, "change", () => this._onLangChange())), t.appendChild(this._langSelect), t.appendChild(this._sep()), this._copyBtn = this._makeBtn(kr.copy, e.copyCode, () => this._copyCode()), t.appendChild(this._copyBtn), t.appendChild(this._sep()), this._wrapBtn = this._makeBtn(kr.wrapOn, e.toggleWordWrap, () => this._toggleWrap()), t.appendChild(this._wrapBtn), this._lineNumbersBtn = this._makeBtn(kr.lineNumbers, e.lineNumbers, () => this._toggleLineNumbers()), t.appendChild(this._lineNumbersBtn), t.appendChild(this._sep()), t.appendChild(this._makeBtn(kr.toParagraph, e.convertToParagraph, () => this._toParagraph())), t.appendChild(this._sep()), t.appendChild(this._makeBtn(kr.deleteCode, e.deleteCodeBlock, () => this._delete(), !0)), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
5749
+ }), this._disposers.push(E(this._langSelect, "change", () => this._onLangChange())), t.appendChild(this._langSelect), t.appendChild(this._sep()), this._copyBtn = this._makeBtn(Qr.copy, e.copyCode, () => this._copyCode()), t.appendChild(this._copyBtn), t.appendChild(this._sep()), this._wrapBtn = this._makeBtn(Qr.wrapOn, e.toggleWordWrap, () => this._toggleWrap()), t.appendChild(this._wrapBtn), this._lineNumbersBtn = this._makeBtn(Qr.lineNumbers, e.lineNumbers, () => this._toggleLineNumbers()), t.appendChild(this._lineNumbersBtn), t.appendChild(this._sep()), t.appendChild(this._makeBtn(Qr.toParagraph, e.convertToParagraph, () => this._toParagraph())), t.appendChild(this._sep()), t.appendChild(this._makeBtn(Qr.deleteCode, e.deleteCodeBlock, () => this._delete(), !0)), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
5053
5750
  }
5054
5751
  _sep() {
5055
5752
  return w("div", { class: "an-link-tooltip-sep" });
@@ -5067,10 +5764,10 @@ var Sr = 120, Cr = 200, wr = [
5067
5764
  _scheduleShow(e) {
5068
5765
  this._activePre === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
5069
5766
  this._activePre = e, this._syncWrapBtn(), this._syncLineNumbersBtn(), this._syncLangSelect(), this._show(e);
5070
- }, Er));
5767
+ }, Yr));
5071
5768
  }
5072
5769
  _scheduleHide() {
5073
- clearTimeout(this._showTimer), this._showTimer = null, clearTimeout(this._hideTimer), this._hideTimer = setTimeout(() => this._hide(), Dr);
5770
+ clearTimeout(this._showTimer), this._showTimer = null, clearTimeout(this._hideTimer), this._hideTimer = setTimeout(() => this._hide(), Xr);
5074
5771
  }
5075
5772
  _show(e) {
5076
5773
  this._el.style.display = "flex", this._positionNear(e);
@@ -5097,7 +5794,7 @@ var Sr = 120, Cr = 200, wr = [
5097
5794
  }
5098
5795
  _syncLangSelect() {
5099
5796
  if (!this._activePre || !this._langSelect) return;
5100
- let e = this._activePre.querySelector("code"), t = this._activePre.dataset.language || "", n = e && (Or.exec(e.className) || [])[1] || "";
5797
+ let e = this._activePre.querySelector("code"), t = this._activePre.dataset.language || "", n = e && (Zr.exec(e.className) || [])[1] || "";
5101
5798
  this._langSelect.value = t || n || "";
5102
5799
  }
5103
5800
  _copyCode() {
@@ -5140,7 +5837,7 @@ var Sr = 120, Cr = 200, wr = [
5140
5837
  let e = this._activePre;
5141
5838
  if (!e) return;
5142
5839
  let t = this._langSelect.value, n = globalThis, r = e.querySelector("code");
5143
- r || (r = document.createElement("code"), r.innerHTML = e.innerHTML, e.innerHTML = "", e.appendChild(r)), r.className = t ? `language-${t}` : "", e.className = t ? `language-${t}` : "", t ? e.dataset.language = t : delete e.dataset.language;
5840
+ r || (r = document.createElement("code"), r.innerHTML = e.innerHTML, e.innerHTML = "", e.appendChild(r)), ei(r, t), ei(e, t), t ? e.dataset.language = t : delete e.dataset.language;
5144
5841
  let i = () => {
5145
5842
  r.querySelectorAll("br").forEach((e) => e.replaceWith("\n")), n.Prism.highlightElement(r), this.context.invoke("editor.afterCommand");
5146
5843
  };
@@ -5203,21 +5900,21 @@ var Sr = 120, Cr = 200, wr = [
5203
5900
  let e = this._activePre;
5204
5901
  e && (this._hide(), e.remove(), this.context.invoke("editor.afterCommand"));
5205
5902
  }
5206
- }, jr = null, Mr = null;
5207
- function Nr() {
5208
- return jr ? Promise.resolve(jr) : (Mr ??= import("./emoji-data-BDQX5kh-.js").then((e) => (jr = {
5903
+ }, ni = null, ri = null;
5904
+ function ii() {
5905
+ return ni ? Promise.resolve(ni) : (ri ??= import("./emoji-data-BDQX5kh-.js").then((e) => (ni = {
5209
5906
  EMOJI_CATS: e.EMOJI_CATS,
5210
5907
  EMOJI_LIST: e.EMOJI_LIST
5211
- }, jr)), Mr);
5908
+ }, ni)), ri);
5212
5909
  }
5213
- var Pr = class extends H {
5910
+ var ai = class extends U {
5214
5911
  _activeCat = "all";
5215
5912
  initialize() {
5216
5913
  return this;
5217
5914
  }
5218
5915
  async show() {
5219
5916
  if (this._saveRange(), !this._dialog) {
5220
- let { EMOJI_CATS: e, EMOJI_LIST: t } = await Nr();
5917
+ let { EMOJI_CATS: e, EMOJI_LIST: t } = await ii();
5221
5918
  this._dialog || (this._cats = e, this._list = t, this._dialog = this._buildDialog(), document.body.appendChild(this._dialog));
5222
5919
  }
5223
5920
  this._activeCat = "all", this._searchInput.value = "", this._updateCatTabs(), this._filterEmojis("", "all"), this._open();
@@ -5274,7 +5971,7 @@ var Pr = class extends H {
5274
5971
  type: "button",
5275
5972
  class: "an-btn"
5276
5973
  });
5277
- p.textContent = e.cancelBtn, f.appendChild(p), n.append(r, c, l, d, f), t.appendChild(n), he(r, n);
5974
+ p.textContent = e.cancelBtn, f.appendChild(p), n.append(r, c, l, d, f), t.appendChild(n), D(r, n);
5278
5975
  let m = E(s, "click", () => this._close()), h = E(p, "click", () => this._close()), g = E(t, "click", (e) => {
5279
5976
  e.target === t && this._close();
5280
5977
  }), _ = E(c, "input", () => this._filterEmojis(c.value, this._activeCat)), v = E(l, "click", (e) => {
@@ -5310,14 +6007,14 @@ var Pr = class extends H {
5310
6007
  let s = document.createTextNode(e);
5311
6008
  i.insertNode(s), i.setStartAfter(s), i.collapse(!0), r && (r.removeAllRanges(), r.addRange(i)), this._close(), n.focus(), this.context.invoke("editor.afterCommand");
5312
6009
  }
5313
- }, Fr = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css", Ir = null, Lr = null;
5314
- function Rr() {
5315
- return Ir ? Promise.resolve(Ir) : (Lr ??= import("./icon-data-V0Xqv-wX.js").then((e) => (Ir = {
6010
+ }, oi = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css", si = null, ci = null;
6011
+ function li() {
6012
+ return si ? Promise.resolve(si) : (ci ??= import("./icon-data-V0Xqv-wX.js").then((e) => (si = {
5316
6013
  ICON_CATEGORIES: e.ICON_CATEGORIES,
5317
6014
  ICON_LIST: e.ICON_LIST
5318
- }, Ir)), Lr);
6015
+ }, si)), ci);
5319
6016
  }
5320
- var zr = class extends H {
6017
+ var ui = class extends U {
5321
6018
  _selectedIcon = null;
5322
6019
  _activeCat = "all";
5323
6020
  initialize() {
@@ -5325,7 +6022,7 @@ var zr = class extends H {
5325
6022
  }
5326
6023
  _ensureFontAwesome() {
5327
6024
  if (this.context.options.fontAwesomeAutoInject === !1) return;
5328
- let e = this.context.options.fontAwesomeCDN || Fr;
6025
+ let e = this.context.options.fontAwesomeCDN || oi;
5329
6026
  if (!e || document.getElementById("an-fontawesome-css")) return;
5330
6027
  let t = Array.from(document.querySelectorAll("link[rel=\"stylesheet\"]")).map((e) => e.href || "").join(" ");
5331
6028
  if (/fontawesome|font-awesome/.test(t) || document.querySelector(".fa-solid, .fas, .far, .fab")) return;
@@ -5334,7 +6031,7 @@ var zr = class extends H {
5334
6031
  }
5335
6032
  async show() {
5336
6033
  if (this._saveRange(), this._ensureFontAwesome(), !this._dialog) {
5337
- let { ICON_CATEGORIES: e, ICON_LIST: t } = await Rr();
6034
+ let { ICON_CATEGORIES: e, ICON_LIST: t } = await li();
5338
6035
  this._dialog || (this._cats = e, this._list = t, this._dialog = this._buildDialog(), document.body.appendChild(this._dialog));
5339
6036
  }
5340
6037
  this._selectedIcon = null, this._activeCat = "all", this._searchInput.value = "", this._grid.querySelectorAll(".an-icon-cell.active").forEach((e) => e.classList.remove("active")), this._insertBtn.setAttribute("disabled", ""), this._updateCatTabs(), this._filterIcons("", "all"), this._updatePreview(null), this._open();
@@ -5440,7 +6137,7 @@ var zr = class extends H {
5440
6137
  type: "button",
5441
6138
  class: "an-btn"
5442
6139
  });
5443
- C.textContent = e.cancelBtn, te.append(S, C), this._insertBtn = S, n.append(r, c, l, d, f, x, te), t.appendChild(n), he(r, n);
6140
+ C.textContent = e.cancelBtn, te.append(S, C), this._insertBtn = S, n.append(r, c, l, d, f, x, te), t.appendChild(n), D(r, n);
5444
6141
  let ne = E(s, "click", () => this._close()), re = E(C, "click", () => this._close()), ie = E(S, "click", () => this._onInsert()), ae = E(t, "click", (e) => {
5445
6142
  e.target === t && this._close();
5446
6143
  }), T = E(c, "input", () => this._filterIcons(c.value, this._activeCat)), oe = E(l, "click", (e) => {
@@ -5525,7 +6222,7 @@ var zr = class extends H {
5525
6222
  highlightColor: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M3 21v-4l9-9 4 4-9 9z\"/><path d=\"M12 8l4 4\"/><line x1=\"3\" y1=\"21\" x2=\"21\" y2=\"21\"/></svg>",
5526
6223
  noColor: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"11\" height=\"11\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\"><line x1=\"4\" y1=\"4\" x2=\"20\" y2=\"20\"/><line x1=\"20\" y1=\"4\" x2=\"4\" y2=\"20\"/></svg>",
5527
6224
  back: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"15 18 9 12 15 6\"/></svg>"
5528
- }, Br = [
6225
+ }, di = [
5529
6226
  "#000000",
5530
6227
  "#434343",
5531
6228
  "#666666",
@@ -5551,19 +6248,19 @@ var zr = class extends H {
5551
6248
  "#d9d2e9",
5552
6249
  "#ead1dc"
5553
6250
  ];
5554
- function Vr(e) {
6251
+ function fi(e) {
5555
6252
  let t = e === "foreColor" ? "Text Color" : "Highlight Color", n = e === "foreColor" ? "textColor" : "highlightColor";
5556
6253
  return () => [{
5557
6254
  back: !0,
5558
6255
  label: t,
5559
6256
  localeKey: n,
5560
- navigate: () => Hr
6257
+ navigate: () => pi
5561
6258
  }, {
5562
6259
  colorPalette: !0,
5563
6260
  colorType: e
5564
6261
  }];
5565
6262
  }
5566
- var Hr = [
6263
+ var pi = [
5567
6264
  {
5568
6265
  name: "cut",
5569
6266
  label: "Cut",
@@ -5627,14 +6324,14 @@ var Hr = [
5627
6324
  label: "Text Color",
5628
6325
  icon: J.textColor,
5629
6326
  colorStrip: "foreColor",
5630
- navigate: Vr("foreColor")
6327
+ navigate: fi("foreColor")
5631
6328
  },
5632
6329
  {
5633
6330
  name: "highlightColor",
5634
6331
  label: "Highlight Color",
5635
6332
  icon: J.highlightColor,
5636
6333
  colorStrip: "hiliteColor",
5637
- navigate: Vr("hiliteColor")
6334
+ navigate: fi("hiliteColor")
5638
6335
  },
5639
6336
  { separator: !0 },
5640
6337
  {
@@ -5681,9 +6378,9 @@ var Hr = [
5681
6378
  icon: J.table,
5682
6379
  tableGrid: !0
5683
6380
  }
5684
- ], Ur = class {
6381
+ ], mi = class {
5685
6382
  constructor(e) {
5686
- this.context = e, this.options = e.options || {}, this._items = this.options.contextMenu?.items || Hr, this.el = null, this._disposers = [], this._menuDisposers = [], this._lastX = 0, this._lastY = 0, this._copiedFormat = null, this._savedRange = null;
6383
+ this.context = e, this.options = e.options || {}, this._items = this.options.contextMenu?.items || pi, this.el = null, this._disposers = [], this._menuDisposers = [], this._lastX = 0, this._lastY = 0, this._copiedFormat = null, this._savedRange = null;
5687
6384
  }
5688
6385
  initialize() {
5689
6386
  this.el = w("div", {
@@ -5769,7 +6466,7 @@ var Hr = [
5769
6466
  }
5770
6467
  if (e.colorPalette) {
5771
6468
  let t = w("div", { class: "an-context-color-palette" });
5772
- if (Br.forEach((n) => {
6469
+ if (di.forEach((n) => {
5773
6470
  let r = w("div", {
5774
6471
  class: "an-context-color-swatch",
5775
6472
  title: n,
@@ -5999,7 +6696,7 @@ var Hr = [
5999
6696
  } catch {}
6000
6697
  this.context.invoke("editor.afterCommand");
6001
6698
  }
6002
- }, Wr = [
6699
+ }, hi = [
6003
6700
  {
6004
6701
  category: "Text Formatting",
6005
6702
  items: [
@@ -6072,12 +6769,12 @@ var Hr = [
6072
6769
  action: "Show this keyboard shortcuts dialog"
6073
6770
  }]
6074
6771
  }
6075
- ], Gr = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"2\" y=\"7\" width=\"20\" height=\"14\" rx=\"2\"/><path d=\"M6 11h.01M10 11h.01M14 11h.01M18 11h.01M6 15h.01M18 15h.01M10 15h4\"/><path d=\"M7 3l5 4 5-4\"/></svg>", Kr = class extends H {
6772
+ ], gi = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"2\" y=\"7\" width=\"20\" height=\"14\" rx=\"2\"/><path d=\"M6 11h.01M10 11h.01M14 11h.01M18 11h.01M6 15h.01M18 15h.01M10 15h4\"/><path d=\"M7 3l5 4 5-4\"/></svg>", _i = class extends U {
6076
6773
  show() {
6077
6774
  this._open();
6078
6775
  }
6079
6776
  _buildDialog() {
6080
- let e = this.context.locale.shortcutsDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, Gr, e.title);
6777
+ let e = this.context.locale.shortcutsDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, gi, e.title);
6081
6778
  n.classList.add("an-shortcuts-box");
6082
6779
  let r = w("button", {
6083
6780
  type: "button",
@@ -6085,7 +6782,7 @@ var Hr = [
6085
6782
  "aria-label": e.close,
6086
6783
  style: "margin-left:auto"
6087
6784
  });
6088
- r.textContent = "×", this._closeBtn = r, this._firstInput = r, n.querySelector(".an-dialog-header").appendChild(r), (this.context.locale.shortcutsDialog.shortcuts || Wr).forEach(({ category: e, items: t }) => {
6785
+ r.textContent = "×", this._closeBtn = r, this._firstInput = r, n.querySelector(".an-dialog-header").appendChild(r), (this.context.locale.shortcutsDialog.shortcuts || hi).forEach(({ category: e, items: t }) => {
6089
6786
  let r = w("div", { class: "an-shortcuts-cat" });
6090
6787
  r.textContent = e, n.appendChild(r);
6091
6788
  let i = w("div", { class: "an-shortcuts-table" });
@@ -6099,7 +6796,7 @@ var Hr = [
6099
6796
  let i = E(r, "click", () => this._close());
6100
6797
  return this._disposers.push(i), t;
6101
6798
  }
6102
- }, qr = class extends H {
6799
+ }, vi = class extends U {
6103
6800
  constructor(e) {
6104
6801
  super(e), this._findInput = null, this._replaceInput = null, this._caseCheckbox = null, this._counterEl = null, this._closeBtn = null, this._matches = [], this._currentIndex = -1, this._caseSensitive = !1, this._useRegex = !1, this._wholeWord = !1, this._mode = "find", this._queryRegex = null, this._lastQuery = null, this._lastCaseSensitive = null, this._lastUseRegex = null, this._lastWholeWord = null, this._focusTimer = null;
6105
6802
  }
@@ -6215,7 +6912,7 @@ var Hr = [
6215
6912
  });
6216
6913
  b.textContent = e.replaceAllBtn, _.append(v, y, b), n.appendChild(_);
6217
6914
  let x = w("div", { class: "an-fr-replace-actions" });
6218
- x.style.display = "none", n.appendChild(x), t.appendChild(n), he(r, n);
6915
+ x.style.display = "none", n.appendChild(x), t.appendChild(n), D(r, n);
6219
6916
  let ee = E(s, "click", () => this._close()), te = E(t, "click", (e) => {
6220
6917
  e.target === t && this._close();
6221
6918
  }), S = E(l, "input", () => this._onSearch()), C = E(d, "click", () => {
@@ -6342,8 +7039,8 @@ var Hr = [
6342
7039
  this._counterEl.textContent = e ? this.context.locale.findReplace.noResults : "";
6343
7040
  } else this._counterEl.textContent = `${this._currentIndex + 1} / ${e}`;
6344
7041
  }
6345
- }, Y = 20, Jr = "#3b82f6", X = (e, t, n) => Math.min(Math.max(e, t), n);
6346
- function Yr(e, t, n, r) {
7042
+ }, Y = 20, yi = "#3b82f6", X = (e, t, n) => Math.min(Math.max(e, t), n);
7043
+ function bi(e, t, n, r) {
6347
7044
  return new Promise((i) => {
6348
7045
  let a = (e) => {
6349
7046
  let a = document.createElement("canvas");
@@ -6367,7 +7064,7 @@ function Yr(e, t, n, r) {
6367
7064
  o.crossOrigin = "anonymous", o.onload = () => a(o), o.onerror = () => i(null), o.src = e.src + (e.src.includes("?") ? "&" : "?") + "_an=" + Date.now();
6368
7065
  });
6369
7066
  }
6370
- var Xr = class {
7067
+ var xi = class {
6371
7068
  constructor(e) {
6372
7069
  this.context = e, this._img = null, this._box = null, this._imgRect = null, this._scrim = null, this._cropBox = null, this._handles = {}, this._toolbar = null, this._infoEl = null, this._dragDisposers = null, this._disposers = [];
6373
7070
  }
@@ -6398,7 +7095,7 @@ var Xr = class {
6398
7095
  t.className = "an-crop-box", t.style.cssText = `
6399
7096
  position:fixed; z-index:10101;
6400
7097
  box-sizing:border-box;
6401
- border:2px solid ${Jr};
7098
+ border:2px solid ${yi};
6402
7099
  cursor:move;
6403
7100
  outline: none;
6404
7101
  `;
@@ -6463,7 +7160,7 @@ var Xr = class {
6463
7160
  "position:absolute",
6464
7161
  "width:10px",
6465
7162
  "height:10px",
6466
- `background:${Jr}`,
7163
+ `background:${yi}`,
6467
7164
  "border:2px solid #fff",
6468
7165
  "border-radius:2px",
6469
7166
  "box-sizing:border-box",
@@ -6497,7 +7194,7 @@ var Xr = class {
6497
7194
  let a = this._makeToolbarBtn("✓ Crop", "#22c55e", () => this._confirm()), o = this._makeToolbarBtn("✕ Cancel", "#94a3b8", () => this._close(!1)), s = document.createElement("label");
6498
7195
  s.style.cssText = "color:#94a3b8;font-size:11px;cursor:pointer;display:flex;align-items:center;gap:4px;";
6499
7196
  let c = document.createElement("input");
6500
- c.type = "checkbox", c.style.accentColor = Jr, s.appendChild(c), s.appendChild(document.createTextNode("Lock ratio")), this._arCheck = c, i.appendChild(a), i.appendChild(o), i.appendChild(s), this._toolbar = i, this._disposers.push(E(i, "mousedown", (e) => e.stopPropagation())), document.body.appendChild(e), document.body.appendChild(t), document.body.appendChild(i), this._scrim = e, this._cropBox = t;
7197
+ c.type = "checkbox", c.style.accentColor = yi, s.appendChild(c), s.appendChild(document.createTextNode("Lock ratio")), this._arCheck = c, i.appendChild(a), i.appendChild(o), i.appendChild(s), this._toolbar = i, this._disposers.push(E(i, "mousedown", (e) => e.stopPropagation())), document.body.appendChild(e), document.body.appendChild(t), document.body.appendChild(i), this._scrim = e, this._cropBox = t;
6501
7198
  }
6502
7199
  _makeToolbarBtn(e, t, n) {
6503
7200
  let r = document.createElement("button");
@@ -6582,7 +7279,7 @@ var Xr = class {
6582
7279
  this._close(!1);
6583
7280
  return;
6584
7281
  }
6585
- let f = await Yr(e, {
7282
+ let f = await bi(e, {
6586
7283
  x: c,
6587
7284
  y: l,
6588
7285
  width: u,
@@ -6626,7 +7323,7 @@ var Xr = class {
6626
7323
  e?.remove();
6627
7324
  }), this._scrim = null, this._cropBox = null, this._toolbar = null, this._infoEl = null, this._handles = {}, this._img = null, this._box = null, this._imgRect = null, this._arCheck = null;
6628
7325
  }
6629
- }, Zr = class {
7326
+ }, Si = class {
6630
7327
  constructor(e) {
6631
7328
  this.context = e, this.options = e.options, this._banner = null;
6632
7329
  }
@@ -6679,7 +7376,7 @@ var Xr = class {
6679
7376
  _removeBanner() {
6680
7377
  this._banner?.remove(), this._banner = null;
6681
7378
  }
6682
- }, Qr = class {
7379
+ }, Ci = class {
6683
7380
  constructor(e) {
6684
7381
  this.context = e, this.options = e.options, this._disposers = [];
6685
7382
  }
@@ -6692,7 +7389,13 @@ var Xr = class {
6692
7389
  this._disposers.forEach((e) => e()), this._disposers = [];
6693
7390
  }
6694
7391
  _onKeydown(e) {
6695
- e.key === " " ? this._applyBlockRule() && e.preventDefault() : e.key === "Enter" && this._applyEnterRule() && e.preventDefault();
7392
+ this._inCodeContext() || (e.key === " " ? this._applyBlockRule() && e.preventDefault() : e.key === "Enter" && this._applyEnterRule() && e.preventDefault());
7393
+ }
7394
+ _inCodeContext() {
7395
+ let e = globalThis.getSelection();
7396
+ if (!e?.rangeCount) return !1;
7397
+ let t = e.getRangeAt(0).startContainer;
7398
+ return !!(t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement)?.closest("pre, code");
6696
7399
  }
6697
7400
  _getLineContext() {
6698
7401
  let e = globalThis.getSelection();
@@ -6721,7 +7424,7 @@ var Xr = class {
6721
7424
  if (!e) return !1;
6722
7425
  let { text: t } = e, n = [
6723
7426
  {
6724
- re: /^(#{1,3})$/,
7427
+ re: /^(#{1,6})$/,
6725
7428
  handler: (e) => this._convertToHeading(e[1].length)
6726
7429
  },
6727
7430
  {
@@ -6729,16 +7432,16 @@ var Xr = class {
6729
7432
  handler: () => this._convertToBlockquote()
6730
7433
  },
6731
7434
  {
6732
- re: /^[-*]$/,
7435
+ re: /^[-*+]$/,
6733
7436
  handler: () => this._convertToList("ul")
6734
7437
  },
6735
7438
  {
6736
- re: /^1\.$/,
7439
+ re: /^1[.)]$/,
6737
7440
  handler: () => this._convertToList("ol")
6738
7441
  },
6739
7442
  {
6740
- re: /^\[ \]$/,
6741
- handler: () => this._convertToChecklist()
7443
+ re: /^\[([ xX])\]$/,
7444
+ handler: (e) => this._convertToChecklist(e[1].toLowerCase() === "x")
6742
7445
  }
6743
7446
  ];
6744
7447
  for (let { re: e, handler: r } of n) {
@@ -6751,7 +7454,7 @@ var Xr = class {
6751
7454
  let e = this._getLineContext();
6752
7455
  if (!e) return !1;
6753
7456
  let { text: t } = e;
6754
- return /^-{3,}$/.test(t) ? (this._convertToHr(), !0) : /^`{3}/.test(t) ? (this._convertToCodeBlock(), !0) : !1;
7457
+ return /^(?:-{3,}|\*{3,}|_{3,})$/.test(t) ? (this._convertToHr(), !0) : /^(?:`{3}|~{3})/.test(t) ? (this._convertToCodeBlock(), !0) : !1;
6755
7458
  }
6756
7459
  _selectLineAndDelete() {
6757
7460
  let e = globalThis.getSelection();
@@ -6768,8 +7471,12 @@ var Xr = class {
6768
7471
  _convertToList(e) {
6769
7472
  this._selectLineAndDelete(), document.execCommand(e === "ul" ? "insertUnorderedList" : "insertOrderedList"), this.context.triggerEvent("change", this.context.getHTML());
6770
7473
  }
6771
- _convertToChecklist() {
6772
- this._selectLineAndDelete(), this.context.invoke("editor.toggleChecklist"), this.context.triggerEvent("change", this.context.getHTML());
7474
+ _convertToChecklist(e = !1) {
7475
+ if (this._selectLineAndDelete(), this.context.invoke("editor.toggleChecklist"), e) {
7476
+ let e = globalThis.getSelection(), t = e?.rangeCount ? e.getRangeAt(0).startContainer : null, n = (t?.nodeType === Node.ELEMENT_NODE ? t : t?.parentElement ?? null)?.closest("li")?.querySelector("input[type=\"checkbox\"]") ?? null;
7477
+ n && (n.checked = !0);
7478
+ }
7479
+ this.context.triggerEvent("change", this.context.getHTML());
6773
7480
  }
6774
7481
  _convertToHr() {
6775
7482
  this._selectLineAndDelete(), this.context.invoke("editor.insertHr"), this.context.triggerEvent("change", this.context.getHTML());
@@ -6778,6 +7485,7 @@ var Xr = class {
6778
7485
  this._selectLineAndDelete(), document.execCommand("formatBlock", !1, "pre"), this.context.triggerEvent("change", this.context.getHTML());
6779
7486
  }
6780
7487
  _onInput() {
7488
+ if (this._inCodeContext()) return;
6781
7489
  let e = globalThis.getSelection();
6782
7490
  if (!e?.rangeCount) return;
6783
7491
  let t = e.getRangeAt(0);
@@ -6814,7 +7522,7 @@ var Xr = class {
6814
7522
  break;
6815
7523
  }
6816
7524
  }
6817
- }, $r = [
7525
+ }, wi = [
6818
7526
  "#000000",
6819
7527
  "#434343",
6820
7528
  "#666666",
@@ -6839,7 +7547,7 @@ var Xr = class {
6839
7547
  "#c9daf8",
6840
7548
  "#d9d2e9",
6841
7549
  "#ead1dc"
6842
- ], ei = "stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"", Z = (e) => `<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" ${ei} style="display:block">${e}</svg>`, ti = {
7550
+ ], Ti = "stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"", Z = (e) => `<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" ${Ti} style="display:block">${e}</svg>`, Ei = {
6843
7551
  bold: Z("<path d=\"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z\"/><path d=\"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z\"/>"),
6844
7552
  italic: Z("<line x1=\"19\" y1=\"4\" x2=\"10\" y2=\"4\"/><line x1=\"14\" y1=\"20\" x2=\"5\" y2=\"20\"/><line x1=\"15\" y1=\"4\" x2=\"9\" y2=\"20\"/>"),
6845
7553
  underline: Z("<path d=\"M6 3v7a6 6 0 0 0 6 6 6 6 0 0 0 6-6V3\"/><line x1=\"4\" y1=\"21\" x2=\"20\" y2=\"21\"/>"),
@@ -6849,7 +7557,7 @@ var Xr = class {
6849
7557
  hiliteColor: Z("<path d=\"M3 21v-4l9-9 4 4-9 9z\"/><path d=\"M12 8l4 4\"/><line x1=\"3\" y1=\"21\" x2=\"21\" y2=\"21\"/>"),
6850
7558
  removeFormat: Z("<path d=\"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21\"/><path d=\"M22 21H7\"/><path d=\"m5 11 9 9\"/>"),
6851
7559
  inlineCode: Z("<path d=\"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1\"/><path d=\"M16 3h1a2 2 0 0 1 2 2v5c0 1.1.9 2 2 2a2 2 0 0 1-2 2v5a2 2 0 0 1-2 2h-1\"/>")
6852
- }, ni = {
7560
+ }, Di = {
6853
7561
  bold: (e) => e.invoke("editor.bold"),
6854
7562
  italic: (e) => e.invoke("editor.italic"),
6855
7563
  underline: (e) => e.invoke("editor.underline"),
@@ -6870,15 +7578,15 @@ var Xr = class {
6870
7578
  e.invoke("editor.afterCommand");
6871
7579
  },
6872
7580
  inlineCode: (e) => e.invoke("editor.inlineCode")
6873
- }, ri = {
7581
+ }, Oi = {
6874
7582
  bold: () => document.queryCommandState("bold"),
6875
7583
  italic: () => document.queryCommandState("italic"),
6876
7584
  underline: () => document.queryCommandState("underline"),
6877
7585
  strikethrough: () => document.queryCommandState("strikeThrough")
6878
- }, ii = {
7586
+ }, ki = {
6879
7587
  foreColor: !0,
6880
7588
  hiliteColor: !0
6881
- }, ai = class {
7589
+ }, Ai = class {
6882
7590
  constructor(e) {
6883
7591
  this.context = e, this.options = e.options, this._el = null, this._picker = null, this._pickerType = null, this._savedRange = null, this._visible = !1, this._rafId = null, this._contextMenuOpen = !1, this._disposers = [], this._onSelectionChange = this._onSelectionChange.bind(this), this._onMousedown = this._onMousedown.bind(this), this._onKeydown = this._onKeydown.bind(this), this._onContextMenu = this._onContextMenu.bind(this);
6884
7592
  }
@@ -6908,23 +7616,23 @@ var Xr = class {
6908
7616
  "removeFormat"
6909
7617
  ];
6910
7618
  for (let n of t) {
6911
- if (!ti[n]) continue;
7619
+ if (!Ei[n]) continue;
6912
7620
  let t = document.createElement("button");
6913
- if (t.type = "button", t.dataset.name = n, t.setAttribute("aria-label", n), ii[n]) {
7621
+ if (t.type = "button", t.dataset.name = n, t.setAttribute("aria-label", n), ki[n]) {
6914
7622
  t.className = "an-bubble-btn an-bubble-btn--color";
6915
7623
  let e = document.createElement("span");
6916
- e.className = "an-bubble-btn-svg", e.innerHTML = ti[n];
7624
+ e.className = "an-bubble-btn-svg", e.innerHTML = Ei[n];
6917
7625
  let r = document.createElement("span");
6918
7626
  r.className = "an-bubble-color-strip", r.style.background = n === "foreColor" ? "#000000" : "transparent", t.appendChild(e), t.appendChild(r);
6919
- } else t.className = "an-bubble-btn", t.innerHTML = ti[n];
7627
+ } else t.className = "an-bubble-btn", t.innerHTML = Ei[n];
6920
7628
  t.addEventListener("mousedown", (e) => {
6921
7629
  e.preventDefault();
6922
7630
  }), t.addEventListener("click", (e) => {
6923
- if (e.preventDefault(), e.stopPropagation(), ii[n]) {
7631
+ if (e.preventDefault(), e.stopPropagation(), ki[n]) {
6924
7632
  this._openColorPicker(n, t);
6925
7633
  return;
6926
7634
  }
6927
- this.context.invoke("editor.focus"), ni[n] && ni[n](this.context), this._syncActive();
7635
+ this.context.invoke("editor.focus"), Di[n] && Di[n](this.context), this._syncActive();
6928
7636
  }), e.appendChild(t);
6929
7637
  }
6930
7638
  document.body.appendChild(e), this._el = e, this._btnCache = Array.from(e.querySelectorAll(".an-bubble-btn"));
@@ -6933,7 +7641,7 @@ var Xr = class {
6933
7641
  let e = document.createElement("div");
6934
7642
  e.className = "an-bubble-color-picker", e.style.display = "none", e.addEventListener("mousedown", (e) => e.preventDefault());
6935
7643
  let t = document.createElement("div");
6936
- t.className = "an-context-color-palette", $r.forEach((e) => {
7644
+ t.className = "an-context-color-palette", wi.forEach((e) => {
6937
7645
  let n = document.createElement("div");
6938
7646
  n.className = "an-context-color-swatch", n.title = e, n.style.background = e, n.setAttribute("role", "button"), n.setAttribute("aria-label", e), n.addEventListener("click", (t) => {
6939
7647
  t.stopPropagation(), this._applyColor(this._pickerType, e);
@@ -7001,7 +7709,7 @@ var Xr = class {
7001
7709
  }
7002
7710
  _syncActive() {
7003
7711
  this._btnCache && this._btnCache.forEach((e) => {
7004
- let t = ri[e.dataset.name];
7712
+ let t = Oi[e.dataset.name];
7005
7713
  e.classList.toggle("an-active", !!t?.());
7006
7714
  });
7007
7715
  }
@@ -7052,7 +7760,7 @@ var Xr = class {
7052
7760
  _onContextMenu() {
7053
7761
  this._hide();
7054
7762
  }
7055
- }, oi = class {
7763
+ }, ji = class {
7056
7764
  constructor(e) {
7057
7765
  this.context = e, this._dropdown = null, this._query = "", this._debounceTimer = null, this._activeIndex = -1, this._items = [], this._open = !1, this._triggerNode = null, this._triggerOffset = 0, this._caretRect = null, this._disposers = [];
7058
7766
  }
@@ -7197,7 +7905,7 @@ var Xr = class {
7197
7905
  let n;
7198
7906
  typeof this._cfg.onInsert == "function" && (n = this._cfg.onInsert(t)), n ||= `<span class="${this._cfg.mentionClass}" data-mention-id="${t.id}" contenteditable="false">@${t.label}</span>`, this.context.invoke("editor.insertHTML", n + "&#8203;"), this._hideDropdown(), this.context.triggerEvent("change", this.context.getHTML());
7199
7907
  }
7200
- }, si = class {
7908
+ }, Mi = class {
7201
7909
  constructor(e) {
7202
7910
  this.context = e, this.options = e.options, this._disposers = [], this._menu = null, this._filtered = [], this._activeIndex = -1, this._open = !1, this._query = "", this._textNode = null, this._triggerOffset = 0, this._caretRect = null;
7203
7911
  }
@@ -7424,38 +8132,38 @@ var Xr = class {
7424
8132
  this._deleteTriggerText(), this._close(), t.run();
7425
8133
  }
7426
8134
  }
7427
- }, ci = /* @__PURE__ */ new Map(), li = [
8135
+ }, Ni = /* @__PURE__ */ new Map(), Pi = [
7428
8136
  {
7429
8137
  name: "autoSaveRestore",
7430
- Class: Zr,
8138
+ Class: Si,
7431
8139
  enabled: (e) => !!e.autoSaveRestore
7432
8140
  },
7433
8141
  {
7434
8142
  name: "markdownShortcuts",
7435
- Class: Qr,
8143
+ Class: Ci,
7436
8144
  enabled: (e) => e.markdownShortcuts !== !1
7437
8145
  },
7438
8146
  {
7439
8147
  name: "bubbleToolbar",
7440
- Class: ai,
8148
+ Class: Ai,
7441
8149
  enabled: (e) => !!e.bubbleToolbar
7442
8150
  },
7443
8151
  {
7444
8152
  name: "mention",
7445
- Class: oi,
8153
+ Class: ji,
7446
8154
  enabled: (e) => !!e.mention
7447
8155
  },
7448
8156
  {
7449
8157
  name: "slashMenu",
7450
- Class: si,
8158
+ Class: Mi,
7451
8159
  enabled: (e) => e.slashMenu !== !1
7452
8160
  }
7453
- ], ui = /* @__PURE__ */ new Map(), di = class {
8161
+ ], Fi = /* @__PURE__ */ new Map(), Ii = class {
7454
8162
  constructor(e, t = {}) {
7455
8163
  this.targetEl = e, this.options = c(A, t), this.locale = Wt(this.options.lang), this.layoutInfo = {}, this._listeners = /* @__PURE__ */ new Map(), this._modules = /* @__PURE__ */ new Map(), this._plugins = /* @__PURE__ */ new Map(), this._disposers = [], this._alive = !1, this._autoSaveTimer = null, this._pendingAutoSave = null, this._suppressedRemoteHTML = null, this._destroyPromise = null;
7456
8164
  }
7457
8165
  initialize() {
7458
- let { container: e, editable: t } = cn(this.targetEl, this.options);
8166
+ let { container: e, editable: t } = ln(this.targetEl, this.options);
7459
8167
  this.layoutInfo.container = e, this.layoutInfo.editable = t, this._registerModules();
7460
8168
  let n = this._modules.get("toolbar");
7461
8169
  n?.el && (e.insertBefore(n.el, t), this.layoutInfo.toolbar = n.el);
@@ -7467,12 +8175,12 @@ var Xr = class {
7467
8175
  let n = new t(this);
7468
8176
  this._modules.set(e, n), n.initialize();
7469
8177
  };
7470
- e("editor", Un), e("toolbar", Jn), e("statusbar", Qn), e("clipboard", $n), e("contextMenu", Ur), e("placeholder", er), e("codeview", tr), e("fullscreen", nr), e("linkDialog", ir), e("imageDialog", or), e("videoDialog", cr), e("imageResizer", dr), e("videoResizer", fr), e("linkTooltip", gr), e("imageTooltip", vr), e("videoTooltip", yr), e("tableTooltip", Tr), e("codeTooltip", Ar), e("emojiDialog", Pr), e("iconDialog", zr), e("shortcutsDialog", Kr), e("findReplace", qr), e("imageCropOverlay", Xr);
7471
- for (let { name: t, Class: n, enabled: r } of li) r(this.options) && e(t, n);
7472
- if (ci.size > 0) for (let [t, n] of ci) e(t, n);
8178
+ e("editor", dr), e("toolbar", gr), e("statusbar", br), e("clipboard", xr), e("contextMenu", mi), e("placeholder", Sr), e("codeview", Cr), e("fullscreen", wr), e("linkDialog", Er), e("imageDialog", Or), e("videoDialog", Ar), e("imageResizer", Nr), e("videoResizer", Pr), e("linkTooltip", Rr), e("imageTooltip", Br), e("videoTooltip", Vr), e("tableTooltip", Jr), e("codeTooltip", ti), e("emojiDialog", ai), e("iconDialog", ui), e("shortcutsDialog", _i), e("findReplace", vi), e("imageCropOverlay", xi);
8179
+ for (let { name: t, Class: n, enabled: r } of Pi) r(this.options) && e(t, n);
8180
+ if (Ni.size > 0) for (let [t, n] of Ni) e(t, n);
7473
8181
  }
7474
8182
  _syncOptionalModules() {
7475
- for (let { name: e, Class: t, enabled: n } of li) {
8183
+ for (let { name: e, Class: t, enabled: n } of Pi) {
7476
8184
  let r = n(this.options);
7477
8185
  if (r !== this._modules.has(e)) if (r) {
7478
8186
  let n = new t(this);
@@ -7516,7 +8224,7 @@ var Xr = class {
7516
8224
  });
7517
8225
  }
7518
8226
  _applyGlobalPlugins() {
7519
- if (ui.size !== 0) for (let { plugin: e, options: t } of ui.values()) this._installPlugin(e, t);
8227
+ if (Fi.size !== 0) for (let { plugin: e, options: t } of Fi.values()) this._installPlugin(e, t);
7520
8228
  }
7521
8229
  _bindEditorEvents(e) {
7522
8230
  let t = E(e, "input", () => this._syncToTarget()), n = E(e, "focus", () => {
@@ -7772,39 +8480,39 @@ var Xr = class {
7772
8480
  };
7773
8481
  //#endregion
7774
8482
  //#region src/js/core/lists.js
7775
- function fi(e) {
8483
+ function Li(e) {
7776
8484
  return e[e.length - 1];
7777
8485
  }
7778
- function pi(e) {
8486
+ function Ri(e) {
7779
8487
  return e[0];
7780
8488
  }
7781
- function mi(e, t = 1) {
8489
+ function zi(e, t = 1) {
7782
8490
  return e.slice(0, e.length - t);
7783
8491
  }
7784
- function hi(e, t = 1) {
8492
+ function Bi(e, t = 1) {
7785
8493
  return e.slice(t);
7786
8494
  }
7787
- function gi(e) {
8495
+ function Vi(e) {
7788
8496
  return e.flat();
7789
8497
  }
7790
- function _i(e) {
8498
+ function Hi(e) {
7791
8499
  return [...new Set(e)];
7792
8500
  }
7793
- function vi(e, t) {
8501
+ function Ui(e, t) {
7794
8502
  let n = [];
7795
8503
  for (let r = 0; r < e.length; r += t) n.push(e.slice(r, r + t));
7796
8504
  return n;
7797
8505
  }
7798
- function yi(e, t) {
8506
+ function Wi(e, t) {
7799
8507
  return e.reduce((e, n) => {
7800
8508
  let r = t(n);
7801
8509
  return e[r] || (e[r] = []), e[r].push(n), e;
7802
8510
  }, {});
7803
8511
  }
7804
- function bi(e, t) {
8512
+ function Gi(e, t) {
7805
8513
  return e.every(t);
7806
8514
  }
7807
- function xi(e, t) {
8515
+ function Ki(e, t) {
7808
8516
  return e.some(t);
7809
8517
  }
7810
8518
  //#endregion
@@ -7812,7 +8520,7 @@ function xi(e, t) {
7812
8520
  function Q() {
7813
8521
  return globalThis.navigator?.userAgent ?? "";
7814
8522
  }
7815
- var Si = {
8523
+ var qi = {
7816
8524
  get isChrome() {
7817
8525
  return /Chrome\//.test(Q()) && !/Edg\//.test(Q());
7818
8526
  },
@@ -7837,17 +8545,17 @@ var Si = {
7837
8545
  get modifierKey() {
7838
8546
  return /Macintosh/.test(Q()) ? "metaKey" : "ctrlKey";
7839
8547
  }
7840
- }, Ci = { ...A }, $ = /* @__PURE__ */ new WeakMap(), wi = {
8548
+ }, Ji = { ...A }, $ = /* @__PURE__ */ new WeakMap(), Yi = {
7841
8549
  create(e, t = {}) {
7842
- let n = Ti(e).map((e) => {
8550
+ let n = Xi(e).map((e) => {
7843
8551
  if ($.has(e)) return $.get(e);
7844
- let n = new di(e, t);
8552
+ let n = new Ii(e, t);
7845
8553
  return n.initialize(), $.set(e, n), n;
7846
8554
  });
7847
8555
  return n.length === 1 ? n[0] : n;
7848
8556
  },
7849
8557
  destroy(e) {
7850
- Ti(e).forEach((e) => {
8558
+ Xi(e).forEach((e) => {
7851
8559
  let t = $.get(e);
7852
8560
  t && (t.destroy(), $.delete(e));
7853
8561
  });
@@ -7863,20 +8571,20 @@ var Si = {
7863
8571
  Object.assign(A, e);
7864
8572
  },
7865
8573
  resetDefaults() {
7866
- Object.keys(A).forEach((e) => delete A[e]), Object.assign(A, Ci);
8574
+ Object.keys(A).forEach((e) => delete A[e]), Object.assign(A, Ji);
7867
8575
  },
7868
8576
  registerModule(e, t) {
7869
- ci.set(e, t);
8577
+ Ni.set(e, t);
7870
8578
  },
7871
8579
  use(e, t = {}) {
7872
8580
  if (!e || typeof e.name != "string") throw TypeError("[AutumnNote] AutumnNote.use: plugin must have a string `name` property.");
7873
- return ui.has(e.name) ? (console.warn(`[AutumnNote] Plugin "${e.name}" already registered globally. Skipping.`), this) : (Array.isArray(e.buttons) && e.buttons.forEach((e) => $e(e)), ui.set(e.name, {
8581
+ return Fi.has(e.name) ? (console.warn(`[AutumnNote] Plugin "${e.name}" already registered globally. Skipping.`), this) : (Array.isArray(e.buttons) && e.buttons.forEach((e) => $e(e)), Fi.set(e.name, {
7874
8582
  plugin: e,
7875
8583
  options: t
7876
8584
  }), this);
7877
8585
  },
7878
8586
  hasPlugin(e) {
7879
- return ui.has(e);
8587
+ return Fi.has(e);
7880
8588
  },
7881
8589
  registerButton(e) {
7882
8590
  return $e(e), this;
@@ -7890,12 +8598,12 @@ var Si = {
7890
8598
  return n >= 0 ? t[n] = e : t.push(e), this;
7891
8599
  },
7892
8600
  buttons: Vt,
7893
- version: "2.2.0"
8601
+ version: "2.4.0"
7894
8602
  };
7895
- function Ti(e) {
8603
+ function Xi(e) {
7896
8604
  return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : e instanceof Element ? [e] : e instanceof NodeList || Array.isArray(e) ? Array.from(e) : [];
7897
8605
  }
7898
8606
  //#endregion
7899
- export { di as Context, d as ELEMENT_NODE, f as TEXT_NODE, ge as WrappedRange, Qe as _buttonRegistry, ct as alignCenterBtn, ut as alignJustifyBtn, st as alignLeftBtn, lt as alignRightBtn, bi as all, ne as ancestors, xi as any, zt as backColorBtn, tt as boldBtn, Vt as buttons, It as checklistBtn, re as children, vi as chunk, e as clamp, S as closest, C as closestPara, At as codeviewBtn, be as collapsedRange, r as compose, w as createElement, ve as currentRange, t as debounce, wi as default, A as defaultOptions, Bt as defaultToolbar, Et as directionBtn, xt as emojiBtn, Si as env, Nt as findBtn, Pt as findReplaceBtn, pi as first, gi as flatten, Dt as fontFamilyBtn, wt as fontSizeBtn, Rt as foreColorBtn, _e as fromNativeRange, jt as fullscreenBtn, et as getButton, yi as groupBy, _t as hrBtn, St as iconBtn, i as identity, yt as imageBtn, pt as indentBtn, mi as initial, Ft as inlineCodeBtn, ce as insertAfter, ee as isAnchor, x as isEditable, p as isElement, ue as isEmpty, s as isFunction, te as isImage, b as isInline, pe as isInsideEditable, F as isKey, _ as isLi, v as isList, I as isModifier, a as isNil, g as isPara, l as isPlainObject, xe as isSelectionInside, o as isString, y as isTable, m as isText, h as isVoid, nt as italicBtn, P as key, fi as last, kt as lineHeightBtn, vt as linkBtn, Ht as locales, he as makeDraggable, c as mergeDeep, ae as nextElement, le as nodeValue, ft as olBtn, E as on, mt as outdentBtn, de as outerHtml, Ot as paragraphStyleBtn, fe as placeCaret, ie as prevElement, Lt as printBtn, ye as rangeFromElement, u as rect2bnd, gt as redoBtn, $e as registerButton, Ut as registerLocale, T as remove, Tt as removeFormatBtn, Wt as resolveLocale, M as sanitiseHTML, N as sanitiseUrl, Mt as shortcutsBtn, Ce as splitText, it as strikeBtn, ot as subscriptBtn, at as superscriptBtn, Ct as tableBtn, hi as tail, n as throttle, me as trapFocus, dt as ulBtn, rt as underlineBtn, ht as undoBtn, _i as unique, oe as unwrap, bt as videoBtn, Se as withSavedRange, se as wrap };
8607
+ export { Ii as Context, d as ELEMENT_NODE, f as TEXT_NODE, he as WrappedRange, Qe as _buttonRegistry, ct as alignCenterBtn, ut as alignJustifyBtn, st as alignLeftBtn, lt as alignRightBtn, Gi as all, ne as ancestors, Ki as any, zt as backColorBtn, tt as boldBtn, Vt as buttons, It as checklistBtn, re as children, Ui as chunk, e as clamp, S as closest, C as closestPara, At as codeviewBtn, ye as collapsedRange, r as compose, w as createElement, _e as currentRange, t as debounce, Yi as default, A as defaultOptions, Bt as defaultToolbar, Et as directionBtn, xt as emojiBtn, qi as env, Nt as findBtn, Pt as findReplaceBtn, Ri as first, Vi as flatten, Dt as fontFamilyBtn, wt as fontSizeBtn, Rt as foreColorBtn, ge as fromNativeRange, jt as fullscreenBtn, et as getButton, Wi as groupBy, _t as hrBtn, St as iconBtn, i as identity, yt as imageBtn, pt as indentBtn, zi as initial, Ft as inlineCodeBtn, ce as insertAfter, ee as isAnchor, x as isEditable, p as isElement, ue as isEmpty, s as isFunction, te as isImage, b as isInline, pe as isInsideEditable, P as isKey, _ as isLi, v as isList, F as isModifier, a as isNil, g as isPara, l as isPlainObject, be as isSelectionInside, o as isString, y as isTable, m as isText, h as isVoid, nt as italicBtn, N as key, Li as last, kt as lineHeightBtn, vt as linkBtn, Ht as locales, D as makeDraggable, c as mergeDeep, ae as nextElement, le as nodeValue, ft as olBtn, E as on, mt as outdentBtn, de as outerHtml, Ot as paragraphStyleBtn, fe as placeCaret, ie as prevElement, Lt as printBtn, ve as rangeFromElement, u as rect2bnd, gt as redoBtn, $e as registerButton, Ut as registerLocale, T as remove, Tt as removeFormatBtn, Wt as resolveLocale, M as sanitiseHTML, sn as sanitiseUrl, Mt as shortcutsBtn, Se as splitText, it as strikeBtn, ot as subscriptBtn, at as superscriptBtn, Ct as tableBtn, Bi as tail, n as throttle, me as trapFocus, dt as ulBtn, rt as underlineBtn, ht as undoBtn, Hi as unique, oe as unwrap, bt as videoBtn, xe as withSavedRange, se as wrap };
7900
8608
 
7901
8609
  //# sourceMappingURL=autumnnote.es.js.map