autumnnote 2.0.0 → 2.2.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.
Files changed (64) hide show
  1. package/README.md +72 -5
  2. package/dist/autumnnote.cjs +20 -20
  3. package/dist/autumnnote.css +1 -1
  4. package/dist/autumnnote.es.js +661 -798
  5. package/dist/autumnnote.es.js.map +1 -1
  6. package/dist/autumnnote.min.js +20 -20
  7. package/dist/autumnnote.umd.js +20 -20
  8. package/dist/autumnnote.umd.js.map +1 -1
  9. package/dist/icon-data-V0Xqv-wX.js +255 -0
  10. package/dist/icon-data-V0Xqv-wX.js.map +1 -0
  11. package/package.json +13 -4
  12. package/types/index.d.ts +8 -0
  13. package/src/js/Context.js +0 -854
  14. package/src/js/core/detectLang.js +0 -98
  15. package/src/js/core/dom.js +0 -372
  16. package/src/js/core/env.js +0 -25
  17. package/src/js/core/key.js +0 -66
  18. package/src/js/core/lists.js +0 -121
  19. package/src/js/core/markdown.js +0 -695
  20. package/src/js/core/range.js +0 -194
  21. package/src/js/core/sanitise.js +0 -231
  22. package/src/js/editing/History.js +0 -266
  23. package/src/js/editing/Style.js +0 -812
  24. package/src/js/editing/Table.js +0 -105
  25. package/src/js/editing/Typing.js +0 -397
  26. package/src/js/index.js +0 -193
  27. package/src/js/index.umd.js +0 -17
  28. package/src/js/module/AutoSaveRestore.js +0 -125
  29. package/src/js/module/BaseDialog.js +0 -133
  30. package/src/js/module/BaseMediaTooltip.js +0 -142
  31. package/src/js/module/BaseResizer.js +0 -312
  32. package/src/js/module/BubbleToolbar.js +0 -483
  33. package/src/js/module/Buttons.js +0 -399
  34. package/src/js/module/Clipboard.js +0 -579
  35. package/src/js/module/CodeTooltip.js +0 -493
  36. package/src/js/module/Codeview.js +0 -125
  37. package/src/js/module/ContextMenu.js +0 -621
  38. package/src/js/module/Editor.js +0 -747
  39. package/src/js/module/EmojiDialog.js +0 -254
  40. package/src/js/module/FindReplace.js +0 -512
  41. package/src/js/module/Fullscreen.js +0 -80
  42. package/src/js/module/IconDialog.js +0 -618
  43. package/src/js/module/ImageCropOverlay.js +0 -586
  44. package/src/js/module/ImageDialog.js +0 -193
  45. package/src/js/module/ImageResizer.js +0 -42
  46. package/src/js/module/ImageTooltip.js +0 -285
  47. package/src/js/module/LinkDialog.js +0 -145
  48. package/src/js/module/LinkTooltip.js +0 -250
  49. package/src/js/module/MarkdownShortcuts.js +0 -250
  50. package/src/js/module/Mention.js +0 -365
  51. package/src/js/module/Placeholder.js +0 -51
  52. package/src/js/module/ShortcutsDialog.js +0 -111
  53. package/src/js/module/SlashMenu.js +0 -376
  54. package/src/js/module/Statusbar.js +0 -246
  55. package/src/js/module/TableTooltip.js +0 -1521
  56. package/src/js/module/Toolbar.js +0 -750
  57. package/src/js/module/VideoDialog.js +0 -193
  58. package/src/js/module/VideoResizer.js +0 -66
  59. package/src/js/module/VideoTooltip.js +0 -248
  60. package/src/js/module/emoji-data.js +0 -496
  61. package/src/js/renderer.js +0 -120
  62. package/src/js/settings.js +0 -214
  63. package/src/styles/_variables.scss +0 -48
  64. package/src/styles/autumnnote.scss +0 -2866
@@ -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 D(e, t) {
144
+ function he(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 D(e, t) {
163
163
  }
164
164
  //#endregion
165
165
  //#region src/js/core/range.js
166
- var he = class {
166
+ var ge = 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 he = class {
199
199
  this.toNativeRange().insertNode(e);
200
200
  }
201
201
  };
202
- function ge(e) {
203
- return new he(e.startContainer, e.startOffset, e.endContainer, e.endOffset);
204
- }
205
202
  function _e(e) {
203
+ return new ge(e.startContainer, e.startOffset, e.endContainer, e.endOffset);
204
+ }
205
+ function ve(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 : ge(n);
209
+ return e && !e.contains(n.commonAncestorContainer) ? null : _e(n);
210
210
  }
211
- function ve(e) {
212
- return new he(e, 0, e, e.childNodes.length);
211
+ function ye(e) {
212
+ return new ge(e, 0, e, e.childNodes.length);
213
213
  }
214
- function ye(e, t = 0) {
215
- return new he(e, t, e, t);
214
+ function be(e, t = 0) {
215
+ return new ge(e, t, e, t);
216
216
  }
217
- function be(e) {
217
+ function xe(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 xe(e) {
221
+ function Se(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(ge(n)), t.removeAllRanges(), t.addRange(n);
228
+ e(_e(n)), t.removeAllRanges(), t.addRange(n);
229
229
  }
230
- function Se(e, t) {
230
+ function Ce(e, t) {
231
231
  return [e, e.splitText(t)];
232
232
  }
233
233
  //#endregion
234
234
  //#region src/js/editing/Style.js
235
- function O(e, t = null) {
235
+ function D(e, t = null) {
236
236
  return document.execCommand(e, !1, t);
237
237
  }
238
- var Ce = () => O("bold"), we = () => O("italic");
239
- function Te() {
238
+ var we = () => D("bold"), Te = () => D("italic");
239
+ function Ee() {
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 Te() {
248
248
  n.remove();
249
249
  return;
250
250
  }
251
- O("underline");
251
+ D("underline");
252
252
  }
253
- function Ee() {
253
+ function De() {
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 Ee() {
262
262
  n.remove();
263
263
  return;
264
264
  }
265
- O("strikeThrough");
265
+ D("strikeThrough");
266
266
  }
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) {
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) {
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 Me(e, t = document) {
278
278
  } catch {}
279
279
  return;
280
280
  }
281
- O("fontSize", "7");
281
+ D("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 Me(e, t = document) {
292
292
  } catch {}
293
293
  }
294
294
  }
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() {
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() {
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
- Be(n);
303
+ Ve(n);
304
304
  return;
305
305
  }
306
306
  }
307
- O("outdent");
307
+ D("outdent");
308
308
  }
309
- function Be(e) {
309
+ function Ve(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 Be(e) {
323
323
  n && (n.removeAllRanges(), n.addRange(e));
324
324
  } catch {}
325
325
  }
326
- function Ve() {
326
+ function He() {
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 He(e) {
332
+ function Ue(e) {
333
333
  e.classList.remove("an-checklist"), e.querySelectorAll("input[type=\"checkbox\"]").forEach((e) => e.remove());
334
334
  }
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
- }
339
335
  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");
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");
342
338
  }
343
- function Ge(e) {
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");
342
+ }
343
+ function Ke(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 Ge(e) {
383
383
  t.style.lineHeight = e;
384
384
  });
385
385
  }
386
- function Ke(e) {
386
+ function qe(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 Ke(e) {
415
415
  }
416
416
  }
417
417
  }
418
- function qe() {
418
+ function Je() {
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 qe() {
423
423
  let n = t?.closest("code");
424
424
  return !!(n && !n.closest("pre"));
425
425
  }
426
- function Je(e, t) {
426
+ function O(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 = Je(r, "ul");
459
+ let t = O(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)", () => Ce(), () => document.queryCommandState("bold")), nt = k("italic", "italic", "Italic (Ctrl+I)", () => we(), () => document.queryCommandState("italic")), rt = k("underline", "underline", "Underline (Ctrl+U)", () => Te(), () => {
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(), () => {
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", () => 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 = {
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 = {
569
569
  name: "table",
570
570
  type: "grid",
571
571
  icon: "table",
@@ -596,7 +596,7 @@ var tt = k("bold", "bold", "Bold (Ctrl+B)", () => Ce(), () => document.queryComm
596
596
  "48px",
597
597
  "72px"
598
598
  ],
599
- action: (e, t) => Me(t, e.layoutInfo.editable),
599
+ action: (e, t) => Ne(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)", () => Ce(), () => document.queryComm
612
612
  return "";
613
613
  }
614
614
  }
615
- }, Tt = k("removeFormat", "remove-format", "Remove Format", () => O("removeFormat")), Et = k("direction", "direction", "Toggle Text Direction (LTR / RTL)", (e) => {
615
+ }, Tt = k("removeFormat", "remove-format", "Remove Format", () => D("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) => je(t),
622
+ action: (e, t) => Me(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)", () => Ce(), () => document.queryComm
671
671
  label: "Code"
672
672
  }
673
673
  ],
674
- action: (e, t) => Ne(t),
674
+ action: (e, t) => Pe(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)", () => Ce(), () => document.queryComm
695
695
  "2.5",
696
696
  "3.0"
697
697
  ],
698
- action: (e, t) => Ge(t),
698
+ action: (e, t) => Ke(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)", () => Ce(), () => 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"), () => qe()), 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"), () => Je()), 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) => ke(t)
730
+ action: (e, t) => Ae(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) => Ae(t)
737
+ action: (e, t) => je(t)
738
738
  }, Bt = [
739
739
  [
740
740
  Ot,
@@ -835,6 +835,8 @@ var tt = k("bold", "bold", "Bold (Ctrl+B)", () => Ce(), () => document.queryComm
835
835
  toolbarButtonClass: "btn btn-sm btn-light",
836
836
  useFontAwesome: !0,
837
837
  fontAwesomeClass: "fas",
838
+ fontAwesomeAutoInject: !0,
839
+ fontAwesomeCDN: "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css",
838
840
  pasteAsPlainText: !1,
839
841
  pasteCleanHTML: !0,
840
842
  pasteStripAttributes: !1,
@@ -1310,14 +1312,28 @@ var Gt = [
1310
1312
  "portal",
1311
1313
  "frame",
1312
1314
  "frameset",
1313
- "applet"
1315
+ "applet",
1316
+ "animate",
1317
+ "set",
1318
+ "animatetransform",
1319
+ "animatemotion",
1320
+ "mglyph",
1321
+ "malignmark",
1322
+ "annotation-xml"
1314
1323
  ], Kt = /* @__PURE__ */ new Set(["button"]), qt = [
1315
1324
  "href",
1316
1325
  "src",
1317
1326
  "action",
1318
1327
  "formaction",
1319
- "xlink:href"
1328
+ "xlink:href",
1329
+ "poster",
1330
+ "background",
1331
+ "srcset"
1320
1332
  ], Jt = /* @__PURE__ */ new Set([
1333
+ "poster",
1334
+ "background",
1335
+ "srcset"
1336
+ ]), Yt = /* @__PURE__ */ new Set(["ping"]), Xt = /* @__PURE__ */ new Set([
1321
1337
  "color",
1322
1338
  "background-color",
1323
1339
  "font-size",
@@ -1332,23 +1348,23 @@ var Gt = [
1332
1348
  "border-style",
1333
1349
  "border-color",
1334
1350
  "padding"
1335
- ]), Yt = /url\s*\(|expression\s*\(|@import|javascript:|vbscript:|behavior\s*:|-moz-binding/i, Xt = /* @__PURE__ */ new Set([
1351
+ ]), Zt = /url\s*\(|image-set\s*\(|src\s*\(|expression\s*\(|@import|javascript:|vbscript:|behavior\s*:|-moz-binding/i, Qt = /* @__PURE__ */ new Set([
1336
1352
  "www.youtube.com",
1337
1353
  "youtube.com",
1338
1354
  "m.youtube.com",
1339
1355
  "www.youtube-nocookie.com",
1340
1356
  "youtube-nocookie.com",
1341
1357
  "player.vimeo.com"
1342
- ]), Zt = /* @__PURE__ */ new Set([
1358
+ ]), $t = /* @__PURE__ */ new Set([
1343
1359
  "http:",
1344
1360
  "https:",
1345
1361
  "mailto:",
1346
1362
  "tel:"
1347
- ]), Qt = /* @__PURE__ */ new Set([
1363
+ ]), en = /* @__PURE__ */ new Set([
1348
1364
  "http:",
1349
1365
  "https:",
1350
1366
  "blob:"
1351
- ]), $t = /^data:image\/(?:png|jpe?g|gif|webp|avif|bmp);base64,[a-z0-9+/=\s]+$/i, en = "https://autumnnote.invalid/";
1367
+ ]), tn = /^data:image\/(?:png|jpe?g|gif|webp|avif|bmp);base64,[a-z0-9+/=\s]+$/i, nn = "https://autumnnote.invalid/";
1352
1368
  function M(e, { allowIframes: t = !1 } = {}) {
1353
1369
  let n = new DOMParser().parseFromString(`<body>${e || ""}</body>`, "text/html"), r = Array.from(n.querySelectorAll("*")), i = new Set(t ? Gt.filter((e) => e !== "iframe") : Gt);
1354
1370
  for (let e of r) {
@@ -1363,7 +1379,7 @@ function M(e, { allowIframes: t = !1 } = {}) {
1363
1379
  }
1364
1380
  if (t === "iframe") {
1365
1381
  let t = e.getAttribute("src");
1366
- if (!t || !nn(t)) {
1382
+ if (!t || !on(t)) {
1367
1383
  e.remove();
1368
1384
  continue;
1369
1385
  }
@@ -1374,28 +1390,35 @@ function M(e, { allowIframes: t = !1 } = {}) {
1374
1390
  continue;
1375
1391
  }
1376
1392
  if (t.name === "style") {
1377
- let n = tn(t.value);
1393
+ let n = rn(t.value);
1378
1394
  n ? e.setAttribute("style", n) : e.removeAttribute("style");
1379
1395
  continue;
1380
1396
  }
1381
- if (qt.includes(t.name) && !an(t.value.trim(), {
1382
- media: t.name === "src" && [
1397
+ if (Yt.has(t.name)) {
1398
+ e.removeAttribute(t.name);
1399
+ continue;
1400
+ }
1401
+ if (qt.includes(t.name)) {
1402
+ let n = t.value.trim(), r = Jt.has(t.name) || t.name === "src" && [
1383
1403
  "IMG",
1384
1404
  "VIDEO",
1385
1405
  "AUDIO",
1386
1406
  "SOURCE"
1387
- ].includes(e.tagName),
1388
- allowData: e.tagName === "IMG"
1389
- })) {
1390
- e.removeAttribute(t.name);
1391
- continue;
1407
+ ].includes(e.tagName), i = e.tagName === "IMG";
1408
+ if (!(t.name === "srcset" ? an(n, { allowData: i }) : sn(n, {
1409
+ media: r,
1410
+ allowData: i
1411
+ }))) {
1412
+ e.removeAttribute(t.name);
1413
+ continue;
1414
+ }
1392
1415
  }
1393
1416
  if (e.tagName === "IFRAME") {
1394
1417
  if (t.name === "srcdoc") {
1395
1418
  e.removeAttribute(t.name);
1396
1419
  continue;
1397
1420
  }
1398
- t.name === "src" && !nn(t.value) && e.removeAttribute(t.name);
1421
+ t.name === "src" && !on(t.value) && e.removeAttribute(t.name);
1399
1422
  }
1400
1423
  }
1401
1424
  if (t === "a" && e.getAttribute("target") === "_blank" && e.setAttribute("rel", "noopener noreferrer"), t === "input") if (!(e.closest("ul.an-checklist") !== null && e.closest("li") !== null) || e.getAttribute("type") !== "checkbox") e.remove();
@@ -1407,46 +1430,58 @@ function M(e, { allowIframes: t = !1 } = {}) {
1407
1430
  }
1408
1431
  return n.body.innerHTML;
1409
1432
  }
1410
- function tn(e) {
1433
+ function rn(e) {
1411
1434
  let t = [];
1412
1435
  for (let n of (e || "").split(";")) {
1413
1436
  let e = n.indexOf(":");
1414
1437
  if (e === -1) continue;
1415
1438
  let r = n.slice(0, e).trim().toLowerCase(), i = n.slice(e + 1).trim();
1416
- !r || !i || Jt.has(r) && (Yt.test(i) || t.push(`${r}: ${i}`));
1439
+ !r || !i || Xt.has(r) && (Zt.test(i) || t.push(`${r}: ${i}`));
1417
1440
  }
1418
1441
  return t.join("; ");
1419
1442
  }
1420
- function nn(e) {
1443
+ function an(e, { allowData: t = !1 } = {}) {
1444
+ let n = (e || "").trim().split(/\s+/).filter(Boolean);
1445
+ for (let e of n) {
1446
+ if (/^[\d.]+[xw],?$/i.test(e)) continue;
1447
+ let n = e.replace(/,+$/, "");
1448
+ if (n && !sn(n, {
1449
+ media: !0,
1450
+ allowData: t
1451
+ })) return !1;
1452
+ }
1453
+ return !0;
1454
+ }
1455
+ function on(e) {
1421
1456
  let t = (e || "").trim();
1422
1457
  if (!t || t.startsWith("//") || t.startsWith("/")) return !1;
1423
1458
  try {
1424
1459
  let e = new URL(t);
1425
- return e.protocol === "https:" && Xt.has(e.hostname.toLowerCase());
1460
+ return e.protocol === "https:" && Qt.has(e.hostname.toLowerCase());
1426
1461
  } catch {
1427
1462
  return !1;
1428
1463
  }
1429
1464
  }
1430
- function rn(e, { allowData: t = !1, media: n = t } = {}) {
1465
+ function N(e, { allowData: t = !1, media: n = t } = {}) {
1431
1466
  let r = (e || "").trim();
1432
- return !r && e == null ? null : an(r, {
1467
+ return !r && e == null ? null : sn(r, {
1433
1468
  media: n,
1434
1469
  allowData: t
1435
1470
  }) ? e : null;
1436
1471
  }
1437
- function an(e, { media: t = !1, allowData: n = !1 } = {}) {
1472
+ function sn(e, { media: t = !1, allowData: n = !1 } = {}) {
1438
1473
  let r = (e || "").trim();
1439
- if (!r || n && $t.test(r)) return !0;
1474
+ if (!r || n && tn.test(r)) return !0;
1440
1475
  try {
1441
- let e = new URL(r, en);
1442
- return (t ? Qt : Zt).has(e.protocol);
1476
+ let e = new URL(r, nn);
1477
+ return (t ? en : $t).has(e.protocol);
1443
1478
  } catch {
1444
1479
  return !1;
1445
1480
  }
1446
1481
  }
1447
1482
  //#endregion
1448
1483
  //#region src/js/renderer.js
1449
- function on(e, t) {
1484
+ function cn(e, t) {
1450
1485
  let n = w("div", { class: "an-container" }), r = w("div", {
1451
1486
  class: "an-editable",
1452
1487
  contenteditable: t.readOnly ? "false" : "true",
@@ -1469,7 +1504,7 @@ function on(e, t) {
1469
1504
  }
1470
1505
  //#endregion
1471
1506
  //#region src/js/editing/History.js
1472
- var sn = class {
1507
+ var ln = class {
1473
1508
  constructor(e, t = 100, n = 10 * 1024 * 1024) {
1474
1509
  this.editable = e, this._limit = t, this._maxBytes = n, this._bytes = 0, this.stack = [], this.stackOffset = -1, this._savePoint();
1475
1510
  }
@@ -1590,7 +1625,7 @@ var sn = class {
1590
1625
  };
1591
1626
  //#endregion
1592
1627
  //#region src/js/editing/Table.js
1593
- function cn(e, t, n = {}) {
1628
+ function un(e, t, n = {}) {
1594
1629
  let { headerRow: r = !1 } = n, i = w("table", { class: "an-table" });
1595
1630
  if (r && t > 0) {
1596
1631
  let t = w("thead"), n = w("tr");
@@ -1612,9 +1647,9 @@ function cn(e, t, n = {}) {
1612
1647
  }
1613
1648
  return i;
1614
1649
  }
1615
- function ln(e, t, n = {}) {
1650
+ function dn(e, t, n = {}) {
1616
1651
  if (e <= 0 || t <= 0) return;
1617
- let r = cn(e, t, n), i = globalThis.getSelection();
1652
+ let r = un(e, t, n), i = globalThis.getSelection();
1618
1653
  if (!i || i.rangeCount === 0) return;
1619
1654
  let a = i.getRangeAt(0);
1620
1655
  try {
@@ -1655,7 +1690,7 @@ function ln(e, t, n = {}) {
1655
1690
  }
1656
1691
  //#endregion
1657
1692
  //#region src/js/core/key.js
1658
- var N = {
1693
+ var P = {
1659
1694
  BACKSPACE: "Backspace",
1660
1695
  TAB: "Tab",
1661
1696
  ENTER: "Enter",
@@ -1694,16 +1729,16 @@ var N = {
1694
1729
  SLASH: "/",
1695
1730
  PERIOD: "."
1696
1731
  };
1697
- function P(e, t) {
1732
+ function F(e, t) {
1698
1733
  return e.key === t || e.key === t.toUpperCase();
1699
1734
  }
1700
- function F(e, t) {
1701
- return (e.ctrlKey || e.metaKey) && P(e, t);
1735
+ function I(e, t) {
1736
+ return (e.ctrlKey || e.metaKey) && F(e, t);
1702
1737
  }
1703
1738
  //#endregion
1704
1739
  //#region src/js/editing/Typing.js
1705
- var un = /\bfa-/, I = (e) => !!(e?.nodeName === "I" && un.test(e.className || "")), dn = (e) => e?.nodeType === Node.TEXT_NODE && (e.textContent === "​" || e.textContent === "");
1706
- function fn(e, t) {
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) {
1707
1742
  try {
1708
1743
  let n = document.createRange();
1709
1744
  return n.setStart(e.startContainer, e.startOffset), n.setEnd(t, t.childNodes.length), n.extractContents();
@@ -1711,21 +1746,21 @@ function fn(e, t) {
1711
1746
  return document.createDocumentFragment();
1712
1747
  }
1713
1748
  }
1714
- function pn(e, t, n = {}) {
1749
+ function hn(e, t, n = {}) {
1715
1750
  let r = (e) => {
1716
1751
  let t = globalThis.getSelection();
1717
1752
  if (!t) return !1;
1718
1753
  let n = document.createRange();
1719
1754
  return e(n), n.collapse(!0), t.removeAllRanges(), t.addRange(n), !0;
1720
1755
  };
1721
- if (P(e, N.BACKSPACE)) {
1756
+ if (F(e, P.BACKSPACE)) {
1722
1757
  let t = globalThis.getSelection();
1723
1758
  if (t?.rangeCount > 0) {
1724
1759
  let n = t.getRangeAt(0);
1725
1760
  if (n.collapsed && n.startContainer.nodeType === Node.TEXT_NODE) {
1726
1761
  let r = n.startContainer;
1727
- if (n.startOffset === 0 && I(r.previousSibling)) return e.preventDefault(), r.previousSibling.remove(), !0;
1728
- if (n.startOffset === 1 && r.textContent === "​" && I(r.previousSibling)) {
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)) {
1729
1764
  e.preventDefault();
1730
1765
  let n = r.parentNode, i = r.previousSibling, a = i.previousSibling;
1731
1766
  i.remove(), r.remove();
@@ -1736,17 +1771,17 @@ function pn(e, t, n = {}) {
1736
1771
  }
1737
1772
  return !1;
1738
1773
  }
1739
- if (P(e, N.LEFT) || P(e, N.RIGHT)) {
1774
+ if (F(e, P.LEFT) || F(e, P.RIGHT)) {
1740
1775
  let t = globalThis.getSelection();
1741
1776
  if (!t || t.rangeCount === 0) return !1;
1742
1777
  let n = t.getRangeAt(0);
1743
1778
  if (!n.collapsed) return !1;
1744
- let i = n.startContainer, a = P(e, N.LEFT);
1779
+ let i = n.startContainer, a = F(e, P.LEFT);
1745
1780
  if (i.nodeType === Node.TEXT_NODE) {
1746
1781
  let t = i;
1747
- 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));
1748
- if (a && n.startOffset === 0 && dn(t.previousSibling) && I(t.previousSibling.previousSibling)) return e.preventDefault(), r((e) => e.setStartBefore(t.previousSibling.previousSibling));
1749
- if (!a && n.startOffset === t.textContent.length && I(t.nextSibling)) {
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)) {
1750
1785
  let n = t.nextSibling, i = n.nextSibling;
1751
1786
  if (e.preventDefault(), i?.nodeType === Node.TEXT_NODE) {
1752
1787
  let e = +!!(i.textContent || "").startsWith("​");
@@ -1754,7 +1789,7 @@ function pn(e, t, n = {}) {
1754
1789
  }
1755
1790
  return r((e) => e.setStartAfter(n));
1756
1791
  }
1757
- if (!a && n.startOffset === t.textContent.length && dn(t.nextSibling) && I(t.nextSibling.nextSibling)) {
1792
+ if (!a && n.startOffset === t.textContent.length && pn(t.nextSibling) && L(t.nextSibling.nextSibling)) {
1758
1793
  let n = t.nextSibling.nextSibling, i = n.nextSibling;
1759
1794
  if (e.preventDefault(), i?.nodeType === Node.TEXT_NODE) {
1760
1795
  let e = +!!(i.textContent || "").startsWith("​");
@@ -1767,12 +1802,12 @@ function pn(e, t, n = {}) {
1767
1802
  let t = i;
1768
1803
  if (a && n.startOffset > 0) {
1769
1804
  let i = t.childNodes[n.startOffset - 1];
1770
- if (I(i)) return e.preventDefault(), r((e) => e.setStartBefore(i));
1771
- if (dn(i) && I(i.previousSibling)) return e.preventDefault(), r((e) => e.setStartBefore(i.previousSibling));
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));
1772
1807
  }
1773
1808
  if (!a && n.startOffset < t.childNodes.length) {
1774
1809
  let i = t.childNodes[n.startOffset];
1775
- if (I(i)) {
1810
+ if (L(i)) {
1776
1811
  let t = i.nextSibling;
1777
1812
  if (e.preventDefault(), t?.nodeType === Node.TEXT_NODE) {
1778
1813
  let e = +!!(t.textContent || "").startsWith("​");
@@ -1780,7 +1815,7 @@ function pn(e, t, n = {}) {
1780
1815
  }
1781
1816
  return r((e) => e.setStartAfter(i));
1782
1817
  }
1783
- if (dn(i) && I(i.nextSibling)) {
1818
+ if (pn(i) && L(i.nextSibling)) {
1784
1819
  let t = i.nextSibling, n = t.nextSibling;
1785
1820
  if (e.preventDefault(), n?.nodeType === Node.TEXT_NODE) {
1786
1821
  let e = +!!(n.textContent || "").startsWith("​");
@@ -1791,17 +1826,17 @@ function pn(e, t, n = {}) {
1791
1826
  }
1792
1827
  }
1793
1828
  }
1794
- if (P(e, N.TAB)) {
1795
- let r = _e(t);
1829
+ if (F(e, P.TAB)) {
1830
+ let r = ve(t);
1796
1831
  if (!r) return !1;
1797
1832
  let i = C(r.sc, t);
1798
- if (i && _(i)) return e.preventDefault(), e.shiftKey ? ze() : O("indent"), !0;
1799
- if (i?.nodeName.toUpperCase() === "PRE") return e.shiftKey ? !1 : (e.preventDefault(), O("insertText", " ".repeat(n.tabSize || 4)), !0);
1800
- if (n.tabSize) return e.shiftKey ? !1 : (e.preventDefault(), O("insertText", " ".repeat(n.tabSize)), !0);
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);
1801
1836
  }
1802
- if (P(e, N.ENTER) && e.shiftKey) return e.preventDefault(), O("insertLineBreak"), !0;
1803
- if (P(e, N.ENTER) && !e.shiftKey) {
1804
- let n = _e(t);
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);
1805
1840
  if (!n) return !1;
1806
1841
  let r = n.sc, i = r.nodeType === 3 ? r.parentElement : r;
1807
1842
  if (i?.nodeName === "I" && /\bfa-/.test(i.className || "")) {
@@ -1834,7 +1869,7 @@ function pn(e, t, n = {}) {
1834
1869
  if (r.deleteContents(), n.rangeCount === 0 || !o.isConnected) return !0;
1835
1870
  r = n.getRangeAt(0);
1836
1871
  }
1837
- let i = fn(r, o), a = document.createElement("li"), s = document.createElement("input");
1872
+ let i = mn(r, o), a = document.createElement("li"), s = document.createElement("input");
1838
1873
  s.type = "checkbox", s.setAttribute("contenteditable", "false"), a.appendChild(s), i.textContent.replace(/[\u00a0\u200B]/g, "").length > 0 && a.appendChild(i);
1839
1874
  let c = a.childNodes[1];
1840
1875
  c?.nodeType !== Node.TEXT_NODE && (c = document.createTextNode("​"), a.appendChild(c)), o.after(a);
@@ -1842,26 +1877,26 @@ function pn(e, t, n = {}) {
1842
1877
  return l.setStart(c, 0), l.collapse(!0), n.removeAllRanges(), n.addRange(l), !0;
1843
1878
  }
1844
1879
  let s = C(n.sc, t);
1845
- if (s?.nodeName.toUpperCase() === "PRE") return e.preventDefault(), O("insertText", "\n"), !0;
1880
+ if (s?.nodeName.toUpperCase() === "PRE") return e.preventDefault(), D("insertText", "\n"), !0;
1846
1881
  if (s?.nodeName.toUpperCase() === "BLOCKQUOTE") {
1847
1882
  let t = n.toNativeRange();
1848
- if (t.setEnd(s, s.childNodes.length), t.toString() === "" && n.isCollapsed()) return e.preventDefault(), O("formatBlock", "<p>"), !0;
1883
+ if (t.setEnd(s, s.childNodes.length), t.toString() === "" && n.isCollapsed()) return e.preventDefault(), D("formatBlock", "<p>"), !0;
1849
1884
  }
1850
1885
  }
1851
1886
  return !1;
1852
1887
  }
1853
1888
  //#endregion
1854
1889
  //#region src/js/core/markdown.js
1855
- function mn(e) {
1856
- return gn(new DOMParser().parseFromString(`<body>${e || ""}</body>`, "text/html").body).replace(/\n{3,}/g, "\n\n").trim();
1890
+ function gn(e) {
1891
+ return vn(new DOMParser().parseFromString(`<body>${e || ""}</body>`, "text/html").body).replace(/\n{3,}/g, "\n\n").trim();
1857
1892
  }
1858
- function hn(e, t) {
1893
+ function _n(e, t) {
1859
1894
  return Array.from(e.children).filter((e) => e.tagName === t.toUpperCase());
1860
1895
  }
1861
- function gn(e, t = 0) {
1896
+ function vn(e, t = 0) {
1862
1897
  if (e.nodeType === 3) return e.textContent.replace(/\s+/g, " ");
1863
1898
  if (e.nodeType !== 1) return "";
1864
- let n = e, r = n.nodeName.toLowerCase(), i = () => Array.from(n.childNodes).map((e) => gn(e, t)).join("");
1899
+ let n = e, r = n.nodeName.toLowerCase(), i = () => Array.from(n.childNodes).map((e) => vn(e, t)).join("");
1865
1900
  switch (r) {
1866
1901
  case "p":
1867
1902
  case "div": return `\n\n${i()}\n\n`;
@@ -1884,7 +1919,7 @@ function gn(e, t = 0) {
1884
1919
  case "u": return `<u>${i()}</u>`;
1885
1920
  case "span": {
1886
1921
  let e = n.getAttribute("style") || "";
1887
- return /\b(color|background-color|font-size)\s*:/.test(e) ? `<span style="${R(e)}">${i()}</span>` : i();
1922
+ return /\b(color|background-color|font-size)\s*:/.test(e) ? `<span style="${z(e)}">${i()}</span>` : i();
1888
1923
  }
1889
1924
  case "code": return n.closest("pre") ? i() : `\`${i()}\``;
1890
1925
  case "pre": {
@@ -1904,18 +1939,18 @@ function gn(e, t = 0) {
1904
1939
  return `![${n.getAttribute("alt") || ""}](${e})`;
1905
1940
  }
1906
1941
  case "ul": {
1907
- let e = hn(n, "li");
1942
+ let e = _n(n, "li");
1908
1943
  if (!e.length) return i();
1909
1944
  let r = " ".repeat(t), a = n.classList.contains("an-checklist"), o = e.map((e) => {
1910
- let n = hn(e, "input").find((e) => e.getAttribute("type") === "checkbox"), i = "- ";
1911
- return (a || n) && (i = n && n.checked ? "- [x] " : "- [ ] "), `${r}${i}${gn(e, t + 1).trim()}`;
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()}`;
1912
1947
  }).join("\n");
1913
1948
  return t === 0 ? `\n\n${o}\n\n` : `\n${o}`;
1914
1949
  }
1915
1950
  case "ol": {
1916
- let e = hn(n, "li");
1951
+ let e = _n(n, "li");
1917
1952
  if (!e.length) return i();
1918
- let r = " ".repeat(t), a = e.map((e, n) => `${r}${n + 1}. ${gn(e, t + 1).trim()}`).join("\n");
1953
+ let r = " ".repeat(t), a = e.map((e, n) => `${r}${n + 1}. ${vn(e, t + 1).trim()}`).join("\n");
1919
1954
  return t === 0 ? `\n\n${a}\n\n` : `\n${a}`;
1920
1955
  }
1921
1956
  case "li": return i();
@@ -1923,7 +1958,7 @@ function gn(e, t = 0) {
1923
1958
  case "table": {
1924
1959
  let e = Array.from(n.querySelectorAll("tr"));
1925
1960
  if (!e.length) return i();
1926
- let t = !!hn(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) => {
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) => {
1927
1962
  let t = [...e];
1928
1963
  for (; t.length < a;) t.push("");
1929
1964
  return t;
@@ -1935,60 +1970,60 @@ function gn(e, t = 0) {
1935
1970
  default: return i();
1936
1971
  }
1937
1972
  }
1938
- function _n(e) {
1973
+ function yn(e) {
1939
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);
1940
1975
  }
1941
- var vn = /^ {0,3}>( ?)(.*)$/, yn = /^ {0,3}([-*_])( *\1){2,}\s*$/, bn = "";
1942
- function xn(e) {
1976
+ var bn = /^ {0,3}>( ?)(.*)$/, xn = /^ {0,3}([-*_])( *\1){2,}\s*$/, Sn = "";
1977
+ function Cn(e) {
1943
1978
  let t = e.replaceAll("\r\n", "\n").replaceAll("\r", "\n").split("\n");
1944
- t = Tn(t);
1945
- let n = En(t);
1946
- return t = n.clean, Cn = n.linkDefs, wn = n.footnoteIds, Sn(t);
1979
+ t = Dn(t);
1980
+ let n = On(t);
1981
+ return t = n.clean, Tn = n.linkDefs, En = n.footnoteIds, wn(t);
1947
1982
  }
1948
- function Sn(e) {
1983
+ function wn(e) {
1949
1984
  let t = [], n = 0;
1950
1985
  for (; n < e.length;) {
1951
1986
  let r = e[n], i = /^```(\S*)$/.exec(r);
1952
1987
  if (i) {
1953
1988
  let r = i[1], a = [];
1954
- for (n++; n < e.length && !e[n].startsWith("```");) a.push(Ln(e[n])), n++;
1955
- let o = r ? ` class="language-${R(r)}"` : "";
1989
+ for (n++; n < e.length && !e[n].startsWith("```");) a.push(zn(e[n])), n++;
1990
+ let o = r ? ` class="language-${z(r)}"` : "";
1956
1991
  t.push(`<pre><code${o}>${a.join("\n")}</code></pre>`), n++;
1957
1992
  continue;
1958
1993
  }
1959
- if (r.trim() && !yn.test(r) && !/^#{1,6} /.test(r) && n + 1 < e.length) {
1994
+ if (r.trim() && !xn.test(r) && !/^#{1,6} /.test(r) && n + 1 < e.length) {
1960
1995
  if (/^=+\s*$/.test(e[n + 1])) {
1961
- t.push(`<h1>${L(r.trim())}</h1>`), n += 2;
1996
+ t.push(`<h1>${R(r.trim())}</h1>`), n += 2;
1962
1997
  continue;
1963
1998
  }
1964
1999
  if (/^-{2,}\s*$/.test(e[n + 1])) {
1965
- t.push(`<h2>${L(r.trim())}</h2>`), n += 2;
2000
+ t.push(`<h2>${R(r.trim())}</h2>`), n += 2;
1966
2001
  continue;
1967
2002
  }
1968
2003
  }
1969
- if (yn.test(r)) {
2004
+ if (xn.test(r)) {
1970
2005
  t.push("<hr>"), n++;
1971
2006
  continue;
1972
2007
  }
1973
2008
  let a = /^(#{1,6})\s+(.+)$/.exec(r);
1974
2009
  if (a) {
1975
2010
  let e = a[1].length, r = a[2].replace(/(?:^|\s)#+\s*$/, "");
1976
- t.push(`<h${e}>${L(r)}</h${e}>`), n++;
2011
+ t.push(`<h${e}>${R(r)}</h${e}>`), n++;
1977
2012
  continue;
1978
2013
  }
1979
- if (vn.test(r)) {
2014
+ if (bn.test(r)) {
1980
2015
  let r = [];
1981
- for (; n < e.length && vn.test(e[n]);) r.push(vn.exec(e[n])[2]), n++;
1982
- t.push(`<blockquote>${Sn(r)}</blockquote>`);
2016
+ for (; n < e.length && bn.test(e[n]);) r.push(bn.exec(e[n])[2]), n++;
2017
+ t.push(`<blockquote>${wn(r)}</blockquote>`);
1983
2018
  continue;
1984
2019
  }
1985
2020
  if (/^[-*+] /.test(r)) {
1986
- let { html: r, endIdx: i } = kn(e, n);
2021
+ let { html: r, endIdx: i } = jn(e, n);
1987
2022
  t.push(r), n = i;
1988
2023
  continue;
1989
2024
  }
1990
2025
  if (/^\d+\. /.test(r)) {
1991
- let { html: r, endIdx: i } = kn(e, n);
2026
+ let { html: r, endIdx: i } = jn(e, n);
1992
2027
  t.push(r), n = i;
1993
2028
  continue;
1994
2029
  }
@@ -1997,22 +2032,22 @@ function Sn(e) {
1997
2032
  continue;
1998
2033
  }
1999
2034
  if (/^\|.+\|/.test(r) && n + 1 < e.length && /^\|[\s|:-]+\|/.test(e[n + 1])) {
2000
- let i = On(r), a = On(e[n + 1]).map((e) => e.startsWith(":") && e.endsWith(":") ? "center" : e.endsWith(":") ? "right" : e.startsWith(":") ? "left" : null);
2035
+ let i = An(r), a = An(e[n + 1]).map((e) => e.startsWith(":") && e.endsWith(":") ? "center" : e.endsWith(":") ? "right" : e.startsWith(":") ? "left" : null);
2001
2036
  n += 2;
2002
2037
  let o = [];
2003
- for (; n < e.length && /^\|.+\|/.test(e[n]);) o.push(On(e[n])), n++;
2004
- let s = (e, t, n) => `<${e}${n ? ` style="text-align:${n}"` : ""}>${L(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>` : "";
2038
+ for (; n < e.length && /^\|.+\|/.test(e[n]);) o.push(An(e[n])), n++;
2039
+ 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>` : "";
2005
2040
  t.push(`<table>${c}${l}</table>`);
2006
2041
  continue;
2007
2042
  }
2008
2043
  let o = [];
2009
- for (; n < e.length && e[n].trim() !== "" && !/^(#{1,6} |[-*+] |\d+\. |```)/.test(e[n]) && !vn.test(e[n]) && !yn.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++;
2010
- o.length && t.push(`<p>${L(Dn(o)).replaceAll(bn, "<br>")}</p>`);
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>`);
2011
2046
  }
2012
2047
  return t.join("");
2013
2048
  }
2014
- var Cn = /* @__PURE__ */ new Map(), wn = /* @__PURE__ */ new Set();
2015
- function Tn(e) {
2049
+ var Tn = /* @__PURE__ */ new Map(), En = /* @__PURE__ */ new Set();
2050
+ function Dn(e) {
2016
2051
  if ((e[0] || "").trim() !== "---") return e;
2017
2052
  let t = -1;
2018
2053
  for (let n = 1; n < e.length; n++) {
@@ -2026,7 +2061,7 @@ function Tn(e) {
2026
2061
  let n = t + 1;
2027
2062
  return e[n] !== void 0 && e[n].trim() === "" && n++, e.slice(n);
2028
2063
  }
2029
- function En(e) {
2064
+ function On(e) {
2030
2065
  let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = [], i = !1, a = /^\[([^\]]+)\]:\s*(\S+)(?:\s+"([^"]*)")?\s*$/, o = /^\[\^([^\]]+)\]:\s*(.+)$/;
2031
2066
  for (let s of e) {
2032
2067
  if (/^```/.test(s)) {
@@ -2056,23 +2091,23 @@ function En(e) {
2056
2091
  footnoteIds: n
2057
2092
  };
2058
2093
  }
2059
- function Dn(e) {
2094
+ function kn(e) {
2060
2095
  let t = "";
2061
2096
  for (let n = 0; n < e.length; n++) {
2062
2097
  let r = n === e.length - 1, i = e[n];
2063
2098
  if (!r && /\\$/.test(i)) {
2064
- t += i.replace(/\\$/, "") + bn;
2099
+ t += i.replace(/\\$/, "") + Sn;
2065
2100
  continue;
2066
2101
  }
2067
2102
  if (!r && / {2,}$/.test(i)) {
2068
- t += i.replace(/ {2,}$/, "") + bn;
2103
+ t += i.replace(/ {2,}$/, "") + Sn;
2069
2104
  continue;
2070
2105
  }
2071
2106
  t += i + (r ? "" : " ");
2072
2107
  }
2073
2108
  return t;
2074
2109
  }
2075
- function On(e) {
2110
+ function An(e) {
2076
2111
  let t = e.replace(/^\|/, "").replace(/\|$/, ""), n = [], r = "";
2077
2112
  for (let e = 0; e < t.length; e++) {
2078
2113
  if (t[e] === "\\" && t[e + 1] === "|") {
@@ -2087,7 +2122,7 @@ function On(e) {
2087
2122
  }
2088
2123
  return n.push(r), n.map((e) => e.trim());
2089
2124
  }
2090
- function kn(e, t) {
2125
+ function jn(e, t) {
2091
2126
  let n = e[t].match(/^(\s*)/)[1].length, r = /^\s*\d+\. /.test(e[t]), i = [], a = null, o = !1, s = !1, c = t;
2092
2127
  for (; c < e.length;) {
2093
2128
  let t = e[c];
@@ -2116,7 +2151,7 @@ function kn(e, t) {
2116
2151
  continue;
2117
2152
  }
2118
2153
  if (/^\s*(?:[-*+]|\d+\.) /.test(t)) {
2119
- let t = kn(e, c);
2154
+ let t = jn(e, c);
2120
2155
  i[i.length - 1].sub += t.html, c = t.endIdx, s = !1;
2121
2156
  } else if (s) i[i.length - 1].paras.push(t.trim()), s = !1, c++;
2122
2157
  else {
@@ -2129,78 +2164,78 @@ function kn(e, t) {
2129
2164
  return {
2130
2165
  html: `${f}${i.map(({ paras: e, isCB: t, checked: n, sub: r }) => {
2131
2166
  let i = t ? `<input type="checkbox" contenteditable="false"${n ? " checked" : ""}>` : "";
2132
- return `<li>${o ? e.map((e, t) => `<p>${t === 0 ? i : ""}${L(e)}</p>`).join("") : `${i}${L(e[0])}`}${r}</li>`;
2167
+ return `<li>${o ? e.map((e, t) => `<p>${t === 0 ? i : ""}${R(e)}</p>`).join("") : `${i}${R(e[0])}`}${r}</li>`;
2133
2168
  }).join("")}${p}`,
2134
2169
  endIdx: c
2135
2170
  };
2136
2171
  }
2137
- var An = /\\([*_`#[\]()>\\~|])/g, jn = "\0";
2138
- function Mn(e) {
2172
+ var Mn = /\\([*_`#[\]()>\\~|])/g, Nn = "\0";
2173
+ function Pn(e) {
2139
2174
  let t = [];
2140
2175
  return {
2141
- text: e.replace(An, (e, n) => (t.push(n), `${jn}${t.length - 1}${jn}`)),
2176
+ text: e.replace(Mn, (e, n) => (t.push(n), `${Nn}${t.length - 1}${Nn}`)),
2142
2177
  literals: t
2143
2178
  };
2144
2179
  }
2145
- function Nn(e, t) {
2146
- return e.replace(RegExp(`${jn}(\\d+)${jn}`, "g"), (e, n) => Ln(t[Number(n)]));
2180
+ function Fn(e, t) {
2181
+ return e.replace(RegExp(`${Nn}(\\d+)${Nn}`, "g"), (e, n) => zn(t[Number(n)]));
2147
2182
  }
2148
- function Pn(e) {
2149
- return e = e.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, (e, t, n) => `<img src="${z(n)}" alt="${z(t)}" class="an-image">`), e = e.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (e, t, n) => `<a href="${z(n)}">${t}</a>`), e = e.replace(/\[([^\]]+)\]\[([^\]]*)\]/g, (e, t, n) => {
2150
- let r = Cn.get(Rn(n || t).trim().toLowerCase());
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());
2151
2186
  if (!r) return e;
2152
- let i = r.title ? ` title="${R(r.title)}"` : "";
2153
- return `<a href="${R(r.href)}"${i}>${t}</a>`;
2187
+ let i = r.title ? ` title="${z(r.title)}"` : "";
2188
+ return `<a href="${z(r.href)}"${i}>${t}</a>`;
2154
2189
  }), e = e.replace(/\[([^\]]+)\]/g, (e, t) => {
2155
- let n = Cn.get(Rn(t).trim().toLowerCase());
2190
+ let n = Tn.get(Vn(t).trim().toLowerCase());
2156
2191
  if (!n) return e;
2157
- let r = n.title ? ` title="${R(n.title)}"` : "";
2158
- return `<a href="${R(n.href)}"${r}>${t}</a>`;
2159
- }), e = e.replace(/\[\^([^\]]+)\]/g, (e, t) => wn.has(Rn(t)) ? `<sup>[${t}]</sup>` : e), e;
2192
+ let r = n.title ? ` title="${z(n.title)}"` : "";
2193
+ 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;
2160
2195
  }
2161
- function Fn(e) {
2162
- return e = e.replace(/&lt;(https?:\/\/[^\s&]+?)&gt;/g, (e, t) => `<a href="${z(t)}">${t}</a>`), e = e.replace(/(^|[\s(])(https?:\/\/[^\s()]+)/g, (e, t, n) => {
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) => {
2163
2198
  let r = /[.,;:!?)]+$/.exec(n), i = r ? n.slice(0, -r[0].length) : n;
2164
2199
  if (!i) return e;
2165
2200
  let a = r ? r[0] : "";
2166
- return `${t}<a href="${z(i)}">${i}</a>${a}`;
2201
+ return `${t}<a href="${Bn(i)}">${i}</a>${a}`;
2167
2202
  }), e;
2168
2203
  }
2169
- function In(e) {
2204
+ function Rn(e) {
2170
2205
  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;
2171
2206
  }
2172
- function L(e) {
2173
- let { text: t, literals: n } = Mn(e), r = Ln(t);
2174
- return r = Pn(r), r = Fn(r), r = In(r), Nn(r, n);
2207
+ 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);
2175
2210
  }
2176
- function Ln(e) {
2211
+ function zn(e) {
2177
2212
  return String(e).replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
2178
2213
  }
2179
- function R(e) {
2214
+ function z(e) {
2180
2215
  return String(e).replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("'", "&#39;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
2181
2216
  }
2182
- function z(e) {
2217
+ function Bn(e) {
2183
2218
  return String(e).replaceAll("\"", "&quot;").replaceAll("'", "&#39;");
2184
2219
  }
2185
- function Rn(e) {
2220
+ function Vn(e) {
2186
2221
  return String(e).replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
2187
2222
  }
2188
2223
  //#endregion
2189
2224
  //#region src/js/core/detectLang.js
2190
- function zn(e) {
2225
+ function Hn(e) {
2191
2226
  if (!e?.trim()) return null;
2192
2227
  let t = e.trim();
2193
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;
2194
2229
  }
2195
2230
  //#endregion
2196
2231
  //#region src/js/module/Editor.js
2197
- var Bn = class {
2232
+ var Un = class {
2198
2233
  constructor(e) {
2199
2234
  this.context = e, this.options = e.options, this._history = null, this._disposers = [], this._snapshotTimer = null;
2200
2235
  }
2201
2236
  initialize() {
2202
2237
  let e = this.context.layoutInfo.editable;
2203
- return this._history = new sn(e, this.options.historyLimit || 100, this.options.historyMaxBytes || 10 * 1024 * 1024), this._bindEvents(e), this;
2238
+ return this._history = new ln(e, this.options.historyLimit || 100, this.options.historyMaxBytes || 10 * 1024 * 1024), this._bindEvents(e), this;
2204
2239
  }
2205
2240
  destroy() {
2206
2241
  this._disposers.forEach((e) => e()), this._disposers = [], this._history = null, clearTimeout(this._snapshotTimer), this._snapshotTimer = null;
@@ -2277,32 +2312,32 @@ var Bn = class {
2277
2312
  }
2278
2313
  _onKeydown(e) {
2279
2314
  let t = this.context.layoutInfo.editable;
2280
- if (!pn(e, t, this.options)) {
2281
- if (F(e, "z") && !e.shiftKey) {
2315
+ if (!hn(e, t, this.options)) {
2316
+ if (I(e, "z") && !e.shiftKey) {
2282
2317
  e.preventDefault(), this.undo();
2283
2318
  return;
2284
2319
  }
2285
- if (F(e, "z") && e.shiftKey || F(e, "y")) {
2320
+ if (I(e, "z") && e.shiftKey || I(e, "y")) {
2286
2321
  e.preventDefault(), this.redo();
2287
2322
  return;
2288
2323
  }
2289
- if (F(e, "b")) {
2324
+ if (I(e, "b")) {
2290
2325
  e.preventDefault(), this.bold();
2291
2326
  return;
2292
2327
  }
2293
- if (F(e, "i")) {
2328
+ if (I(e, "i")) {
2294
2329
  e.preventDefault(), this.italic();
2295
2330
  return;
2296
2331
  }
2297
- if (F(e, "u")) {
2332
+ if (I(e, "u")) {
2298
2333
  e.preventDefault(), this.underline();
2299
2334
  return;
2300
2335
  }
2301
- if (F(e, "k")) {
2336
+ if (I(e, "k")) {
2302
2337
  e.preventDefault(), this.context.invoke("linkDialog.show");
2303
2338
  return;
2304
2339
  }
2305
- if (F(e, "v") && e.shiftKey) {
2340
+ if (I(e, "v") && e.shiftKey) {
2306
2341
  this.context.invoke("clipboard.setForcePlain", !0);
2307
2342
  return;
2308
2343
  }
@@ -2310,11 +2345,11 @@ var Bn = class {
2310
2345
  e.preventDefault(), this.context.invoke("shortcutsDialog.show");
2311
2346
  return;
2312
2347
  }
2313
- if (F(e, "f")) {
2348
+ if (I(e, "f")) {
2314
2349
  e.preventDefault(), this.context.invoke("findReplace.show", "find");
2315
2350
  return;
2316
2351
  }
2317
- F(e, "h") && (e.preventDefault(), this.context.invoke("findReplace.show", "replace")), F(e, "`") && (e.preventDefault(), this.inlineCode());
2352
+ I(e, "h") && (e.preventDefault(), this.context.invoke("findReplace.show", "replace")), I(e, "`") && (e.preventDefault(), this.inlineCode());
2318
2353
  }
2319
2354
  }
2320
2355
  _enforceLimit(e) {
@@ -2386,16 +2421,16 @@ var Bn = class {
2386
2421
  return !e && !t;
2387
2422
  }
2388
2423
  insertHTML(e) {
2389
- e && (O("insertHTML", M(e)), this.afterCommand());
2424
+ e && (D("insertHTML", M(e)), this.afterCommand());
2390
2425
  }
2391
2426
  insertText(e) {
2392
- e && (O("insertText", e), this.afterCommand());
2427
+ e && (D("insertText", e), this.afterCommand());
2393
2428
  }
2394
2429
  setMarkdown(e) {
2395
- this.setHTML(xn(e || ""));
2430
+ this.setHTML(Cn(e || ""));
2396
2431
  }
2397
2432
  getMarkdown() {
2398
- return mn(this.getHTML());
2433
+ return gn(this.getHTML());
2399
2434
  }
2400
2435
  undo() {
2401
2436
  this._history && (this._flushPendingSnapshot(), this._history.undo(), this.context.invoke("toolbar.refresh"), this.context.invoke("statusbar.update"), this.context.triggerEvent("change", this.getHTML()));
@@ -2425,49 +2460,49 @@ var Bn = class {
2425
2460
  return !e || !this._history ? !1 : (this._history._restoreSelection(e), !0);
2426
2461
  }
2427
2462
  bold() {
2428
- Ce(), this.afterCommand();
2463
+ we(), this.afterCommand();
2429
2464
  }
2430
2465
  italic() {
2431
- we(), this.afterCommand();
2466
+ Te(), this.afterCommand();
2432
2467
  }
2433
2468
  underline() {
2434
- Te(), this.afterCommand();
2469
+ Ee(), this.afterCommand();
2435
2470
  }
2436
2471
  strikethrough() {
2437
- Ee(), this.afterCommand();
2472
+ De(), this.afterCommand();
2438
2473
  }
2439
2474
  superscript() {
2440
- De(), this.afterCommand();
2475
+ Oe(), this.afterCommand();
2441
2476
  }
2442
2477
  subscript() {
2443
- Oe(), this.afterCommand();
2478
+ ke(), this.afterCommand();
2444
2479
  }
2445
2480
  justifyLeft() {
2446
- Pe(), this.afterCommand();
2481
+ Fe(), this.afterCommand();
2447
2482
  }
2448
2483
  justifyCenter() {
2449
- Fe(), this.afterCommand();
2484
+ Ie(), this.afterCommand();
2450
2485
  }
2451
2486
  justifyRight() {
2452
- Ie(), this.afterCommand();
2487
+ Le(), this.afterCommand();
2453
2488
  }
2454
2489
  justifyFull() {
2455
- Le(), this.afterCommand();
2490
+ Re(), this.afterCommand();
2456
2491
  }
2457
2492
  indent() {
2458
- Re(), this.afterCommand();
2493
+ ze(), this.afterCommand();
2459
2494
  }
2460
2495
  outdent() {
2461
- ze(), this.afterCommand();
2496
+ Be(), this.afterCommand();
2462
2497
  }
2463
2498
  insertUL() {
2464
- Ue(), this.afterCommand();
2499
+ We(), this.afterCommand();
2465
2500
  }
2466
2501
  insertOL() {
2467
- We(), this.afterCommand();
2502
+ Ge(), this.afterCommand();
2468
2503
  }
2469
2504
  inlineCode() {
2470
- Ke(this.context.layoutInfo.editable), this.afterCommand();
2505
+ qe(this.context.layoutInfo.editable), this.afterCommand();
2471
2506
  }
2472
2507
  toggleChecklist() {
2473
2508
  Xe(), this.afterCommand();
@@ -2476,12 +2511,12 @@ var Bn = class {
2476
2511
  this.context.print();
2477
2512
  }
2478
2513
  formatBlock(e) {
2479
- if (Ne(e), e === "pre") {
2514
+ if (Pe(e), e === "pre") {
2480
2515
  let e = globalThis.getSelection();
2481
2516
  if (e?.rangeCount > 0) {
2482
2517
  let t = e.getRangeAt(0).commonAncestorContainer, n = t.nodeType === 1 ? t.closest("pre") : t.parentElement?.closest("pre");
2483
2518
  if (n && !n.dataset.language) {
2484
- let e = zn(n.textContent || "");
2519
+ let e = Hn(n.textContent || "");
2485
2520
  if (e) {
2486
2521
  this.context.invoke("codeTooltip.applyLanguage", n, e);
2487
2522
  return;
@@ -2492,55 +2527,55 @@ var Bn = class {
2492
2527
  this.afterCommand();
2493
2528
  }
2494
2529
  foreColor(e) {
2495
- ke(e), this.afterCommand();
2530
+ Ae(e), this.afterCommand();
2496
2531
  }
2497
2532
  backColor(e) {
2498
- Ae(e), this.afterCommand();
2533
+ je(e), this.afterCommand();
2499
2534
  }
2500
2535
  fontName(e) {
2501
- je(e), this.afterCommand();
2536
+ Me(e), this.afterCommand();
2502
2537
  }
2503
2538
  fontSize(e) {
2504
- Me(e, this.context.layoutInfo.editable), this.afterCommand();
2539
+ Ne(e, this.context.layoutInfo.editable), this.afterCommand();
2505
2540
  }
2506
2541
  insertHr() {
2507
- O("insertHorizontalRule"), this.afterCommand();
2542
+ D("insertHorizontalRule"), this.afterCommand();
2508
2543
  }
2509
2544
  insertLink(e, t, n = !1) {
2510
2545
  let r = globalThis.getSelection();
2511
2546
  if (!r || r.rangeCount === 0) return;
2512
- let i = rn(e);
2547
+ let i = N(e);
2513
2548
  if (i) {
2514
2549
  if (r.toString().trim().length > 0) {
2515
- if (O("createLink", i), n) {
2550
+ if (D("createLink", i), n) {
2516
2551
  let e = this._getClosestAnchor();
2517
2552
  e && (e.setAttribute("target", "_blank"), e.setAttribute("rel", "noopener noreferrer"));
2518
2553
  }
2519
2554
  } else {
2520
2555
  let e = this._escapeAttr(t || i);
2521
- O("insertHTML", `<a href="${this._escapeAttr(i)}"${n ? " target=\"_blank\" rel=\"noopener noreferrer\"" : ""}>${e}</a>`);
2556
+ D("insertHTML", `<a href="${this._escapeAttr(i)}"${n ? " target=\"_blank\" rel=\"noopener noreferrer\"" : ""}>${e}</a>`);
2522
2557
  }
2523
2558
  this.afterCommand();
2524
2559
  }
2525
2560
  }
2526
2561
  unlink() {
2527
- O("unlink"), this.afterCommand();
2562
+ D("unlink"), this.afterCommand();
2528
2563
  }
2529
2564
  insertImage(e, t = "", n = "") {
2530
- let r = rn(e, { allowData: !0 });
2565
+ let r = N(e, { allowData: !0 });
2531
2566
  if (!r) return;
2532
2567
  let i = {
2533
2568
  left: "float:left;margin:0 1em 1em 0",
2534
2569
  center: "display:block;margin:0 auto",
2535
2570
  right: "float:right;margin:0 0 1em 1em"
2536
2571
  }[n] || "", a = i ? ` style="${i}"` : "";
2537
- O("insertHTML", `<img src="${this._escapeAttr(r)}" alt="${this._escapeAttr(t)}" class="an-image"${a}>`), this.afterCommand();
2572
+ D("insertHTML", `<img src="${this._escapeAttr(r)}" alt="${this._escapeAttr(t)}" class="an-image"${a}>`), this.afterCommand();
2538
2573
  }
2539
2574
  insertVideo(e) {
2540
- e && (O("insertHTML", e), this.afterCommand());
2575
+ e && (D("insertHTML", e), this.afterCommand());
2541
2576
  }
2542
2577
  insertTable(e, t) {
2543
- ln(e, t, { headerRow: this.context.options.tableHeaderRow }), this.afterCommand();
2578
+ dn(e, t, { headerRow: this.context.options.tableHeaderRow }), this.afterCommand();
2544
2579
  }
2545
2580
  _getClosestAnchor() {
2546
2581
  let e = globalThis.getSelection();
@@ -2555,44 +2590,44 @@ var Bn = class {
2555
2590
  _escapeAttr(e) {
2556
2591
  return String(e ?? "").replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
2557
2592
  }
2558
- }, Vn = (e) => typeof e == "string" ? et(e) : e, B = null, Hn = "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" ${Hn} style="display:block">${e}</svg>`, H = /* @__PURE__ */ new Map([
2559
- ["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\"/>")],
2560
- ["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\"/>")],
2561
- ["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\"/>")],
2562
- ["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\"/>")],
2563
- ["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\"/>")],
2564
- ["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\"/>")],
2565
- ["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\"/>")],
2566
- ["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\"/>")],
2567
- ["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\"/>")],
2568
- ["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\"/>")],
2569
- ["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\"/>")],
2570
- ["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\"/>")],
2571
- ["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\"/>")],
2572
- ["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\"/>")],
2573
- ["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\"/>")],
2574
- ["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\"/>")],
2575
- ["minus", V("<line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/>")],
2576
- ["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\"/>")],
2577
- ["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\"/>")],
2578
- ["video", V("<polygon points=\"23 7 16 12 23 17 23 7\"/><rect x=\"1\" y=\"5\" width=\"15\" height=\"14\" rx=\"2\"/>")],
2579
- ["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\"/>")],
2580
- ["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\"/>")],
2581
- ["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\"/>")],
2582
- ["code", V("<polyline points=\"16 18 22 12 16 6\"/><polyline points=\"8 6 2 12 8 18\"/>")],
2583
- ["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\"/>")],
2584
- ["foreColor", V("<path d=\"M4 20L12 4L20 20\"/><line x1=\"7.5\" y1=\"14\" x2=\"16.5\" y2=\"14\"/>")],
2585
- ["backColor", V("<path d=\"M3 21v-4l9-9 4 4-9 9z\"/><path d=\"M12 8l4 4\"/>")],
2586
- ["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\"/>")],
2587
- ["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\"/>")],
2588
- ["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\"/>")],
2589
- ["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\"/>")],
2590
- ["search", V("<circle cx=\"11\" cy=\"11\" r=\"7\"/><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"/>")],
2591
- ["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\"/>")],
2592
- ["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\"/>")],
2593
- ["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\"/>")],
2594
- ["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\"/>")]
2595
- ]), Un = /* @__PURE__ */ new Map([
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([
2596
2631
  ["bold", "fa-bold"],
2597
2632
  ["italic", "fa-italic"],
2598
2633
  ["underline", "fa-underline"],
@@ -2626,12 +2661,17 @@ var Bn = class {
2626
2661
  ["inline-code", "fa-code"],
2627
2662
  ["checklist", "fa-list-check"],
2628
2663
  ["print", "fa-print"]
2629
- ]), Wn = class {
2664
+ ]), Jn = class {
2630
2665
  constructor(e) {
2631
2666
  this.context = e, this.options = e.options, this.el = null, this._disposers = [], this._colorPickerClosers = [], this._refreshRaf = null;
2632
2667
  }
2633
2668
  initialize() {
2634
- return this.el = w("div", { class: "an-toolbar" }), this._faReady = this._detectFontAwesome(), this._buildButtons(), this._btnMap = new Map((this.options.toolbar || []).flat().map(Vn).filter(Boolean).map((e) => [e.name, e])), this;
2669
+ return this.el = w("div", {
2670
+ class: "an-toolbar",
2671
+ role: "toolbar",
2672
+ "aria-orientation": "horizontal",
2673
+ "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;
2635
2675
  }
2636
2676
  destroy() {
2637
2677
  this._refreshRaf && cancelAnimationFrame(this._refreshRaf), this._refreshRaf = null, this._disposers.forEach((e) => e()), this._disposers = [], this.el?.parentNode && this.el.remove(), this.el = null;
@@ -2641,7 +2681,7 @@ var Bn = class {
2641
2681
  e.forEach((e) => {
2642
2682
  let n = w("div", { class: "an-btn-group" });
2643
2683
  e.forEach((e) => {
2644
- let t = Vn(e);
2684
+ let t = Wn(e);
2645
2685
  if (!t) {
2646
2686
  console.warn(`[AutumnNote] Toolbar: button "${e}" not found in registry. Skipped.`);
2647
2687
  return;
@@ -2856,23 +2896,60 @@ var Bn = class {
2856
2896
  class: `${this.options.useBootstrap ? this.options.toolbarButtonClass || "btn btn-sm btn-light" : "an-btn"}${e.className ? ` ${e.className}` : ""}`,
2857
2897
  title: this.context.locale.toolbar[e.name] || e.tooltip || "",
2858
2898
  "data-btn": e.name,
2859
- "aria-label": this.context.locale.toolbar[e.name] || e.tooltip || e.name
2899
+ "aria-label": this.context.locale.toolbar[e.name] || e.tooltip || e.name,
2900
+ ...typeof e.isActive == "function" ? { "aria-pressed": "false" } : {}
2860
2901
  }), n = this.options.fontAwesomeClass || "fas";
2861
2902
  if (this._faReady) {
2862
- let r = Un.get(e.icon) || Un.get(e.name) || null;
2863
- 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;
2864
- } 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;
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;
2865
2906
  let r = E(t, "click", (t) => {
2866
2907
  t.preventDefault(), this.context.invoke("editor.focus"), e.action(this.context), this.context.invoke("editor.afterCommand"), this.refresh();
2867
2908
  });
2868
2909
  return this._disposers.push(r), t;
2869
2910
  }
2911
+ _controls() {
2912
+ return this.el ? Array.from(this.el.querySelectorAll("button, select")) : [];
2913
+ }
2914
+ _navigable() {
2915
+ return this._controls().filter((e) => !e.disabled);
2916
+ }
2917
+ _syncRovingTabindex(e) {
2918
+ let t = this._controls(), n = this._navigable();
2919
+ if (!n.length) return;
2920
+ let r = e && n.includes(e) ? e : n.find((e) => e.getAttribute("tabindex") === "0") || n[0];
2921
+ t.forEach((e) => e.setAttribute("tabindex", e === r ? "0" : "-1"));
2922
+ }
2923
+ _initRovingFocus() {
2924
+ this.el && (this._syncRovingTabindex(), this._disposers.push(E(this.el, "keydown", (e) => this._onToolbarKeydown(e)), E(this.el, "focusin", (e) => {
2925
+ let t = e.target?.closest?.("button, select");
2926
+ t && this._syncRovingTabindex(t);
2927
+ })));
2928
+ }
2929
+ _onToolbarKeydown(e) {
2930
+ if (![
2931
+ "ArrowRight",
2932
+ "ArrowLeft",
2933
+ "Home",
2934
+ "End"
2935
+ ].includes(e.key)) return;
2936
+ let t = this._navigable(), n = e.target?.closest?.("button, select"), r = n ? t.indexOf(n) : -1;
2937
+ if (r === -1) return;
2938
+ let i;
2939
+ if (e.key === "Home") i = t[0];
2940
+ else if (e.key === "End") i = t.at(-1);
2941
+ else {
2942
+ let n = this.options.direction === "rtl";
2943
+ i = t[(r + (e.key === "ArrowRight" === n ? -1 : 1) + t.length) % t.length];
2944
+ }
2945
+ i && (e.preventDefault(), this._syncRovingTabindex(i), i.focus());
2946
+ }
2870
2947
  _detectFontAwesome() {
2871
2948
  if (!this.options.useFontAwesome) return !1;
2872
- if (B !== null) return B;
2873
- if (document.querySelector(".fa, .fas, .far, .fal, .fab, .fa-solid")) return B = !0, !0;
2949
+ if (Gn !== null) return Gn;
2950
+ if (document.querySelector(".fa, .fas, .far, .fal, .fab, .fa-solid")) return Gn = !0, !0;
2874
2951
  let e = Array.from(document.querySelectorAll("link[rel=\"stylesheet\"]")).filter((e) => e.id !== "an-fontawesome-css").map((e) => e.href || "").join(" ");
2875
- return B = /fontawesome|font-awesome|use\.fontawesome|all\.css/.test(e), B;
2952
+ return Gn = /fontawesome|font-awesome|use\.fontawesome|all\.css/.test(e), Gn;
2876
2953
  }
2877
2954
  refresh() {
2878
2955
  this._refreshRaf && cancelAnimationFrame(this._refreshRaf), this._refreshRaf = requestAnimationFrame(() => {
@@ -2884,8 +2961,12 @@ var Bn = class {
2884
2961
  let e = this._btnMap || /* @__PURE__ */ new Map();
2885
2962
  this.el.querySelectorAll("button[data-btn]").forEach((t) => {
2886
2963
  let n = e.get(t.dataset.btn);
2887
- n && typeof n.isActive == "function" && t.classList.toggle("active", !!n.isActive(this.context)), n && typeof n.isDisabled == "function" && (t.disabled = !!n.isDisabled(this.context));
2888
- }), this.el.querySelectorAll("select[data-btn]").forEach((t) => {
2964
+ if (n && typeof n.isActive == "function") {
2965
+ let e = !!n.isActive(this.context);
2966
+ t.classList.toggle("active", e), t.setAttribute("aria-pressed", String(e));
2967
+ }
2968
+ n && typeof n.isDisabled == "function" && (t.disabled = !!n.isDisabled(this.context));
2969
+ }), this._syncRovingTabindex(), this.el.querySelectorAll("select[data-btn]").forEach((t) => {
2889
2970
  let n = e.get(t.dataset.btn);
2890
2971
  if (!n || typeof n.getValue != "function") return;
2891
2972
  let r = (n.getValue(this.context) || "").replace(/["']/g, "").trim();
@@ -2901,27 +2982,27 @@ var Bn = class {
2901
2982
  this.el && (this.el.style.display = "none");
2902
2983
  }
2903
2984
  rebuild() {
2904
- 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._btnMap = new Map((this.options.toolbar || []).flat().map(Vn).filter(Boolean).map((e) => [e.name, e])), this.refresh();
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();
2905
2986
  }
2906
- }, Gn = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "word" }) : null;
2907
- function Kn(e) {
2987
+ }, Yn = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "word" }) : null;
2988
+ function Xn(e) {
2908
2989
  let t = e.trim();
2909
2990
  if (!t) return 0;
2910
- if (Gn) {
2991
+ if (Yn) {
2911
2992
  let e = 0;
2912
- for (let n of Gn.segment(t)) n.isWordLike && e++;
2993
+ for (let n of Yn.segment(t)) n.isWordLike && e++;
2913
2994
  return e;
2914
2995
  }
2915
2996
  return t.split(/\s+/).length;
2916
2997
  }
2917
- function qn(e, t, n) {
2998
+ function Zn(e, t, n) {
2918
2999
  if (!n) {
2919
3000
  e.classList.remove("an-count-warn", "an-count-exceeded");
2920
3001
  return;
2921
3002
  }
2922
3003
  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");
2923
3004
  }
2924
- var Jn = class {
3005
+ var Qn = class {
2925
3006
  constructor(e) {
2926
3007
  this.context = e, this.options = e.options, this.el = null, this._disposers = [], this._wordCountEl = null, this._charCountEl = null;
2927
3008
  }
@@ -2974,17 +3055,17 @@ var Jn = class {
2974
3055
  }
2975
3056
  update() {
2976
3057
  if (!this._wordCountEl || !this._charCountEl) return;
2977
- let e = this.context.layoutInfo.editable.textContent || "", t = Kn(e), n = e.replaceAll("\n", "").length, r = this.options.maxWords || 0, i = this.options.maxChars || 0, a = this.context.locale.statusbar;
2978
- this._wordCountEl.textContent = r ? a.wordsLimit(t, r) : a.words(t), this._charCountEl.textContent = i ? a.charsLimit(n, i) : a.chars(n), qn(this._wordCountEl, t, r), qn(this._charCountEl, n, i);
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);
2979
3060
  }
2980
3061
  getWordCount() {
2981
3062
  let e = this.context.layoutInfo.editable;
2982
- return Kn(e.innerText || "");
3063
+ return Xn(e.innerText || "");
2983
3064
  }
2984
3065
  getCharCount() {
2985
3066
  return (this.context.layoutInfo.editable.innerText || "").replaceAll("\n", "").length;
2986
3067
  }
2987
- }, Yn = class {
3068
+ }, $n = class {
2988
3069
  constructor(e) {
2989
3070
  this.context = e, this.options = e.options, this._disposers = [];
2990
3071
  }
@@ -3096,20 +3177,20 @@ var Jn = class {
3096
3177
  text: t.getData("text/plain") || "",
3097
3178
  html: t.types.includes("text/html") ? t.getData("text/html") : null
3098
3179
  }), n || this.options.pasteAsPlainText) {
3099
- 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");
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");
3100
3181
  return;
3101
3182
  }
3102
3183
  if (this.options.markdownPaste !== !1) {
3103
3184
  let n = t.types.includes("text/html"), r = n ? t.getData("text/html") : "", i = !n || this._isTriviallyPlainHtml(r), a = t.getData("text/plain");
3104
- if (a && i && _n(a)) {
3105
- e.preventDefault(), O("insertHTML", M(xn(a))), this.context.invoke("editor.afterCommand");
3185
+ if (a && i && yn(a)) {
3186
+ e.preventDefault(), D("insertHTML", M(Cn(a))), this.context.invoke("editor.afterCommand");
3106
3187
  return;
3107
3188
  }
3108
3189
  }
3109
3190
  if (this.options.pasteCleanHTML !== !1 && t.types.includes("text/html")) {
3110
3191
  e.preventDefault();
3111
3192
  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;
3112
- 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");
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");
3113
3194
  }
3114
3195
  }
3115
3196
  _onDragover(e) {
@@ -3141,7 +3222,7 @@ var Jn = class {
3141
3222
  }
3142
3223
  let n = new FileReader();
3143
3224
  n.onload = (e) => {
3144
- O("insertHTML", M(xn(e.target.result || ""))), this.context.invoke("editor.afterCommand");
3225
+ D("insertHTML", M(Cn(e.target.result || ""))), this.context.invoke("editor.afterCommand");
3145
3226
  }, n.onerror = () => {
3146
3227
  let t = `Failed to read dropped markdown file "${e.name}".`;
3147
3228
  console.warn(`[AutumnNote] ${t}`), this.context.triggerEvent("pasteError", { message: t });
@@ -3243,7 +3324,7 @@ var Jn = class {
3243
3324
  _escapeHTML(e) {
3244
3325
  return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&#039;");
3245
3326
  }
3246
- }, Xn = class {
3327
+ }, er = class {
3247
3328
  constructor(e) {
3248
3329
  this.context = e, this.options = e.options, this._disposers = [];
3249
3330
  }
@@ -3260,7 +3341,7 @@ var Jn = class {
3260
3341
  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");
3261
3342
  e.classList.toggle("an-placeholder", n && !t);
3262
3343
  }
3263
- }, Zn = class {
3344
+ }, tr = class {
3264
3345
  constructor(e) {
3265
3346
  this.context = e, this.options = e.options, this._active = !1, this._textarea = null, this._disposers = [];
3266
3347
  }
@@ -3305,13 +3386,13 @@ var Jn = class {
3305
3386
  return /^<[^/!][^>]*[^/]>/.test(r) && !t.test(r) && !/^<(br|hr|img|input|link|meta)/.test(r) && n++, i;
3306
3387
  }).filter(Boolean).join("\n");
3307
3388
  }
3308
- }, Qn = class {
3389
+ }, nr = class {
3309
3390
  constructor(e) {
3310
3391
  this.context = e, this._active = !1, this._disposers = [], this._prevHeight = "";
3311
3392
  }
3312
3393
  initialize() {
3313
3394
  let e = E(document, "keydown", (e) => {
3314
- this._active && P(e, N.ESCAPE) && this.deactivate();
3395
+ this._active && F(e, P.ESCAPE) && this.deactivate();
3315
3396
  });
3316
3397
  return this._disposers.push(e), this;
3317
3398
  }
@@ -3334,7 +3415,7 @@ var Jn = class {
3334
3415
  let e = this.context.layoutInfo.container;
3335
3416
  e.classList.remove("an-fullscreen"), e.style.height = this._prevHeight, document.body.style.overflow = "", this._active = !1, this.context.invoke("toolbar.refresh");
3336
3417
  }
3337
- }, U = class {
3418
+ }, H = class {
3338
3419
  constructor(e) {
3339
3420
  this.context = e, this.options = e.options, this._dialog = null, this._disposers = [], this._savedRange = null, this._firstInput = null, this._removeTrap = null;
3340
3421
  }
@@ -3348,7 +3429,7 @@ var Jn = class {
3348
3429
  this._disposers.forEach((e) => e()), this._disposers = [], this._dialog?.parentNode && this._dialog.remove(), this._dialog = null;
3349
3430
  }
3350
3431
  _saveRange() {
3351
- xe((e) => {
3432
+ Se((e) => {
3352
3433
  this._savedRange = e;
3353
3434
  });
3354
3435
  }
@@ -3367,7 +3448,7 @@ var Jn = class {
3367
3448
  }), i = w("div", { class: "an-dialog-box" }), a = w("div", { class: "an-dialog-header" }), o = w("span", { class: "an-dialog-icon" });
3368
3449
  o.innerHTML = t;
3369
3450
  let s = w("h3", { class: "an-dialog-title" });
3370
- s.textContent = n, a.appendChild(o), a.appendChild(s), i.appendChild(a), r.appendChild(i), D(a, i);
3451
+ s.textContent = n, a.appendChild(o), a.appendChild(s), i.appendChild(a), r.appendChild(i), he(a, i);
3371
3452
  let c = E(r, "click", (e) => {
3372
3453
  e.target === r && this._close();
3373
3454
  });
@@ -3390,12 +3471,12 @@ var Jn = class {
3390
3471
  let o = E(i, "click", n), s = E(a, "click", () => this._close());
3391
3472
  return this._disposers.push(o, s), r;
3392
3473
  }
3393
- }, $n = "<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 {
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 {
3394
3475
  show() {
3395
3476
  this._saveRange(), this._prefill(), this._open();
3396
3477
  }
3397
3478
  _buildDialog() {
3398
- let e = this.context.locale.linkDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, $n, e.title), r = w("label", { class: "an-label" });
3479
+ let e = this.context.locale.linkDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, rr, e.title), r = w("label", { class: "an-label" });
3399
3480
  r.textContent = e.url;
3400
3481
  let i = w("input", {
3401
3482
  type: "url",
@@ -3465,12 +3546,12 @@ var Jn = class {
3465
3546
  }
3466
3547
  this._savedRange && this._savedRange.select(), this.context.invoke("editor.insertLink", e, t, n), this._close();
3467
3548
  }
3468
- }, 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\"><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>", nr = class extends U {
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 {
3469
3550
  show({ beforeInsert: e } = {}) {
3470
3551
  this._beforeInsert = typeof e == "function" ? e : null, this._saveRange(), this._urlInput.value = "", this._altInput.value = "", this._fileInput && (this._fileInput.value = ""), this._open();
3471
3552
  }
3472
3553
  _buildDialog() {
3473
- let e = this.context.locale.imageDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, tr, e.title), r = w("label", { class: "an-label" });
3554
+ let e = this.context.locale.imageDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, ar, e.title), r = w("label", { class: "an-label" });
3474
3555
  r.textContent = e.imageUrl;
3475
3556
  let i = w("input", {
3476
3557
  type: "url",
@@ -3597,12 +3678,12 @@ var Jn = class {
3597
3678
  _close() {
3598
3679
  this._beforeInsert = null, super._close();
3599
3680
  }
3600
- }, 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\"><polygon points=\"23 7 16 12 23 17 23 7\"/><rect x=\"1\" y=\"5\" width=\"15\" height=\"14\" rx=\"2\"/></svg>", ir = class extends U {
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 {
3601
3682
  show() {
3602
3683
  this._saveRange(), this._urlInput.value = "", this._widthInput.value = "560", this._hintEl.textContent = "", this._open();
3603
3684
  }
3604
3685
  _buildDialog() {
3605
- let e = this.context.locale.videoDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, rr, e.title), r = w("label", { class: "an-label" });
3686
+ let e = this.context.locale.videoDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, sr, e.title), r = w("label", { class: "an-label" });
3606
3687
  r.textContent = e.videoUrl;
3607
3688
  let i = w("input", {
3608
3689
  type: "url",
@@ -3648,7 +3729,7 @@ var Jn = class {
3648
3729
  this._savedRange && this._savedRange.select(), this.context.invoke("editor.insertVideo", n), this._close();
3649
3730
  }
3650
3731
  _parseVideoUrl(e) {
3651
- if (!e || !rn(e, { media: !0 })) return null;
3732
+ if (!e || !N(e, { media: !0 })) return null;
3652
3733
  let t = /(?:youtube\.com\/watch\?(?:.*&)?v=|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/.exec(e);
3653
3734
  if (t) return {
3654
3735
  type: "YouTube",
@@ -3680,10 +3761,10 @@ var Jn = class {
3680
3761
  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>`;
3681
3762
  }
3682
3763
  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>`;
3683
- let i = rn(e, { media: !0 });
3764
+ let i = N(e, { media: !0 });
3684
3765
  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;
3685
3766
  }
3686
- }, ar = [
3767
+ }, lr = [
3687
3768
  {
3688
3769
  pos: "nw",
3689
3770
  cursor: "nw-resize"
@@ -3716,7 +3797,7 @@ var Jn = class {
3716
3797
  pos: "w",
3717
3798
  cursor: "w-resize"
3718
3799
  }
3719
- ], or = class {
3800
+ ], ur = class {
3720
3801
  constructor(e) {
3721
3802
  this.context = e, this._active = null, this._overlay = null, this._disposers = [], this._positionRaf = null, this._lastOverlayPos = null;
3722
3803
  }
@@ -3769,9 +3850,9 @@ var Jn = class {
3769
3850
  }
3770
3851
  _buildOverlay() {
3771
3852
  let e = document.createElement("div");
3772
- return e.className = this._overlayClass, e.style.display = "none", ar.forEach(({ pos: t }) => {
3853
+ return e.className = this._overlayClass, e.style.display = "none", lr.forEach(({ pos: t }) => {
3773
3854
  let n = document.createElement("div");
3774
- n.className = `an-resize-handle an-resize-${t}`, n.dataset.handle = t, this._disposers.push(E(n, "mousedown", (e) => {
3855
+ n.className = `an-resize-handle an-resize-${t}`, n.dataset.handle = t, this._disposers.push(E(n, "pointerdown", (e) => {
3775
3856
  e.preventDefault(), e.stopPropagation(), this._startResize(e, t);
3776
3857
  })), e.appendChild(n);
3777
3858
  }), e;
@@ -3820,11 +3901,13 @@ var Jn = class {
3820
3901
  t.includes("e") && (_ = Math.max(s, a + e)), t.includes("w") && (_ = Math.max(s, a - e)), t.includes("s") && (v = Math.max(c, o + h)), t.includes("n") && (v = Math.max(c, o - h)), _ = Math.min(_, g), u && (Math.abs(e) >= Math.abs(h) || (_ = Math.min(Math.max(s, Math.round(v * l)), g)), v = Math.max(c, Math.round(_ / l))), this._applySize(n, _, v), this._updateOverlayPosition();
3821
3902
  });
3822
3903
  }, m = () => {
3823
- f !== null && (cancelAnimationFrame(f), f = null), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", m), this._dragDisposers = null, this.context.invoke("editor.afterCommand");
3904
+ document.removeEventListener("pointermove", p), document.removeEventListener("pointerup", h), document.removeEventListener("pointercancel", h);
3905
+ }, h = () => {
3906
+ f !== null && (cancelAnimationFrame(f), f = null), m(), this._dragDisposers = null, this.context.invoke("editor.afterCommand");
3824
3907
  };
3825
- document.addEventListener("mousemove", p), document.addEventListener("mouseup", m), this._dragDisposers = [() => document.removeEventListener("mousemove", p), () => document.removeEventListener("mouseup", m)];
3908
+ document.addEventListener("pointermove", p), document.addEventListener("pointerup", h), document.addEventListener("pointercancel", h), this._dragDisposers = [m];
3826
3909
  }
3827
- }, sr = class extends or {
3910
+ }, dr = class extends ur {
3828
3911
  get _overlayClass() {
3829
3912
  return "an-image-resizer";
3830
3913
  }
@@ -3853,7 +3936,7 @@ var Jn = class {
3853
3936
  getActiveImage() {
3854
3937
  return this._active;
3855
3938
  }
3856
- }, cr = class extends or {
3939
+ }, fr = class extends ur {
3857
3940
  get _overlayClass() {
3858
3941
  return "an-video-resizer";
3859
3942
  }
@@ -3889,12 +3972,12 @@ var Jn = class {
3889
3972
  getActiveWrapper() {
3890
3973
  return this._active;
3891
3974
  }
3892
- }, lr = {
3975
+ }, pr = {
3893
3976
  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>",
3894
3977
  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>",
3895
3978
  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>",
3896
3979
  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>"
3897
- }, ur = 120, dr = 200, fr = class {
3980
+ }, mr = 120, hr = 200, gr = class {
3898
3981
  constructor(e) {
3899
3982
  this.context = e, this._el = null, this._activeAnchor = null, this._showTimer = null, this._hideTimer = null, this._disposers = [];
3900
3983
  }
@@ -3918,7 +4001,7 @@ var Jn = class {
3918
4001
  role: "toolbar",
3919
4002
  "aria-label": e.ariaLabel
3920
4003
  });
3921
- 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(lr.open, e.openLink, () => this._openLink()), this._copyBtn = this._makeBtn(lr.copy, e.copyUrl, () => this._copyLink()), this._editBtn = this._makeBtn(lr.edit, e.editLink, () => this._editLink()), this._unlinkBtn = this._makeBtn(lr.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;
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;
3922
4005
  }
3923
4006
  _makeBtn(e, t, n) {
3924
4007
  let r = w("button", {
@@ -3933,12 +4016,12 @@ var Jn = class {
3933
4016
  _scheduleShow(e) {
3934
4017
  this._activeAnchor === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
3935
4018
  this._activeAnchor = e, this._show(e);
3936
- }, ur));
4019
+ }, mr));
3937
4020
  }
3938
4021
  _scheduleHide() {
3939
4022
  clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => {
3940
4023
  this._hide();
3941
- }, dr));
4024
+ }, hr));
3942
4025
  }
3943
4026
  _show(e) {
3944
4027
  let t = this.context.layoutInfo.container.classList.contains("an-disabled"), n = e.getAttribute("href") || "";
@@ -3987,7 +4070,7 @@ var Jn = class {
3987
4070
  let t = globalThis.getSelection(), n = document.createRange();
3988
4071
  n.selectNode(e), t.removeAllRanges(), t.addRange(n), document.execCommand("unlink"), this.context.invoke("editor.afterCommand");
3989
4072
  }
3990
- }, pr = class {
4073
+ }, _r = class {
3991
4074
  constructor(e) {
3992
4075
  this.context = e, this.options = e.options, this._el = null, this._active = null, this._showTimer = null, this._hideTimer = null, this._disposers = [];
3993
4076
  }
@@ -4028,7 +4111,7 @@ var Jn = class {
4028
4111
  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;
4029
4112
  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`;
4030
4113
  }
4031
- }, W = {
4114
+ }, U = {
4032
4115
  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>",
4033
4116
  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>",
4034
4117
  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>",
@@ -4039,7 +4122,7 @@ var Jn = class {
4039
4122
  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>",
4040
4123
  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>",
4041
4124
  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>"
4042
- }, mr = class extends pr {
4125
+ }, vr = class extends _r {
4043
4126
  initialize() {
4044
4127
  this._el = this._buildTooltip(), document.body.appendChild(this._el);
4045
4128
  let e = this.context.layoutInfo.editable;
@@ -4064,7 +4147,7 @@ var Jn = class {
4064
4147
  role: "toolbar",
4065
4148
  "aria-label": e.ariaLabel
4066
4149
  });
4067
- 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;
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;
4068
4151
  }
4069
4152
  _setFloat(e) {
4070
4153
  let t = this._active;
@@ -4131,7 +4214,7 @@ var Jn = class {
4131
4214
  let a = globalThis.getSelection();
4132
4215
  a && (a.removeAllRanges(), a.addRange(i)), this.context.invoke("editor.afterCommand"), this.context.invoke("imageResizer.updateOverlay"), this._hide();
4133
4216
  }
4134
- }, G = {
4217
+ }, W = {
4135
4218
  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>",
4136
4219
  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>",
4137
4220
  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>",
@@ -4139,7 +4222,7 @@ var Jn = class {
4139
4222
  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>",
4140
4223
  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>",
4141
4224
  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>"
4142
- }, hr = class extends pr {
4225
+ }, yr = class extends _r {
4143
4226
  initialize() {
4144
4227
  this._el = this._buildTooltip(), document.body.appendChild(this._el);
4145
4228
  let e = this.context.layoutInfo.editable;
@@ -4170,7 +4253,7 @@ var Jn = class {
4170
4253
  role: "toolbar",
4171
4254
  "aria-label": e.ariaLabel
4172
4255
  });
4173
- 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;
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;
4174
4257
  }
4175
4258
  _setFloat(e) {
4176
4259
  let t = this._active;
@@ -4217,8 +4300,35 @@ var Jn = class {
4217
4300
  }
4218
4301
  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);
4219
4302
  }
4220
- }, gr = 120, _r = 200;
4221
- function vr(e) {
4303
+ }, G = {
4304
+ 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
+ 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
+ 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>",
4307
+ colLeft: "<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=\"12\" y1=\"3\" x2=\"12\" y2=\"21\"/><path d=\"M3 12h7\"/><path d=\"M7 8l-4 4 4 4\"/></svg>",
4308
+ colRight: "<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=\"12\" y1=\"3\" x2=\"12\" y2=\"21\"/><path d=\"M12 12h9\"/><path d=\"M17 8l4 4-4 4\"/></svg>",
4309
+ deleteCol: "<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=\"12\" y1=\"3\" x2=\"12\" y2=\"21\"/><line x1=\"15\" y1=\"6\" x2=\"21\" y2=\"12\"/><line x1=\"21\" y1=\"6\" x2=\"15\" y2=\"12\"/></svg>",
4310
+ mergeCells: "<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=\"7\" width=\"8\" height=\"10\" rx=\"1\"/><rect x=\"14\" y=\"7\" width=\"8\" height=\"10\" rx=\"1\"/><path d=\"M10 12h4\"/><path d=\"M12 10l2 2-2 2\"/></svg>",
4311
+ unmergeCells: "<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=\"5\" width=\"20\" height=\"14\" rx=\"1\"/><line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\" stroke-dasharray=\"2.5 2\"/><line x1=\"2\" y1=\"12\" x2=\"22\" y2=\"12\" stroke-dasharray=\"2.5 2\"/><path d=\"M9 9 L6 12 L9 15\"/><path d=\"M15 9 L18 12 L15 15\"/></svg>",
4312
+ colWidth: "<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=\"7\" y1=\"4\" x2=\"7\" y2=\"20\"/><line x1=\"17\" y1=\"4\" x2=\"17\" y2=\"20\"/><line x1=\"7\" y1=\"12\" x2=\"17\" y2=\"12\"/><path d=\"M10 9l-3 3 3 3\"/><path d=\"M14 9l3 3-3 3\"/></svg>",
4313
+ rowHeight: "<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=\"4\" y1=\"7\" x2=\"20\" y2=\"7\"/><line x1=\"4\" y1=\"17\" x2=\"20\" y2=\"17\"/><line x1=\"12\" y1=\"7\" x2=\"12\" y2=\"17\"/><path d=\"M9 10l3-3 3 3\"/><path d=\"M9 14l3 3 3-3\"/></svg>",
4314
+ tableBorder: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\"><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\" stroke-width=\"1\"/><line x1=\"3\" y1=\"13\" x2=\"21\" y2=\"13\" stroke-width=\"2\"/><line x1=\"3\" y1=\"20\" x2=\"21\" y2=\"20\" stroke-width=\"3\"/></svg>",
4315
+ deleteTable: "<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=\"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\"/><line x1=\"16\" y1=\"16\" x2=\"22\" y2=\"22\" stroke=\"#ef4444\"/><line x1=\"22\" y1=\"16\" x2=\"16\" y2=\"22\" stroke=\"#ef4444\"/></svg>",
4316
+ selectCells: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M4 4 L4 20 L9 15 L12 21 L14 20 L11 14 L17 14 Z\" fill=\"currentColor\" opacity=\"0.15\"/><path d=\"M4 4 L4 20 L9 15 L12 21 L14 20 L11 14 L17 14 Z\"/></svg>",
4317
+ cellShade: "<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=\"M19 11L8.93 3.36a1 1 0 0 0-1.29.08L3.22 7.8a1 1 0 0 0-.07 1.29L11 20\"/><path d=\"m5 14 5-5\"/><path d=\"M22 22a2 2 0 0 1-2 2h-3a2 2 0 0 1-2-2c0-1.5 2.5-5 3.5-5s3.5 3.5 3.5 5z\"/></svg>",
4318
+ borderColor: "<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=\"14\" rx=\"1\"/><line x1=\"3\" y1=\"10\" x2=\"21\" y2=\"10\" stroke-width=\"1.5\"/><line x1=\"12\" y1=\"3\" x2=\"12\" y2=\"17\" stroke-width=\"1.5\"/><path d=\"M3 21h18\" stroke-width=\"3\"/></svg>",
4319
+ alignLeft: "<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=\"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\"/></svg>",
4320
+ alignCenter: "<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=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"/><line x1=\"17\" y1=\"12\" x2=\"7\" y2=\"12\"/><line x1=\"19\" y1=\"18\" x2=\"5\" y2=\"18\"/></svg>",
4321
+ alignRight: "<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=\"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\"/></svg>",
4322
+ alignJustify: "<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=\"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\"/></svg>",
4323
+ headerRow: "<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\"/><rect x=\"3\" y=\"3\" width=\"18\" height=\"8\" rx=\"1\" fill=\"currentColor\" opacity=\"0.2\"/><line x1=\"3\" y1=\"11\" x2=\"21\" y2=\"11\"/><line x1=\"3\" y1=\"16\" x2=\"21\" y2=\"16\"/><line x1=\"9\" y1=\"11\" x2=\"9\" y2=\"21\"/><line x1=\"15\" y1=\"11\" x2=\"15\" y2=\"21\"/></svg>",
4324
+ sortAsc: "<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=\"4\" y1=\"6\" x2=\"11\" y2=\"6\"/><line x1=\"4\" y1=\"12\" x2=\"11\" y2=\"12\"/><line x1=\"4\" y1=\"18\" x2=\"13\" y2=\"18\"/><path d=\"M15 9l3-3 3 3\"/><line x1=\"18\" y1=\"6\" x2=\"18\" y2=\"18\"/></svg>",
4325
+ sortDesc: "<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=\"4\" y1=\"6\" x2=\"13\" y2=\"6\"/><line x1=\"4\" y1=\"12\" x2=\"11\" y2=\"12\"/><line x1=\"4\" y1=\"18\" x2=\"11\" y2=\"18\"/><path d=\"M15 15l3 3 3-3\"/><line x1=\"18\" y1=\"6\" x2=\"18\" y2=\"18\"/></svg>",
4326
+ exportCSV: "<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 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"/><polyline points=\"7 10 12 15 17 10\"/><line x1=\"12\" y1=\"15\" x2=\"12\" y2=\"3\"/></svg>",
4327
+ cellPadding: "<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\"/><rect x=\"7\" y=\"7\" width=\"10\" height=\"10\" rx=\"0.5\" stroke-dasharray=\"2 1.5\"/></svg>"
4328
+ };
4329
+ //#endregion
4330
+ //#region src/js/module/table-grid.js
4331
+ function K(e) {
4222
4332
  let t = e.closest("tr");
4223
4333
  if (!t) return -1;
4224
4334
  let n = 0;
@@ -4228,7 +4338,7 @@ function vr(e) {
4228
4338
  }
4229
4339
  return -1;
4230
4340
  }
4231
- function K(e, t) {
4341
+ function q(e, t) {
4232
4342
  let n = 0;
4233
4343
  for (let r of e.cells) {
4234
4344
  if (n === t) return r;
@@ -4237,7 +4347,7 @@ function K(e, t) {
4237
4347
  }
4238
4348
  return null;
4239
4349
  }
4240
- function yr(e, t) {
4350
+ function br(e, t) {
4241
4351
  let n = 0;
4242
4352
  for (let r of e.cells) if (n += r.colSpan || 1, n > t) {
4243
4353
  let e = r.nextElementSibling;
@@ -4245,7 +4355,7 @@ function yr(e, t) {
4245
4355
  }
4246
4356
  return null;
4247
4357
  }
4248
- function br(e) {
4358
+ function xr(e) {
4249
4359
  let t = Array.from(e.rows), n = {}, r = /* @__PURE__ */ new WeakMap();
4250
4360
  return t.forEach((e, t) => {
4251
4361
  n[t] || (n[t] = {});
@@ -4270,32 +4380,9 @@ function br(e) {
4270
4380
  cellPos: r
4271
4381
  };
4272
4382
  }
4273
- var q = {
4274
- 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>",
4275
- 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>",
4276
- 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>",
4277
- colLeft: "<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=\"12\" y1=\"3\" x2=\"12\" y2=\"21\"/><path d=\"M3 12h7\"/><path d=\"M7 8l-4 4 4 4\"/></svg>",
4278
- colRight: "<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=\"12\" y1=\"3\" x2=\"12\" y2=\"21\"/><path d=\"M12 12h9\"/><path d=\"M17 8l4 4-4 4\"/></svg>",
4279
- deleteCol: "<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=\"12\" y1=\"3\" x2=\"12\" y2=\"21\"/><line x1=\"15\" y1=\"6\" x2=\"21\" y2=\"12\"/><line x1=\"21\" y1=\"6\" x2=\"15\" y2=\"12\"/></svg>",
4280
- mergeCells: "<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=\"7\" width=\"8\" height=\"10\" rx=\"1\"/><rect x=\"14\" y=\"7\" width=\"8\" height=\"10\" rx=\"1\"/><path d=\"M10 12h4\"/><path d=\"M12 10l2 2-2 2\"/></svg>",
4281
- unmergeCells: "<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=\"5\" width=\"20\" height=\"14\" rx=\"1\"/><line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\" stroke-dasharray=\"2.5 2\"/><line x1=\"2\" y1=\"12\" x2=\"22\" y2=\"12\" stroke-dasharray=\"2.5 2\"/><path d=\"M9 9 L6 12 L9 15\"/><path d=\"M15 9 L18 12 L15 15\"/></svg>",
4282
- colWidth: "<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=\"7\" y1=\"4\" x2=\"7\" y2=\"20\"/><line x1=\"17\" y1=\"4\" x2=\"17\" y2=\"20\"/><line x1=\"7\" y1=\"12\" x2=\"17\" y2=\"12\"/><path d=\"M10 9l-3 3 3 3\"/><path d=\"M14 9l3 3-3 3\"/></svg>",
4283
- rowHeight: "<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=\"4\" y1=\"7\" x2=\"20\" y2=\"7\"/><line x1=\"4\" y1=\"17\" x2=\"20\" y2=\"17\"/><line x1=\"12\" y1=\"7\" x2=\"12\" y2=\"17\"/><path d=\"M9 10l3-3 3 3\"/><path d=\"M9 14l3 3 3-3\"/></svg>",
4284
- tableBorder: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\"><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\" stroke-width=\"1\"/><line x1=\"3\" y1=\"13\" x2=\"21\" y2=\"13\" stroke-width=\"2\"/><line x1=\"3\" y1=\"20\" x2=\"21\" y2=\"20\" stroke-width=\"3\"/></svg>",
4285
- deleteTable: "<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=\"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\"/><line x1=\"16\" y1=\"16\" x2=\"22\" y2=\"22\" stroke=\"#ef4444\"/><line x1=\"22\" y1=\"16\" x2=\"16\" y2=\"22\" stroke=\"#ef4444\"/></svg>",
4286
- selectCells: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M4 4 L4 20 L9 15 L12 21 L14 20 L11 14 L17 14 Z\" fill=\"currentColor\" opacity=\"0.15\"/><path d=\"M4 4 L4 20 L9 15 L12 21 L14 20 L11 14 L17 14 Z\"/></svg>",
4287
- cellShade: "<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=\"M19 11L8.93 3.36a1 1 0 0 0-1.29.08L3.22 7.8a1 1 0 0 0-.07 1.29L11 20\"/><path d=\"m5 14 5-5\"/><path d=\"M22 22a2 2 0 0 1-2 2h-3a2 2 0 0 1-2-2c0-1.5 2.5-5 3.5-5s3.5 3.5 3.5 5z\"/></svg>",
4288
- borderColor: "<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=\"14\" rx=\"1\"/><line x1=\"3\" y1=\"10\" x2=\"21\" y2=\"10\" stroke-width=\"1.5\"/><line x1=\"12\" y1=\"3\" x2=\"12\" y2=\"17\" stroke-width=\"1.5\"/><path d=\"M3 21h18\" stroke-width=\"3\"/></svg>",
4289
- alignLeft: "<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=\"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\"/></svg>",
4290
- alignCenter: "<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=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"/><line x1=\"17\" y1=\"12\" x2=\"7\" y2=\"12\"/><line x1=\"19\" y1=\"18\" x2=\"5\" y2=\"18\"/></svg>",
4291
- alignRight: "<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=\"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\"/></svg>",
4292
- alignJustify: "<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=\"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\"/></svg>",
4293
- headerRow: "<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\"/><rect x=\"3\" y=\"3\" width=\"18\" height=\"8\" rx=\"1\" fill=\"currentColor\" opacity=\"0.2\"/><line x1=\"3\" y1=\"11\" x2=\"21\" y2=\"11\"/><line x1=\"3\" y1=\"16\" x2=\"21\" y2=\"16\"/><line x1=\"9\" y1=\"11\" x2=\"9\" y2=\"21\"/><line x1=\"15\" y1=\"11\" x2=\"15\" y2=\"21\"/></svg>",
4294
- sortAsc: "<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=\"4\" y1=\"6\" x2=\"11\" y2=\"6\"/><line x1=\"4\" y1=\"12\" x2=\"11\" y2=\"12\"/><line x1=\"4\" y1=\"18\" x2=\"13\" y2=\"18\"/><path d=\"M15 9l3-3 3 3\"/><line x1=\"18\" y1=\"6\" x2=\"18\" y2=\"18\"/></svg>",
4295
- sortDesc: "<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=\"4\" y1=\"6\" x2=\"13\" y2=\"6\"/><line x1=\"4\" y1=\"12\" x2=\"11\" y2=\"12\"/><line x1=\"4\" y1=\"18\" x2=\"11\" y2=\"18\"/><path d=\"M15 15l3 3 3-3\"/><line x1=\"18\" y1=\"6\" x2=\"18\" y2=\"18\"/></svg>",
4296
- exportCSV: "<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 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"/><polyline points=\"7 10 12 15 17 10\"/><line x1=\"12\" y1=\"15\" x2=\"12\" y2=\"3\"/></svg>",
4297
- cellPadding: "<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\"/><rect x=\"7\" y=\"7\" width=\"10\" height=\"10\" rx=\"0.5\" stroke-dasharray=\"2 1.5\"/></svg>"
4298
- }, xr = [
4383
+ //#endregion
4384
+ //#region src/js/module/TableTooltip.js
4385
+ var Sr = 120, Cr = 200, wr = [
4299
4386
  "#000000",
4300
4387
  "#434343",
4301
4388
  "#666666",
@@ -4320,7 +4407,7 @@ var q = {
4320
4407
  "#c9daf8",
4321
4408
  "#d9d2e9",
4322
4409
  "#ead1dc"
4323
- ], Sr = class {
4410
+ ], Tr = class {
4324
4411
  constructor(e) {
4325
4412
  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;
4326
4413
  }
@@ -4378,7 +4465,7 @@ var q = {
4378
4465
  });
4379
4466
  }), E(e, "mousedown", (e) => {
4380
4467
  if (!this.context.layoutInfo.container.classList.contains("an-disabled") && !(!t || !n)) {
4381
- if (r = !0, i = n, a = e.clientX, o = e.clientY, f = t.closest("table"), i === "col") l = vr(t) + (t.colSpan || 1) - 1, u = l >= 0 ? Array.from(f.querySelectorAll("tr")).map((e) => K(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";
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";
4382
4469
  else {
4383
4470
  let e = t.closest("tr"), n = (e ? Array.from(f.rows).indexOf(e) : 0) + (t.rowSpan || 1) - 1;
4384
4471
  d = f.rows[n] || e, c = d ? d.offsetHeight : 40, document.body.style.cursor = "row-resize";
@@ -4410,27 +4497,27 @@ var q = {
4410
4497
  role: "toolbar",
4411
4498
  "aria-label": e.ariaLabel
4412
4499
  });
4413
- 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(q.selectCells, e.selectCells, () => this._toggleSelectMode()), t.appendChild(this._selectBtn), t.appendChild(this._sep()), t.appendChild(this._makeBtn(q.rowAbove, e.addRowAbove, () => this._addRow("above"))), t.appendChild(this._makeBtn(q.rowBelow, e.addRowBelow, () => this._addRow("below"))), t.appendChild(this._makeBtn(q.deleteRow, e.deleteRow, () => this._deleteRow())), t.appendChild(this._sep()), t.appendChild(this._makeBtn(q.colLeft, e.addColumnLeft, () => this._addColumn("left"))), t.appendChild(this._makeBtn(q.colRight, e.addColumnRight, () => this._addColumn("right"))), t.appendChild(this._makeBtn(q.deleteCol, e.deleteColumn, () => this._deleteColumn())), t.appendChild(this._makeBtn(q.sortAsc, e.sortAsc, () => this._sortColumn("asc"))), t.appendChild(this._makeBtn(q.sortDesc, e.sortDesc, () => this._sortColumn("desc"))), t.appendChild(this._sep()), t.appendChild(this._makeBtn(q.mergeCells, e.mergeCells, () => this._mergeCells())), t.appendChild(this._makeBtn(q.unmergeCells, e.unmergeCells, () => this._unmergeCells())), t.appendChild(this._sep()), t.appendChild(this._makeBtn(q.alignLeft, e.cellAlignLeft, () => this._applyCellAlign("left"))), t.appendChild(this._makeBtn(q.alignCenter, e.cellAlignCenter, () => this._applyCellAlign("center"))), t.appendChild(this._makeBtn(q.alignRight, e.cellAlignRight, () => this._applyCellAlign("right"))), t.appendChild(this._makeBtn(q.alignJustify, e.cellAlignJustify, () => this._applyCellAlign("justify"))), t.appendChild(this._makeBtn(q.headerRow, e.toggleHeaderRow, () => this._toggleHeaderRow())), t.appendChild(this._sep());
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());
4414
4501
  let n = w("button", {
4415
4502
  type: "button",
4416
4503
  class: "an-link-tooltip-btn an-link-tooltip-btn--shade",
4417
4504
  title: e.cellBackground
4418
4505
  }), r = w("span", { class: "an-bubble-btn-svg" });
4419
- r.innerHTML = q.cellShade;
4506
+ r.innerHTML = G.cellShade;
4420
4507
  let i = w("span", { class: "an-link-tooltip-color-strip" });
4421
4508
  n.appendChild(r), n.appendChild(i), this._shadeColorStrip = i, this._disposers.push(E(n, "click", (e) => {
4422
4509
  e.preventDefault(), e.stopPropagation(), this._openCellShadePopover();
4423
- })), t.appendChild(n), t.appendChild(this._sep()), t.appendChild(this._makeBtn(q.colWidth, e.columnWidth, () => this._openSizePopover("col"))), t.appendChild(this._makeBtn(q.rowHeight, e.rowHeight, () => this._openSizePopover("row"))), t.appendChild(this._makeBtn(q.tableBorder, e.tableBorderWidth, () => this._openSizePopover("border"))), t.appendChild(this._makeBtn(q.cellPadding, e.cellPadding, () => this._openSizePopover("cellPadding")));
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")));
4424
4511
  let a = w("button", {
4425
4512
  type: "button",
4426
4513
  class: "an-link-tooltip-btn an-link-tooltip-btn--shade",
4427
4514
  title: e.tableBorderColor
4428
4515
  }), o = w("span", { class: "an-bubble-btn-svg" });
4429
- o.innerHTML = q.borderColor;
4516
+ o.innerHTML = G.borderColor;
4430
4517
  let s = w("span", { class: "an-link-tooltip-color-strip" });
4431
4518
  return a.appendChild(o), a.appendChild(s), this._borderColorStrip = s, this._disposers.push(E(a, "click", (e) => {
4432
4519
  e.preventDefault(), e.stopPropagation(), this._openBorderColorPopover();
4433
- })), t.appendChild(a), t.appendChild(this._sep()), t.appendChild(this._makeBtn(q.deleteTable, e.deleteTable, () => this._deleteTable(), !0)), t.appendChild(this._sep()), t.appendChild(this._makeBtn(q.exportCSV, e.exportCSV, () => this._exportTableCSV())), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => {
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", () => {
4434
4521
  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();
4435
4522
  })), t;
4436
4523
  }
@@ -4450,10 +4537,10 @@ var q = {
4450
4537
  _scheduleShow(e) {
4451
4538
  this._activeTable === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
4452
4539
  this._activeTable = e, this._show();
4453
- }, gr));
4540
+ }, Sr));
4454
4541
  }
4455
4542
  _scheduleHide() {
4456
- clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => this._hide(), _r));
4543
+ clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => this._hide(), Cr));
4457
4544
  }
4458
4545
  _show() {
4459
4546
  this._activeTable && (this._el.style.display = "flex", this._syncShadeStrip(), this._syncBorderColorStrip(), requestAnimationFrame(() => {
@@ -4502,7 +4589,7 @@ var q = {
4502
4589
  if (!t || e === t) return [e];
4503
4590
  let n = e.closest("table");
4504
4591
  if (!n?.contains(t)) return [e];
4505
- let { gridMap: r, cellPos: i } = br(n), a = i.get(e), o = i.get(t);
4592
+ let { gridMap: r, cellPos: i } = xr(n), a = i.get(e), o = i.get(t);
4506
4593
  if (!a || !o) return [e];
4507
4594
  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;
4508
4595
  for (; d;) {
@@ -4550,7 +4637,7 @@ var q = {
4550
4637
  if (!t.length) return;
4551
4638
  let n = t[0].closest("table");
4552
4639
  if (!n) return;
4553
- let r = t.map((e) => vr(e)), i = e === "left" ? Math.min(...r) : Math.max(...r), a = Array.from(n.querySelectorAll("tr")), o = a.map((t) => e === "left" ? K(t, i) : yr(t, i)), s = a.map((e) => e.closest("thead") !== null);
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);
4554
4641
  a.forEach((e, t) => {
4555
4642
  e.insertBefore(w(s[t] ? "th" : "td", {}, ["\xA0"]), o[t]);
4556
4643
  }), requestAnimationFrame(() => this._positionNear(this._activeTable)), this.context.invoke("editor.afterCommand");
@@ -4570,12 +4657,12 @@ var q = {
4570
4657
  if (!t) return;
4571
4658
  let n = Array.from(t.querySelectorAll("tr"));
4572
4659
  if (n[0] && n[0].cells.length <= 1) return;
4573
- let r = [...new Set(e.map((e) => vr(e)))];
4660
+ let r = [...new Set(e.map((e) => K(e)))];
4574
4661
  if (r.length >= (n[0]?.cells.length ?? 1)) return;
4575
4662
  let i = [];
4576
4663
  r.forEach((e) => {
4577
4664
  n.forEach((t) => {
4578
- let n = K(t, e);
4665
+ let n = q(t, e);
4579
4666
  n && i.push(n);
4580
4667
  });
4581
4668
  }), this._activeCell = null, this._clearSelection(), i.forEach((e) => e.remove()), requestAnimationFrame(() => this._positionNear(this._activeTable)), this.context.invoke("editor.afterCommand");
@@ -4598,7 +4685,7 @@ var q = {
4598
4685
  }
4599
4686
  }), n.length < 2) return;
4600
4687
  }
4601
- let { gridMap: r, cellPos: i } = br(t), a = Infinity, o = -Infinity, s = Infinity, c = -Infinity;
4688
+ let { gridMap: r, cellPos: i } = xr(t), a = Infinity, o = -Infinity, s = Infinity, c = -Infinity;
4602
4689
  if (n.forEach((e) => {
4603
4690
  let t = i.get(e);
4604
4691
  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));
@@ -4637,7 +4724,7 @@ var q = {
4637
4724
  _unmergeOne(e, t) {
4638
4725
  let n = e.colSpan || 1, r = e.rowSpan || 1;
4639
4726
  if (n === 1 && r === 1) return;
4640
- let { cellPos: i } = br(t), a = i.get(e);
4727
+ let { cellPos: i } = xr(t), a = i.get(e);
4641
4728
  if (!a) return;
4642
4729
  let { r: o, c: s } = a, c = Array.from(t.rows), l = e.tagName.toLowerCase();
4643
4730
  if (e.rowSpan = 1, e.colSpan = 1, e.style.verticalAlign = "", n > 1) {
@@ -4724,10 +4811,10 @@ var q = {
4724
4811
  let i = t.closest("table");
4725
4812
  if (i) {
4726
4813
  if (n) {
4727
- let t = [...new Set(r.map((e) => vr(e)))], n = Array.from(i.querySelectorAll("tr"));
4814
+ let t = [...new Set(r.map((e) => K(e)))], n = Array.from(i.querySelectorAll("tr"));
4728
4815
  t.forEach((t) => {
4729
4816
  n.forEach((n) => {
4730
- let r = K(n, t);
4817
+ let r = q(n, t);
4731
4818
  r && (r.colSpan || 1) === 1 && (r.style.width = `${e}px`, r.style.minWidth = `${e}px`);
4732
4819
  });
4733
4820
  });
@@ -4748,44 +4835,62 @@ var q = {
4748
4835
  _hideSizePopover() {
4749
4836
  this._sizePopover && (this._sizePopover.style.display = "none"), this._sizeApply = null;
4750
4837
  }
4751
- _buildCellShadePopover() {
4752
- let e = w("div", { class: "an-cell-shade-popover" });
4753
- e.style.display = "none";
4754
- let t = w("div", { class: "an-size-popover-title" });
4755
- e.appendChild(t), this._shadeTitleEl = t;
4756
- let n = w("div", { class: "an-context-color-palette" });
4757
- xr.forEach((e) => {
4758
- let t = w("div", {
4838
+ _buildColorPopover({ defaultColor: e, apply: t, getPopover: n, hide: r }) {
4839
+ let i = w("div", { class: "an-cell-shade-popover" });
4840
+ i.style.display = "none";
4841
+ let a = w("div", { class: "an-size-popover-title" });
4842
+ i.appendChild(a);
4843
+ let o = w("div", { class: "an-context-color-palette" });
4844
+ wr.forEach((e) => {
4845
+ let n = w("div", {
4759
4846
  class: "an-context-color-swatch",
4760
4847
  title: e
4761
4848
  });
4762
- t.style.background = e, this._disposers.push(E(t, "click", (t) => {
4763
- t.stopPropagation(), this._applyCellShade(e);
4764
- })), n.appendChild(t);
4765
- }), e.appendChild(n);
4766
- let r = w("div", { class: "an-context-color-custom" }), i = w("button", {
4849
+ n.style.background = e, this._disposers.push(E(n, "click", (n) => {
4850
+ n.stopPropagation(), t(e);
4851
+ })), o.appendChild(n);
4852
+ }), i.appendChild(o);
4853
+ let s = w("div", { class: "an-context-color-custom" }), c = w("button", {
4767
4854
  type: "button",
4768
4855
  class: "an-shade-no-color"
4769
4856
  });
4770
- this._disposers.push(E(i, "click", () => this._applyCellShade(""))), r.appendChild(i), e.appendChild(r), this._shadeNoBtn = i;
4771
- let a = w("div", { class: "an-context-color-custom" }), o = w("input", {
4857
+ this._disposers.push(E(c, "click", () => t(""))), s.appendChild(c), i.appendChild(s);
4858
+ let l = w("div", { class: "an-context-color-custom" }), u = w("input", {
4772
4859
  type: "color",
4773
4860
  class: "an-shade-color-input",
4774
- value: "#ffffff"
4775
- }), s = w("span");
4776
- return s.textContent = this.context.locale.contextMenu.customColorLabel, this._disposers.push(E(o, "change", () => this._applyCellShade(o.value))), a.appendChild(o), a.appendChild(s), e.appendChild(a), this._disposers.push(E(e, "mousedown", (e) => e.preventDefault()), E(e, "mouseenter", () => this._clearTimers()), E(e, "mouseleave", () => this._scheduleHide()), E(document, "click", (e) => {
4777
- let t = e.target;
4778
- this._shadePopover && this._shadePopover.style.display !== "none" && !this._shadePopover.contains(t) && !this._el?.contains(t) && this._hideCellShadePopover();
4779
- })), e;
4861
+ value: e
4862
+ }), d = w("span");
4863
+ return d.textContent = this.context.locale.contextMenu.customColorLabel, this._disposers.push(E(u, "change", () => t(u.value))), l.appendChild(u), l.appendChild(d), i.appendChild(l), this._disposers.push(E(i, "mousedown", (e) => e.preventDefault()), E(i, "mouseenter", () => this._clearTimers()), E(i, "mouseleave", () => this._scheduleHide()), E(document, "click", (e) => {
4864
+ let t = e.target, i = n();
4865
+ i && i.style.display !== "none" && !i.contains(t) && !this._el?.contains(t) && r();
4866
+ })), {
4867
+ el: i,
4868
+ titleEl: a,
4869
+ noColorBtn: c
4870
+ };
4871
+ }
4872
+ _showColorPopover(e) {
4873
+ let t = e();
4874
+ t && (t.style.display = "block", requestAnimationFrame(() => {
4875
+ let t = e();
4876
+ if (!t || !this._el) return;
4877
+ let n = t.offsetWidth || 170, r = t.offsetHeight || 120, i = this._el.getBoundingClientRect(), a = i.left, o = i.bottom + 6;
4878
+ a + n > globalThis.innerWidth - 8 && (a = globalThis.innerWidth - n - 8), o + r > globalThis.innerHeight - 8 && (o = i.top - r - 6), t.style.left = `${Math.max(8, a)}px`, t.style.top = `${Math.max(8, o)}px`;
4879
+ }));
4880
+ }
4881
+ _buildCellShadePopover() {
4882
+ let { el: e, titleEl: t, noColorBtn: n } = this._buildColorPopover({
4883
+ defaultColor: "#ffffff",
4884
+ apply: (e) => this._applyCellShade(e),
4885
+ getPopover: () => this._shadePopover,
4886
+ hide: () => this._hideCellShadePopover()
4887
+ });
4888
+ return this._shadeTitleEl = t, this._shadeNoBtn = n, e;
4780
4889
  }
4781
4890
  _openCellShadePopover() {
4782
4891
  if (!this._shadePopover) return;
4783
4892
  let e = this.context.locale.tooltips.table;
4784
- this._shadeTitleEl && (this._shadeTitleEl.textContent = e.cellBackground), this._shadeNoBtn && (this._shadeNoBtn.textContent = e.noShading), this._shadePopover.style.display = "block", requestAnimationFrame(() => {
4785
- if (!this._shadePopover || !this._el) return;
4786
- let e = this._shadePopover.offsetWidth || 170, t = this._shadePopover.offsetHeight || 120, n = this._el.getBoundingClientRect(), r = n.left, i = n.bottom + 6;
4787
- r + e > globalThis.innerWidth - 8 && (r = globalThis.innerWidth - e - 8), i + t > globalThis.innerHeight - 8 && (i = n.top - t - 6), this._shadePopover.style.left = `${Math.max(8, r)}px`, this._shadePopover.style.top = `${Math.max(8, i)}px`;
4788
- });
4893
+ this._shadeTitleEl && (this._shadeTitleEl.textContent = e.cellBackground), this._shadeNoBtn && (this._shadeNoBtn.textContent = e.noShading), this._showColorPopover(() => this._shadePopover);
4789
4894
  }
4790
4895
  _hideCellShadePopover() {
4791
4896
  this._shadePopover && (this._shadePopover.style.display = "none");
@@ -4796,43 +4901,18 @@ var q = {
4796
4901
  }), this._shadeColorStrip && (this._shadeColorStrip.style.background = e || "transparent"), this._hideCellShadePopover(), this.context.invoke("editor.afterCommand");
4797
4902
  }
4798
4903
  _buildBorderColorPopover() {
4799
- let e = w("div", { class: "an-cell-shade-popover" });
4800
- e.style.display = "none";
4801
- let t = w("div", { class: "an-size-popover-title" });
4802
- e.appendChild(t), this._borderColorTitleEl = t;
4803
- let n = w("div", { class: "an-context-color-palette" });
4804
- xr.forEach((e) => {
4805
- let t = w("div", {
4806
- class: "an-context-color-swatch",
4807
- title: e
4808
- });
4809
- t.style.background = e, this._disposers.push(E(t, "click", (t) => {
4810
- t.stopPropagation(), this._applyBorderColor(e);
4811
- })), n.appendChild(t);
4812
- }), e.appendChild(n);
4813
- let r = w("div", { class: "an-context-color-custom" }), i = w("button", {
4814
- type: "button",
4815
- class: "an-shade-no-color"
4904
+ let { el: e, titleEl: t, noColorBtn: n } = this._buildColorPopover({
4905
+ defaultColor: "#000000",
4906
+ apply: (e) => this._applyBorderColor(e),
4907
+ getPopover: () => this._borderColorPopover,
4908
+ hide: () => this._hideBorderColorPopover()
4816
4909
  });
4817
- this._disposers.push(E(i, "click", () => this._applyBorderColor(""))), r.appendChild(i), e.appendChild(r), this._borderColorNoBtn = i;
4818
- let a = w("div", { class: "an-context-color-custom" }), o = w("input", {
4819
- type: "color",
4820
- class: "an-shade-color-input",
4821
- value: "#000000"
4822
- }), s = w("span");
4823
- return s.textContent = this.context.locale.contextMenu.customColorLabel, this._disposers.push(E(o, "change", () => this._applyBorderColor(o.value))), a.appendChild(o), a.appendChild(s), e.appendChild(a), this._disposers.push(E(e, "mousedown", (e) => e.preventDefault()), E(e, "mouseenter", () => this._clearTimers()), E(e, "mouseleave", () => this._scheduleHide()), E(document, "click", (e) => {
4824
- let t = e.target;
4825
- this._borderColorPopover && this._borderColorPopover.style.display !== "none" && !this._borderColorPopover.contains(t) && !this._el?.contains(t) && this._hideBorderColorPopover();
4826
- })), e;
4910
+ return this._borderColorTitleEl = t, this._borderColorNoBtn = n, e;
4827
4911
  }
4828
4912
  _openBorderColorPopover() {
4829
4913
  if (!this._borderColorPopover) return;
4830
4914
  let e = this.context.locale.tooltips.table;
4831
- this._borderColorTitleEl && (this._borderColorTitleEl.textContent = e.tableBorderColor), this._borderColorNoBtn && (this._borderColorNoBtn.textContent = e.noBorderColor), this._borderColorPopover.style.display = "block", requestAnimationFrame(() => {
4832
- if (!this._borderColorPopover || !this._el) return;
4833
- let e = this._borderColorPopover.offsetWidth || 170, t = this._borderColorPopover.offsetHeight || 120, n = this._el.getBoundingClientRect(), r = n.left, i = n.bottom + 6;
4834
- r + e > globalThis.innerWidth - 8 && (r = globalThis.innerWidth - e - 8), i + t > globalThis.innerHeight - 8 && (i = n.top - t - 6), this._borderColorPopover.style.left = `${Math.max(8, r)}px`, this._borderColorPopover.style.top = `${Math.max(8, i)}px`;
4835
- });
4915
+ this._borderColorTitleEl && (this._borderColorTitleEl.textContent = e.tableBorderColor), this._borderColorNoBtn && (this._borderColorNoBtn.textContent = e.noBorderColor), this._showColorPopover(() => this._borderColorPopover);
4836
4916
  }
4837
4917
  _hideBorderColorPopover() {
4838
4918
  this._borderColorPopover && (this._borderColorPopover.style.display = "none");
@@ -4881,11 +4961,11 @@ var q = {
4881
4961
  if (!t) return;
4882
4962
  let n = this._getCell();
4883
4963
  if (!n) return;
4884
- let r = vr(n);
4964
+ let r = K(n);
4885
4965
  if (r === -1) return;
4886
4966
  let i = t.querySelector("tbody") || t, a = Array.from(i.querySelectorAll(":scope > tr"));
4887
4967
  a.length < 2 || (a.sort((t, n) => {
4888
- let i = K(t, r), a = K(n, r), o = (i?.textContent || "").trim(), s = (a?.textContent || "").trim(), c = parseFloat(o), l = parseFloat(s);
4968
+ let i = q(t, r), a = q(n, r), o = (i?.textContent || "").trim(), s = (a?.textContent || "").trim(), c = parseFloat(o), l = parseFloat(s);
4889
4969
  return !isNaN(c) && !isNaN(l) ? e === "asc" ? c - l : l - c : e === "asc" ? o.localeCompare(s) : s.localeCompare(o);
4890
4970
  }), a.forEach((e) => i.appendChild(e)), this._markSortIndicator(t, r, e), this.context.invoke("editor.afterCommand"));
4891
4971
  }
@@ -4897,7 +4977,7 @@ var q = {
4897
4977
  });
4898
4978
  let i = r.querySelector("tr");
4899
4979
  if (!i) return;
4900
- let a = K(i, t);
4980
+ let a = q(i, t);
4901
4981
  a && a.classList.add(n === "asc" ? "an-sort-asc" : "an-sort-desc");
4902
4982
  }
4903
4983
  _exportTableCSV() {
@@ -4906,13 +4986,13 @@ var q = {
4906
4986
  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");
4907
4987
  i.href = r, i.download = "table.csv", i.style.display = "none", document.body.appendChild(i), i.click(), i.remove(), URL.revokeObjectURL(r);
4908
4988
  }
4909
- }, Cr = 100, wr = 180, Tr = /language-(\S+)/, Er = {
4989
+ }, Er = 100, Dr = 180, Or = /language-(\S+)/, kr = {
4910
4990
  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>",
4911
4991
  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>",
4912
4992
  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>",
4913
4993
  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>",
4914
4994
  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>"
4915
- }, Dr = class {
4995
+ }, Ar = class {
4916
4996
  constructor(e) {
4917
4997
  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;
4918
4998
  }
@@ -4969,7 +5049,7 @@ var q = {
4969
5049
  ].forEach(([e, t]) => {
4970
5050
  let n = w("option", { value: e });
4971
5051
  n.textContent = t, this._langSelect.appendChild(n);
4972
- }), this._disposers.push(E(this._langSelect, "change", () => this._onLangChange())), t.appendChild(this._langSelect), t.appendChild(this._sep()), this._copyBtn = this._makeBtn(Er.copy, e.copyCode, () => this._copyCode()), t.appendChild(this._copyBtn), t.appendChild(this._sep()), this._wrapBtn = this._makeBtn(Er.wrapOn, e.toggleWordWrap, () => this._toggleWrap()), t.appendChild(this._wrapBtn), this._lineNumbersBtn = this._makeBtn(Er.lineNumbers, e.lineNumbers, () => this._toggleLineNumbers()), t.appendChild(this._lineNumbersBtn), t.appendChild(this._sep()), t.appendChild(this._makeBtn(Er.toParagraph, e.convertToParagraph, () => this._toParagraph())), t.appendChild(this._sep()), t.appendChild(this._makeBtn(Er.deleteCode, e.deleteCodeBlock, () => this._delete(), !0)), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
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;
4973
5053
  }
4974
5054
  _sep() {
4975
5055
  return w("div", { class: "an-link-tooltip-sep" });
@@ -4987,10 +5067,10 @@ var q = {
4987
5067
  _scheduleShow(e) {
4988
5068
  this._activePre === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
4989
5069
  this._activePre = e, this._syncWrapBtn(), this._syncLineNumbersBtn(), this._syncLangSelect(), this._show(e);
4990
- }, Cr));
5070
+ }, Er));
4991
5071
  }
4992
5072
  _scheduleHide() {
4993
- clearTimeout(this._showTimer), this._showTimer = null, clearTimeout(this._hideTimer), this._hideTimer = setTimeout(() => this._hide(), wr);
5073
+ clearTimeout(this._showTimer), this._showTimer = null, clearTimeout(this._hideTimer), this._hideTimer = setTimeout(() => this._hide(), Dr);
4994
5074
  }
4995
5075
  _show(e) {
4996
5076
  this._el.style.display = "flex", this._positionNear(e);
@@ -5017,7 +5097,7 @@ var q = {
5017
5097
  }
5018
5098
  _syncLangSelect() {
5019
5099
  if (!this._activePre || !this._langSelect) return;
5020
- let e = this._activePre.querySelector("code"), t = this._activePre.dataset.language || "", n = e && (Tr.exec(e.className) || [])[1] || "";
5100
+ let e = this._activePre.querySelector("code"), t = this._activePre.dataset.language || "", n = e && (Or.exec(e.className) || [])[1] || "";
5021
5101
  this._langSelect.value = t || n || "";
5022
5102
  }
5023
5103
  _copyCode() {
@@ -5123,21 +5203,21 @@ var q = {
5123
5203
  let e = this._activePre;
5124
5204
  e && (this._hide(), e.remove(), this.context.invoke("editor.afterCommand"));
5125
5205
  }
5126
- }, Or = null, kr = null;
5127
- function Ar() {
5128
- return Or ? Promise.resolve(Or) : (kr ??= import("./emoji-data-BDQX5kh-.js").then((e) => (Or = {
5206
+ }, jr = null, Mr = null;
5207
+ function Nr() {
5208
+ return jr ? Promise.resolve(jr) : (Mr ??= import("./emoji-data-BDQX5kh-.js").then((e) => (jr = {
5129
5209
  EMOJI_CATS: e.EMOJI_CATS,
5130
5210
  EMOJI_LIST: e.EMOJI_LIST
5131
- }, Or)), kr);
5211
+ }, jr)), Mr);
5132
5212
  }
5133
- var jr = class extends U {
5213
+ var Pr = class extends H {
5134
5214
  _activeCat = "all";
5135
5215
  initialize() {
5136
5216
  return this;
5137
5217
  }
5138
5218
  async show() {
5139
5219
  if (this._saveRange(), !this._dialog) {
5140
- let { EMOJI_CATS: e, EMOJI_LIST: t } = await Ar();
5220
+ let { EMOJI_CATS: e, EMOJI_LIST: t } = await Nr();
5141
5221
  this._dialog || (this._cats = e, this._list = t, this._dialog = this._buildDialog(), document.body.appendChild(this._dialog));
5142
5222
  }
5143
5223
  this._activeCat = "all", this._searchInput.value = "", this._updateCatTabs(), this._filterEmojis("", "all"), this._open();
@@ -5194,7 +5274,7 @@ var jr = class extends U {
5194
5274
  type: "button",
5195
5275
  class: "an-btn"
5196
5276
  });
5197
- p.textContent = e.cancelBtn, f.appendChild(p), n.append(r, c, l, d, f), t.appendChild(n), D(r, n);
5277
+ p.textContent = e.cancelBtn, f.appendChild(p), n.append(r, c, l, d, f), t.appendChild(n), he(r, n);
5198
5278
  let m = E(s, "click", () => this._close()), h = E(p, "click", () => this._close()), g = E(t, "click", (e) => {
5199
5279
  e.target === t && this._close();
5200
5280
  }), _ = E(c, "input", () => this._filterEmojis(c.value, this._activeCat)), v = E(l, "click", (e) => {
@@ -5230,270 +5310,34 @@ var jr = class extends U {
5230
5310
  let s = document.createTextNode(e);
5231
5311
  i.insertNode(s), i.setStartAfter(s), i.collapse(!0), r && (r.removeAllRanges(), r.addRange(i)), this._close(), n.focus(), this.context.invoke("editor.afterCommand");
5232
5312
  }
5233
- }, Mr = [
5234
- {
5235
- id: "popular",
5236
- label: "Popular"
5237
- },
5238
- {
5239
- id: "interface",
5240
- label: "Interface"
5241
- },
5242
- {
5243
- id: "navigation",
5244
- label: "Navigation"
5245
- },
5246
- {
5247
- id: "media",
5248
- label: "Media"
5249
- },
5250
- {
5251
- id: "communication",
5252
- label: "Communication"
5253
- },
5254
- {
5255
- id: "files",
5256
- label: "Files"
5257
- },
5258
- {
5259
- id: "people",
5260
- label: "People"
5261
- },
5262
- {
5263
- id: "objects",
5264
- label: "Objects"
5265
- }
5266
- ], Nr = [
5267
- ["house", "popular"],
5268
- ["star", "popular"],
5269
- ["heart", "popular"],
5270
- ["check", "popular"],
5271
- ["xmark", "popular"],
5272
- ["plus", "popular"],
5273
- ["minus", "popular"],
5274
- ["magnifying-glass", "popular"],
5275
- ["gear", "popular"],
5276
- ["bell", "popular"],
5277
- ["user", "popular"],
5278
- ["envelope", "popular"],
5279
- ["phone", "popular"],
5280
- ["calendar", "popular"],
5281
- ["clock", "popular"],
5282
- ["lock", "popular"],
5283
- ["eye", "popular"],
5284
- ["eye-slash", "popular"],
5285
- ["trash", "popular"],
5286
- ["pen", "popular"],
5287
- ["bookmark", "popular"],
5288
- ["flag", "popular"],
5289
- ["thumbs-up", "popular"],
5290
- ["thumbs-down", "popular"],
5291
- ["circle-info", "popular"],
5292
- ["triangle-exclamation", "popular"],
5293
- ["circle-check", "popular"],
5294
- ["circle-xmark", "popular"],
5295
- ["share", "popular"],
5296
- ["download", "popular"],
5297
- ["upload", "popular"],
5298
- ["tag", "popular"],
5299
- ["bars", "interface"],
5300
- ["ellipsis", "interface"],
5301
- ["ellipsis-vertical", "interface"],
5302
- ["list", "interface"],
5303
- ["table-cells", "interface"],
5304
- ["table-list", "interface"],
5305
- ["grip", "interface"],
5306
- ["filter", "interface"],
5307
- ["sort", "interface"],
5308
- ["arrows-rotate", "interface"],
5309
- ["rotate", "interface"],
5310
- ["rotate-left", "interface"],
5311
- ["rotate-right", "interface"],
5312
- ["copy", "interface"],
5313
- ["floppy-disk", "interface"],
5314
- ["print", "interface"],
5315
- ["link", "interface"],
5316
- ["code", "interface"],
5317
- ["expand", "interface"],
5318
- ["compress", "interface"],
5319
- ["cloud", "interface"],
5320
- ["lock-open", "interface"],
5321
- ["key", "interface"],
5322
- ["shield", "interface"],
5323
- ["shield-halved", "interface"],
5324
- ["sliders", "interface"],
5325
- ["toggle-on", "interface"],
5326
- ["square-check", "interface"],
5327
- ["circle-plus", "interface"],
5328
- ["circle-minus", "interface"],
5329
- ["arrow-right", "navigation"],
5330
- ["arrow-left", "navigation"],
5331
- ["arrow-up", "navigation"],
5332
- ["arrow-down", "navigation"],
5333
- ["chevron-right", "navigation"],
5334
- ["chevron-left", "navigation"],
5335
- ["chevron-up", "navigation"],
5336
- ["chevron-down", "navigation"],
5337
- ["angle-right", "navigation"],
5338
- ["angle-left", "navigation"],
5339
- ["angle-up", "navigation"],
5340
- ["angle-down", "navigation"],
5341
- ["angles-right", "navigation"],
5342
- ["angles-left", "navigation"],
5343
- ["location-dot", "navigation"],
5344
- ["compass", "navigation"],
5345
- ["map", "navigation"],
5346
- ["map-pin", "navigation"],
5347
- ["route", "navigation"],
5348
- ["circle-arrow-right", "navigation"],
5349
- ["circle-arrow-left", "navigation"],
5350
- ["arrow-trend-up", "navigation"],
5351
- ["arrow-trend-down", "navigation"],
5352
- ["right-from-bracket", "navigation"],
5353
- ["right-to-bracket", "navigation"],
5354
- ["play", "media"],
5355
- ["pause", "media"],
5356
- ["stop", "media"],
5357
- ["forward", "media"],
5358
- ["backward", "media"],
5359
- ["forward-step", "media"],
5360
- ["backward-step", "media"],
5361
- ["volume-high", "media"],
5362
- ["volume-low", "media"],
5363
- ["volume-xmark", "media"],
5364
- ["volume-off", "media"],
5365
- ["music", "media"],
5366
- ["headphones", "media"],
5367
- ["microphone", "media"],
5368
- ["microphone-slash", "media"],
5369
- ["film", "media"],
5370
- ["camera", "media"],
5371
- ["camera-rotate", "media"],
5372
- ["video", "media"],
5373
- ["image", "media"],
5374
- ["images", "media"],
5375
- ["photo-film", "media"],
5376
- ["podcast", "media"],
5377
- ["radio", "media"],
5378
- ["comment", "communication"],
5379
- ["comments", "communication"],
5380
- ["comment-dots", "communication"],
5381
- ["message", "communication"],
5382
- ["paper-plane", "communication"],
5383
- ["reply", "communication"],
5384
- ["reply-all", "communication"],
5385
- ["at", "communication"],
5386
- ["hashtag", "communication"],
5387
- ["wifi", "communication"],
5388
- ["signal", "communication"],
5389
- ["rss", "communication"],
5390
- ["share-nodes", "communication"],
5391
- ["inbox", "communication"],
5392
- ["phone-volume", "communication"],
5393
- ["mobile", "communication"],
5394
- ["mobile-screen", "communication"],
5395
- ["laptop", "communication"],
5396
- ["desktop", "communication"],
5397
- ["tower-broadcast", "communication"],
5398
- ["file", "files"],
5399
- ["file-lines", "files"],
5400
- ["folder", "files"],
5401
- ["folder-open", "files"],
5402
- ["folder-plus", "files"],
5403
- ["folder-minus", "files"],
5404
- ["file-image", "files"],
5405
- ["file-pdf", "files"],
5406
- ["file-code", "files"],
5407
- ["file-zipper", "files"],
5408
- ["file-audio", "files"],
5409
- ["file-video", "files"],
5410
- ["file-arrow-up", "files"],
5411
- ["file-arrow-down", "files"],
5412
- ["database", "files"],
5413
- ["box", "files"],
5414
- ["box-open", "files"],
5415
- ["hard-drive", "files"],
5416
- ["server", "files"],
5417
- ["user", "people"],
5418
- ["users", "people"],
5419
- ["user-group", "people"],
5420
- ["user-plus", "people"],
5421
- ["user-minus", "people"],
5422
- ["user-check", "people"],
5423
- ["user-xmark", "people"],
5424
- ["user-tie", "people"],
5425
- ["user-shield", "people"],
5426
- ["user-secret", "people"],
5427
- ["person", "people"],
5428
- ["person-running", "people"],
5429
- ["person-walking", "people"],
5430
- ["child", "people"],
5431
- ["handshake", "people"],
5432
- ["hand", "people"],
5433
- ["hands-holding", "people"],
5434
- ["people-group", "people"],
5435
- ["pencil", "objects"],
5436
- ["paintbrush", "objects"],
5437
- ["eraser", "objects"],
5438
- ["scissors", "objects"],
5439
- ["wrench", "objects"],
5440
- ["screwdriver", "objects"],
5441
- ["hammer", "objects"],
5442
- ["toolbox", "objects"],
5443
- ["graduation-cap", "objects"],
5444
- ["book", "objects"],
5445
- ["book-open", "objects"],
5446
- ["glasses", "objects"],
5447
- ["microscope", "objects"],
5448
- ["flask", "objects"],
5449
- ["stethoscope", "objects"],
5450
- ["hospital", "objects"],
5451
- ["building", "objects"],
5452
- ["city", "objects"],
5453
- ["car", "objects"],
5454
- ["truck", "objects"],
5455
- ["plane", "objects"],
5456
- ["train", "objects"],
5457
- ["bicycle", "objects"],
5458
- ["bus", "objects"],
5459
- ["rocket", "objects"],
5460
- ["briefcase", "objects"],
5461
- ["cart-shopping", "objects"],
5462
- ["bag-shopping", "objects"],
5463
- ["credit-card", "objects"],
5464
- ["money-bill", "objects"],
5465
- ["chart-bar", "objects"],
5466
- ["chart-line", "objects"],
5467
- ["chart-pie", "objects"],
5468
- ["bolt", "objects"],
5469
- ["sun", "objects"],
5470
- ["moon", "objects"],
5471
- ["snowflake", "objects"],
5472
- ["fire", "objects"],
5473
- ["droplet", "objects"],
5474
- ["leaf", "objects"],
5475
- ["tree", "objects"],
5476
- ["earth-americas", "objects"],
5477
- ["globe", "objects"],
5478
- ["award", "objects"],
5479
- ["trophy", "objects"],
5480
- ["gift", "objects"],
5481
- ["puzzle-piece", "objects"]
5482
- ], Pr = class extends U {
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 = {
5316
+ ICON_CATEGORIES: e.ICON_CATEGORIES,
5317
+ ICON_LIST: e.ICON_LIST
5318
+ }, Ir)), Lr);
5319
+ }
5320
+ var zr = class extends H {
5483
5321
  _selectedIcon = null;
5484
5322
  _activeCat = "all";
5485
5323
  initialize() {
5486
- return this._ensureFontAwesome(), this;
5324
+ return this;
5487
5325
  }
5488
5326
  _ensureFontAwesome() {
5489
- if (document.getElementById("an-fontawesome-css")) return;
5490
- let e = Array.from(document.querySelectorAll("link[rel=\"stylesheet\"]")).map((e) => e.href || "").join(" ");
5491
- if (/fontawesome|font-awesome/.test(e) || document.querySelector(".fa-solid, .fas, .far, .fab")) return;
5492
- let t = document.createElement("link");
5493
- t.id = "an-fontawesome-css", t.rel = "stylesheet", t.href = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css", t.crossOrigin = "anonymous", t.referrerPolicy = "no-referrer", document.head.appendChild(t);
5327
+ if (this.context.options.fontAwesomeAutoInject === !1) return;
5328
+ let e = this.context.options.fontAwesomeCDN || Fr;
5329
+ if (!e || document.getElementById("an-fontawesome-css")) return;
5330
+ let t = Array.from(document.querySelectorAll("link[rel=\"stylesheet\"]")).map((e) => e.href || "").join(" ");
5331
+ if (/fontawesome|font-awesome/.test(t) || document.querySelector(".fa-solid, .fas, .far, .fab")) return;
5332
+ let n = document.createElement("link");
5333
+ n.id = "an-fontawesome-css", n.rel = "stylesheet", n.href = e, n.crossOrigin = "anonymous", n.referrerPolicy = "no-referrer", document.head.appendChild(n);
5494
5334
  }
5495
- show() {
5496
- this._dialog || (this._dialog = this._buildDialog(), document.body.appendChild(this._dialog)), this._saveRange(), 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();
5335
+ async show() {
5336
+ if (this._saveRange(), this._ensureFontAwesome(), !this._dialog) {
5337
+ let { ICON_CATEGORIES: e, ICON_LIST: t } = await Rr();
5338
+ this._dialog || (this._cats = e, this._list = t, this._dialog = this._buildDialog(), document.body.appendChild(this._dialog));
5339
+ }
5340
+ 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();
5497
5341
  }
5498
5342
  _buildDialog() {
5499
5343
  let e = this.context.locale.iconDialog, t = w("div", {
@@ -5523,7 +5367,7 @@ var jr = class extends U {
5523
5367
  class: "an-icon-cat active",
5524
5368
  "data-cat": "all"
5525
5369
  });
5526
- u.textContent = e.all, l.appendChild(u), Mr.forEach(({ id: t, label: n }) => {
5370
+ u.textContent = e.all, l.appendChild(u), this._cats.forEach(({ id: t, label: n }) => {
5527
5371
  let r = w("button", {
5528
5372
  type: "button",
5529
5373
  class: "an-icon-cat",
@@ -5532,7 +5376,7 @@ var jr = class extends U {
5532
5376
  r.textContent = e.categories?.[t] || n, l.appendChild(r);
5533
5377
  }), this._catBar = l;
5534
5378
  let d = w("div", { class: "an-icon-grid" });
5535
- Nr.forEach(([e, t]) => {
5379
+ this._list.forEach(([e, t]) => {
5536
5380
  let n = w("button", {
5537
5381
  type: "button",
5538
5382
  class: "an-icon-cell",
@@ -5596,7 +5440,7 @@ var jr = class extends U {
5596
5440
  type: "button",
5597
5441
  class: "an-btn"
5598
5442
  });
5599
- 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);
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);
5600
5444
  let ne = E(s, "click", () => this._close()), re = E(C, "click", () => this._close()), ie = E(S, "click", () => this._onInsert()), ae = E(t, "click", (e) => {
5601
5445
  e.target === t && this._close();
5602
5446
  }), T = E(c, "input", () => this._filterIcons(c.value, this._activeCat)), oe = E(l, "click", (e) => {
@@ -5681,7 +5525,7 @@ var jr = class extends U {
5681
5525
  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>",
5682
5526
  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>",
5683
5527
  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>"
5684
- }, Fr = [
5528
+ }, Br = [
5685
5529
  "#000000",
5686
5530
  "#434343",
5687
5531
  "#666666",
@@ -5707,19 +5551,19 @@ var jr = class extends U {
5707
5551
  "#d9d2e9",
5708
5552
  "#ead1dc"
5709
5553
  ];
5710
- function Ir(e) {
5554
+ function Vr(e) {
5711
5555
  let t = e === "foreColor" ? "Text Color" : "Highlight Color", n = e === "foreColor" ? "textColor" : "highlightColor";
5712
5556
  return () => [{
5713
5557
  back: !0,
5714
5558
  label: t,
5715
5559
  localeKey: n,
5716
- navigate: () => Lr
5560
+ navigate: () => Hr
5717
5561
  }, {
5718
5562
  colorPalette: !0,
5719
5563
  colorType: e
5720
5564
  }];
5721
5565
  }
5722
- var Lr = [
5566
+ var Hr = [
5723
5567
  {
5724
5568
  name: "cut",
5725
5569
  label: "Cut",
@@ -5783,14 +5627,14 @@ var Lr = [
5783
5627
  label: "Text Color",
5784
5628
  icon: J.textColor,
5785
5629
  colorStrip: "foreColor",
5786
- navigate: Ir("foreColor")
5630
+ navigate: Vr("foreColor")
5787
5631
  },
5788
5632
  {
5789
5633
  name: "highlightColor",
5790
5634
  label: "Highlight Color",
5791
5635
  icon: J.highlightColor,
5792
5636
  colorStrip: "hiliteColor",
5793
- navigate: Ir("hiliteColor")
5637
+ navigate: Vr("hiliteColor")
5794
5638
  },
5795
5639
  { separator: !0 },
5796
5640
  {
@@ -5837,9 +5681,9 @@ var Lr = [
5837
5681
  icon: J.table,
5838
5682
  tableGrid: !0
5839
5683
  }
5840
- ], Rr = class {
5684
+ ], Ur = class {
5841
5685
  constructor(e) {
5842
- this.context = e, this.options = e.options || {}, this._items = this.options.contextMenu?.items || Lr, this.el = null, this._disposers = [], this._menuDisposers = [], this._lastX = 0, this._lastY = 0, this._copiedFormat = null, this._savedRange = null;
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;
5843
5687
  }
5844
5688
  initialize() {
5845
5689
  this.el = w("div", {
@@ -5925,7 +5769,7 @@ var Lr = [
5925
5769
  }
5926
5770
  if (e.colorPalette) {
5927
5771
  let t = w("div", { class: "an-context-color-palette" });
5928
- if (Fr.forEach((n) => {
5772
+ if (Br.forEach((n) => {
5929
5773
  let r = w("div", {
5930
5774
  class: "an-context-color-swatch",
5931
5775
  title: n,
@@ -6155,7 +5999,7 @@ var Lr = [
6155
5999
  } catch {}
6156
6000
  this.context.invoke("editor.afterCommand");
6157
6001
  }
6158
- }, zr = [
6002
+ }, Wr = [
6159
6003
  {
6160
6004
  category: "Text Formatting",
6161
6005
  items: [
@@ -6228,12 +6072,12 @@ var Lr = [
6228
6072
  action: "Show this keyboard shortcuts dialog"
6229
6073
  }]
6230
6074
  }
6231
- ], Br = "<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>", Vr = class extends U {
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 {
6232
6076
  show() {
6233
6077
  this._open();
6234
6078
  }
6235
6079
  _buildDialog() {
6236
- let e = this.context.locale.shortcutsDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, Br, e.title);
6080
+ let e = this.context.locale.shortcutsDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, Gr, e.title);
6237
6081
  n.classList.add("an-shortcuts-box");
6238
6082
  let r = w("button", {
6239
6083
  type: "button",
@@ -6241,7 +6085,7 @@ var Lr = [
6241
6085
  "aria-label": e.close,
6242
6086
  style: "margin-left:auto"
6243
6087
  });
6244
- r.textContent = "×", this._closeBtn = r, this._firstInput = r, n.querySelector(".an-dialog-header").appendChild(r), (this.context.locale.shortcutsDialog.shortcuts || zr).forEach(({ category: e, items: t }) => {
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 }) => {
6245
6089
  let r = w("div", { class: "an-shortcuts-cat" });
6246
6090
  r.textContent = e, n.appendChild(r);
6247
6091
  let i = w("div", { class: "an-shortcuts-table" });
@@ -6255,7 +6099,7 @@ var Lr = [
6255
6099
  let i = E(r, "click", () => this._close());
6256
6100
  return this._disposers.push(i), t;
6257
6101
  }
6258
- }, Hr = class extends U {
6102
+ }, qr = class extends H {
6259
6103
  constructor(e) {
6260
6104
  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;
6261
6105
  }
@@ -6371,7 +6215,7 @@ var Lr = [
6371
6215
  });
6372
6216
  b.textContent = e.replaceAllBtn, _.append(v, y, b), n.appendChild(_);
6373
6217
  let x = w("div", { class: "an-fr-replace-actions" });
6374
- x.style.display = "none", n.appendChild(x), t.appendChild(n), D(r, n);
6218
+ x.style.display = "none", n.appendChild(x), t.appendChild(n), he(r, n);
6375
6219
  let ee = E(s, "click", () => this._close()), te = E(t, "click", (e) => {
6376
6220
  e.target === t && this._close();
6377
6221
  }), S = E(l, "input", () => this._onSearch()), C = E(d, "click", () => {
@@ -6498,8 +6342,8 @@ var Lr = [
6498
6342
  this._counterEl.textContent = e ? this.context.locale.findReplace.noResults : "";
6499
6343
  } else this._counterEl.textContent = `${this._currentIndex + 1} / ${e}`;
6500
6344
  }
6501
- }, Y = 20, Ur = "#3b82f6", X = (e, t, n) => Math.min(Math.max(e, t), n);
6502
- function Wr(e, t, n, r) {
6345
+ }, Y = 20, Jr = "#3b82f6", X = (e, t, n) => Math.min(Math.max(e, t), n);
6346
+ function Yr(e, t, n, r) {
6503
6347
  return new Promise((i) => {
6504
6348
  let a = (e) => {
6505
6349
  let a = document.createElement("canvas");
@@ -6523,7 +6367,7 @@ function Wr(e, t, n, r) {
6523
6367
  o.crossOrigin = "anonymous", o.onload = () => a(o), o.onerror = () => i(null), o.src = e.src + (e.src.includes("?") ? "&" : "?") + "_an=" + Date.now();
6524
6368
  });
6525
6369
  }
6526
- var Gr = class {
6370
+ var Xr = class {
6527
6371
  constructor(e) {
6528
6372
  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 = [];
6529
6373
  }
@@ -6554,7 +6398,7 @@ var Gr = class {
6554
6398
  t.className = "an-crop-box", t.style.cssText = `
6555
6399
  position:fixed; z-index:10101;
6556
6400
  box-sizing:border-box;
6557
- border:2px solid ${Ur};
6401
+ border:2px solid ${Jr};
6558
6402
  cursor:move;
6559
6403
  outline: none;
6560
6404
  `;
@@ -6619,7 +6463,7 @@ var Gr = class {
6619
6463
  "position:absolute",
6620
6464
  "width:10px",
6621
6465
  "height:10px",
6622
- `background:${Ur}`,
6466
+ `background:${Jr}`,
6623
6467
  "border:2px solid #fff",
6624
6468
  "border-radius:2px",
6625
6469
  "box-sizing:border-box",
@@ -6653,7 +6497,7 @@ var Gr = class {
6653
6497
  let a = this._makeToolbarBtn("✓ Crop", "#22c55e", () => this._confirm()), o = this._makeToolbarBtn("✕ Cancel", "#94a3b8", () => this._close(!1)), s = document.createElement("label");
6654
6498
  s.style.cssText = "color:#94a3b8;font-size:11px;cursor:pointer;display:flex;align-items:center;gap:4px;";
6655
6499
  let c = document.createElement("input");
6656
- c.type = "checkbox", c.style.accentColor = Ur, 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;
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;
6657
6501
  }
6658
6502
  _makeToolbarBtn(e, t, n) {
6659
6503
  let r = document.createElement("button");
@@ -6738,7 +6582,7 @@ var Gr = class {
6738
6582
  this._close(!1);
6739
6583
  return;
6740
6584
  }
6741
- let f = await Wr(e, {
6585
+ let f = await Yr(e, {
6742
6586
  x: c,
6743
6587
  y: l,
6744
6588
  width: u,
@@ -6782,7 +6626,7 @@ var Gr = class {
6782
6626
  e?.remove();
6783
6627
  }), 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;
6784
6628
  }
6785
- }, Kr = class {
6629
+ }, Zr = class {
6786
6630
  constructor(e) {
6787
6631
  this.context = e, this.options = e.options, this._banner = null;
6788
6632
  }
@@ -6835,7 +6679,7 @@ var Gr = class {
6835
6679
  _removeBanner() {
6836
6680
  this._banner?.remove(), this._banner = null;
6837
6681
  }
6838
- }, qr = class {
6682
+ }, Qr = class {
6839
6683
  constructor(e) {
6840
6684
  this.context = e, this.options = e.options, this._disposers = [];
6841
6685
  }
@@ -6970,7 +6814,7 @@ var Gr = class {
6970
6814
  break;
6971
6815
  }
6972
6816
  }
6973
- }, Jr = [
6817
+ }, $r = [
6974
6818
  "#000000",
6975
6819
  "#434343",
6976
6820
  "#666666",
@@ -6995,7 +6839,7 @@ var Gr = class {
6995
6839
  "#c9daf8",
6996
6840
  "#d9d2e9",
6997
6841
  "#ead1dc"
6998
- ], Yr = "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" ${Yr} style="display:block">${e}</svg>`, Xr = {
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 = {
6999
6843
  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\"/>"),
7000
6844
  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\"/>"),
7001
6845
  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\"/>"),
@@ -7005,7 +6849,7 @@ var Gr = class {
7005
6849
  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\"/>"),
7006
6850
  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\"/>"),
7007
6851
  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\"/>")
7008
- }, Zr = {
6852
+ }, ni = {
7009
6853
  bold: (e) => e.invoke("editor.bold"),
7010
6854
  italic: (e) => e.invoke("editor.italic"),
7011
6855
  underline: (e) => e.invoke("editor.underline"),
@@ -7026,15 +6870,15 @@ var Gr = class {
7026
6870
  e.invoke("editor.afterCommand");
7027
6871
  },
7028
6872
  inlineCode: (e) => e.invoke("editor.inlineCode")
7029
- }, Qr = {
6873
+ }, ri = {
7030
6874
  bold: () => document.queryCommandState("bold"),
7031
6875
  italic: () => document.queryCommandState("italic"),
7032
6876
  underline: () => document.queryCommandState("underline"),
7033
6877
  strikethrough: () => document.queryCommandState("strikeThrough")
7034
- }, $r = {
6878
+ }, ii = {
7035
6879
  foreColor: !0,
7036
6880
  hiliteColor: !0
7037
- }, ei = class {
6881
+ }, ai = class {
7038
6882
  constructor(e) {
7039
6883
  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);
7040
6884
  }
@@ -7064,23 +6908,23 @@ var Gr = class {
7064
6908
  "removeFormat"
7065
6909
  ];
7066
6910
  for (let n of t) {
7067
- if (!Xr[n]) continue;
6911
+ if (!ti[n]) continue;
7068
6912
  let t = document.createElement("button");
7069
- if (t.type = "button", t.dataset.name = n, t.setAttribute("aria-label", n), $r[n]) {
6913
+ if (t.type = "button", t.dataset.name = n, t.setAttribute("aria-label", n), ii[n]) {
7070
6914
  t.className = "an-bubble-btn an-bubble-btn--color";
7071
6915
  let e = document.createElement("span");
7072
- e.className = "an-bubble-btn-svg", e.innerHTML = Xr[n];
6916
+ e.className = "an-bubble-btn-svg", e.innerHTML = ti[n];
7073
6917
  let r = document.createElement("span");
7074
6918
  r.className = "an-bubble-color-strip", r.style.background = n === "foreColor" ? "#000000" : "transparent", t.appendChild(e), t.appendChild(r);
7075
- } else t.className = "an-bubble-btn", t.innerHTML = Xr[n];
6919
+ } else t.className = "an-bubble-btn", t.innerHTML = ti[n];
7076
6920
  t.addEventListener("mousedown", (e) => {
7077
6921
  e.preventDefault();
7078
6922
  }), t.addEventListener("click", (e) => {
7079
- if (e.preventDefault(), e.stopPropagation(), $r[n]) {
6923
+ if (e.preventDefault(), e.stopPropagation(), ii[n]) {
7080
6924
  this._openColorPicker(n, t);
7081
6925
  return;
7082
6926
  }
7083
- this.context.invoke("editor.focus"), Zr[n] && Zr[n](this.context), this._syncActive();
6927
+ this.context.invoke("editor.focus"), ni[n] && ni[n](this.context), this._syncActive();
7084
6928
  }), e.appendChild(t);
7085
6929
  }
7086
6930
  document.body.appendChild(e), this._el = e, this._btnCache = Array.from(e.querySelectorAll(".an-bubble-btn"));
@@ -7089,7 +6933,7 @@ var Gr = class {
7089
6933
  let e = document.createElement("div");
7090
6934
  e.className = "an-bubble-color-picker", e.style.display = "none", e.addEventListener("mousedown", (e) => e.preventDefault());
7091
6935
  let t = document.createElement("div");
7092
- t.className = "an-context-color-palette", Jr.forEach((e) => {
6936
+ t.className = "an-context-color-palette", $r.forEach((e) => {
7093
6937
  let n = document.createElement("div");
7094
6938
  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) => {
7095
6939
  t.stopPropagation(), this._applyColor(this._pickerType, e);
@@ -7157,7 +7001,7 @@ var Gr = class {
7157
7001
  }
7158
7002
  _syncActive() {
7159
7003
  this._btnCache && this._btnCache.forEach((e) => {
7160
- let t = Qr[e.dataset.name];
7004
+ let t = ri[e.dataset.name];
7161
7005
  e.classList.toggle("an-active", !!t?.());
7162
7006
  });
7163
7007
  }
@@ -7208,7 +7052,7 @@ var Gr = class {
7208
7052
  _onContextMenu() {
7209
7053
  this._hide();
7210
7054
  }
7211
- }, ti = class {
7055
+ }, oi = class {
7212
7056
  constructor(e) {
7213
7057
  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 = [];
7214
7058
  }
@@ -7353,7 +7197,7 @@ var Gr = class {
7353
7197
  let n;
7354
7198
  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());
7355
7199
  }
7356
- }, ni = class {
7200
+ }, si = class {
7357
7201
  constructor(e) {
7358
7202
  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;
7359
7203
  }
@@ -7580,38 +7424,38 @@ var Gr = class {
7580
7424
  this._deleteTriggerText(), this._close(), t.run();
7581
7425
  }
7582
7426
  }
7583
- }, ri = /* @__PURE__ */ new Map(), ii = [
7427
+ }, ci = /* @__PURE__ */ new Map(), li = [
7584
7428
  {
7585
7429
  name: "autoSaveRestore",
7586
- Class: Kr,
7430
+ Class: Zr,
7587
7431
  enabled: (e) => !!e.autoSaveRestore
7588
7432
  },
7589
7433
  {
7590
7434
  name: "markdownShortcuts",
7591
- Class: qr,
7435
+ Class: Qr,
7592
7436
  enabled: (e) => e.markdownShortcuts !== !1
7593
7437
  },
7594
7438
  {
7595
7439
  name: "bubbleToolbar",
7596
- Class: ei,
7440
+ Class: ai,
7597
7441
  enabled: (e) => !!e.bubbleToolbar
7598
7442
  },
7599
7443
  {
7600
7444
  name: "mention",
7601
- Class: ti,
7445
+ Class: oi,
7602
7446
  enabled: (e) => !!e.mention
7603
7447
  },
7604
7448
  {
7605
7449
  name: "slashMenu",
7606
- Class: ni,
7450
+ Class: si,
7607
7451
  enabled: (e) => e.slashMenu !== !1
7608
7452
  }
7609
- ], ai = /* @__PURE__ */ new Map(), oi = class {
7453
+ ], ui = /* @__PURE__ */ new Map(), di = class {
7610
7454
  constructor(e, t = {}) {
7611
7455
  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;
7612
7456
  }
7613
7457
  initialize() {
7614
- let { container: e, editable: t } = on(this.targetEl, this.options);
7458
+ let { container: e, editable: t } = cn(this.targetEl, this.options);
7615
7459
  this.layoutInfo.container = e, this.layoutInfo.editable = t, this._registerModules();
7616
7460
  let n = this._modules.get("toolbar");
7617
7461
  n?.el && (e.insertBefore(n.el, t), this.layoutInfo.toolbar = n.el);
@@ -7623,12 +7467,12 @@ var Gr = class {
7623
7467
  let n = new t(this);
7624
7468
  this._modules.set(e, n), n.initialize();
7625
7469
  };
7626
- e("editor", Bn), e("toolbar", Wn), e("statusbar", Jn), e("clipboard", Yn), e("contextMenu", Rr), e("placeholder", Xn), e("codeview", Zn), e("fullscreen", Qn), e("linkDialog", er), e("imageDialog", nr), e("videoDialog", ir), e("imageResizer", sr), e("videoResizer", cr), e("linkTooltip", fr), e("imageTooltip", mr), e("videoTooltip", hr), e("tableTooltip", Sr), e("codeTooltip", Dr), e("emojiDialog", jr), e("iconDialog", Pr), e("shortcutsDialog", Vr), e("findReplace", Hr), e("imageCropOverlay", Gr);
7627
- for (let { name: t, Class: n, enabled: r } of ii) r(this.options) && e(t, n);
7628
- if (ri.size > 0) for (let [t, n] of ri) e(t, n);
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);
7629
7473
  }
7630
7474
  _syncOptionalModules() {
7631
- for (let { name: e, Class: t, enabled: n } of ii) {
7475
+ for (let { name: e, Class: t, enabled: n } of li) {
7632
7476
  let r = n(this.options);
7633
7477
  if (r !== this._modules.has(e)) if (r) {
7634
7478
  let n = new t(this);
@@ -7672,7 +7516,7 @@ var Gr = class {
7672
7516
  });
7673
7517
  }
7674
7518
  _applyGlobalPlugins() {
7675
- if (ai.size !== 0) for (let { plugin: e, options: t } of ai.values()) this._installPlugin(e, t);
7519
+ if (ui.size !== 0) for (let { plugin: e, options: t } of ui.values()) this._installPlugin(e, t);
7676
7520
  }
7677
7521
  _bindEditorEvents(e) {
7678
7522
  let t = E(e, "input", () => this._syncToTarget()), n = E(e, "focus", () => {
@@ -7928,63 +7772,82 @@ var Gr = class {
7928
7772
  };
7929
7773
  //#endregion
7930
7774
  //#region src/js/core/lists.js
7931
- function si(e) {
7775
+ function fi(e) {
7932
7776
  return e[e.length - 1];
7933
7777
  }
7934
- function ci(e) {
7778
+ function pi(e) {
7935
7779
  return e[0];
7936
7780
  }
7937
- function li(e, t = 1) {
7781
+ function mi(e, t = 1) {
7938
7782
  return e.slice(0, e.length - t);
7939
7783
  }
7940
- function ui(e, t = 1) {
7784
+ function hi(e, t = 1) {
7941
7785
  return e.slice(t);
7942
7786
  }
7943
- function di(e) {
7787
+ function gi(e) {
7944
7788
  return e.flat();
7945
7789
  }
7946
- function fi(e) {
7790
+ function _i(e) {
7947
7791
  return [...new Set(e)];
7948
7792
  }
7949
- function pi(e, t) {
7793
+ function vi(e, t) {
7950
7794
  let n = [];
7951
7795
  for (let r = 0; r < e.length; r += t) n.push(e.slice(r, r + t));
7952
7796
  return n;
7953
7797
  }
7954
- function mi(e, t) {
7798
+ function yi(e, t) {
7955
7799
  return e.reduce((e, n) => {
7956
7800
  let r = t(n);
7957
7801
  return e[r] || (e[r] = []), e[r].push(n), e;
7958
7802
  }, {});
7959
7803
  }
7960
- function hi(e, t) {
7804
+ function bi(e, t) {
7961
7805
  return e.every(t);
7962
7806
  }
7963
- function gi(e, t) {
7807
+ function xi(e, t) {
7964
7808
  return e.some(t);
7965
7809
  }
7966
7810
  //#endregion
7967
7811
  //#region src/js/core/env.js
7968
- var Q = navigator.userAgent, _i = {
7969
- isChrome: /Chrome\//.test(Q),
7970
- isFF: /Firefox\//.test(Q),
7971
- isSafari: /^((?!chrome|android).)*safari/i.test(Q),
7972
- isEdge: /Edg\//.test(Q),
7973
- isMac: /Macintosh/.test(Q),
7974
- isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(Q),
7975
- isTouch: "ontouchstart" in globalThis || navigator.maxTouchPoints > 0,
7976
- modifierKey: /Macintosh/.test(Q) ? "metaKey" : "ctrlKey"
7977
- }, vi = { ...A }, $ = /* @__PURE__ */ new WeakMap(), yi = {
7812
+ function Q() {
7813
+ return globalThis.navigator?.userAgent ?? "";
7814
+ }
7815
+ var Si = {
7816
+ get isChrome() {
7817
+ return /Chrome\//.test(Q()) && !/Edg\//.test(Q());
7818
+ },
7819
+ get isFF() {
7820
+ return /Firefox\//.test(Q());
7821
+ },
7822
+ get isSafari() {
7823
+ return /^((?!chrome|android).)*safari/i.test(Q());
7824
+ },
7825
+ get isEdge() {
7826
+ return /Edg\//.test(Q());
7827
+ },
7828
+ get isMac() {
7829
+ return /Macintosh/.test(Q());
7830
+ },
7831
+ get isMobile() {
7832
+ return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(Q());
7833
+ },
7834
+ get isTouch() {
7835
+ return "ontouchstart" in globalThis || (globalThis.navigator?.maxTouchPoints ?? 0) > 0;
7836
+ },
7837
+ get modifierKey() {
7838
+ return /Macintosh/.test(Q()) ? "metaKey" : "ctrlKey";
7839
+ }
7840
+ }, Ci = { ...A }, $ = /* @__PURE__ */ new WeakMap(), wi = {
7978
7841
  create(e, t = {}) {
7979
- let n = bi(e).map((e) => {
7842
+ let n = Ti(e).map((e) => {
7980
7843
  if ($.has(e)) return $.get(e);
7981
- let n = new oi(e, t);
7844
+ let n = new di(e, t);
7982
7845
  return n.initialize(), $.set(e, n), n;
7983
7846
  });
7984
7847
  return n.length === 1 ? n[0] : n;
7985
7848
  },
7986
7849
  destroy(e) {
7987
- bi(e).forEach((e) => {
7850
+ Ti(e).forEach((e) => {
7988
7851
  let t = $.get(e);
7989
7852
  t && (t.destroy(), $.delete(e));
7990
7853
  });
@@ -8000,20 +7863,20 @@ var Q = navigator.userAgent, _i = {
8000
7863
  Object.assign(A, e);
8001
7864
  },
8002
7865
  resetDefaults() {
8003
- Object.keys(A).forEach((e) => delete A[e]), Object.assign(A, vi);
7866
+ Object.keys(A).forEach((e) => delete A[e]), Object.assign(A, Ci);
8004
7867
  },
8005
7868
  registerModule(e, t) {
8006
- ri.set(e, t);
7869
+ ci.set(e, t);
8007
7870
  },
8008
7871
  use(e, t = {}) {
8009
7872
  if (!e || typeof e.name != "string") throw TypeError("[AutumnNote] AutumnNote.use: plugin must have a string `name` property.");
8010
- return ai.has(e.name) ? (console.warn(`[AutumnNote] Plugin "${e.name}" already registered globally. Skipping.`), this) : (Array.isArray(e.buttons) && e.buttons.forEach((e) => $e(e)), ai.set(e.name, {
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, {
8011
7874
  plugin: e,
8012
7875
  options: t
8013
7876
  }), this);
8014
7877
  },
8015
7878
  hasPlugin(e) {
8016
- return ai.has(e);
7879
+ return ui.has(e);
8017
7880
  },
8018
7881
  registerButton(e) {
8019
7882
  return $e(e), this;
@@ -8027,12 +7890,12 @@ var Q = navigator.userAgent, _i = {
8027
7890
  return n >= 0 ? t[n] = e : t.push(e), this;
8028
7891
  },
8029
7892
  buttons: Vt,
8030
- version: "2.0.0"
7893
+ version: "2.2.0"
8031
7894
  };
8032
- function bi(e) {
7895
+ function Ti(e) {
8033
7896
  return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : e instanceof Element ? [e] : e instanceof NodeList || Array.isArray(e) ? Array.from(e) : [];
8034
7897
  }
8035
7898
  //#endregion
8036
- export { oi 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, hi as all, ne as ancestors, gi as any, zt as backColorBtn, tt as boldBtn, Vt as buttons, It as checklistBtn, re as children, pi 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, _i as env, Nt as findBtn, Pt as findReplaceBtn, ci as first, di as flatten, Dt as fontFamilyBtn, wt as fontSizeBtn, Rt as foreColorBtn, ge as fromNativeRange, jt as fullscreenBtn, et as getButton, mi as groupBy, _t as hrBtn, St as iconBtn, i as identity, yt as imageBtn, pt as indentBtn, li 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, si 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, rn as sanitiseUrl, Mt as shortcutsBtn, Se as splitText, it as strikeBtn, ot as subscriptBtn, at as superscriptBtn, Ct as tableBtn, ui as tail, n as throttle, me as trapFocus, dt as ulBtn, rt as underlineBtn, ht as undoBtn, fi as unique, oe as unwrap, bt as videoBtn, xe as withSavedRange, se as wrap };
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 };
8037
7900
 
8038
7901
  //# sourceMappingURL=autumnnote.es.js.map