autumnnote 2.5.0 → 2.7.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.
@@ -122,12 +122,22 @@ function fe(e) {
122
122
  n && (n.removeAllRanges(), n.addRange(t));
123
123
  }
124
124
  function pe(e) {
125
+ if (e?.querySelectorAll) for (let t of e.querySelectorAll("ul > ul, ul > ol, ol > ul, ol > ol")) {
126
+ let e = t.previousElementSibling;
127
+ if (e && e.nodeName === "LI") e.appendChild(t);
128
+ else if (t.parentNode) {
129
+ let e = t.ownerDocument.createElement("li");
130
+ t.parentNode.insertBefore(e, t), e.appendChild(t);
131
+ }
132
+ }
133
+ }
134
+ function me(e) {
125
135
  return !!S(e, x);
126
136
  }
127
137
  function E(e, t, n, r) {
128
138
  return e.addEventListener(t, n, r), () => e.removeEventListener(t, n, r);
129
139
  }
130
- function me(e, t) {
140
+ function he(e, t) {
131
141
  let n = () => Array.from(e.querySelectorAll("a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])")).filter((e) => !e.closest("[style*=\"display: none\"]") && !e.closest("[style*=\"display:none\"]")), r = (e) => {
132
142
  if (e.key === "Escape") {
133
143
  e.stopPropagation(), t?.();
@@ -141,7 +151,7 @@ function me(e, t) {
141
151
  };
142
152
  return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
143
153
  }
144
- function he(e, t) {
154
+ function ge(e, t) {
145
155
  e.style.cursor = "grab";
146
156
  let n = (n) => {
147
157
  if (n.button !== 0 || n.target.closest("button, input, select, textarea, a")) return;
@@ -163,7 +173,7 @@ function he(e, t) {
163
173
  }
164
174
  //#endregion
165
175
  //#region src/js/core/range.js
166
- var ge = class {
176
+ var _e = class {
167
177
  constructor(e, t, n, r) {
168
178
  this.sc = e, this.so = t, this.ec = n, this.eo = r;
169
179
  }
@@ -199,40 +209,40 @@ var ge = class {
199
209
  this.toNativeRange().insertNode(e);
200
210
  }
201
211
  };
202
- function _e(e) {
203
- return new ge(e.startContainer, e.startOffset, e.endContainer, e.endOffset);
204
- }
205
212
  function ve(e) {
213
+ return new _e(e.startContainer, e.startOffset, e.endContainer, e.endOffset);
214
+ }
215
+ function ye(e) {
206
216
  let t = globalThis.getSelection();
207
217
  if (!t || t.rangeCount === 0) return null;
208
218
  let n = t.getRangeAt(0);
209
- return e && !e.contains(n.commonAncestorContainer) ? null : _e(n);
219
+ return e && !e.contains(n.commonAncestorContainer) ? null : ve(n);
210
220
  }
211
- function ye(e) {
212
- return new ge(e, 0, e, e.childNodes.length);
221
+ function be(e) {
222
+ return new _e(e, 0, e, e.childNodes.length);
213
223
  }
214
- function be(e, t = 0) {
215
- return new ge(e, t, e, t);
224
+ function xe(e, t = 0) {
225
+ return new _e(e, t, e, t);
216
226
  }
217
- function xe(e) {
227
+ function Se(e) {
218
228
  let t = globalThis.getSelection();
219
229
  return !t || t.rangeCount === 0 ? !1 : e.contains(t.getRangeAt(0).commonAncestorContainer);
220
230
  }
221
- function Se(e) {
231
+ function Ce(e) {
222
232
  let t = globalThis.getSelection();
223
233
  if (!t || t.rangeCount === 0) {
224
234
  e(null);
225
235
  return;
226
236
  }
227
237
  let n = t.getRangeAt(0).cloneRange();
228
- e(_e(n)), t.removeAllRanges(), t.addRange(n);
238
+ e(ve(n)), t.removeAllRanges(), t.addRange(n);
229
239
  }
230
- function Ce(e, t) {
240
+ function we(e, t) {
231
241
  return [e, e.splitText(t)];
232
242
  }
233
243
  //#endregion
234
244
  //#region src/js/editing/insert.js
235
- function we(e) {
245
+ function Te(e) {
236
246
  let t = e && e.nodeType === 1 ? e : e?.parentElement;
237
247
  for (; t;) {
238
248
  let e = t.getAttribute?.("contenteditable") ?? t.contentEditable;
@@ -242,38 +252,41 @@ function we(e) {
242
252
  }
243
253
  return null;
244
254
  }
245
- function Te(e) {
255
+ function Ee(e) {
246
256
  let t = globalThis.getSelection?.();
247
257
  if (!t || t.rangeCount === 0) return null;
248
258
  let n = t.getRangeAt(0);
249
- return e && e !== document ? e.contains(n.commonAncestorContainer) ? n : null : we(n.commonAncestorContainer) ? n : null;
259
+ return e && e !== document ? e.contains(n.commonAncestorContainer) ? n : null : Te(n.commonAncestorContainer) ? n : null;
250
260
  }
251
- function Ee(e) {
261
+ function De(e) {
252
262
  let t = globalThis.getSelection?.();
253
263
  if (!t) return;
254
264
  let n = document.createRange();
255
265
  n.setStartAfter(e), n.collapse(!0), t.removeAllRanges(), t.addRange(n);
256
266
  }
257
- function De(e, t) {
258
- let n = Te(t);
267
+ function Oe(e, t) {
268
+ let n = Ee(t);
259
269
  if (!n) return !1;
260
270
  let r = document.createElement("template");
261
271
  r.innerHTML = e;
262
272
  let i = r.content, a = i.lastChild;
263
- return n.deleteContents(), n.insertNode(i), a && Ee(a), !0;
273
+ return n.deleteContents(), n.insertNode(i), a && De(a), !0;
264
274
  }
265
- function Oe(e, t) {
266
- let n = Te(t);
275
+ function ke(e, t) {
276
+ let n = Ee(t);
267
277
  if (!n) return !1;
268
278
  n.deleteContents();
269
279
  let r = String(e), i = document.createDocumentFragment();
270
- !r.includes("\n") || ke(n.startContainer, t) ? i.appendChild(document.createTextNode(r)) : r.split("\n").forEach((e, t) => {
280
+ !r.includes("\n") || je(n.startContainer, t) ? i.appendChild(document.createTextNode(r)) : r.split("\n").forEach((e, t) => {
271
281
  t > 0 && i.appendChild(document.createElement("br")), e && i.appendChild(document.createTextNode(e));
272
282
  });
273
283
  let a = i.lastChild;
274
- return n.insertNode(i), a && Ee(a), !0;
284
+ return n.insertNode(i), a && De(a), !0;
275
285
  }
276
- function ke(e, t) {
286
+ function Ae(e) {
287
+ return ke("\n", e);
288
+ }
289
+ function je(e, t) {
277
290
  let n = e.nodeType === 1 ? e : e.parentElement;
278
291
  for (; n && n !== t;) {
279
292
  if (n.tagName === "PRE" || n.tagName === "TEXTAREA") return !0;
@@ -283,12 +296,12 @@ function ke(e, t) {
283
296
  }
284
297
  return !1;
285
298
  }
286
- function Ae(e) {
287
- let t = Te(e);
299
+ function Me(e) {
300
+ let t = Ee(e);
288
301
  if (!t) return !1;
289
302
  let n = document.createElement("hr");
290
303
  t.deleteContents();
291
- let r = Me(t.startContainer, e);
304
+ let r = Pe(t.startContainer, e);
292
305
  r && r.parentNode ? r.parentNode.insertBefore(n, r.nextSibling) : t.insertNode(n);
293
306
  let i = n.nextElementSibling;
294
307
  if (!i || i.tagName === "HR") {
@@ -302,7 +315,7 @@ function Ae(e) {
302
315
  }
303
316
  return !0;
304
317
  }
305
- var je = /* @__PURE__ */ new Set([
318
+ var Ne = /* @__PURE__ */ new Set([
306
319
  "P",
307
320
  "DIV",
308
321
  "H1",
@@ -315,10 +328,10 @@ var je = /* @__PURE__ */ new Set([
315
328
  "PRE",
316
329
  "LI"
317
330
  ]);
318
- function Me(e, t) {
331
+ function Pe(e, t) {
319
332
  let n = e.nodeType === 1 ? e : e.parentElement;
320
333
  for (; n && n !== t;) {
321
- if (je.has(n.tagName)) return n;
334
+ if (Ne.has(n.tagName)) return n;
322
335
  n = n.parentElement;
323
336
  }
324
337
  return null;
@@ -326,10 +339,10 @@ function Me(e, t) {
326
339
  //#endregion
327
340
  //#region src/js/editing/Style.js
328
341
  function D(e, t = null) {
329
- return e === "insertHTML" && De(String(t ?? "")) || e === "insertText" && Oe(String(t ?? "")) || e === "insertHorizontalRule" && Ae() ? !0 : document.execCommand(e, !1, t);
342
+ return e === "insertHTML" && Oe(String(t ?? "")) || e === "insertText" && ke(String(t ?? "")) || e === "insertLineBreak" && Ae() || e === "insertHorizontalRule" && Me() ? !0 : document.execCommand(e, !1, t);
330
343
  }
331
- var Ne = () => D("bold"), Pe = () => D("italic");
332
- function Fe() {
344
+ var Fe = () => D("bold"), Ie = () => D("italic");
345
+ function Le() {
333
346
  let e = globalThis.getSelection();
334
347
  if (!e?.rangeCount) return;
335
348
  let t = e.getRangeAt(0).commonAncestorContainer;
@@ -343,7 +356,7 @@ function Fe() {
343
356
  }
344
357
  D("underline");
345
358
  }
346
- function Ie() {
359
+ function Re() {
347
360
  let e = globalThis.getSelection();
348
361
  if (!e?.rangeCount) return;
349
362
  let t = e.getRangeAt(0).startContainer;
@@ -357,8 +370,8 @@ function Ie() {
357
370
  }
358
371
  D("strikeThrough");
359
372
  }
360
- var Le = () => D("superscript"), Re = () => D("subscript"), ze = (e) => D("foreColor", e), Be = (e) => D("hiliteColor", e), Ve = (e) => D("fontName", e);
361
- function He(e, t = document) {
373
+ var ze = () => D("superscript"), Be = () => D("subscript"), Ve = (e) => D("foreColor", e), He = (e) => D("hiliteColor", e), Ue = (e) => D("fontName", e);
374
+ function We(e, t = document) {
362
375
  let n = globalThis.getSelection(), r = !n?.rangeCount || n.getRangeAt(0).collapsed;
363
376
  if (r && n?.rangeCount > 0) {
364
377
  try {
@@ -385,21 +398,52 @@ function He(e, t = document) {
385
398
  } catch {}
386
399
  }
387
400
  }
388
- var Ue = (e) => D("formatBlock", `<${e}>`), We = () => D("justifyLeft"), Ge = () => D("justifyCenter"), Ke = () => D("justifyRight"), qe = () => D("justifyFull"), Je = () => D("indent");
389
- function Ye() {
401
+ var Ge = (e) => D("formatBlock", `<${e}>`), Ke = () => D("justifyLeft"), qe = () => D("justifyCenter"), Je = () => D("justifyRight"), Ye = () => D("justifyFull");
402
+ function Xe() {
403
+ D("indent"), pe(Ze());
404
+ }
405
+ function Ze() {
406
+ let e = globalThis.getSelection();
407
+ if (!e?.rangeCount) return null;
408
+ let t = e.getRangeAt(0).commonAncestorContainer;
409
+ t.nodeType === 3 && (t = t.parentElement);
410
+ let n = null;
411
+ for (let e = t; e; e = e.parentElement) (e.nodeName === "UL" || e.nodeName === "OL") && (n = e);
412
+ return n;
413
+ }
414
+ function Qe() {
390
415
  let e = globalThis.getSelection();
391
416
  if (e?.rangeCount) {
392
417
  let t = e.getRangeAt(0).commonAncestorContainer;
393
418
  t.nodeType === 3 && (t = t.parentElement);
394
419
  let n = t?.closest(".an-checklist li");
395
420
  if (n) {
396
- Xe(n);
421
+ et(n);
397
422
  return;
398
423
  }
399
424
  }
400
- D("outdent");
425
+ $e() || D("outdent");
401
426
  }
402
- function Xe(e) {
427
+ function $e() {
428
+ let e = globalThis.getSelection();
429
+ if (!e?.rangeCount) return !1;
430
+ let t = e.getRangeAt(0).startContainer;
431
+ t.nodeType === 3 && (t = t.parentElement);
432
+ let n = t?.closest?.("li");
433
+ if (!n) return !1;
434
+ let r = n.parentElement;
435
+ if (!r || r.nodeName !== "UL" && r.nodeName !== "OL") return !1;
436
+ let i = r.parentElement;
437
+ if (!i || i.nodeName !== "LI" || !i.parentNode) return !1;
438
+ let a = [];
439
+ for (let e = n.nextElementSibling; e; e = e.nextElementSibling) a.push(e);
440
+ if (a.length) {
441
+ let e = n.ownerDocument.createElement(r.nodeName.toLowerCase());
442
+ a.forEach((t) => e.appendChild(t)), n.appendChild(e);
443
+ }
444
+ return i.parentNode.insertBefore(n, i.nextSibling), r.children.length || r.remove(), !0;
445
+ }
446
+ function et(e) {
403
447
  let t = e.closest(".an-checklist");
404
448
  if (!t) return;
405
449
  let n = Array.from(t.children), r = n.indexOf(e), i = n.slice(r + 1), a = document.createElement("p");
@@ -416,24 +460,24 @@ function Xe(e) {
416
460
  n && (n.removeAllRanges(), n.addRange(e));
417
461
  } catch {}
418
462
  }
419
- function Ze() {
463
+ function tt() {
420
464
  let e = globalThis.getSelection();
421
465
  if (!e?.rangeCount) return null;
422
466
  let t = e.getRangeAt(0).commonAncestorContainer;
423
467
  return t.nodeType === 3 && (t = t.parentElement), t?.closest("ul, ol") || null;
424
468
  }
425
- function Qe(e) {
469
+ function nt(e) {
426
470
  e.classList.remove("an-checklist"), e.querySelectorAll("input[type=\"checkbox\"]").forEach((e) => e.remove());
427
471
  }
428
- function $e() {
429
- let e = Ze();
430
- e ? e.classList.contains("an-checklist") ? (Qe(e), e.tagName === "OL" && it(e, "ul")) : e.tagName === "OL" ? it(e, "ul") : D("insertUnorderedList") : D("insertUnorderedList");
472
+ function rt() {
473
+ let e = tt();
474
+ e ? e.classList.contains("an-checklist") ? (nt(e), e.tagName === "OL" && ct(e, "ul")) : e.tagName === "OL" ? ct(e, "ul") : D("insertUnorderedList") : D("insertUnorderedList");
431
475
  }
432
- function et() {
433
- let e = Ze();
434
- e ? e.classList.contains("an-checklist") ? (Qe(e), it(e, "ol")) : e.tagName === "UL" ? it(e, "ol") : D("insertOrderedList") : D("insertOrderedList");
476
+ function it() {
477
+ let e = tt();
478
+ e ? e.classList.contains("an-checklist") ? (nt(e), ct(e, "ol")) : e.tagName === "UL" ? ct(e, "ol") : D("insertOrderedList") : D("insertOrderedList");
435
479
  }
436
- function tt(e) {
480
+ function at(e) {
437
481
  let t = globalThis.getSelection();
438
482
  if (!t || t.rangeCount === 0) return;
439
483
  let n = t.getRangeAt(0), r = /* @__PURE__ */ new Set([
@@ -476,7 +520,7 @@ function tt(e) {
476
520
  t.style.lineHeight = e;
477
521
  });
478
522
  }
479
- function nt(e) {
523
+ function ot(e) {
480
524
  let t = globalThis.getSelection();
481
525
  if (!t?.rangeCount) return;
482
526
  let n = t.getRangeAt(0), r = n.commonAncestorContainer;
@@ -508,7 +552,7 @@ function nt(e) {
508
552
  }
509
553
  }
510
554
  }
511
- function rt() {
555
+ function st() {
512
556
  let e = globalThis.getSelection();
513
557
  if (!e?.rangeCount) return !1;
514
558
  let t = e.getRangeAt(0).startContainer;
@@ -516,13 +560,13 @@ function rt() {
516
560
  let n = t?.closest("code");
517
561
  return !!(n && !n.closest("pre"));
518
562
  }
519
- function it(e, t) {
563
+ function ct(e, t) {
520
564
  let n = document.createElement(t);
521
565
  for (let t of e.attributes) n.setAttribute(t.name, t.value);
522
566
  for (; e.firstChild;) n.appendChild(e.firstChild);
523
567
  return e.parentNode.replaceChild(n, e), n;
524
568
  }
525
- function at(e) {
569
+ function lt(e) {
526
570
  e.querySelectorAll("li").forEach((e) => {
527
571
  if (!e.querySelector("input[type=\"checkbox\"]")) {
528
572
  let t = document.createElement("input");
@@ -530,7 +574,7 @@ function at(e) {
530
574
  }
531
575
  });
532
576
  }
533
- function ot() {
577
+ function ut() {
534
578
  let e = globalThis.getSelection();
535
579
  if (!e?.rangeCount) return;
536
580
  let t = e.getRangeAt(0), n = t.commonAncestorContainer;
@@ -549,8 +593,8 @@ function ot() {
549
593
  }
550
594
  }
551
595
  } else {
552
- let t = it(r, "ul");
553
- t.classList.add("an-checklist"), at(t);
596
+ let t = ct(r, "ul");
597
+ t.classList.add("an-checklist"), lt(t);
554
598
  let n = t.querySelector("li");
555
599
  if (n) {
556
600
  let t = document.createRange();
@@ -623,7 +667,7 @@ function ot() {
623
667
  }
624
668
  }
625
669
  }
626
- function st() {
670
+ function dt() {
627
671
  let e = globalThis.getSelection();
628
672
  if (!e?.rangeCount) return !1;
629
673
  let t = e.getRangeAt(0).commonAncestorContainer;
@@ -641,24 +685,24 @@ function O(e, t, n, r, i, a) {
641
685
  isDisabled: a
642
686
  };
643
687
  }
644
- var ct = /* @__PURE__ */ new Map();
645
- function lt(e) {
688
+ var ft = /* @__PURE__ */ new Map();
689
+ function pt(e) {
646
690
  if (!e || typeof e.name != "string") {
647
691
  console.warn("[AutumnNote] registerButton: btnDef must have a string `name` property.");
648
692
  return;
649
693
  }
650
- ct.has(e.name) && console.warn(`[AutumnNote] registerButton: overwriting existing button "${e.name}".`), ct.set(e.name, e);
694
+ ft.has(e.name) && console.warn(`[AutumnNote] registerButton: overwriting existing button "${e.name}".`), ft.set(e.name, e);
651
695
  }
652
- function ut(e) {
653
- return ct.get(e);
696
+ function mt(e) {
697
+ return ft.get(e);
654
698
  }
655
- var dt = O("bold", "bold", "Bold (Ctrl+B)", () => Ne(), () => document.queryCommandState("bold")), ft = O("italic", "italic", "Italic (Ctrl+I)", () => Pe(), () => document.queryCommandState("italic")), pt = O("underline", "underline", "Underline (Ctrl+U)", () => Fe(), () => {
699
+ var ht = O("bold", "bold", "Bold (Ctrl+B)", () => Fe(), () => document.queryCommandState("bold")), gt = O("italic", "italic", "Italic (Ctrl+I)", () => Ie(), () => document.queryCommandState("italic")), _t = O("underline", "underline", "Underline (Ctrl+U)", () => Le(), () => {
656
700
  if (document.queryCommandState("underline")) return !0;
657
701
  let e = globalThis.getSelection();
658
702
  if (!e?.rangeCount) return !1;
659
703
  let t = e.getRangeAt(0).startContainer;
660
704
  return t.nodeType === 3 && (t = t.parentElement), !!t?.closest("u");
661
- }), mt = O("strikethrough", "strikethrough", "Strikethrough", () => Ie(), () => document.queryCommandState("strikeThrough")), ht = O("superscript", "superscript", "Superscript", () => Le(), () => document.queryCommandState("superscript")), gt = O("subscript", "subscript", "Subscript", () => Re(), () => document.queryCommandState("subscript")), _t = O("alignLeft", "align-left", "Align Left", () => We()), vt = O("alignCenter", "align-center", "Align Center", () => Ge()), yt = O("alignRight", "align-right", "Align Right", () => Ke()), bt = O("alignJustify", "align-justify", "Justify", () => qe()), xt = O("ul", "list-ul", "Unordered List", () => $e()), St = O("ol", "list-ol", "Ordered List", () => et()), Ct = O("indent", "indent", "Indent", () => Je()), wt = O("outdent", "outdent", "Outdent", () => Ye()), Tt = O("undo", "undo", "Undo (Ctrl+Z)", (e) => e.invoke("editor.undo"), void 0, (e) => !e.invoke("editor.canUndo")), Et = O("redo", "redo", "Redo (Ctrl+Y)", (e) => e.invoke("editor.redo"), void 0, (e) => !e.invoke("editor.canRedo")), Dt = O("hr", "minus", "Horizontal Rule", () => D("insertHorizontalRule")), Ot = O("link", "link", "Insert Link", (e) => e.invoke("linkDialog.show")), kt = O("image", "image", "Insert Image", (e) => e.invoke("imageDialog.show")), At = O("video", "video", "Insert Video", (e) => e.invoke("videoDialog.show")), jt = O("emoji", "emoji", "Insert Emoji", (e) => e.invoke("emojiDialog.show")), Mt = O("icon", "icon", "Insert FA Icon", (e) => e.invoke("iconDialog.show")), Nt = {
705
+ }), vt = O("strikethrough", "strikethrough", "Strikethrough", () => Re(), () => document.queryCommandState("strikeThrough")), yt = O("superscript", "superscript", "Superscript", () => ze(), () => document.queryCommandState("superscript")), bt = O("subscript", "subscript", "Subscript", () => Be(), () => document.queryCommandState("subscript")), xt = O("alignLeft", "align-left", "Align Left", () => Ke()), St = O("alignCenter", "align-center", "Align Center", () => qe()), Ct = O("alignRight", "align-right", "Align Right", () => Je()), wt = O("alignJustify", "align-justify", "Justify", () => Ye()), Tt = O("ul", "list-ul", "Unordered List", () => rt()), Et = O("ol", "list-ol", "Ordered List", () => it()), Dt = O("indent", "indent", "Indent", () => Xe()), Ot = O("outdent", "outdent", "Outdent", () => Qe()), kt = O("undo", "undo", "Undo (Ctrl+Z)", (e) => e.invoke("editor.undo"), void 0, (e) => !e.invoke("editor.canUndo")), At = O("redo", "redo", "Redo (Ctrl+Y)", (e) => e.invoke("editor.redo"), void 0, (e) => !e.invoke("editor.canRedo")), jt = O("hr", "minus", "Horizontal Rule", () => D("insertHorizontalRule")), Mt = O("link", "link", "Insert Link", (e) => e.invoke("linkDialog.show")), Nt = O("image", "image", "Insert Image", (e) => e.invoke("imageDialog.show")), Pt = O("video", "video", "Insert Video", (e) => e.invoke("videoDialog.show")), Ft = O("emoji", "emoji", "Insert Emoji", (e) => e.invoke("emojiDialog.show")), It = O("icon", "icon", "Insert FA Icon", (e) => e.invoke("iconDialog.show")), Lt = {
662
706
  name: "table",
663
707
  type: "grid",
664
708
  icon: "table",
@@ -666,7 +710,7 @@ var dt = O("bold", "bold", "Bold (Ctrl+B)", () => Ne(), () => document.queryComm
666
710
  action: (e, t, n) => {
667
711
  e.invoke("editor.insertTable", n, t), e.invoke("editor.afterCommand");
668
712
  }
669
- }, Pt = {
713
+ }, Rt = {
670
714
  name: "fontSize",
671
715
  type: "select",
672
716
  tooltip: "Font Size",
@@ -689,7 +733,7 @@ var dt = O("bold", "bold", "Bold (Ctrl+B)", () => Ne(), () => document.queryComm
689
733
  "48px",
690
734
  "72px"
691
735
  ],
692
- action: (e, t) => He(t, e.layoutInfo.editable),
736
+ action: (e, t) => We(t, e.layoutInfo.editable),
693
737
  getValue: (e) => {
694
738
  try {
695
739
  let t = globalThis.getSelection();
@@ -705,14 +749,14 @@ var dt = O("bold", "bold", "Bold (Ctrl+B)", () => Ne(), () => document.queryComm
705
749
  return "";
706
750
  }
707
751
  }
708
- }, Ft = O("removeFormat", "remove-format", "Remove Format", () => D("removeFormat")), It = O("direction", "direction", "Toggle Text Direction (LTR / RTL)", (e) => {
752
+ }, zt = O("removeFormat", "remove-format", "Remove Format", () => D("removeFormat")), Bt = O("direction", "direction", "Toggle Text Direction (LTR / RTL)", (e) => {
709
753
  let t = e.layoutInfo.editable, n = (t.getAttribute("dir") || "ltr") === "ltr" ? "rtl" : "ltr";
710
754
  t.setAttribute("dir", n), t.style.textAlign = n === "rtl" ? "right" : "left", e.invoke("editor.afterCommand");
711
- }), Lt = {
755
+ }), Vt = {
712
756
  name: "fontFamily",
713
757
  type: "select",
714
758
  tooltip: "Font Family",
715
- action: (e, t) => Ve(t),
759
+ action: (e, t) => Ue(t),
716
760
  getValue: () => {
717
761
  try {
718
762
  return document.queryCommandValue("fontName") || "";
@@ -720,7 +764,7 @@ var dt = O("bold", "bold", "Bold (Ctrl+B)", () => Ne(), () => document.queryComm
720
764
  return "";
721
765
  }
722
766
  }
723
- }, Rt = {
767
+ }, Ht = {
724
768
  name: "paragraphStyle",
725
769
  type: "select",
726
770
  tooltip: "Paragraph Style",
@@ -764,7 +808,7 @@ var dt = O("bold", "bold", "Bold (Ctrl+B)", () => Ne(), () => document.queryComm
764
808
  label: "Code"
765
809
  }
766
810
  ],
767
- action: (e, t) => Ue(t),
811
+ action: (e, t) => Ge(t),
768
812
  getValue: () => {
769
813
  try {
770
814
  let e = document.queryCommandValue("formatBlock").toLowerCase().replace(/[<>]/g, "");
@@ -773,7 +817,7 @@ var dt = O("bold", "bold", "Bold (Ctrl+B)", () => Ne(), () => document.queryComm
773
817
  return "";
774
818
  }
775
819
  }
776
- }, zt = {
820
+ }, Ut = {
777
821
  name: "lineHeight",
778
822
  type: "select",
779
823
  tooltip: "Line Height",
@@ -788,7 +832,7 @@ var dt = O("bold", "bold", "Bold (Ctrl+B)", () => Ne(), () => document.queryComm
788
832
  "2.5",
789
833
  "3.0"
790
834
  ],
791
- action: (e, t) => tt(t),
835
+ action: (e, t) => at(t),
792
836
  getValue: () => {
793
837
  try {
794
838
  let e = globalThis.getSelection();
@@ -814,108 +858,108 @@ var dt = O("bold", "bold", "Bold (Ctrl+B)", () => Ne(), () => document.queryComm
814
858
  return "";
815
859
  }
816
860
  }
817
- }, Bt = O("codeview", "code", "HTML Code View", (e) => e.invoke("codeview.toggle"), (e) => e.invoke("codeview.isActive")), Vt = O("fullscreen", "expand", "Fullscreen", (e) => e.invoke("fullscreen.toggle"), (e) => e.invoke("fullscreen.isActive")), Ht = O("shortcuts", "keyboard", "Keyboard Shortcuts (Ctrl+Shift+/)", (e) => e.invoke("shortcutsDialog.show")), Ut = O("find", "search", "Find (Ctrl+F)", (e) => e.invoke("findReplace.show", "find")), Wt = O("findReplace", "find-replace", "Find & Replace (Ctrl+H)", (e) => e.invoke("findReplace.show", "replace")), Gt = O("inlineCode", "inline-code", "Inline Code (Ctrl+`)", (e) => e.invoke("editor.inlineCode"), () => rt()), Kt = O("checklist", "checklist", "Checklist", (e) => e.invoke("editor.toggleChecklist"), () => st()), qt = O("print", "print", "Print", (e) => e.invoke("editor.print")), Jt = {
861
+ }, Wt = O("codeview", "code", "HTML Code View", (e) => e.invoke("codeview.toggle"), (e) => e.invoke("codeview.isActive")), Gt = O("fullscreen", "expand", "Fullscreen", (e) => e.invoke("fullscreen.toggle"), (e) => e.invoke("fullscreen.isActive")), Kt = O("shortcuts", "keyboard", "Keyboard Shortcuts (Ctrl+Shift+/)", (e) => e.invoke("shortcutsDialog.show")), qt = O("find", "search", "Find (Ctrl+F)", (e) => e.invoke("findReplace.show", "find")), Jt = O("findReplace", "find-replace", "Find & Replace (Ctrl+H)", (e) => e.invoke("findReplace.show", "replace")), Yt = O("inlineCode", "inline-code", "Inline Code (Ctrl+`)", (e) => e.invoke("editor.inlineCode"), () => st()), Xt = O("checklist", "checklist", "Checklist", (e) => e.invoke("editor.toggleChecklist"), () => dt()), Zt = O("print", "print", "Print", (e) => e.invoke("editor.print")), Qt = {
818
862
  name: "foreColor",
819
863
  type: "colorpicker",
820
864
  icon: "foreColor",
821
865
  tooltip: "Text Color",
822
866
  defaultColor: "#e11d48",
823
- action: (e, t) => ze(t)
824
- }, Yt = {
867
+ action: (e, t) => Ve(t)
868
+ }, $t = {
825
869
  name: "backColor",
826
870
  type: "colorpicker",
827
871
  icon: "backColor",
828
872
  tooltip: "Highlight Color",
829
873
  defaultColor: "#fbbf24",
830
- action: (e, t) => Be(t)
831
- }, Xt = [
874
+ action: (e, t) => He(t)
875
+ }, en = [
832
876
  [
877
+ Ht,
878
+ Vt,
833
879
  Rt,
834
- Lt,
835
- Pt,
836
- zt
880
+ Ut
837
881
  ],
838
- [Tt, Et],
839
- [
840
- dt,
841
- ft,
842
- pt,
843
- mt,
844
- Gt
845
- ],
846
- [ht, gt],
847
- [Jt, Yt],
882
+ [kt, At],
848
883
  [
884
+ ht,
885
+ gt,
849
886
  _t,
850
887
  vt,
851
- yt,
852
- bt
888
+ Yt
853
889
  ],
890
+ [yt, bt],
891
+ [Qt, $t],
854
892
  [
855
893
  xt,
856
894
  St,
857
- Kt,
858
895
  Ct,
859
896
  wt
860
897
  ],
861
898
  [
899
+ Tt,
900
+ Et,
901
+ Xt,
862
902
  Dt,
863
- Ot,
864
- kt,
865
- At,
866
- Nt,
867
- jt,
868
- Mt
903
+ Ot
869
904
  ],
870
905
  [
906
+ jt,
907
+ Mt,
908
+ Nt,
909
+ Pt,
910
+ Lt,
871
911
  Ft,
872
- Bt,
873
- Vt,
874
- Ut,
912
+ It
913
+ ],
914
+ [
915
+ zt,
916
+ Wt,
917
+ Gt,
875
918
  qt,
876
- Ht
919
+ Zt,
920
+ Kt
877
921
  ]
878
- ], Zt = {
879
- boldBtn: dt,
880
- italicBtn: ft,
881
- underlineBtn: pt,
882
- strikeBtn: mt,
883
- superscriptBtn: ht,
884
- subscriptBtn: gt,
885
- alignLeftBtn: _t,
886
- alignCenterBtn: vt,
887
- alignRightBtn: yt,
888
- alignJustifyBtn: bt,
889
- ulBtn: xt,
890
- olBtn: St,
891
- indentBtn: Ct,
892
- outdentBtn: wt,
893
- undoBtn: Tt,
894
- redoBtn: Et,
895
- hrBtn: Dt,
896
- linkBtn: Ot,
897
- imageBtn: kt,
898
- videoBtn: At,
899
- emojiBtn: jt,
900
- iconBtn: Mt,
901
- tableBtn: Nt,
902
- fontSizeBtn: Pt,
903
- removeFormatBtn: Ft,
904
- directionBtn: It,
905
- fontFamilyBtn: Lt,
906
- paragraphStyleBtn: Rt,
907
- lineHeightBtn: zt,
908
- codeviewBtn: Bt,
909
- fullscreenBtn: Vt,
910
- shortcutsBtn: Ht,
911
- findBtn: Ut,
912
- findReplaceBtn: Wt,
913
- inlineCodeBtn: Gt,
914
- checklistBtn: Kt,
915
- printBtn: qt,
916
- foreColorBtn: Jt,
917
- backColorBtn: Yt,
918
- defaultToolbar: Xt
922
+ ], tn = {
923
+ boldBtn: ht,
924
+ italicBtn: gt,
925
+ underlineBtn: _t,
926
+ strikeBtn: vt,
927
+ superscriptBtn: yt,
928
+ subscriptBtn: bt,
929
+ alignLeftBtn: xt,
930
+ alignCenterBtn: St,
931
+ alignRightBtn: Ct,
932
+ alignJustifyBtn: wt,
933
+ ulBtn: Tt,
934
+ olBtn: Et,
935
+ indentBtn: Dt,
936
+ outdentBtn: Ot,
937
+ undoBtn: kt,
938
+ redoBtn: At,
939
+ hrBtn: jt,
940
+ linkBtn: Mt,
941
+ imageBtn: Nt,
942
+ videoBtn: Pt,
943
+ emojiBtn: Ft,
944
+ iconBtn: It,
945
+ tableBtn: Lt,
946
+ fontSizeBtn: Rt,
947
+ removeFormatBtn: zt,
948
+ directionBtn: Bt,
949
+ fontFamilyBtn: Vt,
950
+ paragraphStyleBtn: Ht,
951
+ lineHeightBtn: Ut,
952
+ codeviewBtn: Wt,
953
+ fullscreenBtn: Gt,
954
+ shortcutsBtn: Kt,
955
+ findBtn: qt,
956
+ findReplaceBtn: Jt,
957
+ inlineCodeBtn: Yt,
958
+ checklistBtn: Xt,
959
+ printBtn: Zt,
960
+ foreColorBtn: Qt,
961
+ backColorBtn: $t,
962
+ defaultToolbar: en
919
963
  }, k = {
920
964
  placeholder: "",
921
965
  height: 200,
@@ -923,7 +967,7 @@ var dt = O("bold", "bold", "Bold (Ctrl+B)", () => Ne(), () => document.queryComm
923
967
  maxHeight: 0,
924
968
  focus: !1,
925
969
  resizable: !0,
926
- toolbar: Xt,
970
+ toolbar: en,
927
971
  useBootstrap: !1,
928
972
  toolbarButtonClass: "btn btn-sm btn-light",
929
973
  useFontAwesome: !0,
@@ -947,6 +991,9 @@ var dt = O("bold", "bold", "Bold (Ctrl+B)", () => Ne(), () => document.queryComm
947
991
  theme: "light",
948
992
  codeHighlight: !0,
949
993
  codeHighlightCDN: "https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0",
994
+ cspNonce: "",
995
+ externalAssetCrossOrigin: "anonymous",
996
+ externalAssetReferrerPolicy: "no-referrer",
950
997
  markdownPaste: !0,
951
998
  historyLimit: 100,
952
999
  historyMaxBytes: 10 * 1024 * 1024,
@@ -1374,23 +1421,23 @@ var dt = O("bold", "bold", "Bold (Ctrl+B)", () => Ne(), () => document.queryComm
1374
1421
  table: "Table",
1375
1422
  image: "Image"
1376
1423
  }
1377
- }, Qt = { en: A };
1378
- function $t(e, t) {
1424
+ }, nn = { en: A };
1425
+ function rn(e, t) {
1379
1426
  if (typeof e != "string" || !e) throw TypeError("[AutumnNote] registerLocale: code must be a non-empty string.");
1380
1427
  if (!t || typeof t != "object") throw TypeError(`[AutumnNote] registerLocale: locale for "${e}" must be an object.`);
1381
- Qt[e] = t;
1428
+ nn[e] = t;
1382
1429
  }
1383
- function en(e) {
1430
+ function an(e) {
1384
1431
  if (!e || e === "en") return A;
1385
1432
  if (typeof e == "string") {
1386
- let t = Qt[e];
1433
+ let t = nn[e];
1387
1434
  return t ? c(c({}, A), t) : (console.warn(`[AutumnNote] Locale "${e}" is not registered, falling back to English. Import it first: import { ${e} } from 'autumnnote/i18n/${e}'; AutumnNote.registerLocale('${e}', ${e});`), A);
1388
1435
  }
1389
1436
  return typeof e == "object" ? c(c({}, A), e) : A;
1390
1437
  }
1391
1438
  //#endregion
1392
1439
  //#region src/js/core/sanitise.js
1393
- var tn = [
1440
+ var on = [
1394
1441
  "script",
1395
1442
  "style",
1396
1443
  "iframe",
@@ -1413,7 +1460,7 @@ var tn = [
1413
1460
  "mglyph",
1414
1461
  "malignmark",
1415
1462
  "annotation-xml"
1416
- ], nn = /* @__PURE__ */ new Set(["button"]), rn = [
1463
+ ], sn = /* @__PURE__ */ new Set(["button"]), cn = [
1417
1464
  "href",
1418
1465
  "src",
1419
1466
  "action",
@@ -1422,11 +1469,11 @@ var tn = [
1422
1469
  "poster",
1423
1470
  "background",
1424
1471
  "srcset"
1425
- ], an = /* @__PURE__ */ new Set([
1472
+ ], ln = /* @__PURE__ */ new Set([
1426
1473
  "poster",
1427
1474
  "background",
1428
1475
  "srcset"
1429
- ]), on = /* @__PURE__ */ new Set(["ping"]), sn = /* @__PURE__ */ new Set([
1476
+ ]), un = /* @__PURE__ */ new Set(["ping"]), dn = /* @__PURE__ */ new Set([
1430
1477
  "color",
1431
1478
  "background-color",
1432
1479
  "font-size",
@@ -1442,28 +1489,31 @@ var tn = [
1442
1489
  "border-color",
1443
1490
  "padding",
1444
1491
  "white-space"
1445
- ]), cn = /url\s*\(|image-set\s*\(|src\s*\(|expression\s*\(|@import|javascript:|vbscript:|behavior\s*:|-moz-binding/i, ln = /* @__PURE__ */ new Set([
1492
+ ]), fn = /url\s*\(|image-set\s*\(|src\s*\(|expression\s*\(|@import|javascript:|vbscript:|behavior\s*:|-moz-binding/i, pn = /* @__PURE__ */ new Set([
1446
1493
  "www.youtube.com",
1447
1494
  "youtube.com",
1448
1495
  "m.youtube.com",
1449
1496
  "www.youtube-nocookie.com",
1450
1497
  "youtube-nocookie.com",
1451
1498
  "player.vimeo.com"
1452
- ]), un = /* @__PURE__ */ new Set([
1499
+ ]), mn = /* @__PURE__ */ new Set([
1453
1500
  "http:",
1454
1501
  "https:",
1455
1502
  "mailto:",
1456
1503
  "tel:"
1457
- ]), dn = /* @__PURE__ */ new Set([
1504
+ ]), hn = /* @__PURE__ */ new Set([
1458
1505
  "http:",
1459
1506
  "https:",
1460
1507
  "blob:"
1461
- ]), fn = /^data:image\/(?:png|jpe?g|gif|webp|avif|bmp);base64,[a-z0-9+/=\s]+$/i, pn = "https://autumnnote.invalid/";
1462
- function j(e, { allowIframes: t = !1 } = {}) {
1463
- let n = new DOMParser().parseFromString(`<body>${e || ""}</body>`, "text/html"), r = Array.from(n.querySelectorAll("*")), i = new Set(t ? tn.filter((e) => e !== "iframe") : tn);
1508
+ ]), gn = /^data:image\/(?:png|jpe?g|gif|webp|avif|bmp);base64,[a-z0-9+/=\s]+$/i, _n = "https://autumnnote.invalid/";
1509
+ function j(e, t) {
1510
+ return vn(e, t).innerHTML;
1511
+ }
1512
+ function vn(e, { allowIframes: t = !1 } = {}) {
1513
+ let n = new DOMParser().parseFromString(`<body>${e || ""}</body>`, "text/html"), r = Array.from(n.querySelectorAll("*")), i = new Set(t ? on.filter((e) => e !== "iframe") : on);
1464
1514
  for (let e of r) {
1465
1515
  let t = e.tagName.toLowerCase();
1466
- if (nn.has(t)) {
1516
+ if (sn.has(t)) {
1467
1517
  e.replaceWith(...e.childNodes);
1468
1518
  continue;
1469
1519
  }
@@ -1473,7 +1523,7 @@ function j(e, { allowIframes: t = !1 } = {}) {
1473
1523
  }
1474
1524
  if (t === "iframe") {
1475
1525
  let t = e.getAttribute("src");
1476
- if (!t || !gn(t)) {
1526
+ if (!t || !xn(t)) {
1477
1527
  e.remove();
1478
1528
  continue;
1479
1529
  }
@@ -1484,22 +1534,22 @@ function j(e, { allowIframes: t = !1 } = {}) {
1484
1534
  continue;
1485
1535
  }
1486
1536
  if (t.name === "style") {
1487
- let n = mn(t.value);
1537
+ let n = yn(t.value);
1488
1538
  n ? e.setAttribute("style", n) : e.removeAttribute("style");
1489
1539
  continue;
1490
1540
  }
1491
- if (on.has(t.name)) {
1541
+ if (un.has(t.name)) {
1492
1542
  e.removeAttribute(t.name);
1493
1543
  continue;
1494
1544
  }
1495
- if (rn.includes(t.name)) {
1496
- let n = t.value.trim(), r = an.has(t.name) || t.name === "src" && [
1545
+ if (cn.includes(t.name)) {
1546
+ let n = t.value.trim(), r = ln.has(t.name) || t.name === "src" && [
1497
1547
  "IMG",
1498
1548
  "VIDEO",
1499
1549
  "AUDIO",
1500
1550
  "SOURCE"
1501
1551
  ].includes(e.tagName), i = e.tagName === "IMG";
1502
- if (!(t.name === "srcset" ? hn(n, { allowData: i }) : _n(n, {
1552
+ if (!(t.name === "srcset" ? bn(n, { allowData: i }) : Sn(n, {
1503
1553
  media: r,
1504
1554
  allowData: i
1505
1555
  }))) {
@@ -1512,7 +1562,7 @@ function j(e, { allowIframes: t = !1 } = {}) {
1512
1562
  e.removeAttribute(t.name);
1513
1563
  continue;
1514
1564
  }
1515
- t.name === "src" && !gn(t.value) && e.removeAttribute(t.name);
1565
+ t.name === "src" && !xn(t.value) && e.removeAttribute(t.name);
1516
1566
  }
1517
1567
  }
1518
1568
  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();
@@ -1522,60 +1572,60 @@ function j(e, { allowIframes: t = !1 } = {}) {
1522
1572
  "contenteditable"
1523
1573
  ].includes(t.name) || e.removeAttribute(t.name);
1524
1574
  }
1525
- return n.body.innerHTML;
1575
+ return n.body;
1526
1576
  }
1527
- function mn(e) {
1577
+ function yn(e) {
1528
1578
  let t = [];
1529
1579
  for (let n of (e || "").split(";")) {
1530
1580
  let e = n.indexOf(":");
1531
1581
  if (e === -1) continue;
1532
1582
  let r = n.slice(0, e).trim().toLowerCase(), i = n.slice(e + 1).trim();
1533
- !r || !i || sn.has(r) && (cn.test(i) || t.push(`${r}: ${i}`));
1583
+ !r || !i || dn.has(r) && (fn.test(i) || t.push(`${r}: ${i}`));
1534
1584
  }
1535
1585
  return t.join("; ");
1536
1586
  }
1537
- function hn(e, { allowData: t = !1 } = {}) {
1587
+ function bn(e, { allowData: t = !1 } = {}) {
1538
1588
  let n = (e || "").trim().split(/\s+/).filter(Boolean);
1539
1589
  for (let e of n) {
1540
1590
  if (/^[\d.]+[xw],?$/i.test(e)) continue;
1541
1591
  let n = e.replace(/,+$/, "");
1542
- if (n && !_n(n, {
1592
+ if (n && !Sn(n, {
1543
1593
  media: !0,
1544
1594
  allowData: t
1545
1595
  })) return !1;
1546
1596
  }
1547
1597
  return !0;
1548
1598
  }
1549
- function gn(e) {
1599
+ function xn(e) {
1550
1600
  let t = (e || "").trim();
1551
1601
  if (!t || t.startsWith("//") || t.startsWith("/")) return !1;
1552
1602
  try {
1553
1603
  let e = new URL(t);
1554
- return e.protocol === "https:" && ln.has(e.hostname.toLowerCase());
1604
+ return e.protocol === "https:" && pn.has(e.hostname.toLowerCase());
1555
1605
  } catch {
1556
1606
  return !1;
1557
1607
  }
1558
1608
  }
1559
1609
  function M(e, { allowData: t = !1, media: n = t } = {}) {
1560
1610
  let r = (e || "").trim();
1561
- return !r && e == null ? null : _n(r, {
1611
+ return !r && e == null ? null : Sn(r, {
1562
1612
  media: n,
1563
1613
  allowData: t
1564
1614
  }) ? e : null;
1565
1615
  }
1566
- function _n(e, { media: t = !1, allowData: n = !1 } = {}) {
1616
+ function Sn(e, { media: t = !1, allowData: n = !1 } = {}) {
1567
1617
  let r = (e || "").trim();
1568
- if (!r || n && fn.test(r)) return !0;
1618
+ if (!r || n && gn.test(r)) return !0;
1569
1619
  try {
1570
- let e = new URL(r, pn);
1571
- return (t ? dn : un).has(e.protocol);
1620
+ let e = new URL(r, _n);
1621
+ return (t ? hn : mn).has(e.protocol);
1572
1622
  } catch {
1573
1623
  return !1;
1574
1624
  }
1575
1625
  }
1576
1626
  //#endregion
1577
1627
  //#region src/js/renderer.js
1578
- function vn(e, t) {
1628
+ function Cn(e, t) {
1579
1629
  let n = w("div", { class: "an-container" }), r = w("div", {
1580
1630
  class: "an-editable",
1581
1631
  contenteditable: t.readOnly ? "false" : "true",
@@ -1598,16 +1648,16 @@ function vn(e, t) {
1598
1648
  }
1599
1649
  //#endregion
1600
1650
  //#region src/js/Context.js
1601
- var yn = /* @__PURE__ */ new Map(), bn = [];
1602
- function xn(e) {
1603
- bn = Array.isArray(e) ? e : [];
1651
+ var wn = /* @__PURE__ */ new Map(), Tn = [];
1652
+ function En(e) {
1653
+ Tn = Array.isArray(e) ? e : [];
1604
1654
  }
1605
- var Sn = /* @__PURE__ */ new Map(), Cn = class {
1655
+ var Dn = /* @__PURE__ */ new Map(), On = class {
1606
1656
  constructor(e, t = {}) {
1607
- this.targetEl = e, this.options = c(k, t), this.locale = en(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;
1657
+ this.targetEl = e, this.options = c(k, t), this.locale = an(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, this._releaseInstance = null;
1608
1658
  }
1609
1659
  initialize() {
1610
- let { container: e, editable: t } = vn(this.targetEl, this.options);
1660
+ let { container: e, editable: t } = Cn(this.targetEl, this.options);
1611
1661
  this.layoutInfo.container = e, this.layoutInfo.editable = t, this._registerModules();
1612
1662
  let n = this._modules.get("toolbar");
1613
1663
  n?.el && (e.insertBefore(n.el, t), this.layoutInfo.toolbar = n.el);
@@ -1619,11 +1669,11 @@ var Sn = /* @__PURE__ */ new Map(), Cn = class {
1619
1669
  let n = new t(this);
1620
1670
  this._modules.set(e, n), n.initialize();
1621
1671
  };
1622
- for (let { name: t, Class: n, enabled: r } of bn) typeof r == "function" && !r(this.options) || e(t, n);
1623
- if (yn.size > 0) for (let [t, n] of yn) e(t, n);
1672
+ for (let { name: t, Class: n, enabled: r } of Tn) typeof r == "function" && !r(this.options) || e(t, n);
1673
+ if (wn.size > 0) for (let [t, n] of wn) e(t, n);
1624
1674
  }
1625
1675
  _syncOptionalModules() {
1626
- for (let { name: e, Class: t, enabled: n } of bn) {
1676
+ for (let { name: e, Class: t, enabled: n } of Tn) {
1627
1677
  if (typeof n != "function") continue;
1628
1678
  let r = n(this.options);
1629
1679
  if (r !== this._modules.has(e)) if (r) {
@@ -1646,7 +1696,7 @@ var Sn = /* @__PURE__ */ new Map(), Cn = class {
1646
1696
  return n >= 0 ? t[n] = e : t.push(e), this.invoke("slashMenu.refresh"), this;
1647
1697
  }
1648
1698
  use(e, t = {}) {
1649
- return Array.isArray(e.buttons) && e.buttons.forEach((e) => lt(e)), this._installPlugin(e, t), this;
1699
+ return Array.isArray(e.buttons) && e.buttons.forEach((e) => pt(e)), this._installPlugin(e, t), this;
1650
1700
  }
1651
1701
  getPlugin(e) {
1652
1702
  return this._plugins.get(e)?.publicApi ?? null;
@@ -1668,7 +1718,7 @@ var Sn = /* @__PURE__ */ new Map(), Cn = class {
1668
1718
  });
1669
1719
  }
1670
1720
  _applyGlobalPlugins() {
1671
- if (Sn.size !== 0) for (let { plugin: e, options: t } of Sn.values()) this._installPlugin(e, t);
1721
+ if (Dn.size !== 0) for (let { plugin: e, options: t } of Dn.values()) this._installPlugin(e, t);
1672
1722
  }
1673
1723
  _bindEditorEvents(e) {
1674
1724
  let t = E(e, "input", () => this._syncToTarget()), n = E(e, "focus", () => {
@@ -1914,14 +1964,22 @@ var Sn = /* @__PURE__ */ new Map(), Cn = class {
1914
1964
  } catch {}
1915
1965
  this._plugins.clear(), this._disposers.forEach((e) => e()), this._disposers = [];
1916
1966
  let t = this.layoutInfo.container, n = t?.classList.contains("an-theme-dark"), r = t?.classList.contains("an-theme-auto");
1917
- return t?.parentNode && (this.targetEl.style.display = "", t.remove()), n && !document.querySelector(".an-container.an-theme-dark") && document.body.classList.remove("an-theme-dark"), r && !document.querySelector(".an-container.an-theme-auto") && document.body.classList.remove("an-theme-auto"), typeof this.options.onDestroy == "function" && this.options.onDestroy(this), this._alive = !1, this._destroyPromise = Promise.resolve(e).then(() => {
1967
+ return t?.parentNode && (this.targetEl.style.display = "", t.remove()), n && !document.querySelector(".an-container.an-theme-dark") && document.body.classList.remove("an-theme-dark"), r && !document.querySelector(".an-container.an-theme-auto") && document.body.classList.remove("an-theme-auto"), typeof this.options.onDestroy == "function" && this.options.onDestroy(this), this._alive = !1, this._releaseInstance?.(), this._releaseInstance = null, this._destroyPromise = Promise.resolve(e).then(() => {
1918
1968
  this._listeners.clear();
1919
1969
  }), this._destroyPromise;
1920
1970
  }
1921
1971
  _syncToTarget(e) {
1922
1972
  (this.targetEl.tagName === "TEXTAREA" || this.targetEl.tagName === "INPUT") && (this.targetEl.value = typeof e == "string" ? e : this.getHTML());
1923
1973
  }
1924
- }, wn = class {
1974
+ };
1975
+ //#endregion
1976
+ //#region src/js/editing/History.js
1977
+ function kn(e, t) {
1978
+ let n = Math.min(e.length, t.length), r = 0;
1979
+ for (; r < n && e.charCodeAt(r) === t.charCodeAt(r);) r++;
1980
+ return r;
1981
+ }
1982
+ var An = class {
1925
1983
  constructor(e, t = 100, n = 10 * 1024 * 1024) {
1926
1984
  this.editable = e, this._limit = t, this._maxBytes = n, this._bytes = 0, this.stack = [], this.stackOffset = -1, this._savePoint();
1927
1985
  }
@@ -1943,12 +2001,12 @@ var Sn = /* @__PURE__ */ new Map(), Cn = class {
1943
2001
  } : null;
1944
2002
  }
1945
2003
  _charOffset(e, t) {
1946
- let n = 0, r = document.createTreeWalker(this.editable, NodeFilter.SHOW_TEXT, null), i;
1947
- for (; i = r.nextNode();) {
1948
- if (i === e) return n + t;
1949
- n += i.length;
2004
+ try {
2005
+ let n = document.createRange();
2006
+ return n.selectNodeContents(this.editable), n.setEnd(e, t), n.toString().length;
2007
+ } catch {
2008
+ return 0;
1950
2009
  }
1951
- return 0;
1952
2010
  }
1953
2011
  _restoreSelection(e) {
1954
2012
  if (!e) return;
@@ -1995,7 +2053,18 @@ var Sn = /* @__PURE__ */ new Map(), Cn = class {
1995
2053
  this.stackOffset = this.stack.length - 1;
1996
2054
  }
1997
2055
  _restore(e) {
1998
- e && (this.editable.innerHTML = this._detokenizeImages(e), this._restoreSelection(e.sel));
2056
+ if (!e) return;
2057
+ let t = this.editable.textContent || "";
2058
+ this.editable.innerHTML = this._detokenizeImages(e);
2059
+ let n = e.sel;
2060
+ if (!n) {
2061
+ let e = kn(t, this.editable.textContent || "");
2062
+ n = {
2063
+ start: e,
2064
+ end: e
2065
+ };
2066
+ }
2067
+ this._restoreSelection(n);
1999
2068
  }
2000
2069
  _tokenizeImages(e) {
2001
2070
  if (!e.includes("data:")) return {
@@ -2042,7 +2111,7 @@ var Sn = /* @__PURE__ */ new Map(), Cn = class {
2042
2111
  };
2043
2112
  //#endregion
2044
2113
  //#region src/js/editing/Table.js
2045
- function Tn(e, t, n = {}) {
2114
+ function jn(e, t, n = {}) {
2046
2115
  let { headerRow: r = !1 } = n, i = w("table", { class: "an-table" });
2047
2116
  if (r && t > 0) {
2048
2117
  let t = w("thead"), n = w("tr");
@@ -2064,9 +2133,9 @@ function Tn(e, t, n = {}) {
2064
2133
  }
2065
2134
  return i;
2066
2135
  }
2067
- function En(e, t, n = {}) {
2136
+ function Mn(e, t, n = {}) {
2068
2137
  if (e <= 0 || t <= 0) return;
2069
- let r = Tn(e, t, n), i = globalThis.getSelection();
2138
+ let r = jn(e, t, n), i = globalThis.getSelection();
2070
2139
  if (!i || i.rangeCount === 0) return;
2071
2140
  let a = i.getRangeAt(0);
2072
2141
  try {
@@ -2154,8 +2223,28 @@ function F(e, t) {
2154
2223
  }
2155
2224
  //#endregion
2156
2225
  //#region src/js/editing/Typing.js
2157
- var Dn = /\bfa-/, I = (e) => !!(e?.nodeName === "I" && Dn.test(e.className || "")), On = (e) => e?.nodeType === Node.TEXT_NODE && (e.textContent === "​" || e.textContent === "");
2158
- function kn(e, t) {
2226
+ var Nn = /\bfa-/, I = (e) => !!(e?.nodeName === "I" && Nn.test(e.className || "")), Pn = (e) => e?.nodeType === Node.TEXT_NODE && (e.textContent === "​" || e.textContent === "");
2227
+ function Fn(e, t, n) {
2228
+ let r = (e?.nodeType === Node.ELEMENT_NODE ? e : e?.parentElement ?? null)?.closest("td, th") ?? null;
2229
+ if (!r || !t.contains(r)) return !1;
2230
+ let i = r.closest("table");
2231
+ if (!i || !t.contains(i)) return !1;
2232
+ let a = Array.from(i.querySelectorAll("td, th")), o = a[a.indexOf(r) + (n ? -1 : 1)];
2233
+ if (o) return fe(o), !0;
2234
+ if (n) return !0;
2235
+ let s = In(r.closest("tr"))?.firstElementChild ?? null;
2236
+ return s && fe(s), !0;
2237
+ }
2238
+ function In(e) {
2239
+ if (!e?.parentNode) return null;
2240
+ let t = document.createElement("tr");
2241
+ for (let n of e.cells) {
2242
+ let e = document.createElement("td");
2243
+ e.appendChild(document.createElement("br")), n.hasAttribute("style") && e.setAttribute("style", n.getAttribute("style")), t.appendChild(e);
2244
+ }
2245
+ return e.parentNode.insertBefore(t, e.nextSibling), t;
2246
+ }
2247
+ function Ln(e, t) {
2159
2248
  try {
2160
2249
  let n = document.createRange();
2161
2250
  return n.setStart(e.startContainer, e.startOffset), n.setEnd(t, t.childNodes.length), n.extractContents();
@@ -2163,7 +2252,7 @@ function kn(e, t) {
2163
2252
  return document.createDocumentFragment();
2164
2253
  }
2165
2254
  }
2166
- function An(e, t, n = {}) {
2255
+ function Rn(e, t, n = {}) {
2167
2256
  let r = (e) => {
2168
2257
  let t = globalThis.getSelection();
2169
2258
  if (!t) return !1;
@@ -2197,7 +2286,7 @@ function An(e, t, n = {}) {
2197
2286
  if (i.nodeType === Node.TEXT_NODE) {
2198
2287
  let t = i;
2199
2288
  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));
2200
- if (a && n.startOffset === 0 && On(t.previousSibling) && I(t.previousSibling.previousSibling)) return e.preventDefault(), r((e) => e.setStartBefore(t.previousSibling.previousSibling));
2289
+ if (a && n.startOffset === 0 && Pn(t.previousSibling) && I(t.previousSibling.previousSibling)) return e.preventDefault(), r((e) => e.setStartBefore(t.previousSibling.previousSibling));
2201
2290
  if (!a && n.startOffset === t.textContent.length && I(t.nextSibling)) {
2202
2291
  let n = t.nextSibling, i = n.nextSibling;
2203
2292
  if (e.preventDefault(), i?.nodeType === Node.TEXT_NODE) {
@@ -2206,7 +2295,7 @@ function An(e, t, n = {}) {
2206
2295
  }
2207
2296
  return r((e) => e.setStartAfter(n));
2208
2297
  }
2209
- if (!a && n.startOffset === t.textContent.length && On(t.nextSibling) && I(t.nextSibling.nextSibling)) {
2298
+ if (!a && n.startOffset === t.textContent.length && Pn(t.nextSibling) && I(t.nextSibling.nextSibling)) {
2210
2299
  let n = t.nextSibling.nextSibling, i = n.nextSibling;
2211
2300
  if (e.preventDefault(), i?.nodeType === Node.TEXT_NODE) {
2212
2301
  let e = +!!(i.textContent || "").startsWith("​");
@@ -2220,7 +2309,7 @@ function An(e, t, n = {}) {
2220
2309
  if (a && n.startOffset > 0) {
2221
2310
  let i = t.childNodes[n.startOffset - 1];
2222
2311
  if (I(i)) return e.preventDefault(), r((e) => e.setStartBefore(i));
2223
- if (On(i) && I(i.previousSibling)) return e.preventDefault(), r((e) => e.setStartBefore(i.previousSibling));
2312
+ if (Pn(i) && I(i.previousSibling)) return e.preventDefault(), r((e) => e.setStartBefore(i.previousSibling));
2224
2313
  }
2225
2314
  if (!a && n.startOffset < t.childNodes.length) {
2226
2315
  let i = t.childNodes[n.startOffset];
@@ -2232,7 +2321,7 @@ function An(e, t, n = {}) {
2232
2321
  }
2233
2322
  return r((e) => e.setStartAfter(i));
2234
2323
  }
2235
- if (On(i) && I(i.nextSibling)) {
2324
+ if (Pn(i) && I(i.nextSibling)) {
2236
2325
  let t = i.nextSibling, n = t.nextSibling;
2237
2326
  if (e.preventDefault(), n?.nodeType === Node.TEXT_NODE) {
2238
2327
  let e = +!!(n.textContent || "").startsWith("​");
@@ -2244,16 +2333,17 @@ function An(e, t, n = {}) {
2244
2333
  }
2245
2334
  }
2246
2335
  if (P(e, N.TAB)) {
2247
- let r = ve(t);
2336
+ let r = ye(t);
2248
2337
  if (!r) return !1;
2338
+ if (Fn(r.sc, t, e.shiftKey)) return e.preventDefault(), !0;
2249
2339
  let i = C(r.sc, t);
2250
- if (i && _(i)) return e.preventDefault(), e.shiftKey ? Ye() : D("indent"), !0;
2340
+ if (i && _(i)) return e.preventDefault(), e.shiftKey ? Qe() : Xe(), !0;
2251
2341
  if (i?.nodeName.toUpperCase() === "PRE") return e.shiftKey ? !1 : (e.preventDefault(), D("insertText", " ".repeat(n.tabSize || 4)), !0);
2252
2342
  if (n.tabSize) return e.shiftKey ? !1 : (e.preventDefault(), D("insertText", " ".repeat(n.tabSize)), !0);
2253
2343
  }
2254
2344
  if (P(e, N.ENTER) && e.shiftKey) return e.preventDefault(), D("insertLineBreak"), !0;
2255
2345
  if (P(e, N.ENTER) && !e.shiftKey) {
2256
- let n = ve(t);
2346
+ let n = ye(t);
2257
2347
  if (!n) return !1;
2258
2348
  let r = n.sc, i = r.nodeType === 3 ? r.parentElement : r;
2259
2349
  if (i?.nodeName === "I" && /\bfa-/.test(i.className || "")) {
@@ -2286,7 +2376,7 @@ function An(e, t, n = {}) {
2286
2376
  if (r.deleteContents(), n.rangeCount === 0 || !o.isConnected) return !0;
2287
2377
  r = n.getRangeAt(0);
2288
2378
  }
2289
- let i = kn(r, o), a = document.createElement("li"), s = document.createElement("input");
2379
+ let i = Ln(r, o), a = document.createElement("li"), s = document.createElement("input");
2290
2380
  s.type = "checkbox", s.setAttribute("contenteditable", "false"), a.appendChild(s), i.textContent.replace(/[\u00a0\u200B]/g, "").length > 0 && a.appendChild(i);
2291
2381
  let c = a.childNodes[1];
2292
2382
  c?.nodeType !== Node.TEXT_NODE && (c = document.createTextNode("​"), a.appendChild(c)), o.after(a);
@@ -2303,14 +2393,98 @@ function An(e, t, n = {}) {
2303
2393
  return !1;
2304
2394
  }
2305
2395
  //#endregion
2396
+ //#region src/js/core/count.js
2397
+ var zn = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "word" }) : null;
2398
+ function Bn(e) {
2399
+ let t = e.trim();
2400
+ if (!t) return 0;
2401
+ if (zn) {
2402
+ let e = 0;
2403
+ for (let n of zn.segment(t)) n.isWordLike && e++;
2404
+ return e;
2405
+ }
2406
+ return t.split(/\s+/).length;
2407
+ }
2408
+ var Vn = /* @__PURE__ */ new Set(/* @__PURE__ */ "ADDRESS.ARTICLE.ASIDE.BLOCKQUOTE.BR.DD.DIV.DL.DT.FIELDSET.FIGCAPTION.FIGURE.FOOTER.FORM.H1.H2.H3.H4.H5.H6.HEADER.HR.LI.MAIN.NAV.OL.P.PRE.SECTION.TABLE.TBODY.TD.TFOOT.TH.THEAD.TR.UL".split("."));
2409
+ function Hn(e, t, n) {
2410
+ for (let r = e.firstChild; r; r = r.nextSibling) if (r.nodeType === 3) {
2411
+ let e = r.data;
2412
+ t.push(e), n.push(e);
2413
+ } else if (r.nodeType === 1) {
2414
+ let e = Vn.has(r.tagName);
2415
+ e && t.push("\n"), Hn(r, t, n), e && t.push("\n");
2416
+ }
2417
+ }
2418
+ function Un(e) {
2419
+ if (e.nodeType === 3) {
2420
+ let t = e.data;
2421
+ return {
2422
+ lines: t,
2423
+ flat: t
2424
+ };
2425
+ }
2426
+ let t = [], n = [];
2427
+ return Hn(e, t, n), {
2428
+ lines: t.join(""),
2429
+ flat: n.join("")
2430
+ };
2431
+ }
2432
+ var Wn = class {
2433
+ constructor() {
2434
+ this._cache = /* @__PURE__ */ new WeakMap();
2435
+ }
2436
+ counts(e) {
2437
+ let t = 0, n = 0, r = [], i = [], a = 0;
2438
+ for (let o = e.firstChild; o; o = o.nextSibling) {
2439
+ let e = this._cache.get(o);
2440
+ if (e && e.key === (o.textContent || "")) {
2441
+ t += e.words, n += e.chars;
2442
+ continue;
2443
+ }
2444
+ let { lines: s, flat: c } = Un(o);
2445
+ r.push({
2446
+ node: o,
2447
+ key: c,
2448
+ text: s,
2449
+ start: a
2450
+ }), i.push(s), a += s.length + 1;
2451
+ }
2452
+ if (r.length) {
2453
+ let e = Gn(r, i.join("\n"));
2454
+ r.forEach((r, i) => {
2455
+ let a = {
2456
+ key: r.key,
2457
+ words: e[i],
2458
+ chars: r.key.replaceAll("\n", "").length
2459
+ };
2460
+ this._cache.set(r.node, a), t += a.words, n += a.chars;
2461
+ });
2462
+ }
2463
+ return {
2464
+ words: t,
2465
+ chars: n
2466
+ };
2467
+ }
2468
+ };
2469
+ function Gn(e, t) {
2470
+ if (!zn) return e.map((e) => Bn(e.text));
2471
+ let n = Array(e.length).fill(0), r = 0;
2472
+ for (let i of zn.segment(t)) if (i.isWordLike) {
2473
+ for (; r < e.length - 1 && i.index >= e[r + 1].start;) r++;
2474
+ n[r]++;
2475
+ }
2476
+ return n;
2477
+ }
2478
+ //#endregion
2306
2479
  //#region src/js/core/markdown.js
2307
- function jn(e) {
2308
- return zn(new DOMParser().parseFromString(`<body>${e || ""}</body>`, "text/html").body).replace(/\n{3,}/g, "\n\n").trim();
2480
+ function Kn(e) {
2481
+ let t = new DOMParser().parseFromString(`<body>${e || ""}</body>`, "text/html");
2482
+ return pe(t.body), er(t.body).replace(/\n{3,}/g, "\n\n").trim();
2309
2483
  }
2310
- function Mn(e, t) {
2484
+ function qn(e, t) {
2311
2485
  return Array.from(e.children).filter((e) => e.tagName === t.toUpperCase());
2312
2486
  }
2313
- function Nn(e) {
2487
+ function Jn(e) {
2314
2488
  let t = "";
2315
2489
  for (let n of e.childNodes) {
2316
2490
  if (n.nodeType === 3) {
@@ -2324,40 +2498,40 @@ function Nn(e) {
2324
2498
  continue;
2325
2499
  }
2326
2500
  if (e === "div" || e === "p") {
2327
- t && !t.endsWith("\n") && (t += "\n"), t += Nn(n), t += "\n";
2501
+ t && !t.endsWith("\n") && (t += "\n"), t += Jn(n), t += "\n";
2328
2502
  continue;
2329
2503
  }
2330
- t += Nn(n);
2504
+ t += Jn(n);
2331
2505
  }
2332
2506
  return t;
2333
2507
  }
2334
- function Pn(e) {
2508
+ function Yn(e) {
2335
2509
  return e.replaceAll("\\", "\\\\").replace(/&(?=#\d+;|#[xX][0-9a-fA-F]+;|[a-zA-Z][a-zA-Z0-9]*;)/g, "&amp;").replace(/!(?=\[)/g, String.raw`\!`).replace(/([`*[\]])/g, String.raw`\$1`).replace(/(?<!\w)_|_(?!\w)/g, String.raw`\_`).replace(/~(?=~)|(?<=~)~/g, String.raw`\~`);
2336
2510
  }
2337
- function Fn(e) {
2511
+ function Xn(e) {
2338
2512
  return /^\s*(?:-{2,}|={2,}|\*{3,}|_{3,}|(?:[-*_] +){2,}[-*_])\s*$/.test(e) ? e.replace(/[-=*_]/, (e) => `\\${e}`) : e.replace(/^(\s*)(#{1,6})(?=\s|$)/, (e, t, n) => `${t}\\${n}`).replace(/^(\s*)>/, (e, t) => `${t}\\>`).replace(/^(\s*)([-*+])(?=\s)/, (e, t, n) => `${t}\\${n}`).replace(/^(\s*)(\d+)([.)])(?=\s)/, (e, t, n, r) => `${t}${n}\\${r}`);
2339
2513
  }
2340
- function In(e) {
2341
- return e.split("\n").map(Fn).join("\n");
2514
+ function Zn(e) {
2515
+ return e.split("\n").map(Xn).join("\n");
2342
2516
  }
2343
- function Ln(e, t) {
2517
+ function Qn(e, t) {
2344
2518
  let n = " ".repeat(t + 1);
2345
- return zn(e, t + 1).trim().split("\n").map((e, t) => t === 0 || e.trim() === "" || e.startsWith(n) ? e : n + e).join("\n");
2519
+ return er(e, t + 1).trim().split("\n").map((e, t) => t === 0 || e.trim() === "" || e.startsWith(n) ? e : n + e).join("\n");
2346
2520
  }
2347
- function Rn(e, t) {
2521
+ function $n(e, t) {
2348
2522
  let n = e.getAttribute(t) || "", r = /[\s()]/.test(n) ? `<${n}>` : n, i = e.getAttribute("title");
2349
2523
  return i ? `${r} "${i.replaceAll("\"", String.raw`\"`)}"` : r;
2350
2524
  }
2351
- function zn(e, t = 0) {
2525
+ function er(e, t = 0) {
2352
2526
  if (e.nodeType === 3) {
2353
2527
  let t = e.textContent.replace(/\s+/g, " ");
2354
- return e.parentElement?.closest("pre, code") ? t : Pn(t);
2528
+ return e.parentElement?.closest("pre, code") ? t : Yn(t);
2355
2529
  }
2356
2530
  if (e.nodeType !== 1) return "";
2357
- let n = e, r = n.nodeName.toLowerCase(), i = () => Array.from(n.childNodes).map((e) => zn(e, t)).join("");
2531
+ let n = e, r = n.nodeName.toLowerCase(), i = () => Array.from(n.childNodes).map((e) => er(e, t)).join("");
2358
2532
  switch (r) {
2359
2533
  case "p":
2360
- case "div": return `\n\n${In(i())}\n\n`;
2534
+ case "div": return `\n\n${Zn(i())}\n\n`;
2361
2535
  case "br": return " \n";
2362
2536
  case "h1": return `\n\n# ${i()}\n\n`;
2363
2537
  case "h2": return `\n\n## ${i()}\n\n`;
@@ -2386,27 +2560,27 @@ function zn(e, t = 0) {
2386
2560
  }
2387
2561
  case "pre": {
2388
2562
  let e = n.querySelector("code"), t = /language-(\S+)/.exec(e?.className || "");
2389
- return `\n\n\`\`\`${t ? t[1] : ""}\n${Nn(e || n).replace(/\n$/, "")}\n\`\`\`\n\n`;
2563
+ return `\n\n\`\`\`${t ? t[1] : ""}\n${Jn(e || n).replace(/\n$/, "")}\n\`\`\`\n\n`;
2390
2564
  }
2391
2565
  case "blockquote": {
2392
2566
  let e = i().trim().split("\n");
2393
2567
  return `\n\n${e.filter((t, n) => t.trim() !== "" || (e[n - 1] ?? "").trim() !== "").map((e) => e.trim() === "" ? ">" : `> ${e}`).join("\n")}\n\n`;
2394
2568
  }
2395
- case "a": return `[${i()}](${Rn(n, "href")})`;
2396
- case "img": return `![${Pn(n.getAttribute("alt") || "")}](${Rn(n, "src")})`;
2569
+ case "a": return `[${i()}](${$n(n, "href")})`;
2570
+ case "img": return `![${Yn(n.getAttribute("alt") || "")}](${$n(n, "src")})`;
2397
2571
  case "ul": {
2398
- let e = Mn(n, "li");
2572
+ let e = qn(n, "li");
2399
2573
  if (!e.length) return i();
2400
2574
  let r = " ".repeat(t), a = n.classList.contains("an-checklist"), o = e.map((e) => {
2401
- let n = Mn(e, "input").find((e) => e.getAttribute("type") === "checkbox"), i = "- ";
2402
- return (a || n) && (i = n && n.checked ? "- [x] " : "- [ ] "), `${r}${i}${Ln(e, t)}`;
2575
+ let n = qn(e, "input").find((e) => e.getAttribute("type") === "checkbox"), i = "- ";
2576
+ return (a || n) && (i = n && n.checked ? "- [x] " : "- [ ] "), `${r}${i}${Qn(e, t)}`;
2403
2577
  }).join("\n");
2404
2578
  return t === 0 ? `\n\n${o}\n\n` : `\n${o}`;
2405
2579
  }
2406
2580
  case "ol": {
2407
- let e = Mn(n, "li");
2581
+ let e = qn(n, "li");
2408
2582
  if (!e.length) return i();
2409
- let r = " ".repeat(t), a = Number.parseInt(n.getAttribute("start") || "1", 10), o = Number.isFinite(a) ? a : 1, s = e.map((e, n) => `${r}${o + n}. ${Ln(e, t)}`).join("\n");
2583
+ let r = " ".repeat(t), a = Number.parseInt(n.getAttribute("start") || "1", 10), o = Number.isFinite(a) ? a : 1, s = e.map((e, n) => `${r}${o + n}. ${Qn(e, t)}`).join("\n");
2410
2584
  return t === 0 ? `\n\n${s}\n\n` : `\n${s}`;
2411
2585
  }
2412
2586
  case "li": return i();
@@ -2414,7 +2588,7 @@ function zn(e, t = 0) {
2414
2588
  case "table": {
2415
2589
  let e = Array.from(n.querySelectorAll("tr"));
2416
2590
  if (!e.length) return i();
2417
- let t = !!Mn(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) => Pn(e.textContent.trim()).replaceAll("|", String.raw`\|`))), a = Math.max(...r.map((e) => e.length)), o = (e) => {
2591
+ let t = !!qn(n, "thead")[0] || e[0].children.length > 0 && Array.from(e[0].children).every((e) => e.tagName === "TH"), r = e.map((e) => Array.from(e.querySelectorAll("th, td")).map((e) => Yn(e.textContent.trim()).replaceAll("|", String.raw`\|`))), a = Math.max(...r.map((e) => e.length)), o = (e) => {
2418
2592
  let t = [...e];
2419
2593
  for (; t.length < a;) t.push("");
2420
2594
  return t;
@@ -2429,16 +2603,16 @@ function zn(e, t = 0) {
2429
2603
  default: return i();
2430
2604
  }
2431
2605
  }
2432
- function Bn(e) {
2606
+ function tr(e) {
2433
2607
  return String(e ?? "").replace(/^\ufeff/, "");
2434
2608
  }
2435
- function Vn(e) {
2436
- let t = Bn(e);
2609
+ function nr(e) {
2610
+ let t = tr(e);
2437
2611
  return /^#{1,6} [^\s]|^[ \t]*[-*+] [^\s]|^[ \t]*\d+[.)] [^\s]|^> ?[^\s]|^ {0,3}(?:`{3,}|~{3,})|^\*{2}[^*\n]+\*{2}/m.test(t) || /^.+\n=+\s*$/m.test(t) || /^.+\n-{2,}\s*$/m.test(t) || /^---[ \t]*\n(?:[\s\S]*?\n)?(?:---|\.\.\.)[ \t]*(?:\n|$)/.test(t) || /^\|.+\|[ \t]*\n\|[ \t:|-]+\|/m.test(t) || /^[^\n|]*\|[^\n]*\n[ \t]*:?-+:?[ \t]*(?:\|[ \t]*:?-+:?[ \t]*)+$/m.test(t) || /!?\[[^\]\n]*\]\([^)\n]*\)/.test(t) && /`[^`\n]+`|\*\*[^*\n]+\*\*|^#{1,6} |^[-*+] /m.test(t);
2438
2612
  }
2439
- var Hn = /^ {0,3}>( ?)(.*)$/, Un = /^(?: {4}|\t)\s*\S/, Wn = /^( {0,3})(`{3,}|~{3,})[ \t]*([^\s`~][^\n]*)?$/;
2440
- function Gn(e) {
2441
- let t = Wn.exec(e);
2613
+ var rr = /^ {0,3}>( ?)(.*)$/, ir = /^(?: {4}|\t)\s*\S/, ar = /^( {0,3})(`{3,}|~{3,})[ \t]*([^\s`~][^\n]*)?$/;
2614
+ function or(e) {
2615
+ let t = ar.exec(e);
2442
2616
  if (!t) return null;
2443
2617
  let [, n, r, i = ""] = t;
2444
2618
  return r[0] === "`" && i.includes("`") ? null : {
@@ -2448,7 +2622,7 @@ function Gn(e) {
2448
2622
  lang: i.trim().split(/\s+/)[0] || ""
2449
2623
  };
2450
2624
  }
2451
- function Kn(e, t) {
2625
+ function sr(e, t) {
2452
2626
  let n = 0, r = 0;
2453
2627
  for (; r < e.length && n < t;) {
2454
2628
  if (e[r] === " ") {
@@ -2465,40 +2639,40 @@ function Kn(e, t) {
2465
2639
  }
2466
2640
  return e.slice(r);
2467
2641
  }
2468
- var qn = /^ {0,3}([-*_])( *\1){2,}\s*$/, Jn = "";
2469
- function Yn(e) {
2470
- let t = Bn(e).replaceAll("\r\n", "\n").replaceAll("\r", "\n").split("\n");
2471
- t = $n(t);
2472
- let n = er(t);
2473
- return t = n.clean, Zn = n.linkDefs, Qn = n.footnoteIds, Xn(t);
2642
+ var cr = /^ {0,3}([-*_])( *\1){2,}\s*$/, lr = "";
2643
+ function ur(e) {
2644
+ let t = tr(e).replaceAll("\r\n", "\n").replaceAll("\r", "\n").split("\n");
2645
+ t = mr(t);
2646
+ let n = hr(t);
2647
+ return t = n.clean, fr = n.linkDefs, pr = n.footnoteIds, dr(t);
2474
2648
  }
2475
- function Xn(e) {
2649
+ function dr(e) {
2476
2650
  let t = [], n = 0;
2477
2651
  for (; n < e.length;) {
2478
- let r = e[n], i = Gn(r);
2652
+ let r = e[n], i = or(r);
2479
2653
  if (i) {
2480
2654
  let r = RegExp(`^ {0,3}\\${i.marker}{${i.length},}[ \t]*$`), a = [];
2481
- for (n++; n < e.length && !r.test(e[n]);) a.push(Sr(Kn(e[n], i.indent))), n++;
2655
+ for (n++; n < e.length && !r.test(e[n]);) a.push(Rr(sr(e[n], i.indent))), n++;
2482
2656
  let o = i.lang ? ` class="language-${z(i.lang)}"` : "";
2483
2657
  t.push(`<pre><code${o}>${a.join("\n")}</code></pre>`), n++;
2484
2658
  continue;
2485
2659
  }
2486
- if (Un.test(r)) {
2660
+ if (ir.test(r)) {
2487
2661
  let r = [];
2488
- for (; n < e.length && (Un.test(e[n]) || e[n].trim() === "");) {
2662
+ for (; n < e.length && (ir.test(e[n]) || e[n].trim() === "");) {
2489
2663
  if (e[n].trim() === "") {
2490
2664
  let t = n;
2491
2665
  for (; t < e.length && e[t].trim() === "";) t++;
2492
- if (t >= e.length || !Un.test(e[t])) break;
2666
+ if (t >= e.length || !ir.test(e[t])) break;
2493
2667
  for (; n < t; n++) r.push("");
2494
2668
  continue;
2495
2669
  }
2496
- r.push(Sr(Kn(e[n], 4))), n++;
2670
+ r.push(Rr(sr(e[n], 4))), n++;
2497
2671
  }
2498
2672
  t.push(`<pre><code>${r.join("\n")}</code></pre>`);
2499
2673
  continue;
2500
2674
  }
2501
- if (r.trim() && !qn.test(r) && !/^#{1,6} /.test(r) && n + 1 < e.length) {
2675
+ if (r.trim() && !cr.test(r) && !/^#{1,6} /.test(r) && n + 1 < e.length) {
2502
2676
  if (/^=+\s*$/.test(e[n + 1])) {
2503
2677
  t.push(`<h1>${R(r.trim())}</h1>`), n += 2;
2504
2678
  continue;
@@ -2508,7 +2682,7 @@ function Xn(e) {
2508
2682
  continue;
2509
2683
  }
2510
2684
  }
2511
- if (qn.test(r)) {
2685
+ if (cr.test(r)) {
2512
2686
  t.push("<hr>"), n++;
2513
2687
  continue;
2514
2688
  }
@@ -2518,19 +2692,19 @@ function Xn(e) {
2518
2692
  t.push(`<h${e}>${R(r)}</h${e}>`), n++;
2519
2693
  continue;
2520
2694
  }
2521
- if (Hn.test(r)) {
2695
+ if (rr.test(r)) {
2522
2696
  let r = [];
2523
- for (; n < e.length && Hn.test(e[n]);) r.push(Hn.exec(e[n])[2]), n++;
2524
- t.push(`<blockquote>${Xn(r)}</blockquote>`);
2697
+ for (; n < e.length && rr.test(e[n]);) r.push(rr.exec(e[n])[2]), n++;
2698
+ t.push(`<blockquote>${dr(r)}</blockquote>`);
2525
2699
  continue;
2526
2700
  }
2527
2701
  if (/^[-*+] /.test(r)) {
2528
- let { html: r, endIdx: i } = ar(e, n);
2702
+ let { html: r, endIdx: i } = xr(e, n);
2529
2703
  t.push(r), n = i;
2530
2704
  continue;
2531
2705
  }
2532
2706
  if (/^\d+[.)] /.test(r)) {
2533
- let { html: r, endIdx: i } = ar(e, n);
2707
+ let { html: r, endIdx: i } = xr(e, n);
2534
2708
  t.push(r), n = i;
2535
2709
  continue;
2536
2710
  }
@@ -2538,23 +2712,23 @@ function Xn(e) {
2538
2712
  n++;
2539
2713
  continue;
2540
2714
  }
2541
- if (rr(e, n)) {
2542
- let i = ir(r), a = ir(e[n + 1]).map((e) => e.startsWith(":") && e.endsWith(":") ? "center" : e.endsWith(":") ? "right" : e.startsWith(":") ? "left" : null);
2715
+ if (yr(e, n)) {
2716
+ let i = br(r), a = br(e[n + 1]).map((e) => e.startsWith(":") && e.endsWith(":") ? "center" : e.endsWith(":") ? "right" : e.startsWith(":") ? "left" : null);
2543
2717
  n += 2;
2544
2718
  let o = [];
2545
- for (; n < e.length && e[n].trim() !== "" && nr(e[n]) > 1;) o.push(ir(e[n])), n++;
2719
+ for (; n < e.length && e[n].trim() !== "" && vr(e[n]);) o.push(br(e[n])), n++;
2546
2720
  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>` : "";
2547
2721
  t.push(`<table>${c}${l}</table>`);
2548
2722
  continue;
2549
2723
  }
2550
2724
  let o = [];
2551
- for (; n < e.length && e[n].trim() !== "" && !/^(#{1,6} |[-*+] |\d+[.)] )/.test(e[n]) && !Gn(e[n]) && !Hn.test(e[n]) && !qn.test(e[n]) && !rr(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++;
2552
- o.length ? t.push(`<p>${R(tr(o)).replaceAll(Jn, "<br>")}</p>`) : (t.push(`<p>${R(r)}</p>`), n++);
2725
+ for (; n < e.length && e[n].trim() !== "" && !/^(#{1,6} |[-*+] |\d+[.)] )/.test(e[n]) && !or(e[n]) && !rr.test(e[n]) && !cr.test(e[n]) && !yr(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++;
2726
+ o.length ? t.push(`<p>${R(gr(o)).replaceAll(lr, "<br>")}</p>`) : (t.push(`<p>${R(r)}</p>`), n++);
2553
2727
  }
2554
2728
  return t.join("");
2555
2729
  }
2556
- var Zn = /* @__PURE__ */ new Map(), Qn = /* @__PURE__ */ new Set();
2557
- function $n(e) {
2730
+ var fr = /* @__PURE__ */ new Map(), pr = /* @__PURE__ */ new Set();
2731
+ function mr(e) {
2558
2732
  if ((e[0] || "").trim() !== "---") return e;
2559
2733
  let t = -1;
2560
2734
  for (let n = 1; n < e.length; n++) {
@@ -2568,14 +2742,14 @@ function $n(e) {
2568
2742
  let n = t + 1;
2569
2743
  return e[n] !== void 0 && e[n].trim() === "" && n++, e.slice(n);
2570
2744
  }
2571
- function er(e) {
2745
+ function hr(e) {
2572
2746
  let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = [], i = !1, a = /^\[([^\]]+)\]:\s*(\S+)(?:\s+"([^"]*)")?\s*$/, o = /^\[\^([^\]]+)\]:[ \t]*(\S.*)$/;
2573
2747
  for (let s of e) {
2574
2748
  if (i) {
2575
2749
  /^ {0,3}(?:`{3,}|~{3,})[ \t]*$/.test(s) && (i = !1), r.push(s);
2576
2750
  continue;
2577
2751
  }
2578
- if (Gn(s)) {
2752
+ if (or(s)) {
2579
2753
  i = !0, r.push(s);
2580
2754
  continue;
2581
2755
  }
@@ -2602,33 +2776,36 @@ function er(e) {
2602
2776
  footnoteIds: n
2603
2777
  };
2604
2778
  }
2605
- function tr(e) {
2779
+ function gr(e) {
2606
2780
  let t = "";
2607
2781
  for (let n = 0; n < e.length; n++) {
2608
2782
  let r = n === e.length - 1, i = e[n].replace(/^[ \t]+/, "");
2609
2783
  if (!r && /\\$/.test(i)) {
2610
- t += i.replace(/\\$/, "") + Jn;
2784
+ t += i.replace(/\\$/, "") + lr;
2611
2785
  continue;
2612
2786
  }
2613
2787
  if (!r && / {2,}$/.test(i)) {
2614
- t += i.replace(/ {2,}$/, "") + Jn;
2788
+ t += i.replace(/ {2,}$/, "") + lr;
2615
2789
  continue;
2616
2790
  }
2617
2791
  t += i + (r ? "" : " ");
2618
2792
  }
2619
2793
  return t;
2620
2794
  }
2621
- function nr(e) {
2622
- return ir(e).length;
2795
+ function _r(e) {
2796
+ return br(e).length;
2797
+ }
2798
+ function vr(e) {
2799
+ return e.includes("|") ? /^\s*\|/.test(e) || _r(e) > 1 : !1;
2623
2800
  }
2624
- function rr(e, t) {
2801
+ function yr(e, t) {
2625
2802
  let n = e[t], r = e[t + 1];
2626
2803
  if (r === void 0 || !n.includes("|")) return !1;
2627
2804
  if (/^\|.+\|/.test(n)) return /^\|[\s|:-]+\|/.test(r);
2628
- let i = ir(r);
2629
- return i.length < 2 || !i.every((e) => /^:?-+:?$/.test(e)) ? !1 : nr(n) === i.length;
2805
+ let i = br(r);
2806
+ return i.length < 2 || !i.every((e) => /^:?-+:?$/.test(e)) ? !1 : _r(n) === i.length;
2630
2807
  }
2631
- function ir(e) {
2808
+ function br(e) {
2632
2809
  let t = e.replace(/^\|/, "").replace(/\|$/, ""), n = [], r = "";
2633
2810
  for (let e = 0; e < t.length; e++) {
2634
2811
  if (t[e] === "\\" && t[e + 1] === "|") {
@@ -2643,7 +2820,7 @@ function ir(e) {
2643
2820
  }
2644
2821
  return n.push(r), n.map((e) => e.trim());
2645
2822
  }
2646
- function ar(e, t) {
2823
+ function xr(e, t) {
2647
2824
  let n = e[t].match(/^(\s*)/)[1].length, r = /^\s*\d+[.)] /.test(e[t]), i = [], a = null, o = !1, s = !1, c = t;
2648
2825
  for (; c < e.length;) {
2649
2826
  let t = e[c];
@@ -2671,15 +2848,15 @@ function ar(e, t) {
2671
2848
  c++;
2672
2849
  continue;
2673
2850
  }
2674
- let n = (e) => Kn(e, l), r = Gn(n(t));
2851
+ let n = (e) => sr(e, l), r = or(n(t));
2675
2852
  if (r) {
2676
2853
  let t = RegExp(`^ {0,3}\\${r.marker}{${r.length},}[ \t]*$`), a = [n(e[c])];
2677
2854
  for (c++; c < e.length && !t.test(n(e[c]));) a.push(n(e[c])), c++;
2678
- c < e.length && (a.push(n(e[c])), c++), i[i.length - 1].sub += Xn(a), s = !1;
2855
+ c < e.length && (a.push(n(e[c])), c++), i[i.length - 1].sub += dr(a), s = !1;
2679
2856
  continue;
2680
2857
  }
2681
2858
  if (/^\s*(?:[-*+]|\d+[.)]) /.test(t)) {
2682
- let t = ar(e, c);
2859
+ let t = xr(e, c);
2683
2860
  i[i.length - 1].sub += t.html, c = t.endIdx, s = !1;
2684
2861
  } else if (s) i[i.length - 1].paras.push(t.trim()), s = !1, c++;
2685
2862
  else {
@@ -2697,32 +2874,32 @@ function ar(e, t) {
2697
2874
  endIdx: c
2698
2875
  };
2699
2876
  }
2700
- var or = /\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g, L = "\0", sr = "", cr = /(`+)([^]*?)\1/g;
2701
- function lr(e) {
2877
+ var Sr = /\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g, L = "\0", Cr = "", wr = /(`+)([^]*?)\1/g;
2878
+ function Tr(e) {
2702
2879
  let t = [];
2703
2880
  return {
2704
- text: e.replace(cr, (e, n, r) => r === "" ? e : (t.push(r), `${sr}${t.length - 1}${sr}`)),
2881
+ text: e.replace(wr, (e, n, r) => r === "" ? e : (t.push(r), `${Cr}${t.length - 1}${Cr}`)),
2705
2882
  codes: t
2706
2883
  };
2707
2884
  }
2708
- function ur(e, t, n) {
2709
- return e.replace(RegExp(`${sr}(\\d+)${sr}`, "g"), (e, r) => {
2885
+ function Er(e, t, n) {
2886
+ return e.replace(RegExp(`${Cr}(\\d+)${Cr}`, "g"), (e, r) => {
2710
2887
  let i = t[Number(r)];
2711
- return i = i.replace(RegExp(`${L}(\\d+)${L}`, "g"), (e, t) => `\\${n[Number(t)]}`), i.length > 2 && i.startsWith(" ") && i.endsWith(" ") && i.trim() !== "" && (i = i.slice(1, -1)), `<code>${Sr(i)}</code>`;
2888
+ return i = i.replace(RegExp(`${L}(\\d+)${L}`, "g"), (e, t) => `\\${n[Number(t)]}`), i.length > 2 && i.startsWith(" ") && i.endsWith(" ") && i.trim() !== "" && (i = i.slice(1, -1)), `<code>${Rr(i)}</code>`;
2712
2889
  });
2713
2890
  }
2714
- function dr(e) {
2891
+ function Dr(e) {
2715
2892
  let t = [];
2716
2893
  return {
2717
- text: e.replace(or, (e, n) => (t.push(n), `${L}${t.length - 1}${L}`)),
2894
+ text: e.replace(Sr, (e, n) => (t.push(n), `${L}${t.length - 1}${L}`)),
2718
2895
  literals: t
2719
2896
  };
2720
2897
  }
2721
- function fr(e, t) {
2722
- return e.replace(RegExp(`${L}(\\d+)${L}`, "g"), (e, n) => xr(t[Number(n)]));
2898
+ function Or(e, t) {
2899
+ return e.replace(RegExp(`${L}(\\d+)${L}`, "g"), (e, n) => Lr(t[Number(n)]));
2723
2900
  }
2724
- var pr = String.raw`(&lt;.*?&gt;(?:\s+(?:"[^"]*"|'[^']*'))?|[^)]*)`, mr = new RegExp(String.raw`!\[([^\]]*)\]\(${pr}\)`, "g"), hr = new RegExp(String.raw`\[([^\]]+)\]\(${pr}\)`, "g");
2725
- function gr(e) {
2901
+ var kr = String.raw`(&lt;.*?&gt;(?:\s+(?:"[^"]*"|'[^']*'))?|[^)]*)`, Ar = new RegExp(String.raw`!\[([^\]]*)\]\(${kr}\)`, "g"), jr = new RegExp(String.raw`\[([^\]]+)\]\(${kr}\)`, "g");
2902
+ function Mr(e) {
2726
2903
  let t = e.trim(), n = /^&lt;([\s\S]*?)&gt;(?:[ \t]*(?:"([^"]*)"|'([^']*)'))?[ \t]*$/.exec(t);
2727
2904
  if (n) return {
2728
2905
  href: n[1],
@@ -2737,26 +2914,26 @@ function gr(e) {
2737
2914
  title: ""
2738
2915
  };
2739
2916
  }
2740
- function _r(e) {
2741
- return e = e.replace(mr, (e, t, n) => {
2742
- let { href: r, title: i } = gr(n), a = i ? ` title="${B(i)}"` : "";
2917
+ function Nr(e) {
2918
+ return e = e.replace(Ar, (e, t, n) => {
2919
+ let { href: r, title: i } = Mr(n), a = i ? ` title="${B(i)}"` : "";
2743
2920
  return `<img src="${B(r)}" alt="${B(t)}"${a} class="an-image">`;
2744
- }), e = e.replace(hr, (e, t, n) => {
2745
- let { href: r, title: i } = gr(n), a = i ? ` title="${B(i)}"` : "";
2921
+ }), e = e.replace(jr, (e, t, n) => {
2922
+ let { href: r, title: i } = Mr(n), a = i ? ` title="${B(i)}"` : "";
2746
2923
  return `<a href="${B(r)}"${a}>${t}</a>`;
2747
2924
  }), e = e.replace(/\[([^\]]+)\]\[([^\]]*)\]/g, (e, t, n) => {
2748
- let r = Zn.get(Cr(n || t).trim().toLowerCase());
2925
+ let r = fr.get(zr(n || t).trim().toLowerCase());
2749
2926
  if (!r) return e;
2750
2927
  let i = r.title ? ` title="${z(r.title)}"` : "";
2751
2928
  return `<a href="${z(r.href)}"${i}>${t}</a>`;
2752
2929
  }), e = e.replace(/\[([^\]]+)\]/g, (e, t) => {
2753
- let n = Zn.get(Cr(t).trim().toLowerCase());
2930
+ let n = fr.get(zr(t).trim().toLowerCase());
2754
2931
  if (!n) return e;
2755
2932
  let r = n.title ? ` title="${z(n.title)}"` : "";
2756
2933
  return `<a href="${z(n.href)}"${r}>${t}</a>`;
2757
- }), e = e.replace(/\[\^([^\]]+)\]/g, (e, t) => Qn.has(Cr(t)) ? `<sup>[${t}]</sup>` : e), e;
2934
+ }), e = e.replace(/\[\^([^\]]+)\]/g, (e, t) => pr.has(zr(t)) ? `<sup>[${t}]</sup>` : e), e;
2758
2935
  }
2759
- function vr(e) {
2936
+ function Pr(e) {
2760
2937
  return e = e.replace(/&lt;(https?:\/\/[^\s&]+?)&gt;/g, (e, t) => `<a href="${B(t)}">${t}</a>`), e = e.replace(/&lt;([\w.!#$%&'*+/=?^`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+)&gt;/g, (e, t) => `<a href="mailto:${B(t)}">${t}</a>`), e = e.replace(/(^|[\s(])(https?:\/\/[^\s()]+)/g, (e, t, n) => {
2761
2938
  let r = /[.,;:!?)]+$/.exec(n), i = r ? n.slice(0, -r[0].length) : n;
2762
2939
  if (!i) return e;
@@ -2764,18 +2941,18 @@ function vr(e) {
2764
2941
  return `${t}<a href="${B(i)}">${i}</a>${a}`;
2765
2942
  }), e;
2766
2943
  }
2767
- function yr(e) {
2944
+ function Fr(e) {
2768
2945
  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;
2769
2946
  }
2770
2947
  function R(e) {
2771
- let { text: t, literals: n } = dr(e), { text: r, codes: i } = lr(t), a = xr(r);
2772
- return a = _r(a), a = vr(a), a = yr(a), ur(fr(a, n), i, n);
2948
+ let { text: t, literals: n } = Dr(e), { text: r, codes: i } = Tr(t), a = Lr(r);
2949
+ return a = Nr(a), a = Pr(a), a = Fr(a), Er(Or(a, n), i, n);
2773
2950
  }
2774
- var br = /&(?!#\d+;|#[xX][0-9a-fA-F]+;|[a-zA-Z][a-zA-Z0-9]*;)/g;
2775
- function xr(e) {
2776
- return String(e).replace(br, "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
2951
+ var Ir = /&(?!#\d+;|#[xX][0-9a-fA-F]+;|[a-zA-Z][a-zA-Z0-9]*;)/g;
2952
+ function Lr(e) {
2953
+ return String(e).replace(Ir, "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
2777
2954
  }
2778
- function Sr(e) {
2955
+ function Rr(e) {
2779
2956
  return String(e).replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
2780
2957
  }
2781
2958
  function z(e) {
@@ -2784,16 +2961,16 @@ function z(e) {
2784
2961
  function B(e) {
2785
2962
  return String(e).replaceAll("\"", "&quot;").replaceAll("'", "&#39;");
2786
2963
  }
2787
- function Cr(e) {
2964
+ function zr(e) {
2788
2965
  return String(e).replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
2789
2966
  }
2790
2967
  //#endregion
2791
2968
  //#region src/js/core/detectLang.js
2792
- var wr = 5, Tr = 2, Er = [
2969
+ var Br = 5, Vr = 2, Hr = [
2793
2970
  ["typescript", "javascript"],
2794
2971
  ["scss", "css"],
2795
2972
  ["cpp", "c"]
2796
- ], Dr = [
2973
+ ], Ur = [
2797
2974
  "javascript",
2798
2975
  "typescript",
2799
2976
  "python",
@@ -2816,7 +2993,7 @@ var wr = 5, Tr = 2, Er = [
2816
2993
  "scss",
2817
2994
  "css",
2818
2995
  "bash"
2819
- ], Or = [
2996
+ ], Wr = [
2820
2997
  {
2821
2998
  lang: "php",
2822
2999
  w: 10,
@@ -3382,33 +3559,41 @@ var wr = 5, Tr = 2, Er = [
3382
3559
  w: 3,
3383
3560
  re: /\s\|[ \t]*\w|\s&&\s|\s2>&1|\s-[\w-]+\s/
3384
3561
  }
3385
- ], kr = 4e3;
3386
- function Ar(e) {
3387
- if (e.length <= kr) return e;
3388
- let t = e.slice(0, kr), n = t.lastIndexOf("\n");
3562
+ ], Gr = 4e3;
3563
+ function Kr(e) {
3564
+ if (e.length <= Gr) return e;
3565
+ let t = e.slice(0, Gr), n = t.lastIndexOf("\n");
3389
3566
  return n > 0 ? t.slice(0, n) : t;
3390
3567
  }
3391
- function jr(e) {
3568
+ function qr(e) {
3392
3569
  if (!e?.trim()) return null;
3393
- let t = Ar(e.trim()), n = /* @__PURE__ */ new Map();
3394
- for (let { lang: e, re: r, w: i } of Or) r.test(t) && n.set(e, (n.get(e) || 0) + i);
3570
+ let t = Kr(e.trim()), n = /* @__PURE__ */ new Map();
3571
+ for (let { lang: e, re: r, w: i } of Wr) r.test(t) && n.set(e, (n.get(e) || 0) + i);
3395
3572
  if (n.size === 0) return null;
3396
- for (let [e, t] of Er) {
3573
+ for (let [e, t] of Hr) {
3397
3574
  let r = n.get(e);
3398
3575
  r && n.set(e, r + (n.get(t) || 0));
3399
3576
  }
3400
3577
  let r = [...n.entries()].sort((e, t) => t[1] - e[1]), [i, a] = r[0], o = r[1]?.[1] ?? 0;
3401
- return a < wr || a - o < Tr ? null : i;
3578
+ return a < Br || a - o < Vr ? null : i;
3402
3579
  }
3403
3580
  //#endregion
3404
3581
  //#region src/js/module/Editor.js
3405
- var Mr = class {
3582
+ var Jr = /* @__PURE__ */ new Set([
3583
+ "PRE",
3584
+ "BLOCKQUOTE",
3585
+ "TABLE",
3586
+ "FIGURE",
3587
+ "UL",
3588
+ "OL",
3589
+ "HR"
3590
+ ]), Yr = class {
3406
3591
  constructor(e) {
3407
- this.context = e, this.options = e.options, this._history = null, this._disposers = [], this._snapshotTimer = null;
3592
+ this.context = e, this.options = e.options, this._history = null, this._disposers = [], this._snapshotTimer = null, this._limitCounter = null;
3408
3593
  }
3409
3594
  initialize() {
3410
3595
  let e = this.context.layoutInfo.editable;
3411
- return this._history = new wn(e, this.options.historyLimit || 100, this.options.historyMaxBytes || 10 * 1024 * 1024), this._bindEvents(e), this;
3596
+ return this._history = new An(e, this.options.historyLimit || 100, this.options.historyMaxBytes || 10 * 1024 * 1024), this._bindEvents(e), this;
3412
3597
  }
3413
3598
  destroy() {
3414
3599
  this._disposers.forEach((e) => e()), this._disposers = [], this._history = null, clearTimeout(this._snapshotTimer), this._snapshotTimer = null;
@@ -3485,7 +3670,7 @@ var Mr = class {
3485
3670
  }
3486
3671
  _onKeydown(e) {
3487
3672
  let t = this.context.layoutInfo.editable;
3488
- if (!An(e, t, this.options)) {
3673
+ if (!Rn(e, t, this.options)) {
3489
3674
  if (F(e, "z") && !e.shiftKey) {
3490
3675
  e.preventDefault(), this.undo();
3491
3676
  return;
@@ -3528,14 +3713,15 @@ var Mr = class {
3528
3713
  _enforceLimit(e) {
3529
3714
  let t = this.options.maxChars || 0, n = this.options.maxWords || 0;
3530
3715
  if (!t && !n) return;
3716
+ this._limitCounter ??= new Wn();
3531
3717
  let r = e.inputType || "";
3532
3718
  if (r.startsWith("delete") || r === "historyUndo" || r === "historyRedo" || r === "insertFromPaste" || r === "insertFromDrop" || !r.startsWith("insert")) return;
3533
- let i = this.context.layoutInfo.editable.innerText || "", a = i.replaceAll("\n", "").length;
3719
+ let { words: i, chars: a } = this._limitCounter.counts(this.context.layoutInfo.editable);
3534
3720
  if (t && a >= t) {
3535
3721
  e.preventDefault(), typeof this.options.onCharLimitReached == "function" && this.options.onCharLimitReached(this.context);
3536
3722
  return;
3537
3723
  }
3538
- n && (e.data === " " || r === "insertParagraph" || r === "insertLineBreak") && (i.trim() ? i.trim().split(/\s+/).length : 0) >= n && (e.preventDefault(), typeof this.options.onWordLimitReached == "function" && this.options.onWordLimitReached(this.context));
3724
+ n && (e.data === " " || r === "insertParagraph" || r === "insertLineBreak") && i >= n && (e.preventDefault(), typeof this.options.onWordLimitReached == "function" && this.options.onWordLimitReached(this.context));
3539
3725
  }
3540
3726
  afterCommand() {
3541
3727
  this._cleanOrphanedFigures(), this._ensureTrailingParagraph(), this.context.invoke("toolbar.refresh"), this.context.invoke("statusbar.update"), this._scheduleSnapshot();
@@ -3554,15 +3740,7 @@ var Mr = class {
3554
3740
  let e = this.context.layoutInfo.editable;
3555
3741
  if (!e) return;
3556
3742
  let t = e.lastElementChild;
3557
- if (t && (/* @__PURE__ */ new Set([
3558
- "PRE",
3559
- "BLOCKQUOTE",
3560
- "TABLE",
3561
- "FIGURE",
3562
- "UL",
3563
- "OL",
3564
- "HR"
3565
- ])).has(t.nodeName)) {
3743
+ if (t && Jr.has(t.nodeName)) {
3566
3744
  let t = document.createElement("p");
3567
3745
  t.innerHTML = "<br>", e.appendChild(t);
3568
3746
  }
@@ -3575,7 +3753,8 @@ var Mr = class {
3575
3753
  return this.context.invoke("clipboard.resolveImages", e) ?? e;
3576
3754
  }
3577
3755
  setHTML(e) {
3578
- this.context.layoutInfo.editable.innerHTML = j(e, { allowIframes: !0 }), this._history && this._history.reset(), this.afterCommand();
3756
+ let t = vn(e, { allowIframes: !0 });
3757
+ this.context.layoutInfo.editable.replaceChildren(...t.childNodes), this._history && this._history.reset(), this.afterCommand();
3579
3758
  }
3580
3759
  getText() {
3581
3760
  return this.context.layoutInfo.editable.innerText || "";
@@ -3600,10 +3779,10 @@ var Mr = class {
3600
3779
  e && (D("insertText", e), this.afterCommand());
3601
3780
  }
3602
3781
  setMarkdown(e) {
3603
- this.setHTML(Yn(e || ""));
3782
+ this.setHTML(ur(e || ""));
3604
3783
  }
3605
3784
  getMarkdown() {
3606
- return jn(this.getHTML());
3785
+ return Kn(this.getHTML());
3607
3786
  }
3608
3787
  undo() {
3609
3788
  this._history && (this._flushPendingSnapshot(), this._history.undo(), this.context.invoke("toolbar.refresh"), this.context.invoke("statusbar.update"), this.context.triggerEvent("change", this.getHTML()));
@@ -3633,63 +3812,63 @@ var Mr = class {
3633
3812
  return !e || !this._history ? !1 : (this._history._restoreSelection(e), !0);
3634
3813
  }
3635
3814
  bold() {
3636
- Ne(), this.afterCommand();
3815
+ Fe(), this.afterCommand();
3637
3816
  }
3638
3817
  italic() {
3639
- Pe(), this.afterCommand();
3818
+ Ie(), this.afterCommand();
3640
3819
  }
3641
3820
  underline() {
3642
- Fe(), this.afterCommand();
3821
+ Le(), this.afterCommand();
3643
3822
  }
3644
3823
  strikethrough() {
3645
- Ie(), this.afterCommand();
3824
+ Re(), this.afterCommand();
3646
3825
  }
3647
3826
  superscript() {
3648
- Le(), this.afterCommand();
3827
+ ze(), this.afterCommand();
3649
3828
  }
3650
3829
  subscript() {
3651
- Re(), this.afterCommand();
3830
+ Be(), this.afterCommand();
3652
3831
  }
3653
3832
  justifyLeft() {
3654
- We(), this.afterCommand();
3833
+ Ke(), this.afterCommand();
3655
3834
  }
3656
3835
  justifyCenter() {
3657
- Ge(), this.afterCommand();
3836
+ qe(), this.afterCommand();
3658
3837
  }
3659
3838
  justifyRight() {
3660
- Ke(), this.afterCommand();
3839
+ Je(), this.afterCommand();
3661
3840
  }
3662
3841
  justifyFull() {
3663
- qe(), this.afterCommand();
3842
+ Ye(), this.afterCommand();
3664
3843
  }
3665
3844
  indent() {
3666
- Je(), this.afterCommand();
3845
+ Xe(), this.afterCommand();
3667
3846
  }
3668
3847
  outdent() {
3669
- Ye(), this.afterCommand();
3848
+ Qe(), this.afterCommand();
3670
3849
  }
3671
3850
  insertUL() {
3672
- $e(), this.afterCommand();
3851
+ rt(), this.afterCommand();
3673
3852
  }
3674
3853
  insertOL() {
3675
- et(), this.afterCommand();
3854
+ it(), this.afterCommand();
3676
3855
  }
3677
3856
  inlineCode() {
3678
- nt(this.context.layoutInfo.editable), this.afterCommand();
3857
+ ot(this.context.layoutInfo.editable), this.afterCommand();
3679
3858
  }
3680
3859
  toggleChecklist() {
3681
- ot(), this.afterCommand();
3860
+ ut(), this.afterCommand();
3682
3861
  }
3683
3862
  print() {
3684
3863
  this.context.print();
3685
3864
  }
3686
3865
  formatBlock(e) {
3687
- if (Ue(e), e === "pre") {
3866
+ if (Ge(e), e === "pre") {
3688
3867
  let e = globalThis.getSelection();
3689
3868
  if (e?.rangeCount > 0) {
3690
3869
  let t = e.getRangeAt(0).commonAncestorContainer, n = t.nodeType === 1 ? t.closest("pre") : t.parentElement?.closest("pre");
3691
3870
  if (n && !n.dataset.language) {
3692
- let e = jr(n.textContent || "");
3871
+ let e = qr(n.textContent || "");
3693
3872
  if (e) {
3694
3873
  this.context.invoke("codeTooltip.applyLanguage", n, e);
3695
3874
  return;
@@ -3700,16 +3879,16 @@ var Mr = class {
3700
3879
  this.afterCommand();
3701
3880
  }
3702
3881
  foreColor(e) {
3703
- ze(e), this.afterCommand();
3882
+ Ve(e), this.afterCommand();
3704
3883
  }
3705
3884
  backColor(e) {
3706
- Be(e), this.afterCommand();
3885
+ He(e), this.afterCommand();
3707
3886
  }
3708
3887
  fontName(e) {
3709
- Ve(e), this.afterCommand();
3888
+ Ue(e), this.afterCommand();
3710
3889
  }
3711
3890
  fontSize(e) {
3712
- He(e, this.context.layoutInfo.editable), this.afterCommand();
3891
+ We(e, this.context.layoutInfo.editable), this.afterCommand();
3713
3892
  }
3714
3893
  insertHr() {
3715
3894
  D("insertHorizontalRule"), this.afterCommand();
@@ -3748,7 +3927,7 @@ var Mr = class {
3748
3927
  e && (D("insertHTML", e), this.afterCommand());
3749
3928
  }
3750
3929
  insertTable(e, t) {
3751
- En(e, t, { headerRow: this.context.options.tableHeaderRow }), this.afterCommand();
3930
+ Mn(e, t, { headerRow: this.context.options.tableHeaderRow }), this.afterCommand();
3752
3931
  }
3753
3932
  _getClosestAnchor() {
3754
3933
  let e = globalThis.getSelection();
@@ -3763,7 +3942,7 @@ var Mr = class {
3763
3942
  _escapeAttr(e) {
3764
3943
  return String(e ?? "").replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
3765
3944
  }
3766
- }, Nr = (e) => typeof e == "string" ? ut(e) : e, Pr = null, Fr = "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" ${Fr} style="display:block">${e}</svg>`, H = /* @__PURE__ */ new Map([
3945
+ }, Xr = (e) => typeof e == "string" ? mt(e) : e, Zr = null, Qr = "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" ${Qr} style="display:block">${e}</svg>`, H = /* @__PURE__ */ new Map([
3767
3946
  ["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\"/>")],
3768
3947
  ["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\"/>")],
3769
3948
  ["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\"/>")],
@@ -3800,7 +3979,7 @@ var Mr = class {
3800
3979
  ["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\"/>")],
3801
3980
  ["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\"/>")],
3802
3981
  ["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\"/>")]
3803
- ]), Ir = /* @__PURE__ */ new Map([
3982
+ ]), $r = /* @__PURE__ */ new Map([
3804
3983
  ["bold", "fa-bold"],
3805
3984
  ["italic", "fa-italic"],
3806
3985
  ["underline", "fa-underline"],
@@ -3834,7 +4013,7 @@ var Mr = class {
3834
4013
  ["inline-code", "fa-code"],
3835
4014
  ["checklist", "fa-list-check"],
3836
4015
  ["print", "fa-print"]
3837
- ]), Lr = class {
4016
+ ]), ei = class {
3838
4017
  constructor(e) {
3839
4018
  this.context = e, this.options = e.options, this.el = null, this._disposers = [], this._colorPickerClosers = [], this._refreshRaf = null;
3840
4019
  }
@@ -3844,7 +4023,7 @@ var Mr = class {
3844
4023
  role: "toolbar",
3845
4024
  "aria-orientation": "horizontal",
3846
4025
  "aria-label": "Editor toolbar"
3847
- }), this._faReady = this._detectFontAwesome(), this._buildButtons(), this._initRovingFocus(), this._btnMap = new Map((this.options.toolbar || []).flat().map(Nr).filter(Boolean).map((e) => [e.name, e])), this;
4026
+ }), this._faReady = this._detectFontAwesome(), this._buildButtons(), this._initRovingFocus(), this._btnMap = new Map((this.options.toolbar || []).flat().map(Xr).filter(Boolean).map((e) => [e.name, e])), this;
3848
4027
  }
3849
4028
  destroy() {
3850
4029
  this._refreshRaf && cancelAnimationFrame(this._refreshRaf), this._refreshRaf = null, this._disposers.forEach((e) => e()), this._disposers = [], this.el?.parentNode && this.el.remove(), this.el = null;
@@ -3854,7 +4033,7 @@ var Mr = class {
3854
4033
  e.forEach((e) => {
3855
4034
  let n = w("div", { class: "an-btn-group" });
3856
4035
  e.forEach((e) => {
3857
- let t = Nr(e);
4036
+ let t = Xr(e);
3858
4037
  if (!t) {
3859
4038
  console.warn(`[AutumnNote] Toolbar: button "${e}" not found in registry. Skipped.`);
3860
4039
  return;
@@ -4073,7 +4252,7 @@ var Mr = class {
4073
4252
  ...typeof e.isActive == "function" ? { "aria-pressed": "false" } : {}
4074
4253
  }), n = this.options.fontAwesomeClass || "fas";
4075
4254
  if (this._faReady) {
4076
- let r = Ir.get(e.icon) || Ir.get(e.name) || null;
4255
+ let r = $r.get(e.icon) || $r.get(e.name) || null;
4077
4256
  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;
4078
4257
  } 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;
4079
4258
  let r = E(t, "click", (t) => {
@@ -4119,10 +4298,10 @@ var Mr = class {
4119
4298
  }
4120
4299
  _detectFontAwesome() {
4121
4300
  if (!this.options.useFontAwesome) return !1;
4122
- if (Pr !== null) return Pr;
4123
- if (document.querySelector(".fa, .fas, .far, .fal, .fab, .fa-solid")) return Pr = !0, !0;
4301
+ if (Zr !== null) return Zr;
4302
+ if (document.querySelector(".fa, .fas, .far, .fal, .fab, .fa-solid")) return Zr = !0, !0;
4124
4303
  let e = Array.from(document.querySelectorAll("link[rel=\"stylesheet\"]")).filter((e) => e.id !== "an-fontawesome-css").map((e) => e.href || "").join(" ");
4125
- return Pr = /fontawesome|font-awesome|use\.fontawesome|all\.css/.test(e), Pr;
4304
+ return Zr = /fontawesome|font-awesome|use\.fontawesome|all\.css/.test(e), Zr;
4126
4305
  }
4127
4306
  refresh() {
4128
4307
  this._refreshRaf && cancelAnimationFrame(this._refreshRaf), this._refreshRaf = requestAnimationFrame(() => {
@@ -4155,29 +4334,21 @@ var Mr = class {
4155
4334
  this.el && (this.el.style.display = "none");
4156
4335
  }
4157
4336
  rebuild() {
4158
- 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(Nr).filter(Boolean).map((e) => [e.name, e])), this.refresh();
4159
- }
4160
- }, Rr = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "word" }) : null;
4161
- function zr(e) {
4162
- let t = e.trim();
4163
- if (!t) return 0;
4164
- if (Rr) {
4165
- let e = 0;
4166
- for (let n of Rr.segment(t)) n.isWordLike && e++;
4167
- return e;
4337
+ 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(Xr).filter(Boolean).map((e) => [e.name, e])), this.refresh();
4168
4338
  }
4169
- return t.split(/\s+/).length;
4170
- }
4171
- function Br(e, t, n) {
4339
+ };
4340
+ //#endregion
4341
+ //#region src/js/module/Statusbar.js
4342
+ function ti(e, t, n) {
4172
4343
  if (!n) {
4173
4344
  e.classList.remove("an-count-warn", "an-count-exceeded");
4174
4345
  return;
4175
4346
  }
4176
4347
  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");
4177
4348
  }
4178
- var Vr = class {
4349
+ var ni = class {
4179
4350
  constructor(e) {
4180
- this.context = e, this.options = e.options, this.el = null, this._disposers = [], this._wordCountEl = null, this._charCountEl = null;
4351
+ this.context = e, this.options = e.options, this.el = null, this._disposers = [], this._wordCountEl = null, this._charCountEl = null, this._counter = new Wn();
4181
4352
  }
4182
4353
  initialize() {
4183
4354
  if (this.el = w("div", { class: "an-statusbar" }), this.options.resizable !== !1) {
@@ -4226,19 +4397,21 @@ var Vr = class {
4226
4397
  }, d = E(e, "mousedown", s), f = E(e, "touchstart", u);
4227
4398
  this._disposers.push(d, f);
4228
4399
  }
4400
+ _counts() {
4401
+ return this._counter.counts(this.context.layoutInfo.editable);
4402
+ }
4229
4403
  update() {
4230
4404
  if (!this._wordCountEl || !this._charCountEl) return;
4231
- let e = this.context.layoutInfo.editable.textContent || "", t = zr(e), n = e.replaceAll("\n", "").length, r = this.options.maxWords || 0, i = this.options.maxChars || 0, a = this.context.locale.statusbar;
4232
- this._wordCountEl.textContent = r ? a.wordsLimit(t, r) : a.words(t), this._charCountEl.textContent = i ? a.charsLimit(n, i) : a.chars(n), Br(this._wordCountEl, t, r), Br(this._charCountEl, n, i);
4405
+ let { words: e, chars: t } = this._counts(), n = this.options.maxWords || 0, r = this.options.maxChars || 0, i = this.context.locale.statusbar;
4406
+ this._wordCountEl.textContent = n ? i.wordsLimit(e, n) : i.words(e), this._charCountEl.textContent = r ? i.charsLimit(t, r) : i.chars(t), ti(this._wordCountEl, e, n), ti(this._charCountEl, t, r);
4233
4407
  }
4234
4408
  getWordCount() {
4235
- let e = this.context.layoutInfo.editable;
4236
- return zr(e.innerText || "");
4409
+ return this._counts().words;
4237
4410
  }
4238
4411
  getCharCount() {
4239
- return (this.context.layoutInfo.editable.innerText || "").replaceAll("\n", "").length;
4412
+ return this._counts().chars;
4240
4413
  }
4241
- }, Hr = class {
4414
+ }, ri = class {
4242
4415
  constructor(e) {
4243
4416
  this.context = e, this.options = e.options, this._disposers = [];
4244
4417
  }
@@ -4355,8 +4528,8 @@ var Vr = class {
4355
4528
  }
4356
4529
  if (this.options.markdownPaste !== !1) {
4357
4530
  let n = t.types.includes("text/html"), r = n ? t.getData("text/html") : "", i = !n || this._isTriviallyPlainHtml(r), a = t.getData("text/plain");
4358
- if (a && i && Vn(a)) {
4359
- e.preventDefault(), D("insertHTML", j(Yn(a))), this.context.invoke("editor.afterCommand");
4531
+ if (a && i && nr(a)) {
4532
+ e.preventDefault(), D("insertHTML", j(ur(a))), this.context.invoke("editor.afterCommand");
4360
4533
  return;
4361
4534
  }
4362
4535
  }
@@ -4395,7 +4568,7 @@ var Vr = class {
4395
4568
  }
4396
4569
  let n = new FileReader();
4397
4570
  n.onload = (e) => {
4398
- D("insertHTML", j(Yn(e.target.result || ""))), this.context.invoke("editor.afterCommand");
4571
+ D("insertHTML", j(ur(e.target.result || ""))), this.context.invoke("editor.afterCommand");
4399
4572
  }, n.onerror = () => {
4400
4573
  let t = `Failed to read dropped markdown file "${e.name}".`;
4401
4574
  console.warn(`[AutumnNote] ${t}`), this.context.triggerEvent("pasteError", { message: t });
@@ -4607,7 +4780,7 @@ var Vr = class {
4607
4780
  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>",
4608
4781
  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>",
4609
4782
  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>"
4610
- }, Ur = [
4783
+ }, ii = [
4611
4784
  "#000000",
4612
4785
  "#434343",
4613
4786
  "#666666",
@@ -4633,19 +4806,19 @@ var Vr = class {
4633
4806
  "#d9d2e9",
4634
4807
  "#ead1dc"
4635
4808
  ];
4636
- function Wr(e) {
4809
+ function ai(e) {
4637
4810
  let t = e === "foreColor" ? "Text Color" : "Highlight Color", n = e === "foreColor" ? "textColor" : "highlightColor";
4638
4811
  return () => [{
4639
4812
  back: !0,
4640
4813
  label: t,
4641
4814
  localeKey: n,
4642
- navigate: () => Gr
4815
+ navigate: () => oi
4643
4816
  }, {
4644
4817
  colorPalette: !0,
4645
4818
  colorType: e
4646
4819
  }];
4647
4820
  }
4648
- var Gr = [
4821
+ var oi = [
4649
4822
  {
4650
4823
  name: "cut",
4651
4824
  label: "Cut",
@@ -4709,14 +4882,14 @@ var Gr = [
4709
4882
  label: "Text Color",
4710
4883
  icon: U.textColor,
4711
4884
  colorStrip: "foreColor",
4712
- navigate: Wr("foreColor")
4885
+ navigate: ai("foreColor")
4713
4886
  },
4714
4887
  {
4715
4888
  name: "highlightColor",
4716
4889
  label: "Highlight Color",
4717
4890
  icon: U.highlightColor,
4718
4891
  colorStrip: "hiliteColor",
4719
- navigate: Wr("hiliteColor")
4892
+ navigate: ai("hiliteColor")
4720
4893
  },
4721
4894
  { separator: !0 },
4722
4895
  {
@@ -4763,9 +4936,9 @@ var Gr = [
4763
4936
  icon: U.table,
4764
4937
  tableGrid: !0
4765
4938
  }
4766
- ], Kr = class {
4939
+ ], si = class {
4767
4940
  constructor(e) {
4768
- this.context = e, this.options = e.options || {}, this._items = this.options.contextMenu?.items || Gr, this.el = null, this._disposers = [], this._menuDisposers = [], this._lastX = 0, this._lastY = 0, this._copiedFormat = null, this._savedRange = null;
4941
+ this.context = e, this.options = e.options || {}, this._items = this.options.contextMenu?.items || oi, this.el = null, this._disposers = [], this._menuDisposers = [], this._lastX = 0, this._lastY = 0, this._copiedFormat = null, this._savedRange = null;
4769
4942
  }
4770
4943
  initialize() {
4771
4944
  this.el = w("div", {
@@ -4851,7 +5024,7 @@ var Gr = [
4851
5024
  }
4852
5025
  if (e.colorPalette) {
4853
5026
  let t = w("div", { class: "an-context-color-palette" });
4854
- if (Ur.forEach((n) => {
5027
+ if (ii.forEach((n) => {
4855
5028
  let r = w("div", {
4856
5029
  class: "an-context-color-swatch",
4857
5030
  title: n,
@@ -5081,7 +5254,13 @@ var Gr = [
5081
5254
  } catch {}
5082
5255
  this.context.invoke("editor.afterCommand");
5083
5256
  }
5084
- }, qr = class {
5257
+ }, ci = /[^\s\u200B]/;
5258
+ function li(e) {
5259
+ let t = document.createTreeWalker(e, NodeFilter.SHOW_TEXT);
5260
+ for (let e = t.nextNode(); e; e = t.nextNode()) if (ci.test(e.data)) return !0;
5261
+ return !1;
5262
+ }
5263
+ var ui = class {
5085
5264
  constructor(e) {
5086
5265
  this.context = e, this.options = e.options, this._disposers = [];
5087
5266
  }
@@ -5095,10 +5274,10 @@ var Gr = [
5095
5274
  this._disposers.forEach((e) => e()), this._disposers = [];
5096
5275
  }
5097
5276
  _update() {
5098
- 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");
5277
+ let e = this.context.layoutInfo.editable, t = document.activeElement === e, n = !li(e) && !e.querySelector("img, table, hr, .an-video-wrapper");
5099
5278
  e.classList.toggle("an-placeholder", n && !t);
5100
5279
  }
5101
- }, Jr = class {
5280
+ }, di = class {
5102
5281
  constructor(e) {
5103
5282
  this.context = e, this.options = e.options, this._active = !1, this._textarea = null, this._disposers = [];
5104
5283
  }
@@ -5143,7 +5322,7 @@ var Gr = [
5143
5322
  return /^<[^/!][^>]*[^/]>/.test(r) && !t.test(r) && !/^<(br|hr|img|input|link|meta)/.test(r) && n++, i;
5144
5323
  }).filter(Boolean).join("\n");
5145
5324
  }
5146
- }, Yr = class {
5325
+ }, fi = class {
5147
5326
  constructor(e) {
5148
5327
  this.context = e, this._active = !1, this._disposers = [], this._prevHeight = "";
5149
5328
  }
@@ -5186,12 +5365,12 @@ var Gr = [
5186
5365
  this._disposers.forEach((e) => e()), this._disposers = [], this._dialog?.parentNode && this._dialog.remove(), this._dialog = null;
5187
5366
  }
5188
5367
  _saveRange() {
5189
- Se((e) => {
5368
+ Ce((e) => {
5190
5369
  this._savedRange = e;
5191
5370
  });
5192
5371
  }
5193
5372
  _open() {
5194
- this._dialog && (this._dialog.style.display = "flex", this._removeTrap = me(this._dialog, () => this._close()), setTimeout(() => this._firstInput?.focus(), 50));
5373
+ this._dialog && (this._dialog.style.display = "flex", this._removeTrap = he(this._dialog, () => this._close()), setTimeout(() => this._firstInput?.focus(), 50));
5195
5374
  }
5196
5375
  _close() {
5197
5376
  this._dialog && (this._dialog.style.display = "none"), this._removeTrap &&= (this._removeTrap(), null), this._savedRange = null;
@@ -5205,7 +5384,7 @@ var Gr = [
5205
5384
  }), i = w("div", { class: "an-dialog-box" }), a = w("div", { class: "an-dialog-header" }), o = w("span", { class: "an-dialog-icon" });
5206
5385
  o.innerHTML = t;
5207
5386
  let s = w("h3", { class: "an-dialog-title" });
5208
- s.textContent = n, a.appendChild(o), a.appendChild(s), i.appendChild(a), r.appendChild(i), he(a, i);
5387
+ s.textContent = n, a.appendChild(o), a.appendChild(s), i.appendChild(a), r.appendChild(i), ge(a, i);
5209
5388
  let c = E(r, "click", (e) => {
5210
5389
  e.target === r && this._close();
5211
5390
  });
@@ -5228,12 +5407,12 @@ var Gr = [
5228
5407
  let o = E(i, "click", n), s = E(a, "click", () => this._close());
5229
5408
  return this._disposers.push(o, s), r;
5230
5409
  }
5231
- }, Xr = "<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>", Zr = class extends W {
5410
+ }, pi = "<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>", mi = class extends W {
5232
5411
  show() {
5233
5412
  this._saveRange(), this._prefill(), this._open();
5234
5413
  }
5235
5414
  _buildDialog() {
5236
- let e = this.context.locale.linkDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, Xr, e.title), r = w("label", { class: "an-label" });
5415
+ let e = this.context.locale.linkDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, pi, e.title), r = w("label", { class: "an-label" });
5237
5416
  r.textContent = e.url;
5238
5417
  let i = w("input", {
5239
5418
  type: "url",
@@ -5303,12 +5482,12 @@ var Gr = [
5303
5482
  }
5304
5483
  this._savedRange && this._savedRange.select(), this.context.invoke("editor.insertLink", e, t, n), this._close();
5305
5484
  }
5306
- }, Qr = "<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>", $r = class extends W {
5485
+ }, hi = "<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>", gi = class extends W {
5307
5486
  show({ beforeInsert: e } = {}) {
5308
5487
  this._beforeInsert = typeof e == "function" ? e : null, this._saveRange(), this._urlInput.value = "", this._altInput.value = "", this._fileInput && (this._fileInput.value = ""), this._open();
5309
5488
  }
5310
5489
  _buildDialog() {
5311
- let e = this.context.locale.imageDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, Qr, e.title), r = w("label", { class: "an-label" });
5490
+ let e = this.context.locale.imageDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, hi, e.title), r = w("label", { class: "an-label" });
5312
5491
  r.textContent = e.imageUrl;
5313
5492
  let i = w("input", {
5314
5493
  type: "url",
@@ -5435,12 +5614,12 @@ var Gr = [
5435
5614
  _close() {
5436
5615
  this._beforeInsert = null, super._close();
5437
5616
  }
5438
- }, ei = "<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>", ti = class extends W {
5617
+ }, _i = "<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>", vi = class extends W {
5439
5618
  show() {
5440
5619
  this._saveRange(), this._urlInput.value = "", this._widthInput.value = "560", this._hintEl.textContent = "", this._open();
5441
5620
  }
5442
5621
  _buildDialog() {
5443
- let e = this.context.locale.videoDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, ei, e.title), r = w("label", { class: "an-label" });
5622
+ let e = this.context.locale.videoDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, _i, e.title), r = w("label", { class: "an-label" });
5444
5623
  r.textContent = e.videoUrl;
5445
5624
  let i = w("input", {
5446
5625
  type: "url",
@@ -5521,7 +5700,7 @@ var Gr = [
5521
5700
  let i = M(e, { media: !0 });
5522
5701
  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;
5523
5702
  }
5524
- }, ni = [
5703
+ }, yi = [
5525
5704
  {
5526
5705
  pos: "nw",
5527
5706
  cursor: "nw-resize"
@@ -5554,7 +5733,7 @@ var Gr = [
5554
5733
  pos: "w",
5555
5734
  cursor: "w-resize"
5556
5735
  }
5557
- ], ri = class {
5736
+ ], bi = class {
5558
5737
  constructor(e) {
5559
5738
  this.context = e, this._active = null, this._overlay = null, this._disposers = [], this._positionRaf = null, this._lastOverlayPos = null;
5560
5739
  }
@@ -5607,7 +5786,7 @@ var Gr = [
5607
5786
  }
5608
5787
  _buildOverlay() {
5609
5788
  let e = document.createElement("div");
5610
- return e.className = this._overlayClass, e.style.display = "none", ni.forEach(({ pos: t }) => {
5789
+ return e.className = this._overlayClass, e.style.display = "none", yi.forEach(({ pos: t }) => {
5611
5790
  let n = document.createElement("div");
5612
5791
  n.className = `an-resize-handle an-resize-${t}`, n.dataset.handle = t, this._disposers.push(E(n, "pointerdown", (e) => {
5613
5792
  e.preventDefault(), e.stopPropagation(), this._startResize(e, t);
@@ -5664,7 +5843,7 @@ var Gr = [
5664
5843
  };
5665
5844
  document.addEventListener("pointermove", p), document.addEventListener("pointerup", h), document.addEventListener("pointercancel", h), this._dragDisposers = [m];
5666
5845
  }
5667
- }, ii = class extends ri {
5846
+ }, xi = class extends bi {
5668
5847
  get _overlayClass() {
5669
5848
  return "an-image-resizer";
5670
5849
  }
@@ -5693,7 +5872,7 @@ var Gr = [
5693
5872
  getActiveImage() {
5694
5873
  return this._active;
5695
5874
  }
5696
- }, ai = class extends ri {
5875
+ }, Si = class extends bi {
5697
5876
  get _overlayClass() {
5698
5877
  return "an-video-resizer";
5699
5878
  }
@@ -5729,12 +5908,12 @@ var Gr = [
5729
5908
  getActiveWrapper() {
5730
5909
  return this._active;
5731
5910
  }
5732
- }, oi = {
5911
+ }, Ci = {
5733
5912
  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>",
5734
5913
  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>",
5735
5914
  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>",
5736
5915
  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>"
5737
- }, si = 120, ci = 200, li = class {
5916
+ }, wi = 120, Ti = 200, Ei = class {
5738
5917
  constructor(e) {
5739
5918
  this.context = e, this._el = null, this._activeAnchor = null, this._showTimer = null, this._hideTimer = null, this._disposers = [];
5740
5919
  }
@@ -5758,7 +5937,7 @@ var Gr = [
5758
5937
  role: "toolbar",
5759
5938
  "aria-label": e.ariaLabel
5760
5939
  });
5761
- 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(oi.open, e.openLink, () => this._openLink()), this._copyBtn = this._makeBtn(oi.copy, e.copyUrl, () => this._copyLink()), this._editBtn = this._makeBtn(oi.edit, e.editLink, () => this._editLink()), this._unlinkBtn = this._makeBtn(oi.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;
5940
+ 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(Ci.open, e.openLink, () => this._openLink()), this._copyBtn = this._makeBtn(Ci.copy, e.copyUrl, () => this._copyLink()), this._editBtn = this._makeBtn(Ci.edit, e.editLink, () => this._editLink()), this._unlinkBtn = this._makeBtn(Ci.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;
5762
5941
  }
5763
5942
  _makeBtn(e, t, n) {
5764
5943
  let r = w("button", {
@@ -5773,12 +5952,12 @@ var Gr = [
5773
5952
  _scheduleShow(e) {
5774
5953
  this._activeAnchor === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
5775
5954
  this._activeAnchor = e, this._show(e);
5776
- }, si));
5955
+ }, wi));
5777
5956
  }
5778
5957
  _scheduleHide() {
5779
5958
  clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => {
5780
5959
  this._hide();
5781
- }, ci));
5960
+ }, Ti));
5782
5961
  }
5783
5962
  _show(e) {
5784
5963
  let t = this.context.layoutInfo.container.classList.contains("an-disabled"), n = e.getAttribute("href") || "";
@@ -5827,7 +6006,7 @@ var Gr = [
5827
6006
  let t = globalThis.getSelection(), n = document.createRange();
5828
6007
  n.selectNode(e), t.removeAllRanges(), t.addRange(n), document.execCommand("unlink"), this.context.invoke("editor.afterCommand");
5829
6008
  }
5830
- }, ui = class {
6009
+ }, Di = class {
5831
6010
  constructor(e) {
5832
6011
  this.context = e, this.options = e.options, this._el = null, this._active = null, this._showTimer = null, this._hideTimer = null, this._disposers = [];
5833
6012
  }
@@ -5879,7 +6058,7 @@ var Gr = [
5879
6058
  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>",
5880
6059
  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>",
5881
6060
  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>"
5882
- }, di = class extends ui {
6061
+ }, Oi = class extends Di {
5883
6062
  initialize() {
5884
6063
  this._el = this._buildTooltip(), document.body.appendChild(this._el);
5885
6064
  let e = this.context.layoutInfo.editable;
@@ -5979,7 +6158,7 @@ var Gr = [
5979
6158
  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>",
5980
6159
  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>",
5981
6160
  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>"
5982
- }, fi = class extends ui {
6161
+ }, ki = class extends Di {
5983
6162
  initialize() {
5984
6163
  this._el = this._buildTooltip(), document.body.appendChild(this._el);
5985
6164
  let e = this.context.layoutInfo.editable;
@@ -6085,7 +6264,7 @@ var Gr = [
6085
6264
  };
6086
6265
  //#endregion
6087
6266
  //#region src/js/module/table-grid.js
6088
- function pi(e) {
6267
+ function Ai(e) {
6089
6268
  let t = e.closest("tr");
6090
6269
  if (!t) return -1;
6091
6270
  let n = 0;
@@ -6104,7 +6283,7 @@ function J(e, t) {
6104
6283
  }
6105
6284
  return null;
6106
6285
  }
6107
- function mi(e, t) {
6286
+ function ji(e, t) {
6108
6287
  let n = 0;
6109
6288
  for (let r of e.cells) if (n += r.colSpan || 1, n > t) {
6110
6289
  let e = r.nextElementSibling;
@@ -6112,7 +6291,7 @@ function mi(e, t) {
6112
6291
  }
6113
6292
  return null;
6114
6293
  }
6115
- function hi(e) {
6294
+ function Mi(e) {
6116
6295
  let t = Array.from(e.rows), n = {}, r = /* @__PURE__ */ new WeakMap();
6117
6296
  return t.forEach((e, t) => {
6118
6297
  n[t] || (n[t] = {});
@@ -6139,7 +6318,7 @@ function hi(e) {
6139
6318
  }
6140
6319
  //#endregion
6141
6320
  //#region src/js/module/TableTooltip.js
6142
- var gi = 120, _i = 200, vi = [
6321
+ var Ni = 120, Pi = 200, Fi = [
6143
6322
  "#000000",
6144
6323
  "#434343",
6145
6324
  "#666666",
@@ -6164,7 +6343,7 @@ var gi = 120, _i = 200, vi = [
6164
6343
  "#c9daf8",
6165
6344
  "#d9d2e9",
6166
6345
  "#ead1dc"
6167
- ], yi = class {
6346
+ ], Ii = class {
6168
6347
  constructor(e) {
6169
6348
  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;
6170
6349
  }
@@ -6222,7 +6401,7 @@ var gi = 120, _i = 200, vi = [
6222
6401
  });
6223
6402
  }), E(e, "mousedown", (e) => {
6224
6403
  if (!this.context.layoutInfo.container.classList.contains("an-disabled") && !(!t || !n)) {
6225
- if (r = !0, i = n, a = e.clientX, o = e.clientY, f = t.closest("table"), i === "col") l = pi(t) + (t.colSpan || 1) - 1, u = l >= 0 ? Array.from(f.querySelectorAll("tr")).map((e) => J(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";
6404
+ if (r = !0, i = n, a = e.clientX, o = e.clientY, f = t.closest("table"), i === "col") l = Ai(t) + (t.colSpan || 1) - 1, u = l >= 0 ? Array.from(f.querySelectorAll("tr")).map((e) => J(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";
6226
6405
  else {
6227
6406
  let e = t.closest("tr"), n = (e ? Array.from(f.rows).indexOf(e) : 0) + (t.rowSpan || 1) - 1;
6228
6407
  d = f.rows[n] || e, c = d ? d.offsetHeight : 40, document.body.style.cursor = "row-resize";
@@ -6294,10 +6473,10 @@ var gi = 120, _i = 200, vi = [
6294
6473
  _scheduleShow(e) {
6295
6474
  this._activeTable === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
6296
6475
  this._activeTable = e, this._show();
6297
- }, gi));
6476
+ }, Ni));
6298
6477
  }
6299
6478
  _scheduleHide() {
6300
- clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => this._hide(), _i));
6479
+ clearTimeout(this._showTimer), this._showTimer = null, !this._hideTimer && (this._hideTimer = setTimeout(() => this._hide(), Pi));
6301
6480
  }
6302
6481
  _show() {
6303
6482
  this._activeTable && (this._el.style.display = "flex", this._syncShadeStrip(), this._syncBorderColorStrip(), requestAnimationFrame(() => {
@@ -6346,7 +6525,7 @@ var gi = 120, _i = 200, vi = [
6346
6525
  if (!t || e === t) return [e];
6347
6526
  let n = e.closest("table");
6348
6527
  if (!n?.contains(t)) return [e];
6349
- let { gridMap: r, cellPos: i } = hi(n), a = i.get(e), o = i.get(t);
6528
+ let { gridMap: r, cellPos: i } = Mi(n), a = i.get(e), o = i.get(t);
6350
6529
  if (!a || !o) return [e];
6351
6530
  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;
6352
6531
  for (; d;) {
@@ -6394,7 +6573,7 @@ var gi = 120, _i = 200, vi = [
6394
6573
  if (!t.length) return;
6395
6574
  let n = t[0].closest("table");
6396
6575
  if (!n) return;
6397
- let r = t.map((e) => pi(e)), i = e === "left" ? Math.min(...r) : Math.max(...r), a = Array.from(n.querySelectorAll("tr")), o = a.map((t) => e === "left" ? J(t, i) : mi(t, i)), s = a.map((e) => e.closest("thead") !== null);
6576
+ let r = t.map((e) => Ai(e)), i = e === "left" ? Math.min(...r) : Math.max(...r), a = Array.from(n.querySelectorAll("tr")), o = a.map((t) => e === "left" ? J(t, i) : ji(t, i)), s = a.map((e) => e.closest("thead") !== null);
6398
6577
  a.forEach((e, t) => {
6399
6578
  e.insertBefore(w(s[t] ? "th" : "td", {}, ["\xA0"]), o[t]);
6400
6579
  }), requestAnimationFrame(() => this._positionNear(this._activeTable)), this.context.invoke("editor.afterCommand");
@@ -6414,7 +6593,7 @@ var gi = 120, _i = 200, vi = [
6414
6593
  if (!t) return;
6415
6594
  let n = Array.from(t.querySelectorAll("tr"));
6416
6595
  if (n[0] && n[0].cells.length <= 1) return;
6417
- let r = [...new Set(e.map((e) => pi(e)))];
6596
+ let r = [...new Set(e.map((e) => Ai(e)))];
6418
6597
  if (r.length >= (n[0]?.cells.length ?? 1)) return;
6419
6598
  let i = [];
6420
6599
  r.forEach((e) => {
@@ -6442,7 +6621,7 @@ var gi = 120, _i = 200, vi = [
6442
6621
  }
6443
6622
  }), n.length < 2) return;
6444
6623
  }
6445
- let { gridMap: r, cellPos: i } = hi(t), a = Infinity, o = -Infinity, s = Infinity, c = -Infinity;
6624
+ let { gridMap: r, cellPos: i } = Mi(t), a = Infinity, o = -Infinity, s = Infinity, c = -Infinity;
6446
6625
  if (n.forEach((e) => {
6447
6626
  let t = i.get(e);
6448
6627
  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));
@@ -6481,7 +6660,7 @@ var gi = 120, _i = 200, vi = [
6481
6660
  _unmergeOne(e, t) {
6482
6661
  let n = e.colSpan || 1, r = e.rowSpan || 1;
6483
6662
  if (n === 1 && r === 1) return;
6484
- let { cellPos: i } = hi(t), a = i.get(e);
6663
+ let { cellPos: i } = Mi(t), a = i.get(e);
6485
6664
  if (!a) return;
6486
6665
  let { r: o, c: s } = a, c = Array.from(t.rows), l = e.tagName.toLowerCase();
6487
6666
  if (e.rowSpan = 1, e.colSpan = 1, e.style.verticalAlign = "", n > 1) {
@@ -6568,7 +6747,7 @@ var gi = 120, _i = 200, vi = [
6568
6747
  let i = t.closest("table");
6569
6748
  if (i) {
6570
6749
  if (n) {
6571
- let t = [...new Set(r.map((e) => pi(e)))], n = Array.from(i.querySelectorAll("tr"));
6750
+ let t = [...new Set(r.map((e) => Ai(e)))], n = Array.from(i.querySelectorAll("tr"));
6572
6751
  t.forEach((t) => {
6573
6752
  n.forEach((n) => {
6574
6753
  let r = J(n, t);
@@ -6598,7 +6777,7 @@ var gi = 120, _i = 200, vi = [
6598
6777
  let a = w("div", { class: "an-size-popover-title" });
6599
6778
  i.appendChild(a);
6600
6779
  let o = w("div", { class: "an-context-color-palette" });
6601
- vi.forEach((e) => {
6780
+ Fi.forEach((e) => {
6602
6781
  let n = w("div", {
6603
6782
  class: "an-context-color-swatch",
6604
6783
  title: e
@@ -6718,7 +6897,7 @@ var gi = 120, _i = 200, vi = [
6718
6897
  if (!t) return;
6719
6898
  let n = this._getCell();
6720
6899
  if (!n) return;
6721
- let r = pi(n);
6900
+ let r = Ai(n);
6722
6901
  if (r === -1) return;
6723
6902
  let i = t.querySelector("tbody") || t, a = Array.from(i.querySelectorAll(":scope > tr"));
6724
6903
  a.length < 2 || (a.sort((t, n) => {
@@ -6743,13 +6922,23 @@ var gi = 120, _i = 200, vi = [
6743
6922
  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");
6744
6923
  i.href = r, i.download = "table.csv", i.style.display = "none", document.body.appendChild(i), i.click(), i.remove(), URL.revokeObjectURL(r);
6745
6924
  }
6746
- }, bi = 100, xi = 180, Si = /language-(\S+)/, Ci = {
6925
+ };
6926
+ //#endregion
6927
+ //#region src/js/core/externalAsset.js
6928
+ function Li(e, t = {}) {
6929
+ t.cspNonce && (e.nonce = t.cspNonce);
6930
+ let n = t.externalAssetCrossOrigin ?? "anonymous", r = t.externalAssetReferrerPolicy ?? "no-referrer";
6931
+ return n && (e.crossOrigin = n), r && (e.referrerPolicy = r), e;
6932
+ }
6933
+ //#endregion
6934
+ //#region src/js/module/CodeTooltip.js
6935
+ var Ri = 100, zi = 180, Bi = /language-(\S+)/, Vi = {
6747
6936
  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>",
6748
6937
  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>",
6749
6938
  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>",
6750
6939
  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>",
6751
6940
  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>"
6752
- }, wi = [
6941
+ }, Hi = [
6753
6942
  ["", "Plain text"],
6754
6943
  ["javascript", "JavaScript"],
6755
6944
  ["typescript", "TypeScript"],
@@ -6774,14 +6963,14 @@ var gi = 120, _i = 200, vi = [
6774
6963
  ["kotlin", "Kotlin"],
6775
6964
  ["swift", "Swift"]
6776
6965
  ];
6777
- function Ti(e, t) {
6966
+ function Ui(e, t) {
6778
6967
  [...e.classList].forEach((t) => {
6779
6968
  t.startsWith("language-") && e.classList.remove(t);
6780
6969
  }), t && e.classList.add(`language-${t}`);
6781
6970
  }
6782
- var Ei = class {
6971
+ var Wi = class {
6783
6972
  constructor(e) {
6784
- 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;
6973
+ 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, this._asyncDisposers = [];
6785
6974
  }
6786
6975
  initialize() {
6787
6976
  this._el = this._buildTooltip(), document.body.appendChild(this._el), this._ensurePrism();
@@ -6799,7 +6988,7 @@ var Ei = class {
6799
6988
  })), this;
6800
6989
  }
6801
6990
  destroy() {
6802
- this._clearTimers(), this._disposers.forEach((e) => e()), this._disposers = [], this._el?.remove(), this._el = null;
6991
+ this._clearTimers(), this._asyncDisposers.forEach((e) => e()), this._asyncDisposers = [], this._disposers.forEach((e) => e()), this._disposers = [], this._el?.remove(), this._el = null;
6803
6992
  }
6804
6993
  _buildTooltip() {
6805
6994
  let e = this.context.locale.tooltips.code, t = w("div", {
@@ -6811,10 +7000,10 @@ var Ei = class {
6811
7000
  class: "an-code-lang-select",
6812
7001
  title: e.syntaxLanguage,
6813
7002
  "aria-label": e.syntaxAriaLabel
6814
- }), wi.forEach(([e, t]) => {
7003
+ }), Hi.forEach(([e, t]) => {
6815
7004
  let n = w("option", { value: e });
6816
7005
  n.textContent = t, this._langSelect.appendChild(n);
6817
- }), this._disposers.push(E(this._langSelect, "change", () => this._onLangChange())), t.appendChild(this._langSelect), t.appendChild(this._sep()), this._copyBtn = this._makeBtn(Ci.copy, e.copyCode, () => this._copyCode()), t.appendChild(this._copyBtn), t.appendChild(this._sep()), this._wrapBtn = this._makeBtn(Ci.wrapOn, e.toggleWordWrap, () => this._toggleWrap()), t.appendChild(this._wrapBtn), this._lineNumbersBtn = this._makeBtn(Ci.lineNumbers, e.lineNumbers, () => this._toggleLineNumbers()), t.appendChild(this._lineNumbersBtn), t.appendChild(this._sep()), t.appendChild(this._makeBtn(Ci.toParagraph, e.convertToParagraph, () => this._toParagraph())), t.appendChild(this._sep()), t.appendChild(this._makeBtn(Ci.deleteCode, e.deleteCodeBlock, () => this._delete(), !0)), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
7006
+ }), this._disposers.push(E(this._langSelect, "change", () => this._onLangChange())), t.appendChild(this._langSelect), t.appendChild(this._sep()), this._copyBtn = this._makeBtn(Vi.copy, e.copyCode, () => this._copyCode()), t.appendChild(this._copyBtn), t.appendChild(this._sep()), this._wrapBtn = this._makeBtn(Vi.wrapOn, e.toggleWordWrap, () => this._toggleWrap()), t.appendChild(this._wrapBtn), this._lineNumbersBtn = this._makeBtn(Vi.lineNumbers, e.lineNumbers, () => this._toggleLineNumbers()), t.appendChild(this._lineNumbersBtn), t.appendChild(this._sep()), t.appendChild(this._makeBtn(Vi.toParagraph, e.convertToParagraph, () => this._toParagraph())), t.appendChild(this._sep()), t.appendChild(this._makeBtn(Vi.deleteCode, e.deleteCodeBlock, () => this._delete(), !0)), this._disposers.push(E(t, "mouseenter", () => this._clearTimers()), E(t, "mouseleave", () => this._scheduleHide())), t;
6818
7007
  }
6819
7008
  _sep() {
6820
7009
  return w("div", { class: "an-link-tooltip-sep" });
@@ -6832,10 +7021,10 @@ var Ei = class {
6832
7021
  _scheduleShow(e) {
6833
7022
  this._activePre === e && this._el.style.display !== "none" || (clearTimeout(this._hideTimer), this._hideTimer = null, clearTimeout(this._showTimer), this._showTimer = setTimeout(() => {
6834
7023
  this._activePre = e, this._syncWrapBtn(), this._syncLineNumbersBtn(), this._syncLangSelect(), this._show(e);
6835
- }, bi));
7024
+ }, Ri));
6836
7025
  }
6837
7026
  _scheduleHide() {
6838
- clearTimeout(this._showTimer), this._showTimer = null, clearTimeout(this._hideTimer), this._hideTimer = setTimeout(() => this._hide(), xi);
7027
+ clearTimeout(this._showTimer), this._showTimer = null, clearTimeout(this._hideTimer), this._hideTimer = setTimeout(() => this._hide(), zi);
6839
7028
  }
6840
7029
  _show(e) {
6841
7030
  this._el.style.display = "flex", this._positionNear(e);
@@ -6862,7 +7051,7 @@ var Ei = class {
6862
7051
  }
6863
7052
  _syncLangSelect() {
6864
7053
  if (!this._activePre || !this._langSelect) return;
6865
- let e = this._activePre.querySelector("code"), t = this._activePre.dataset.language || "", n = e && (Si.exec(e.className) || [])[1] || "";
7054
+ let e = this._activePre.querySelector("code"), t = this._activePre.dataset.language || "", n = e && (Bi.exec(e.className) || [])[1] || "";
6866
7055
  this._langSelect.value = t || n || "";
6867
7056
  }
6868
7057
  _copyCode() {
@@ -6905,9 +7094,9 @@ var Ei = class {
6905
7094
  let e = this._activePre;
6906
7095
  if (!e) return;
6907
7096
  let t = this._langSelect.value, n = globalThis, r = e.querySelector("code");
6908
- r || (r = document.createElement("code"), r.innerHTML = e.innerHTML, e.innerHTML = "", e.appendChild(r)), Ti(r, t), Ti(e, t), t ? e.dataset.language = t : delete e.dataset.language;
7097
+ r || (r = document.createElement("code"), r.innerHTML = e.innerHTML, e.innerHTML = "", e.appendChild(r)), Ui(r, t), Ui(e, t), t ? e.dataset.language = t : delete e.dataset.language;
6909
7098
  let i = () => {
6910
- r.querySelectorAll("br").forEach((e) => e.replaceWith("\n")), n.Prism.highlightElement(r), this.context.invoke("editor.afterCommand");
7099
+ !this.context._alive || !r.isConnected || !n.Prism || (r.querySelectorAll("br").forEach((e) => e.replaceWith("\n")), n.Prism.highlightElement(r), this.context.invoke("editor.afterCommand"));
6911
7100
  };
6912
7101
  if (t) {
6913
7102
  if (n.Prism !== void 0) {
@@ -6918,21 +7107,24 @@ var Ei = class {
6918
7107
  this._loadPrismComponent(t, i);
6919
7108
  return;
6920
7109
  } else if (this._prismScript) {
6921
- this._prismScript.addEventListener("load", () => {
7110
+ this._onScriptLoad(this._prismScript, () => {
6922
7111
  n.Prism.languages[t] ? i() : this._loadPrismComponent(t, i);
6923
- }, { once: !0 });
7112
+ });
6924
7113
  return;
6925
7114
  }
6926
7115
  }
6927
7116
  this.context.invoke("editor.afterCommand");
6928
7117
  }
7118
+ _cdnBase() {
7119
+ return String(this.context.options.codeHighlightCDN ?? "").replace(/\/+$/, "");
7120
+ }
6929
7121
  _ensurePrism() {
6930
7122
  let e = globalThis;
6931
7123
  if (!this.context.options.codeHighlight || e.Prism) return;
6932
- let t = this.context.options.codeHighlightCDN, n = `${t}/themes/prism-tomorrow.min.css`, r = `${t}/prism.min.js`;
7124
+ let t = this._cdnBase(), n = `${t}/themes/prism-tomorrow.min.css`, r = `${t}/prism.min.js`;
6933
7125
  if (!document.querySelector(`link[href="${n}"]`)) {
6934
7126
  let e = document.createElement("link");
6935
- e.rel = "stylesheet", e.href = n, document.head.appendChild(e);
7127
+ e.rel = "stylesheet", e.href = n, Li(e, this.context.options), document.head.appendChild(e);
6936
7128
  }
6937
7129
  let i = document.querySelector(`script[src="${r}"]`);
6938
7130
  if (i) {
@@ -6940,21 +7132,33 @@ var Ei = class {
6940
7132
  return;
6941
7133
  }
6942
7134
  let a = document.createElement("script");
6943
- a.dataset.manual = "", a.src = r, this._prismScript = a, a.addEventListener("load", () => {
7135
+ a.dataset.manual = "", a.src = r, Li(a, this.context.options), this._prismScript = a, this._onScriptLoad(a, () => {
6944
7136
  this._prismScript = null;
6945
- }, { once: !0 }), document.head.appendChild(a);
7137
+ }), document.head.appendChild(a);
7138
+ }
7139
+ _onScriptLoad(e, t) {
7140
+ let n = () => {
7141
+ this.context._alive && t();
7142
+ };
7143
+ e.addEventListener("load", n, { once: !0 }), this._asyncDisposers.push(() => e.removeEventListener("load", n));
6946
7144
  }
6947
7145
  _loadPrismComponent(e, t) {
6948
- let n = globalThis, r = `${this.context.options.codeHighlightCDN}/components/prism-${e}.min.js`;
7146
+ let n = globalThis, r = `${this._cdnBase()}/components/prism-${e}.min.js`;
6949
7147
  if (document.querySelector(`script[src="${r}"]`)) {
6950
7148
  let r = setInterval(() => {
7149
+ if (!this.context._alive) {
7150
+ clearInterval(r);
7151
+ return;
7152
+ }
6951
7153
  n.Prism?.languages[e] && (clearInterval(r), t());
6952
- }, 50);
6953
- setTimeout(() => clearInterval(r), 3e3);
7154
+ }, 50), i = setTimeout(() => clearInterval(r), 3e3);
7155
+ this._asyncDisposers.push(() => {
7156
+ clearInterval(r), clearTimeout(i);
7157
+ });
6954
7158
  return;
6955
7159
  }
6956
7160
  let i = document.createElement("script");
6957
- i.src = r, i.addEventListener("load", t, { once: !0 }), document.head.appendChild(i);
7161
+ i.src = r, Li(i, this.context.options), this._onScriptLoad(i, t), document.head.appendChild(i);
6958
7162
  }
6959
7163
  _toParagraph() {
6960
7164
  let e = this._activePre;
@@ -6968,21 +7172,21 @@ var Ei = class {
6968
7172
  let e = this._activePre;
6969
7173
  e && (this._hide(), e.remove(), this.context.invoke("editor.afterCommand"));
6970
7174
  }
6971
- }, Di = null, Oi = null;
6972
- function ki() {
6973
- return Di ? Promise.resolve(Di) : (Oi ??= import("./emoji-data-BDQX5kh-.js").then((e) => (Di = {
7175
+ }, Gi = null, Ki = null;
7176
+ function qi() {
7177
+ return Gi ? Promise.resolve(Gi) : (Ki ??= import("./emoji-data-BDQX5kh-.js").then((e) => (Gi = {
6974
7178
  EMOJI_CATS: e.EMOJI_CATS,
6975
7179
  EMOJI_LIST: e.EMOJI_LIST
6976
- }, Di)), Oi);
7180
+ }, Gi)), Ki);
6977
7181
  }
6978
- var Ai = class extends W {
7182
+ var Ji = class extends W {
6979
7183
  _activeCat = "all";
6980
7184
  initialize() {
6981
7185
  return this;
6982
7186
  }
6983
7187
  async show() {
6984
7188
  if (this._saveRange(), !this._dialog) {
6985
- let { EMOJI_CATS: e, EMOJI_LIST: t } = await ki();
7189
+ let { EMOJI_CATS: e, EMOJI_LIST: t } = await qi();
6986
7190
  this._dialog || (this._cats = e, this._list = t, this._dialog = this._buildDialog(), document.body.appendChild(this._dialog));
6987
7191
  }
6988
7192
  this._activeCat = "all", this._searchInput.value = "", this._updateCatTabs(), this._filterEmojis("", "all"), this._open();
@@ -7039,7 +7243,7 @@ var Ai = class extends W {
7039
7243
  type: "button",
7040
7244
  class: "an-btn"
7041
7245
  });
7042
- p.textContent = e.cancelBtn, f.appendChild(p), n.append(r, c, l, d, f), t.appendChild(n), he(r, n);
7246
+ p.textContent = e.cancelBtn, f.appendChild(p), n.append(r, c, l, d, f), t.appendChild(n), ge(r, n);
7043
7247
  let m = E(s, "click", () => this._close()), h = E(p, "click", () => this._close()), g = E(t, "click", (e) => {
7044
7248
  e.target === t && this._close();
7045
7249
  }), _ = E(c, "input", () => this._filterEmojis(c.value, this._activeCat)), v = E(l, "click", (e) => {
@@ -7075,14 +7279,14 @@ var Ai = class extends W {
7075
7279
  let s = document.createTextNode(e);
7076
7280
  i.insertNode(s), i.setStartAfter(s), i.collapse(!0), r && (r.removeAllRanges(), r.addRange(i)), this._close(), n.focus(), this.context.invoke("editor.afterCommand");
7077
7281
  }
7078
- }, ji = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css", Mi = null, Ni = null;
7079
- function Pi() {
7080
- return Mi ? Promise.resolve(Mi) : (Ni ??= import("./icon-data-V0Xqv-wX.js").then((e) => (Mi = {
7282
+ }, Yi = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css", Xi = null, Zi = null;
7283
+ function Qi() {
7284
+ return Xi ? Promise.resolve(Xi) : (Zi ??= import("./icon-data-V0Xqv-wX.js").then((e) => (Xi = {
7081
7285
  ICON_CATEGORIES: e.ICON_CATEGORIES,
7082
7286
  ICON_LIST: e.ICON_LIST
7083
- }, Mi)), Ni);
7287
+ }, Xi)), Zi);
7084
7288
  }
7085
- var Fi = class extends W {
7289
+ var $i = class extends W {
7086
7290
  _selectedIcon = null;
7087
7291
  _activeCat = "all";
7088
7292
  initialize() {
@@ -7090,16 +7294,16 @@ var Fi = class extends W {
7090
7294
  }
7091
7295
  _ensureFontAwesome() {
7092
7296
  if (this.context.options.fontAwesomeAutoInject === !1) return;
7093
- let e = this.context.options.fontAwesomeCDN || ji;
7297
+ let e = this.context.options.fontAwesomeCDN || Yi;
7094
7298
  if (!e || document.getElementById("an-fontawesome-css")) return;
7095
7299
  let t = Array.from(document.querySelectorAll("link[rel=\"stylesheet\"]")).map((e) => e.href || "").join(" ");
7096
7300
  if (/fontawesome|font-awesome/.test(t) || document.querySelector(".fa-solid, .fas, .far, .fab")) return;
7097
7301
  let n = document.createElement("link");
7098
- n.id = "an-fontawesome-css", n.rel = "stylesheet", n.href = e, n.crossOrigin = "anonymous", n.referrerPolicy = "no-referrer", document.head.appendChild(n);
7302
+ n.id = "an-fontawesome-css", n.rel = "stylesheet", n.href = e, Li(n, this.context.options), document.head.appendChild(n);
7099
7303
  }
7100
7304
  async show() {
7101
7305
  if (this._saveRange(), this._ensureFontAwesome(), !this._dialog) {
7102
- let { ICON_CATEGORIES: e, ICON_LIST: t } = await Pi();
7306
+ let { ICON_CATEGORIES: e, ICON_LIST: t } = await Qi();
7103
7307
  this._dialog || (this._cats = e, this._list = t, this._dialog = this._buildDialog(), document.body.appendChild(this._dialog));
7104
7308
  }
7105
7309
  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();
@@ -7205,7 +7409,7 @@ var Fi = class extends W {
7205
7409
  type: "button",
7206
7410
  class: "an-btn"
7207
7411
  });
7208
- 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);
7412
+ C.textContent = e.cancelBtn, te.append(S, C), this._insertBtn = S, n.append(r, c, l, d, f, x, te), t.appendChild(n), ge(r, n);
7209
7413
  let ne = E(s, "click", () => this._close()), re = E(C, "click", () => this._close()), ie = E(S, "click", () => this._onInsert()), ae = E(t, "click", (e) => {
7210
7414
  e.target === t && this._close();
7211
7415
  }), T = E(c, "input", () => this._filterIcons(c.value, this._activeCat)), oe = E(l, "click", (e) => {
@@ -7263,7 +7467,7 @@ var Fi = class extends W {
7263
7467
  _close() {
7264
7468
  this._selectedIcon = null, super._close();
7265
7469
  }
7266
- }, Ii = [
7470
+ }, ea = [
7267
7471
  {
7268
7472
  category: "Text Formatting",
7269
7473
  items: [
@@ -7336,12 +7540,12 @@ var Fi = class extends W {
7336
7540
  action: "Show this keyboard shortcuts dialog"
7337
7541
  }]
7338
7542
  }
7339
- ], Li = "<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>", Ri = class extends W {
7543
+ ], ta = "<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>", na = class extends W {
7340
7544
  show() {
7341
7545
  this._open();
7342
7546
  }
7343
7547
  _buildDialog() {
7344
- let e = this.context.locale.shortcutsDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, Li, e.title);
7548
+ let e = this.context.locale.shortcutsDialog, { overlay: t, box: n } = this._buildDialogShell(e.ariaLabel, ta, e.title);
7345
7549
  n.classList.add("an-shortcuts-box");
7346
7550
  let r = w("button", {
7347
7551
  type: "button",
@@ -7349,7 +7553,7 @@ var Fi = class extends W {
7349
7553
  "aria-label": e.close,
7350
7554
  style: "margin-left:auto"
7351
7555
  });
7352
- r.textContent = "×", this._closeBtn = r, this._firstInput = r, n.querySelector(".an-dialog-header").appendChild(r), (this.context.locale.shortcutsDialog.shortcuts || Ii).forEach(({ category: e, items: t }) => {
7556
+ r.textContent = "×", this._closeBtn = r, this._firstInput = r, n.querySelector(".an-dialog-header").appendChild(r), (this.context.locale.shortcutsDialog.shortcuts || ea).forEach(({ category: e, items: t }) => {
7353
7557
  let r = w("div", { class: "an-shortcuts-cat" });
7354
7558
  r.textContent = e, n.appendChild(r);
7355
7559
  let i = w("div", { class: "an-shortcuts-table" });
@@ -7363,7 +7567,7 @@ var Fi = class extends W {
7363
7567
  let i = E(r, "click", () => this._close());
7364
7568
  return this._disposers.push(i), t;
7365
7569
  }
7366
- }, zi = class extends W {
7570
+ }, ra = class extends W {
7367
7571
  constructor(e) {
7368
7572
  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;
7369
7573
  }
@@ -7381,7 +7585,7 @@ var Fi = class extends W {
7381
7585
  this._findInput && this._findInput.focus();
7382
7586
  return;
7383
7587
  }
7384
- this._dialog.style.display = "flex", this._removeTrap &&= (this._removeTrap(), null), this._removeTrap = me(this._dialog, () => this._close());
7588
+ this._dialog.style.display = "flex", this._removeTrap &&= (this._removeTrap(), null), this._removeTrap = he(this._dialog, () => this._close());
7385
7589
  }
7386
7590
  }
7387
7591
  _close() {
@@ -7479,7 +7683,7 @@ var Fi = class extends W {
7479
7683
  });
7480
7684
  b.textContent = e.replaceAllBtn, _.append(v, y, b), n.appendChild(_);
7481
7685
  let x = w("div", { class: "an-fr-replace-actions" });
7482
- x.style.display = "none", n.appendChild(x), t.appendChild(n), he(r, n);
7686
+ x.style.display = "none", n.appendChild(x), t.appendChild(n), ge(r, n);
7483
7687
  let ee = E(s, "click", () => this._close()), te = E(t, "click", (e) => {
7484
7688
  e.target === t && this._close();
7485
7689
  }), S = E(l, "input", () => this._onSearch()), C = E(d, "click", () => {
@@ -7606,8 +7810,8 @@ var Fi = class extends W {
7606
7810
  this._counterEl.textContent = e ? this.context.locale.findReplace.noResults : "";
7607
7811
  } else this._counterEl.textContent = `${this._currentIndex + 1} / ${e}`;
7608
7812
  }
7609
- }, Y = 20, Bi = "#3b82f6", X = (e, t, n) => Math.min(Math.max(e, t), n);
7610
- function Vi(e, t, n, r) {
7813
+ }, Y = 20, ia = "#3b82f6", X = (e, t, n) => Math.min(Math.max(e, t), n);
7814
+ function aa(e, t, n, r) {
7611
7815
  return new Promise((i) => {
7612
7816
  let a = (e) => {
7613
7817
  let a = document.createElement("canvas");
@@ -7631,7 +7835,7 @@ function Vi(e, t, n, r) {
7631
7835
  o.crossOrigin = "anonymous", o.onload = () => a(o), o.onerror = () => i(null), o.src = e.src + (e.src.includes("?") ? "&" : "?") + "_an=" + Date.now();
7632
7836
  });
7633
7837
  }
7634
- var Hi = class {
7838
+ var oa = class {
7635
7839
  constructor(e) {
7636
7840
  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 = [];
7637
7841
  }
@@ -7662,7 +7866,7 @@ var Hi = class {
7662
7866
  t.className = "an-crop-box", t.style.cssText = `
7663
7867
  position:fixed; z-index:10101;
7664
7868
  box-sizing:border-box;
7665
- border:2px solid ${Bi};
7869
+ border:2px solid ${ia};
7666
7870
  cursor:move;
7667
7871
  outline: none;
7668
7872
  `;
@@ -7727,7 +7931,7 @@ var Hi = class {
7727
7931
  "position:absolute",
7728
7932
  "width:10px",
7729
7933
  "height:10px",
7730
- `background:${Bi}`,
7934
+ `background:${ia}`,
7731
7935
  "border:2px solid #fff",
7732
7936
  "border-radius:2px",
7733
7937
  "box-sizing:border-box",
@@ -7761,7 +7965,7 @@ var Hi = class {
7761
7965
  let a = this._makeToolbarBtn("✓ Crop", "#22c55e", () => this._confirm()), o = this._makeToolbarBtn("✕ Cancel", "#94a3b8", () => this._close(!1)), s = document.createElement("label");
7762
7966
  s.style.cssText = "color:#94a3b8;font-size:11px;cursor:pointer;display:flex;align-items:center;gap:4px;";
7763
7967
  let c = document.createElement("input");
7764
- c.type = "checkbox", c.style.accentColor = Bi, 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;
7968
+ c.type = "checkbox", c.style.accentColor = ia, 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;
7765
7969
  }
7766
7970
  _makeToolbarBtn(e, t, n) {
7767
7971
  let r = document.createElement("button");
@@ -7846,7 +8050,7 @@ var Hi = class {
7846
8050
  this._close(!1);
7847
8051
  return;
7848
8052
  }
7849
- let f = await Vi(e, {
8053
+ let f = await aa(e, {
7850
8054
  x: c,
7851
8055
  y: l,
7852
8056
  width: u,
@@ -7890,7 +8094,7 @@ var Hi = class {
7890
8094
  e?.remove();
7891
8095
  }), 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;
7892
8096
  }
7893
- }, Ui = class {
8097
+ }, sa = class {
7894
8098
  constructor(e) {
7895
8099
  this.context = e, this.options = e.options, this._banner = null;
7896
8100
  }
@@ -7943,7 +8147,7 @@ var Hi = class {
7943
8147
  _removeBanner() {
7944
8148
  this._banner?.remove(), this._banner = null;
7945
8149
  }
7946
- }, Wi = class {
8150
+ }, ca = class {
7947
8151
  constructor(e) {
7948
8152
  this.context = e, this.options = e.options, this._disposers = [];
7949
8153
  }
@@ -8089,7 +8293,7 @@ var Hi = class {
8089
8293
  break;
8090
8294
  }
8091
8295
  }
8092
- }, Gi = [
8296
+ }, la = [
8093
8297
  "#000000",
8094
8298
  "#434343",
8095
8299
  "#666666",
@@ -8114,7 +8318,7 @@ var Hi = class {
8114
8318
  "#c9daf8",
8115
8319
  "#d9d2e9",
8116
8320
  "#ead1dc"
8117
- ], Ki = "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" ${Ki} style="display:block">${e}</svg>`, qi = {
8321
+ ], ua = "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" ${ua} style="display:block">${e}</svg>`, da = {
8118
8322
  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\"/>"),
8119
8323
  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\"/>"),
8120
8324
  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\"/>"),
@@ -8124,7 +8328,7 @@ var Hi = class {
8124
8328
  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\"/>"),
8125
8329
  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\"/>"),
8126
8330
  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\"/>")
8127
- }, Ji = {
8331
+ }, fa = {
8128
8332
  bold: (e) => e.invoke("editor.bold"),
8129
8333
  italic: (e) => e.invoke("editor.italic"),
8130
8334
  underline: (e) => e.invoke("editor.underline"),
@@ -8145,115 +8349,115 @@ var Hi = class {
8145
8349
  e.invoke("editor.afterCommand");
8146
8350
  },
8147
8351
  inlineCode: (e) => e.invoke("editor.inlineCode")
8148
- }, Yi = {
8352
+ }, pa = {
8149
8353
  bold: () => document.queryCommandState("bold"),
8150
8354
  italic: () => document.queryCommandState("italic"),
8151
8355
  underline: () => document.queryCommandState("underline"),
8152
8356
  strikethrough: () => document.queryCommandState("strikeThrough")
8153
- }, Xi = {
8357
+ }, ma = {
8154
8358
  foreColor: !0,
8155
8359
  hiliteColor: !0
8156
- }, Zi = [
8360
+ }, ha = [
8157
8361
  {
8158
8362
  name: "editor",
8159
- Class: Mr
8363
+ Class: Yr
8160
8364
  },
8161
8365
  {
8162
8366
  name: "toolbar",
8163
- Class: Lr
8367
+ Class: ei
8164
8368
  },
8165
8369
  {
8166
8370
  name: "statusbar",
8167
- Class: Vr
8371
+ Class: ni
8168
8372
  },
8169
8373
  {
8170
8374
  name: "clipboard",
8171
- Class: Hr
8375
+ Class: ri
8172
8376
  },
8173
8377
  {
8174
8378
  name: "placeholder",
8175
- Class: qr
8379
+ Class: ui
8176
8380
  },
8177
8381
  {
8178
8382
  name: "contextMenu",
8179
- Class: Kr
8383
+ Class: si
8180
8384
  },
8181
8385
  {
8182
8386
  name: "codeview",
8183
- Class: Jr
8387
+ Class: di
8184
8388
  },
8185
8389
  {
8186
8390
  name: "fullscreen",
8187
- Class: Yr
8391
+ Class: fi
8188
8392
  },
8189
8393
  {
8190
8394
  name: "linkDialog",
8191
- Class: Zr
8395
+ Class: mi
8192
8396
  },
8193
8397
  {
8194
8398
  name: "imageDialog",
8195
- Class: $r
8399
+ Class: gi
8196
8400
  },
8197
8401
  {
8198
8402
  name: "videoDialog",
8199
- Class: ti
8403
+ Class: vi
8200
8404
  },
8201
8405
  {
8202
8406
  name: "imageResizer",
8203
- Class: ii
8407
+ Class: xi
8204
8408
  },
8205
8409
  {
8206
8410
  name: "videoResizer",
8207
- Class: ai
8411
+ Class: Si
8208
8412
  },
8209
8413
  {
8210
8414
  name: "linkTooltip",
8211
- Class: li
8415
+ Class: Ei
8212
8416
  },
8213
8417
  {
8214
8418
  name: "imageTooltip",
8215
- Class: di
8419
+ Class: Oi
8216
8420
  },
8217
8421
  {
8218
8422
  name: "videoTooltip",
8219
- Class: fi
8423
+ Class: ki
8220
8424
  },
8221
8425
  {
8222
8426
  name: "tableTooltip",
8223
- Class: yi
8427
+ Class: Ii
8224
8428
  },
8225
8429
  {
8226
8430
  name: "codeTooltip",
8227
- Class: Ei
8431
+ Class: Wi
8228
8432
  },
8229
8433
  {
8230
8434
  name: "emojiDialog",
8231
- Class: Ai
8435
+ Class: Ji
8232
8436
  },
8233
8437
  {
8234
8438
  name: "iconDialog",
8235
- Class: Fi
8439
+ Class: $i
8236
8440
  },
8237
8441
  {
8238
8442
  name: "shortcutsDialog",
8239
- Class: Ri
8443
+ Class: na
8240
8444
  },
8241
8445
  {
8242
8446
  name: "findReplace",
8243
- Class: zi
8447
+ Class: ra
8244
8448
  },
8245
8449
  {
8246
8450
  name: "imageCropOverlay",
8247
- Class: Hi
8451
+ Class: oa
8248
8452
  },
8249
8453
  {
8250
8454
  name: "autoSaveRestore",
8251
- Class: Ui,
8455
+ Class: sa,
8252
8456
  enabled: (e) => !!e.autoSaveRestore
8253
8457
  },
8254
8458
  {
8255
8459
  name: "markdownShortcuts",
8256
- Class: Wi,
8460
+ Class: ca,
8257
8461
  enabled: (e) => e.markdownShortcuts !== !1
8258
8462
  },
8259
8463
  {
@@ -8288,23 +8492,23 @@ var Hi = class {
8288
8492
  "removeFormat"
8289
8493
  ];
8290
8494
  for (let n of t) {
8291
- if (!qi[n]) continue;
8495
+ if (!da[n]) continue;
8292
8496
  let t = document.createElement("button");
8293
- if (t.type = "button", t.dataset.name = n, t.setAttribute("aria-label", n), Xi[n]) {
8497
+ if (t.type = "button", t.dataset.name = n, t.setAttribute("aria-label", n), ma[n]) {
8294
8498
  t.className = "an-bubble-btn an-bubble-btn--color";
8295
8499
  let e = document.createElement("span");
8296
- e.className = "an-bubble-btn-svg", e.innerHTML = qi[n];
8500
+ e.className = "an-bubble-btn-svg", e.innerHTML = da[n];
8297
8501
  let r = document.createElement("span");
8298
8502
  r.className = "an-bubble-color-strip", r.style.background = n === "foreColor" ? "#000000" : "transparent", t.appendChild(e), t.appendChild(r);
8299
- } else t.className = "an-bubble-btn", t.innerHTML = qi[n];
8503
+ } else t.className = "an-bubble-btn", t.innerHTML = da[n];
8300
8504
  t.addEventListener("mousedown", (e) => {
8301
8505
  e.preventDefault();
8302
8506
  }), t.addEventListener("click", (e) => {
8303
- if (e.preventDefault(), e.stopPropagation(), Xi[n]) {
8507
+ if (e.preventDefault(), e.stopPropagation(), ma[n]) {
8304
8508
  this._openColorPicker(n, t);
8305
8509
  return;
8306
8510
  }
8307
- this.context.invoke("editor.focus"), Ji[n] && Ji[n](this.context), this._syncActive();
8511
+ this.context.invoke("editor.focus"), fa[n] && fa[n](this.context), this._syncActive();
8308
8512
  }), e.appendChild(t);
8309
8513
  }
8310
8514
  document.body.appendChild(e), this._el = e, this._btnCache = Array.from(e.querySelectorAll(".an-bubble-btn"));
@@ -8313,7 +8517,7 @@ var Hi = class {
8313
8517
  let e = document.createElement("div");
8314
8518
  e.className = "an-bubble-color-picker", e.style.display = "none", e.addEventListener("mousedown", (e) => e.preventDefault());
8315
8519
  let t = document.createElement("div");
8316
- t.className = "an-context-color-palette", Gi.forEach((e) => {
8520
+ t.className = "an-context-color-palette", la.forEach((e) => {
8317
8521
  let n = document.createElement("div");
8318
8522
  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) => {
8319
8523
  t.stopPropagation(), this._applyColor(this._pickerType, e);
@@ -8381,7 +8585,7 @@ var Hi = class {
8381
8585
  }
8382
8586
  _syncActive() {
8383
8587
  this._btnCache && this._btnCache.forEach((e) => {
8384
- let t = Yi[e.dataset.name];
8588
+ let t = pa[e.dataset.name];
8385
8589
  e.classList.toggle("an-active", !!t?.());
8386
8590
  });
8387
8591
  }
@@ -8817,42 +9021,42 @@ var Hi = class {
8817
9021
  },
8818
9022
  enabled: (e) => e.slashMenu !== !1
8819
9023
  }
8820
- ];
9024
+ ], ga = "2.7.0";
8821
9025
  //#endregion
8822
9026
  //#region src/js/core/lists.js
8823
- function Qi(e) {
9027
+ function _a(e) {
8824
9028
  return e[e.length - 1];
8825
9029
  }
8826
- function $i(e) {
9030
+ function va(e) {
8827
9031
  return e[0];
8828
9032
  }
8829
- function ea(e, t = 1) {
9033
+ function ya(e, t = 1) {
8830
9034
  return e.slice(0, e.length - t);
8831
9035
  }
8832
- function ta(e, t = 1) {
9036
+ function ba(e, t = 1) {
8833
9037
  return e.slice(t);
8834
9038
  }
8835
- function na(e) {
9039
+ function xa(e) {
8836
9040
  return e.flat();
8837
9041
  }
8838
- function ra(e) {
9042
+ function Sa(e) {
8839
9043
  return [...new Set(e)];
8840
9044
  }
8841
- function ia(e, t) {
9045
+ function Ca(e, t) {
8842
9046
  let n = [];
8843
9047
  for (let r = 0; r < e.length; r += t) n.push(e.slice(r, r + t));
8844
9048
  return n;
8845
9049
  }
8846
- function aa(e, t) {
9050
+ function wa(e, t) {
8847
9051
  return e.reduce((e, n) => {
8848
9052
  let r = t(n);
8849
9053
  return e[r] || (e[r] = []), e[r].push(n), e;
8850
9054
  }, {});
8851
9055
  }
8852
- function oa(e, t) {
9056
+ function Ta(e, t) {
8853
9057
  return e.every(t);
8854
9058
  }
8855
- function sa(e, t) {
9059
+ function Ea(e, t) {
8856
9060
  return e.some(t);
8857
9061
  }
8858
9062
  //#endregion
@@ -8860,7 +9064,7 @@ function sa(e, t) {
8860
9064
  function Q() {
8861
9065
  return globalThis.navigator?.userAgent ?? "";
8862
9066
  }
8863
- var ca = {
9067
+ var Da = {
8864
9068
  get isChrome() {
8865
9069
  return /Chrome\//.test(Q()) && !/Edg\//.test(Q());
8866
9070
  },
@@ -8885,17 +9089,19 @@ var ca = {
8885
9089
  get modifierKey() {
8886
9090
  return /Macintosh/.test(Q()) ? "metaKey" : "ctrlKey";
8887
9091
  }
8888
- }, la = { ...k }, $ = /* @__PURE__ */ new WeakMap(), ua = {
9092
+ }, Oa = { ...k }, $ = /* @__PURE__ */ new WeakMap(), ka = {
8889
9093
  create(e, t = {}) {
8890
- let n = da(e).map((e) => {
9094
+ let n = Aa(e).map((e) => {
8891
9095
  if ($.has(e)) return $.get(e);
8892
- let n = new Cn(e, t);
8893
- return n.initialize(), $.set(e, n), n;
9096
+ let n = new On(e, t);
9097
+ return n._releaseInstance = () => {
9098
+ $.get(e) === n && $.delete(e);
9099
+ }, n.initialize(), $.set(e, n), n;
8894
9100
  });
8895
9101
  return n.length === 1 ? n[0] : n;
8896
9102
  },
8897
9103
  destroy(e) {
8898
- da(e).forEach((e) => {
9104
+ Aa(e).forEach((e) => {
8899
9105
  let t = $.get(e);
8900
9106
  t && (t.destroy(), $.delete(e));
8901
9107
  });
@@ -8911,42 +9117,42 @@ var ca = {
8911
9117
  Object.assign(k, e);
8912
9118
  },
8913
9119
  resetDefaults() {
8914
- Object.keys(k).forEach((e) => delete k[e]), Object.assign(k, la);
9120
+ Object.keys(k).forEach((e) => delete k[e]), Object.assign(k, Oa);
8915
9121
  },
8916
9122
  registerModule(e, t) {
8917
- yn.set(e, t);
9123
+ wn.set(e, t);
8918
9124
  },
8919
9125
  use(e, t = {}) {
8920
9126
  if (!e || typeof e.name != "string") throw TypeError("[AutumnNote] AutumnNote.use: plugin must have a string `name` property.");
8921
- return Sn.has(e.name) ? (console.warn(`[AutumnNote] Plugin "${e.name}" already registered globally. Skipping.`), this) : (Array.isArray(e.buttons) && e.buttons.forEach((e) => lt(e)), Sn.set(e.name, {
9127
+ return Dn.has(e.name) ? (console.warn(`[AutumnNote] Plugin "${e.name}" already registered globally. Skipping.`), this) : (Array.isArray(e.buttons) && e.buttons.forEach((e) => pt(e)), Dn.set(e.name, {
8922
9128
  plugin: e,
8923
9129
  options: t
8924
9130
  }), this);
8925
9131
  },
8926
9132
  hasPlugin(e) {
8927
- return Sn.has(e);
9133
+ return Dn.has(e);
8928
9134
  },
8929
9135
  registerButton(e) {
8930
- return lt(e), this;
9136
+ return pt(e), this;
8931
9137
  },
8932
9138
  registerLocale(e, t) {
8933
- return $t(e, t), this;
9139
+ return rn(e, t), this;
8934
9140
  },
8935
9141
  registerSlashCommand(e) {
8936
9142
  if (!e?.id || typeof e.run != "function") throw TypeError("[AutumnNote] Slash command requires an id and run(context) function.");
8937
9143
  let t = k.slashCommands, n = t.findIndex((t) => t.id === e.id);
8938
9144
  return n >= 0 ? t[n] = e : t.push(e), this;
8939
9145
  },
8940
- buttons: Zt,
8941
- version: "2.5.0"
9146
+ buttons: tn,
9147
+ version: ga
8942
9148
  };
8943
- function da(e) {
9149
+ function Aa(e) {
8944
9150
  return typeof e == "string" ? Array.from(document.querySelectorAll(e)) : e instanceof Element ? [e] : e instanceof NodeList || Array.isArray(e) ? Array.from(e) : [];
8945
9151
  }
8946
9152
  //#endregion
8947
9153
  //#region src/js/index.js
8948
- xn(Zi);
9154
+ En(ha);
8949
9155
  //#endregion
8950
- export { Cn as Context, d as ELEMENT_NODE, Dr as SUPPORTED_LANGS, f as TEXT_NODE, ge as WrappedRange, ct as _buttonRegistry, vt as alignCenterBtn, bt as alignJustifyBtn, _t as alignLeftBtn, yt as alignRightBtn, oa as all, ne as ancestors, sa as any, Yt as backColorBtn, dt as boldBtn, Zt as buttons, Kt as checklistBtn, re as children, ia as chunk, e as clamp, S as closest, C as closestPara, Bt as codeviewBtn, be as collapsedRange, r as compose, w as createElement, ve as currentRange, t as debounce, ua as default, k as defaultOptions, Xt as defaultToolbar, jr as detectLang, It as directionBtn, jt as emojiBtn, ca as env, Ut as findBtn, Wt as findReplaceBtn, $i as first, na as flatten, Lt as fontFamilyBtn, Pt as fontSizeBtn, Jt as foreColorBtn, _e as fromNativeRange, Vt as fullscreenBtn, ut as getButton, aa as groupBy, Dt as hrBtn, jn as htmlToMarkdown, Mt as iconBtn, i as identity, kt as imageBtn, Ct as indentBtn, ea as initial, Gt 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, Vn as isMarkdown, F 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, ft as italicBtn, N as key, Qi as last, zt as lineHeightBtn, Ot as linkBtn, Qt as locales, he as makeDraggable, Yn as markdownToHTML, c as mergeDeep, ae as nextElement, le as nodeValue, St as olBtn, E as on, wt as outdentBtn, de as outerHtml, Rt as paragraphStyleBtn, fe as placeCaret, ie as prevElement, qt as printBtn, ye as rangeFromElement, u as rect2bnd, Et as redoBtn, lt as registerButton, $t as registerLocale, T as remove, Ft as removeFormatBtn, en as resolveLocale, j as sanitiseHTML, M as sanitiseUrl, Ht as shortcutsBtn, Ce as splitText, mt as strikeBtn, gt as subscriptBtn, ht as superscriptBtn, Nt as tableBtn, ta as tail, n as throttle, me as trapFocus, xt as ulBtn, pt as underlineBtn, Tt as undoBtn, ra as unique, oe as unwrap, At as videoBtn, Se as withSavedRange, se as wrap };
9156
+ export { On as Context, d as ELEMENT_NODE, Ur as SUPPORTED_LANGS, f as TEXT_NODE, _e as WrappedRange, ft as _buttonRegistry, St as alignCenterBtn, wt as alignJustifyBtn, xt as alignLeftBtn, Ct as alignRightBtn, Ta as all, ne as ancestors, Ea as any, $t as backColorBtn, ht as boldBtn, tn as buttons, Xt as checklistBtn, re as children, Ca as chunk, e as clamp, S as closest, C as closestPara, Wt as codeviewBtn, xe as collapsedRange, r as compose, w as createElement, ye as currentRange, t as debounce, ka as default, k as defaultOptions, en as defaultToolbar, qr as detectLang, Bt as directionBtn, Ft as emojiBtn, Da as env, qt as findBtn, Jt as findReplaceBtn, va as first, xa as flatten, Vt as fontFamilyBtn, Rt as fontSizeBtn, Qt as foreColorBtn, ve as fromNativeRange, Gt as fullscreenBtn, mt as getButton, wa as groupBy, jt as hrBtn, Kn as htmlToMarkdown, It as iconBtn, i as identity, Nt as imageBtn, Dt as indentBtn, ya as initial, Yt 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, me as isInsideEditable, P as isKey, _ as isLi, v as isList, nr as isMarkdown, F as isModifier, a as isNil, g as isPara, l as isPlainObject, Se as isSelectionInside, o as isString, y as isTable, m as isText, h as isVoid, gt as italicBtn, N as key, _a as last, Ut as lineHeightBtn, Mt as linkBtn, nn as locales, ge as makeDraggable, ur as markdownToHTML, c as mergeDeep, ae as nextElement, le as nodeValue, Et as olBtn, E as on, Ot as outdentBtn, de as outerHtml, Ht as paragraphStyleBtn, fe as placeCaret, ie as prevElement, Zt as printBtn, be as rangeFromElement, u as rect2bnd, At as redoBtn, pt as registerButton, rn as registerLocale, T as remove, zt as removeFormatBtn, pe as repairListNesting, an as resolveLocale, j as sanitiseHTML, vn as sanitiseToBody, M as sanitiseUrl, Kt as shortcutsBtn, we as splitText, vt as strikeBtn, bt as subscriptBtn, yt as superscriptBtn, Lt as tableBtn, ba as tail, n as throttle, he as trapFocus, Tt as ulBtn, _t as underlineBtn, kt as undoBtn, Sa as unique, oe as unwrap, Pt as videoBtn, Ce as withSavedRange, se as wrap };
8951
9157
 
8952
9158
  //# sourceMappingURL=autumnnote.es.js.map